incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r943996 - in /incubator/aries/trunk/jndi: jndi-core/ jndi-core/src/main/java/org/apache/aries/jndi/ jndi-core/src/main/java/org/apache/aries/jndi/startup/ jndi-core/src/test/java/org/apache/aries/jndi/ jndi-url/ jndi-url/src/main/java/org/a...
Date Thu, 13 May 2010 20:05:49 GMT
Author: gawor
Date: Thu May 13 20:05:48 2010
New Revision: 943996

URL: http://svn.apache.org/viewvc?rev=943996&view=rev
Log:
code cleanup: removed some unused code, formatting updates and added extra svn properties

Modified:
    incubator/aries/trunk/jndi/jndi-core/pom.xml
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
  (contents, props changed)
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/DelegateContext.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-core/src/test/java/org/apache/aries/jndi/ObjectFactoryTest.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/pom.xml
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/AbstractServiceRegistryContext.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiNameParser.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiURLContextFactory.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/OsgiNameParserTest.java
  (props changed)
    incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java
  (props changed)

Modified: incubator/aries/trunk/jndi/jndi-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-core/pom.xml?rev=943996&r1=943995&r2=943996&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-core/pom.xml (original)
+++ incubator/aries/trunk/jndi/jndi-core/pom.xml Thu May 13 20:05:48 2010
@@ -17,48 +17,48 @@
  under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.aries.jndi</groupId>
-    <artifactId>jndi</artifactId>
-    <version>0.2-incubating-SNAPSHOT</version>
-  </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.jndi</groupId>
+        <artifactId>jndi</artifactId>
+        <version>0.2-incubating-SNAPSHOT</version>
+    </parent>
 
-  <artifactId>org.apache.aries.jndi.core</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Aries JNDI Core</name>
-  <description>
+    <artifactId>org.apache.aries.jndi.core</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries JNDI Core</name>
+    <description>
       This bundle contains the core of JNDI support for OSGi.
-  </description>
+    </description>
 
-  <properties>
-    <aries.osgi.export.pkg>
-      org.apache.aries.jndi
-    </aries.osgi.export.pkg>
-    <aries.osgi.private.pkg>
-      org.apache.aries.jndi.startup
-    </aries.osgi.private.pkg>
-    <aries.osgi.activator>
-      org.apache.aries.jndi.startup.Activator
-    </aries.osgi.activator>
-  </properties>
-  
-  <dependencies>
-      <dependency>
-      	<groupId>org.apache.aries.jndi</groupId>
-      	<artifactId>org.apache.aries.jndi.api</artifactId>
-        <scope>provided</scope>
-      </dependency>
-      <dependency>
-          <groupId>org.osgi</groupId>
-          <artifactId>org.osgi.core</artifactId>
-          <scope>provided</scope>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.aries.testsupport</groupId>
-          <artifactId>org.apache.aries.testsupport.unit</artifactId>
-          <scope>test</scope>
-      </dependency>
-  </dependencies>
+    <properties>
+        <aries.osgi.export.pkg>
+            org.apache.aries.jndi
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.jndi.startup
+        </aries.osgi.private.pkg>
+        <aries.osgi.activator>
+            org.apache.aries.jndi.startup.Activator
+        </aries.osgi.activator>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.jndi</groupId>
+            <artifactId>org.apache.aries.jndi.api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
 </project>

