User: user57  
  Date: 02/02/11 19:22:03

  Added:       src/main/org/jboss/util SafeObjectNameFactory.java
  Log:
   o Adding SafeObjectFactory, which simply makes ObjectNames and
     turns ant malformed exceptions into Errors.  This is used to
     create ObjectName OBJECT_NAME fields, so we don't have to keep
     creating new ObjectNames all the time.
   o MainDeployer & ServiceController use new ObjectName OBJECT_NAME
   o Updated refering classes to not wrap OBJECT_NAME with new ObjectName
   o Using MBeanProxy to talk to ServiceController (and MainDeployer
     in some areas).  MBeanProxy is a central location to put in that
     pesky JMX exception handling + is tidies up the code base.  Can
     evevntually optimize this to make it veru efficient too.
   o Putting org.jboss.util classes into lib/ext/jboss-util.jar and adding
     it to the bootlibraries, so that the core system components have access
     to these when loading (not just when running, aka after
     jboss-service.xml loads).
   * Need to clean up jboss-util, move deployable stuff out of it and such
     (they don't really belong there).
   o updated modules that needed util, to include jboss-util.jar in there
     external module config
  
  Revision  Changes    Path
  1.1                  jboss/src/main/org/jboss/util/SafeObjectNameFactory.java
  
  Index: SafeObjectNameFactory.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.util;
  
  import java.util.Hashtable;
  
  import javax.management.MalformedObjectNameException;
  import javax.management.ObjectName;
  
  /**
   * A simple factory for creating safe object names.  A safe object name
   * will not throw malforumed exceptions.  Any such exceptions will 
   * be translated into errors.
   *      
   * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
   * @version $Revision: 1.1 $
   */
  public class SafeObjectNameFactory
  {
     public static ObjectName create(String name) {
        try {
         return new ObjectName(name);
        }
        catch (MalformedObjectNameException e) {
         throw new Error("Invalid ObjectName: " + name + "; " + e);
        }
     }
  
     public static ObjectName create(String domain, String key, String value) {
        try {
         return new ObjectName(domain, key, value);
        }
        catch (MalformedObjectNameException e) {
         throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + 
"; " + e);
        }
     }
  
     public static ObjectName create(String domain, Hashtable table) {
        try {
         return new ObjectName(domain, table);
        }
        catch (MalformedObjectNameException e) {
         throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
        }
     }
  }
  
  
  

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

Reply via email to