001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.tool.properties;
018
019import java.io.File;
020import java.util.HashSet;
021import java.util.Set;
022
023public class JmsClientSystemProperties extends AbstractObjectProperties {
024    
025    public static final String DEST_DISTRO_ALL    = "all";    // Each client will send/receive to all destination;
026    public static final String DEST_DISTRO_EQUAL  = "equal";  // Equally divide the number of destinations to the number of clients
027    public static final String DEST_DISTRO_DIVIDE = "divide"; // Divide the destination among the clients, even if some have more destination than others
028
029    public static final String REPORT_VERBOSE  = "verbose"; // Report would be generated to the console
030    public static final String REPORT_XML_FILE = "xml"; // Report would be generated to an xml file
031
032    public static final String SAMPLER_TP  = "tp";
033    public static final String SAMPLER_CPU = "cpu";
034
035    protected File propsConfigFile;
036
037    protected String reportType = REPORT_XML_FILE;
038    protected String reportDir  = "./";
039    protected String reportName;
040
041    protected String samplers = SAMPLER_TP + "," + SAMPLER_CPU; // Start both samplers
042
043    protected String spiClass = "org.apache.activemq.tool.spi.ActiveMQReflectionSPI";
044    protected String clientPrefix = "JmsClient";
045    protected int numClients = 1;
046    protected int totalDests = 1;
047    protected String destDistro = DEST_DISTRO_ALL;
048
049    public String getReportType() {
050        return reportType;
051    }
052
053    public void setReportType(String reportType) {
054        this.reportType = reportType;
055    }
056
057    public String getReportDir() {
058        return reportDir;
059    }
060
061    public void setReportDir(String reportDir) {
062        this.reportDir = reportDir;
063    }
064
065    public String getReportName() {
066        return reportName;
067    }
068
069    public void setReportName(String reportName) {
070        this.reportName = reportName;
071    }
072
073    public String getSamplers() {
074        return samplers;
075    }
076
077    public Set<String> getSamplersSet() {
078        Set<String> samplersSet = new HashSet<>();
079        for (String sampler : samplers.split(",")) {
080            samplersSet.add(sampler.trim());
081        }
082        return samplersSet;
083    }
084
085    public void setSamplers(String samplers) {
086        this.samplers = samplers;
087    }
088
089    public String getSpiClass() {
090        return spiClass;
091    }
092
093    public void setSpiClass(String spiClass) {
094        this.spiClass = spiClass;
095    }
096
097    public String getClientPrefix() {
098        return clientPrefix;
099    }
100
101    public void setClientPrefix(String clientPrefix) {
102        this.clientPrefix = clientPrefix;
103    }
104
105    public int getNumClients() {
106        return numClients;
107    }
108
109    public void setNumClients(int numClients) {
110        this.numClients = numClients;
111    }
112
113    public int getTotalDests() {
114        return totalDests;
115    }
116
117    public void setTotalDests(int totalDests) {
118        this.totalDests = totalDests;
119    }
120
121    public String getDestDistro() {
122        return destDistro;
123    }
124
125    public void setDestDistro(String destDistro) {
126        this.destDistro = destDistro;
127    }
128
129    public String getPropsConfigFile() {
130        return this.propsConfigFile + "";
131    }
132
133    public void setPropsConfigFile(String propsConfigFile) {
134        this.propsConfigFile = new File(propsConfigFile);
135    }
136}