servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r538091 - in /incubator/servicemix/branches/osgi/servicemix-osgi: ./ bundles/ bundles/xbean-naming/ dist/ dist/src/main/release/ jmx/org.apache.servicemix.osgi.jmx.registry/ naming/ naming/org.apache.servicemix.osgi.naming.gjndi/ naming/org...
Date Tue, 15 May 2007 08:43:23 GMT
Author: gnodet
Date: Tue May 15 01:43:21 2007
New Revision: 538091

URL: http://svn.apache.org/viewvc?view=rev&rev=538091
Log:
Put rmi registry in its own tree

Added:
    incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/
    incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml   (with
props)
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
  (with props)
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
  (with props)
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
  (with props)
    incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml   (with props)
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/
      - copied from r538038, incubator/servicemix/branches/osgi/servicemix-osgi/jmx/org.apache.servicemix.osgi.jmx.registry/
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
  (with props)
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml   (with props)
Removed:
    incubator/servicemix/branches/osgi/servicemix-osgi/jmx/org.apache.servicemix.osgi.jmx.registry/
Modified:
    incubator/servicemix/branches/osgi/servicemix-osgi/bundles/pom.xml
    incubator/servicemix/branches/osgi/servicemix-osgi/dist/pom.xml
    incubator/servicemix/branches/osgi/servicemix-osgi/dist/src/main/release/config.properties
    incubator/servicemix/branches/osgi/servicemix-osgi/pom.xml
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/pom.xml
    incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/Activator.java

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/bundles/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/bundles/pom.xml?view=diff&rev=538091&r1=538090&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/bundles/pom.xml (original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/bundles/pom.xml Tue May 15 01:43:21
2007
@@ -22,6 +22,7 @@
     <module>j2ee-management</module>
     <module>howl</module>
     <module>commons-logging</module>
+    <module>xbean-naming</module>
   </modules>
 
   <build>

Added: incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml (added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml Tue May
15 01:43:21 2007
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- 
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    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.servicemix.osgi</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <properties>
+        <pkgArtifactId>xbean-naming</pkgArtifactId>
+        <pkgVersion>3.0</pkgVersion>
+        <pomVersion>1.0-SNAPSHOT</pomVersion>
+    </properties>
+    <groupId>org.apache.servicemix.osgi.bundles</groupId>
+    <artifactId>${pom.groupId}.${pkgArtifactId}</artifactId>
+    <version>${pkgVersion}-${pomVersion}</version>
+    <packaging>bundle</packaging>
+    <name>ServiceMix OSGI Common Bundles: ${pkgArtifactId}</name>
+    <description>
+        This bundle simply wraps ${pkgArtifactId}-${pkgVersion}.jar.
+    </description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.xbean</groupId>
+            <artifactId>${pkgArtifactId}</artifactId>
+            <version>${pkgVersion}</version>
+        </dependency>
+    </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${felix.version}</version>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <goals>
+              <goal>bundle</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Export-Package>*;version=${pkgVersion}</Export-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/bundles/xbean-naming/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/dist/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/dist/pom.xml?view=diff&rev=538091&r1=538090&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/dist/pom.xml (original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/dist/pom.xml Tue May 15 01:43:21 2007
@@ -51,6 +51,11 @@
                   <version>1.0-SNAPSHOT</version>
                 </artifactItem>
                 <artifactItem>
+                  <groupId>org.apache.servicemix.osgi.naming</groupId>
+                  <artifactId>org.apache.servicemix.osgi.naming.gjndi</artifactId>
+                  <version>1.0-SNAPSHOT</version>
+                </artifactItem>
+                <artifactItem>
                   <groupId>org.apache.servicemix.osgi.bundles</groupId>
                   <artifactId>org.apache.servicemix.osgi.bundles.geronimo-transaction</artifactId>
                   <version>2.0-SNAPSHOT-1.0-SNAPSHOT</version>
@@ -84,6 +89,11 @@
                   <groupId>org.apache.servicemix.osgi.bundles</groupId>
                   <artifactId>org.apache.servicemix.osgi.bundles.j2ee-management</artifactId>
                   <version>1.1-1.0-SNAPSHOT</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.servicemix.osgi.bundles</groupId>
+                  <artifactId>org.apache.servicemix.osgi.bundles.xbean-naming</artifactId>
+                  <version>3.0-1.0-SNAPSHOT</version>
                 </artifactItem>
                 <artifactItem>
                   <groupId>org.apache.felix</groupId>

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/dist/src/main/release/config.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/dist/src/main/release/config.properties?view=diff&rev=538091&r1=538090&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/dist/src/main/release/config.properties
(original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/dist/src/main/release/config.properties
Tue May 15 01:43:21 2007
@@ -40,7 +40,9 @@
  file:bundles/org.apache.servicemix.osgi.bundles.j2ee-management-1.1-1.0-SNAPSHOT.jar \
  file:bundles/org.apache.servicemix.osgi.bundles.howl-1.0.1-1-1.0-SNAPSHOT.jar \
  file:bundles/org.apache.servicemix.osgi.bundles.geronimo-transaction-2.0-SNAPSHOT-1.0-SNAPSHOT.jar
\
- file:bundles/org.apache.servicemix.osgi.transaction.manager-1.0-SNAPSHOT.jar
+ file:bundles/org.apache.servicemix.osgi.transaction.manager-1.0-SNAPSHOT.jar \
+ file:bundles/org.apache.servicemix.osgi.bundles.xbean-naming-3.0-1.0-SNAPSHOT.jar \
+ file:bundles/org.apache.servicemix.osgi.naming.gjndi-1.0-SNAPSHOT.jar
 felix.log.level=4
 felix.startlevel.framework=1
 felix.startlevel.bundle=1

Added: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
(added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
Tue May 15 01:43:21 2007
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+  
+  <!--
+    
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+  -->
+  
+  <parent>
+    <groupId>org.apache.servicemix.osgi</groupId>
+    <artifactId>naming</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>jar</packaging>
+  <name>ServiceMix OSGI Naming Global JNDI</name>
+  <groupId>org.apache.servicemix.osgi.naming</groupId>
+  <artifactId>org.apache.servicemix.osgi.naming.gjndi</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>${felix.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.osgi.bundles</groupId>
+      <artifactId>org.apache.servicemix.osgi.bundles.xbean-naming</artifactId>
+      <version>3.0-1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.osgi.jmx</groupId>
+      <artifactId>org.apache.servicemix.osgi.jmx.registry</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Bundle-Activator>${pom.artifactId}.impl.Activator</Bundle-Activator>
+            <Export-Package>
+              ${pom.artifactId}
+            </Export-Package>
+            <DynamicImport-Package>
+              *
+            </DynamicImport-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
(added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
Tue May 15 01:43:21 2007
@@ -0,0 +1,96 @@
+package org.apache.servicemix.osgi.naming.gjndi.impl;
+
+import org.apache.servicemix.osgi.jmx.registry.RmiRegistry;
+import org.apache.xbean.naming.global.GlobalContextManager;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+public class Activator implements BundleActivator, ServiceListener {
+
+    static final String JAVA_NAMING_FACTORY_INITIAL = "java.naming.factory.initial";
+    static final String JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
+    static final String JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
+
+
+    private BundleContext context;
+    private ServiceReference rmiRef;
+    private RmiRegistry rmi;
+
+    /**
+     * Implements BundleActivator.start(). P
+     * 
+     * @param context
+     *            the framework context for the bundle.
+     */
+    public void start(BundleContext context) throws Exception {
+        this.context = context;
+        rmiRef = context.getServiceReference(RmiRegistry.class.getName());
+        context.addServiceListener(this, "(|(objectClass=" + RmiRegistry.class.getName()
+ "))");
+        if (rmiRef != null) {
+            startRmiGJndi();
+        }
+    }
+
+    /**
+     * Implements BundleActivator.stop().
+     * 
+     * @param context
+     *            the framework context for the bundle.
+     */
+    public void stop(BundleContext context) throws Exception {
+        stopRmiGJndi();
+    }
+
+    /**
+     * Implements ServiceListener.serviceChanged().
+     * 
+     * @param event
+     *            the service event.
+     */
+    public void serviceChanged(ServiceEvent event) {
+        ServiceReference servicereference = event.getServiceReference();
+        String[] ast = (String[]) (servicereference.getProperty("objectClass"));
+        String as = ast[0];
+        switch (event.getType()) {
+        case ServiceEvent.REGISTERED:
+            rmiRef = servicereference;
+            if (rmiRef != null) {
+                try {
+                    this.startRmiGJndi();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            break;
+        case ServiceEvent.UNREGISTERING:
+            try {
+                this.stopRmiGJndi();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            break;
+        }
+    }
+
+    protected void startRmiGJndi() throws Exception {
+        rmi = (RmiRegistry) context.getService(rmiRef);
+        if (rmi == null) {
+            return;
+        }
+        int port = rmi.getPort();
+        System.setProperty(JAVA_NAMING_FACTORY_INITIAL, GlobalContextManager.class.getName());
+        System.setProperty(JAVA_NAMING_FACTORY_URL_PKGS, "org.apache.xbean.naming");
+        System.setProperty(JAVA_NAMING_PROVIDER_URL, "rmi://0.0.0.0:" + rmi.getPort());
+    }
+
+    protected void stopRmiGJndi() throws Exception {
+        if (rmi != null) {
+            context.ungetService(rmiRef);
+            rmi = null;
+        }
+    }
+
+}

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/Activator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
(added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
Tue May 15 01:43:21 2007
@@ -0,0 +1,4 @@
+package org.apache.servicemix.osgi.naming.gjndi.impl;
+
+public class GlobalContext {
+}

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/org.apache.servicemix.osgi.naming.gjndi/src/main/java/org/apache/servicemix/osgi/naming/gjndi/impl/GlobalContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml (added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml Tue May 15 01:43:21
2007
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<project>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>osgi</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <name>ServiceMix OSGI Naming Bundles</name>
+  <groupId>org.apache.servicemix.osgi</groupId>
+  <artifactId>naming</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0-SNAPSHOT</version>
+
+  <modules>
+    <module>org.apache.servicemix.osgi.naming.gjndi</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <version>${felix.version}</version>
+          <executions>
+            <execution>
+              <phase>process-classes</phase>
+              <goals>
+                <goal>manifest</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/naming/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/pom.xml?view=diff&rev=538091&r1=538090&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/pom.xml (original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/pom.xml Tue May 15 01:43:21 2007
@@ -10,8 +10,10 @@
 
   <modules>
     <module>bundles</module>
+    <module>rmi</module>
     <module>jmx</module>
     <module>transaction</module>
+    <module>naming</module>
     <module>dist</module>
   </modules>
 

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/pom.xml?view=diff&rev=538091&r1=538038&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/pom.xml
(original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/pom.xml
Tue May 15 01:43:21 2007
@@ -21,15 +21,15 @@
 
   <parent>
     <groupId>org.apache.servicemix.osgi</groupId>
-    <artifactId>jmx</artifactId>
+    <artifactId>rmi</artifactId>
     <version>1.0-SNAPSHOT</version>
   </parent>
   
   <modelVersion>4.0.0</modelVersion>
   <packaging>jar</packaging>
   <name>ServiceMix OSGI JMX RMI Registry</name>
-  <groupId>org.apache.servicemix.osgi.jmx</groupId>
-  <artifactId>org.apache.servicemix.osgi.jmx.registry</artifactId>
+  <groupId>org.apache.servicemix.osgi.rmi</groupId>
+  <artifactId>org.apache.servicemix.osgi.rmi.registry</artifactId>
   <version>1.0-SNAPSHOT</version>
 
   <dependencies>

Modified: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/Activator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/Activator.java?view=diff&rev=538091&r1=538038&r2=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/Activator.java
(original)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/Activator.java
Tue May 15 01:43:21 2007
@@ -22,6 +22,7 @@
         if (portS != null) {
             port = Integer.parseInt(portS);
         }
+        System.setProperty("java.rmi.server.RMIClassLoaderSpi", RmiClassLoaderSpiImpl.class.getName());
         Registry reg = LocateRegistry.createRegistry(port);
         registry = new RmiRegistryImpl(reg, port);
         context.registerService(new String[] { RmiRegistry.class.getName(), Registry.class.getName()
}, 

Added: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
(added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
Tue May 15 01:43:21 2007
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.osgi.jmx.registry.impl;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import java.io.File;
+
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+
+import java.rmi.server.RMIClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
+
+
+/**
+ * An implementation of {@link RMIClassLoaderSpi} which provides normilzation
+ * of codebase URLs and delegates to the default {@link RMIClassLoaderSpi}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RmiClassLoaderSpiImpl
+    extends RMIClassLoaderSpi
+{
+    private RMIClassLoaderSpi delegate = RMIClassLoader.getDefaultProviderInstance();
+
+    //TODO: Not sure of the best initial size.  Starting with 100 which should be reasonable.
+    private ConcurrentHashMap cachedCodebases = new ConcurrentHashMap(100);
+
+
+    public Class loadClass(String codebase, String name, ClassLoader defaultLoader)
+        throws MalformedURLException, ClassNotFoundException
+    {
+        if (codebase != null) {
+            codebase = getNormalizedCodebase(codebase);
+        }
+        
+        return delegate.loadClass(codebase, name, defaultLoader);
+    }
+    
+    public Class loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader)
+        throws MalformedURLException, ClassNotFoundException
+    {
+        if (codebase != null) {
+            codebase = getNormalizedCodebase(codebase);
+        }
+        
+        return delegate.loadProxyClass(codebase, interfaces, defaultLoader);
+    }
+    
+    public ClassLoader getClassLoader(String codebase)
+        throws MalformedURLException
+    {
+        if (codebase != null) {
+            codebase = getNormalizedCodebase(codebase);
+        }
+        
+        return delegate.getClassLoader(codebase);
+    }
+    
+    public String getClassAnnotation(Class type) {
+        Object obj = type.getClassLoader();
+        if (obj instanceof ClassLoaderServerAware) {
+            ClassLoaderServerAware classLoader = (ClassLoaderServerAware) obj;
+            URL urls[] = classLoader.getClassLoaderServerURLs();
+            if (null == urls) {
+                return delegate.getClassAnnotation(type);
+            }
+            StringBuffer codebase = new StringBuffer();
+            for (int i = 0; i < urls.length; i++) {
+                URL url = normalizeURL(urls[i]);
+                if (codebase.length() != 0) {
+                    codebase.append(' ');
+                }
+                codebase.append(url);
+            }
+            return codebase.toString();
+        }
+        
+        return delegate.getClassAnnotation(type);
+    }
+
+    /**
+     * Uses a ConcurrentReaderHashmap to save the contents of previous parses.
+     *
+     * @param codebase
+     * @return
+     * @throws MalformedURLException
+     */
+    private String getNormalizedCodebase(String codebase)
+            throws MalformedURLException {
+        String cachedCodebase = (String)cachedCodebases.get(codebase);
+        if (cachedCodebase != null)
+            return cachedCodebase;
+
+        String normalizedCodebase = normalizeCodebase(codebase);
+        String oldValue = (String)cachedCodebases.put(codebase, normalizedCodebase);
+
+        // If there was a previous value remove the one we just added to make sure the
+        // cache doesn't grow.
+        if (oldValue != null) {
+            cachedCodebases.remove(codebase);
+        }
+        return normalizedCodebase;  // We can use the oldValue
+    }
+
+
+    static String normalizeCodebase(String input)
+        throws MalformedURLException
+    {
+        assert input != null;
+
+        StringBuffer codebase = new StringBuffer();
+        StringBuffer working = new StringBuffer();
+        StringTokenizer stok = new StringTokenizer(input, " \t\n\r\f", true);
+        
+        while (stok.hasMoreTokens()) {
+            String item = stok.nextToken();
+            // Optimisation: This optimisation to prevent unnecessary MalformedURLExceptions

+            //   being generated is most helpful on windows where directory names in the
path 
+            //   often contain spaces.  E.G:
+            //     file:/C:/Program Files/Apache Software Foundation/Maven 1.0.2/lib/ant-1.5.3-1.jar
+            //
+            //   Therefore we won't attempt URL("Files/Apache) or URL(" ") for the path delimiter.
+            if ( item.indexOf(':') != -1 )
+            {
+                try {
+                    URL url = new URL(item);
+                    // If we got this far then item is a valid url, so commit the current
+                    // buffer and start collecting any trailing bits from where we are now
+                    updateCodebase(working, codebase);
+                } catch (MalformedURLException ignore) {
+                    // just keep going & append to the working buffer
+                }
+            }
+            
+            // Append the URL or delimiter to the working buffer
+            working.append(item);
+        }
+        
+        // Handle trailing elements
+        updateCodebase(working, codebase);
+        
+        // System.out.println("Normalized codebase: " + codebase);
+        return codebase.toString();
+    }
+    
+    private static void updateCodebase(final StringBuffer working, final StringBuffer codebase)
+        throws MalformedURLException
+    {
+        if (working.length() != 0) {
+            // Normalize the URL
+            URL url = normalizeURL(new URL(working.toString()));
+            // System.out.println("Created normalized URL: " + url);
+            
+            // Put spaces back in for URL delims
+            if (codebase.length() != 0) {
+                codebase.append(" ");
+            }
+            codebase.append(url);
+            
+            // Reset the working buffer
+            working.setLength(0);
+        }
+    }
+    
+    static URL normalizeURL(URL url)
+    {
+        assert url != null;
+        
+        if (url.getProtocol().equals("file")) {
+            String filename = url.getFile().replace('/', File.separatorChar);
+            File file = new File(filename);
+            try {
+                url = file.toURI().toURL();
+            }
+            catch (MalformedURLException ignore) {}
+        }
+        
+        return url;
+    }
+    
+    public interface ClassLoaderServerAware {
+        public URL[] getClassLoaderServerURLs();
+    }
+}

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/org.apache.servicemix.osgi.rmi.registry/src/main/java/org/apache/servicemix/osgi/jmx/registry/impl/RmiClassLoaderSpiImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml?view=auto&rev=538091
==============================================================================
--- incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml (added)
+++ incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml Tue May 15 01:43:21 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<project>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>osgi</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <name>ServiceMix OSGI Rmi Bundles</name>
+  <groupId>org.apache.servicemix.osgi</groupId>
+  <artifactId>rmi</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0-SNAPSHOT</version>
+
+  <modules>
+    <module>org.apache.servicemix.osgi.rmi.registry</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <version>${felix.version}</version>
+          <executions>
+            <execution>
+              <phase>process-classes</phase>
+              <goals>
+                <goal>manifest</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/branches/osgi/servicemix-osgi/rmi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message