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/core/src/java/org/apache/geronimo/jmx Relationship.java JMXUtil.java RelationshipMBean.java
Date Sat, 16 Aug 2003 23:16:55 GMT
dain        2003/08/16 16:16:55

  Modified:    modules/core/src/java/org/apache/geronimo/jmx
                        Relationship.java JMXUtil.java
                        RelationshipMBean.java
  Log:
  Initial revision of deployment dependency management system.
  
  Revision  Changes    Path
  1.4       +17 -34    incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/Relationship.java
  
  Index: Relationship.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/Relationship.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Relationship.java	13 Aug 2003 21:17:28 -0000	1.3
  +++ Relationship.java	16 Aug 2003 23:16:55 -0000	1.4
  @@ -55,25 +55,22 @@
    */
   package org.apache.geronimo.jmx;
   
  -import javax.management.MBeanRegistration;
  -import javax.management.ObjectName;
  -import javax.management.MBeanServer;
  -import javax.management.relation.RoleInfo;
   import javax.management.relation.RelationServiceMBean;
   import javax.management.relation.RelationServiceNotRegisteredException;
   import javax.management.relation.RelationTypeNotFoundException;
  +import javax.management.relation.RoleInfo;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.geronimo.common.AbstractStateManageable;
   
   /**
    *
    *
    * @version $Revision$ $Date$
    */
  -public class Relationship implements MBeanRegistration, RelationshipMBean{
  +public class Relationship extends AbstractStateManageable implements RelationshipMBean
{
       private final Log log = LogFactory.getLog(getClass());
  -    private MBeanServer server;
   
       private String name;
   
  @@ -95,25 +92,21 @@
       private int rightRoleMaximum = RoleInfo.ROLE_CARDINALITY_INFINITY;
       private String rightRoleDescription;
   
  -    public ObjectName preRegister(MBeanServer server, ObjectName objectName) throws Exception
{
  -        if(objectName == null) {
  -            // we have no way to generate a logical default name
  -            throw new IllegalArgumentException("Name cannot be null");
  -        }
  -        this.server = server;
  -        return objectName;
  -    }
  -
  -    public void postRegister(Boolean aBoolean) {
  -    }
  -
       public void preDeregister() throws Exception {
  +        RelationServiceMBean relationService = JMXUtil.getRelationService(server);
  +        try {
  +            relationService.removeRelationType(name);
  +        } catch (IllegalArgumentException e) {
  +            log.warn("Could not remove relation type: name=" + name, e);
  +        } catch (RelationServiceNotRegisteredException e) {
  +            log.warn("Could not remove relation type: name=" + name, e);
  +        } catch (RelationTypeNotFoundException e) {
  +            log.warn("Could not remove relation type: name=" + name, e);
  +        }
  +        super.preDeregister();
       }
   
  -    public void postDeregister() {
  -    }
  -
  -    public void create() throws Exception {
  +    public void doStart() throws Exception {
           RelationServiceMBean relationService = JMXUtil.getRelationService(server);
           RoleInfo[] roleInfo = {
               new RoleInfo(leftRoleName, leftRoleClass, leftRoleReadable, leftRoleWritable,
leftRoleMinimum, leftRoleMaximum, leftRoleDescription),
  @@ -123,17 +116,7 @@
           relationService.createRelationType(name, roleInfo);
       }
   
  -    public void destroy() {
  -        RelationServiceMBean relationService = JMXUtil.getRelationService(server);
  -        try {
  -            relationService.removeRelationType(name);
  -        } catch (IllegalArgumentException e) {
  -            log.warn("Could not remove relation type: name=" + name, e);
  -        } catch (RelationServiceNotRegisteredException e) {
  -            log.warn("Could not remove relation type: name=" + name, e);
  -        } catch (RelationTypeNotFoundException e) {
  -            log.warn("Could not remove relation type: name=" + name, e);
  -        }
  +    public void doStop() throws Exception {
       }
   
       public String getName() {
  
  
  
  1.3       +12 -2     incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/JMXUtil.java
  
  Index: JMXUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/JMXUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JMXUtil.java	11 Aug 2003 17:59:12 -0000	1.2
  +++ JMXUtil.java	16 Aug 2003 23:16:55 -0000	1.3
  @@ -60,6 +60,8 @@
   import javax.management.ObjectName;
   import javax.management.relation.RelationServiceMBean;
   
  +import org.apache.geronimo.deployment.dependency.DependencyServiceMBean;
  +
   /**
    * Helper class for JMX Operations
    *
  @@ -67,9 +69,13 @@
    * @version $Revision$ $Date$
    */
   public class JMXUtil {
  +    private JMXUtil() {
  +    }
  +
       /** the ObjectName of the MBeanServerDelegate */
       public static final ObjectName DELEGATE_NAME = getObjectName("JMImplementation:type=MBeanServerDelegate");
       public static final ObjectName RELATION_SERVICE_NAME = getObjectName("geronimo.boot:role=RelationService");
  +    public static final ObjectName DEPENDENCY_SERVICE_NAME = getObjectName("geronimo.boot:role=DependencyService");
   
       /**
        * Convert a String to an ObjectName
  @@ -86,6 +92,10 @@
       }
   
       public static RelationServiceMBean getRelationService(MBeanServer server) {
  -        return (RelationServiceMBean) MBeanProxyFactory.getProxy(RelationServiceMBean.class,
server, JMXUtil.RELATION_SERVICE_NAME);
  +        return (RelationServiceMBean) MBeanProxyFactory.getProxy(RelationServiceMBean.class,
server, RELATION_SERVICE_NAME);
  +    }
  +
  +    public static DependencyServiceMBean getDependencyService(MBeanServer server) {
  +        return (DependencyServiceMBean) MBeanProxyFactory.getProxy(DependencyServiceMBean.class,
server, DEPENDENCY_SERVICE_NAME);
       }
   }
  
  
  
  1.2       +4 -6      incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/RelationshipMBean.java
  
  Index: RelationshipMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/jmx/RelationshipMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RelationshipMBean.java	12 Aug 2003 23:26:15 -0000	1.1
  +++ RelationshipMBean.java	16 Aug 2003 23:16:55 -0000	1.2
  @@ -55,16 +55,14 @@
    */
   package org.apache.geronimo.jmx;
   
  +import org.apache.geronimo.common.StateManageable;
  +
   /**
    * 
    * 
    * @version $Revision$ $Date$
    */
  -public interface RelationshipMBean {
  -    void create() throws Exception;
  -
  -    void destroy();
  -
  +public interface RelationshipMBean extends StateManageable {
       String getName();
   
       void setName(String name);
  
  
  

Mime
View raw message