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/03/26 16:55:51 UTC
svn commit: r641356 - in /geronimo/gshell/trunk: ./ gshell-assembly/
gshell-cli/ gshell-cli/src/main/resources/META-INF/plexus/
gshell-command-api/ gshell-commands/ gshell-commands/gshell-bsf/
gshell-commands/gshell-builtins/ gshell-core/ gshell-core/s...
Author: jdillon
Date: Wed Mar 26 08:55:46 2008
New Revision: 641356
URL: http://svn.apache.org/viewvc?rev=641356&view=rev
Log:
Upgrade to the latest plexus container (well latest -1 due to lack of sources published for latest)
Add dependencies on latest maven-artifact which will be used to support dynamic dependencies
Command components are now loaded and registered on-demand due to changes in the plexus containers ability to configure discovery components
Dropped usage of ${version} for dependencies
Modified:
geronimo/gshell/trunk/gshell-assembly/pom.xml
geronimo/gshell/trunk/gshell-cli/pom.xml
geronimo/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
geronimo/gshell/trunk/gshell-command-api/pom.xml
geronimo/gshell/trunk/gshell-commands/gshell-bsf/pom.xml
geronimo/gshell/trunk/gshell-commands/gshell-builtins/pom.xml
geronimo/gshell/trunk/gshell-commands/pom.xml
geronimo/gshell/trunk/gshell-core/pom.xml
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellLoader.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoveryListener.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/CommandRegistry.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
geronimo/gshell/trunk/gshell-embeddable/pom.xml
geronimo/gshell/trunk/gshell-maven-plugin/pom.xml
geronimo/gshell/trunk/gshell-remote/gshell-remote-client/pom.xml
geronimo/gshell/trunk/gshell-remote/gshell-remote-common/pom.xml
geronimo/gshell/trunk/gshell-remote/gshell-remote-server/pom.xml
geronimo/gshell/trunk/gshell-remote/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-ansi/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-clp/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-i18n/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-prefs/pom.xml
geronimo/gshell/trunk/gshell-whisper/pom.xml
geronimo/gshell/trunk/pom.xml
Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Wed Mar 26 08:55:46 2008
@@ -42,31 +42,26 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-bootstrap</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-embeddable</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-cli</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-optional</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-bsf</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
@@ -78,25 +73,21 @@
<dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-vfs</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-whisper</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.remote</groupId>
<artifactId>gshell-remote-client</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.remote</groupId>
<artifactId>gshell-remote-server</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
@@ -112,7 +103,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-diet-log4j</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-cli/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,13 +41,11 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-ansi</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml (original)
+++ geronimo/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml Wed Mar 26 08:55:46 2008
@@ -21,19 +21,6 @@
<!-- $Rev$ $Date$ -->
<plexus>
- <component-discoverer-manager implementation="org.codehaus.plexus.component.discovery.DefaultComponentDiscovererManager">
- <listeners>
- <listener implementation="org.codehaus.plexus.component.discovery.DiscoveryListenerDescriptor">
- <role>org.codehaus.plexus.component.discovery.ComponentDiscoveryListener</role>
- <role-hint>command</role-hint>
- </listener>
- </listeners>
-
- <component-discoverers>
- <component-discoverer implementation="org.apache.geronimo.gshell.plugin.CommandDiscoverer"/>
- </component-discoverers>
- </component-discoverer-manager>
-
<components>
<!--
Configure our logging component to be used so Plexus will pick it up.
@@ -45,35 +32,9 @@
</component>
<!--
- Configure the registry.
- -->
- <component>
- <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
- <role-hint>default</role-hint>
- <implementation>org.apache.geronimo.gshell.registry.DefaultCommandRegistry</implementation>
- </component>
-
- <!--
- Configure the discovery listener to register commands
- -->
- <component>
- <role>org.codehaus.plexus.component.discovery.ComponentDiscoveryListener</role>
- <role-hint>command</role-hint>
- <implementation>org.apache.geronimo.gshell.plugin.CommandDiscoveryListener</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.PlexusContainer</role>
- <field-name>container</field-name>
- </requirement>
- <requirement>
- <role>org.apache.geronimo.gshell.registry.CommandRegistry</role>
- <field-name>registry</field-name>
- </requirement>
- </requirements>
- </component>
-
- <!--
Add our instance lookup components.
+
+ TODO: Drop this and use the annotations to set factories.
-->
<component>
<role>org.apache.geronimo.gshell.command.IO</role>
Modified: geronimo/gshell/trunk/gshell-command-api/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-command-api/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-command-api/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-command-api/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,31 +41,26 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-common</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-ansi</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-i18n</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-clp</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-prefs</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-commands/gshell-bsf/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-bsf/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-bsf/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-bsf/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,13 +41,11 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-ansi</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-commands/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/pom.xml Wed Mar 26 08:55:46 2008
@@ -43,7 +43,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-command-api</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-core/pom.xml Wed Mar 26 08:55:46 2008
@@ -59,10 +59,10 @@
</dependency>
<dependency>
- <groupId>org.apache.maven</groupId>
+ <groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
</dependency>
-
+
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java Wed Mar 26 08:55:46 2008
@@ -26,10 +26,11 @@
import org.apache.geronimo.gshell.shell.Environment;
import org.apache.geronimo.gshell.shell.InteractiveShell;
import org.apache.geronimo.gshell.shell.ShellInfo;
+import org.apache.geronimo.gshell.plugin.CommandDiscoverer;
+import org.apache.geronimo.gshell.plugin.CommandDiscoveryListener;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
-import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,7 +49,7 @@
private final IO io;
- private final PlexusContainer container;
+ private final DefaultPlexusContainer container;
private final SecurityManager sm;
@@ -77,8 +78,11 @@
try {
ContainerConfiguration config = new DefaultContainerConfiguration();
- config.setName("gshell.core");
+ config.setName("gshell");
config.setClassWorld(classWorld);
+ config.addComponentDiscoverer(new CommandDiscoverer());
+ config.addComponentDiscoveryListener(new CommandDiscoveryListener());
+
container = new DefaultPlexusContainer(config);
//
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellLoader.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellLoader.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellLoader.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellLoader.java Wed Mar 26 08:55:46 2008
@@ -19,12 +19,123 @@
package org.apache.geronimo.gshell;
+import org.apache.geronimo.gshell.model.application.Application;
+import org.apache.geronimo.gshell.model.settings.Settings;
+import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.lookup.IOLookup;
+import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.shell.InteractiveShell;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
/**
- * ???
+ * Loads {@link GShell} instances.
*
* @version $Rev$ $Date$
*/
public class GShellLoader
{
- // TODO
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ private final ClassWorld classWorld;
+
+ private final IO io;
+
+ private final Environment environment;
+
+ private final SecurityManager securityManager;
+
+ private final PlexusContainer container;
+
+ private Application application;
+
+ private Settings settings;
+
+ public GShellLoader(final ClassWorld classWorld, final IO io) throws Exception {
+ assert classWorld != null;
+ assert io != null;
+
+ this.classWorld = classWorld;
+ this.io = io;
+ this.environment = new DefaultEnvironment(io);
+ this.securityManager = new ShellSecurityManager();
+
+ this.container = createContainer();
+
+ // Install IO and Environment lookups
+ IOLookup.set(container, io);
+ EnvironmentLookup.set(container, environment);
+ }
+
+ private PlexusContainer createContainer() throws Exception {
+ ContainerConfiguration config = new DefaultContainerConfiguration();
+ config.setName("gshell.core");
+ config.setClassWorld(classWorld);
+
+ return new DefaultPlexusContainer(config);
+ }
+
+ private ArtifactRepository createArtifactRepository() throws ComponentLookupException {
+ ArtifactRepositoryLayout repositoryLayout =
+ (ArtifactRepositoryLayout) container.lookup(ArtifactRepositoryLayout.ROLE, "default");
+
+ ArtifactRepositoryFactory artifactRepositoryFactory =
+ (ArtifactRepositoryFactory) container.lookup(ArtifactRepositoryFactory.ROLE);
+
+ String url = null; //settings.getLocalRepository();
+
+ if (!url.startsWith("file:")) {
+ url = "file://" + url;
+ }
+
+ ArtifactRepository localRepository = new DefaultArtifactRepository("local", url, repositoryLayout);
+
+ /*
+ boolean snapshotPolicySet = false;
+
+ if (commandLine.hasOption(CLIManager.OFFLINE)) {
+ settings.setOffline(true);
+
+ snapshotPolicySet = true;
+ }
+
+ if (!snapshotPolicySet && commandLine.hasOption(CLIManager.UPDATE_SNAPSHOTS)) {
+ artifactRepositoryFactory.setGlobalUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
+ }
+
+ if (commandLine.hasOption(CLIManager.CHECKSUM_FAILURE_POLICY)) {
+ System.out.println("+ Enabling strict checksum verification on all artifact downloads.");
+
+ artifactRepositoryFactory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL);
+ } else if (commandLine.hasOption(CLIManager.CHECKSUM_WARNING_POLICY)) {
+ System.out.println("+ Disabling strict checksum verification on all artifact downloads.");
+
+ artifactRepositoryFactory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
+ }
+ */
+
+ return localRepository;
+ }
+
+ //
+ // Loading
+ //
+
+ public GShell load() throws Exception {
+ InteractiveShell shell = (InteractiveShell) container.lookup(InteractiveShell.class);
+
+ return null;
+ }
}
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java Wed Mar 26 08:55:46 2008
@@ -23,9 +23,7 @@
import com.thoughtworks.xstream.XStreamException;
import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
-import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.discovery.AbstractComponentDiscoverer;
-import org.codehaus.plexus.component.discovery.ComponentDiscoverer;
import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.slf4j.Logger;
@@ -36,11 +34,12 @@
*
* @version $Rev$ $Date$
*/
-@Component(role=ComponentDiscoverer.class, hint="command")
public class CommandDiscoverer
extends AbstractComponentDiscoverer
{
private final Logger log = LoggerFactory.getLogger(getClass());
+
+ public CommandDiscoverer() {}
protected String getComponentDescriptorLocation() {
return "META-INF/gshell/commands.xml";
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoveryListener.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoveryListener.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoveryListener.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoveryListener.java Wed Mar 26 08:55:46 2008
@@ -21,40 +21,34 @@
import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
-import org.apache.geronimo.gshell.registry.CommandRegistry;
-import org.apache.geronimo.gshell.registry.DuplicateRegistrationException;
-import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Map;
+import java.util.HashMap;
+
/**
- * Registers commands with the registry as they are discovered by the container.
- *
+ * Maps command ids to command descriptors for just in time component initialization.
+ *
+ * This is not a typical Plexus component and can not have any requirements or custom configuration
+ * due to how the container hacks this puppy into existance. This component is bound to a role
+ * which is the same as its classname.
+ *
* @version $Rev$ $Date$
*/
-@Component(role=ComponentDiscoveryListener.class, hint="command")
+@Component(role=CommandDiscoveryListener.class)
public class CommandDiscoveryListener
implements ComponentDiscoveryListener
{
private final Logger log = LoggerFactory.getLogger(getClass());
- @Requirement
- private PlexusContainer container;
-
- @Requirement
- private CommandRegistry registry;
+ private Map<String,CommandDescriptor> descriptors = new HashMap<String,CommandDescriptor>();
public CommandDiscoveryListener() {}
-
- public CommandDiscoveryListener(final PlexusContainer container, final CommandRegistry registry) {
- this.container = container;
- this.registry = registry;
- }
public String getId() {
return getClass().getSimpleName();
@@ -71,13 +65,16 @@
CommandSetDescriptor commands = ((ComponentSetDescriptorAdapter)components).getCommands();
for (CommandDescriptor descriptor : commands.getCommands()) {
- try {
- registry.register(new PlexusCommandWrapper(container, descriptor));
- }
- catch (DuplicateRegistrationException e) {
- log.error("Failed to register command: " + descriptor, e);
- }
+ log.debug("Found: {}", descriptor);
+
+ descriptors.put(descriptor.getId(), descriptor);
}
}
+ }
+
+ public CommandDescriptor getCommandDescriptor(final String id) {
+ assert id != null;
+
+ return descriptors.get(id);
}
}
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/CommandRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/CommandRegistry.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/CommandRegistry.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/CommandRegistry.java Wed Mar 26 08:55:46 2008
@@ -30,11 +30,11 @@
*/
public interface CommandRegistry
{
- void register(Command command) throws DuplicateRegistrationException;
+ void register(Command command) throws RegistryException;
- void unregister(Command command) throws NotRegisteredException;
+ void unregister(Command command) throws RegistryException;
- Command lookup(String id) throws NotRegisteredException;
+ Command lookup(String id) throws RegistryException;
Collection<Command> commands();
}
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java Wed Mar 26 08:55:46 2008
@@ -25,7 +25,12 @@
import java.util.Map;
import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.plugin.CommandDiscoveryListener;
+import org.apache.geronimo.gshell.plugin.PlexusCommandWrapper;
+import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.PlexusContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,12 +39,18 @@
*
* @version $Rev$ $Date$
*/
-@Component(role=CommandRegistry.class, hint="default")
+@Component(role=CommandRegistry.class)
public class DefaultCommandRegistry
implements CommandRegistry
{
private final Logger log = LoggerFactory.getLogger(getClass());
+ @Requirement
+ private PlexusContainer container;
+
+ @Requirement
+ private CommandDiscoveryListener collector;
+
private Map<String, Command> commands = new HashMap<String, Command>();
public void register(final Command command) throws DuplicateRegistrationException {
@@ -55,15 +66,23 @@
log.debug("Registered: {}", id);
}
- private void ensureRegistered(final String id) throws NotRegisteredException {
+ private void ensureRegistered(final String id) throws RegistryException {
assert id != null;
if (!commands.containsKey(id)) {
- throw new NotRegisteredException(id);
+ CommandDescriptor descriptor = collector.getCommandDescriptor(id);
+
+ if (descriptor == null) {
+ throw new NotRegisteredException(id);
+ }
+
+ log.debug("Registering command id: {}", id);
+
+ register(new PlexusCommandWrapper(container, descriptor));
}
}
- public void unregister(final Command command) throws NotRegisteredException {
+ public void unregister(final Command command) throws RegistryException {
assert command != null;
String id = command.getId();
@@ -74,7 +93,7 @@
log.debug("Unregistered: {}", id);
}
- public Command lookup(final String id) throws NotRegisteredException {
+ public Command lookup(final String id) throws RegistryException {
assert id != null;
ensureRegistered(id);
Modified: geronimo/gshell/trunk/gshell-embeddable/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-embeddable/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-embeddable/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-embeddable/pom.xml Wed Mar 26 08:55:46 2008
@@ -82,11 +82,6 @@
<artifactSet>
<excludes>
<!--
- Exclude org.codehaus.plexus:plexus-component-api because plexus-container-default already includes it (lame)
- -->
- <exclude>org.codehaus.plexus:plexus-component-api</exclude>
-
- <!--
Exclude org.codehaus.plexus:plexus-classworlds because it will already be on our bootstrap classloader.
-->
<exclude>org.codehaus.plexus:plexus-classworlds</exclude>
Modified: geronimo/gshell/trunk/gshell-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-maven-plugin/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-maven-plugin/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-maven-plugin/pom.xml Wed Mar 26 08:55:46 2008
@@ -40,7 +40,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
@@ -63,7 +62,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
+ <artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,13 +41,11 @@
<dependency>
<groupId>org.apache.geronimo.gshell.remote</groupId>
<artifactId>gshell-remote-common</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-common/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-common/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-common/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-whisper</artifactId>
- <version>${version}</version>
</dependency>
<!--
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,13 +41,11 @@
<dependency>
<groupId>org.apache.geronimo.gshell.remote</groupId>
<artifactId>gshell-remote-common</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-remote/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/pom.xml Wed Mar 26 08:55:46 2008
@@ -43,7 +43,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
@@ -53,7 +52,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
+ <artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-support/gshell-ansi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ansi/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ansi/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-ansi/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-i18n</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-support/gshell-clp/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-clp/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-clp/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-clp/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-common</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-support/gshell-i18n/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-i18n/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-i18n/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-i18n/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-common</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-support/gshell-prefs/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-prefs/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-prefs/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-prefs/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-common</artifactId>
- <version>${version}</version>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/gshell-whisper/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-whisper/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-whisper/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-whisper/pom.xml Wed Mar 26 08:55:46 2008
@@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-common</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
@@ -51,7 +50,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
+ <artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
@@ -77,12 +76,6 @@
<dependency>
<groupId>commons-vfs</groupId>
<artifactId>commons-vfs</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <scope>test</scope>
</dependency>
</dependencies>
Modified: geronimo/gshell/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/pom.xml?rev=641356&r1=641355&r2=641356&view=diff
==============================================================================
--- geronimo/gshell/trunk/pom.xml (original)
+++ geronimo/gshell/trunk/pom.xml Wed Mar 26 08:55:46 2008
@@ -54,7 +54,31 @@
<artifactId>gshell-common</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-i18n</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-ansi</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-clp</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-prefs</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-command-api</artifactId>
@@ -78,13 +102,79 @@
<artifactId>gshell-core</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-bootstrap</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-embeddable</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-cli</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-whisper</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.remote</groupId>
+ <artifactId>gshell-remote-common</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.remote</groupId>
+ <artifactId>gshell-remote-client</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.remote</groupId>
+ <artifactId>gshell-remote-server</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-builtins</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.commands</groupId>
+ <artifactId>gshell-optional</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.commands</groupId>
+ <artifactId>gshell-bsf</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.commands</groupId>
+ <artifactId>gshell-vfs</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-diet-log4j</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -125,12 +215,6 @@
</dependency>
<dependency>
- <groupId>commons-vfs</groupId>
- <artifactId>commons-vfs</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<version>1.0-alpha-13</version>
@@ -142,16 +226,13 @@
<version>1.2-alpha-12</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- <version>1.0-alpha-32</version>
- </dependency>
-
+ <!--
+ NOTE: 1.0-alpha-44 does not have sources published, which is a huge PITA, so use the previous for now.
+ -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
- <version>1.0-alpha-32</version>
+ <version>1.0-alpha-43</version>
</dependency>
<dependency>
@@ -161,17 +242,23 @@
</dependency>
<dependency>
- <groupId>org.apache.maven</groupId>
+ <groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
- <version>2.0.8</version>
+ <version>3.0-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-runtime</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact-manager</artifactId>
- <version>2.0.8</version>
+ <groupId>commons-vfs</groupId>
+ <artifactId>commons-vfs</artifactId>
+ <version>1.0</version>
</dependency>
-
+
<dependency>
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>