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/11/29 22:34:21 UTC

svn commit: r599584 - in /servicemix/branches/servicemix-4.0: ./ apache-servicemix/ apache-servicemix/src/main/descriptors/ apache-servicemix/src/main/release/conf/ apache-servicemix/src/main/release/etc/ bundles/ant/ gshell/ gshell/gshell-obr/ gshell/...

Author: gnodet
Date: Thu Nov 29 13:34:16 2007
New Revision: 599584

URL: http://svn.apache.org/viewvc?rev=599584&view=rev
Log:
Add OBR bundele and related gshell commands

Added:
    servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/conf/org.apache.servicemix.management.cfg
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/   (with props)
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/pom.xml
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/AddUrlCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/DeployCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/FileUtil.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/InfoCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListUrlCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ObrCommandSupport.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/OsgiCommandSupport.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/RemoveUrlCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/SourceCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/StartCommand.java
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/
    servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml
Removed:
    servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml
Modified:
    servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
    servicemix/branches/servicemix-4.0/apache-servicemix/src/main/descriptors/unix-bin.xml
    servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/etc/layout.xml
    servicemix/branches/servicemix-4.0/bundles/ant/   (props changed)
    servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
    servicemix/branches/servicemix-4.0/gshell/pom.xml
    servicemix/branches/servicemix-4.0/pom.xml
    servicemix/branches/servicemix-4.0/runtime/   (props changed)
    servicemix/branches/servicemix-4.0/runtime/filemonitor/   (props changed)
    servicemix/branches/servicemix-4.0/runtime/minimum/   (props changed)
    servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml

Modified: servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml Thu Nov 29 13:34:16 2007
@@ -329,10 +329,15 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-jms</artifactId>
         </dependency>
-      <dependency>
-        <groupId>org.apache.ws.commons.schema</groupId>
-        <artifactId>XmlSchema</artifactId>
-      </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.schema</groupId>
+            <artifactId>XmlSchema</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <version>${bundlerepository.version}</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

Modified: servicemix/branches/servicemix-4.0/apache-servicemix/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/descriptors/unix-bin.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/apache-servicemix/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/branches/servicemix-4.0/apache-servicemix/src/main/descriptors/unix-bin.xml Thu Nov 29 13:34:16 2007
@@ -159,6 +159,17 @@
             </includes>
         </dependencySet>
 
+        <!-- OBR + GShell command -->
+        <dependencySet>
+            <outputDirectory>/system</outputDirectory>
+            <unpack>false</unpack>
+            <scope>runtime</scope>
+            <includes>
+                <include>org.apache.felix:bundlerepository</include>
+                <include>org.apache.servicemix.gshell:org.apache.servicemix.gshell.obr</include>
+            </includes>
+        </dependencySet>
+
         <!-- Transaction Manager -->
         <dependencySet>
             <outputDirectory>/system</outputDirectory>

Added: servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/conf/org.apache.servicemix.management.cfg
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/conf/org.apache.servicemix.management.cfg?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/conf/org.apache.servicemix.management.cfg (added)
+++ servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/conf/org.apache.servicemix.management.cfg Thu Nov 29 13:34:16 2007
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+#
+rmiRegistryPort = 1099
+jmxLogin        = smx
+jmxPassword     = smx
+serviceUrl      = service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
+daemon          = true
+threaded        = true
+objectName      = connector:name=rmi

Modified: servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/etc/layout.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/etc/layout.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/etc/layout.xml (original)
+++ servicemix/branches/servicemix-4.0/apache-servicemix/src/main/release/etc/layout.xml Thu Nov 29 13:34:16 2007
@@ -143,6 +143,45 @@
             </nodes>
         </group>
 
+        <!-- OBR -->
+        <group>
+            <name>obr</name>
+            <nodes>
+                <command>
+                    <name>addUrl</name>
+                    <id>obr:addUrl</id>
+                </command>
+                <command>
+                    <name>deploy</name>
+                    <id>obr:deploy</id>
+                </command>
+                <command>
+                    <name>info</name>
+                    <id>obr:info</id>
+                </command>
+                <command>
+                    <name>list</name>
+                    <id>obr:list</id>
+                </command>
+                <command>
+                    <name>listUrl</name>
+                    <id>obr:listUrl</id>
+                </command>
+                <command>
+                    <name>removeUrl</name>
+                    <id>obr:removeUrl</id>
+                </command>
+                <command>
+                    <name>source</name>
+                    <id>obr:source</id>
+                </command>
+                <command>
+                    <name>start</name>
+                    <id>obr:start</id>
+                </command>
+            </nodes>
+        </group>
+
     </nodes>
 
 </layout>

Propchange: servicemix/branches/servicemix-4.0/bundles/ant/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Nov 29 13:34:16 2007
@@ -1 +1,2 @@
 target
