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 2008/10/23 19:45:10 UTC
svn commit: r707424 [1/2] - in /servicemix/smx4/kernel/trunk: ./ assembly/
gshell/
gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/
gshell/gshell-core/src/main/resources/META-INF/spring/
gshell/gshell-core/src/main/resources/o...
Author: gnodet
Date: Thu Oct 23 10:45:08 2008
New Revision: 707424
URL: http://svn.apache.org/viewvc?rev=707424&view=rev
Log:
Re-introduce osgi commands, making sure everything works in OSGi
Added:
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerAwareProcessor.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerWrapper.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandSupport.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleCommand.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleLevel.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundlesCommand.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundlesCommand.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Headers.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Headers.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/InstallBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListBundles.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListServices.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListServices.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Shutdown.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartLevel.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StopBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Util.java
- copied, changed from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Util.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/Headers.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/ListBundles.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/ListServices.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/Shutdown.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/StartBundle.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/StartLevel.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/StopBundle.properties
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.properties
Removed:
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/SpringBeanContainerFactoryBean.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleLevel.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundlesCommand.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Headers.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/InstallBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListServices.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Util.java
Modified:
servicemix/smx4/kernel/trunk/assembly/pom.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/CommandBundle.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/commands.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/test/java/org/apache/servicemix/kernel/gshell/core/Test.java
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/pom.xml
servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
servicemix/smx4/kernel/trunk/gshell/pom.xml
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=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/pom.xml Thu Oct 23 10:45:08 2008
@@ -38,10 +38,12 @@
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.main</artifactId>
</dependency>
+ <!--
<dependency>
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.client</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.filemonitor</artifactId>
@@ -63,10 +65,12 @@
<groupId>org.apache.servicemix.kernel.gshell</groupId>
<artifactId>org.apache.servicemix.kernel.gshell.obr</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.apache.servicemix.kernel.gshell</groupId>
<artifactId>org.apache.servicemix.kernel.gshell.osgi</artifactId>
</dependency>
+ <!--
<dependency>
<groupId>org.apache.servicemix.kernel.gshell</groupId>
<artifactId>org.apache.servicemix.kernel.gshell.log</artifactId>
@@ -244,6 +248,7 @@
<outputDirectory>target/dependencies</outputDirectory>
<destFileName>servicemix.jar</destFileName>
</artifactItem>
+ <!--
<artifactItem>
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.client</artifactId>
@@ -251,6 +256,7 @@
<outputDirectory>target/dependencies</outputDirectory>
<destFileName>servicemix-client.jar</destFileName>
</artifactItem>
+ -->
<artifactItem>
<groupId>org.apache.servicemix.kernel.jaas</groupId>
<artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerAwareProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerAwareProcessor.java?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerAwareProcessor.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerAwareProcessor.java Thu Oct 23 10:45:08 2008
@@ -0,0 +1,37 @@
+package org.apache.servicemix.kernel.gshell.core;
+
+import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationContext;
+
+public class BeanContainerAwareProcessor implements InitializingBean, BeanPostProcessor, ApplicationContextAware {
+
+ private ApplicationContext applicationContext;
+ private BeanContainer container;
+
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ this.container = new BeanContainerWrapper(applicationContext);
+ }
+
+ public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
+ assert bean != null;
+
+ if (bean instanceof BeanContainerAware) {
+ ((BeanContainerAware)bean).setBeanContainer(container);
+ }
+
+ return bean;
+ }
+
+ public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
+ return bean;
+ }
+}
\ No newline at end of file
Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerWrapper.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerWrapper.java?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerWrapper.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/BeanContainerWrapper.java Thu Oct 23 10:45:08 2008
@@ -0,0 +1,91 @@
+package org.apache.servicemix.kernel.gshell.core;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Collection;
+import java.net.URL;
+
+import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+
+public class BeanContainerWrapper implements BeanContainer {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private ApplicationContext context;
+
+ public BeanContainerWrapper(ApplicationContext context) {
+ this.context = context;
+ }
+
+ public BeanContainer getParent() {
+ return null;
+ }
+
+ public ClassLoader getClassLoader() {
+ return context.getClassLoader();
+ }
+
+ public void loadBeans(String[] strings) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> T getBean(Class<T> type) {
+ assert type != null;
+
+ log.trace("Getting bean of type: {}", type);
+
+ String[] names = context.getBeanNamesForType(type);
+
+ if (names.length == 0) {
+ throw new NoSuchBeanDefinitionException(type, "No bean defined for type: " + type);
+ }
+ if (names.length > 1) {
+ throw new NoSuchBeanDefinitionException(type, "No unique bean defined for type: " + type + ", found matches: " + Arrays.asList(names));
+ }
+
+ return getBean(names[0], type);
+ }
+
+ public <T> T getBean(String name, Class<T> requiredType) {
+ assert name != null;
+ assert requiredType != null;
+
+ log.trace("Getting bean named '{}' of type: {}", name, requiredType);
+
+ return (T) context.getBean(name, requiredType);
+ }
+
+ public <T> Map<String, T> getBeans(Class<T> type) {
+ assert type != null;
+
+ log.trace("Getting beans of type: {}", type);
+
+ return (Map<String,T>) context.getBeansOfType(type);
+ }
+
+ public String[] getBeanNames() {
+ log.trace("Getting bean names");
+
+ return context.getBeanDefinitionNames();
+ }
+
+ public String[] getBeanNames(Class type) {
+ assert type != null;
+
+ log.trace("Getting bean names of type: {}", type);
+
+ return context.getBeanNamesForType(type);
+ }
+
+ public BeanContainer createChild(String s, Collection<URL> urls) {
+ throw new UnsupportedOperationException();
+ }
+
+ public BeanContainer createChild(String s) {
+ throw new UnsupportedOperationException();
+ }
+}
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/CommandBundle.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/CommandBundle.java?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/CommandBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/CommandBundle.java Thu Oct 23 10:45:08 2008
@@ -1,21 +1,28 @@
package org.apache.servicemix.kernel.gshell.core;
import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
+import java.util.Dictionary;
+import java.util.Properties;
+import java.util.List;
+import java.util.ArrayList;
import org.springframework.osgi.context.BundleContextAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.AliasRegistry;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
import org.apache.geronimo.gshell.command.Command;
import org.apache.geronimo.gshell.registry.CommandRegistry;
+import org.apache.geronimo.gshell.registry.AliasRegistry;
+import org.apache.geronimo.gshell.wisdom.command.CommandSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CommandBundle implements BundleContextAware, InitializingBean, DisposableBean {
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
@Autowired(required = false)
private CommandRegistry commandRegistry;
@@ -28,6 +35,8 @@
private Map<String,String> aliases;
+ private List<ServiceRegistration> registrations = new ArrayList<ServiceRegistration>();
+
public CommandBundle() {
}
@@ -56,24 +65,38 @@
}
public void afterPropertiesSet() throws Exception {
- System.err.println("CommandBundle: init");
- if (commandRegistry != null) {
- System.err.println("Using the auto wired command registry");
+ log.debug("Initializing command bundle");
+ if (commandRegistry != null && aliasRegistry != null) {
+ log.debug("Command bundle is using the auto wired command/alias registry");
for (String name : commands.keySet()) {
- System.err.println("Registering command: " + name);
+ log.debug("Registering command: {}", name);
commandRegistry.registerCommand(name, commands.get(name));
}
- }
- if (aliasRegistry != null) {
- System.err.println("Using the auto wired alias registry");
for (String name : aliases.keySet()) {
+ log.debug("Registering alias: {}", name);
aliasRegistry.registerAlias(name, aliases.get(name));
}
+ } else if (bundleContext != null) {
+ if (aliases != null && aliases.size() > 0) {
+ throw new Exception("Aliases are not supported in OSGi");
+ }
+ log.debug("Command bundle is using the OSGi registry");
+ for (String name : commands.keySet()) {
+ log.debug("Registering command: {}", name);
+ Dictionary props = new Properties();
+ props.put(OsgiCommandRegistry.NAME, name);
+ registrations.add(bundleContext.registerService(Command.class.getName(), commands.get(name), props));
+ }
+ } else {
+ throw new Exception("Command bundle should be wired to the command/alias registry or be used in an OSGi context");
}
}
public void destroy() {
- System.err.println("CommandBundle: init");
+ log.debug("Destroying command bundle");
+ for (ServiceRegistration reg : registrations) {
+ reg.unregister();
+ }
}
}
Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java Thu Oct 23 10:45:08 2008
@@ -0,0 +1,26 @@
+package org.apache.servicemix.kernel.gshell.core;
+
+import java.util.Map;
+
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.registry.CommandRegistry;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class OsgiCommandRegistry {
+
+ public static final String NAME = "name";
+
+ @Autowired
+ private CommandRegistry commandRegistry;
+
+ public void register(final Command command, Map<String, ?> properties) throws Exception {
+ String name = (String) properties.get(NAME);
+ commandRegistry.registerCommand(name, command);
+ }
+
+ public void unregister(final Command command, Map<String, ?> properties) throws Exception {
+ String name = (String) properties.get(NAME);
+ commandRegistry.removeCommand(name);
+ }
+
+}
Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandSupport.java?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandSupport.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandSupport.java Thu Oct 23 10:45:08 2008
@@ -0,0 +1,33 @@
+package org.apache.servicemix.kernel.gshell.core;
+
+import org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.osgi.context.BundleContextAware;
+import org.osgi.framework.BundleContext;
+
+public abstract class OsgiCommandSupport implements CommandAction, BundleContextAware {
+
+ protected Log log = LogFactory.getLog(getClass());
+ protected BundleContext bundleContext;
+ protected CommandContext commandContext;
+ protected IO io;
+
+ public Object execute(CommandContext commandContext) throws Exception {
+ this.commandContext = commandContext;
+ this.io = commandContext.getIo();
+ return doExecute();
+ }
+
+ protected abstract Object doExecute() throws Exception;
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+}
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml Thu Oct 23 10:45:08 2008
@@ -29,45 +29,7 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <!--
- <bean id="clear" class="org.apache.geronimo.gshell.commands.builtins.ClearCommand">
- <constructor-arg ref="terminal" />
- </bean>
-
- <bean id="echo" class="org.apache.geronimo.gshell.commands.builtins.EchoCommand" />
-
- <bean id="exit" class="org.apache.geronimo.gshell.commands.builtins.ExitCommand" />
-
- <bean id="help" class="org.apache.geronimo.gshell.commands.builtins.HelpCommand">
- <constructor-arg ref="commandRegistry" />
- <constructor-arg ref="commandRegistry" />
- <constructor-arg ref="branding" />
- </bean>
-
- <bean id="history-cmd" class="org.apache.geronimo.gshell.commands.builtins.HistoryCommand">
- <constructor-arg ref="history" />
- </bean>
-
- <bean id="info" class="org.apache.geronimo.gshell.commands.builtins.InfoCommand">
- <constructor-arg ref="branding" />
- </bean>
-
- <bean id="set" class="org.apache.geronimo.gshell.commands.builtins.SetCommand" />
-
- <bean id="source" class="org.apache.geronimo.gshell.commands.builtins.SourceCommand" />
-
- <bean id="unset" class="org.apache.geronimo.gshell.commands.builtins.UnsetCommand" />
-
- <bean id="grep" class="org.apache.geronimo.gshell.commands.utils.GrepCommand" />
-
- <bean id="cat" class="org.apache.geronimo.gshell.commands.utils.CatCommand" />
-
- <bean id="exec" class="org.apache.geronimo.gshell.commands.utils.ExecuteCommand" />
-
- <bean id="java" class="org.apache.geronimo.gshell.commands.utils.JavaCommand" />
-
- <bean id="sleep" class="org.apache.geronimo.gshell.commands.utils.SleepCommand" />
- -->
+ <import resource="classpath:org/apache/servicemix/kernel/gshell/core/commands.xml" />
<gshell:command-bundle>
<gshell:command name="about">
@@ -150,4 +112,44 @@
</gshell:command>
</gshell:command-bundle>
+ <!--
+ <bean id="clear" class="org.apache.geronimo.gshell.commands.builtins.ClearCommand">
+ <constructor-arg ref="terminal" />
+ </bean>
+
+ <bean id="echo" class="org.apache.geronimo.gshell.commands.builtins.EchoCommand" />
+
+ <bean id="exit" class="org.apache.geronimo.gshell.commands.builtins.ExitCommand" />
+
+ <bean id="help" class="org.apache.geronimo.gshell.commands.builtins.HelpCommand">
+ <constructor-arg ref="commandRegistry" />
+ <constructor-arg ref="commandRegistry" />
+ <constructor-arg ref="branding" />
+ </bean>
+
+ <bean id="history-cmd" class="org.apache.geronimo.gshell.commands.builtins.HistoryCommand">
+ <constructor-arg ref="history" />
+ </bean>
+
+ <bean id="info" class="org.apache.geronimo.gshell.commands.builtins.InfoCommand">
+ <constructor-arg ref="branding" />
+ </bean>
+
+ <bean id="set" class="org.apache.geronimo.gshell.commands.builtins.SetCommand" />
+
+ <bean id="source" class="org.apache.geronimo.gshell.commands.builtins.SourceCommand" />
+
+ <bean id="unset" class="org.apache.geronimo.gshell.commands.builtins.UnsetCommand" />
+
+ <bean id="grep" class="org.apache.geronimo.gshell.commands.utils.GrepCommand" />
+
+ <bean id="cat" class="org.apache.geronimo.gshell.commands.utils.CatCommand" />
+
+ <bean id="exec" class="org.apache.geronimo.gshell.commands.utils.ExecuteCommand" />
+
+ <bean id="java" class="org.apache.geronimo.gshell.commands.utils.JavaCommand" />
+
+ <bean id="sleep" class="org.apache.geronimo.gshell.commands.utils.SleepCommand" />
+ -->
+
</beans>
\ No newline at end of file
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml Thu Oct 23 10:45:08 2008
@@ -32,104 +32,13 @@
http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
- <!--
- <osgi:list id="commands" interface="org.apache.geronimo.gshell.command.Command" cardinality="0..N">
- <osgi:listener ref="commandRegistry" bind-method="register" unbind-method="unregister" />
- </osgi:list>
+ <bean id="osgiCommandRegistry" class="org.apache.servicemix.kernel.gshell.core.OsgiCommandRegistry" />
- <osgi:service ref="clear" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="clear"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="exit" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="exit"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="help" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="help,?"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="history-cmd" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="history"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="info" interface="org.apache.geronimo.gshell.command.Command">
- </osgi:service>
-
- <osgi:service ref="set" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="set"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="unset" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="unset"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="source" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="source,."/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="echo" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="alias" value="echo"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="rsh" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="remote"/>
- <entry key="alias" value="rsh"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="grep" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="utils"/>
- <entry key="alias" value="grep"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="cat" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="utils"/>
- <entry key="alias" value="cat"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="java" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="utils"/>
- <entry key="alias" value="java"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="exec" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="utils"/>
- <entry key="alias" value="exec"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="sleep" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="utils"/>
- <entry key="alias" value="sleep"/>
- </osgi:service-properties>
- </osgi:service>
+ <osgi:list id="osgiCommands" interface="org.apache.geronimo.gshell.command.Command" cardinality="0..N">
+ <osgi:listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister" />
+ </osgi:list>
+ <!--
<osgi:service ref="commandExecutor" interface="org.apache.geronimo.gshell.command.CommandExecutor">
</osgi:service>
Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml Thu Oct 23 10:45:08 2008
@@ -0,0 +1,100 @@
+<?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: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://servicemix.apache.org/schema/servicemix-gshell
+ http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
+
+ <bean id="metaFileProviderConfigurer" class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <property name="scheme" value="meta"/>
+ <property name="provider">
+ <bean class="org.apache.geronimo.gshell.vfs.provider.meta.MetaFileProvider"/>
+ </property>
+ </bean>
+
+ <bean id="fileSystemAccess" class="org.apache.geronimo.gshell.vfs.FileSystemAccessImpl"/>
+
+ <bean id="fileObjectNameCompleter" class="org.apache.geronimo.gshell.vfs.FileObjectNameCompleter"/>
+
+ <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
+ <property name="customEditors">
+ <map>
+ <entry key="org.apache.commons.vfs.CacheStrategy">
+ <bean class="org.apache.geronimo.gshell.vfs.config.CacheStrategyEditor"/>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!--
+ TODO: Set tempDir File arg in constructor to set the temporary location, may need 2 replicators?
+ -->
+ <bean id="defaultFileReplicator" class="org.apache.commons.vfs.impl.DefaultFileReplicator"/>
+
+ <bean id="fileSystemManager" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactoryBean">
+ <property name="filesCache">
+ <bean class="org.apache.commons.vfs.cache.SoftRefFilesCache"/>
+ </property>
+
+ <property name="cacheStrategy" value="ON_RESOLVE"/>
+
+ <property name="fileReplicator">
+ <bean class="org.apache.commons.vfs.impl.PrivilegedFileReplicator">
+ <constructor-arg ref="defaultFileReplicator"/>
+ </bean>
+ </property>
+
+ <!--
+ TODO: Try and root the temporary store under ${gshell.home}/tmp or something
+ -->
+ <property name="temporaryFileStore">
+ <ref bean="defaultFileReplicator"/>
+ </property>
+
+ <property name="fileContentInfoFactory">
+ <bean class="org.apache.commons.vfs.impl.FileContentInfoFilenameFactory"/>
+ </property>
+
+ <property name="defaultProvider">
+ <bean class="org.apache.commons.vfs.provider.url.UrlFileProvider"/>
+ </property>
+ </bean>
+
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <property name="scheme" value="tmp"/>
+ <property name="provider">
+ <bean class="org.apache.commons.vfs.provider.temp.TemporaryFileProvider"/>
+ </property>
+ </bean>
+
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <property name="scheme" value="ram"/>
+ <property name="provider">
+ <bean class="org.apache.commons.vfs.provider.ram.RamFileProvider"/>
+ </property>
+ </bean>
+
+</beans>
\ No newline at end of file
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml Thu Oct 23 10:45:08 2008
@@ -28,17 +28,12 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/servicemix/kernel/gshell/core/commands.xml" />
-
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
- <bean class="org.apache.geronimo.gshell.spring.BeanContainerAwareProcessor">
- <constructor-arg>
- <bean class="org.apache.servicemix.kernel.gshell.core.SpringBeanContainerFactoryBean" />
- </constructor-arg>
- </bean>
- <bean id="io" class="org.apache.geronimo.gshell.io.IO" />
+ <bean id="io" class="org.apache.geronimo.gshell.io.IO">
+ <property name="verbosity" value="DEBUG" />
+ </bean>
<bean id="application" class="org.apache.servicemix.kernel.gshell.core.ApplicationImpl">
<property name="id" value="servicemix" />
@@ -105,75 +100,6 @@
<bean id="metaDataRegistry" class="org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataRegistryImpl"/>
- <bean id="metaFileProviderConfigurer" class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
- <property name="scheme" value="meta"/>
- <property name="provider">
- <bean class="org.apache.geronimo.gshell.vfs.provider.meta.MetaFileProvider"/>
- </property>
- </bean>
-
- <bean id="fileSystemAccess" class="org.apache.geronimo.gshell.vfs.FileSystemAccessImpl"/>
-
- <bean id="fileObjectNameCompleter" class="org.apache.geronimo.gshell.vfs.FileObjectNameCompleter"/>
-
- <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
- <property name="customEditors">
- <map>
- <entry key="org.apache.commons.vfs.CacheStrategy">
- <bean class="org.apache.geronimo.gshell.vfs.config.CacheStrategyEditor"/>
- </entry>
- </map>
- </property>
- </bean>
-
- <!--
- TODO: Set tempDir File arg in constructor to set the temporary location, may need 2 replicators?
- -->
- <bean id="defaultFileReplicator" class="org.apache.commons.vfs.impl.DefaultFileReplicator"/>
-
- <bean id="fileSystemManager" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactoryBean">
- <property name="filesCache">
- <bean class="org.apache.commons.vfs.cache.SoftRefFilesCache"/>
- </property>
-
- <property name="cacheStrategy" value="ON_RESOLVE"/>
-
- <property name="fileReplicator">
- <bean class="org.apache.commons.vfs.impl.PrivilegedFileReplicator">
- <constructor-arg ref="defaultFileReplicator"/>
- </bean>
- </property>
-
- <!--
- TODO: Try and root the temporary store under ${gshell.home}/tmp or something
- -->
- <property name="temporaryFileStore">
- <ref bean="defaultFileReplicator"/>
- </property>
-
- <property name="fileContentInfoFactory">
- <bean class="org.apache.commons.vfs.impl.FileContentInfoFilenameFactory"/>
- </property>
-
- <property name="defaultProvider">
- <bean class="org.apache.commons.vfs.provider.url.UrlFileProvider"/>
- </property>
- </bean>
-
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
- <property name="scheme" value="tmp"/>
- <property name="provider">
- <bean class="org.apache.commons.vfs.provider.temp.TemporaryFileProvider"/>
- </property>
- </bean>
-
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
- <property name="scheme" value="ram"/>
- <property name="provider">
- <bean class="org.apache.commons.vfs.provider.ram.RamFileProvider"/>
- </property>
- </bean>
-
<bean id="applicationManager" class="org.apache.servicemix.kernel.gshell.core.ApplicationManagerImpl"/>
</beans>
\ No newline at end of file
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/commands.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/commands.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/commands.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/commands.xml Thu Oct 23 10:45:08 2008
@@ -26,6 +26,8 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
+ <bean class="org.apache.servicemix.kernel.gshell.core.BeanContainerAwareProcessor" />
+
<bean id="statelessCommandTemplate" class="org.apache.geronimo.gshell.wisdom.command.StatelessCommand" abstract="true">
<property name="documenter">
<bean class="org.apache.geronimo.gshell.wisdom.command.MessageSourceCommandDocumenter"/>
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/test/java/org/apache/servicemix/kernel/gshell/core/Test.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/test/java/org/apache/servicemix/kernel/gshell/core/Test.java?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/test/java/org/apache/servicemix/kernel/gshell/core/Test.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/test/java/org/apache/servicemix/kernel/gshell/core/Test.java Thu Oct 23 10:45:08 2008
@@ -10,7 +10,9 @@
public void test() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml", "META-INF/spring/gshell-commands.xml" });
+ new String[] { "META-INF/spring/gshell.xml",
+ "META-INF/spring/gshell-vfs.xml",
+ "META-INF/spring/gshell-commands.xml" });
ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
assertNotNull(appMgr);
Shell shell = appMgr.create();
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/pom.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/pom.xml Thu Oct 23 10:45:08 2008
@@ -64,9 +64,13 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Export-Package>
- org.apache.geronimo.gshell.osgi*;version=${project.version};-split-package:=merge-first
+ org.apache.servicemix.kernel.gshell.osgi*;version=${project.version};-split-package:=merge-first
</Export-Package>
- <Import-Package>*</Import-Package>
+ <Import-Package>
+ org.apache.geronimo.gshell.wisdom.command,
+ org.apache.servicemix.kernel.gshell.core,
+ *
+ </Import-Package>
<Private-Package>!*</Private-Package>
<Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
</instructions>
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleCommand.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleCommand.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleCommand.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleCommand.java Thu Oct 23 10:45:08 2008
@@ -14,19 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:10:32 PM
- * To change this template use File | Settings | File Templates.
- */
public abstract class BundleCommand extends OsgiCommandSupport {
@Argument(required = true, index = 0)
@@ -36,10 +29,10 @@
Bundle bundle = getBundleContext().getBundle(id);
if (bundle == null) {
io.out.println("Bundle " + id + " not found");
- return FAILURE;
+ return Result.FAILURE;
}
doExecute(bundle);
- return SUCCESS;
+ return Result.SUCCESS;
}
protected abstract void doExecute(Bundle bundle) throws Exception;
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleLevel.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleLevel.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleLevel.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.java Thu Oct 23 10:45:08 2008
@@ -14,22 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.apache.geronimo.gshell.clp.Argument;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:37:30 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:bundle-level", description="Get or set the start level of a given bundle")
public class BundleLevel extends BundleCommand {
@Argument(required = false, index = 1)
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundlesCommand.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundlesCommand.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundlesCommand.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundlesCommand.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundlesCommand.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundlesCommand.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/BundlesCommand.java Thu Oct 23 10:45:08 2008
@@ -14,22 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import java.util.ArrayList;
import java.util.List;
import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:10:32 PM
- * To change this template use File | Settings | File Templates.
- */
public abstract class BundlesCommand extends OsgiCommandSupport {
@Argument(required = false, multiValued = true, description = "Bundle IDs")
@@ -48,7 +41,7 @@
}
}
doExecute(bundles);
- return SUCCESS;
+ return Result.SUCCESS;
}
protected abstract void doExecute(List<Bundle> bundles) throws Exception;
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Headers.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Headers.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Headers.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Headers.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Headers.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Headers.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Headers.java Thu Oct 23 10:45:08 2008
@@ -14,27 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import java.io.PrintWriter;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:10:15 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:headers", description="Display headers")
public class Headers extends OsgiCommandSupport {
@Argument(required = false, multiValued = true, description = "Bundles ids")
@@ -58,7 +47,7 @@
printHeaders(bundles[i]);
}
}
- return SUCCESS;
+ return Result.SUCCESS;
}
protected void printHeaders(Bundle bundle) throws Exception {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/InstallBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/InstallBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/InstallBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/InstallBundle.java Thu Oct 23 10:45:08 2008
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -22,19 +22,10 @@
import org.apache.geronimo.gshell.clp.Argument;
import org.apache.geronimo.gshell.clp.Option;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Dec 5, 2007
- * Time: 3:32:15 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:install", description="Install bundle")
public class InstallBundle extends OsgiCommandSupport {
@Argument(required = true, multiValued = true, description = "Bundle URLs")
@@ -66,7 +57,7 @@
} else if (sb.length() > 0) {
io.out.println("Bundle ID: " + sb.toString());
}
- return null;
+ return Result.SUCCESS;
}
protected Bundle install(String location, PrintWriter out, PrintWriter err) {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListBundles.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListBundles.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListBundles.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListBundles.java Thu Oct 23 10:45:08 2008
@@ -14,24 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.apache.geronimo.gshell.clp.Option;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.startlevel.StartLevel;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 9:44:20 AM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:list-bundles", description="List bundles")
public class ListBundles extends OsgiCommandSupport {
@Option(name = "-l", description = "Show locations")
@@ -119,7 +110,7 @@
else {
io.out.println("There are no installed bundles.");
}
- return SUCCESS;
+ return Result.SUCCESS;
}
finally {
if (ref != null) {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListServices.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListServices.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListServices.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListServices.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListServices.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListServices.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ListServices.java Thu Oct 23 10:45:08 2008
@@ -14,26 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import java.util.List;
import org.apache.geronimo.gshell.clp.Argument;
import org.apache.geronimo.gshell.clp.Option;
import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 9:44:20 AM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id = "osgi:list-services", description = "List services")
public class ListServices extends OsgiCommandSupport {
@Option(name = "-a", description = "Show all")
@@ -177,7 +168,7 @@
io.out.println("There are no registered services.");
}
}
- return null;
+ return Result.SUCCESS;
}
}
\ No newline at end of file
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RefreshBundle.java Thu Oct 23 10:45:08 2008
@@ -14,23 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:37:30 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:refresh", description="Refresh bundle")
public class RefreshBundle extends OsgiCommandSupport {
@Argument(required = false)
@@ -41,13 +32,13 @@
ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
if (ref == null) {
io.out.println("PackageAdmin service is unavailable.");
- return FAILURE;
+ return Result.FAILURE;
}
try {
PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
if (pa == null) {
io.out.println("PackageAdmin service is unavailable.");
- return FAILURE;
+ return Result.FAILURE;
}
if (id == null) {
pa.refreshPackages(null);
@@ -56,7 +47,7 @@
Bundle bundle = getBundleContext().getBundle(id);
if (bundle == null) {
io.out.println("Bundle " + id + " not found");
- return FAILURE;
+ return Result.FAILURE;
}
pa.refreshPackages(new Bundle[] { bundle });
}
@@ -64,6 +55,6 @@
finally {
getBundleContext().ungetService(ref);
}
- return SUCCESS;
+ return Result.SUCCESS;
}
}
\ No newline at end of file
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/ResolveBundle.java Thu Oct 23 10:45:08 2008
@@ -14,22 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:37:30 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:resolve", description="Resolve bundle")
public class ResolveBundle extends BundleCommand {
protected void doExecute(Bundle bundle) throws Exception {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Shutdown.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Shutdown.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Shutdown.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Shutdown.java Thu Oct 23 10:45:08 2008
@@ -14,16 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
/**
* Command to shut down ServiceMix Kernel
*/
-@CommandComponent(id="osgi:shutdown", description="Shutdown")
public class Shutdown extends OsgiCommandSupport {
protected Object doExecute() throws Exception {
@@ -37,7 +35,7 @@
}
}
}.start();
- return SUCCESS;
+ return Result.SUCCESS;
}
}
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartBundle.java Thu Oct 23 10:45:08 2008
@@ -14,19 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.osgi.framework.Bundle;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:10:15 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:start", description="Start bundle")
public class StartBundle extends BundleCommand {
protected void doExecute(Bundle bundle) throws Exception {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartLevel.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartLevel.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartLevel.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StartLevel.java Thu Oct 23 10:45:08 2008
@@ -14,23 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:37:30 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:start-level", description="Get or set the start level")
public class StartLevel extends OsgiCommandSupport {
@Argument(required = false, index = 0)
@@ -60,7 +51,7 @@
finally {
getBundleContext().ungetService(ref);
}
- return null;
+ return Result.SUCCESS;
}
}
\ No newline at end of file
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StopBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StopBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StopBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/StopBundle.java Thu Oct 23 10:45:08 2008
@@ -14,19 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.osgi.framework.Bundle;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:10:15 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:stop", description="Stop bundle")
public class StopBundle extends BundleCommand {
protected void doExecute(Bundle bundle) throws Exception {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/UninstallBundle.java Thu Oct 23 10:45:08 2008
@@ -14,19 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.osgi.framework.Bundle;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Oct 3, 2007
- * Time: 12:37:30 PM
- * To change this template use File | Settings | File Templates.
- */
-@CommandComponent(id="osgi:uninstall", description="Uninstall bundle")
public class UninstallBundle extends BundleCommand {
protected void doExecute(Bundle bundle) throws Exception {
Copied: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Util.java (from r707408, servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Util.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Util.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Util.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Util.java&r1=707408&r2=707424&rev=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Util.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/Util.java Thu Oct 23 10:45:08 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.geronimo.gshell.osgi;
+package org.apache.servicemix.kernel.gshell.osgi;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=707424&r1=707423&r2=707424&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml Thu Oct 23 10:45:08 2008
@@ -21,109 +21,59 @@
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"
+ xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
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">
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://servicemix.apache.org/schema/servicemix-gshell
+ http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <!-- osgi commands -->
- <bean id="bundle-level" class="org.apache.geronimo.gshell.osgi.BundleLevel" />
- <bean id="headers" class="org.apache.geronimo.gshell.osgi.Headers" />
- <bean id="install-bundle" class="org.apache.geronimo.gshell.osgi.InstallBundle" />
- <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="bundle-level" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="bundle-level"/>
- </osgi:service-properties>
- </osgi:service>
+ <import resource="classpath:org/apache/servicemix/kernel/gshell/core/commands.xml" />
- <osgi:service ref="headers" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="install-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="install"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="list-bundles" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="list"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="list-services" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="list-services"/>
- <entry key="alias" value="ls"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="refresh-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="refresh"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="resolve-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="resolve"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="shutdown" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="start-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="start"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="start-level" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="start-level"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="stop-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="stop"/>
- </osgi:service-properties>
- </osgi:service>
-
- <osgi:service ref="uninstall-bundle" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="osgi"/>
- <entry key="name" value="uninstall"/>
- </osgi:service-properties>
- </osgi:service>
+ <gshell:command-bundle>
+ <gshell:command name="osgi/bundle-level">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.BundleLevel" />
+ </gshell:command>
+ <gshell:command name="osgi/headers">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.Headers" />
+ </gshell:command>
+ <gshell:command name="osgi/intall-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.InstallBundle" />
+ </gshell:command>
+ <gshell:command name="osgi/list-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.ListBundles" />
+ </gshell:command>
+ <gshell:command name="osgi/list-services">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.ListServices" />
+ </gshell:command>
+ <gshell:command name="osgi/list-services">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.ListServices" />
+ </gshell:command>
+ <gshell:command name="osgi/refresh-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.RefreshBundle" />
+ </gshell:command>
+ <gshell:command name="osgi/resolve-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.ResolveBundle" />
+ </gshell:command>
+ <gshell:command name="osgi/shutdown">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.Shutdown" />
+ </gshell:command>
+ <gshell:command name="osgi/start-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.StartBundle" />
+ </gshell:command>
+ <gshell:command name="osgi/start-level">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.StartLevel" />
+ </gshell:command>
+ <gshell:command name="osgi/stop-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.StopBundle" />
+ </gshell:command>
+ <gshell:command name="osgi/uninstall-bundle">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.UninstallBundle" />
+ </gshell:command>
+ </gshell:command-bundle>
</beans>
\ No newline at end of file
Added: servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.properties?rev=707424&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.properties (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/BundleLevel.properties Thu Oct 23 10:45:08 2008
@@ -0,0 +1,27 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Get or set the start level of a given bundle
+
+command.manual=\
+ TODO: about manual
\ No newline at end of file