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/12/17 10:41:17 UTC
svn commit: r727323 - in
/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main:
java/org/apache/servicemix/kernel/gshell/core/
java/org/apache/servicemix/kernel/gshell/core/config/
resources/META-INF/spring/
Author: gnodet
Date: Wed Dec 17 01:41:16 2008
New Revision: 727323
URL: http://svn.apache.org/viewvc?rev=727323&view=rev
Log:
Upgrade to latest gshell
Removed:
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/Alias.java
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/Link.java
Modified:
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/java/org/apache/servicemix/kernel/gshell/core/OsgiAliasRegistry.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/config/CommandParser.java
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-vfs.xml
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
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=727323&r1=727322&r2=727323&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 Wed Dec 17 01:41:16 2008
@@ -18,7 +18,6 @@
*/
package org.apache.servicemix.kernel.gshell.core;
-import java.util.Map;
import java.util.Dictionary;
import java.util.Properties;
import java.util.List;
@@ -27,19 +26,17 @@
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.context.ApplicationContextAware;
import org.springframework.context.ApplicationContext;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.Link;
+import org.apache.geronimo.gshell.command.Alias;
import org.apache.geronimo.gshell.registry.CommandRegistry;
import org.apache.geronimo.gshell.registry.AliasRegistry;
-import org.apache.geronimo.gshell.wisdom.command.CommandSupport;
import org.apache.geronimo.gshell.wisdom.command.LinkCommand;
import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
-import org.apache.geronimo.gshell.spring.BeanContainerAware;
-import org.apache.geronimo.gshell.spring.BeanContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,9 +52,9 @@
private List<Command> commands;
- private Map<String,String> links;
+ private List<Link> links;
- private Map<String,String> aliases;
+ private List<Alias> aliases;
private ApplicationContext applicationContext;
@@ -80,19 +77,21 @@
this.commands = commands;
}
- public Map<String, String> getLinks() {
+ public List<Link> getLinks() {
return links;
}
- public void setLinks(Map<String, String> links) {
+ public void setLinks(List<Link> links) {
+ assert links != null;
+
this.links = links;
}
- public Map<String, String> getAliases() {
+ public List<Alias> getAliases() {
return aliases;
}
- public void setAliases(final Map<String, String> aliases) {
+ public void setAliases(List<Alias> aliases) {
assert aliases != null;
this.aliases = aliases;
@@ -125,17 +124,17 @@
}
}
if (links != null) {
- for (String name : links.keySet()) {
- log.debug("Registering link: {}", name);
- LinkCommand link = new LinkCommand(commandRegistry, links.get(name));
- link.setLocation(new CommandLocationImpl(name));
- commandRegistry.registerCommand(link);
+ 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 (String name : aliases.keySet()) {
- log.debug("Registering alias: {}", name);
- aliasRegistry.registerAlias(name, aliases.get(name));
+ for (Alias alias : aliases) {
+ log.debug("Registering alias: {}", alias.getName());
+ aliasRegistry.registerAlias(alias.getName(), alias.getAlias());
}
}
} else if (bundleContext != null) {
@@ -149,21 +148,16 @@
}
}
if (links != null) {
- for (String name : links.keySet()) {
- log.debug("Registering link: {}", name);
- Dictionary props = new Properties();
- props.put(OsgiCommandRegistry.NAME, name);
- props.put(OsgiCommandRegistry.TARGET, links.get(name));
- registrations.add(bundleContext.registerService(Link.class.getName(), new Link() {}, props));
+ for (Link link : links) {
+ log.debug("Registering link: {}", link.getName());
+ registrations.add(bundleContext.registerService(Link.class.getName(), link, new Properties()));
}
}
if (aliases != null) {
- for (String name : aliases.keySet()) {
- log.debug("Registering alias: {}", name);
+ for (Alias alias : aliases) {
+ log.debug("Registering alias: {}", alias.getName());
Dictionary props = new Properties();
- props.put(OsgiAliasRegistry.NAME, name);
- props.put(OsgiAliasRegistry.ALIAS, aliases.get(name));
- registrations.add(bundleContext.registerService(Alias.class.getName(), new Alias() {}, props));
+ registrations.add(bundleContext.registerService(Alias.class.getName(), alias, new Properties()));
}
}
} else {
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiAliasRegistry.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiAliasRegistry.java?rev=727323&r1=727322&r2=727323&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiAliasRegistry.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiAliasRegistry.java Wed Dec 17 01:41:16 2008
@@ -21,6 +21,7 @@
import java.util.Map;
import org.apache.geronimo.gshell.registry.AliasRegistry;
+import org.apache.geronimo.gshell.command.Alias;
public class OsgiAliasRegistry {
@@ -34,11 +35,11 @@
}
public void register(final Alias alias, Map<String, ?> properties) throws Exception {
- aliasRegistry.registerAlias((String) properties.get(NAME), (String) properties.get(ALIAS));
+ aliasRegistry.registerAlias(alias.getName(), alias.getAlias());
}
public void unregister(final Alias alias, Map<String, ?> properties) throws Exception {
- aliasRegistry.removeAlias((String) properties.get(NAME));
+ aliasRegistry.removeAlias(alias.getName());
}
}
Modified: 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=727323&r1=727322&r2=727323&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/OsgiCommandRegistry.java Wed Dec 17 01:41:16 2008
@@ -21,11 +21,10 @@
import java.util.Map;
import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.command.CommandResult;
+import org.apache.geronimo.gshell.command.Link;
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.apache.geronimo.gshell.shell.ShellContext;
public class OsgiCommandRegistry {
@@ -47,13 +46,13 @@
}
public void register(final Link link, Map<String, ?> properties) throws Exception {
- LinkCommand cmd = new LinkCommand(commandRegistry, (String) properties.get(TARGET));
- cmd.setLocation(new CommandLocationImpl((String) properties.get(NAME)));
+ LinkCommand cmd = new LinkCommand(commandRegistry, link.getTarget());
+ cmd.setLocation(new CommandLocationImpl(link.getName()));
commandRegistry.registerCommand(cmd);
}
public void unregister(final Link link, Map<String, ?> properties) throws Exception {
- commandRegistry.removeCommand(commandRegistry.getCommand((String) properties.get(NAME)));
+ commandRegistry.removeCommand(commandRegistry.getCommand(link.getName()));
}
}
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/config/CommandParser.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/config/CommandParser.java?rev=727323&r1=727322&r2=727323&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/config/CommandParser.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/config/CommandParser.java Wed Dec 17 01:41:16 2008
@@ -42,7 +42,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.registry.CommandLocationImpl;
+import org.apache.geronimo.gshell.command.Link;
+import org.apache.geronimo.gshell.command.Alias;
import org.apache.servicemix.kernel.gshell.core.CommandBundle;
public class CommandParser extends AbstractBeanDefinitionParser {
@@ -278,16 +282,15 @@
//
ManagedList commands = new ManagedList();
-
commands.addAll(parseCommands(element));
bundle.addPropertyValue(COMMANDS, commands);
- ManagedMap links = new ManagedMap();
- links.putAll(parseLinks(element));
+ ManagedList links = new ManagedList();
+ links.addAll(parseLinks(element));
bundle.addPropertyValue(LINKS, links);
- ManagedMap aliases = new ManagedMap();
- aliases.putAll(parseAliases(element));
+ ManagedList aliases = new ManagedList();
+ aliases.addAll(parseAliases(element));
bundle.addPropertyValue(ALIASES, aliases);
return bundle;
@@ -429,12 +432,12 @@
// <gshell:link>
//
- private Map<String,String> parseLinks(final Element element) {
+ private List<Link> parseLinks(final Element element) {
assert element != null;
log.trace("Parse links; element; {}", element);
- Map<String,String> links = new LinkedHashMap<String,String>();
+ List<Link> links = new ArrayList<Link>();
List<Element> children = getChildElements(element, LINK);
@@ -442,7 +445,7 @@
String name = child.getAttribute(NAME);
String target = child.getAttribute(TARGET);
- links.put(name, target);
+ links.add(new LinkImpl(name, target));
}
return links;
@@ -452,12 +455,12 @@
// <gshell:alias>
//
- private Map<String,String> parseAliases(final Element element) {
+ private List<Alias> parseAliases(final Element element) {
assert element != null;
log.trace("Parse aliases; element; {}", element);
- Map<String,String> aliases = new LinkedHashMap<String,String>();
+ List<Alias> aliases = new ArrayList<Alias>();
List<Element> children = getChildElements(element, ALIAS);
@@ -465,7 +468,7 @@
String name = child.getAttribute(NAME);
String alias = child.getAttribute(ALIAS);
- aliases.put(name, alias);
+ aliases.add(new AliasImpl(name, alias));
}
return aliases;
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=727323&r1=727322&r2=727323&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 Wed Dec 17 01:41:16 2008
@@ -48,11 +48,11 @@
<osgi:listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister" />
</osgi:list>
- <osgi:list id="osgiLinkCommands" interface="org.apache.servicemix.kernel.gshell.core.Link" cardinality="0..N">
+ <osgi:list id="osgiLinkCommands" interface="org.apache.geronimo.gshell.command.Link" cardinality="0..N">
<osgi:listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister" />
</osgi:list>
- <osgi:list id="osgiAliases" interface="org.apache.servicemix.kernel.gshell.core.Alias" cardinality="0..N">
+ <osgi:list id="osgiAliases" interface="org.apache.geronimo.gshell.command.Alias" cardinality="0..N">
<osgi:listener ref="osgiAliasRegistry" bind-method="register" unbind-method="unregister" />
</osgi:list>
Modified: 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=727323&r1=727322&r2=727323&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-vfs.xml Wed Dec 17 01:41:16 2008
@@ -33,7 +33,6 @@
default-destroy-method="destroy">
<bean id="fileSystemAccess" class="org.apache.geronimo.gshell.vfs.FileSystemAccessImpl">
- <constructor-arg ref="applicationManager"/>
<constructor-arg ref="fileSystemManager"/>
</bean>
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=727323&r1=727322&r2=727323&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 Wed Dec 17 01:41:16 2008
@@ -45,7 +45,7 @@
<property name="model">
<bean class="org.apache.geronimo.gshell.application.model.ApplicationModel">
<!-- TODO: fix version -->
- <property name="version" value="1.0.0"/>
+ <property name="version" value="1.1.0"/>
<property name="branding" ref="branding"/>
</bean>
</property>
@@ -149,9 +149,7 @@
<constructor-arg ref="commandRegistry"/>
</bean>
- <bean id="variableNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.VariableNameCompleter"
- lazy-init="true">
- <constructor-arg ref="applicationManager"/>
+ <bean id="variableNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.VariableNameCompleter" lazy-init="true">
</bean>
</beans>
\ No newline at end of file