You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by cr...@apache.org on 2002/01/25 01:32:44 UTC

cvs commit: jakarta-commons-sandbox/modeler/src/java/org/apache/commons/modeler Registry.java

craigmcc    02/01/24 16:32:44

  Modified:    modeler  STATUS.html
               modeler/src/java/org/apache/commons/modeler Registry.java
  Log:
  Declare our dependence on the commons-logging APIs, and use them in the
  Registry class.
  
  Revision  Changes    Path
  1.5       +2 -1      jakarta-commons-sandbox/modeler/STATUS.html
  
  Index: STATUS.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/modeler/STATUS.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- STATUS.html	16 Jan 2002 01:11:58 -0000	1.4
  +++ STATUS.html	25 Jan 2002 00:32:44 -0000	1.5
  @@ -7,7 +7,7 @@
   
   <div align="center">
   <h1>The Jakarta Commons <em>Workflow</em> Component</h1>
  -$Id: STATUS.html,v 1.4 2002/01/16 01:11:58 remm Exp $<br>
  +$Id: STATUS.html,v 1.5 2002/01/25 00:32:44 craigmcc Exp $<br>
   <a href="#Introduction">[Introduction]</a>
   <a href="#Dependencies">[Dependencies]</a>
   <a href="#Release Info">[Release Info]</a>
  @@ -36,6 +36,7 @@
   <li><a href="http://jakarta.apache.org/commons/beanutils/">Jakarta Commons BeanUtils</a></li>
   <li><a href="http://jakarta.apache.org/commons/collections/">Jakarta Commons Collections</a></li>
   <li><a href="http://jakarta.apache.org/commons/digester"/>Jakarta Commons Digester</a></li>
  +<li><a href="http://jakarta.apache.org/commons/logging"/>Jakarta Commons Logging</a></li>
   <li>A JMX compliant implementation, like the <a href="http://java.sun.com/products/JavaManagement/download.html">JMX Instrumentation and Agent Specification reference implementation</a> or <a href="http://www.open-jmx.org">OpenJMX</a></li>
   </ul>
   
  
  
  
  1.5       +26 -25    jakarta-commons-sandbox/modeler/src/java/org/apache/commons/modeler/Registry.java
  
  Index: Registry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/modeler/src/java/org/apache/commons/modeler/Registry.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Registry.java	30 Oct 2001 17:19:38 -0000	1.4
  +++ Registry.java	25 Jan 2002 00:32:44 -0000	1.5
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/modeler/src/java/org/apache/commons/modeler/Registry.java,v 1.4 2001/10/30 17:19:38 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/10/30 17:19:38 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/modeler/src/java/org/apache/commons/modeler/Registry.java,v 1.5 2002/01/25 00:32:44 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/01/25 00:32:44 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -74,6 +74,8 @@
   import javax.management.MBeanServer;
   import javax.management.MBeanServerFactory;
   import org.apache.commons.digester.Digester;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogSource;
   
   
   /**
  @@ -86,7 +88,7 @@
    * synchronized.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/10/30 17:19:38 $
  + * @version $Revision: 1.5 $ $Date: 2002/01/25 00:32:44 $
    */
   
   public final class Registry {
  @@ -115,21 +117,10 @@
       private HashMap beans = new HashMap();
   
   
  -    // ------------------------------------------------------------- Properties
  -
  -
       /**
  -     * The debugging detail level for our Digester instance.
  +     * The Log instance to which we will write our log messages.
        */
  -    private static int debug = 0;
  -
  -    public static int getDebug() {
  -        return (debug);
  -    }
  -
  -    public static void setDebug(int newDebug) {
  -        debug = newDebug;
  -    }
  +    private static Log log = LogSource.getInstance(Registry.class);
   
   
       // --------------------------------------------------------- Public Methods
  @@ -180,15 +171,15 @@
        */
       public String[] findManagedBeans(String group) {
   
  -
           ArrayList results = new ArrayList();
           Iterator items = beans.values().iterator();
           while (items.hasNext()) {
               ManagedBean item = (ManagedBean) items.next();
  -            if ((group == null) && (item.getGroup() == null))
  +            if ((group == null) && (item.getGroup() == null)) {
                   results.add(item.getName());
  -            else if (group.equals(item.getGroup()))
  +            } else if (group.equals(item.getGroup())) {
                   results.add(item.getName());
  +            }
           }
           String values[] = new String[results.size()];
           return ((String[]) results.toArray(values));
  @@ -234,8 +225,10 @@
        */
       public synchronized static Registry getRegistry() {
   
  -        if (registry == null)
  +        if (registry == null) {
  +            log.info("Creating new Registry instance");
               registry = new Registry();
  +        }
           return (registry);
   
       }
  @@ -247,8 +240,10 @@
        */
       public synchronized static MBeanServer getServer() {
   
  -        if (server == null)
  +        if (server == null) {
  +            log.info("Creating MBeanServer");
               server = MBeanServerFactory.createMBeanServer();
  +        }
           return (server);
   
       }
  @@ -266,10 +261,11 @@
       public static void loadRegistry(InputStream stream)
           throws Exception {
   
  +        log.info("Loading registry information");
  +
           // Create a digester to use for parsing
           Registry registry = getRegistry();
           Digester digester = new Digester();
  -        digester.setDebug(debug);
           digester.setNamespaceAware(false);
           digester.setValidating(true);
           URL url = registry.getClass().getResource
  @@ -356,7 +352,12 @@
                 "org.apache.commons.modeler.ParameterInfo");
   
           // Process the input file to configure our registry
  -        digester.parse(stream);
  +        try {
  +            digester.parse(stream);
  +        } catch (Exception e) {
  +            log.error("Error digesting Registry data", e);
  +            throw e;
  +        }
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>