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/deployment/plan CreateMBeanInstance.java
Date Wed, 20 Aug 2003 22:38:24 GMT
dain        2003/08/20 15:38:24

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/plan
                        CreateMBeanInstance.java
  Log:
  Added code to make File, URI and URL constructor arguments relative to the baseURI of
  the deployment unit.
  
  Revision  Changes    Path
  1.8       +23 -2     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java
  
  Index: CreateMBeanInstance.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CreateMBeanInstance.java	18 Aug 2003 22:03:38 -0000	1.7
  +++ CreateMBeanInstance.java	20 Aug 2003 22:38:24 -0000	1.8
  @@ -62,6 +62,11 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Set;
  +import java.net.URL;
  +import java.net.URI;
  +import java.net.MalformedURLException;
  +import java.net.URISyntaxException;
  +import java.io.File;
   import javax.management.InstanceAlreadyExistsException;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanException;
  @@ -92,13 +97,15 @@
       private final Log log = LogFactory.getLog(this.getClass());
       private final MBeanServer server;
       private final MBeanMetadata metadata;
  +    private final URI baseURI;
       private final DependencyServiceMBean dependencyService;
       private final RelationServiceMBean relationService;
       private ObjectName actualName;
   
  -    public CreateMBeanInstance(MBeanServer server, MBeanMetadata metadata) {
  +    public CreateMBeanInstance(MBeanServer server, MBeanMetadata metadata) throws DeploymentException
{
           this.server = server;
           this.metadata = metadata;
  +        this.baseURI = metadata.getBaseURI();
           dependencyService = JMXUtil.getDependencyService(server);
           relationService = JMXUtil.getRelationService(server);
       }
  @@ -251,6 +258,20 @@
       private static final Class[] stringArg = new Class[]{String.class};
   
       private Object getValue(ClassLoader cl, String typeName, String value) throws DeploymentException
{
  +        if("java.net.URI".equals(typeName)) {
  +            return baseURI.resolve(value);
  +        }
  +        if("java.net.URL".equals(typeName)) {
  +            try {
  +                return baseURI.resolve(value).toURL();
  +            } catch (MalformedURLException e) {
  +                throw new DeploymentException(e);
  +            }
  +        }
  +        if("java.io.File".equals(typeName)) {
  +            return new File(baseURI.resolve(value));
  +        }
  +
           Class attrType = null;
           try {
               attrType = ClassUtil.getClassForName(cl, typeName);
  
  
  

Mime
View raw message