You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ch...@apache.org on 2011/07/13 17:08:50 UTC
svn commit: r1146091 - in
/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main:
java/org/apache/geronimo/shell/deploy/ resources/OSGI-INF/blueprint/
Author: chirunhua
Date: Wed Jul 13 15:08:50 2011
New Revision: 1146091
URL: http://svn.apache.org/viewvc?rev=1146091&view=rev
Log:
support bundle installation and uninstallation from Karaf Shell
Added:
geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/InstallBundleCommand.java
geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/UninstallBundleCommand.java
Modified:
geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml
Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/InstallBundleCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/InstallBundleCommand.java?rev=1146091&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/InstallBundleCommand.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/InstallBundleCommand.java Wed Jul 13 15:08:50 2011
@@ -0,0 +1,99 @@
+/*
+ * 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.shell.deploy;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Option;
+import org.apache.geronimo.cli.deployer.InstallBundleCommandArgs;
+import org.apache.geronimo.deployment.cli.CommandInstallBundle;
+import org.apache.geronimo.deployment.cli.ServerConnection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(scope = "deploy", name = "install-bundle", description = "Install an OSGi bundle")
+public class InstallBundleCommand extends ConnectCommand {
+
+ @Option(name = "--groupId", description = "Group Id")
+ String groupId;
+
+ @Option(name = "--startLevel", description = "Start level of the bundle")
+ int startLevel;
+
+ @Option(name = "--start", description = "Whether to start the bundle")
+ boolean start;
+
+ @Argument(required = true, description = "Bundle file")
+ String bundleFile;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ ServerConnection connection = connect();
+
+ CommandInstallBundle command = new CommandInstallBundle();
+
+ InstallBundleCommandArgs args = new InstallBundleCommandArgsImpl(groupId, startLevel, start, new String[]{bundleFile});
+
+ command.execute(this, connection, args);
+ return null;
+ }
+
+}
+
+class InstallBundleCommandArgsImpl implements InstallBundleCommandArgs {
+ String[] args;
+
+ String groupId;
+
+ int startLevel;
+
+ boolean start;
+
+ public InstallBundleCommandArgsImpl(String groupId, int startLevel, boolean start, String[] args) {
+ this.args = args;
+ this.groupId = groupId;
+ this.start = start;
+ this.startLevel = startLevel;
+ }
+
+ @Override
+ public String getGroupId() {
+ return groupId;
+ }
+
+ @Override
+ public int getStartLevel() {
+ return startLevel;
+ }
+
+ @Override
+ public boolean isStart() {
+ return start;
+ }
+
+ @Override
+ public String[] getArgs() {
+ return args;
+ }
+
+
+}
+
Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/UninstallBundleCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/UninstallBundleCommand.java?rev=1146091&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/UninstallBundleCommand.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/UninstallBundleCommand.java Wed Jul 13 15:08:50 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.shell.deploy;
+
+import java.util.Arrays;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.geronimo.cli.deployer.BaseCommandArgs;
+import org.apache.geronimo.deployment.cli.AbstractCommand;
+import org.apache.geronimo.deployment.cli.CommandUninstallBundle;
+import org.apache.geronimo.deployment.cli.ServerConnection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(scope = "deploy", name = "uninstall-bundle", description = "Uninstall an OSGi bundle")
+public class UninstallBundleCommand extends ConnectCommand {
+
+ @Argument(required = true, description = "Bundle Id")
+ String bundleId;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ ServerConnection connection = connect();
+
+ AbstractCommand command = new CommandUninstallBundle();
+
+ BaseCommandArgs args = new BaseCommandArgs(new String[]{bundleId});
+
+ command.execute(this, connection, args);
+ return null;
+ }
+
+}
+
+
+
+
+
+
Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml?rev=1146091&r1=1146090&r2=1146091&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml Wed Jul 13 15:08:50 2011
@@ -93,6 +93,14 @@
<action class="org.apache.geronimo.shell.deploy.EncryptCommand">
</action>
</command>
+ <command name="deploy/install-bundle">
+ <action class="org.apache.geronimo.shell.deploy.InstallBundleCommand">
+ </action>
+ </command>
+ <command name="deploy/uninstall-bundle">
+ <action class="org.apache.geronimo.shell.deploy.UninstallBundleCommand">
+ </action>
+ </command>
<command name="deploy/unlock-keystore">
<action class="org.apache.geronimo.shell.deploy.UnlockKeystoreCommand">
</action>