geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r659615 - in /geronimo/gshell/trunk/gshell-model/src: main/java/org/apache/geronimo/gshell/model/application/ main/java/org/apache/geronimo/gshell/model/common/ main/java/org/apache/geronimo/gshell/model/plugin/ test/java/org/apache/geronim...
Date Fri, 23 May 2008 18:18:25 GMT
Author: jdillon
Date: Fri May 23 11:18:24 2008
New Revision: 659615

URL: http://svn.apache.org/viewvc?rev=659615&view=rev
Log:
Add common support for top-level descriptors

Added:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
      - copied, changed from r659613, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
Modified:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
    geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java?rev=659615&r1=659614&r2=659615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
Fri May 23 11:18:24 2008
@@ -20,16 +20,15 @@
 package org.apache.geronimo.gshell.model.application;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelRoot;
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.DependencyGroup;
-import org.apache.geronimo.gshell.model.common.RemoteRepository;
+import org.apache.geronimo.gshell.model.common.DescriptorSupport;
 import org.apache.geronimo.gshell.model.common.LocalRepository;
+import org.apache.geronimo.gshell.model.common.RemoteRepository;
 import org.apache.geronimo.gshell.model.layout.Layout;
 
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Properties;
+import java.util.List;
 
 /**
  * Application model root element.
@@ -38,20 +37,8 @@
  */
 @XStreamAlias("application")
 public class Application