Modified: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java?rev=943996&r1=943995&r2=943996&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
(original)
+++ incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
Thu May 13 20:05:48 2010
@@ -43,115 +43,66 @@ public final class ContextHelper {
 
     public static final Comparator<ServiceReference> SERVICE_REFERENCE_COMPARATOR =

         new ServiceReferenceComparator();
-    
-	/** The bundle context we use for accessing the SR */
-  private static BundleContext context;
-  
-  /** Ensure no one constructs us */
-  private ContextHelper() { throw new RuntimeException(); }
-  
-  public static void setBundleContext(BundleContext ctx)
-  {
-  	context = ctx;
-  }
-      
-  private static Context createIcfContext(Hashtable<?,?> env) throws NamingException
-  {
-    String icfFactory = (String) env.get(Context.INITIAL_CONTEXT_FACTORY);
-    InitialContextFactory icf = null;
-
-    if (icfFactory != null) {
-      try {
-        Class<?> clazz = Class.forName(icfFactory, true, Thread.currentThread()
-            .getContextClassLoader());
-        icf = (InitialContextFactory) clazz.newInstance();
-
-      } catch (ClassNotFoundException e11) {
-        NamingException e4 = new NamingException("Argh this should never happen :)");
-        e4.initCause(e11);
-        throw e4;
-      } catch (InstantiationException e2) {
-        NamingException e4 = new NamingException("Argh this should never happen :)");
-        e4.initCause(e2);
-        throw e4;
-      } catch (IllegalAccessException e1) {
-        NamingException e4 = new NamingException("Argh this should never happen :)");
-        e4.initCause(e1);
-        throw e4;
-      }
-    }
-    Context ctx = null;
 
-    if (icf != null) {
-      ctx = icf.getInitialContext(env);
-    }    
-    
-    return ctx;
-  }
-  
-  /**
-   * This method is used to create a URL Context. It does this by looking for 
-   * the URL context's ObjectFactory in the service registry.
-   * 
-   * @param urlScheme
-   * @param env
-   * @return a Context
-   * @throws NamingException
-   */
-  public static Context createURLContext(String urlScheme, Hashtable<?, ?> env)
-      throws NamingException
-  {
-    ObjectFactory factory = null;
-    ServiceReference ref = null;
-
-    Context ctx = null;
-
-    try {
-      ServiceReference[] services = context.getServiceReferences(ObjectFactory.class.getName(),
-                                                                 "(" + JNDIConstants.JNDI_URLSCHEME
+ "=" + urlScheme + ")");
-
-      if (services != null) {
-        ref = services[0];
-        factory = (ObjectFactory) context.getService(ref);
-      }
-    } catch (InvalidSyntaxException e1) {
-      // TODO nls enable this.
-      NamingException e = new NamingException("Argh this should never happen :)");
-      e.initCause(e1);
-      throw e;
-    }
+    /** The bundle context we use for accessing the SR */
+    private static BundleContext context;
 
-    if (factory != null) {
-      try {
-        ctx = (Context) factory.getObjectInstance(null, null, null, env);
-      } catch (Exception e) {
-        NamingException e2 = new NamingException();
-        e2.initCause(e);
-        throw e2;
-      } finally {
-        if (ref != null) context.ungetService(ref);
-      }
-    }
+    /** Ensure no one constructs us */
+    private ContextHelper() {
+        throw new RuntimeException();
+    }
+
+    public static void setBundleContext(BundleContext ctx) {
+        context = ctx;
+    }
+
+    /**
+     * This method is used to create a URL Context. It does this by looking for
+     * the URL context's ObjectFactory in the service registry.
+     * 
+     * @param urlScheme
+     * @param env
+     * @return a Context
+     * @throws NamingException
+     */
+    public static Context createURLContext(String urlScheme, Hashtable<?, ?> env)
+        throws NamingException {
+        ServiceReference ref = null;
+        try {
+            ServiceReference[] services = context.getServiceReferences(ObjectFactory.class.getName(),

+                                                                       "(" + JNDIConstants.JNDI_URLSCHEME
+ "=" + urlScheme + ")");
 
-    // TODO: This works for WAS - we believe - but is incorrect behaviour. We should not
use an icf to generate the URLContext.
-    // Rather, the missing URLContext factories should be exported on behalf of WAS.
-    if (ctx == null) {
-      ctx = createIcfContext(env);
-    }
-    
-    if (ctx == null && factory == null) {
-      NamingException e = new NamingException("We could not find an ObjectFactory to use");
-      throw e;
-    } else if (ctx == null && factory != null) {
-      NamingException e = new NamingException("The ICF returned a null context");
-      throw e;
+            if (services != null) {
+                ref = services[0];
+            }
+        } catch (InvalidSyntaxException e1) {
+            NamingException e = new NamingException("Argh this should never happen :)");
+            e.initCause(e1);
+            throw e;
+        }
+
+        Context ctx = null; 
+        
+        if (ref != null) {
+            ObjectFactory factory = (ObjectFactory) context.getService(ref);
+            try {
+                ctx = (Context) factory.getObjectInstance(null, null, null, env);
+            } catch (Exception e) {
+                NamingException e2 = new NamingException();
+                e2.initCause(e);
+                throw e2;
+            } finally {
+                if (ref != null) {
+                    context.ungetService(ref);
+                }
+            }
+        }
+
+        return ctx;
     }
 
-    return ctx;
-  }
-  
     public static Context getInitialContext(BundleContext context, Hashtable<?, ?>
environment)
-            throws NamingException {
+        throws NamingException {
         ContextProvider provider = getContextProvider(context, environment);
         String contextFactoryClass = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY);
         if (contextFactoryClass == null) {

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/DelegateContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/DelegateContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-core/src/test/java/org/apache/aries/jndi/ObjectFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-core/src/test/java/org/apache/aries/jndi/ObjectFactoryTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/aries/trunk/jndi/jndi-url/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url/pom.xml?rev=943996&r1=943995&r2=943996&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url/pom.xml (original)
+++ incubator/aries/trunk/jndi/jndi-url/pom.xml Thu May 13 20:05:48 2010
@@ -17,57 +17,57 @@
  under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.aries.jndi</groupId>
-    <artifactId>jndi</artifactId>
-    <version>0.2-incubating-SNAPSHOT</version>
-  </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.jndi</groupId>
+        <artifactId>jndi</artifactId>
+        <version>0.2-incubating-SNAPSHOT</version>
+    </parent>
 
-  <artifactId>org.apache.aries.jndi.url</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Aries JNDI URL Handler</name>
-  <description>
+    <artifactId>org.apache.aries.jndi.url</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries JNDI URL Handler</name>
+    <description>
       This bundle contains the JNDI URL handler for OSGi
-  </description>
+    </description>
 
-  <properties>
-    <aries.osgi.export.pkg>
-        org.apache.aries.jndi.services
-    </aries.osgi.export.pkg>
-    <aries.osgi.private.pkg>
-        org.apache.aries.jndi.url
-    </aries.osgi.private.pkg>
-    <aries.osgi.activator>
-        org.apache.aries.jndi.url.Activator
-    </aries.osgi.activator>
-  </properties>
+    <properties>
+        <aries.osgi.export.pkg>
+            org.apache.aries.jndi.services
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.jndi.url
+        </aries.osgi.private.pkg>
+        <aries.osgi.activator>
+            org.apache.aries.jndi.url.Activator
+        </aries.osgi.activator>
+    </properties>
 
-  <dependencies>
-      <dependency>
-      	<groupId>org.apache.aries.jndi</groupId>
-      	<artifactId>org.apache.aries.jndi.api</artifactId>
-        <scope>provided</scope>
-      </dependency>
-      <dependency>
-      	<groupId>org.apache.aries</groupId>
-      	<artifactId>org.apache.aries.util</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.osgi</groupId>
-          <artifactId>org.osgi.core</artifactId>
-          <scope>provided</scope>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.aries.jndi</groupId>
-          <artifactId>org.apache.aries.jndi.core</artifactId>
-          <scope>test</scope>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.aries.testsupport</groupId>
-          <artifactId>org.apache.aries.testsupport.unit</artifactId>
-          <scope>test</scope>
-      </dependency>
-  </dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.jndi</groupId>
+            <artifactId>org.apache.aries.jndi.api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries</groupId>
+            <artifactId>org.apache.aries.util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.jndi</groupId>
+            <artifactId>org.apache.aries.jndi.core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
 </project>

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/AbstractServiceRegistryContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/AbstractServiceRegistryContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/AbstractServiceRegistryContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiNameParser.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiNameParser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiURLContextFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiURLContextFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/OsgiNameParserTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/OsgiNameParserTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message