geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/jmx JMXReferenceFactory.java
Date Thu, 12 Feb 2004 08:18:21 GMT
djencks     2004/02/12 00:18:21

  Modified:    modules/core project.xml
               modules/core/src/java/org/apache/geronimo/naming/java
                        ComponentContextBuilder.java ReferenceFactory.java
               modules/core/src/java/org/apache/geronimo/naming/jmx
                        JMXReferenceFactory.java
  Log:
  move jndi towards xmlbeans.  most of jndi is disabled at the moment waiting for geronimo
jndi schema.
  
  Revision  Changes    Path
  1.43      +19 -1     incubator-geronimo/modules/core/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/project.xml,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- project.xml	11 Feb 2004 03:14:10 -0000	1.42
  +++ project.xml	12 Feb 2004 08:18:21 -0000	1.43
  @@ -26,6 +26,16 @@
   
       <dependencies>
   
  +        <!-- needed for xmlbeans runtime-->
  +        <dependency>
  +            <groupId>xmlbeans</groupId>
  +            <artifactId>xbean-apache</artifactId>
  +            <version>1.0-DEV</version>
  +            <properties>
  +            </properties>
  +        </dependency>
  +
  +
           <dependency>
               <id>commons-logging</id>
               <version>1.0.3</version>
  @@ -61,6 +71,14 @@
               <version>DEV</version>
               <properties>
                   <module>true</module>
  +            </properties>
  +        </dependency>
  +
  +        <dependency>
  +            <groupId>geronimo-spec</groupId>
  +            <artifactId>geronimo-spec-j2eeschema</artifactId>
  +            <version>DEV</version>
  +            <properties>
               </properties>
           </dependency>
   
  
  
  
  1.13      +31 -33    incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
  
  Index: ComponentContextBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ComponentContextBuilder.java	22 Jan 2004 08:10:26 -0000	1.12
  +++ ComponentContextBuilder.java	12 Feb 2004 08:18:21 -0000	1.13
  @@ -62,12 +62,11 @@
   import javax.naming.Reference;
   import javax.transaction.UserTransaction;
   
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbLocalRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.JNDIEnvironmentRefs;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceRef;
  -import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
   import org.apache.geronimo.deployment.DeploymentException;
  +import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType;
  +import org.apache.geronimo.xbeans.j2ee.EjbRefType;
  +import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
  +import org.apache.geronimo.xbeans.j2ee.ResourceRefType;
   
   /**
    *
  @@ -88,15 +87,14 @@
       /**
        * Build a component context from definitions contained in POJOs read from
        * a deployment descriptor.
  -     * @param refs the source reference definitions
        * @return a Context that can be bound to java:comp
        */
  -    public ReadOnlyContext buildContext(JNDIEnvironmentRefs refs) throws DeploymentException
{
  +    public ReadOnlyContext buildContext(EjbRefType[] ejbRefs, EjbLocalRefType[] ejbLocalRefs,
EnvEntryType[] envEntries, ResourceRefType[] resourceRefs) throws DeploymentException {
           ReadOnlyContext readOnlyContext = new ReadOnlyContext();
  -        buildEnvEntries(readOnlyContext, refs.getEnvEntry());
  -        buildEJBRefs(readOnlyContext, refs.getGeronimoEJBRef());
  -        buildEJBLocalRefs(readOnlyContext, refs.getGeronimoEJBLocalRef());
  -        buildResourceRefs(readOnlyContext, refs.getGeronimoResourceRef());
  +        buildEnvEntries(readOnlyContext, envEntries);
  +        buildEJBRefs(readOnlyContext, ejbRefs);
  +        buildEJBLocalRefs(readOnlyContext, ejbLocalRefs);
  +        buildResourceRefs(readOnlyContext, resourceRefs);
   
           if (userTransaction != null) {
               try {
  @@ -108,12 +106,12 @@
           return readOnlyContext;
       }
   
  -    private static void buildEnvEntries(ReadOnlyContext readOnlyContext, EnvEntry[] envEntries)
throws DeploymentException {
  +    private static void buildEnvEntries(ReadOnlyContext readOnlyContext, EnvEntryType[]
envEntries) throws DeploymentException {
           for (int i = 0; i < envEntries.length; i++) {
  -            EnvEntry entry = envEntries[i];
  -            String name = entry.getEnvEntryName();
  -            String type = entry.getEnvEntryType();
  -            String value = entry.getEnvEntryValue();
  +            EnvEntryType entry = envEntries[i];
  +            String name = entry.getEnvEntryName().getStringValue();
  +            String type = entry.getEnvEntryType().getStringValue();
  +            String value = entry.getEnvEntryValue().getStringValue();
               Object mapEntry;
               try {
                   if (value == null) {
  @@ -150,15 +148,15 @@
           }
       }
   
  -    private void buildEJBRefs(ReadOnlyContext readOnlyContext, EjbRef[] ejbRefs) throws
DeploymentException {
  +    private void buildEJBRefs(ReadOnlyContext readOnlyContext, EjbRefType[] ejbRefs) throws
DeploymentException {
           for (int i = 0; i < ejbRefs.length; i++) {
  -            EjbRef ejbRef = ejbRefs[i];
  -            String name = ejbRef.getEJBRefName();
  +            EjbRefType ejbRef = ejbRefs[i];
  +            String name = ejbRef.getEjbRefName().getStringValue();
               Reference ref = null;
               try {
  -                ref = referenceFactory.getReference(ejbRef.getEJBLink(), ejbRef);
  +                ref = referenceFactory.getReference(ejbRef.getEjbLink().getStringValue(),
ejbRef);
               } catch (NamingException e) {
  -                throw new DeploymentException("Could not construct reference to " + ejbRef.getJndiName()
+ ", " + e.getMessage());
  +                throw new DeploymentException("Could not construct reference to " + ejbRef
+ ", " + e.getMessage());
               }
               try {
                   readOnlyContext.internalBind(ENV + name, ref);
  @@ -168,15 +166,15 @@
           }
       }
   
  -    private void buildEJBLocalRefs(ReadOnlyContext readOnlyContext, EjbLocalRef[] ejbLocalRefs)
throws DeploymentException {
  +    private void buildEJBLocalRefs(ReadOnlyContext readOnlyContext, EjbLocalRefType[] ejbLocalRefs)
throws DeploymentException {
           for (int i = 0; i < ejbLocalRefs.length; i++) {
  -            EjbLocalRef ejbLocalRef = ejbLocalRefs[i];
  -            String name = ejbLocalRef.getEJBRefName();
  +            EjbLocalRefType ejbLocalRef = ejbLocalRefs[i];
  +            String name = ejbLocalRef.getEjbRefName().getStringValue();
               Reference ref = null;
               try {
  -                ref = referenceFactory.getReference(ejbLocalRef.getEJBLink(), ejbLocalRef);
  +                ref = referenceFactory.getReference(ejbLocalRef.getEjbLink().getStringValue(),
ejbLocalRef);
               } catch (NamingException e) {
  -                throw new DeploymentException("Could not construct reference to " + ejbLocalRef.getJndiName()
+ ", " + e.getMessage());
  +                throw new DeploymentException("Could not construct reference to " + ejbLocalRef
+ ", " + e.getMessage());
               }
               try {
                   readOnlyContext.internalBind(ENV + name, ref);
  @@ -186,15 +184,15 @@
           }
       }
   
  -    private void buildResourceRefs(ReadOnlyContext readOnlyContext, ResourceRef[] resRefs)
throws DeploymentException {
  +    private void buildResourceRefs(ReadOnlyContext readOnlyContext, ResourceRefType[] resRefs)
throws DeploymentException {
           for (int i=0; i < resRefs.length; i++) {
  -            ResourceRef resRef = resRefs[i];
  -            String name = resRef.getResRefName();
  -            String type = resRef.getResType();
  +            ResourceRefType resRef = resRefs[i];
  +            String name = resRef.getResRefName().getStringValue();
  +            String type = resRef.getResType().getStringValue();
               Object ref;
               if ("java.net.URL".equals(type)) {
                   try {
  -                    ref = new URL(resRef.getURLRef());
  +                    ref = new URL(null /*resRef.geturl().getStringValue()*/);
                   } catch (MalformedURLException e) {
                       throw new DeploymentException("Invalid URL for resource-ref "+name,
e);
                   }
  @@ -202,7 +200,7 @@
                   try {
                       ref = referenceFactory.getReference(null, resRef);
                   } catch (NamingException e) {
  -                    throw new DeploymentException("Could not construct reference to " +
resRef.getJndiName());
  +                    throw new DeploymentException("Could not construct reference to " +
resRef);
                   }
               }
               try {
  
  
  
  1.4       +3 -5      incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ReferenceFactory.java
  
  Index: ReferenceFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ReferenceFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReferenceFactory.java	16 Nov 2003 05:24:38 -0000	1.3
  +++ ReferenceFactory.java	12 Feb 2004 08:18:21 -0000	1.4
  @@ -1,9 +1,7 @@
   package org.apache.geronimo.naming.java;
   
  -import javax.naming.Reference;
   import javax.naming.NamingException;
  -
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.JNDILocator;
  +import javax.naming.Reference;
   
   /**
    *
  @@ -13,5 +11,5 @@
    * */
   public interface ReferenceFactory {
   
  -    Reference getReference(String link, JNDILocator locator) throws NamingException;
  +    Reference getReference(String link, Object locator) throws NamingException;
   }
  
  
  
  1.5       +8 -11     incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
  
  Index: JMXReferenceFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JMXReferenceFactory.java	17 Nov 2003 07:33:51 -0000	1.4
  +++ JMXReferenceFactory.java	12 Feb 2004 08:18:21 -0000	1.5
  @@ -56,15 +56,11 @@
   
   package org.apache.geronimo.naming.jmx;
   
  -import javax.naming.Reference;
  -import javax.naming.NamingException;
   import javax.naming.LinkRef;
  +import javax.naming.NamingException;
  +import javax.naming.Reference;
   
   import org.apache.geronimo.naming.java.ReferenceFactory;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.JNDILocator;
  -import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceRef;
  -import org.apache.geronimo.deployment.model.j2ee.EJBRef;
  -import org.apache.geronimo.deployment.model.j2ee.EJBLocalRef;
   
   /**
    * This is a preliminary implementation that makes several unwarranted and redundant assumptions
such as:
  @@ -88,8 +84,9 @@
           this.mbeanServerId = mbeanServerId;
       }
   
  -    public Reference getReference(String link, JNDILocator locator) throws NamingException
{
  -        String methodName;
  +    public Reference getReference(String link, Object locator) throws NamingException {
  +        String methodName = null;
  +        /*
           if (locator instanceof EJBRef) {
               methodName = "getEJBHome";
           } else if (locator instanceof EJBLocalRef) {
  @@ -99,9 +96,9 @@
           } else {
               throw new NamingException("Invalid type: " + locator);
           }
  -
  +        */
           return new LinkRef(JMXContext.encode(mbeanServerId,
  -                (link == null)? locator.getJndiName(): "geronimo.j2ee:J2eeType=SessionBean,name="+link,
  +                (link == null)? /*locator.getJndiName()*/ null: "geronimo.j2ee:J2eeType=SessionBean,name="+link,
                   methodName));
       }
   }
  
  
  

Mime
View raw message