User: user57  
  Date: 01/04/21 00:24:49

  Modified:    src/main/org/jboss/configuration ConfigurationService.java
                        ConfigurationServiceMBean.java
  Log:
   o Added autoTrim field, which when set to true will cause the value of
     and attribute to be trimmed prior to setting the value.
   o Added constructors to control this flag (no-arg constructor will set
     it to false, as is the current behavior).
  
  Revision  Changes    Path
  1.26      +46 -12    jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ConfigurationService.java 2001/04/21 06:00:38     1.25
  +++ ConfigurationService.java 2001/04/21 07:24:49     1.26
  @@ -45,14 +45,14 @@
    * @author  Rickard Öberg ([EMAIL PROTECTED])
    * @author  [EMAIL PROTECTED]
    * @author  Jason Dillon <a 
href="mailto:[EMAIL PROTECTED]">&lt;[EMAIL PROTECTED]&gt;</a>
  - * @version $Revision: 1.25 $
  + * @version $Revision: 1.26 $
    */
   public class ConfigurationService
      extends ServiceMBeanSupport
      implements ConfigurationServiceMBean
   {
  -   // Constants -----------------------------------------------------
  -    static Hashtable primitives = new Hashtable();
  +    // Constants -----------------------------------------------------
  +    private static Hashtable primitives = new Hashtable();
   
       static
       {
  @@ -63,22 +63,52 @@
           primitives.put("long",Long.TYPE);
       }
   
  -   // Attributes ----------------------------------------------------
  -    Log log = Log.createLog(getName());
  +    // Attributes ----------------------------------------------------
  +    private final Log log = Log.createLog(getName());
   
  -    MBeanServer server;
  -    ObjectName serviceControl;
  +    private MBeanServer server;
  +    private ObjectName serviceControl;
   
  -   // Static --------------------------------------------------------
  +    /** Flag to indicate if attribute values should be automatically trimmed. */
  +    private boolean autoTrim;
  +   
  +    // Static --------------------------------------------------------
  +
  +    // Constructors --------------------------------------------------
  +
  +    /**
  +     * Construct a <tt>ConfigurationService</tt>.
  +     *
  +     * @param autoTrim  True to enable auto-trimming of attribute values.
  +     */
  +    public ConfigurationService(final boolean autoTrim) {
  +        this.autoTrim = autoTrim;
  +    }
  +
  +    /**
  +     * Construct a <tt>ConfigurationService</tt> that will not auto-trim
  +     * attribute values.
  +     */
  +    public ConfigurationService() {
  +        this(false);
  +    }
  +   
  +    // Public --------------------------------------------------------
   
  -   // Constructors --------------------------------------------------
  +    /**
  +     * Get the attribute value auto-trim flag.
  +     *
  +     * @return  True if attribute values are auto-trimmed.
  +     */
  +    public boolean getAutoTrim() {
  +        return autoTrim;
  +    }
   
  -   // Public --------------------------------------------------------
       public ObjectName getObjectName(MBeanServer server, ObjectName name)
  -       throws javax.management.MalformedObjectNameException
  +        throws javax.management.MalformedObjectNameException
       {
           this.server = server;
  -       return new ObjectName(OBJECT_NAME);
  +        return new ObjectName(OBJECT_NAME);
       }
   
       public String getName()
  @@ -125,6 +155,10 @@
                       {
                           String attributeValue = 
((Text)attributeElement.getFirstChild()).getData();
   
  +                        if (autoTrim) {
  +                            attributeValue = attributeValue.trim();
  +                        }
  +                        
                           MBeanAttributeInfo[] attributes = info.getAttributes();
                           for (int k = 0; k < attributes.length; k++)
                           {
  
  
  
  1.5       +9 -1      
jboss/src/main/org/jboss/configuration/ConfigurationServiceMBean.java
  
  Index: ConfigurationServiceMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationServiceMBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigurationServiceMBean.java    2000/12/07 15:44:05     1.4
  +++ ConfigurationServiceMBean.java    2001/04/21 07:24:49     1.5
  @@ -12,7 +12,7 @@
    *      
    *   @see <related>
    *   @author Rickard Öberg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
   public interface ConfigurationServiceMBean
   {
  @@ -20,6 +20,14 @@
      public static final String OBJECT_NAME = ":service=Configuration";
       
      // Public --------------------------------------------------------
  +
  +    /**
  +     * Get the attribute value auto-trim flag.
  +     *
  +     * @return  True if attribute values are auto-trimmed.
  +     */
  +    boolean getAutoTrim();
  +   
        public void load(org.w3c.dom.Document conf)
                throws Exception;
                
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to