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 2007/09/04 06:21:22 UTC
svn commit: r572508 - in /geronimo/sandbox/gshell/trunk:
gshell-assembly/src/main/assembly/ gshell-assembly/src/main/config/
gshell-assembly/src/main/scripts/ gshell-assembly/src/main/underlay/
gshell-assembly/src/main/underlay/bin/ gshell-assembly/src...
Author: jdillon
Date: Mon Sep 3 21:21:20 2007
New Revision: 572508
URL: http://svn.apache.org/viewvc?rev=572508&view=rev
Log:
Hook up a plexus config to control the main cli app
Add the start of custom plugin descriptor muck
Update the assembly to use src/main/underlay for resource root
Hook up minimal configuration for the LayoutManager and setup the basic layout, pending more work to hook up though
Added:
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh (props changed)
- copied unchanged from r572186, geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/scripts/gsh
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh.bat (props changed)
- copied unchanged from r572186, geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/scripts/gsh.bat
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf (props changed)
- copied unchanged from r572186, geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/config/gsh-classworlds.conf
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties (props changed)
- copied unchanged from r572186, geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/config/gsh-log4j.properties
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh.properties (props changed)
- copied unchanged from r572186, geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/config/gsh.properties
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml (with props)
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java (with props)
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java (with props)
Removed:
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/config/
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/scripts/
Modified:
geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml
geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/Shell.java
geronimo/sandbox/gshell/trunk/gshell-layout/pom.xml
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Alias.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Command.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Group.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java
geronimo/sandbox/gshell/trunk/gshell-layout/src/main/resources/META-INF/plexus/components.xml
geronimo/sandbox/gshell/trunk/gshell-layout/src/test/java/org/apache/geronimo/gshell/layout/model/BasicModelValidationTest.java
Modified: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml Mon Sep 3 21:21:20 2007
@@ -38,7 +38,7 @@
</fileSet>
<fileSet>
- <directory>src/main/scripts</directory>
+ <directory>src/main/underlay/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>gsh.bat</include>
@@ -47,7 +47,7 @@
</fileSet>
<fileSet>
- <directory>src/main/scripts</directory>
+ <directory>src/main/underlay/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>gsh</include>
@@ -57,7 +57,7 @@
</fileSet>
<fileSet>
- <directory>src/main/config</directory>
+ <directory>src/main/underlay/etc</directory>
<outputDirectory>etc</outputDirectory>
</fileSet>
</fileSets>
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh.bat
------------------------------------------------------------------------------
svn:eol-style = CRLF
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh.bat
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/bin/gsh.bat
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml?rev=572508&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml (added)
+++ geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml Mon Sep 3 21:21:20 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<layout>
+ <name>/</name>
+
+ <nodes>
+ <command>
+ <name>help</name>
+ <implementation>org.apache.geronimo.gshell.commands.buildins.HelpCommand</implementation>
+ </command>
+
+ <alias>
+ <name>?</name>
+ <command>/help</command>
+ </alias>
+ </nodes>
+</layout>
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java Mon Sep 3 21:21:20 2007
@@ -19,6 +19,8 @@
package org.apache.geronimo.gshell.cli;
+import java.io.File;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -72,9 +74,6 @@
watch.start();
}
- private void setConsoleLogLevel(final String level) {
- System.setProperty("gshell.log.console.level", level);
- }
@Option(name="-h", aliases={"--help"}, description="Display this help message")
private boolean help;
@@ -84,6 +83,10 @@
@Option(name="-i", aliases={"--interactive"}, description="Run in interactive mode")
private boolean interactive = true;
+
+ private void setConsoleLogLevel(final String level) {
+ System.setProperty("gshell.log.console.level", level);
+ }
@Option(name="-d", aliases={"--debug"}, description="Enable DEBUG logging output")
private void setDebug(boolean flag) {
Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml Mon Sep 3 21:21:20 2007
@@ -21,22 +21,43 @@
<!-- $Rev$ $Date$ -->
<plexus>
- <!--
- <components>
- <component>
- <role>org.apache.geronimo.gshell.Shell</role>
- <implementation>org.apache.geronimo.gshell.Shell</implementation>
- </component>
+ <component-discoverer-manager implementation="org.codehaus.plexus.component.discovery.DefaultComponentDiscovererManager">
+ <listeners>
+ <listener implementation="org.codehaus.plexus.component.discovery.DiscoveryListenerDescriptor">
+ <role>org.apache.geronimo.gshell.GShellPluginCollector</role>
+ </listener>
+ </listeners>
+ <component-discoverers>
+ <component-discoverer implementation="org.apache.geronimo.gshell.GShellPluginDiscoverer"/>
+ </component-discoverers>
+ </component-discoverer-manager>
+
+ <components>
<component>
- <role>org.apache.geronimo.gshell.command.CommandManager</role>
- <implementation>org.apache.geronimo.gshell.command.CommandManagerImpl</implementation>
+ <role>org.apache.geronimo.gshell.GShellPluginCollector</role>
+ <implementation>org.apache.geronimo.gshell.GShellPluginCollector</implementation>
</component>
<component>
- <role>org.apache.geronimo.gshell.CommandLineBuilder</role>
- <implementation>org.apache.geronimo.gshell.CommandLineBuilder</implementation>
+ <role>org.apache.geronimo.gshell.layout.XMLLayoutLoader</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.geronimo.gshell.layout.XMLLayoutLoader</implementation>
+ <instantiation-strategy>singleton</instantiation-strategy>
+ <lifecycle-handler>plexus</lifecycle-handler>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gshell.parser.CommandLineParser</role>
+ <field-name>parser</field-name>
+ </requirement>
+ </requirements>
+ <configuration>
+ <url>file://${gshell.home}/etc/layout.xml</url>
+ </configuration>
</component>
</components>
- -->
</plexus>
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java?rev=572508&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java Mon Sep 3 21:21:20 2007
@@ -0,0 +1,125 @@
+/*
+ * 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;
+
+import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
+import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class GShellPluginCollector
+ implements ComponentDiscoveryListener
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /*
+ private Set pluginsInProcess = new HashSet();
+
+ private Map pluginDescriptors = new HashMap();
+
+ private Map pluginIdsByPrefix = new HashMap();
+
+ // ----------------------------------------------------------------------
+ // Mojo discovery
+ // ----------------------------------------------------------------------
+
+ public void componentDiscovered( ComponentDiscoveryEvent event )
+ {
+ ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
+
+ if ( componentSetDescriptor instanceof PluginDescriptor )
+ {
+ PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
+
+ // TODO: see comment in getPluginDescriptor
+ String key = Plugin.constructKey( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId() );
+
+ if ( !pluginsInProcess.contains( key ) )
+ {
+ pluginsInProcess.add( key );
+
+ getLogger().debug( this + ": Discovered plugin: " + key );
+
+ pluginDescriptors.put( key, pluginDescriptor );
+
+ // TODO: throw an (not runtime) exception if there is a prefix overlap - means doing so elsewhere
+ // we also need to deal with multiple versions somehow - currently, first wins
+ if ( !pluginIdsByPrefix.containsKey( pluginDescriptor.getGoalPrefix() ) )
+ {
+ pluginIdsByPrefix.put( pluginDescriptor.getGoalPrefix(), pluginDescriptor );
+ }
+ }
+ }
+ }
+
+ public String getId()
+ {
+ return "maven-plugin-collector";
+ }
+
+ public PluginDescriptor getPluginDescriptor( Plugin plugin )
+ {
+ // TODO: include version, but can't do this in the plugin manager as it is not resolved to the right version
+ // at that point. Instead, move the duplication check to the artifact container, or store it locally based on
+ // the unresolved version?
+ return (PluginDescriptor) pluginDescriptors.get( plugin.getKey() );
+ }
+
+ public boolean isPluginInstalled( Plugin plugin )
+ {
+ // TODO: see comment in getPluginDescriptor
+ return pluginDescriptors.containsKey( plugin.getKey() );
+ }
+
+ public PluginDescriptor getPluginDescriptorForPrefix( String prefix )
+ {
+ return (PluginDescriptor) pluginIdsByPrefix.get( prefix );
+ }
+
+ public void flushPluginDescriptor( Plugin plugin )
+ {
+ pluginsInProcess.remove( plugin.getKey() );
+ pluginDescriptors.remove( plugin.getKey() );
+
+ for ( Iterator it = pluginIdsByPrefix.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+
+ if ( plugin.getKey().equals( entry.getValue() ) )
+ {
+ it.remove();
+ }
+ }
+ }
+ */
+
+ public void componentDiscovered(ComponentDiscoveryEvent event) {
+ // TODOD:
+ }
+
+ public String getId() {
+ return "gshell-plugin-collector";
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginCollector.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java?rev=572508&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java Mon Sep 3 21:21:20 2007
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.io.Reader;
+
+import org.codehaus.plexus.component.discovery.DefaultComponentDiscoverer;
+import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class GShellPluginDiscoverer
+ extends DefaultComponentDiscoverer// AbstractComponentDiscoverer
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /*
+ private PluginDescriptorBuilder builder;
+
+ public MavenPluginDiscoverer()
+ {
+ builder = new PluginDescriptorBuilder();
+ }
+
+ public String getComponentDescriptorLocation()
+ {
+ return "META-INF/maven/plugin.xml";
+ }
+
+ public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorConfiguration, String source )
+ throws PlexusConfigurationException
+ {
+ return builder.build( componentDescriptorConfiguration, source );
+ }
+ */
+
+ /*
+ protected String getComponentDescriptorLocation() {
+ return null;
+ }
+
+ protected ComponentSetDescriptor createComponentDescriptors(Reader reader, String source) throws PlexusConfigurationException {
+ return null;
+ }
+ */
+
+ /*
+ This is the default bits...
+
+ public String getComponentDescriptorLocation()
+ {
+ return "META-INF/plexus/components.xml";
+ }
+
+ public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorReader, String source )
+ throws PlexusConfigurationException
+ {
+ PlexusConfiguration componentDescriptorConfiguration = PlexusTools.buildConfiguration( source, componentDescriptorReader );
+
+ ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();
+
+ List componentDescriptors = new ArrayList();
+
+ PlexusConfiguration[] componentConfigurations =
+ componentDescriptorConfiguration.getChild( "components" ).getChildren( "component" );
+
+ for ( int i = 0; i < componentConfigurations.length; i++ )
+ {
+ PlexusConfiguration componentConfiguration = componentConfigurations[i];
+
+ ComponentDescriptor componentDescriptor;
+
+ try
+ {
+ componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
+ }
+ catch ( PlexusConfigurationException e )
+ {
+ throw new PlexusConfigurationException( "Cannot process component descriptor: " + source, e );
+ }
+
+ componentDescriptor.setSource( source );
+ componentDescriptor.setComponentType( "plexus" );
+
+ componentDescriptors.add( componentDescriptor );
+ }
+
+ componentSetDescriptor.setComponents( componentDescriptors );
+
+ // TODO: read and store the dependencies
+
+ return componentSetDescriptor;
+ }
+ */
+}
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellPluginDiscoverer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/Shell.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/Shell.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/Shell.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/Shell.java Mon Sep 3 21:21:20 2007
@@ -30,6 +30,8 @@
import org.apache.geronimo.gshell.layout.LayoutManager;
import org.apache.geronimo.gshell.util.Arguments;
import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,6 +42,7 @@
*/
// @Component(role = Shell.class)
public class Shell
+ implements Initializable
{
private Logger log = LoggerFactory.getLogger(getClass());
@@ -86,6 +89,16 @@
public CommandManager getCommandManager() {
return commandManager;
+ }
+
+ public void initialize() throws InitializationException {
+ // Dump some debug to crapski
+ if (log.isDebugEnabled()) {
+ log.debug("Container: {}", container);
+ log.debug("Layout manager: {}", layoutManager);
+ log.debug("Command manager: {}", commandManager);
+ log.debug("Builder: {}", commandLineBuilder);
+ }
}
public Object execute(final String commandLine) throws Exception {
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/pom.xml?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/pom.xml Mon Sep 3 21:21:20 2007
@@ -43,23 +43,16 @@
<artifactId>gshell-api</artifactId>
<version>${pom.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
+ <artifactId>plexus-container-default</artifactId>
</dependency>
-
+
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>
-
- <!--
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- -->
<dependency>
<groupId>junit</groupId>
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java Mon Sep 3 21:21:20 2007
@@ -19,11 +19,20 @@
package org.apache.geronimo.gshell.layout;
+import org.apache.geronimo.gshell.layout.model.Layout;
+
/**
- * ???
+ * Provies the shell with a simple mechanism to organize commands.
*
* @version $Rev$ $Date$
*/
public interface LayoutManager
{
+ Layout getLayout();
+
+ //
+ // TODO: Add lookup() command, to find a suitable command to execute from the layout.
+ // Need to have the Command's context/env passed in to query the current location
+ // as well as any additional search path muck
+ //
}
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java Mon Sep 3 21:21:20 2007
@@ -19,10 +19,21 @@
package org.apache.geronimo.gshell.layout;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.annotations.Annotations;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+import org.apache.geronimo.gshell.layout.model.Alias;
+import org.apache.geronimo.gshell.layout.model.Command;
+import org.apache.geronimo.gshell.layout.model.Layout;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,6 +42,7 @@
*
* @version $Rev$ $Date$
*/
+// @Component(role = LayoutManager.class)
public class LayoutManagerImpl
implements LayoutManager, Initializable
{
@@ -39,9 +51,62 @@
// @Requirement
private PlexusContainer container;
+ private Layout layout;
+
public void initialize() throws InitializationException {
//
- // TODO: Load up the model... from configuration
+ // HACK: For now just hard code it... Really need to expose a helper object to find the Shell's basic directory config muck
//
+
+ String homePath = System.getProperty("gshell.home");
+ if (homePath == null) {
+ throw new InitializationException("The 'gsell.home' property must be set for the shell to function correctly");
+ }
+
+ File homeDir = new File(homePath);
+ URL url = null;
+ try {
+ url = new File(homeDir, "etc/layout.xml").toURI().toURL();
+ } catch (MalformedURLException e) {
+ throw new InitializationException("Invalid URL for layout configuration", e);
+ }
+
+ log.debug("Loading layout from XML: {}", url);
+
+ InputStream input;
+ try {
+ input = url.openStream();
+ }
+ catch (IOException e) {
+ throw new InitializationException("Failed to initialize the shell layout", e);
+ }
+
+ // Setup the XStream marshallar and configure it with the aliases for the model we are working with
+ XStream xs = new XStream(new DomDriver());
+ Annotations.configureAliases(xs, Layout.class, Command.class, Alias.class);
+
+ Layout layout;
+ try {
+ layout = (Layout)xs.fromXML(input);
+
+ assert layout != null;
+ }
+ finally {
+ try {
+ input.close();
+ }
+ catch (IOException ignore) {}
+ }
+
+ log.debug("Loaded layout: {}", layout);
+
+ //
+ // TODO: Do some kind post-parsing validation or someting?
+
+ this.layout = layout;
+ }
+
+ public Layout getLayout() {
+ return layout;
}
}
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Alias.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Alias.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Alias.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Alias.java Mon Sep 3 21:21:20 2007
@@ -22,7 +22,7 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
- * ???
+ * An alias to a command.
*
* @version $Rev$ $Date$
*/
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Command.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Command.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Command.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Command.java Mon Sep 3 21:21:20 2007
@@ -22,7 +22,7 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
- * ???
+ * A command instance.
*
* @version $Rev$ $Date$
*/
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Group.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Group.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Group.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Group.java Mon Sep 3 21:21:20 2007
@@ -25,7 +25,7 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
- * ???
+ * A group of nodes.
*
* @version $Rev$ $Date$
*/
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java Mon Sep 3 21:21:20 2007
@@ -19,13 +19,10 @@
package org.apache.geronimo.gshell.layout.model;
-import java.util.ArrayList;
-import java.util.List;
-
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
- * ???
+ * The root container for a layout tree.
*
* @version $Rev$ $Date$
*/
@@ -35,5 +32,12 @@
{
public Layout(final String name) {
super(name);
+ }
+
+ /**
+ * Constructs the root layout.
+ */
+ public Layout() {
+ super("/");
}
}
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java Mon Sep 3 21:21:20 2007
@@ -20,7 +20,7 @@
package org.apache.geronimo.gshell.layout.model;
/**
- * ???
+ * The rudimentary elemnet of a layout.
*
* @version $Rev$ $Date$
*/
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/resources/META-INF/plexus/components.xml?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/resources/META-INF/plexus/components.xml Mon Sep 3 21:21:20 2007
@@ -33,12 +33,6 @@
<role>org.codehaus.plexus.PlexusContainer</role>
<field-name>container</field-name>
</requirement>
- <!--
- <requirement>
- <role>org.apache.geronimo.gshell.command.CommandManager</role>
- <field-name>commandManager</field-name>
- </requirement>
- -->
</requirements>
</component>
</components>
Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/test/java/org/apache/geronimo/gshell/layout/model/BasicModelValidationTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/test/java/org/apache/geronimo/gshell/layout/model/BasicModelValidationTest.java?rev=572508&r1=572507&r2=572508&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/test/java/org/apache/geronimo/gshell/layout/model/BasicModelValidationTest.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/test/java/org/apache/geronimo/gshell/layout/model/BasicModelValidationTest.java Mon Sep 3 21:21:20 2007
@@ -50,8 +50,8 @@
}
public void testDumpLayout1() throws Exception {
- Layout layout = new Layout("default");
-
+ Layout layout = new Layout();
+
layout.nodes().add(new Command("foo", "bar"));
layout.nodes().add(new Alias("f", "foo"));