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 12:12:08 UTC
svn commit: r572602 - in /geronimo/sandbox/gshell/trunk:
gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/
gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/
gshell-commands/gshell-vfs/src/main/resources/META-INF/p...
Author: jdillon
Date: Tue Sep 4 03:12:04 2007
New Revision: 572602
URL: http://svn.apache.org/viewvc?rev=572602&view=rev
Log:
Some more work on the commands plugin descriptor w/modello
Added:
geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/
geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml (with props)
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java (with props)
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/
geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml (with props)
Modified:
geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VFSCommandSupport.java
geronimo/sandbox/gshell/trunk/gshell-plugin/src/main/mdo/plugin.mdo
Modified: geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java?rev=572602&r1=572601&r2=572602&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java Tue Sep 4 03:12:04 2007
@@ -279,6 +279,11 @@
present.add(handler);
}
+ //
+ // FIXME: Some options, like --help or --version may be used in conjunction with other options which are marked as required.
+ // We need to set a little flag on the --help|--verison options to override this required handling crapo...
+ //
+
// Ensure that all required option handlers are present
for (Handler handler : optionHandlers) {
if (handler.descriptor.required() && !present.contains(handler)) {
Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VFSCommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VFSCommandSupport.java?rev=572602&r1=572601&r2=572602&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VFSCommandSupport.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VFSCommandSupport.java Tue Sep 4 03:12:04 2007
@@ -35,12 +35,14 @@
protected void doInit() throws Exception {
//
- // TODO: Should probably bind this pupping into the container and let plexus handle it for us
+ // TODO: Should probably bind this pupping into the container and let plexus handle it for us... though
+ // the components.xml generation will clobber anything which we add, it won't merge like a good like
+ // plugin should... :-(
//
fsManager = VFS.getManager();
}
-
+
protected FileSystemManager getFileSystemManager() {
if (fsManager == null) {
throw new IllegalStateException("Not initialized; Missing FileSystemManager");
Added: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml?rev=572602&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml (added)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml Tue Sep 4 03:12:04 2007
@@ -0,0 +1,33 @@
+<?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$ -->
+
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.commons.vfs.FileSystemManager</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.commons.vfs.impl.StandardFileSystemManager</implementation>
+ <instantiation-strategy>singleton</instantiation-strategy>
+ <lifecycle-handler>plexus</lifecycle-handler>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/sandbox/gshell/trunk/gshell-plugin/src/main/mdo/plugin.mdo
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-plugin/src/main/mdo/plugin.mdo?rev=572602&r1=572601&r2=572602&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-plugin/src/main/mdo/plugin.mdo (original)
+++ geronimo/sandbox/gshell/trunk/gshell-plugin/src/main/mdo/plugin.mdo Tue Sep 4 03:12:04 2007
@@ -38,7 +38,12 @@
<!--
FIXME: This should really be abstract :-(
-->
- <class>
+ <class java.abstract="true"
+ java.generate-add="false"
+ java.generate-remove="false"
+ java.generate-break="false"
+ java.generate-create="false">
+
<name>Element</name>
<version>1.0.0+</version>
<description>TODO</description>
@@ -106,11 +111,7 @@
<name>configuration</name>
<version>1.0.0+</version>
<description>TODO</description>
- <type>Properties</type>
- <association xml.mapStyle="inline">
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
+ <type>DOM</type>
</field>
<field>
Added: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java?rev=572602&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java Tue Sep 4 03:12:04 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.plugin.model;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gshell.plugin.model.io.xpp3.PluginXpp3Reader;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Basic validation of the plugin model muck.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BasicModelValidationTest
+ extends TestCase
+{
+ public void testRead1() throws Exception {
+ PluginXpp3Reader reader = new PluginXpp3Reader();
+ Plugin plugin = reader.read(getClass().getResourceAsStream("plugins1.xml"));
+
+ assertNotNull(plugin);
+ assertEquals("testing", plugin.getName());
+
+ assertNotNull(plugin.getCommands());
+ assertEquals(1, plugin.getCommands().size());
+
+ Command command = (Command) plugin.getCommands().get(0);
+ assertNotNull(command);
+ assertEquals("builtins.HelpCommand", command.getName());
+ assertEquals("org.apache.geronimo.gshell.commands.builtins.HelpCommand", command.getImplementation());
+
+ assertNotNull(command.getRequirements());
+ assertEquals(1, command.getRequirements().size());
+
+ Requirement req = (Requirement) command.getRequirements().get(0);
+ assertNotNull(req);
+ assertEquals("org.codehaus.plexus.PlexusContainer", req.getRole());
+ assertEquals("container", req.getField());
+
+ assertNotNull(command.getConfiguration());
+
+ assertEquals(Xpp3Dom.class, command.getConfiguration().getClass());
+
+ //
+ // TODO: Validate the configuration bits...
+ //
+ }
+}
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/java/org/apache/geronimo/gshell/plugin/model/BasicModelValidationTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml?rev=572602&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml (added)
+++ geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml Tue Sep 4 03:12:04 2007
@@ -0,0 +1,41 @@
+<?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$ -->
+
+<plugin>
+ <name>testing</name>
+
+ <commands>
+ <command>
+ <name>builtins.HelpCommand</name>
+ <implementation>org.apache.geronimo.gshell.commands.builtins.HelpCommand</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field>container</field>
+ </requirement>
+ </requirements>
+ <configuration>
+ <foo>bar</foo>
+ </configuration>
+ </command>
+ </commands>
+</plugin>
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-plugin/src/test/resources/org/apache/geronimo/gshell/plugin/model/plugins1.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml