geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBeanInfoXMLLoader.java
Date Thu, 06 Nov 2003 19:54:39 GMT
dain        2003/11/06 11:54:39

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBeanInfoXMLLoader.java
  Log:
  Added code to load endpoints.
  
  Revision  Changes    Path
  1.3       +57 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfoXMLLoader.java
  
  Index: GeronimoMBeanInfoXMLLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfoXMLLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoMBeanInfoXMLLoader.java	24 Oct 2003 22:37:00 -0000	1.2
  +++ GeronimoMBeanInfoXMLLoader.java	6 Nov 2003 19:54:39 -0000	1.3
  @@ -63,6 +63,8 @@
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
  +import javax.management.ObjectName;
  +import javax.management.MalformedObjectNameException;
   
   import org.apache.geronimo.kernel.deployment.DeploymentException;
   import org.apache.geronimo.kernel.deployment.service.XMLUtil;
  @@ -126,6 +128,7 @@
           loadAttributes(mbeanElement, mbeanInfo);
           loadOperations(mbeanElement, mbeanInfo);
           loadNotifications(mbeanElement, mbeanInfo);
  +        loadEndpoints(mbeanElement, mbeanInfo);
   
           return mbeanInfo;
       }
  @@ -296,5 +299,58 @@
           }
   
           return notificationInfo;
  +    }
  +
  +    public static void loadEndpoints(Element mbeanElement, GeronimoMBeanInfo mbeanInfo)
{
  +        NodeList nl = mbeanElement.getElementsByTagName("endpoint");
  +        for (int i = 0; i < nl.getLength(); i++) {
  +            Element notificationElement = (Element) nl.item(i);
  +            mbeanInfo.addEndpoint(loadEndpoint(notificationElement));
  +        }
  +    }
  +
  +    public static GeronimoMBeanEndpoint loadEndpoint(Element endpointElement) {
  +        GeronimoMBeanEndpoint endpoint = new GeronimoMBeanEndpoint();
  +
  +        endpoint.setName(endpointElement.getAttribute("name"));
  +        endpoint.setName(endpointElement.getAttribute("type"));
  +        endpoint.setDescription(endpointElement.getAttribute("description"));
  +
  +        String targetName = endpointElement.getAttribute("targetName");
  +        if (targetName == null || targetName.length() == 0) {
  +            targetName = "default";
  +        }
  +        endpoint.setTargetName(targetName);
  +
  +        String requriedString = endpointElement.getAttribute("required");
  +        if (requriedString == null || requriedString.length() == 0) {
  +            endpoint.setRequired(false);
  +        } else {
  +            if (requriedString.equalsIgnoreCase("true") || requriedString.equals("1"))
{
  +                endpoint.setRequired(true);
  +            } else {
  +                endpoint.setRequired(false);
  +            }
  +        }
  +
  +        String setterName = endpointElement.getAttribute("setterName");
  +        if (setterName != null && setterName.length() > 0) {
  +            endpoint.setSetterName(setterName);
  +        }
  +
  +
  +        NodeList nl = endpointElement.getElementsByTagName("peer");
  +        for (int i = 0; i < nl.getLength(); i++) {
  +            final Element peerElement = (Element) nl.item(i);
  +            final String patternString = peerElement.getAttribute("pattern");
  +            try {
  +                ObjectName pattern = new ObjectName(patternString);
  +                endpoint.addPeer(pattern);
  +            } catch (MalformedObjectNameException e) {
  +                throw new IllegalArgumentException("Invalid object name pattern: pattern"
+ patternString);
  +            }
  +        }
  +
  +        return endpoint;
       }
   }
  
  
  

Mime
View raw message