+*.iml

Propchange: servicemix/branches/servicemix-4.0/gshell/gshell-obr/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 29 13:34:16 2007
@@ -0,0 +1,4 @@
+target
+*.iml
+*.iws
+*.ipr

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/pom.xml?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/pom.xml (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/pom.xml Thu Nov 29 13:34:16 2007
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.gshell</groupId>
+        <artifactId>gshell</artifactId>
+        <version>4.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.gshell</groupId>
+    <artifactId>org.apache.servicemix.gshell.obr</artifactId>
+    <packaging>bundle</packaging>
+    <name>ServiceMix GShell OBR Commands</name>
+
+    <description>
+        Provides the OBR GShell commands
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${felix.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <version>${bundlerepository.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell</groupId>
+            <artifactId>gshell-command-api</artifactId>
+            <version>${gshell.version}</version>
+        </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>
+                <version>${felix.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>org.apache.geronimo.gshell.obr*;version=${project.version}</Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Spring-Context>*;publish-context:=false</Spring-Context>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/AddUrlCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/AddUrlCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/AddUrlCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/AddUrlCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.obr;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.obr.RepositoryAdmin;
+
+@CommandComponent(id="obr:addUrl", description="Add a list of repository URLs to the repository service")
+public class AddUrlCommand extends ObrCommandSupport {
+
+    @Argument(required = true, multiValued = true, description = "Repository URLs")
+    List<URL> urls;
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        for (URL url : urls) {
+            admin.addRepository(url);
+        }
+    }
+}

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/DeployCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/DeployCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/DeployCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/DeployCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,125 @@
+/*
+ * 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.obr;
+
+import java.util.List;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Requirement;
+import org.osgi.service.obr.Resolver;
+import org.osgi.service.obr.Resource;
+
+@CommandComponent(id="obr:deploy", description="Deploy")
+public class DeployCommand extends ObrCommandSupport {
+
+    @Argument(required = true, index = 1, multiValued = true, description = "List of bundles")
+    List<String> bundles;
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        doDeploy(admin, false);
+    }
+
+    protected void doDeploy(RepositoryAdmin admin, boolean start) throws Exception {
+        Resolver resolver = admin.resolver();
+        for (String bundle : bundles) {
+            String[] target = getTarget(bundle);
+            Resource resource = selectNewestVersion(searchRepository(admin, target[0], target[1]));
+            if (resource != null)
+            {
+                resolver.add(resource);
+            }
+            else
+            {
+                io.err.println("Unknown bundle - " + target[0]);
+            }
+        }
+        if ((resolver.getAddedResources() != null) &&
+            (resolver.getAddedResources().length > 0))
+        {
+            if (resolver.resolve())
+            {
+                io.out.println("Target resource(s):");
+                printUnderline(io.out, 19);
+                Resource[] resources = resolver.getAddedResources();
+                for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++)
+                {
+                    io.out.println("   " + resources[resIdx].getPresentationName()
+                        + " (" + resources[resIdx].getVersion() + ")");
+                }
+                resources = resolver.getRequiredResources();
+                if ((resources != null) && (resources.length > 0))
+                {
+                    io.out.println("\nRequired resource(s):");
+                    printUnderline(io.out, 21);
+                    for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                    {
+                        io.out.println("   " + resources[resIdx].getPresentationName()
+                            + " (" + resources[resIdx].getVersion() + ")");
+                    }
+                }
+                resources = resolver.getOptionalResources();
+                if ((resources != null) && (resources.length > 0))
+                {
+                    io.out.println("\nOptional resource(s):");
+                    printUnderline(io.out, 21);
+                    for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                    {
+                        io.out.println("   " + resources[resIdx].getPresentationName()
+                            + " (" + resources[resIdx].getVersion() + ")");
+                    }
+                }
+
+                try
+                {
+                    io.out.print("\nDeploying...");
+                    resolver.deploy(start);
+                    io.out.println("done.");
+                }
+                catch (IllegalStateException ex)
+                {
+                    io.err.println(ex);
+                }
+            }
+            else
+            {
+                Requirement[] reqs = resolver.getUnsatisfiedRequirements();
+                if ((reqs != null) && (reqs.length > 0))
+                {
+                    io.out.println("Unsatisfied requirement(s):");
+                    printUnderline(io.out, 27);
+                    for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++)
+                    {
+                        io.out.println("   " + reqs[reqIdx].getFilter());
+                        Resource[] resources = resolver.getResources(reqs[reqIdx]);
+                        for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                        {
+                            io.out.println("      " + resources[resIdx].getPresentationName());
+                        }
+                    }
+                }
+                else
+                {
+                    io.out.println("Could not resolve targets.");
+                }
+            }
+        }
+
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/FileUtil.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/FileUtil.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/FileUtil.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/FileUtil.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,170 @@
+/*
+ * 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.obr;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+public class FileUtil
+{
+    public static void downloadSource(
+        PrintWriter out, PrintWriter err,
+        URL srcURL, String dirStr, boolean extract)
+    {
+        // Get the file name from the URL.
+        String fileName = (srcURL.getFile().lastIndexOf('/') > 0)
+            ? srcURL.getFile().substring(srcURL.getFile().lastIndexOf('/') + 1)
+            : srcURL.getFile();
+
+        try
+        {
+            out.println("Connecting...");
+
+            File dir = new File(dirStr);
+            if (!dir.exists())
+            {
+                err.println("Destination directory does not exist.");
+            }
+            File file = new File(dir, fileName);
+
+            OutputStream os = new FileOutputStream(file);
+            URLConnection conn = srcURL.openConnection();
+            int total = conn.getContentLength();
+            InputStream is = conn.getInputStream();
+
+            if (total > 0)
+            {
+                out.println("Downloading " + fileName
+                    + " ( " + total + " bytes ).");
+            }
+            else
+            {
+                out.println("Downloading " + fileName + ".");
+            }
+            byte[] buffer = new byte[4096];
+            int count = 0;
+            for (int len = is.read(buffer); len > 0; len = is.read(buffer))
+            {
+                count += len;
+                os.write(buffer, 0, len);
+            }
+
+            os.close();
+            is.close();
+
+            if (extract)
+            {
+                is = new FileInputStream(file);
+                JarInputStream jis = new JarInputStream(is);
+                out.println("Extracting...");
+                unjar(jis, dir);
+                jis.close();
+                file.delete();
+            }
+        }
+        catch (Exception ex)
+        {
+            err.println(ex);
+        }
+    }
+
+    public static void unjar(JarInputStream jis, File dir)
+        throws IOException
+    {
+        // Reusable buffer.
+        byte[] buffer = new byte[4096];
+
+        // Loop through JAR entries.
+        for (JarEntry je = jis.getNextJarEntry();
+             je != null;
+             je = jis.getNextJarEntry())
+        {
+            if (je.getName().startsWith("/"))
+            {
+                throw new IOException("JAR resource cannot contain absolute paths.");
+            }
+
+            File target = new File(dir, je.getName());
+
+            // Check to see if the JAR entry is a directory.
+            if (je.isDirectory())
+            {
+                if (!target.exists())
+                {
+                    if (!target.mkdirs())
+                    {
+                        throw new IOException("Unable to create target directory: "
+                            + target);
+                    }
+                }
+                // Just continue since directories do not have content to copy.
+                continue;
+            }
+
+            int lastIndex = je.getName().lastIndexOf('/');
+            String name = (lastIndex >= 0) ?
+                je.getName().substring(lastIndex + 1) : je.getName();
+            String destination = (lastIndex >= 0) ?
+                je.getName().substring(0, lastIndex) : "";
+
+            // JAR files use '/', so convert it to platform separator.
+            destination = destination.replace('/', File.separatorChar);
+            copy(jis, dir, name, destination, buffer);
+        }
+    }
+
+    public static void copy(
+        InputStream is, File dir, String destName, String destDir, byte[] buffer)
+        throws IOException
+    {
+        if (destDir == null)
+        {
+            destDir = "";
+        }
+
+        // Make sure the target directory exists and
+        // that is actually a directory.
+        File targetDir = new File(dir, destDir);
+        if (!targetDir.exists())
+        {
+            if (!targetDir.mkdirs())
+            {
+                throw new IOException("Unable to create target directory: "
+                    + targetDir);
+            }
+        }
+        else if (!targetDir.isDirectory())
+        {
+            throw new IOException("Target is not a directory: "
+                + targetDir);
+        }
+
+        BufferedOutputStream bos = new BufferedOutputStream(
+            new FileOutputStream(new File(targetDir, destName)));
+        int count = 0;
+        while ((count = is.read(buffer)) > 0)
+        {
+            bos.write(buffer, 0, count);
+        }
+        bos.close();
+    }
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/InfoCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/InfoCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/InfoCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/InfoCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,106 @@
+/*
+ * 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.obr;
+
+import java.io.PrintWriter;
+import java.lang.reflect.Array;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.obr.Capability;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Requirement;
+import org.osgi.service.obr.Resource;
+
+@CommandComponent(id="obr:info", description="Display the meta-data for the specified bundles.")
+public class InfoCommand extends ObrCommandSupport {
+
+    @Argument(required = true, multiValued = true)
+    List<String> bundles;
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        for (String bundle : bundles) {
+            String[] target = getTarget(bundle);
+            Resource[] resources = searchRepository(admin, target[0], target[1]);
+            if (resources == null)
+            {
+                io.err.println("Unknown bundle and/or version: "
+                    + target[0]);
+            }
+            else
+            {
+                for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                {
+                    if (resIdx > 0)
+                    {
+                        io.out.println("");
+                    }
+                    printResource(io.out, resources[resIdx]);
+                }
+            }
+        }
+    }
+
+    private void printResource(PrintWriter out, Resource resource)
+    {
+        printUnderline(out, resource.getPresentationName().length());
+        out.println(resource.getPresentationName());
+        printUnderline(out, resource.getPresentationName().length());
+
+        Map map = resource.getProperties();
+        for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); )
+        {
+            Map.Entry entry = (Map.Entry) iter.next();
+            if (entry.getValue().getClass().isArray())
+            {
+                out.println(entry.getKey() + ":");
+                for (int j = 0; j < Array.getLength(entry.getValue()); j++)
+                {
+                    out.println("   " + Array.get(entry.getValue(), j));
+                }
+            }
+            else
+            {
+                out.println(entry.getKey() + ": " + entry.getValue());
+            }
+        }
+
+        Requirement[] reqs = resource.getRequirements();
+        if ((reqs != null) && (reqs.length > 0))
+        {
+            out.println("Requires:");
+            for (int i = 0; i < reqs.length; i++)
+            {
+                out.println("   " + reqs[i].getFilter());
+            }
+        }
+
+        Capability[] caps = resource.getCapabilities();
+        if ((caps != null) && (caps.length > 0))
+        {
+            out.println("Capabilities:");
+            for (int i = 0; i < caps.length; i++)
+            {
+                out.println("   " + caps[i].getProperties());
+            }
+        }
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,89 @@
+/*
+ * 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.obr;
+
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+import java.util.List;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Version;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Resource;
+
+@CommandComponent(id="obr:list", description="List")
+public class ListCommand extends ObrCommandSupport {
+
+    @Argument(required = false, multiValued = true)
+    List<String> args;
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        String substr = null;
+
+        if (args != null) {
+            for (String arg : args)
+            {
+                // Add a space in between tokens.
+                if (substr == null)
+                {
+                    substr = "";
+                }
+                else
+                {
+                    substr += " ";
+                }
+
+                substr += arg;
+            }
+        }
+        
+        StringBuffer sb = new StringBuffer();
+        if ((substr == null) || (substr.length() == 0))
+        {
+            sb.append("(|(presentationname=*)(symbolicname=*))");
+        }
+        else
+        {
+            sb.append("(|(presentationname=*");
+            sb.append(substr);
+            sb.append("*)(symbolicname=*");
+            sb.append(substr);
+            sb.append("*))");
+        }
+        Resource[] resources = admin.discoverResources(sb.toString());
+        for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++)
+        {
+            String name = resources[resIdx].getPresentationName();
+            Version version = resources[resIdx].getVersion();
+            if (version != null)
+            {
+                io.out.println(name + " (" + version + ")");
+            }
+            else
+            {
+                io.out.println(name);
+            }
+        }
+
+        if (resources == null)
+        {
+            io.out.println("No matching bundles.");
+        }
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListUrlCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListUrlCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListUrlCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ListUrlCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.obr;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.obr.Repository;
+import org.osgi.service.obr.RepositoryAdmin;
+
+@CommandComponent(id="obr:listUrl", description="Display the repository URLs currently associated with the repository service.")
+public class ListUrlCommand extends ObrCommandSupport {
+
+    protected void doExecute(RepositoryAdmin admin) {
+        Repository[] repos = admin.listRepositories();
+        if ((repos != null) && (repos.length > 0)) {
+            for (int i = 0; i < repos.length; i++) {
+                io.out.println(repos[i].getURL());
+            }
+        } else {
+            io.out.println("No repository URLs are set.");
+        }
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ObrCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ObrCommandSupport.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ObrCommandSupport.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/ObrCommandSupport.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,121 @@
+package org.apache.geronimo.gshell.obr;
+
+import java.io.PrintWriter;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Resource;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Nov 29, 2007
+ * Time: 4:51:56 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class ObrCommandSupport extends OsgiCommandSupport {
+
+    protected static final char VERSION_DELIM = ',';
+
+    protected Object doExecute() throws Exception {
+        // Get repository admin service.
+        ServiceReference ref = getBundleContext().getServiceReference(RepositoryAdmin.class.getName());
+        if (ref == null) {
+            io.out.println("RepositoryAdmin service is unavailable.");
+            return null;
+        }
+        try {
+            RepositoryAdmin admin = (RepositoryAdmin) getBundleContext().getService(ref);
+            if (admin == null) {
+                io.out.println("RepositoryAdmin service is unavailable.");
+                return null;
+            }
+
+            doExecute(admin);
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+        return null;
+    }
+
+    protected abstract void doExecute(RepositoryAdmin admin) throws Exception;
+
+    protected Resource[] searchRepository(RepositoryAdmin admin, String targetId, String targetVersion)
+    {
+        // Try to see if the targetId is a bundle ID.
+        try
+        {
+            Bundle bundle = getBundleContext().getBundle(Long.parseLong(targetId));
+            targetId = bundle.getSymbolicName();
+        }
+        catch (NumberFormatException ex)
+        {
+            // It was not a number, so ignore.
+        }
+
+        // The targetId may be a bundle name or a bundle symbolic name,
+        // so create the appropriate LDAP query.
+        StringBuffer sb = new StringBuffer("(|(presentationname=");
+        sb.append(targetId);
+        sb.append(")(symbolicname=");
+        sb.append(targetId);
+        sb.append("))");
+        if (targetVersion != null)
+        {
+            sb.insert(0, "(&");
+            sb.append("(version=");
+            sb.append(targetVersion);
+            sb.append("))");
+        }
+        return admin.discoverResources(sb.toString());
+    }
+
+    public Resource selectNewestVersion(Resource[] resources)
+    {
+        int idx = -1;
+        Version v = null;
+        for (int i = 0; (resources != null) && (i < resources.length); i++)
+        {
+            if (i == 0)
+            {
+                idx = 0;
+                v = resources[i].getVersion();
+            }
+            else
+            {
+                Version vtmp = resources[i].getVersion();
+                if (vtmp.compareTo(v) > 0)
+                {
+                    idx = i;
+                    v = vtmp;
+                }
+            }
+        }
+        return (idx < 0) ? null : resources[idx];
+    }
+
+    protected String[] getTarget(String bundle) {
+        String[] target;
+        int idx = bundle.indexOf(VERSION_DELIM);
+        if (idx > 0) {
+            target = new String[] { bundle.substring(0, idx), bundle.substring(idx) };
+        }
+        else
+        {
+            target = new String[] { bundle, null };
+        }
+        return target;
+    }
+
+    protected void printUnderline(PrintWriter out, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
+            out.print('-');
+        }
+        out.println("");
+    }
+}

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/OsgiCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/OsgiCommandSupport.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/OsgiCommandSupport.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/OsgiCommandSupport.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,145 @@
+/*
+ * 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.obr;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.geronimo.gshell.clp.CommandLineProcessor;
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.clp.Printer;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.command.Variables;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.common.Arguments;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.osgi.context.BundleContextAware;
+
+/**
+ * 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 implements Command, BundleContextAware {
+
+    private BundleContext bundleContext;
+
+    protected Logger log = LoggerFactory.getLogger(getClass());
+
+    protected CommandContext context;
+
+    protected IO io;
+
+    protected Variables variables;
+
+    @Option(name="-h", aliases={"--help"}, description="Display this help message")
+    private boolean displayHelp;
+
+    public String getId() {
+        CommandComponent cmd = getClass().getAnnotation(CommandComponent.class);
+        if (cmd == null) {
+            throw new IllegalStateException("Command id not found");
+        }
+        return cmd.id();
+    }
+
+    public String getDescription() {
+        CommandComponent cmd = getClass().getAnnotation(CommandComponent.class);
+        if (cmd == null) {
+            throw new IllegalStateException("Command description not found");
+        }
+        return cmd.description();
+    }
+
+    public void setBundleContext(BundleContext context) {
+        bundleContext = context;
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public Object execute(final CommandContext context, final Object... args) throws Exception {
+        OsgiCommandSupport cmd = getClass().newInstance();
+        cmd.setBundleContext(bundleContext);
+        cmd.init(context);
+        return cmd.doExecute(args);
+    }
+
+    public void init(final CommandContext context) {
+        assert context != null;
+
+        this.context = context;
+        this.io = context.getIO();
+        this.variables = context.getVariables();
+
+        // Re-setup logging using our id
+        String id = getId();
+        log = LoggerFactory.getLogger(getClass().getName() + "." + id);
+    }
+
+    public Object doExecute(final Object... args) throws Exception {
+        assert args != null;
+
+        log.info("Executing w/args: [{}]", Arguments.asString(args));
+
+        CommandLineProcessor clp = new CommandLineProcessor(this);
+        clp.process(Arguments.toStringArray(args));
+
+        // Handle --help/-h automatically for the command
+        if (displayHelp) {
+            //
+            // TODO: Make a special PrinterHandler to abstrat this muck from having to process it by hand
+            //
+
+            displayHelp(clp);
+
+            return SUCCESS;
+        }
+
+        assert io != null;
+        assert variables != null;
+
+        return doExecute();
+    }
+
+    protected abstract Object doExecute() throws Exception;
+
+    protected void displayHelp(final CommandLineProcessor clp) {
+        assert clp != null;
+
+        //
+        // TODO: Need to ask the LayoutManager what the real name is for our command's ID
+        //
+
+        io.out.println(getId());
+        io.out.println(" -- ");
+        io.out.println();
+
+        Printer printer = new Printer(clp);
+        printer.printUsage(io.out);
+        io.out.println();
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/RemoveUrlCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/RemoveUrlCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/RemoveUrlCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/RemoveUrlCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.obr;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.service.obr.RepositoryAdmin;
+
+@CommandComponent(id="obr:removeUrl", description="Remove a list of repository URLs from the repository service")
+public class RemoveUrlCommand extends ObrCommandSupport {
+
+    @Argument(required = true, multiValued = true, description = "Repository URLs")
+    List<URL> urls;
+
+    protected void doExecute(RepositoryAdmin admin) {
+        for (URL url : urls) {
+            admin.removeRepository(url);
+        }
+    }
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/SourceCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/SourceCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/SourceCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/SourceCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,66 @@
+/*
+ * 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.obr;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Resource;
+
+@CommandComponent(id="obr:source", description="Source")
+public class SourceCommand extends ObrCommandSupport {
+
+    @Option(name = "-x", description = "Extract")
+    boolean extract;
+
+    @Argument(required = true, index = 0, description = "Local directory")
+    String localDir;
+
+    @Argument(required = true, index = 1, multiValued = true, description = "List of bundles")
+    List<String> bundles;
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        for (String bundle : bundles) {
+            String[] target = getTarget(bundle);
+            Resource resource = selectNewestVersion(searchRepository(admin, target[0], target[1]));
+            if (resource == null)
+            {
+                io.err.println("Unknown bundle and/or version: " + target[0]);
+            }
+            else
+            {
+                URL srcURL = (URL) resource.getProperties().get(Resource.SOURCE_URL);
+                if (srcURL != null)
+                {
+                    FileUtil.downloadSource(io.out, io.err, srcURL, localDir, extract);
+                }
+                else
+                {
+                    io.err.println("Missing source URL: " + target[0]);
+                }
+            }
+        }
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/StartCommand.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/StartCommand.java?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/StartCommand.java (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/java/org/apache/geronimo/gshell/obr/StartCommand.java Thu Nov 29 13:34:16 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.obr;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.service.obr.RepositoryAdmin;
+
+@CommandComponent(id="obr:start", description="Start")
+public class StartCommand extends DeployCommand {
+
+    protected void doExecute(RepositoryAdmin admin) throws Exception {
+        doDeploy(admin, true);
+    }
+
+}
\ No newline at end of file

Added: servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml?rev=599584&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml (added)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml Thu Nov 29 13:34:16 2007
@@ -0,0 +1,64 @@
+<?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">
+
+    <bean id="addUrl" class="org.apache.geronimo.gshell.obr.AddUrlCommand" />
+
+    <bean id="deploy" class="org.apache.geronimo.gshell.obr.DeployCommand" />
+
+    <bean id="info" class="org.apache.geronimo.gshell.obr.InfoCommand" />
+
+    <bean id="list" class="org.apache.geronimo.gshell.obr.ListCommand" />
+
+    <bean id="listUrl" class="org.apache.geronimo.gshell.obr.ListUrlCommand" />
+
+    <bean id="removeUrl" class="org.apache.geronimo.gshell.obr.RemoveUrlCommand" />
+
+    <bean id="source" class="org.apache.geronimo.gshell.obr.SourceCommand" />
+
+    <bean id="start" class="org.apache.geronimo.gshell.obr.StartCommand" />
+
+    <osgi:service ref="addUrl" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="deploy" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="info" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="list" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="listUrl" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="removeUrl" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="source" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="start" interface="org.apache.geronimo.gshell.command.Command" />
+
+</beans>
\ No newline at end of file

Modified: servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml (original)
+++ servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml Thu Nov 29 13:34:16 2007
@@ -29,6 +29,28 @@
   http://www.springframework.org/schema/osgi
   http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
+    <bean id="bundle-level" class="org.apache.geronimo.gshell.osgi.BundleLevel" />
+
+    <bean id="headers" class="org.apache.geronimo.gshell.osgi.Headers" />
+
+    <bean id="list-bundles" class="org.apache.geronimo.gshell.osgi.ListBundles" />
+
+    <bean id="list-services" class="org.apache.geronimo.gshell.osgi.ListServices" />
+
+    <bean id="refresh-bundle" class="org.apache.geronimo.gshell.osgi.RefreshBundle" />
+
+    <bean id="resolve-bundle" class="org.apache.geronimo.gshell.osgi.ResolveBundle" />
+
+    <bean id="shutdown" class="org.apache.geronimo.gshell.osgi.Shutdown" />
+
+    <bean id="start-bundle" class="org.apache.geronimo.gshell.osgi.StartBundle" />
+
+    <bean id="start-level" class="org.apache.geronimo.gshell.osgi.StartLevel" />
+
+    <bean id="stop-bundle" class="org.apache.geronimo.gshell.osgi.StopBundle" />
+
+    <bean id="uninstall-bundle" class="org.apache.geronimo.gshell.osgi.UninstallBundle" />
+
     <osgi:service ref="headers" interface="org.apache.geronimo.gshell.command.Command" />
 
     <osgi:service ref="list-bundles" interface="org.apache.geronimo.gshell.command.Command" />

Modified: servicemix/branches/servicemix-4.0/gshell/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/gshell/pom.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/gshell/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/gshell/pom.xml Thu Nov 29 13:34:16 2007
@@ -1,94 +1,95 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <!--
-
-        Licensed to the Apache Software Foundation (ASF) under one or more
-        contributor license agreements.  See the NOTICE file distributed with
-        this work for additional information regarding copyright ownership.
-        The ASF licenses this file to You under the Apache License, Version 2.0
-        (the "License"); you may not use this file except in compliance with
-        the License.  You may obtain a copy of the License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-        Unless required by applicable law or agreed to in writing, software
-        distributed under the License is distributed on an "AS IS" BASIS,
-        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-        See the License for the specific language governing permissions and
-        limitations under the License.
-    -->
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.servicemix</groupId>
-        <artifactId>servicemix</artifactId>
-        <version>4.0-SNAPSHOT</version>
-    </parent>
-
-    <groupId>org.apache.servicemix.gshell</groupId>
-    <artifactId>gshell</artifactId>
-    <packaging>pom</packaging>
-    <version>4.0-SNAPSHOT</version>
-    <name>ServiceMix GShell</name>
-
-    <modules>
-        <module>gshell-core</module>
-        <module>gshell-osgi</module>
-    </modules>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <configuration>
-                    <includeProjectDependencies>false</includeProjectDependencies>
-                    <includePluginDependencies>true</includePluginDependencies>
-                    <executableDependency>
-                        <groupId>org.ops4j.pax.runner</groupId>
-                        <artifactId>pax-runner</artifactId>
-                    </executableDependency>
-                    <mainClass>org.ops4j.pax.runner.Run</mainClass>
-                    <arguments>
-                        <argument>--vmOptions=-Dbundles.configuration.location=${basedir}/src/test/configs</argument>
-                        <argument>--noConsole</argument>
-                        <argument>mvn:org.apache.felix/org.apache.felix.configadmin/0.9.0-SNAPSHOT</argument>
-                        <argument>mvn:org.ops4j.pax.confman/pax-confman-propsloader/0.3.0-SNAPSHOT</argument>
-                        <argument>mvn:org.ops4j.pax.logging/pax-logging-api/0.9.7-SNAPSHOT</argument>
-                        <argument>mvn:org.ops4j.pax.logging/pax-logging-service/0.9.7-SNAPSHOT</argument>
-                        <argument>mvn:org.springframework.osgi/spring-osgi-core/${spring.osgi.version}</argument>
-                        <argument>mvn:org.springframework.osgi/spring-osgi-extender/${spring.osgi.version}</argument>
-                        <argument>mvn:org.springframework.osgi/spring-osgi-io/${spring.osgi.version}</argument>
-                        <argument>mvn:org.springframework/spring-aop/${spring.version}</argument>
-                        <argument>mvn:org.springframework/spring-beans/${spring.version}</argument>
-                        <argument>mvn:org.springframework/spring-context/${spring.version}</argument>
-                        <argument>mvn:org.springframework/spring-core/${spring.version}</argument>
-                        <argument>
-                            mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0-${project.version}
-                        </argument>
-                        <argument>
-                            mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/2.1_3-${project.version}
-                        </argument>
-                        <argument>
-                            mvn:org.apache.servicemix.gshell/org.apache.servicemix.gshell.core/${project.version}
-                        </argument>
-                        <argument>
-                            mvn:org.apache.servicemix.gshell/org.apache.servicemix.gshell.osgi/${project.version}
-                        </argument>
-                    </arguments>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.ops4j.pax.runner</groupId>
-                        <artifactId>pax-runner</artifactId>
-                        <version>0.5.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix</groupId>
+        <artifactId>servicemix</artifactId>
+        <version>4.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.gshell</groupId>
+    <artifactId>gshell</artifactId>
+    <packaging>pom</packaging>
+    <version>4.0-SNAPSHOT</version>
+    <name>ServiceMix GShell</name>
+
+    <modules>
+        <module>gshell-core</module>
+        <module>gshell-osgi</module>
+        <module>gshell-obr</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <configuration>
+                    <includeProjectDependencies>false</includeProjectDependencies>
+                    <includePluginDependencies>true</includePluginDependencies>
+                    <executableDependency>
+                        <groupId>org.ops4j.pax.runner</groupId>
+                        <artifactId>pax-runner</artifactId>
+                    </executableDependency>
+                    <mainClass>org.ops4j.pax.runner.Run</mainClass>
+                    <arguments>
+                        <argument>--vmOptions=-Dbundles.configuration.location=${basedir}/src/test/configs</argument>
+                        <argument>--noConsole</argument>
+                        <argument>mvn:org.apache.felix/org.apache.felix.configadmin/0.9.0-SNAPSHOT</argument>
+                        <argument>mvn:org.ops4j.pax.confman/pax-confman-propsloader/0.3.0-SNAPSHOT</argument>
+                        <argument>mvn:org.ops4j.pax.logging/pax-logging-api/0.9.7-SNAPSHOT</argument>
+                        <argument>mvn:org.ops4j.pax.logging/pax-logging-service/0.9.7-SNAPSHOT</argument>
+                        <argument>mvn:org.springframework.osgi/spring-osgi-core/${spring.osgi.version}</argument>
+                        <argument>mvn:org.springframework.osgi/spring-osgi-extender/${spring.osgi.version}</argument>
+                        <argument>mvn:org.springframework.osgi/spring-osgi-io/${spring.osgi.version}</argument>
+                        <argument>mvn:org.springframework/spring-aop/${spring.version}</argument>
+                        <argument>mvn:org.springframework/spring-beans/${spring.version}</argument>
+                        <argument>mvn:org.springframework/spring-context/${spring.version}</argument>
+                        <argument>mvn:org.springframework/spring-core/${spring.version}</argument>
+                        <argument>
+                            mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0-${project.version}
+                        </argument>
+                        <argument>
+                            mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/2.1_3-${project.version}
+                        </argument>
+                        <argument>
+                            mvn:org.apache.servicemix.gshell/org.apache.servicemix.gshell.core/${project.version}
+                        </argument>
+                        <argument>
+                            mvn:org.apache.servicemix.gshell/org.apache.servicemix.gshell.osgi/${project.version}
+                        </argument>
+                    </arguments>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.ops4j.pax.runner</groupId>
+                        <artifactId>pax-runner</artifactId>
+                        <version>0.5.1</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Modified: servicemix/branches/servicemix-4.0/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/pom.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/pom.xml Thu Nov 29 13:34:16 2007
@@ -50,7 +50,7 @@
         <repository>
             <id>servicemix</id>
             <name>Apache Release Distribution Repository</name>
-            <url>scp://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</url>
+            <url>scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
         </repository>
         <snapshotRepository>
             <id>apache.snapshots</id>
@@ -59,7 +59,7 @@
         </snapshotRepository>
         <site>
             <id>servicemix</id>
-            <url>scp://people.apache.org/www/incubator.apache.org/servicemix/dist/servicemix-${version}/site</url>
+            <url>scp://people.apache.org/www/servicemix.apache.org/dist/servicemix-${version}/site</url>
         </site>
     </distributionManagement>
 
@@ -82,6 +82,7 @@
         <openjpa.version>1.0.1</openjpa.version>
         <pax.logging.version>0.9.8-SNAPSHOT</pax.logging.version>
         <servicemix3.version>3.2.1-SNAPSHOT</servicemix3.version>
+        <bundlerepository.version>1.0.0</bundlerepository.version>
     </properties>
 
     <repositories>
@@ -283,6 +284,11 @@
             <dependency>
                 <groupId>org.apache.servicemix.gshell</groupId>
                 <artifactId>org.apache.servicemix.gshell.osgi</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.servicemix.gshell</groupId>
+                <artifactId>org.apache.servicemix.gshell.obr</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>

Propchange: servicemix/branches/servicemix-4.0/runtime/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 29 13:34:16 2007
@@ -0,0 +1,2 @@
+target
+*.iml

Propchange: servicemix/branches/servicemix-4.0/runtime/filemonitor/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Nov 29 13:34:16 2007
@@ -1 +1,2 @@
 target
+*.iml

Propchange: servicemix/branches/servicemix-4.0/runtime/minimum/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Nov 29 13:34:16 2007
@@ -1 +1,2 @@
 target
+*.iml

Modified: servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml?rev=599584&r1=599583&r2=599584&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml Thu Nov 29 13:34:16 2007
@@ -106,6 +106,7 @@
             <version>${spring.version}</version>
         </dependency>
 
+      <!--
       <dependency>
           <groupId>org.apache.servicemix.gshell</groupId>
           <artifactId>org.apache.servicemix.gshell.core</artifactId>
@@ -118,6 +119,7 @@
           <groupId>org.apache.servicemix.bundles</groupId>
           <artifactId>org.apache.servicemix.bundles.xstream</artifactId>
       </dependency>
+      -->
 
       <dependency>
           <groupId>org.apache.felix</groupId>