servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r701145 - in /servicemix/smx4/kernel/trunk: ./ assembly/ assembly/src/main/descriptors/ assembly/src/main/filtered-resources/etc/ gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/ gshell/gshell-a...
Date Thu, 02 Oct 2008 15:08:21 GMT
Author: gnodet
Date: Thu Oct  2 08:08:20 2008
New Revision: 701145

URL: http://svn.apache.org/viewvc?rev=701145&view=rev
Log:
SMX4KNL-28, SMX4KNL-90: new shells for configuration admin service and packages admin service

Added:
    servicemix/smx4/kernel/trunk/gshell/gshell-config/   (with props)
    servicemix/smx4/kernel/trunk/gshell/gshell-config/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/CancelCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ConfigCommandSupport.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/EditCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ListCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropDelCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropListCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropSetCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/UpdateCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/
    servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/   (with props)
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ExportsCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ImportsCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/PackageCommandSupport.java
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/
    servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
Modified:
    servicemix/smx4/kernel/trunk/assembly/pom.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.ops4j.pax.url.mvn.cfg
    servicemix/smx4/kernel/trunk/pom.xml

Modified: servicemix/smx4/kernel/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/pom.xml?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/pom.xml Thu Oct  2 08:08:20 2008
@@ -75,6 +75,14 @@
             <artifactId>org.apache.servicemix.kernel.gshell.features</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.servicemix.kernel.gshell</groupId>
+            <artifactId>org.apache.servicemix.kernel.gshell.config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel.gshell</groupId>
+            <artifactId>org.apache.servicemix.kernel.gshell.packages</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.servicemix.kernel.jaas</groupId>
             <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
         </dependency>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml Thu Oct  2 08:08:20 2008
@@ -193,6 +193,8 @@
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.log</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.obr</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.features</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.config</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.packages</include>
             </includes>
         </dependencySet>
         <dependencySet>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml Thu Oct  2 08:08:20 2008
@@ -185,6 +185,8 @@
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.log</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.obr</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.features</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.config</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.packages</include>
             </includes>
         </dependencySet>
         <dependencySet>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties Thu Oct  2 08:08:20 2008
@@ -53,6 +53,8 @@
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.osgi/${pom.version}/org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.features/${pom.version}/org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.log/${pom.version}/org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
+org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.config/${pom.version}/org.apache.servicemix.kernel.gshell.config-${pom.version}.jar=50
+org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.packages/${pom.version}/org.apache.servicemix.kernel.gshell.packages-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.config/${pom.version}/org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.keystore/${pom.version}/org.apache.servicemix.kernel.jaas.keystore-${pom.version}.jar=50
 

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties Thu Oct  2 08:08:20 2008
@@ -53,6 +53,8 @@
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.osgi/${pom.version}/org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.features/${pom.version}/org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
 org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.log/${pom.version}/org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
