juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svi...@apache.org
Subject cvs commit: ws-juddi/src/java/org/apache/juddi/monitor MonitorFactory.java
Date Thu, 03 Jun 2004 02:36:40 GMT
sviens      2004/06/02 19:36:40

  Modified:    src/java/org/apache/juddi/transport/axis AxisProcessor.java
               src/java/org/apache/juddi/monitor MonitorFactory.java
  Log:
  Eliminated the use of the 'juddi.useMonitor' property.
  
  Revision  Changes    Path
  1.6       +6 -11     ws-juddi/src/java/org/apache/juddi/transport/axis/AxisProcessor.java
  
  Index: AxisProcessor.java
  ===================================================================
  RCS file: /home/cvs/ws-juddi/src/java/org/apache/juddi/transport/axis/AxisProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AxisProcessor.java	30 May 2004 11:39:39 -0000	1.5
  +++ AxisProcessor.java	3 Jun 2004 02:36:40 -0000	1.6
  @@ -51,22 +51,17 @@
     // jUDDI XML Handler maker
     private static HandlerMaker maker = HandlerMaker.getInstance();
   
  -  // jUDDI Monitor switch
  -  private static boolean useMonitor = Config.getBooleanProperty("juddi.useMonitor",false);
  -
  -
     /**
      * @param soapResponse
      * @param messageContext
      */
     public AxisProcessor(Message soapResponse,MessageContext messageContext)
     {
  -    // get a new monitor from the MonitorFactory and
  -    // inspect the MessageContext
  -
  -    Monitor monitor = null;
  -    if (useMonitor == true)
  -      monitor = MonitorFactory.getMonitor();
  +    // get a new monitor from the MonitorFactory
  +    
  +    Monitor monitor = MonitorFactory.getMonitor();
  +    
  +    // if monitoring is turned on inspect the MessageContext
   
       if (monitor != null)
         monitor.inspectMessageContext(messageContext);
  @@ -171,7 +166,7 @@
   
         RegistryObject uddiResponse = null;
         
  -      RegistryEngine registry = RegistryServlet.getInstance();
  +      RegistryEngine registry = RegistryServlet.getRegistry();
         if ((registry != null) && (registry.isAvailable()))
           uddiResponse = registry.execute(uddiRequest);
         else
  
  
  
  1.3       +38 -33    ws-juddi/src/java/org/apache/juddi/monitor/MonitorFactory.java
  
  Index: MonitorFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-juddi/src/java/org/apache/juddi/monitor/MonitorFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MonitorFactory.java	11 Mar 2004 18:06:21 -0000	1.2
  +++ MonitorFactory.java	3 Jun 2004 02:36:40 -0000	1.3
  @@ -21,13 +21,17 @@
   import org.apache.juddi.util.Loader;
   
   /**
  - * @author Anou Mana (anou_mana@users.sourceforge.net)
  + * @author Anou Mana (anou_mana@apache.org)
    */
  -public  class MonitorFactory
  +public class MonitorFactory
   {
     // private reference to the jUDDI logger
     private static Log log = LogFactory.getLog(MonitorFactory.class);
   
  +  // Monitor property key & default implementation
  +  private static final String IMPL_KEY = "juddi.monitor";
  +  private static final String DEFAULT_IMPL = "org.apache.juddi.monitor.jdbc.JDBCMonitor";
  +
     private static Class monitorClass = null;
   
     /**
  @@ -37,56 +41,57 @@
      */
     public static Monitor getMonitor()
     {
  -  //see if monitor is needed
  -  String needsMonitor = Config.getMonitor();
  -
  -  Monitor monitor = null;
  +    Monitor monitor = null;
   
  -  if(needsMonitor.equals("true"))
  -  {
  -      getMonitorClass();
  -
  -    if(monitorClass != null)
  +    // Determine if monitor is needed. This is done by 
  +    // looking for the existance of a "juddi.monitor" 
  +    // property value.  If a value exists and it's not 
  +    // equal to null then the registry will be monitoring
  +    // http traffic/requests.
  +    
  +    String needsMonitor = Config.getStringProperty(IMPL_KEY,null);
  +    if (needsMonitor != null)
       {
  -        try
  -      {
  -        // try to instantiate the Monitor
  -        monitor = (Monitor)monitorClass.newInstance();
  -      }
  -      catch(java.lang.Exception e)
  +      getMonitorClass();
  +  
  +      if (monitorClass != null)
         {
  -        log.error("Exception while attempting to instantiate subclass of " +
  -        "Monitor: " + "\n" + e.getMessage());
  -        log.error(e);
  +        try
  +        {
  +          // try to instantiate the Monitor
  +          monitor = (Monitor)monitorClass.newInstance();
  +        }
  +        catch(java.lang.Exception ex)
  +        {
  +          log.error("Exception while attempting to instantiate subclass " +
  +                      "of Monitor: " + "\n" + ex.getMessage(),ex);
  +        }
         }
       }
  -  }
  +    
       return monitor;
     }
   
  -
  -  private  static synchronized void getMonitorClass()
  +  private static synchronized void getMonitorClass()
     {
  -    if(monitorClass == null)
  +    if (monitorClass == null)
       {
  -        // obtain the name of the DefaultMonitor to create
  -      String className = Config.getMonitorClass();
  +      // Obtain the class name of the Monitor to create
  +      String className = Config.getStringProperty(IMPL_KEY,DEFAULT_IMPL);
   
  -      // write DefaultMonitor Property to the log for good measure
  +      // Write Monitor property to the log for good measure
         log.debug(className);
   
         try
         {
  -        // instruct class loader to load the Monitor
  +        // Instruct class loader to load the Monitor
           monitorClass = Loader.getClassForName(className);
         }
  -      catch(ClassNotFoundException e)
  +      catch(ClassNotFoundException cnfex)
         {
  -        log.error("The specified DefaultMonitor class '" + className +
  -          "' was not found in classpath.");
  -        log.error(e);
  +        log.error("The specified Monitor class '" + className +
  +          "' was not found in classpath.",cnfex);
         }
       }
     }
  -
   }
  
  
  

Mime
View raw message