-    extends ModelRoot
+    extends DescriptorSupport
 {
-    private String groupId;
-
-    private String artifactId;
-
-    private String version;
-
-    private String name;
-
-    private String description;
-
-    private Properties properties;
-
     private LocalRepository localRepository;
 
     private List<RemoteRepository> remoteRepositories;
@@ -66,62 +53,6 @@
 
     // TODO: Paths
 
-    public String getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(final String groupId) {
-        this.groupId = groupId;
-    }
-
-    public String getArtifactId() {
-        return artifactId;
-    }
-
-    public void setArtifactId(final String artifactId) {
-        this.artifactId = artifactId;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(final String version) {
-        this.version = version;
-    }
-
-    public String getId() {
-        return getGroupId() + ":" + getArtifactId() + ":" + getVersion();
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    public Properties getProperties() {
-        if (properties == null) {
-            properties = new Properties();
-        }
-
-        return properties;
-    }
-
-    public void setProperties(final Properties properties) {
-        this.properties = properties;
-    }
-
     public LocalRepository getLocalRepository() {
         return localRepository;
     }

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
(from r659613, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java&r1=659613&r2=659615&rev=659615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
Fri May 23 11:18:24 2008
@@ -17,54 +17,56 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.model.plugin;
+package org.apache.geronimo.gshell.model.common;
 
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelRoot;
-import org.apache.geronimo.gshell.model.common.DependencyGroup;
-import org.apache.geronimo.gshell.model.common.Dependency;
-
-import java.util.List;
-import java.util.ArrayList;
 import java.util.Properties;
 
 /**
- * Plugin model root element.
+ * Support for descriptor models.
  *
  * @version $Rev$ $Date$
  */
-@XStreamAlias("plugin")
-public class Plugin
+public class DescriptorSupport
     extends ModelRoot
 {
-    private String id;
-
-    // groupId
+    private String groupId;
 
-    // artifactId
+    private String artifactId;
 
-    // version
+    private String version;
 
     private String name;
 
     private String description;
 
     private Properties properties;
-    
-    private List<Dependency> dependencies;
 
-    private List<DependencyGroup> dependencyGroups;
-    
-    // Commands
-    
-    // Layout
+    public String getGroupId() {
+        return groupId;
+    }
 
-    public String getId() {
-        return id;
+    public void setGroupId(final String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    public void setArtifactId(final String artifactId) {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion() {
+        return version;
     }
 
-    public void setId(final String id) {
-        this.id = id;
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+
+    public String getId() {
+        return getGroupId() + ":" + getArtifactId() + ":" + getVersion();
     }
 
     public String getName() {
@@ -94,48 +96,4 @@
     public void setProperties(final Properties properties) {
         this.properties = properties;
     }
-
-    public List<DependencyGroup> dependencyGroups() {
-        if (dependencyGroups == null) {
-            dependencyGroups = new ArrayList<DependencyGroup>();
-        }
-
-        return dependencyGroups;
-    }
-
-    public void add(final DependencyGroup group) {
-        assert group != null;
-
-        dependencyGroups().add(group);
-    }
-
-    public List<Dependency> dependencies() {
-        return dependencies(false);
-    }
-
-    public List<Dependency> dependencies(boolean includeGroups) {
-        if (dependencies == null) {
-            dependencies = new ArrayList<Dependency>();
-        }
-
-        if (!includeGroups) {
-            return dependencies;
-        }
-
-        List<Dependency> list = new ArrayList<Dependency>();
-
-        list.addAll(dependencies);
-
-        for (DependencyGroup group : dependencyGroups()) {
-            list.addAll(group.dependencies());
-        }
-
-        return list;
-    }
-
-    public void add(final Dependency dependency) {
-        assert dependency != null;
-
-        dependencies().add(dependency);
-    }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java?rev=659615&r1=659614&r2=659615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
Fri May 23 11:18:24 2008
@@ -20,13 +20,14 @@
 package org.apache.geronimo.gshell.model.plugin;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelRoot;
-import org.apache.geronimo.gshell.model.common.DependencyGroup;
+import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.model.common.Dependency;
+import org.apache.geronimo.gshell.model.common.DependencyGroup;
+import org.apache.geronimo.gshell.model.common.DescriptorSupport;
+import org.apache.geronimo.gshell.model.layout.Layout;
 
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Properties;
+import java.util.List;
 
 /**
  * Plugin model root element.
@@ -35,65 +36,23 @@
  */
 @XStreamAlias("plugin")
 public class Plugin
-    extends ModelRoot
+    extends DescriptorSupport
 {
-    private String id;
-
-    // groupId
-
-    // artifactId
-
-    // version
-
-    private String name;
-
-    private String description;
-
-    private Properties properties;
+    //
+    // FIXME: Might not really need these here, since we are using the pom.xml information
to load dependencies/plugins
+    //
     
     private List<Dependency> dependencies;
 
     private List<DependencyGroup> dependencyGroups;
-    
-    // Commands
-    
-    // Layout
 
-    public String getId() {
-        return id;
-    }
+    //
+    // FIXME: Make collection accessors null-safe
+    //
 
-    public void setId(final String id) {
-        this.id = id;
-    }
+    private List<Command> commands;
 
-    public String getName() {
-        return name;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    public Properties getProperties() {
-        if (properties == null) {
-            properties = new Properties();
-        }
-
-        return properties;
-    }
-
-    public void setProperties(final Properties properties) {
-        this.properties = properties;
-    }
+    private Layout layout;
 
     public List<DependencyGroup> dependencyGroups() {
         if (dependencyGroups == null) {

Modified: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java?rev=659615&r1=659614&r2=659615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
Fri May 23 11:18:24 2008
@@ -40,7 +40,9 @@
     public void testMarshal1() throws Exception {
         Plugin root = new Plugin();
 
-        root.setId("plugin.test");
+        root.setGroupId("plugin.test");
+        root.setArtifactId("plugin-test");
+        root.setVersion("1.0");
         root.setName("Plugin Test");
         root.setDescription("A test plugin descriptor.");
 

Modified: geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml?rev=659615&r1=659614&r2=659615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml
(original)
+++ geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml
Fri May 23 11:18:24 2008
@@ -21,10 +21,12 @@
 <!-- $Rev$ $Date$ -->
 
 <plugin>
-    <id>plugin.test</id>
+    <groupId>plugin.test</groupId>
+    <artifactId>plugin-test</artifactId>
+    <version>1.0</version>
     <name>Plugin Test</name>
     <description>A test plugin descriptor.</description>
-
+    
     <properties>
         <property name="a" value="b"/>
     </properties>



Mime
View raw message