You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/10/04 21:10:59 UTC
svn commit: r581988 - in /incubator/servicemix/branches/osgi/gshell: ./
gshell-osgi/ gshell-osgi/gshell-osgi-commands/
gshell-osgi/gshell-osgi-commands/src/
gshell-osgi/gshell-osgi-commands/src/main/
gshell-osgi/gshell-osgi-commands/src/main/java/ gshe...
Author: gnodet
Date: Thu Oct 4 12:10:50 2007
New Revision: 581988
URL: http://svn.apache.org/viewvc?rev=581988&view=rev
Log:
GShel based OSGi console
Added:
incubator/servicemix/branches/osgi/gshell/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/pom.xml
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Activator.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/BundleCommand.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ListBundles.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/OsgiCommandSupport.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/RefreshBundle.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ResolveBundle.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Shutdown.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartBundle.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartLevel.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StopBundle.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/UninstallBundle.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh (with props)
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/pom.xml
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/pom.xml
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/Activator.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/BundleDelegatingClassLoader.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/GShell.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandDiscoverer.java
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/gshell/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/components.xml
incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/plexus.xml
incubator/servicemix/branches/osgi/gshell/gshell-osgi/pom.xml
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/pom.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/pom.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/pom.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,105 @@
+<?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.
+-->
+
+<!-- $Rev: 580839 $ $Date: 2007-10-01 06:55:10 +0200 (Mon, 01 Oct 2007) $ -->
+
+<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.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gshell-osgi-commands</artifactId>
+ <packaging>bundle</packaging>
+ <name>GShell OSGi Commands</name>
+
+ <description>
+ Provides the OSGi GShell commands
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-ansi</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-core</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-maven-plugin</artifactId>
+ <version>${version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>commands-descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.0.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${artifactId}</Bundle-Name>
+ <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.geronimo.gshell.osgi.commands.Activator</Bundle-Activator>
+ <Export-Package>org.apache.geronimo.gshell.osgi.commands*;version=${project.version}</Export-Package>
+ <Import-Package>*</Import-Package>
+ <Private-Package>!*</Private-Package>
+ <Implementation-Title>Apache GShell</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Activator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Activator.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Activator.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Activator.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,24 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 10:47:35 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Activator implements BundleActivator {
+
+ public void start(BundleContext bundleContext) throws Exception {
+ OsgiCommandSupport.setBundleContext(bundleContext);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ OsgiCommandSupport.setBundleContext(null);
+ }
+
+
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/BundleCommand.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/BundleCommand.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/BundleCommand.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/BundleCommand.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,29 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.framework.Bundle;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:32 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class BundleCommand extends OsgiCommandSupport {
+
+ @Argument(required = true)
+ long id;
+
+ protected Object doExecute() throws Exception {
+ Bundle bundle = getBundleContext().getBundle(id);
+ if (bundle == null) {
+ io.out.println("Bundle " + id + " not found");
+ return FAILURE;
+ }
+ doExecute(bundle);
+ return SUCCESS;
+ }
+
+ protected abstract void doExecute(Bundle bundle) throws Exception;
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ListBundles.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ListBundles.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ListBundles.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ListBundles.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,128 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.startlevel.StartLevel;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 9:44:20 AM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="lb", description="List bundles")
+public class ListBundles extends OsgiCommandSupport {
+
+ @Option(name = "-l", description = "Show locations")
+ boolean showLoc;
+
+ @Option(name = "-s", description = "Show symbolic name")
+ boolean showSymbolic;
+
+ @Option(name = "-u", description = "Show update")
+ boolean showUpdate;
+
+ protected Object doExecute() throws Exception {
+ ServiceReference ref = getBundleContext().getServiceReference(StartLevel.class.getName());
+ StartLevel sl = null;
+ if (ref != null) {
+ sl = (StartLevel) getBundleContext().getService(ref);
+ }
+ if (sl == null) {
+ io.out.println("StartLevel service is unavailable.");
+ }
+ try {
+ Bundle[] bundles = getBundleContext().getBundles();
+ if (bundles != null) {
+ // Display active start level.
+ if (sl != null) {
+ io.out.println("START LEVEL " + sl.getStartLevel());
+ }
+
+ // Print column headers.
+ String msg = " Name";
+ if (showLoc) {
+ msg = " Location";
+ }
+ else if (showSymbolic) {
+ msg = " Symbolic name";
+ }
+ else if (showUpdate) {
+ msg = " Update location";
+ }
+ String level = (sl == null) ? "" : " Level ";
+ io.out.println(" ID " + " State " + level + msg);
+ for (int i = 0; i < bundles.length; i++) {
+ // Get the bundle name or location.
+ String name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_NAME);
+ // If there is no name, then default to symbolic name.
+ name = (name == null) ? bundles[i].getSymbolicName() : name;
+ // If there is no symbolic name, resort to location.
+ name = (name == null) ? bundles[i].getLocation() : name;
+
+ // Overwrite the default value is the user specifically
+ // requested to display one or the other.
+ if (showLoc) {
+ name = bundles[i].getLocation();
+ }
+ else if (showSymbolic) {
+ name = bundles[i].getSymbolicName();
+ name = (name == null) ? "<no symbolic name>" : name;
+ }
+ else if (showUpdate) {
+ name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
+ name = (name == null) ? bundles[i].getLocation() : name;
+ }
+ // Show bundle version if not showing location.
+ String version = (String) bundles[i].getHeaders().get(Constants.BUNDLE_VERSION);
+ name = (!showLoc && !showUpdate && (version != null)) ? name + " (" + version + ")" : name;
+ long l = bundles[i].getBundleId();
+ String id = String.valueOf(l);
+ if (sl == null) {
+ level = "1";
+ }
+ else {
+ level = String.valueOf(sl.getBundleStartLevel(bundles[i]));
+ }
+ while (level.length() < 5) {
+ level = " " + level;
+ }
+ while (id.length() < 4) {
+ id = " " + id;
+ }
+ io.out.println("[" + id + "] ["
+ + getStateString(bundles[i].getState())
+ + "] [" + level + "] " + name);
+ }
+ }
+ else {
+ io.out.println("There are no installed bundles.");
+ }
+ return SUCCESS;
+ }
+ finally {
+ if (ref != null) {
+ getBundleContext().ungetService(ref);
+ }
+ }
+ }
+
+ public String getStateString(int i)
+ {
+ if (i == Bundle.ACTIVE)
+ return "Active ";
+ else if (i == Bundle.INSTALLED)
+ return "Installed ";
+ else if (i == Bundle.RESOLVED)
+ return "Resolved ";
+ else if (i == Bundle.STARTING)
+ return "Starting ";
+ else if (i == Bundle.STOPPING)
+ return "Stopping ";
+ return "Unknown ";
+ }
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/OsgiCommandSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/OsgiCommandSupport.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/OsgiCommandSupport.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/OsgiCommandSupport.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,24 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.command.CommandSupport;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 9:44:39 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class OsgiCommandSupport extends CommandSupport {
+
+ private static BundleContext bundleContext;
+
+ public static void setBundleContext(BundleContext context) {
+ bundleContext = context;
+ }
+
+ public static BundleContext getBundleContext() {
+ return bundleContext;
+ }
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/RefreshBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/RefreshBundle.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/RefreshBundle.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/RefreshBundle.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,52 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="refresh", description="Refresh bundle")
+public class RefreshBundle extends OsgiCommandSupport {
+
+ @Argument(required = false)
+ Long id;
+
+ protected Object doExecute() throws Exception {
+ // Get package admin service.
+ ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
+ if (ref == null) {
+ io.out.println("PackageAdmin service is unavailable.");
+ return FAILURE;
+ }
+ try {
+ PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
+ if (pa == null) {
+ io.out.println("PackageAdmin service is unavailable.");
+ return FAILURE;
+ }
+ if (id == null) {
+ pa.refreshPackages(null);
+ }
+ else {
+ Bundle bundle = getBundleContext().getBundle(id);
+ if (bundle == null) {
+ io.out.println("Bundle " + id + " not found");
+ return FAILURE;
+ }
+ pa.refreshPackages(new Bundle[] { bundle });
+ }
+ }
+ finally {
+ getBundleContext().ungetService(ref);
+ }
+ return SUCCESS;
+ }
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ResolveBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ResolveBundle.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ResolveBundle.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/ResolveBundle.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,38 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="resolve", description="Resolve bundle")
+public class ResolveBundle extends BundleCommand {
+
+ protected void doExecute(Bundle bundle) throws Exception {
+ // Get package admin service.
+ ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
+ if (ref == null) {
+ io.out.println("PackageAdmin service is unavailable.");
+ return;
+ }
+ try {
+ PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
+ if (pa == null) {
+ io.out.println("PackageAdmin service is unavailable.");
+ return;
+ }
+ pa.resolveBundles(new Bundle[] { bundle });
+ }
+ finally {
+ getBundleContext().ungetService(ref);
+ }
+ }
+
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Shutdown.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Shutdown.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Shutdown.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/Shutdown.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,22 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 1:59:04 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="shutdown", description="Shutdown")
+public class Shutdown extends OsgiCommandSupport {
+
+ protected Object doExecute() throws Exception {
+ Bundle bundle = getBundleContext().getBundle(0);
+ bundle.stop();
+ return SUCCESS;
+ }
+
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartBundle.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartBundle.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartBundle.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,20 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:15 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="start", description="Start bundle")
+public class StartBundle extends BundleCommand {
+
+ protected void doExecute(Bundle bundle) throws Exception {
+ bundle.start();
+ }
+
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartLevel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartLevel.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartLevel.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StartLevel.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,48 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="startlevel", description="Get or set the start level")
+public class StartLevel extends BundleCommand {
+
+ @Argument
+ Integer level;
+
+ protected void doExecute(Bundle bundle) throws Exception {
+ // Get package admin service.
+ ServiceReference ref = getBundleContext().getServiceReference(org.osgi.service.startlevel.StartLevel.class.getName());
+ if (ref == null) {
+ io.out.println("StartLevel service is unavailable.");
+ return;
+ }
+ try {
+ org.osgi.service.startlevel.StartLevel sl = (org.osgi.service.startlevel.StartLevel) getBundleContext().getService(ref);
+ if (sl == null) {
+ io.out.println("StartLevel service is unavailable.");
+ return;
+ }
+
+ if (level == null) {
+ io.out.println("Level " + sl.getStartLevel());
+ }
+ else {
+ sl.setStartLevel(level);
+ }
+ }
+ finally {
+ getBundleContext().ungetService(ref);
+ }
+ }
+
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StopBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StopBundle.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StopBundle.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/StopBundle.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,20 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:15 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="stop", description="Stop bundle")
+public class StopBundle extends BundleCommand {
+
+ protected void doExecute(Bundle bundle) throws Exception {
+ bundle.stop();
+ }
+
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/UninstallBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/UninstallBundle.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/UninstallBundle.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-osgi-commands/src/main/java/org/apache/geronimo/gshell/osgi/commands/UninstallBundle.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,20 @@
+package org.apache.geronimo.gshell.osgi.commands;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="uninstall", description="Uninstall bundle")
+public class UninstallBundle extends BundleCommand {
+
+ protected void doExecute(Bundle bundle) throws Exception {
+ bundle.uninstall();
+ }
+
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh Thu Oct 4 12:10:50 2007
@@ -0,0 +1 @@
+java -classpath ~/.m2/repository/org/ops4j/pax/runner/pax-runner/0.5.0-SNAPSHOT/pax-runner-0.5.0-SNAPSHOT.jar org.ops4j.pax.runner.Run --noConsole --p=f pom.xml
Propchange: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/gshell.sh
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/pom.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/pom.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-pax-runner/pom.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,95 @@
+<?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.
+-->
+
+<!-- $Rev: 580689 $ $Date: 2007-09-30 12:06:25 +0200 (Sun, 30 Sep 2007) $ -->
+
+<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.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-pax-runner</artifactId>
+ <name>GShell Pax Runner</name>
+ <packaging>pom</packaging>
+
+ <description>
+ Helper project for running GShell from Pax Runner.
+ </description>
+
+ <repositories>
+ <repository>
+ <id>ops4j.repo</id>
+ <url>http://repository.ops4j.org/maven2</url>
+ </repository>
+ <repository>
+ <id>ops4j.snapshots</id>
+ <url>http://repository.ops4j.org/mvn-snapshots</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>false</enabled></releases>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>ops4j.repo</id>
+ <url>http://repository.ops4j.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>ops4j.snapshots</id>
+ <url>http://repository.ops4j.org/mvn-snapshots</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>false</enabled></releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <version>0.9.7-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <version>0.9.7-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-service</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi-commands</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.runner</groupId>
+ <artifactId>pax-runner</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/pom.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/pom.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/pom.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,171 @@
+<?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.
+-->
+
+<!-- $Rev: 580839 $ $Date: 2007-10-01 06:55:10 +0200 (Mon, 01 Oct 2007) $ -->
+
+<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.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gshell-service</artifactId>
+ <packaging>bundle</packaging>
+ <name>GShell OSGi service</name>
+
+ <description>
+ Provides the OSGi GShell integration
+ </description>
+
+ <properties>
+ <gshell.osgi.activator>
+ org.apache.geronimo.gshell.osgi.Activator
+ </gshell.osgi.activator>
+ <gshell.osgi.import>
+ javax.xml.stream*;resolution:=optional,
+ junit.framework*;resolution:=optional,
+ nu.xom*;resolution:=optional,
+ net.sf.cglib*;resolution:=optional,
+ org.codehaus.jettison*;resolution:=optional,
+ org.dom4j*;resolution:=optional,
+ org.joda*;resolution:=optional,
+ org.jdom*;resolution:=optional,
+ sun.*;resolution:=optional,
+ *
+ </gshell.osgi.import>
+ <!--
+ <gshell.osgi.private.pkg>
+ com.thoughtworks.xstream*,
+ jline*,
+ org.apache.commons.jexl*,
+ org.codehaus.classworlds*,
+ org.codehaus.plexus*,
+ org.xmlpull.*,
+ META-INF*
+ </gshell.osgi.private.pkg>
+ <gshell.osgi.export.pkg>
+ org.apache.geronimo.gshell*
+ </gshell.osgi.export.pkg>
+ -->
+ <gshell.osgi.private.pkg>
+ com.thoughtworks.xstream*,
+ jline*,
+ org.apache.commons.jexl*,
+ org.codehaus.classworlds*,
+ org.xmlpull.*,
+ META-INF*
+ </gshell.osgi.private.pkg>
+ <gshell.osgi.export>
+ org.apache.geronimo.gshell*;version=${project.version},
+ org.codehaus.plexus*;version=${project.version}
+ </gshell.osgi.export>
+ <gshell.osgi.symbolic.name>${groupId}.${artifactId}</gshell.osgi.symbolic.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-core</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-command-api</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-common</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-ansi</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-i18n</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-clp</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-parser</artifactId>
+ <version>${version}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-classworlds</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-embeddable</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi-commands</artifactId>
+ <version>${version}</version>
+ </dependency>
+ -->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.0.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${artifactId}</Bundle-Name>
+ <Bundle-SymbolicName>${gshell.osgi.symbolic.name}</Bundle-SymbolicName>
+ <Bundle-Activator>${gshell.osgi.activator}</Bundle-Activator>
+ <Export-Package>${gshell.osgi.export}</Export-Package>
+ <Import-Package>${gshell.osgi.import}</Import-Package>
+ <Private-Package>${gshell.osgi.private.pkg}</Private-Package>
+ <Implementation-Title>Apache GShell</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/Activator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/Activator.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/Activator.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/Activator.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,45 @@
+package org.apache.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.IO;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.osgi.framework.*;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Activator implements BundleActivator, Runnable {
+
+ private BundleContext context;
+ private GShell shell;
+ private Thread thread;
+ private ClassLoader classLoader;
+
+ public void start(BundleContext bundleContext) throws Exception {
+ context = bundleContext;
+ classLoader = BundleDelegatingClassLoader.createBundleClassLoaderFor(
+ context.getBundle(), Activator.class.getClassLoader());
+ Thread.currentThread().setContextClassLoader(classLoader);
+ ClassWorld cw = new ClassWorld("gshell", classLoader);
+ IO io = new IO(System.in, System.out, System.err);
+ shell = new GShell(cw, io);
+ thread = new Thread(this);
+ thread.start();
+ new OsgiCommandDiscoverer(bundleContext, shell.getCommandRegistry());
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ thread.interrupt();
+ thread.join();
+ }
+
+ public void run() {
+ try {
+ // Wait a bit to make sure everything is initialized
+ Thread.sleep(100);
+ Thread.currentThread().setContextClassLoader(classLoader);
+ shell.run();
+ } catch (Exception e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/BundleDelegatingClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/BundleDelegatingClassLoader.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/BundleDelegatingClassLoader.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/BundleDelegatingClassLoader.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed 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.gshell.osgi;
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * ClassLoader backed by an OSGi bundle. Will use the Bundle class loading.
+ * Contains facilities for tracing classloading behavior so that issues can be
+ * easily resolved. Debugging can be enabled by setting the system property
+ * <code>org.springframework.osgi.DebugClassLoading</code> to true.
+ *
+ *
+ * @author Adrian Colyer
+ * @author Andy Piper
+ * @author Costin Leau
+ * @since 2.0
+ */
+public class BundleDelegatingClassLoader extends ClassLoader {
+ private ClassLoader bridge;
+
+ private Bundle backingBundle;
+
+ public static BundleDelegatingClassLoader createBundleClassLoaderFor(Bundle aBundle) {
+ return createBundleClassLoaderFor(aBundle, BundleDelegatingClassLoader.class.getClassLoader());
+ }
+
+ public static BundleDelegatingClassLoader createBundleClassLoaderFor(final Bundle bundle, final ClassLoader bridge) {
+ return (BundleDelegatingClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new BundleDelegatingClassLoader(bundle, bridge);
+ }
+ });
+ }
+
+ private BundleDelegatingClassLoader(Bundle bundle, ClassLoader bridgeLoader) {
+ super(null);
+ this.backingBundle = bundle;
+ this.bridge = bridgeLoader;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof BundleDelegatingClassLoader))
+ return false;
+
+ final BundleDelegatingClassLoader bundleDelegatingClassLoader = (BundleDelegatingClassLoader) o;
+
+ if (backingBundle.equals(bundleDelegatingClassLoader.backingBundle))
+ return (bridge == null || bridge.equals(bundleDelegatingClassLoader.bridge));
+
+ return false;
+ }
+
+ public int hashCode() {
+ int hashCode = backingBundle.hashCode();
+ if (bridge != null)
+ hashCode |= bridge.hashCode();
+
+ return hashCode;
+ }
+
+ protected Class findClass(String name) throws ClassNotFoundException {
+ try {
+ return this.backingBundle.loadClass(name);
+ }
+ catch (ClassNotFoundException cnfe) {
+ throw new ClassNotFoundException(name + " not found from bundle [" + backingBundle.getSymbolicName() + "]",
+ cnfe);
+ }
+ catch (NoClassDefFoundError ncdfe) {
+ NoClassDefFoundError e = new NoClassDefFoundError(name + " not found from bundle [" + backingBundle + "]");
+ e.initCause(ncdfe);
+ throw e;
+ }
+ }
+
+ protected URL findResource(String name) {
+ URL url = this.backingBundle.getResource(name);
+ return url;
+ }
+
+ protected Enumeration findResources(String name) throws IOException {
+ Enumeration enm = this.backingBundle.getResources(name);
+ return enm;
+ }
+
+ public URL getResource(String name) {
+ URL resource = findResource(name);
+ if (resource == null) {
+ resource = bridge.getResource(name);
+ }
+ return resource;
+ }
+
+ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class clazz;
+ try {
+ clazz = findClass(name);
+ }
+ catch (ClassNotFoundException e) {
+ clazz = bridge.loadClass(name);
+ }
+ if (resolve) {
+ resolveClass(clazz);
+ }
+ return clazz;
+ }
+
+ // For testing
+ public Bundle getBundle() {
+ return backingBundle;
+ }
+
+ public String toString() {
+ Dictionary dict = backingBundle.getHeaders();
+ String bname = dict.get(Constants.BUNDLE_NAME) + "(" + dict.get(Constants.BUNDLE_SYMBOLICNAME) + ")";
+ return "BundleDelegatingClassLoader for [" + bname + "]";
+ }
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/GShell.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/GShell.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/GShell.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/GShell.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,174 @@
+/*
+ * 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.gshell.osgi;
+
+import org.apache.geronimo.gshell.DefaultEnvironment;
+import org.apache.geronimo.gshell.ShellSecurityManager;
+import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.common.StopWatch;
+import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
+import org.apache.geronimo.gshell.lookup.IOLookup;
+import org.apache.geronimo.gshell.registry.CommandRegistry;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.shell.InteractiveShell;
+import org.apache.geronimo.gshell.shell.ShellInfo;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A simple facade over GShell, sets up the container for you... you just run commands :-)
+ *
+ * @version $Rev: 581061 $ $Date: 2007-10-01 22:18:31 +0200 (Mon, 01 Oct 2007) $
+ */
+public class GShell
+ implements InteractiveShell
+{
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ private final ClassWorld classWorld;
+
+ private final IO io;
+
+ private final Environment env;
+
+ private final PlexusContainer container;
+
+ private final SecurityManager sm;
+
+ private final InteractiveShell shell;
+
+ private final CommandRegistry registry;
+
+ public GShell(final IO io) throws Exception {
+ this(new ClassWorld("gshell", Thread.currentThread().getContextClassLoader()), io);
+ }
+
+ public GShell(final ClassWorld classWorld, final IO io) throws Exception {
+ assert classWorld != null;
+ assert io != null;
+
+ this.classWorld = classWorld;
+ this.io = io;
+
+ // Lets time how long init takes
+ StopWatch watch = new StopWatch(true);
+
+ log.debug("Initializing");
+
+ sm = new ShellSecurityManager();
+
+ SecurityManager psm = System.getSecurityManager();
+ System.setSecurityManager(sm);
+
+ try {
+ ContainerConfiguration config = new DefaultContainerConfiguration();
+ config.setName("gshell.core");
+ config.setClassWorld(classWorld);
+ container = new DefaultPlexusContainer(config);
+ env = new DefaultEnvironment(io);
+
+ // Lookup the registry
+ registry = (CommandRegistry) container.lookup(CommandRegistry.class);
+
+ // We first need to stuff in the IO context for the new shell instance
+ IOLookup.set(container, io);
+ // And then lets stuff in the environment too
+ EnvironmentLookup.set(container, env);
+
+ // Then look up the shell we are gonna delegate to
+ shell = (InteractiveShell) container.lookup(InteractiveShell.class);
+ }
+ finally {
+ System.setSecurityManager(psm);
+ }
+
+ log.debug("Initialized in {}", watch);
+ }
+
+ public ShellInfo getShellInfo() {
+ return shell.getShellInfo();
+ }
+
+ public Environment getEnvironment() {
+ return shell.getEnvironment();
+ }
+
+ public CommandRegistry getCommandRegistry() {
+ return registry;
+ }
+
+ public Object execute(final String line) throws Exception {
+ SecurityManager psm = System.getSecurityManager();
+ System.setSecurityManager(sm);
+
+ try {
+ return shell.execute(line);
+ }
+ finally {
+ System.setSecurityManager(psm);
+ }
+ }
+
+ public Object execute(final Object... args) throws Exception {
+ SecurityManager psm = System.getSecurityManager();
+ System.setSecurityManager(sm);
+
+ try {
+ return shell.execute((Object[])args);
+ }
+ finally {
+ System.setSecurityManager(psm);
+ }
+ }
+
+ public Object execute(final String path, final Object[] args) throws Exception {
+ SecurityManager psm = System.getSecurityManager();
+ System.setSecurityManager(sm);
+
+ try {
+ return shell.execute(path, args);
+ }
+ finally {
+ System.setSecurityManager(psm);
+ }
+ }
+
+ public void run(final Object... args) throws Exception {
+ SecurityManager psm = System.getSecurityManager();
+ System.setSecurityManager(sm);
+
+ try {
+ // We first need to stuff in the IO context for the new shell instance
+ IOLookup.set(container, io);
+ // And then lets stuff in the environment too
+ EnvironmentLookup.set(container, env);
+
+ shell.run(args);
+ }
+ finally {
+ System.setSecurityManager(psm);
+ }
+ }
+}
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandDiscoverer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandDiscoverer.java?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandDiscoverer.java (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandDiscoverer.java Thu Oct 4 12:10:50 2007
@@ -0,0 +1,156 @@
+/**
+ * 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.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.command.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.command.descriptor.CommandSetDescriptor;
+import org.apache.geronimo.gshell.plugin.CommandSetDescriptorBuilder;
+import org.apache.geronimo.gshell.registry.CommandRegistry;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Sep 20, 2007
+ * Time: 10:37:31 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class OsgiCommandDiscoverer {
+
+ private static final transient Logger LOG = LoggerFactory.getLogger(OsgiCommandDiscoverer.class);
+
+ private final BundleContext bundleContext;
+ private final Map<String, OsgiCommand> commands;
+ private final CommandRegistry registry;
+
+ private class BundleListener implements SynchronousBundleListener {
+ public void bundleChanged(BundleEvent event) {
+ try {
+ Bundle bundle = event.getBundle();
+ if (event.getType() == BundleEvent.STARTED) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Bundle resolved: " + bundle.getSymbolicName());
+ }
+ mayBeAddCommandsFor(bundle);
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Bundle unresolved: " + bundle.getSymbolicName());
+ }
+ mayBeRemoveCommandsFor(bundle);
+ }
+ } catch (Throwable e) {
+ LOG.error("Exception handing bundle changed event", e);
+ }
+ }
+ }
+
+ private class OsgiCommand implements Command {
+ Bundle bundle;
+ String id;
+ String implementation;
+ String description;
+ Class type;
+
+ public String getId() {
+ return id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Object execute(CommandContext commandContext, Object... objects) throws Exception {
+ init();
+ Command cmd = (Command) type.newInstance();
+ return cmd.execute(commandContext, objects);
+ }
+
+ protected void init() throws Exception {
+ if (type == null) {
+ ClassLoader loader = BundleDelegatingClassLoader.createBundleClassLoaderFor(bundle);
+ type = loader.loadClass(implementation);
+ }
+ }
+ }
+
+ public OsgiCommandDiscoverer(BundleContext context, CommandRegistry registry) {
+ LOG.debug("Initializing OsgiCommandDiscoverer");
+ this.commands = new ConcurrentHashMap<String, OsgiCommand>();
+ this.bundleContext = context;
+ this.registry = registry;
+ bundleContext.addBundleListener(new BundleListener());
+ Bundle[] previousBundles = bundleContext.getBundles();
+ for (int i = 0; i < previousBundles.length; i++) {
+ int state = previousBundles[i].getState();
+ if (state == Bundle.ACTIVE) {
+ mayBeAddCommandsFor(previousBundles[i]);
+ }
+ }
+ }
+
+ protected synchronized void mayBeAddCommandsFor(Bundle bundle) {
+ URL url = bundle.getEntry("/META-INF/gshell/commands.xml");
+ if (url != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Found entry: " + url + " in bundle " + bundle.getSymbolicName());
+ }
+ try {
+ CommandSetDescriptor set = new CommandSetDescriptorBuilder().build(new InputStreamReader(url.openStream()), url.toString());
+ for (CommandDescriptor desc : set.getCommandDescriptors()) {
+ OsgiCommand cmd = new OsgiCommand();
+ cmd.bundle = bundle;
+ cmd.id = desc.getId();
+ cmd.implementation = desc.getImplementation();
+ cmd.description = desc.getDescription();
+ commands.put(cmd.id, cmd);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Adding command: " + cmd.id + " (" + cmd.implementation + ")");
+ }
+ registry.register(cmd);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected synchronized void mayBeRemoveCommandsFor(Bundle bundle) {
+ for (OsgiCommand entry : commands.values()) {
+ if (entry.bundle == bundle) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Removing entry: " + entry.id + " in bundle " + bundle.getSymbolicName());
+ }
+ Command cmd = commands.remove(entry.id);
+ registry.unregister(cmd);
+ }
+ }
+ }
+
+}
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/components.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/components.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/components.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,211 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.geronimo.gshell.branding.Branding</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.branding.DefaultBranding</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gshell.branding.VersionLoader</role>
+ <field-name>versionLoader</field-name>
+ </requirement>
+ <requirement>
+ <role>jline.Terminal</role>
+ <field-name>terminal</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.branding.VersionLoader</role>
+ <implementation>org.apache.geronimo.gshell.branding.PropertiesVersionLoader</implementation>
+ <isolated-realm>false</isolated-realm>
+ <configuration>
+ <resource-name>version.properties</resource-name>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.CommandLineBuilder</role>
+ <implementation>org.apache.geronimo.gshell.CommandLineBuilder</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.component.factory.ComponentFactory</role>
+ <role-hint>Terminal</role-hint>
+ <implementation>org.apache.geronimo.gshell.console.TerminalFactory</implementation>
+ <isolated-realm>false</isolated-realm>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.console.TerminalInfo</role>
+ <implementation>org.apache.geronimo.gshell.console.TerminalInfo</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>jline.Terminal</role>
+ <field-name>terminal</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.command.CommandExecutor</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.DefaultCommandExecutor</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.layout.LayoutManager</role>
+ <field-name>layoutManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.CommandLineBuilder</role>
+ <field-name>commandLineBuilder</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.shell.Environment</role>
+ <field-name>env</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.shell.InteractiveShell</role>
+ <implementation>org.apache.geronimo.gshell.DefaultShell</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gshell.shell.ShellInfo</role>
+ <field-name>shellInfo</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.branding.Branding</role>
+ <field-name>branding</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.command.CommandExecutor</role>
+ <field-name>executor</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.console.TerminalInfo</role>
+ <field-name>termInfo</field-name>
+ </requirement>
+ <requirement>
+ <role>jline.Terminal</role>
+ <field-name>terminal</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.shell.Environment</role>
+ <field-name>env</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.command.IO</role>
+ <field-name>io</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.shell.ShellInfo</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.DefaultShellInfo</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gshell.branding.Branding</role>
+ <field-name>branding</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.layout.LayoutManager</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.layout.DefaultLayoutManager</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
+ <field-name>commandRegistry</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.layout.loader.LayoutLoader</role>
+ <field-name>loader</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.shell.Environment</role>
+ <field-name>env</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.layout.loader.LayoutLoader</role>
+ <implementation>org.apache.geronimo.gshell.layout.loader.XMLLayoutLoader</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gshell.shell.ShellInfo</role>
+ <field-name>info</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.component.factory.ComponentFactory</role>
+ <role-hint>EnvironmentLookup</role-hint>
+ <implementation>org.apache.geronimo.gshell.lookup.EnvironmentLookup</implementation>
+ <isolated-realm>false</isolated-realm>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.component.factory.ComponentFactory</role>
+ <role-hint>IOLookup</role-hint>
+ <implementation>org.apache.geronimo.gshell.lookup.IOLookup</implementation>
+ <isolated-realm>false</isolated-realm>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.component.discovery.ComponentDiscoverer</role>
+ <role-hint>command</role-hint>
+ <implementation>org.apache.geronimo.gshell.plugin.CommandDiscoverer</implementation>
+ <isolated-realm>false</isolated-realm>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.component.discovery.ComponentDiscoveryListener</role>
+ <role-hint>command</role-hint>
+ <implementation>org.apache.geronimo.gshell.plugin.CommandDiscoveryListener</implementation>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
+ <field-name>registry</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.registry.DefaultCommandRegistry</implementation>
+ <isolated-realm>false</isolated-realm>
+ </component>
+ <component>
+ <role>org.apache.geronimo.gshell.URLHandlerFactory</role>
+ <implementation>org.apache.geronimo.gshell.URLHandlerFactory</implementation>
+ <instantiation-strategy>singleton-keep-alive</instantiation-strategy>
+ <isolated-realm>false</isolated-realm>
+ <requirements>
+ <requirement>
+ <role>java.net.URLStreamHandler</role>
+ <role-hints/>
+ <field-name>handlers</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/plexus.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/plexus.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/gshell-service/src/main/resources/META-INF/plexus/plexus.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,97 @@
+<?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.
+-->
+
+<!-- $Rev: 581061 $ $Date: 2007-10-01 22:18:31 +0200 (Mon, 01 Oct 2007) $ -->
+
+<plexus>
+ <component-discoverer-manager implementation="org.codehaus.plexus.component.discovery.DefaultComponentDiscovererManager">
+ <listeners>
+ <listener implementation="org.codehaus.plexus.component.discovery.DiscoveryListenerDescriptor">
+ <role>org.codehaus.plexus.component.discovery.ComponentDiscoveryListener</role>
+ <role-hint>command</role-hint>
+ </listener>
+ </listeners>
+
+ <component-discoverers>
+ <component-discoverer implementation="org.apache.geronimo.gshell.plugin.CommandDiscoverer"/>
+ </component-discoverers>
+ </component-discoverer-manager>
+
+ <components>
+ <!--
+ Configure our logging component to be used so Plexus will pick it up.
+ -->
+ <component>
+ <role>org.codehaus.plexus.logging.LoggerManager</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.Slf4jLoggingManager</implementation>
+ </component>
+
+ <!--
+ Configure the registry.
+ -->
+ <component>
+ <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.registry.DefaultCommandRegistry</implementation>
+ </component>
+
+ <!--
+ Configure the discovery listener to register commands
+ -->
+ <component>
+ <role>org.codehaus.plexus.component.discovery.ComponentDiscoveryListener</role>
+ <role-hint>command</role-hint>
+ <implementation>org.apache.geronimo.gshell.plugin.CommandDiscoveryListener</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
+ <field-name>registry</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <!--
+ Add our instance lookup components.
+ -->
+ <component>
+ <role>org.apache.geronimo.gshell.command.IO</role>
+ <component-factory>IOLookup</component-factory>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gshell.shell.Environment</role>
+ <component-factory>EnvironmentLookup</component-factory>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+
+ <component>
+ <role>jline.Terminal</role>
+ <component-factory>Terminal</component-factory>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+
+ </components>
+</plexus>
\ No newline at end of file
Added: incubator/servicemix/branches/osgi/gshell/gshell-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/gshell/gshell-osgi/pom.xml?rev=581988&view=auto
==============================================================================
--- incubator/servicemix/branches/osgi/gshell/gshell-osgi/pom.xml (added)
+++ incubator/servicemix/branches/osgi/gshell/gshell-osgi/pom.xml Thu Oct 4 12:10:50 2007
@@ -0,0 +1,57 @@
+<?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.
+-->
+
+<!-- $Rev: 580689 $ $Date: 2007-09-30 12:06:25 +0200 (Sun, 30 Sep 2007) $ -->
+
+<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.geronimo.gshell</groupId>
+ <artifactId>gshell</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.gshell.osgi</groupId>
+ <artifactId>gshell-osgi</artifactId>
+ <name>GShell OSGi</name>
+ <packaging>pom</packaging>
+
+ <description>
+ Support modules for OSGi.
+ </description>
+
+ <modules>
+ <module>gshell-osgi-commands</module>
+ <module>gshell-service</module>
+ <module>gshell-pax-runner</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>false</enabled></releases>
+ </repository>
+ </repositories>
+
+</project>
\ No newline at end of file