You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/09/17 11:02:26 UTC
svn commit: r696206 - in /geronimo/gshell/trunk:
gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/
gshell-model/src/main/java/org/apache/geronimo/gshell/model/
gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ g...
Author: jdillon
Date: Wed Sep 17 02:02:20 2008
New Revision: 696206
URL: http://svn.apache.org/viewvc?rev=696206&view=rev
Log:
Starting to add support for aliases and groups
Refactored the model slightly to make artifact grouping muck sharable
Refactored plugin loading muck to use a Plugin component to handle activation of bundles of commands, pending richer activation rule muck
Added:
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java (contents, props changed)
- copied, changed from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Dependency.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java (contents, props changed)
- copied, changed from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java (contents, props changed)
- copied, changed from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java (contents, props changed)
- copied, changed from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java (with props)
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java (contents, props changed)
- copied, changed from r695399, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java (with props)
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java (with props)
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java (with props)
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java (with props)
Removed:
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Dependency.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
Modified:
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Element.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Plugin.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/PluginGroup.java
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java
geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml Wed Sep 17 02:02:20 2008
@@ -29,59 +29,91 @@
<context:annotation-config/>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:clear"/>
-
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.ClearCommand"/>
+ <!--
+ <bean id="commandTemplate" abstract="true" class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="documenter">
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandDocumenterImpl"/>
</property>
- </bean>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:echo"/>
+ <property name="completer">
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandCompleterImpl"/>
+ </property>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.EchoCommand"/>
+ <property name="messages">
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandMessageSource"/>
</property>
</bean>
+ -->
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:exit"/>
+ <bean class="org.apache.geronimo.gshell.wisdom.plugin.PluginImpl">
+ <property name="id" value="gshell-bultins"/>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.ExitCommand"/>
- </property>
+ <!-- Plugin MetaData -->
+
+ <!-- Activation Rules -->
</bean>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:help"/>
+ <bean class="org.apache.geronimo.gshell.wisdom.plugin.CommandBundle" lazy-init="true">
+ <property name="id" value="default"/>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.HelpCommand"/>
- </property>
- </bean>
+ <property name="commands">
+ <list>
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:clear"/>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:set"/>
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.ClearCommand"/>
+ </property>
+ </bean>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.SetCommand"/>
- </property>
- </bean>
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:echo"/>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:source"/>
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.EchoCommand"/>
+ </property>
+ </bean>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.SourceCommand"/>
- </property>
- </bean>
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:exit"/>
+
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.ExitCommand"/>
+ </property>
+ </bean>
+
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:help"/>
+
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.HelpCommand"/>
+ </property>
+ </bean>
+
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:set"/>
+
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.SetCommand"/>
+ </property>
+ </bean>
+
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:source"/>
+
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.SourceCommand"/>
+ </property>
+ </bean>
- <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
- <property name="id" value="gshell-builtins:unset"/>
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="gshell-builtins:unset"/>
- <property name="action">
- <bean class="org.apache.geronimo.gshell.commands.builtins.UnsetCommand"/>
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.UnsetCommand"/>
+ </property>
+ </bean>
+ </list>
</property>
</bean>
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Element.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Element.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Element.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Element.java Wed Sep 17 02:02:20 2008
@@ -29,7 +29,6 @@
*/
public abstract class Element
{
- @Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java Wed Sep 17 02:02:20 2008
@@ -20,8 +20,8 @@
package org.apache.geronimo.gshell.model.application;
import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.Dependency;
-import org.apache.geronimo.gshell.model.common.DependencyGroup;
+import org.apache.geronimo.gshell.model.application.Dependency;
+import org.apache.geronimo.gshell.model.application.DependencyGroup;
import org.apache.geronimo.gshell.model.common.DescriptorSupport;
import org.apache.geronimo.gshell.model.common.LocalRepository;
import org.apache.geronimo.gshell.model.common.RemoteRepository;
Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java (from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Dependency.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Dependency.java&r1=695399&r2=696206&rev=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Dependency.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java Wed Sep 17 02:02:20 2008
@@ -17,9 +17,10 @@
* under the License.
*/
-package org.apache.geronimo.gshell.model.common;
+package org.apache.geronimo.gshell.model.application;
import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.model.common.Artifact;
/**
* Dependency artifact configuration.
@@ -32,74 +33,14 @@
{
public static final String DEFAULT_TYPE = "jar";
- private transient DependencyGroup dependencyGroup;
-
- public DependencyGroup getDependencyGroup() {
- return dependencyGroup;
- }
-
- public void setDependencyGroup(final DependencyGroup group) {
- this.dependencyGroup = group;
- }
-
- // Return configuration detals from the group if not directly configured
-
- @Override
- public String getGroupId() {
- String tmp = super.getGroupId();
-
- if (tmp == null && dependencyGroup != null) {
- tmp = dependencyGroup.getGroupId();
- }
-
- return tmp;
- }
-
- @Override
- public String getArtifactId() {
- String tmp = super.getArtifactId();
-
- if (tmp == null && dependencyGroup != null) {
- tmp = dependencyGroup.getArtifactId();
- }
-
- return tmp;
- }
-
- @Override
- public String getClassifier() {
- String tmp = super.getClassifier();
-
- if (tmp == null && dependencyGroup != null) {
- tmp = dependencyGroup.getClassifier();
- }
-
- return tmp;
- }
-
@Override
public String getType() {
String tmp = super.getType();
- if (tmp == null && dependencyGroup != null) {
- tmp = dependencyGroup.getType();
- }
-
if (tmp == null) {
tmp = DEFAULT_TYPE;
}
return tmp;
}
-
- @Override
- public String getVersion() {
- String tmp = super.getVersion();
-
- if (tmp == null && dependencyGroup != null) {
- tmp = dependencyGroup.getVersion();
- }
-
- return tmp;
- }
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Dependency.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java (from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java&r1=695399&r2=696206&rev=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java Wed Sep 17 02:02:20 2008
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.geronimo.gshell.model.common;
+package org.apache.geronimo.gshell.model.application;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
@@ -25,51 +25,29 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.geronimo.gshell.model.common.ArtifactGroup;
+
/**
- * Groups dependency elements to allow artifact configuration to be shared.
+ * Groups {@link Dependency} elements to allow artifact configuration to be shared.
*
* @version $Rev$ $Date$
*/
@XStreamAlias("dependencyGroup")
public class DependencyGroup
- extends Artifact
+ extends ArtifactGroup<Dependency>
{
@XStreamImplicit
private List<Dependency> dependencies;
- public List<Dependency> getDependencies() {
+ public List<Dependency> getArtifacts() {
if (dependencies == null) {
dependencies = new ArrayList<Dependency>();
}
return dependencies;
}
-
- public void add(final Dependency dependency) {
- assert dependency != null;
-
- getDependencies().add(dependency);
- }
-
- public int size() {
- return getDependencies().size();
- }
-
- public boolean isEmpty() {
- return getDependencies().isEmpty();
- }
- /**
- * Link children to their parent group when deserializing.
- */
- @SuppressWarnings({"UnusedDeclaration"})
- private Object readResolve() {
- if (!isEmpty()) {
- for (Dependency child : getDependencies()) {
- child.setDependencyGroup(this);
- }
- }
-
- return this;
+ public List<Dependency> getDependencies() {
+ return getArtifacts();
}
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/DependencyGroup.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Plugin.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Plugin.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Plugin.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Plugin.java Wed Sep 17 02:02:20 2008
@@ -33,74 +33,14 @@
{
public static final String DEFAULT_TYPE = "jar";
- private transient PluginGroup pluginGroup;
-
- public PluginGroup getPluginGroup() {
- return pluginGroup;
- }
-
- public void setPluginGroup(final PluginGroup group) {
- this.pluginGroup = group;
- }
-
- // Return configuration detals from the group if not directly configured
-
- @Override
- public String getGroupId() {
- String tmp = super.getGroupId();
-
- if (tmp == null && pluginGroup != null) {
- tmp = pluginGroup.getGroupId();
- }
-
- return tmp;
- }
-
- @Override
- public String getArtifactId() {
- String tmp = super.getArtifactId();
-
- if (tmp == null && pluginGroup != null) {
- tmp = pluginGroup.getArtifactId();
- }
-
- return tmp;
- }
-
- @Override
- public String getClassifier() {
- String tmp = super.getClassifier();
-
- if (tmp == null && pluginGroup != null) {
- tmp = pluginGroup.getClassifier();
- }
-
- return tmp;
- }
-
@Override
public String getType() {
String tmp = super.getType();
- if (tmp == null && pluginGroup != null) {
- tmp = pluginGroup.getType();
- }
-
if (tmp == null) {
tmp = DEFAULT_TYPE;
}
return tmp;
}
-
- @Override
- public String getVersion() {
- String tmp = super.getVersion();
-
- if (tmp == null && pluginGroup != null) {
- tmp = pluginGroup.getVersion();
- }
-
- return tmp;
- }
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/PluginGroup.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/PluginGroup.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/PluginGroup.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/PluginGroup.java Wed Sep 17 02:02:20 2008
@@ -21,25 +21,24 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
+import org.apache.geronimo.gshell.model.common.ArtifactGroup;
import java.util.ArrayList;
import java.util.List;
-import org.apache.geronimo.gshell.model.common.Artifact;
-
/**
- * Groups plugin elements to allow artifact configuration to be shared.
+ * Groups {@link Plugin} elements to allow artifact configuration to be shared.
*
* @version $Rev$ $Date$
*/
@XStreamAlias("pluginGroup")
public class PluginGroup
- extends Artifact
+ extends ArtifactGroup<Plugin>
{
@XStreamImplicit
private List<Plugin> plugins;
- public List<Plugin> getPlugins() {
+ public List<Plugin> getArtifacts() {
if (plugins == null) {
plugins = new ArrayList<Plugin>();
}
@@ -47,31 +46,7 @@
return plugins;
}
- public void add(final Plugin plugin) {
- assert plugin != null;
-
- getPlugins().add(plugin);
- }
-
- public int size() {
- return getPlugins().size();
- }
-
- public boolean isEmpty() {
- return getPlugins().isEmpty();
- }
-
- /**
- * Link children to their parent group when deserializing.
- */
- @SuppressWarnings({"UnusedDeclaration"})
- private Object readResolve() {
- if (!isEmpty()) {
- for (Plugin child : getPlugins()) {
- child.setPluginGroup(this);
- }
- }
-
- return this;
+ public List<Plugin> getPlugins() {
+ return getArtifacts();
}
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java Wed Sep 17 02:02:20 2008
@@ -19,69 +19,79 @@
package org.apache.geronimo.gshell.model.common;
-import org.apache.geronimo.gshell.model.Element;
+import com.thoughtworks.xstream.annotations.XStreamOmitField;
/**
* Defines an artifact (groupId, artifactId, version, etc).
*
* @version $Rev$ $Date$
*/
-public abstract class Artifact
- extends Element
+public class Artifact
+ extends ArtifactSupport
{
- private String groupId;
+ @XStreamOmitField
+ private ArtifactGroup artifactGroup;
- private String artifactId;
-
- private String classifier;
-
- private String type;
-
- private String version;
+ public ArtifactGroup getArtifactGroup() {
+ return artifactGroup;
+ }
- // TODO: optional? Any other stuff?
+ public void setArtifactGroup(final ArtifactGroup artifactGroup) {
+ this.artifactGroup = artifactGroup;
+ }
+ @Override
public String getGroupId() {
- return groupId;
- }
+ String tmp = super.getGroupId();
- public void setGroupId(final String groupId) {
- this.groupId = groupId;
+ if (tmp == null && artifactGroup != null) {
+ tmp = artifactGroup.getGroupId();
+ }
+
+ return tmp;
}
+ @Override
public String getArtifactId() {
- return artifactId;
- }
+ String tmp = super.getArtifactId();
- public void setArtifactId(final String artifactId) {
- this.artifactId = artifactId;
+ if (tmp == null && artifactGroup != null) {
+ tmp = artifactGroup.getArtifactId();
+ }
+
+ return tmp;
}
+ @Override
public String getClassifier() {
- return classifier;
- }
+ String tmp = super.getClassifier();
- public void setClassifier(final String classifier) {
- this.classifier = classifier;
+ if (tmp == null && artifactGroup != null) {
+ tmp = artifactGroup.getClassifier();
+ }
+
+ return tmp;
}
+ @Override
public String getType() {
- return type;
- }
+ String tmp = super.getType();
- public void setType(final String type) {
- this.type = type;
+ if (tmp == null && artifactGroup != null) {
+ tmp = artifactGroup.getType();
+ }
+
+ return tmp;
}
+ @Override
public String getVersion() {
- return version;
- }
+ String tmp = super.getVersion();
- public void setVersion(final String version) {
- this.version = version;
- }
+ if (tmp == null && artifactGroup != null) {
+ tmp = artifactGroup.getVersion();
+ }
- public String getId() {
- return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" + getType();
+ return tmp;
}
}
\ No newline at end of file
Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java (from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java&r1=695399&r2=696206&rev=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java Wed Sep 17 02:02:20 2008
@@ -19,44 +19,30 @@
package org.apache.geronimo.gshell.model.common;
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-
-import java.util.ArrayList;
import java.util.List;
/**
- * Groups dependency elements to allow artifact configuration to be shared.
+ * Support for {@link Artifact} groups.
*
* @version $Rev$ $Date$
*/
-@XStreamAlias("dependencyGroup")
-public class DependencyGroup
- extends Artifact
+public abstract class ArtifactGroup<T extends Artifact>
+ extends ArtifactSupport
{
- @XStreamImplicit
- private List<Dependency> dependencies;
+ public abstract List<T> getArtifacts();
- public List<Dependency> getDependencies() {
- if (dependencies == null) {
- dependencies = new ArrayList<Dependency>();
- }
+ public void add(final T artifact) {
+ assert artifact != null;
- return dependencies;
- }
-
- public void add(final Dependency dependency) {
- assert dependency != null;
-
- getDependencies().add(dependency);
+ getArtifacts().add(artifact);
}
public int size() {
- return getDependencies().size();
+ return getArtifacts().size();
}
-
+
public boolean isEmpty() {
- return getDependencies().isEmpty();
+ return getArtifacts().isEmpty();
}
/**
@@ -65,8 +51,8 @@
@SuppressWarnings({"UnusedDeclaration"})
private Object readResolve() {
if (!isEmpty()) {
- for (Dependency child : getDependencies()) {
- child.setDependencyGroup(this);
+ for (Artifact child : getArtifacts()) {
+ child.setArtifactGroup(this);
}
}
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactGroup.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java (from r695399, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java&r1=695399&r2=696206&rev=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java Wed Sep 17 02:02:20 2008
@@ -26,7 +26,7 @@
*
* @version $Rev$ $Date$
*/
-public abstract class Artifact
+public abstract class ArtifactSupport
extends Element
{
private String groupId;
@@ -39,8 +39,6 @@
private String version;
- // TODO: optional? Any other stuff?
-
public String getGroupId() {
return groupId;
}
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ArtifactSupport.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java Wed Sep 17 02:02:20 2008
@@ -20,8 +20,8 @@
package org.apache.geronimo.gshell.model.application;
import junit.framework.TestCase;
-import org.apache.geronimo.gshell.model.common.Dependency;
-import org.apache.geronimo.gshell.model.common.DependencyGroup;
+import org.apache.geronimo.gshell.model.application.Dependency;
+import org.apache.geronimo.gshell.model.application.DependencyGroup;
import org.apache.geronimo.gshell.model.common.RemoteRepository;
import java.net.URL;
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java Wed Sep 17 02:02:20 2008
@@ -48,7 +48,7 @@
//
@PostConstruct
- public void init() throws Exception {
+ private void init() throws Exception {
DefaultContainerConfiguration config = new DefaultContainerConfiguration();
// When running under ClassWorlds already, then set the containers realm to the current realm
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Wed Sep 17 02:02:20 2008
@@ -29,7 +29,7 @@
import org.apache.geronimo.gshell.event.EventPublisher;
import org.apache.geronimo.gshell.io.IO;
import org.apache.geronimo.gshell.model.application.ApplicationModel;
-import org.apache.geronimo.gshell.model.common.Dependency;
+import org.apache.geronimo.gshell.model.application.Dependency;
import org.apache.geronimo.gshell.model.common.LocalRepository;
import org.apache.geronimo.gshell.model.common.RemoteRepository;
import org.apache.geronimo.gshell.model.interpolate.Interpolator;
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java?rev=696206&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java Wed Sep 17 02:02:20 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.command;
+
+import org.apache.geronimo.gshell.command.CommandResult;
+import org.apache.geronimo.gshell.command.Variables;
+import org.apache.geronimo.gshell.io.IO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class AliasContainerImpl
+ extends CommandContainerSupport
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @PostConstruct
+ private void init() {
+ // TODO: setup action, documenter, completer, messages
+ }
+
+ public CommandResult execute(final Object[] args, final IO io, final Variables variables) {
+ return null;
+ }
+}
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasContainerImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java Wed Sep 17 02:02:20 2008
@@ -23,22 +23,17 @@
import org.apache.geronimo.gshell.clp.Option;
import org.apache.geronimo.gshell.command.Arguments;
import org.apache.geronimo.gshell.command.CommandAction;
-import org.apache.geronimo.gshell.command.CommandCompleter;
import org.apache.geronimo.gshell.command.CommandContainer;
-import org.apache.geronimo.gshell.command.CommandContainerAware;
-import org.apache.geronimo.gshell.command.CommandContainerRegistry;
import org.apache.geronimo.gshell.command.CommandContext;
import org.apache.geronimo.gshell.command.CommandDocumenter;
import org.apache.geronimo.gshell.command.CommandResult;
import org.apache.geronimo.gshell.command.Variables;
-import org.apache.geronimo.gshell.i18n.MessageSource;
import org.apache.geronimo.gshell.i18n.ResourceBundleMessageSource;
import org.apache.geronimo.gshell.io.IO;
import org.apache.geronimo.gshell.notification.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
@@ -48,107 +43,27 @@
* @version $Rev$ $Date$
*/
public class CommandContainerImpl
- implements CommandContainer
+ extends CommandContainerSupport
{
private final Logger log = LoggerFactory.getLogger(getClass());
- @Autowired
- private CommandContainerRegistry registry;
-
- private String id;
-
- private CommandAction action;
-
- private CommandDocumenter documenter;
-
- private CommandCompleter completer;
-
- private MessageSource messages;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- assert id != null;
-
- this.id = id;
- }
-
- public CommandAction getAction() {
- return action;
- }
-
- public void setAction(final CommandAction action) {
- assert action != null;
-
- this.action = action;
- }
-
- public CommandDocumenter getDocumenter() {
- return documenter;
- }
-
- public void setDocumenter(final CommandDocumenter documenter) {
- assert documenter != null;
-
- this.documenter = documenter;
- }
-
- public CommandCompleter getCompleter() {
- return completer;
- }
-
- public void setCompleter(final CommandCompleter completer) {
- assert completer != null;
-
- this.completer = completer;
- }
-
- public MessageSource getMessages() {
- return messages;
- }
-
- public void setMessages(final MessageSource messages) {
- assert messages != null;
-
- this.messages = messages;
- }
-
@PostConstruct
- public void init() {
- // Validate properties
- assert registry != null;
- assert id != null;
- assert action != null;
-
+ private void init() {
+ //
+ // TODO: Should ask the container to auto-wire these folks, or ask for defalut versions from the container via factory?
+ // or simply use a parent bean to configure them?
+ //
+
// Create default components if not configured
- if (documenter == null) {
+ if (getDocumenter() == null) {
setDocumenter(new CommandDocumenterImpl());
}
- if (completer == null) {
+ if (getCompleter() == null) {
setCompleter(new CommandCompleterImpl());
}
- if (messages == null) {
- setMessages(new ResourceBundleMessageSource(action.getClass()));
+ if (getMessages() == null) {
+ setMessages(new ResourceBundleMessageSource(getAction().getClass()));
}
-
- // Inject ourself into CommandContainerAware instances
- Object[] children = {
- action,
- documenter,
- completer,
- messages,
- };
-
- for (Object child : children) {
- if (child instanceof CommandContainerAware) {
- ((CommandContainerAware)child).setCommandContainer(this);
- }
- }
-
- // Register ourselves
- registry.register(this);
}
public CommandResult execute(final Object[] args, final IO io, final Variables variables) {
@@ -156,10 +71,10 @@
assert io != null;
assert variables != null;
- log.trace("Executing; context={}");
+ log.trace("Executing");
// Provide logging context for the command execution
- MDC.put("command-id", id);
+ MDC.put("command-id", getId());
CommandResult result;
Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java (from r695399, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java&r1=695399&r2=696206&rev=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java Wed Sep 17 02:02:20 2008
@@ -43,17 +43,14 @@
import javax.annotation.PostConstruct;
/**
- * The default {@link CommandContainer} component.
+ * Provides support for {@link CommandContainer} implementations.
*
* @version $Rev$ $Date$
*/
-public class CommandContainerImpl
+public abstract class CommandContainerSupport
implements CommandContainer
{
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- @Autowired
- private CommandContainerRegistry registry;
+ protected final Logger log = LoggerFactory.getLogger(getClass());
private String id;
@@ -81,7 +78,9 @@
public void setAction(final CommandAction action) {
assert action != null;
-
+
+ handleCommandContainerAware(action);
+
this.action = action;
}
@@ -92,6 +91,8 @@
public void setDocumenter(final CommandDocumenter documenter) {
assert documenter != null;
+ handleCommandContainerAware(documenter);
+
this.documenter = documenter;
}
@@ -101,7 +102,9 @@
public void setCompleter(final CommandCompleter completer) {
assert completer != null;
-
+
+ handleCommandContainerAware(completer);
+
this.completer = completer;
}
@@ -112,165 +115,16 @@
public void setMessages(final MessageSource messages) {
assert messages != null;
- this.messages = messages;
- }
+ handleCommandContainerAware(messages);
- @PostConstruct
- public void init() {
- // Validate properties
- assert registry != null;
- assert id != null;
- assert action != null;
-
- // Create default components if not configured
- if (documenter == null) {
- setDocumenter(new CommandDocumenterImpl());
- }
- if (completer == null) {
- setCompleter(new CommandCompleterImpl());
- }
- if (messages == null) {
- setMessages(new ResourceBundleMessageSource(action.getClass()));
- }
-
- // Inject ourself into CommandContainerAware instances
- Object[] children = {
- action,
- documenter,
- completer,
- messages,
- };
-
- for (Object child : children) {
- if (child instanceof CommandContainerAware) {
- ((CommandContainerAware)child).setCommandContainer(this);
- }
- }
-
- // Register ourselves
- registry.register(this);
- }
-
- public CommandResult execute(final Object[] args, final IO io, final Variables variables) {
- assert args != null;
- assert io != null;
- assert variables != null;
-
- log.trace("Executing; context={}");
-
- // Provide logging context for the command execution
- MDC.put("command-id", id);
-
- CommandResult result;
-
- try {
- CommandAction action = getAction();
-
- // Setup the command action
- try {
- // Process command line options/arguments
- if (processArguments(io, action, args)) {
- // return if we have been asked to display --help
- return new CommandResult(CommandAction.Result.SUCCESS);
- }
-
- // TODO: Add preferences processor
- }
- catch (Exception e) {
- return new CommandResult(e);
- }
-
- // Setup the command context
- CommandContext context = new CommandContext()
- {
- public Object[] getArguments() {
- return args;
- }
-
- public IO getIo() {
- return io;
- }
-
- public Variables getVariables() {
- return variables;
- }
-
- public CommandContainer getContainer() {
- return CommandContainerImpl.this;
- }
- };
-
- // Execute the action
- try {
- log.trace("Executing action: {}", action);
-
- Object value = action.execute(context);
-
- log.trace("Result: {}", value);
-
- result = new CommandResult(value);
- }
- catch (final Notification n) {
- log.trace("Notified: {}, n");
-
- result = new CommandResult(n);
- }
- catch (final Throwable t) {
- log.trace("Caught: {}", t);
-
- result = new CommandResult(t);
- }
- }
- finally {
- MDC.remove("command-id");
- }
-
- return result;
+ this.messages = messages;
}
- private boolean processArguments(final IO io, final CommandAction action, final Object[] args) throws Exception {
- assert io != null;
- assert action != null;
- assert args != null;
-
- if (log.isTraceEnabled()) {
- log.trace("Processing arguments: {}", Arguments.toStringArray(args));
- }
-
- CommandLineProcessor clp = new CommandLineProcessor();
- clp.addBean(action);
+ protected void handleCommandContainerAware(final Object target) {
+ assert target != null;
- // Attach some help context
- CommandDocumenter documenter = getDocumenter();
- clp.addBean(documenter);
-
- HelpSupport help = new HelpSupport();
- clp.addBean(help);
-
- // Process the arguments
- clp.process(Arguments.toStringArray(args));
-
- // Render command-line usage
- if (help.displayHelp) {
- log.trace("Render command-line usage");
-
- documenter.renderUsage(io.out);
- return true;
+ if (target instanceof CommandContainerAware) {
+ ((CommandContainerAware)target).setCommandContainer(this);
}
-
- return false;
- }
-
- /**
- * Helper to inject <tt>--help<tt> support. Package access to allow CommandDocumentorImpl access.
- */
- static class HelpSupport
- {
- //
- // TODO: Need to get this description into an i18n message source
- //
-
- @Option(name="-h", aliases={"--help"}, description="Display this help message", requireOverride=true)
- public boolean displayHelp;
}
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerSupport.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java?rev=696206&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java Wed Sep 17 02:02:20 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.command;
+
+import org.apache.geronimo.gshell.command.CommandResult;
+import org.apache.geronimo.gshell.command.Variables;
+import org.apache.geronimo.gshell.io.IO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class GroupContainerImpl
+ extends CommandContainerSupport
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @PostConstruct
+ private void init() {
+ // TODO: setup action, documenter, completer, messages
+ }
+
+ public CommandResult execute(final Object[] args, final IO io, final Variables variables) {
+ return null;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/GroupContainerImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java?rev=696206&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java Wed Sep 17 02:02:20 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.plugin;
+
+import org.apache.geronimo.gshell.command.CommandContainer;
+
+import java.util.List;
+
+/**
+ * A bundle of {@link CommandContainer} instances.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CommandBundle
+{
+ private String id;
+
+ private List<CommandContainer> commands;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ assert id != null;
+
+ this.id = id;
+ }
+
+ public List<CommandContainer> getCommands() {
+ return commands;
+ }
+
+ public void setCommands(final List<CommandContainer> commands) {
+ assert commands != null;
+
+ this.commands = commands;
+ }
+
+ public int size() {
+ return commands != null ? commands.size() : 0;
+ }
+
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/CommandBundle.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java?rev=696206&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java Wed Sep 17 02:02:20 2008
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.plugin;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Plugin
+{
+ String getId();
+
+ // TODO: Expose configured bundle names
+
+ void activate();
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/Plugin.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java?rev=696206&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java Wed Sep 17 02:02:20 2008
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.plugin;
+
+import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.command.CommandContainer;
+import org.apache.geronimo.gshell.command.CommandContainerRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Map;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class PluginImpl
+ implements Plugin, BeanContainerAware
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private CommandContainerRegistry commandRegistry;
+
+ private BeanContainer container;
+
+ private String id;
+
+ public void setBeanContainer(final BeanContainer container) {
+ assert container != null;
+
+ this.container = container;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ assert id != null;
+
+ this.id = id;
+ }
+
+ public void activate() {
+ log.debug("Activating");
+
+ //
+ // TODO: Create activate rules and execute them here.
+ //
+
+ assert container != null;
+ Map<String, CommandBundle> bundles = container.getBeans(CommandBundle.class);
+
+ log.debug("Discovered {} command bundles", bundles.size());
+
+ for (CommandBundle bundle : bundles.values()) {
+ log.debug("Processing command bundle: {}", bundle.getId());
+
+ if (!bundle.isEmpty()) {
+ log.debug("Discovered {} commands in bundle {}", bundle.size(), bundle.getId());
+
+ for (CommandContainer command : bundle.getCommands()) {
+ commandRegistry.register(command);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java Wed Sep 17 02:02:20 2008
@@ -22,10 +22,10 @@
import org.apache.geronimo.gshell.application.Application;
import org.apache.geronimo.gshell.application.plugin.PluginManager;
import org.apache.geronimo.gshell.artifact.ArtifactManager;
-import org.apache.geronimo.gshell.event.EventPublisher;
-import org.apache.geronimo.gshell.event.EventManager;
-import org.apache.geronimo.gshell.event.EventListener;
import org.apache.geronimo.gshell.event.Event;
+import org.apache.geronimo.gshell.event.EventListener;
+import org.apache.geronimo.gshell.event.EventManager;
+import org.apache.geronimo.gshell.event.EventPublisher;
import org.apache.geronimo.gshell.model.application.Plugin;
import org.apache.geronimo.gshell.spring.BeanContainer;
import org.apache.geronimo.gshell.spring.BeanContainerAware;
@@ -77,7 +77,8 @@
}
@PostConstruct
- public void init() {
+ private void init() {
+ assert eventManager != null;
eventManager.addListener(new EventListener() {
public void onEvent(Event event) throws Exception {
assert event != null;
@@ -118,6 +119,18 @@
BeanContainer pluginContainer = container.createChild("gshell.plugin[" + plugin.getId() + "]", classPath);
log.debug("Created plugin container: {}", pluginContainer);
+
+ // TODO: Refactor to avoid needing this FQCN
+
+ org.apache.geronimo.gshell.wisdom.plugin.Plugin _plugin = pluginContainer.getBean(org.apache.geronimo.gshell.wisdom.plugin.Plugin.class);
+
+ // TODO: Track _plugin
+
+ log.debug("Activating plugin: {}", _plugin.getId());
+
+ _plugin.activate();
+
+ // TODO: Publish the _plugin
eventPublisher.publish(new PluginLoadedEvent(plugin));
}
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java Wed Sep 17 02:02:20 2008
@@ -46,7 +46,7 @@
private EventManager eventManager;
@PostConstruct
- public void init() {
+ private void init() {
eventManager.addListener(new EventListener() {
public void onEvent(Event event) throws Exception {
assert event != null;
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java Wed Sep 17 02:02:20 2008
@@ -102,7 +102,7 @@
}
@PostConstruct
- public void init() {
+ private void init() {
eventManager.addListener(new EventListener() {
public void onEvent(Event event) throws Exception {
assert event != null;
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java?rev=696206&r1=696205&r2=696206&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java Wed Sep 17 02:02:20 2008
@@ -66,7 +66,7 @@
}
@PostConstruct
- public void init() {
+ private void init() {
homeDir = detectHomeDir();
log.debug("Using home directory: {}", homeDir);