Author: sebb
Date: Sat Apr 29 05:11:09 2006
New Revision: 398129

URL: http://svn.apache.org/viewcvs?rev=398129&view=rev
Log:
Make alias names public

Modified:
    
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java

Modified: 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java?rev=398129&r1=398128&r2=398129&view=diff
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
 Sat Apr 29 05:11:09 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005,2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,27 +26,42 @@
  */
 public class HTTPSamplerFactory {
 
-       private static final String HTTP_SAMPLER = "HTTPSampler"; //$NON-NLS-1$
+    /** Use the the default Java HTTP implementation */
+       public static final String HTTP_SAMPLER_JAVA = "HTTPSampler"; 
//$NON-NLS-1$
 
-       private static final String HTTP_SAMPLER_APACHE = "HTTPSampler2"; 
//$NON-NLS-1$
+    /** Use Apache HTTPClient HTTP implementation */
+       public static final String HTTP_SAMPLER_APACHE = "HTTPSampler2"; 
//$NON-NLS-1$
 
-       private static final String DEFAULT_CLASSNAME = 
JMeterUtils.getPropDefault("jmeter.httpsampler", HTTP_SAMPLER); //$NON-NLS-1$
+       public static final String DEFAULT_CLASSNAME = 
+        JMeterUtils.getPropDefault("jmeter.httpsampler", HTTP_SAMPLER_JAVA); 
//$NON-NLS-1$
 
        private HTTPSamplerFactory() {
                // Not intended to be instantiated
        }
 
+    /**
+     * Create a new instance of the default sampler
+     * 
+     * @return instance of default sampler
+     */
        public static HTTPSamplerBase newInstance() {
                return newInstance(DEFAULT_CLASSNAME);
        }
 
-       public static HTTPSamplerBase newInstance(String classname) {
-               if (classname.equals(HTTP_SAMPLER)) {
+    /**
+     * Create a new instance of the required sampler type
+     * 
+     * @param alias HTTP_SAMPLER or HTTP_SAMPLER_APACHE
+     * @return the appropriate sampler
+     * @throws UnsupportedOperationException if alias is not recognised
+     */
+       public static HTTPSamplerBase newInstance(String alias) {
+               if (alias.equals(HTTP_SAMPLER_JAVA)) {
                        return new HTTPSampler();
                }
-               if (classname.equals(HTTP_SAMPLER_APACHE)) {
+               if (alias.equals(HTTP_SAMPLER_APACHE)) {
                        return new HTTPSampler2();
                }
-               throw new UnsupportedOperationException("Cannot create class: " 
+ classname);
+               throw new UnsupportedOperationException("Cannot create class: " 
+ alias);
        }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to