FELIX-1098: Remove strong dependencies on spring / spring-dm
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@771269 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml b/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml
index eee0bab..07c3ca7 100644
--- a/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml
+++ b/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml
@@ -35,56 +35,64 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
- <bean id="adminCommandBundleSupport" scope="prototype">
- <property name="adminService" ref="adminService" />
- </bean>
-
<gshell:command-bundle>
<gshell:command name="admin/create">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.CreateCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.CreateCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
</gshell:command>
<gshell:command name="admin/connect">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ConnectCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ConnectCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
<gshell:completers>
<ref bean="instanceCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="admin/list">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ListCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ListCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
</gshell:command>
<gshell:command name="admin/start">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StartCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StartCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
<gshell:completers>
<ref bean="instanceCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="admin/stop">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StopCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StopCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
<gshell:completers>
<ref bean="instanceCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="admin/destroy">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.DestroyCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.DestroyCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
<gshell:completers>
<ref bean="instanceCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="admin/change-port">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ChangePortCommand"
- parent="adminCommandBundleSupport" />
+ <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ChangePortCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </gshell:action>
<gshell:completers>
<ref bean="instanceCompleter" />
<null/>
diff --git a/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml b/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
index 2aeaffd..095e7e5 100644
--- a/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
+++ b/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
@@ -35,41 +35,53 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="config/cancel">
- <gshell:action class="org.apache.felix.karaf.gshell.config.CancelCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.CancelCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="config/edit">
- <gshell:action class="org.apache.felix.karaf.gshell.config.EditCommand"/>
+ <gshell:action class="org.apache.felix.karaf.gshell.config.EditCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="configCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="config/list">
- <gshell:action class="org.apache.felix.karaf.gshell.config.ListCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.ListCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="config/propdel">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropDelCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.PropDelCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="configPropertyCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="config/proplist">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropListCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.PropListCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="config/propset">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropSetCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.PropSetCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="configPropertyCompleter" />
<null/>
</gshell:completers>
</gshell:command>
<gshell:command name="config/update">
- <gshell:action class="org.apache.felix.karaf.gshell.config.UpdateCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.config.UpdateCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
index 9e5f722..a40b0eb 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
@@ -30,7 +30,7 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
-public class ApplicationManagerImpl implements ApplicationManager, ApplicationContextAware, InitializingBean, DisposableBean {
+public class ApplicationManagerImpl implements ApplicationManager, ApplicationContextAware {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -45,7 +45,7 @@
this.application = application;
}
- public void afterPropertiesSet() throws Exception {
+ public void init() throws Exception {
if (!SystemOutputHijacker.isInstalled()) {
SystemOutputHijacker.install();
}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandBundle.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandBundle.java
deleted file mode 100644
index b44014e..0000000
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandBundle.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.felix.karaf.gshell.core;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.geronimo.gshell.command.Alias;
-import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.command.Link;
-import org.apache.geronimo.gshell.registry.AliasRegistry;
-import org.apache.geronimo.gshell.registry.CommandRegistry;
-import org.apache.geronimo.gshell.wisdom.command.LinkCommand;
-import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.osgi.context.BundleContextAware;
-
-public class CommandBundle implements BundleContextAware, InitializingBean, DisposableBean, ApplicationContextAware {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private CommandRegistry commandRegistry;
-
- private AliasRegistry aliasRegistry;
-
- private BundleContext bundleContext;
-
- private List<Command> commands;
-
- private List<Link> links;
-
- private List<Alias> aliases;
-
- private ApplicationContext applicationContext;
-
- private List<ServiceRegistration> registrations = new ArrayList<ServiceRegistration>();
-
- public CommandBundle() {
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public List<Command> getCommands() {
- return commands;
- }
-
- public void setCommands(final List<Command> commands) {
- assert commands != null;
-
- this.commands = commands;
- }
-
- public List<Link> getLinks() {
- return links;
- }
-
- public void setLinks(List<Link> links) {
- assert links != null;
-
- this.links = links;
- }
-
- public List<Alias> getAliases() {
- return aliases;
- }
-
- public void setAliases(List<Alias> aliases) {
- assert aliases != null;
-
- this.aliases = aliases;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public void afterPropertiesSet() throws Exception {
- log.debug("Initializing command bundle");
- if (commandRegistry == null) {
- String[] names = applicationContext.getBeanNamesForType(CommandRegistry.class);
- if (names.length == 1) {
- commandRegistry = (CommandRegistry) applicationContext.getBean(names[0], CommandRegistry.class);
- }
- }
- if (aliasRegistry == null) {
- String[] names = applicationContext.getBeanNamesForType(AliasRegistry.class);
- if (names.length == 1) {
- aliasRegistry = (AliasRegistry) applicationContext.getBean(names[0], AliasRegistry.class);
- }
- }
- if (commandRegistry != null && aliasRegistry != null) {
- log.debug("Command bundle is using the auto wired command/alias registry");
- if (commands != null) {
- for (Command command : commands) {
- log.debug("Registering command: {}", command.getLocation());
- commandRegistry.registerCommand(command);
- }
- }
- if (links != null) {
- for (Link link : links) {
- log.debug("Registering link: {}", link.getName());
- LinkCommand cmd = new LinkCommand(commandRegistry, link.getTarget());
- cmd.setLocation(new CommandLocationImpl(link.getName()));
- commandRegistry.registerCommand(cmd);
- }
- }
- if (aliases != null) {
- for (Alias alias : aliases) {
- log.debug("Registering alias: {}", alias.getName());
- aliasRegistry.registerAlias(alias.getName(), alias.getAlias());
- }
- }
- } else if (bundleContext != null) {
- log.debug("Command bundle is using the OSGi registry");
- if (commands != null) {
- for (Command command : commands) {
- log.debug("Registering command: {}", command.getLocation());
- Dictionary props = new Properties();
- props.put(OsgiCommandRegistry.NAME, command.getLocation().getFullPath());
- registrations.add(bundleContext.registerService(Command.class.getName(), command, props));
- }
- }
- if (links != null) {
- for (Link link : links) {
- log.debug("Registering link: {}", link.getName());
- registrations.add(bundleContext.registerService(Link.class.getName(), link, new Properties()));
- }
- }
- if (aliases != null) {
- for (Alias alias : aliases) {
- log.debug("Registering alias: {}", alias.getName());
- Dictionary props = new Properties();
- registrations.add(bundleContext.registerService(Alias.class.getName(), alias, new Properties()));
- }
- }
- } else {
- throw new Exception("Command bundle should be wired to the command/alias registry or be used in an OSGi context");
- }
- }
-
- public void destroy() {
- log.debug("Destroying command bundle");
- for (ServiceRegistration reg : registrations) {
- reg.unregister();
- }
- }
-
-}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandSupport.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandSupport.java
index 7844711..17a44cc 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandSupport.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandSupport.java
@@ -29,9 +29,8 @@
import org.apache.geronimo.gshell.io.IO;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.springframework.osgi.context.BundleContextAware;
-public abstract class OsgiCommandSupport implements CommandAction, BundleContextAware {
+public abstract class OsgiCommandSupport implements CommandAction {
protected Log log = LogFactory.getLog(getClass());
protected BundleContext bundleContext;
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/CommandParser.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/CommandParser.java
deleted file mode 100644
index f1efa60..0000000
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/CommandParser.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * 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.felix.karaf.gshell.core.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-import org.apache.geronimo.gshell.command.Alias;
-import org.apache.geronimo.gshell.command.Link;
-import org.apache.geronimo.gshell.wisdom.command.AliasImpl;
-import org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter;
-import org.apache.geronimo.gshell.wisdom.command.LinkImpl;
-import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
-import org.apache.felix.karaf.gshell.core.CommandBundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.GenericBeanDefinition;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.util.StringUtils;
-import org.springframework.util.xml.DomUtils;
-
-public class CommandParser extends AbstractBeanDefinitionParser {
-
- public static final String ID = ID_ATTRIBUTE;
-
- public static final String DESCRIPTION = "description";
-
- public static final String PLUGIN_TEMPLATE = "pluginTemplate";
-
- public static final String ACTION = "action";
-
- public static final String ACTION_ID = "actionId";
-
- public static final String COMMAND_TEMPLATE_SUFFIX = "CommandTemplate";
-
- public static final String COMMAND_BUNDLE = "command-bundle";
-
- public static final String NAME = "name";
-
- public static final String LOCATION = "location";
-
- public static final String COMMANDS = "commands";
-
- public static final String COMMAND = "command";
-
- public static final String TYPE = "type";
-
- public static final String DOCUMENTER = "documenter";
-
- public static final String COMPLETER = "completer";
-
- public static final String COMPLETERS = "completers";
-
- public static final String BEAN = "bean";
-
- public static final String REF = "ref";
-
- public static final String NULL = "null";
-
- public static final String MESSAGE_SOURCE = "message-source";
-
- public static final String MESSAGES = "messages";
-
- public static final String PROTOTYPE = "prototype";
-
- public static final String ALIAS = "alias";
-
- public static final String ALIASES = "aliases";
-
- public static final String LINK = "link";
-
- public static final String LINKS = "links";
-
- public static final String TARGET = "target";
-
- @Override
- protected boolean shouldGenerateId() {
- return true;
- }
-
- @Override
- protected boolean shouldGenerateIdAsFallback() {
- return true;
- }
-
- protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext context) {
- assert element != null;
- assert context != null;
-
- Builder builder = new Builder(context);
- BeanDefinitionBuilder plugin = builder.parseCommandBundle(element);
- return plugin.getBeanDefinition();
- }
-
- /**
- * Helper to deal with command type.
- */
- private enum CommandType
- {
- STATELESS,
- STATEFUL;
-
- public static CommandType parse(final String text) {
- assert text != null;
-
- return valueOf(text.toUpperCase());
- }
-
- public String getTemplateName() {
- return name().toLowerCase() + COMMAND_TEMPLATE_SUFFIX;
- }
-
- public void wire(final BeanDefinitionBuilder command, final BeanDefinitionHolder action) {
- assert command != null;
- assert action != null;
-
- switch (this) {
- case STATELESS:
- command.addPropertyReference(ACTION, action.getBeanName());
- break;
-
- case STATEFUL:
- command.addPropertyValue(ACTION_ID, action.getBeanName());
- break;
- }
- }
- }
-
- /**
- * Helper to build plugin related bean definitions.
- */
- private class Builder
- {
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private ParserContext context;
-
- public Builder(final ParserContext context) {
- assert context != null;
-
- this.context = context;
- }
-
- private String resolveId(final Element element, final BeanDefinition def) throws BeanDefinitionStoreException {
- assert element != null;
- assert def != null;
-
- if (shouldGenerateId()) {
- return context.getReaderContext().generateBeanName(def);
- }
-
- String id = element.getAttribute(ID_ATTRIBUTE);
-
- if (!StringUtils.hasText(id) && shouldGenerateIdAsFallback()) {
- id = context.getReaderContext().generateBeanName(def);
- }
-
- return id;
- }
-
- @SuppressWarnings({"unchecked"})
- private List<Element> getChildElements(final Element element, final String name) {
- assert element != null;
- assert name != null;
-
- return DomUtils.getChildElementsByTagName(element, name);
- }
-
- @SuppressWarnings({"unchecked"})
- private List<Element> getChildElements(final Element element, final String[] names) {
- assert element != null;
- assert names != null;
-
- return DomUtils.getChildElementsByTagName(element, names);
- }
-
- @SuppressWarnings({"unchecked"})
- private Element getChildElement(final Element element, final String name) {
- assert element != null;
- assert name != null;
-
- List<Element> elements = DomUtils.getChildElementsByTagName(element, name);
- if (elements != null && !elements.isEmpty()) {
- return elements.get(0);
- }
- return null;
- }
-
- private BeanDefinitionParserDelegate createBeanDefinitionParserDelegate(final Element element) {
- assert element != null;
-
- BeanDefinitionParserDelegate parser = new BeanDefinitionParserDelegate(context.getReaderContext());
- parser.initDefaults(element.getOwnerDocument().getDocumentElement());
- return parser;
- }
-
- private BeanDefinitionHolder parseBeanDefinitionElement(final Element element) {
- assert element != null;
-
- BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(element);
- return parser.parseBeanDefinitionElement(element);
- }
-
- private void parseAndApplyDescription(final Element element, final BeanDefinition def) {
- assert element != null;
- assert def != null;
-
- Element desc = getChildElement(element, DESCRIPTION);
- if (desc != null) {
- if (def instanceof AbstractBeanDefinition) {
- ((AbstractBeanDefinition)def).setDescription(desc.getTextContent());
- }
- }
- }
-
- private void parseAndApplyDescription(final Element element, final BeanDefinitionBuilder builder) {
- assert element != null;
- assert builder != null;
-
- parseAndApplyDescription(element, builder.getRawBeanDefinition());
- }
-
- private BeanDefinitionHolder register(final BeanDefinitionHolder holder) {
- assert holder != null;
-
- registerBeanDefinition(holder, context.getRegistry());
- return holder;
- }
-
- private BeanDefinitionHolder register(final BeanDefinition def, final String id) {
- assert def != null;
- assert id != null;
-
- BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
- return register(holder);
- }
-
- //
- // <gshell:command-bundle>
- //
-
- private BeanDefinitionBuilder parseCommandBundle(final Element element) {
- assert element != null;
-
- log.trace("Parse command bundle; element; {}", element);
-
- BeanDefinitionBuilder bundle = BeanDefinitionBuilder.rootBeanDefinition(CommandBundle.class);
- parseAndApplyDescription(element, bundle);
-
- //
- // TODO: Figure out how we can save the order of <gshell:command> and <gshell:link> so that 'help' displays them in the order they are defined
- //
-
- ManagedList commands = new ManagedList();
- commands.addAll(parseCommands(element));
- bundle.addPropertyValue(COMMANDS, commands);
-
- ManagedList links = new ManagedList();
- links.addAll(parseLinks(element));
- bundle.addPropertyValue(LINKS, links);
-
- ManagedList aliases = new ManagedList();
- aliases.addAll(parseAliases(element));
- bundle.addPropertyValue(ALIASES, aliases);
-
- return bundle;
- }
-
- //
- // <gshell:command>
- //
-
- private List<BeanDefinition> parseCommands(final Element element) {
- assert element != null;
-
- log.trace("Parse commands; element; {}", element);
-
- List<BeanDefinition> commands = new ArrayList<BeanDefinition>();
-
- List<Element> children = getChildElements(element, COMMAND);
-
- for (Element child : children) {
- BeanDefinitionBuilder command = parseCommand(child);
- commands.add(command.getBeanDefinition());
- }
-
- return commands;
- }
-
- private BeanDefinitionBuilder parseCommand(final Element element) {
- assert element != null;
-
- log.trace("Parse command; element; {}", element);
-
- CommandType type = CommandType.parse(element.getAttribute(TYPE));
- BeanDefinitionBuilder command = BeanDefinitionBuilder.childBeanDefinition(type.getTemplateName());
- parseAndApplyDescription(element, command);
-
- Element child;
-
- // Required children elements
-
- String name = element.getAttribute(NAME);
- BeanDefinition def = new GenericBeanDefinition();
- def.setBeanClassName(CommandLocationImpl.class.getName());
- def.getConstructorArgumentValues().addGenericArgumentValue(name);
- command.addPropertyValue(LOCATION, def);
-
- child = getChildElement(element, ACTION);
- BeanDefinitionHolder action = parseCommandAction(child);
- type.wire(command, action);
-
- // Optional children elements
-
- child = getChildElement(element, DOCUMENTER);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(DOCUMENTER, holder.getBeanDefinition());
- }
-
- child = getChildElement(element, COMPLETER);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(COMPLETER, holder.getBeanDefinition());
- }
-
- child = getChildElement(element, COMPLETERS);
- if (child != null) {
- BeanDefinitionBuilder completer = parseCommandCompleters(child);
- command.addPropertyValue(COMPLETER, completer.getBeanDefinition());
- }
-
- child = getChildElement(element, MESSAGE_SOURCE);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(MESSAGES, holder.getBeanDefinition());
- }
-
- //String id = resolveId(element, command.getBeanDefinition());
- //BeanDefinitionHolder holder = register(command.getBeanDefinition(), id);
-
- return command;
- }
-
- //
- // <gshell:completers>
- //
-
- private BeanDefinitionBuilder parseCommandCompleters(final Element element) {
- assert element != null;
-
- BeanDefinitionBuilder completer = BeanDefinitionBuilder.rootBeanDefinition(ConfigurableCommandCompleter.class);
-
- ManagedList completers = new ManagedList();
-
- List<Element> children = getChildElements(element, new String[] {BEAN, REF, NULL});
-
- for (Element child : children) {
- if (DomUtils.nodeNameEquals(child, BEAN)) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- // noinspection unchecked
- completers.add(holder.getBeanDefinition());
- }
- else if (DomUtils.nodeNameEquals(child, REF)) {
- BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(child);
- RuntimeBeanReference ref = (RuntimeBeanReference) parser.parsePropertySubElement(child, completer.getRawBeanDefinition());
- // noinspection unchecked
- completers.add(ref);
- }
- else if (DomUtils.nodeNameEquals(child, NULL)) {
- // noinspection unchecked
- completers.add(null);
- }
- }
-
- completer.addConstructorArgValue(completers);
-
- return completer;
- }
-
- //
- // <gshell:action>
- //
-
- private BeanDefinitionHolder parseCommandAction(final Element element) {
- assert element != null;
-
- log.trace("Parse command action; element; {}", element);
-
- // Construct the action
- BeanDefinition action = parseBeanDefinitionElement(element).getBeanDefinition();
-
- // All actions are configured as prototypes
- action.setScope(PROTOTYPE);
-
- // Generate id and register the bean
- String id = resolveId(element, action);
- return register(action, id);
- }
-
- //
- // <gshell:link>
- //
-
- private List<Link> parseLinks(final Element element) {
- assert element != null;
-
- log.trace("Parse links; element; {}", element);
-
- List<Link> links = new ArrayList<Link>();
-
- List<Element> children = getChildElements(element, LINK);
-
- for (Element child : children) {
- String name = child.getAttribute(NAME);
- String target = child.getAttribute(TARGET);
-
- links.add(new LinkImpl(name, target));
- }
-
- return links;
- }
-
- //
- // <gshell:alias>
- //
-
- private List<Alias> parseAliases(final Element element) {
- assert element != null;
-
- log.trace("Parse aliases; element; {}", element);
-
- List<Alias> aliases = new ArrayList<Alias>();
-
- List<Element> children = getChildElements(element, ALIAS);
-
- for (Element child : children) {
- String name = child.getAttribute(NAME);
- String alias = child.getAttribute(ALIAS);
-
- aliases.add(new AliasImpl(name, alias));
- }
-
- return aliases;
- }
- }
-}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
index e2c7913..4f0240f 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
@@ -18,7 +18,40 @@
*/
package org.apache.felix.karaf.gshell.core.config;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.w3c.dom.Element;
+
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.GenericBeanDefinition;
+import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.parsing.BeanComponentDefinition;
+import org.springframework.util.StringUtils;
+import org.springframework.util.xml.DomUtils;
+import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
+import org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter;
+import org.apache.geronimo.gshell.wisdom.command.LinkImpl;
+import org.apache.geronimo.gshell.wisdom.command.AliasImpl;
+import org.apache.geronimo.gshell.wisdom.command.StatefulCommand;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.Link;
+import org.apache.geronimo.gshell.command.Alias;
+import org.apache.felix.karaf.gshell.core.OsgiCommandRegistry;
+import org.apache.felix.karaf.gshell.core.BeanContainerAwareProcessor;
public class NamespaceHandler extends NamespaceHandlerSupport {
@@ -26,4 +59,425 @@
registerBeanDefinitionParser(CommandParser.COMMAND_BUNDLE, new CommandParser());
}
+ public static class CommandParser extends AbstractBeanDefinitionParser {
+
+ public static final String ID = ID_ATTRIBUTE;
+
+ public static final String DESCRIPTION = "description";
+
+ public static final String PLUGIN_TEMPLATE = "pluginTemplate";
+
+ public static final String ACTION = "action";
+
+ public static final String ACTION_ID = "actionId";
+
+ public static final String COMMAND_TEMPLATE_SUFFIX = "CommandTemplate";
+
+ public static final String COMMAND_BUNDLE = "command-bundle";
+
+ public static final String NAME = "name";
+
+ public static final String LOCATION = "location";
+
+ public static final String COMMANDS = "commands";
+
+ public static final String COMMAND = "command";
+
+ public static final String DOCUMENTER = "documenter";
+
+ public static final String COMPLETER = "completer";
+
+ public static final String COMPLETERS = "completers";
+
+ public static final String BEAN = "bean";
+
+ public static final String REF = "ref";
+
+ public static final String NULL = "null";
+
+ public static final String MESSAGE_SOURCE = "message-source";
+
+ public static final String MESSAGES = "messages";
+
+ public static final String PROTOTYPE = "prototype";
+
+ public static final String ALIAS = "alias";
+
+ public static final String ALIASES = "aliases";
+
+ public static final String LINK = "link";
+
+ public static final String LINKS = "links";
+
+ public static final String TARGET = "target";
+
+ @Override
+ protected boolean shouldGenerateId() {
+ return true;
+ }
+
+ @Override
+ protected boolean shouldGenerateIdAsFallback() {
+ return true;
+ }
+
+ protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext context) {
+ assert element != null;
+ assert context != null;
+
+ new Builder(context).parseCommandBundle(element);
+ // We need to return a valid bean
+ BeanDefinitionBuilder dummy = BeanDefinitionBuilder.rootBeanDefinition(String.class);
+ return dummy.getBeanDefinition();
+ }
+
+ /**
+ * Helper to build plugin related bean definitions.
+ */
+ private class Builder
+ {
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private ParserContext context;
+
+ public Builder(final ParserContext context) {
+ assert context != null;
+
+ this.context = context;
+ }
+
+ private String resolveId(final Element element, final BeanDefinition def) throws BeanDefinitionStoreException {
+ assert element != null;
+ assert def != null;
+
+ if (shouldGenerateId()) {
+ return context.getReaderContext().generateBeanName(def);
+ }
+
+ String id = element.getAttribute(ID_ATTRIBUTE);
+
+ if (!StringUtils.hasText(id) && shouldGenerateIdAsFallback()) {
+ id = context.getReaderContext().generateBeanName(def);
+ }
+
+ return id;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private List<Element> getChildElements(final Element element, final String name) {
+ assert element != null;
+ assert name != null;
+
+ return DomUtils.getChildElementsByTagName(element, name);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private List<Element> getChildElements(final Element element, final String[] names) {
+ assert element != null;
+ assert names != null;
+
+ return DomUtils.getChildElementsByTagName(element, names);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private Element getChildElement(final Element element, final String name) {
+ assert element != null;
+ assert name != null;
+
+ List<Element> elements = DomUtils.getChildElementsByTagName(element, name);
+ if (elements != null && !elements.isEmpty()) {
+ return elements.get(0);
+ }
+ return null;
+ }
+
+ private BeanDefinitionParserDelegate createBeanDefinitionParserDelegate(final Element element) {
+ assert element != null;
+
+ BeanDefinitionParserDelegate parser = new BeanDefinitionParserDelegate(context.getReaderContext());
+ parser.initDefaults(element.getOwnerDocument().getDocumentElement());
+ return parser;
+ }
+
+ private BeanDefinitionHolder parseBeanDefinitionElement(final Element element) {
+ assert element != null;
+
+ BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(element);
+ return parser.parseBeanDefinitionElement(element);
+ }
+
+ private void parseAndApplyDescription(final Element element, final BeanDefinition def) {
+ assert element != null;
+ assert def != null;
+
+ Element desc = getChildElement(element, DESCRIPTION);
+ if (desc != null) {
+ if (def instanceof AbstractBeanDefinition) {
+ ((AbstractBeanDefinition)def).setDescription(desc.getTextContent());
+ }
+ }
+ }
+
+ private void parseAndApplyDescription(final Element element, final BeanDefinitionBuilder builder) {
+ assert element != null;
+ assert builder != null;
+
+ parseAndApplyDescription(element, builder.getRawBeanDefinition());
+ }
+
+ private BeanDefinitionHolder register(final BeanDefinitionHolder holder) {
+ assert holder != null;
+
+ registerBeanDefinition(holder, context.getRegistry());
+ return holder;
+ }
+
+ private BeanDefinitionHolder register(final BeanDefinition def, final String id) {
+ assert def != null;
+ assert id != null;
+
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
+ return register(holder);
+ }
+
+ //
+ // <gshell:command-bundle>
+ //
+
+ private void parseCommandBundle(final Element element) {
+ assert element != null;
+
+ log.trace("Parse command bundle; element; {}", element);
+
+ if (!context.getRegistry().containsBeanDefinition("$beanContainerAwareProcessor")) {
+ BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(BeanContainerAwareProcessor.class);
+ context.getRegistry().registerBeanDefinition("$beanContainerAwareProcessor", builder.getBeanDefinition());
+ }
+
+ parseCommands(element);
+ parseLinks(element);
+ parseAliases(element);
+ }
+
+ //
+ // <gshell:command>
+ //
+
+ private void parseCommands(final Element element) {
+ assert element != null;
+
+ log.trace("Parse commands; element; {}", element);
+
+ List<Element> children = getChildElements(element, COMMAND);
+ for (Element child : children) {
+ parseCommand(child);
+ }
+ }
+
+ private void parseCommand(final Element element) {
+ assert element != null;
+
+ log.trace("Parse command; element; {}", element);
+
+ BeanDefinitionBuilder command = BeanDefinitionBuilder.genericBeanDefinition(StatefulCommand.class);
+ parseAndApplyDescription(element, command);
+
+ Element child;
+
+ // Required children elements
+
+ String name = element.getAttribute(NAME);
+ BeanDefinition def = new GenericBeanDefinition();
+ def.setBeanClassName(CommandLocationImpl.class.getName());
+ def.getConstructorArgumentValues().addGenericArgumentValue(name);
+ command.addPropertyValue(LOCATION, def);
+
+ child = getChildElement(element, ACTION);
+ BeanDefinitionHolder action = parseCommandAction(child);
+ command.addPropertyValue(ACTION_ID, action.getBeanName());
+
+ // Optional children elements
+
+ child = getChildElement(element, DOCUMENTER);
+ if (child != null) {
+ BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
+ command.addPropertyValue(DOCUMENTER, holder.getBeanDefinition());
+ } else {
+ BeanDefinition documenter = new GenericBeanDefinition();
+ documenter.setBeanClassName("org.apache.geronimo.gshell.wisdom.command.MessageSourceCommandDocumenter");
+ command.addPropertyValue(DOCUMENTER, documenter);
+ }
+
+ child = getChildElement(element, COMPLETER);
+ if (child != null) {
+ BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
+ command.addPropertyValue(COMPLETER, holder.getBeanDefinition());
+ }
+
+ child = getChildElement(element, COMPLETERS);
+ if (child != null) {
+ BeanDefinitionBuilder completer = parseCommandCompleters(child);
+ command.addPropertyValue(COMPLETER, completer.getBeanDefinition());
+ }
+
+ child = getChildElement(element, MESSAGE_SOURCE);
+ if (child != null) {
+ BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
+ command.addPropertyValue(MESSAGES, holder.getBeanDefinition());
+ } else {
+ BeanDefinition msgSource = new GenericBeanDefinition();
+ msgSource.setBeanClassName("org.apache.geronimo.gshell.wisdom.command.CommandMessageSource");
+ command.addPropertyValue(MESSAGES, msgSource);
+ }
+
+ //String id = resolveId(element, command.getBeanDefinition());
+ //BeanDefinitionHolder holder = register(command.getBeanDefinition(), id);
+
+ BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
+ bd.addPropertyReference("bundleContext", "bundleContext");
+ bd.addPropertyValue("target", command.getBeanDefinition());
+ bd.addPropertyValue("interfaces", new Class[] { Command.class });
+ Map<String,String> props = new HashMap<String,String>();
+ props.put(OsgiCommandRegistry.NAME, name);
+ bd.addPropertyValue("serviceProperties", props);
+ BeanDefinition defSvc = bd.getBeanDefinition();
+ String id = context.getReaderContext().generateBeanName(defSvc);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
+ registerBeanDefinition(holder, context.getRegistry());
+ if (shouldFireEvents()) {
+ BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
+ postProcessComponentDefinition(componentDefinition);
+ context.registerComponent(componentDefinition);
+ }
+ }
+
+ //
+ // <gshell:completers>
+ //
+
+ private BeanDefinitionBuilder parseCommandCompleters(final Element element) {
+ assert element != null;
+
+ BeanDefinitionBuilder completer = BeanDefinitionBuilder.rootBeanDefinition(ConfigurableCommandCompleter.class);
+
+ ManagedList completers = new ManagedList();
+
+ List<Element> children = getChildElements(element, new String[] {BEAN, REF, NULL});
+
+ for (Element child : children) {
+ if (DomUtils.nodeNameEquals(child, BEAN)) {
+ BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
+ // noinspection unchecked
+ completers.add(holder.getBeanDefinition());
+ }
+ else if (DomUtils.nodeNameEquals(child, REF)) {
+ BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(child);
+ RuntimeBeanReference ref = (RuntimeBeanReference) parser.parsePropertySubElement(child, completer.getRawBeanDefinition());
+ // noinspection unchecked
+ completers.add(ref);
+ }
+ else if (DomUtils.nodeNameEquals(child, NULL)) {
+ // noinspection unchecked
+ completers.add(null);
+ }
+ }
+
+ completer.addConstructorArgValue(completers);
+
+ return completer;
+ }
+
+ //
+ // <gshell:action>
+ //
+
+ private BeanDefinitionHolder parseCommandAction(final Element element) {
+ assert element != null;
+
+ log.trace("Parse command action; element; {}", element);
+
+ // Construct the action
+ BeanDefinition action = parseBeanDefinitionElement(element).getBeanDefinition();
+
+ // All actions are configured as prototypes
+ action.setScope(PROTOTYPE);
+
+ // Generate id and register the bean
+ String id = resolveId(element, action);
+ return register(action, id);
+ }
+
+ //
+ // <gshell:link>
+ //
+
+ private void parseLinks(final Element element) {
+ assert element != null;
+
+ log.trace("Parse links; element; {}", element);
+
+ List<Element> children = getChildElements(element, LINK);
+
+ for (Element child : children) {
+ String name = child.getAttribute(NAME);
+ String target = child.getAttribute(TARGET);
+
+ BeanDefinitionBuilder link = BeanDefinitionBuilder.genericBeanDefinition(LinkImpl.class);
+ link.addConstructorArgValue(name);
+ link.addConstructorArgValue(target);
+
+ BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
+ bd.addPropertyReference("bundleContext", "bundleContext");
+ bd.addPropertyValue("target", link.getBeanDefinition());
+ bd.addPropertyValue("interfaces", new Class[] { Link.class });
+ BeanDefinition defSvc = bd.getBeanDefinition();
+ String id = context.getReaderContext().generateBeanName(defSvc);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
+ registerBeanDefinition(holder, context.getRegistry());
+ if (shouldFireEvents()) {
+ BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
+ postProcessComponentDefinition(componentDefinition);
+ context.registerComponent(componentDefinition);
+ }
+
+ }
+ }
+
+ //
+ // <gshell:alias>
+ //
+
+ private void parseAliases(final Element element) {
+ assert element != null;
+
+ log.trace("Parse aliases; element; {}", element);
+
+ List<Element> children = getChildElements(element, ALIAS);
+
+ for (Element child : children) {
+ String name = child.getAttribute(NAME);
+ String aliasValue = child.getAttribute(ALIAS);
+
+ BeanDefinitionBuilder alias = BeanDefinitionBuilder.genericBeanDefinition(AliasImpl.class);
+ alias.addConstructorArgValue(name);
+ alias.addConstructorArgValue(aliasValue);
+
+ BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
+ bd.addPropertyReference("bundleContext", "bundleContext");
+ bd.addPropertyValue("target", alias.getBeanDefinition());
+ bd.addPropertyValue("interfaces", new Class[] { Alias.class });
+ BeanDefinition defSvc = bd.getBeanDefinition();
+ String id = context.getReaderContext().generateBeanName(defSvc);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
+ registerBeanDefinition(holder, context.getRegistry());
+ if (shouldFireEvents()) {
+ BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
+ postProcessComponentDefinition(componentDefinition);
+ context.registerComponent(componentDefinition);
+ }
+
+ }
+ }
+ }
+ }
}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/FileSystemManagerFactory.java b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/FileSystemManagerFactory.java
new file mode 100644
index 0000000..8e3c884
--- /dev/null
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/FileSystemManagerFactory.java
@@ -0,0 +1,125 @@
+package org.apache.geronimo.gshell.vfs.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.commons.vfs.FilesCache;
+import org.apache.commons.vfs.CacheStrategy;
+import org.apache.commons.vfs.FileContentInfoFactory;
+import org.apache.commons.vfs.impl.DefaultFileReplicator;
+import org.apache.commons.vfs.impl.PrivilegedFileReplicator;
+import org.apache.commons.vfs.impl.FileContentInfoFilenameFactory;
+import org.apache.commons.vfs.cache.SoftRefFilesCache;
+import org.apache.commons.vfs.provider.FileReplicator;
+import org.apache.commons.vfs.provider.TemporaryFileStore;
+import org.apache.commons.vfs.provider.FileProvider;
+import org.apache.commons.vfs.provider.url.UrlFileProvider;
+
+/**
+ * Factory to construct a {@link org.apache.commons.vfs.FileSystemManager} instance.
+ *
+ * @version $Rev: 707031 $ $Date: 2008-10-22 13:08:07 +0200 (Wed, 22 Oct 2008) $
+ */
+public class FileSystemManagerFactory {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private FilesCache filesCache;
+
+ private CacheStrategy cacheStrategy = CacheStrategy.ON_RESOLVE;
+
+ private FileReplicator fileReplicator;
+
+ private TemporaryFileStore temporaryFileStore;
+
+ private FileContentInfoFactory fileContentInfoFactory;
+
+ private FileProvider defaultProvider;
+
+ // FileObjectDecorator (Class/Constructor of DecoratedFileObject? or make a factory?)
+
+ public void setFilesCache(final FilesCache cache) {
+ this.filesCache = cache;
+ }
+
+ public void setCacheStrategy(final CacheStrategy strategy) {
+ this.cacheStrategy = strategy;
+ }
+
+ public void setFileReplicator(final FileReplicator replicator) {
+ this.fileReplicator = replicator;
+ }
+
+ public void setTemporaryFileStore(final TemporaryFileStore store) {
+ this.temporaryFileStore = store;
+ }
+
+ public void setFileContentInfoFactory(final FileContentInfoFactory factory) {
+ this.fileContentInfoFactory = factory;
+ }
+
+ public void setDefaultProvider(final FileProvider provider) {
+ this.defaultProvider = provider;
+ }
+
+ public void init() {
+ if (filesCache == null) {
+ filesCache = new SoftRefFilesCache();
+ }
+
+ if (fileReplicator == null || temporaryFileStore == null) {
+ DefaultFileReplicator replicator = new DefaultFileReplicator();
+ if (fileReplicator == null) {
+ fileReplicator = new PrivilegedFileReplicator(replicator);
+ }
+ if (temporaryFileStore == null) {
+ temporaryFileStore = replicator;
+ }
+ }
+
+ if (fileContentInfoFactory == null) {
+ fileContentInfoFactory = new FileContentInfoFilenameFactory();
+ }
+
+ if (defaultProvider == null) {
+ defaultProvider = new UrlFileProvider();
+ }
+ }
+
+ //
+ // FactoryBean
+ //
+
+ public ConfigurableFileSystemManager getFileSystemManager() throws Exception {
+ ConfigurableFileSystemManager fsm = new ConfigurableFileSystemManager();
+
+ assert fileReplicator != null;
+ log.debug("File replicator: {}", fileReplicator);
+ fsm.setReplicator(fileReplicator);
+
+ assert temporaryFileStore != null;
+ log.debug("Temporary file store: {}", temporaryFileStore);
+ fsm.setTemporaryFileStore(temporaryFileStore);
+
+ assert filesCache != null;
+ log.debug("Files cache: {}", filesCache);
+ fsm.setFilesCache(filesCache);
+
+ assert cacheStrategy != null;
+ log.debug("Cache strategy: {}", cacheStrategy);
+ fsm.setCacheStrategy(cacheStrategy);
+
+ assert fileContentInfoFactory != null;
+ log.debug("File content info factory: {}", fileContentInfoFactory);
+ fsm.setFileContentInfoFactory(fileContentInfoFactory);
+
+ assert defaultProvider != null;
+ log.debug("Default provider: {}", defaultProvider);
+ fsm.setDefaultProvider(defaultProvider);
+
+ // Finally init the manager
+ fsm.init();
+
+ return fsm;
+ }
+
+}
diff --git a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
index c4fe003..4ed2f90 100644
--- a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
+++ b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
@@ -33,12 +33,6 @@
default-init-method="init"
default-destroy-method="destroy">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
- <bean id="vfsCommandActionTemplate" abstract="true">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </bean>
-
<gshell:command-bundle>
<gshell:command name="about">
<gshell:action class="org.apache.geronimo.gshell.commands.builtin.AboutAction">
@@ -73,7 +67,7 @@
<gshell:action class="org.apache.geronimo.gshell.commands.builtin.EchoAction"/>
</gshell:command>
- <gshell:command name="clear" type="stateless">
+ <gshell:command name="clear">
<gshell:action class="org.apache.geronimo.gshell.commands.builtin.ClearAction"/>
</gshell:command>
@@ -215,19 +209,25 @@
<gshell:command-bundle>
<gshell:command name="cd">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.ChangeDirectoryAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.ChangeDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<null/>
</gshell:completers>
</gshell:command>
- <gshell:command name="pwd" type="stateless">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.CurrentDirectoryAction" parent="vfsCommandActionTemplate"/>
+ <gshell:command name="pwd">
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.CurrentDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="ls">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.ListDirectoryAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.ListDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<null/>
@@ -237,7 +237,9 @@
<gshell:link name="dir" target="ls"/>
<gshell:command name="cp">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.CopyAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.CopyAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<ref bean="fileObjectNameCompleter"/>
@@ -248,7 +250,9 @@
<gshell:link name="copy" target="cp"/>
<gshell:command name="rm">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.RemoveAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.RemoveAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<null/>
@@ -258,7 +262,9 @@
<gshell:link name="del" target="rm"/>
<gshell:command name="fileinfo">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.FileInfoAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.FileInfoAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<null/>
@@ -266,7 +272,9 @@
</gshell:command>
<gshell:command name="touch">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.TouchAction" parent="vfsCommandActionTemplate"/>
+ <gshell:action class="org.apache.geronimo.gshell.commands.file.TouchAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </gshell:action>
<gshell:completers>
<ref bean="fileObjectNameCompleter"/>
<null/>
diff --git a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml
index 0f6dcd7..018b7d0 100644
--- a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml
+++ b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml
@@ -55,7 +55,7 @@
-->
<bean id="defaultFileReplicator" class="org.apache.commons.vfs.impl.DefaultFileReplicator"/>
- <bean id="fileSystemManager" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactoryBean">
+ <bean id="fileSystemManagerFactory" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactory">
<property name="filesCache">
<bean class="org.apache.commons.vfs.cache.SoftRefFilesCache"/>
</property>
@@ -83,6 +83,7 @@
<bean class="org.apache.commons.vfs.provider.url.UrlFileProvider"/>
</property>
</bean>
+ <bean id="fileSystemManager" factory-bean="fileSystemManagerFactory" factory-method="getFileSystemManager"/>
<bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
<property name="fileSystemManager" ref="fileSystemManager"/>
diff --git a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
index f2dbcf7..a56b742 100644
--- a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
+++ b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
@@ -56,7 +56,7 @@
<bean id="eventManager" class="org.apache.geronimo.gshell.event.EventManagerImpl"/>
- <bean id="applicationManager" class="org.apache.felix.karaf.gshell.core.ApplicationManagerImpl">
+ <bean id="applicationManager" class="org.apache.felix.karaf.gshell.core.ApplicationManagerImpl" init-method="init" destroy-method="destroy">
<constructor-arg ref="eventManager" />
<constructor-arg ref="application" />
</bean>
diff --git a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/commands.xml b/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/commands.xml
deleted file mode 100644
index f2330cb..0000000
--- a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/commands.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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">
-
- <bean class="org.apache.felix.karaf.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"/>
- </property>
-
- <property name="messages">
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandMessageSource"/>
- </property>
- </bean>
-
- <bean id="statefulCommandTemplate" class="org.apache.geronimo.gshell.wisdom.command.StatefulCommand" abstract="true">
- <property name="documenter">
- <bean class="org.apache.geronimo.gshell.wisdom.command.MessageSourceCommandDocumenter"/>
- </property>
-
- <property name="messages">
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandMessageSource"/>
- </property>
- </bean>
-
-</beans>
diff --git a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd b/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
index 612d59d..24fd718 100644
--- a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
+++ b/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
@@ -76,19 +76,6 @@
<xsd:element ref="message-source" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="type" use="optional" default="stateful">
- <xsd:annotation>
- <xsd:documentation>
- The command type.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="stateless"/>
- <xsd:enumeration value="stateful"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
</xsd:complexType>
</xsd:element>
diff --git a/karaf/gshell/gshell-core/src/test/java/org/apache/felix/karaf/gshell/core/Test.java b/karaf/gshell/gshell-core/src/test/java/org/apache/felix/karaf/gshell/core/Test.java
deleted file mode 100644
index ed1f4a9..0000000
--- a/karaf/gshell/gshell-core/src/test/java/org/apache/felix/karaf/gshell/core/Test.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.felix.karaf.gshell.core;
-
-import junit.framework.TestCase;
-import org.apache.geronimo.gshell.application.ApplicationManager;
-import org.apache.geronimo.gshell.shell.Shell;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class Test extends TestCase {
-
- public void test() throws Exception {
- System.setProperty("startLocalConsole", "true");
- System.setProperty("karaf.name", "root");
-
- ClassPathXmlApplicationContext context = null;
- try {
- context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml",
- "META-INF/spring/gshell-vfs.xml",
- "META-INF/spring/gshell-commands.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test.xml" });
- ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
- assertNotNull(appMgr);
- Shell shell = appMgr.create();
- assertNotNull(shell);
- shell.execute("help");
- } finally {
- if (context != null) {
- context.destroy();
- }
- }
- }
-
- public void testBanner() throws Exception {
- System.setProperty("startLocalConsole", "true");
- System.setProperty("karaf.name", "root");
-
- ClassPathXmlApplicationContext context = null;
- try {
- context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml",
- "META-INF/spring/gshell-vfs.xml",
- "META-INF/spring/gshell-commands.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test.xml"});
- ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
- assertNotNull(appMgr);
- Shell shell = appMgr.create();
- DefaultBranding branding = (DefaultBranding)appMgr.getApplication().getModel().getBranding();
- assertNotNull(branding.getWelcomeMessage());
- System.out.println(branding.getWelcomeMessage());
- assertNotNull(shell);
- shell.execute("about");
- } finally {
- if (context != null) {
- context.destroy();
- }
- }
- }
-
- public void testLs() throws Exception {
- System.setProperty("startLocalConsole", "true");
- System.setProperty("karaf.name", "root");
-
- ClassPathXmlApplicationContext context = null;
- try {
- context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml",
- "META-INF/spring/gshell-vfs.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test-commands.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test.xml"});
- ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
- assertNotNull(appMgr);
- Shell shell = appMgr.create();
- DefaultBranding branding = (DefaultBranding)appMgr.getApplication().getModel().getBranding();
- assertNotNull(branding.getWelcomeMessage());
- System.out.println(branding.getWelcomeMessage());
- assertNotNull(shell);
- shell.execute("vfs/ls meta:/commands/");
- } finally {
- if (context != null) {
- context.destroy();
- }
- }
- }
-
- public void testCommandGroups() throws Exception {
- System.setProperty("startLocalConsole", "true");
- System.setProperty("karaf.name", "root");
-
- ClassPathXmlApplicationContext context = null;
- try {
- context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml",
- "META-INF/spring/gshell-vfs.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test-commands.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test.xml"});
- ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
- assertNotNull(appMgr);
- Shell shell = appMgr.create();
- DefaultBranding branding = (DefaultBranding)appMgr.getApplication().getModel().getBranding();
- assertNotNull(branding.getWelcomeMessage());
- System.out.println(branding.getWelcomeMessage());
- assertNotNull(shell);
-
- shell.execute("vfs");
- shell.execute("help");
- shell.execute("..");
- } finally {
- if (context != null) {
- context.destroy();
- }
- }
- }
-
- public void testFileAccessCommands() throws Exception {
- System.setProperty("startLocalConsole", "true");
- System.setProperty("karaf.name", "root");
-
- ClassPathXmlApplicationContext context = null;
- try {
- context = new ClassPathXmlApplicationContext(
- new String[] { "META-INF/spring/gshell.xml",
- "META-INF/spring/gshell-vfs.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test-commands.xml",
- "org/apache/felix/karaf/gshell/core/gshell-test.xml"});
- ApplicationManager appMgr = (ApplicationManager) context.getBean("applicationManager");
- assertNotNull(appMgr);
- Shell shell = appMgr.create();
- assertNotNull(shell);
- shell.execute("optional/cat src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test.xml");
- shell.execute("optional/find src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test.xml");
- } finally {
- if (context != null) {
- context.destroy();
- }
- }
- }
-
-}
diff --git a/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test-commands.xml b/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test-commands.xml
deleted file mode 100644
index 2aa64a6..0000000
--- a/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test-commands.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?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"
- 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://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
- <bean id="vfsCommandActionTemplate" abstract="true">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </bean>
-
- <gshell:command-bundle>
- <gshell:command name="about">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.AboutAction">
- <constructor-arg ref="application"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:command name="help">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.HelpAction">
- <constructor-arg ref="commandResolver"/>
- </gshell:action>
- <gshell:completers>
- <bean class="org.apache.geronimo.gshell.console.completer.AggregateCompleter">
- <constructor-arg>
- <list>
- <ref bean="aliasNameCompleter"/>
- <ref bean="commandNameCompleter"/>
- </list>
- </constructor-arg>
- </bean>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="exit">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.ExitAction"/>
- </gshell:command>
-
- <gshell:link name="quit" target="exit"/>
-
- <gshell:command name="echo">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.EchoAction"/>
- </gshell:command>
-
- <gshell:command name="clear" type="stateless">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.ClearAction"/>
- </gshell:command>
-
- <gshell:command name="source">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.SourceAction">
- <constructor-arg ref="commandLineExecutor"/>
- <constructor-arg ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="set">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.SetAction"/>
- </gshell:command>
-
- <gshell:command name="unset">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.UnsetAction"/>
- <gshell:completers>
- <ref bean="variableNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="alias">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.AliasAction">
- <constructor-arg ref="aliasRegistry"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:command name="unalias">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.UnaliasAction">
- <constructor-arg ref="aliasRegistry"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="aliasNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="history">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.HistoryAction"/>
- </gshell:command>
-
- <gshell:command name="info">
- <gshell:action class="org.apache.felix.karaf.gshell.core.commands.InfoAction">
- <constructor-arg ref="branding" />
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="vfs/ls">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.ListDirectoryAction" parent="vfsCommandActionTemplate"/>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="optional/cat">
- <gshell:action class="org.apache.geronimo.gshell.commands.text.CatAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="optional/find">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.FindAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
- </gshell:command-bundle>
-
-</beans>
diff --git a/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test.xml b/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test.xml
deleted file mode 100644
index 250c47e..0000000
--- a/karaf/gshell/gshell-core/src/test/resources/org/apache/felix/karaf/gshell/core/gshell-test.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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"
- 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://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
-
-</beans>
diff --git a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
index a07fe61..90624b7 100644
--- a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
+++ b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
@@ -37,7 +37,7 @@
* for JMX management.
*/
@ManagedResource(description = "Features Service Registry and Management")
-public class ManagedFeaturesRegistry implements InitializingBean, FeaturesRegistry {
+public class ManagedFeaturesRegistry implements FeaturesRegistry {
private static final transient Log LOG = LogFactory.getLog(ManagedFeaturesRegistry.class);
@@ -175,7 +175,7 @@
}
}
- public void afterPropertiesSet() throws Exception {
+ public void init() throws Exception {
if (managementAgent == null) {
throw new IllegalArgumentException("managementAgent must not be null");
}
diff --git a/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml b/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
index 2f05dfe..22a4b95 100644
--- a/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
+++ b/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
@@ -38,42 +38,54 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${karaf.home}/etc/org.apache.servicemix.features.cfg"/>
</bean>
<gshell:command-bundle>
<gshell:command name="features/addUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.AddUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.AddUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="features/listUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="features/removeUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RemoveUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RemoveUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="removeUrlCompleter" />
</gshell:completers>
</gshell:command>
<gshell:command name="features/refreshUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RefreshUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RefreshUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="features/install">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.InstallFeatureCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.InstallFeatureCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="installFeatureCompleter" />
</gshell:completers>
</gshell:command>
<gshell:command name="features/uninstall">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.UninstallFeatureCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.UninstallFeatureCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
<gshell:completers>
<ref bean="uninstallFeatureCompleter" />
</gshell:completers>
</gshell:command>
<gshell:command name="features/list">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListFeaturesCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListFeaturesCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>
@@ -93,7 +105,7 @@
<property name="mbeanServer" ref="mbeanServer" />
</bean>
- <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry">
+ <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry" init-method="init">
<property name="managementAgent" ref="managementAgent" />
<property name="namingStrategy" ref="namingStrategy" />
<property name="featuresService" ref="featuresService" />
diff --git a/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml b/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
index 1d96be4..3e8c463 100644
--- a/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
+++ b/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
@@ -38,11 +38,10 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="log/display">
<gshell:action class="org.apache.felix.karaf.gshell.log.DisplayLog">
+ <property name="bundleContext" ref="bundleContext"/>
<property name="events" ref="events" />
<property name="pattern" value="${pattern}" />
</gshell:action>
@@ -50,15 +49,20 @@
<gshell:link name="log/d" target="log/display" />
<gshell:command name="log/display-exception">
<gshell:action class="org.apache.felix.karaf.gshell.log.DisplayException">
+ <property name="bundleContext" ref="bundleContext"/>
<property name="events" ref="events" />
</gshell:action>
</gshell:command>
<gshell:link name="log/de" target="log/display-exception" />
<gshell:command name="log/get">
- <gshell:action class="org.apache.felix.karaf.gshell.log.GetLogLevel" />
+ <gshell:action class="org.apache.felix.karaf.gshell.log.GetLogLevel">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="log/set">
- <gshell:action class="org.apache.felix.karaf.gshell.log.SetLogLevel" />
+ <gshell:action class="org.apache.felix.karaf.gshell.log.SetLogLevel">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:alias name="ld" alias="log/d" />
diff --git a/karaf/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml b/karaf/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml
index aafca70..956a98d 100644
--- a/karaf/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml
+++ b/karaf/gshell/gshell-obr/src/main/resources/META-INF/spring/gshell-obr.xml
@@ -35,35 +35,51 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="obr/addUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.AddUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.AddUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/deploy">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.DeployCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.DeployCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/info">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.InfoCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.InfoCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/list">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.ListCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.ListCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/listUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.ListUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.ListUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/removeUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.RemoveUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.RemoveUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/refreshUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.RefreshUrlCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.RefreshUrlCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/source">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.SourceCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.SourceCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="obr/start">
- <gshell:action class="org.apache.felix.karaf.gshell.obr.StartCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.obr.StartCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java
index 26fdb2b..e9bd409 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java
@@ -37,8 +37,7 @@
import org.springframework.osgi.service.importer.event.OsgiServiceDependencyWaitStartingEvent;
public class SpringApplicationListener implements OsgiBundleApplicationContextListener,
- BundleListener, BundleContextAware,
- InitializingBean, DisposableBean {
+ BundleListener {
public static enum SpringState {
Unknown,
@@ -92,7 +91,7 @@
this.bundleContext = bundleContext;
}
- public void afterPropertiesSet() throws Exception {
+ public void init() throws Exception {
bundleContext.addBundleListener(this);
}
diff --git a/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml b/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
index 5aa6d12..e035408 100644
--- a/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
+++ b/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
@@ -32,56 +32,83 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="osgi/bundle-level">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.BundleLevel" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.BundleLevel">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/headers">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.Headers" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.Headers">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/install">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.InstallBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.InstallBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/list">
<gshell:action class="org.apache.felix.karaf.gshell.osgi.ListBundles">
+ <property name="bundleContext" ref="bundleContext"/>
<property name="springApplicationListener" ref="springApplicationListener" />
</gshell:action>
</gshell:command>
<gshell:command name="osgi/ls">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.ListServices" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.ListServices">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/refresh">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/update">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/resolve">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/restart">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.RestartBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.RestartBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/shutdown">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.Shutdown" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.Shutdown">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/start">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/start-level">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartLevel" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartLevel">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/stop">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StopBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.StopBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="osgi/uninstall">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle" />
+ <gshell:action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>
- <bean id="springApplicationListener" class="org.apache.felix.karaf.gshell.osgi.SpringApplicationListener" />
+ <bean id="springApplicationListener" class="org.apache.felix.karaf.gshell.osgi.SpringApplicationListener" init-method="init" destroy-method="destroy">
+ <property name="bundleContext" ref="bundleContext"/>
+ </bean>
<osgi:service ref="springApplicationListener" interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener" />
diff --git a/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml b/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
index 5b3c92b..c0e9cc1 100644
--- a/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
+++ b/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
@@ -32,14 +32,16 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="packages/exports">
- <gshell:action class="org.apache.felix.karaf.gshell.packages.ExportsCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.packages.ExportsCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
<gshell:command name="packages/imports">
- <gshell:action class="org.apache.felix.karaf.gshell.packages.ImportsCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.packages.ImportsCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>
diff --git a/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml b/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml
index 02ad9a4..08c1ab1 100644
--- a/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml
+++ b/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml
@@ -32,11 +32,11 @@
http://servicemix.apache.org/schema/servicemix-gshell
http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
- <import resource="classpath:org/apache/felix/karaf/gshell/core/commands.xml" />
-
<gshell:command-bundle>
<gshell:command name="wrapper/install">
- <gshell:action class="org.apache.felix.karaf.gshell.wrapper.InstallCommand" />
+ <gshell:action class="org.apache.felix.karaf.gshell.wrapper.InstallCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </gshell:action>
</gshell:command>
</gshell:command-bundle>