+org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.config/${pom.version}/org.apache.servicemix.kernel.gshell.config-${pom.version}.jar=50
+org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.packages/${pom.version}/org.apache.servicemix.kernel.gshell.packages-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.config/${pom.version}/org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.keystore/${pom.version}/org.apache.servicemix.kernel.jaas.keystore-${pom.version}.jar=50
 

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.ops4j.pax.url.mvn.cfg
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.ops4j.pax.url.mvn.cfg?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.ops4j.pax.url.mvn.cfg (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.ops4j.pax.url.mvn.cfg Thu Oct  2 08:08:20 2008
@@ -43,7 +43,7 @@
 # above, or defaulted to:
 #     System.getProperty( "user.home" ) + "/.m2/repository"
 #
-#org.ops4j.pax.url.mvn.localRepository=
+org.ops4j.pax.url.mvn.localRepository=file:${servicemix.home}/system@snapshots
 
 #
 # Comma separated list of repositories scanned when resolving an artifact.
@@ -58,4 +58,4 @@
 #
 # The following property value will add the system folders as a repo.
 #
-org.ops4j.pax.url.mvn.repositories=+file:${servicemix.base}/system@snapshots,file:${servicemix.home}/system@snapshots
+org.ops4j.pax.url.mvn.repositories=file:${servicemix.base}/system@snapshots,file:${user.home}/.m2/repository@snapshots,http://repo1.maven.org/maven2,http://people.apache.org/repo/m2-snapshot-repository@snapshots@noreleases,http://svn.apache.org/repos/asf/servicemix/m2-repo

Propchange: servicemix/smx4/kernel/trunk/gshell/gshell-config/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct  2 08:08:20 2008
@@ -0,0 +1,8 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/pom.xml?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/pom.xml Thu Oct  2 08:08:20 2008
@@ -0,0 +1,84 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.kernel.gshell</groupId>
+        <artifactId>gshell</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.gshell</groupId>
+    <artifactId>org.apache.servicemix.kernel.gshell.config</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.1.0-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: GShell ConfigAdmin Commands</name>
+
+    <description>
+        Provides the ConfigAdmin GShell commands
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel.gshell</groupId>
+            <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <version>${spring.osgi.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            org.apache.servicemix.kernel.gshell.config*;version=${project.version};-split-package:=merge-first
+                        </Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/CancelCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/CancelCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/CancelCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/CancelCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+@CommandComponent(id="config:cancel", description="Abort the edition of the configuration")
+public class CancelCommand extends ConfigCommandSupport {
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        this.variables.parent().unset(PROPERTY_CONFIG_PID);
+        this.variables.parent().unset(PROPERTY_CONFIG_PROPS);
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ConfigCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ConfigCommandSupport.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ConfigCommandSupport.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ConfigCommandSupport.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+
+import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.Configuration;
+
+/**
+ * Abstract class from which all commands related to the ConfigurationAdmin
+ * service should derive.
+ * This command retrieves a reference to the ConfigurationAdmin service before
+ * calling another method to actually process the command.
+ */
+public abstract class ConfigCommandSupport extends OsgiCommandSupport {
+
+    public static final String PROPERTY_CONFIG_PID = "ConfigCommand.PID";
+    public static final String PROPERTY_CONFIG_PROPS = "ConfigCommand.Props";
+
+    protected Object doExecute() throws Exception {
+        // Get config admin service.
+        ServiceReference ref = getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+        if (ref == null) {
+            io.out.println("ConfigurationAdmin service is unavailable.");
+            return null;
+        }
+        try {
+            ConfigurationAdmin admin = (ConfigurationAdmin) getBundleContext().getService(ref);
+            if (admin == null) {
+                io.out.println("ConfigAdmin service is unavailable.");
+                return null;
+            }
+
+            doExecute(admin);
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+        return null;
+    }
+
+    protected Dictionary getEditedProps() throws Exception {
+        return (Dictionary) this.variables.parent().get(PROPERTY_CONFIG_PROPS);
+    }
+
+    protected abstract void doExecute(ConfigurationAdmin admin) throws Exception;
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/EditCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/EditCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/EditCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/EditCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+
+@CommandComponent(id="config:edit", description="Create or edit a configurations")
+public class EditCommand extends ConfigCommandSupport {
+
+    @Argument(required = true, description = "PID of the configuration")
+    String pid;
+
+    @Option(name = "--force", description = "Force the edition of this config, even if another one was under edition")
+    boolean force;
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        String oldPid = (String) this.variables.get(PROPERTY_CONFIG_PID);
+        if (oldPid != null && !oldPid.equals(pid) && !force) {
+            io.err.println("Another config is being edited.  Cancel / update first, or use the --force option");
+            return;
+        }
+        Dictionary props = admin.getConfiguration(pid).getProperties();
+        this.variables.parent().set(PROPERTY_CONFIG_PID, pid);
+        this.variables.parent().set(PROPERTY_CONFIG_PROPS, props);
+    }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ListCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ListCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ListCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/ListCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Enumeration;
+import java.util.Dictionary;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.Configuration;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+@CommandComponent(id="config:list", description="List existing configurations")
+public class ListCommand extends ConfigCommandSupport {
+
+    @Argument(required = false, description = "LDAP query")
+    String query;
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        Configuration[] configs = admin.listConfigurations(query);
+        for (Configuration config : configs) {
+            io.out.println("----------------------------------------------------------------");
+            io.out.println("Pid:            " + config.getPid());
+            if (config.getFactoryPid() != null) {
+                io.out.println("FactoryPid:     " + config.getFactoryPid());
+            }
+            io.out.println("BundleLocation: " + config.getBundleLocation());
+            if (config.getProperties() != null) {
+                io.out.println("Properties:");
+                Dictionary props = config.getProperties();
+                for (Enumeration e = props.keys(); e.hasMoreElements();) {
+                    Object key = e.nextElement();
+                    io.out.println("   " + key + " = " + props.get(key));
+                }
+            }
+        }
+    }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropDelCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropDelCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropDelCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropDelCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+@CommandComponent(id="config:propdel", description="Delete a property from the edited configuration")
+public class PropDelCommand extends ConfigCommandSupport {
+
+    @Argument(index = 0, required = true, description = "the property to delete")
+    String prop;
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        Dictionary props = getEditedProps();
+        if (props == null) {
+            System.err.println("No configuration is being edited. Run the edit command first");
+        } else {
+            props.remove(prop);
+        }
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropListCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropListCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropListCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropListCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+@CommandComponent(id="config:proplist", description="List the edited configuration")
+public class PropListCommand extends ConfigCommandSupport {
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        Dictionary props = getEditedProps();
+        if (props == null) {
+            System.err.println("No configuration is being edited. Run the edit command first");
+        } else {
+            for (Enumeration e = props.keys(); e.hasMoreElements();) {
+                Object key = e.nextElement();
+                io.out.println("   " + key + " = " + props.get(key));
+            }
+        }
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropSetCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropSetCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropSetCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/PropSetCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+@CommandComponent(id="config:propset", description="Set a property on the edited configuration")
+public class PropSetCommand extends ConfigCommandSupport {
+
+    @Argument(index = 0, required = true, description = "the property to set")
+    String prop;
+
+    @Argument(index = 1, required = true, description = "the value of the property")
+    String value;
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        Dictionary props = getEditedProps();
+        if (props == null) {
+            System.err.println("No configuration is being edited. Run the edit command first");
+        } else {
+            props.put(prop, value);
+        }
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/UpdateCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/UpdateCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/UpdateCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/java/org/apache/servicemix/kernel/gshell/config/UpdateCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.config;
+
+import java.util.Dictionary;
+
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.Configuration;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+@CommandComponent(id="config:update", description="Update the edited configuration")
+public class UpdateCommand extends ConfigCommandSupport {
+
+    protected void doExecute(ConfigurationAdmin admin) throws Exception {
+        Dictionary props = getEditedProps();
+        if (props == null) {
+            System.err.println("No configuration is being edited. Run the edit command first");
+        } else {
+            String pid = (String) this.variables.parent().get(PROPERTY_CONFIG_PID);
+            Configuration cfg = admin.getConfiguration(pid, null);
+            cfg.update(props);
+            this.variables.parent().unset(PROPERTY_CONFIG_PID);
+            this.variables.parent().unset(PROPERTY_CONFIG_PROPS);
+        }
+    }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml Thu Oct  2 08:08:20 2008
@@ -0,0 +1,99 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+    <!-- osgi commands -->
+    <bean id="cancel" class="org.apache.servicemix.kernel.gshell.config.CancelCommand" />
+
+    <bean id="edit" class="org.apache.servicemix.kernel.gshell.config.EditCommand" />
+
+    <bean id="list" class="org.apache.servicemix.kernel.gshell.config.ListCommand" />
+
+    <bean id="propdel" class="org.apache.servicemix.kernel.gshell.config.PropDelCommand" />
+
+    <bean id="proplist" class="org.apache.servicemix.kernel.gshell.config.PropListCommand" />
+
+    <bean id="propset" class="org.apache.servicemix.kernel.gshell.config.PropSetCommand" />
+
+    <bean id="update" class="org.apache.servicemix.kernel.gshell.config.UpdateCommand" />
+
+    <osgi:service ref="cancel" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+      	<entry key="name" value="cancel"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="edit" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+      	<entry key="name" value="edit"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="list" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+      	<entry key="name" value="list"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="propdel" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+        <entry key="name" value="propdel"/>
+        <entry key="alias" value="pd"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="proplist" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+        <entry key="name" value="proplist"/>
+        <entry key="alias" value="pl"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="propset" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+        <entry key="name" value="propset"/>
+        <entry key="alias" value="ps"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="update" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="config"/>
+        <entry key="name" value="update"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+</beans>
\ No newline at end of file

Propchange: servicemix/smx4/kernel/trunk/gshell/gshell-packages/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct  2 08:08:20 2008
@@ -0,0 +1,8 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+eclipse-classes

Added: servicemix/smx4/kernel/trunk/gshell/gshell-packages/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-packages/pom.xml?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-packages/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-packages/pom.xml Thu Oct  2 08:08:20 2008
@@ -0,0 +1,83 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.kernel.gshell</groupId>
+        <artifactId>gshell</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.gshell</groupId>
+    <artifactId>org.apache.servicemix.kernel.gshell.packages</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.1.0-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: GShell PackageAdmin Commands</name>
+
+    <description>
+        Provides the PackageAdmin GShell commands
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel.gshell</groupId>
+            <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            org.apache.servicemix.kernel.gshell.packages*;version=${project.version};-split-package:=merge-first
+                        </Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ExportsCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ExportsCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ExportsCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ExportsCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.packages;
+
+import java.util.List;
+import java.io.PrintWriter;
+
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+
+@CommandComponent(id="package:exports", description="List exported packages")
+public class ExportsCommand extends PackageCommandSupport {
+
+    @Option(name = "-i", aliases = { "--imports"}, description = "List bundles importing the packages")
+    boolean imports;
+
+    @Argument(required = false, multiValued = true, description = "bundle ids")
+    List<Long> ids;
+
+    protected void doExecute(PackageAdmin admin) throws Exception {
+        if (ids != null && !ids.isEmpty()) {
+            for (long id : ids) {
+                Bundle bundle = getBundleContext().getBundle(id);
+                if (bundle != null) {
+                    printExports(io.out, bundle, admin.getExportedPackages(bundle));
+                } else {
+                    io.err.println("Bundle ID " + id + " is invalid.");
+                }
+            }
+        }
+        else {
+            printExports(io.out, null, admin.getExportedPackages((Bundle) null));
+        }
+    }
+
+    protected void printExports(PrintWriter out, Bundle target, ExportedPackage[] exports) {
+        if ((exports != null) && (exports.length > 0)) {
+            for (int i = 0; i < exports.length; i++) {
+                Bundle bundle = exports[i].getExportingBundle();
+                out.print(getBundleName(bundle));
+                out.println(": " + exports[i]);
+                if (imports) {
+                    Bundle[] bs = exports[i].getImportingBundles();
+                    if (bs != null) {
+                        for (Bundle b : bs) {
+                            out.println("\t" + getBundleName(b));
+                        }
+                    }
+                }
+            }
+        } else {
+            out.println(getBundleName(target) + ": No active exported packages.");
+        }
+    }
+
+    public static String getBundleName(Bundle bundle) {
+        if (bundle != null) {
+            String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
+            return (name == null)
+                ? "Bundle " + Long.toString(bundle.getBundleId())
+                : name + " (" + Long.toString(bundle.getBundleId()) + ")";
+        }
+        return "[STALE BUNDLE]";
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ImportsCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ImportsCommand.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ImportsCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/ImportsCommand.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.packages;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.PrintWriter;
+
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+
+@CommandComponent(id="package:imports", description="List imported packages")
+public class ImportsCommand extends PackageCommandSupport {
+
+    @Argument(required = false, multiValued = true, description = "bundle ids")
+    List<Long> ids;
+
+    protected void doExecute(PackageAdmin admin) throws Exception {
+        Map<Long, List<ExportedPackage>> packages = new HashMap<Long, List<ExportedPackage>>();
+        ExportedPackage[] exported = admin.getExportedPackages((Bundle) null);
+        for (ExportedPackage pkg : exported) {
+            Bundle[] bundles = pkg.getImportingBundles();
+            if (bundles != null) {
+                for (Bundle b : bundles) {
+                    List<ExportedPackage> p = packages.get(b.getBundleId());
+                    if (p == null) {
+                        p = new ArrayList<ExportedPackage>();
+                        packages.put(b.getBundleId(), p);
+                    }
+                    p.add(pkg);
+                }
+            }
+        }
+        if (ids != null && !ids.isEmpty()) {
+            for (long id : ids) {
+                Bundle bundle = getBundleContext().getBundle(id);
+                if (bundle != null) {
+                    printImports(io.out, bundle, packages.get(bundle.getBundleId()));
+                } else {
+                    io.err.println("Bundle ID " + id + " is invalid.");
+                }
+            }
+        }
+        else {
+            List<ExportedPackage> pkgs = new ArrayList<ExportedPackage>();
+            for (List<ExportedPackage> l : packages.values()) {
+                pkgs.addAll(l);
+            }
+            printImports(io.out, null, pkgs);
+        }
+    }
+
+    protected void printImports(PrintWriter out, Bundle target, List<ExportedPackage> imports) {
+        if ((imports != null) && (imports.size() > 0)) {
+            for (ExportedPackage p : imports) {
+                Bundle bundle = p.getExportingBundle();
+                out.print(getBundleName(bundle));
+                out.println(": " + p);
+            }
+        } else {
+            out.println(getBundleName(target) + ": No active imported packages.");
+        }
+    }
+
+    public static String getBundleName(Bundle bundle) {
+        if (bundle != null) {
+            String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
+            return (name == null)
+                ? "Bundle " + Long.toString(bundle.getBundleId())
+                : name + " (" + Long.toString(bundle.getBundleId()) + ")";
+        }
+        return "[STALE BUNDLE]";
+    }
+
+}
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/PackageCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/PackageCommandSupport.java?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/PackageCommandSupport.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/java/org/apache/servicemix/kernel/gshell/packages/PackageCommandSupport.java Thu Oct  2 08:08:20 2008
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.packages;
+
+import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Abstract class from which all commands related to the PackageAdmin
+ * service should derive.
+ * This command retrieves a reference to the PackageAdmin service before
+ * calling another method to actually process the command.
+ */
+public abstract class PackageCommandSupport extends OsgiCommandSupport {
+
+    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 null;
+        }
+        try {
+            PackageAdmin admin = (PackageAdmin) getBundleContext().getService(ref);
+            if (admin == null) {
+                io.out.println("PackageAdmin service is unavailable.");
+                return null;
+            }
+
+            doExecute(admin);
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+        return null;
+    }
+
+    protected abstract void doExecute(PackageAdmin admin) throws Exception;
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml?rev=701145&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml Thu Oct  2 08:08:20 2008
@@ -0,0 +1,51 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+    <!-- osgi commands -->
+    <bean id="exports" class="org.apache.servicemix.kernel.gshell.packages.ExportsCommand" />
+
+    <bean id="imports" class="org.apache.servicemix.kernel.gshell.packages.ImportsCommand" />
+
+    <osgi:service ref="exports" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="packages"/>
+      	<entry key="name" value="exports"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="imports" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="packages"/>
+      	<entry key="name" value="imports"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+</beans>

Modified: servicemix/smx4/kernel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/pom.xml?rev=701145&r1=701144&r2=701145&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/pom.xml Thu Oct  2 08:08:20 2008
@@ -174,6 +174,16 @@
                 <version>${pom.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.servicemix.kernel.gshell</groupId>
+                <artifactId>org.apache.servicemix.kernel.gshell.config</artifactId>
+                <version>${pom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.servicemix.kernel.gshell</groupId>
+                <artifactId>org.apache.servicemix.kernel.gshell.packages</artifactId>
+                <version>${pom.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.servicemix.kernel.jaas</groupId>
                 <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
                 <version>${pom.version}</version>



Mime
View raw message