Author: rickhall
Date: Mon Jun 21 16:53:47 2010
New Revision: 956641
URL: http://svn.apache.org/viewvc?rev=956641&view=rev
Log:
Get basic structure of composite manager.
Added:
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/CompositeVirtualModuleImpl.java
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Install.java
- copied, changed from r956640,
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Manager.java
Modified:
felix/sandbox/rickhall/vb/composite/pom.xml
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
Modified: felix/sandbox/rickhall/vb/composite/pom.xml
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb/composite/pom.xml?rev=956641&r1=956640&r2=956641&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb/composite/pom.xml (original)
+++ felix/sandbox/rickhall/vb/composite/pom.xml Mon Jun 21 16:53:47 2010
@@ -35,6 +35,11 @@
<artifactId>org.apache.felix.framework-vb</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.gogo.runtime</artifactId>
+ <version>0.6.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
@@ -67,6 +72,16 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
+
Modified:
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java?rev=956641&r1=956640&r2=956641&view=diff
==============================================================================
---
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
(original)
+++
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
Mon Jun 21 16:53:47 2010
@@ -18,16 +18,35 @@
*/
package org.apache.felix.sandbox.composite;
+import java.util.Hashtable;
+import org.apache.felix.framework.ext.FelixBundleContext;
import org.osgi.framework.*;
public class Activator implements BundleActivator
{
- public void start(BundleContext bc)
+ private Manager m_manager;
+
+ public void start(BundleContext bc) throws Exception
{
- System.out.println("Hello from the composite manager.");
+ if (bc instanceof FelixBundleContext)
+ {
+ m_manager = new Manager((FelixBundleContext) bc);
+
+ Hashtable props = new Hashtable();
+ props.put("osgi.command.scope", "composite");
+ props.put("osgi.command.function", new String[] {
+ "ci"
+ });
+ bc.registerService(
+ Install.class.getName(), new Install(m_manager), props);
+ }
+ else
+ {
+ throw new BundleException("Incorrect bundle context");
+ }
}
- public void stop(BundleContext bc)
+ public void stop(BundleContext bc) throws Exception
{
}
-}
+}
\ No newline at end of file
Added:
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/CompositeVirtualModuleImpl.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/CompositeVirtualModuleImpl.java?rev=956641&view=auto
==============================================================================
---
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/CompositeVirtualModuleImpl.java
(added)
+++
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/CompositeVirtualModuleImpl.java
Mon Jun 21 16:53:47 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.felix.sandbox.composite;
+
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import org.apache.felix.framework.ext.VirtualModule;
+import org.apache.felix.framework.ext.Wire;
+import org.osgi.framework.BundleException;
+
+public class CompositeVirtualModuleImpl implements VirtualModule
+{
+ public void resolve(Wire bootWire, List<Wire> wires) throws BundleException
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Class loadClass(String name) throws ClassNotFoundException
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public URL getResource(String name)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Enumeration getResources(String name)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public URL getEntry(String entry)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Enumeration<String> getEntryPaths(String path)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Enumeration<URL> findEntries(String path, String filePattern,
boolean recurse)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
\ No newline at end of file
Copied:
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Install.java
(from r956640,
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java)
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Install.java?p2=felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Install.java&p1=felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java&r1=956640&r2=956641&rev=956641&view=diff
==============================================================================
---
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Activator.java
(original)
+++
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Install.java
Mon Jun 21 16:53:47 2010
@@ -1,4 +1,4 @@
-/*
+/*
* 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
@@ -6,9 +6,9 @@
* 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
@@ -18,16 +18,25 @@
*/
package org.apache.felix.sandbox.composite;
-import org.osgi.framework.*;
+import org.apache.felix.service.command.Descriptor;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
-public class Activator implements BundleActivator
+public class Install
{
- public void start(BundleContext bc)
+ private final Manager m_manager;
+
+ public Install(Manager manager)
{
- System.out.println("Hello from the composite manager.");
+ m_manager = manager;
}
- public void stop(BundleContext bc)
+ @Descriptor("Install a composite bundle")
+ public Bundle ci(
+ @Descriptor("URL to a composite description")
+ String url)
+ throws BundleException
{
+ return m_manager.install(url);
}
-}
+}
\ No newline at end of file
Added:
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Manager.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Manager.java?rev=956641&view=auto
==============================================================================
---
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Manager.java
(added)
+++
felix/sandbox/rickhall/vb/composite/src/main/java/org/apache/felix/sandbox/composite/Manager.java
Mon Jun 21 16:53:47 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.felix.sandbox.composite;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.felix.framework.ext.FelixBundleContext;
+import org.apache.felix.framework.ext.VirtualModule;
+import org.apache.felix.framework.ext.VirtualModuleContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+public class Manager
+{
+ private final FelixBundleContext m_fbc;
+ private final Map<Bundle, VirtualModule> m_vmMap =
+ new HashMap<Bundle, VirtualModule>();
+ private final Map<Bundle, VirtualModuleContext> m_vmcMap =
+ new HashMap<Bundle, VirtualModuleContext>();
+
+ public Manager(FelixBundleContext fbc)
+ {
+ m_fbc = fbc;
+ }
+
+ public Bundle install(String description) throws BundleException
+ {
+ System.out.println("Installing composite...");
+ VirtualModule vm = new CompositeVirtualModuleImpl();
+ VirtualModuleContext vmc = m_fbc.installBundle(description, null,
null);
+ return vmc.getBundle();
+ }
+}
\ No newline at end of file