geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r813067 [3/3] - in /geronimo/sandbox/djencks/osgi/framework: ./ buildsupport/car-maven-plugin/ buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo...
Date Wed, 09 Sep 2009 18:18:53 GMT
Added: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java?rev=813067&view=auto
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
(added)
+++ geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
Wed Sep  9 18:18:48 2009
@@ -0,0 +1,114 @@
+/*
+ * 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.geronimo.system.configuration;
+
+import java.net.URL;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Collection;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamException;
+import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.PluginXmlUtil;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.DependencyType;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.xml.sax.SAXException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DependencyManager implements SynchronousBundleListener {
+
+    private final BundleContext bundleContext;
+    private final Collection<Repository> repositories;
+
+    public DependencyManager(BundleContext bundleContext, Collection<Repository> repositories)
{
+        this.bundleContext = bundleContext;
+        this.repositories = repositories;
+    }
+
+    public void bundleChanged(BundleEvent bundleEvent) {
+        int eventType = bundleEvent.getType();
+        if (eventType == BundleEvent.INSTALLED) {
+            installed(bundleEvent.getBundle());
+        }
+    }
+
+    private void installed(Bundle bundle) {
+        URL info = bundle.getEntry("META-INF/geronimo-plugin.xml");
+        if (info != null) {
+            System.out.println("found geronimo-plugin.xml for bundle " + bundle);
+            try {
+                InputStream in = info.openStream();
+                try {
+                    PluginType pluginType = PluginXmlUtil.loadPluginMetadata(in);
+                    PluginArtifactType pluginArtifactType = pluginType.getPluginArtifact().get(0);
+                    List<DependencyType> dependencies = pluginArtifactType.getDependency();
+                    for (DependencyType dependencyType: dependencies) {
+                        System.out.println("installing artifact: " + dependencyType);
+                        Artifact artifact = dependencyType.toArtifact();
+                        String location = locateBundle(artifact);
+                        bundleContext.installBundle(location);
+                    }
+                } catch (JAXBException e) {
+
+                } catch (SAXException e) {
+
+                } catch (XMLStreamException e) {
+
+                } catch (InvalidConfigException e) {
+
+                } catch (NoSuchConfigException e) {
+
+                } catch (BundleException e) {
+
+                } finally {
+                    in.close();
+                }
+            } catch (IOException e) {
+                //??
+            }
+        } else {
+            System.out.println("did not find geronimo-plugin.xml for bundle " + bundle);
+        }
+    }
+
+    private String locateBundle(Artifact configurationId) throws NoSuchConfigException, IOException,
InvalidConfigException {
+        for (Repository repo : repositories) {
+            if (repo.contains(configurationId)) {
+                return "file://" + repo.getLocation(configurationId).getAbsolutePath();
+            }
+        }
+        throw new NoSuchConfigException(configurationId);
+    }
+
+}

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java
(from r811772, geronimo/sandbox/djencks/osgi/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginXmlUtil.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java?p2=geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java&p1=geronimo/sandbox/djencks/osgi/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginXmlUtil.java&r1=811772&r2=813067&rev=813067&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginXmlUtil.java
(original)
+++ geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java
Wed Sep  9 18:18:48 2009
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.geronimo.system.plugin;
+package org.apache.geronimo.system.plugin.model;
 
 import java.io.OutputStream;
 import java.io.Writer;

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/PluginXmlUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/djencks/osgi/framework/modules/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/pom.xml?rev=813067&r1=813066&r2=813067&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/pom.xml (original)
+++ geronimo/sandbox/djencks/osgi/framework/modules/pom.xml Wed Sep  9 18:18:48 2009
@@ -130,7 +130,7 @@
                 <plugin>
                   <groupId>org.apache.felix</groupId>
                   <artifactId>maven-bundle-plugin</artifactId>
-                  <version>2.0.0</version>
+                  <!--<version>2.0.0</version>-->
                   <extensions>true</extensions>
                   <configuration>
                     <instructions>

Modified: geronimo/sandbox/djencks/osgi/framework/modules/testsupport-common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/testsupport-common/pom.xml?rev=813067&r1=813066&r2=813067&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/testsupport-common/pom.xml (original)
+++ geronimo/sandbox/djencks/osgi/framework/modules/testsupport-common/pom.xml Wed Sep  9
18:18:48 2009
@@ -55,8 +55,8 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.xmlbeans</groupId>
-            <artifactId>xmlbeans</artifactId>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.xmlbeans</artifactId>
         </dependency>
         
         <dependency>

Modified: geronimo/sandbox/djencks/osgi/framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/pom.xml?rev=813067&r1=813066&r2=813067&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/pom.xml (original)
+++ geronimo/sandbox/djencks/osgi/framework/pom.xml Wed Sep  9 18:18:48 2009
@@ -117,10 +117,68 @@
                 <artifactId>slf4j</artifactId>
                 <version>1.5.5_1-SNAPSHOT</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.bundles</groupId>
+                <artifactId>plexus-archiver</artifactId>
+                <version>1.0.9_1-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.bundles</groupId>
+                <artifactId>sxc-jaxb</artifactId>
+                <version>0.7.2_1-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.bundles</groupId>
+                <artifactId>sxc-runtime</artifactId>
+                <version>0.7.2_1-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.bundles</groupId>
+                <artifactId>plexus-utils</artifactId>
+                <version>1.4.5_1-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.servicemix.bundles</groupId>
+                <artifactId>org.apache.servicemix.bundles.xmlbeans</artifactId>
+                <version>2.4.0_2-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.servicemix.bundles</groupId>
+                <artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
+                <version>1.2_2-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.servicemix.bundles</groupId>
+                <artifactId>org.apache.servicemix.bundles.jline</artifactId>
+                <version>0.9.94_2-SNAPSHOT</version>
+            </dependency>
+            <!-- updated specs -->
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-javaee-deployment_1.1MR3_spec</artifactId>
+                <version>1.1-SNAPSHOT</version>
+            </dependency>
 
 
         </dependencies>
     </dependencyManagement>
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>2.0.1-SNAPSHOT</version>
+                    <!--<configuration>-->
+                        <!--<instructions>-->
+                            <!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
+                        <!--</instructions>-->
+                    <!--</configuration>-->
+                </plugin>
+
+            </plugins>
+        </pluginManagement>
+    </build>
     
     <!--<dependencies>-->
         <!--<dependency>-->



Mime
View raw message