geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r662151 - in /geronimo/gshell/trunk: ./ gshell-assembly/src/main/underlay/etc/ gshell-model/ gshell-model/src/main/java/org/apache/geronimo/gshell/model/ gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ gshell-model/...
Date Sun, 01 Jun 2008 06:44:32 GMT
Author: jdillon
Date: Sat May 31 23:44:31 2008
New Revision: 662151

URL: http://svn.apache.org/viewvc?rev=662151&view=rev
Log:
Moved ModelRoot + ModelElement to ..
Adding model interpolation support, based on plexus-interpolation
Interpolating the application and settings models w/sysprops (more context to be added soon)

Added:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
  (with props)
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
  (with props)
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
  (with props)
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
  (with props)
Removed:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelElement.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelRoot.java
Modified:
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-model/pom.xml
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencySupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
    geronimo/gshell/trunk/pom.xml

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml Sat May 31
23:44:31 2008
@@ -27,23 +27,24 @@
     <version>1.0-alpha-2-SNAPSHOT</version>
     
     <localRepository>
-        <!--
-        <directory>${gshell.home}/repository</directory>
+        <!-- 
+        FIXME: Update the interpolation muck to auto-resolve relative paths to ${gshell.home}
         -->
-        <directory>repository</directory>
+        <directory>${gshell.home}/repository</directory>
     </localRepository>
 
     <remoteRepositories>
         <remoteRepository>
-            <id>maven-cache</id>
-            <!--
-            FIXME: Need to get ${user.home} expansion working soon to drop this hard-coded
muck
+            <id>cache</id>
+            <!-- 
+            FIXME: Allow a normal file path to be used here and auto-converted to a URI
             -->
-            <location>file:/Users/jason/.m2/repository</location>
+            <location>file:${user.home}/.m2/repository</location>
         </remoteRepository>
         
         <!--
         <remoteRepository>
+            <id>central</id>
             <location>http://repo1.maven.org/maven2</location>
         </remoteRepository>
         -->

Modified: geronimo/gshell/trunk/gshell-model/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/pom.xml?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-model/pom.xml Sat May 31 23:44:31 2008
@@ -39,10 +39,20 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        
+        <dependency>
             <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-common</artifactId>
         </dependency>
-
+        
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-interpolation</artifactId>
+        </dependency>
+        
         <dependency>
             <groupId>com.thoughtworks.xstream</groupId>
             <artifactId>xstream</artifactId>

Added: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java?rev=662151&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
(added)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
Sat May 31 23:44:31 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.model;
+
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+
+/**
+ * Base class for model elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ModelElement
+{
+    @Override
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelElement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java?rev=662151&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
(added)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
Sat May 31 23:44:31 2008
@@ -0,0 +1,57 @@
+/*
+ * 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.model;
+
+import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
+import org.apache.geronimo.gshell.model.marshal.Marshaller;
+
+/**
+ * Base class for root model elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ModelRoot
+    extends ModelElement
+{
+    private transient Marshaller marshaller;
+
+    @XStreamAsAttribute
+    private String modelVersion;
+
+    public Marshaller getMarshaller() {
+    	if (marshaller == null) {
+    		throw new IllegalStateException("Marshaller is not bound");
+    	}
+    	
+        return marshaller;
+    }
+
+    public void setMarshaller(final Marshaller marshaller) {
+        this.marshaller = marshaller;
+    }
+
+    public String getModelVersion() {
+        return modelVersion;
+    }
+
+    public void setModelVersion(final String modelVersion) {
+        this.modelVersion = modelVersion;
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/ModelRoot.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
Sat May 31 23:44:31 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.model.application;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelElement;
+
+import org.apache.geronimo.gshell.model.ModelElement;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.Properties;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
Sat May 31 23:44:31 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelElement;
+
+import org.apache.geronimo.gshell.model.ModelElement;
 
 import java.net.URI;
 import java.util.ArrayList;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
Sat May 31 23:44:31 2008
@@ -22,7 +22,7 @@
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
-import org.apache.geronimo.gshell.model.common.ModelRoot;
+import org.apache.geronimo.gshell.model.ModelRoot;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
Sat May 31 23:44:31 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelElement;
+
+import org.apache.geronimo.gshell.model.ModelElement;
 
 /**
  * Describes a comand parameter.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
Sat May 31 23:44:31 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelElement;
+
+import org.apache.geronimo.gshell.model.ModelElement;
 
 /**
  * Describes a required component of a command.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
Sat May 31 23:44:31 2008
@@ -62,7 +62,6 @@
     /**
      * Link children to their parent group when deserializing.
      */
-    @SuppressWarnings({"UnusedDeclaration"})
     private Object readResolve() {
         if (!isEmpty()) {
             for (Dependency child : dependencies()) {

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencySupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencySupport.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencySupport.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencySupport.java
Sat May 31 23:44:31 2008
@@ -19,6 +19,8 @@
 
 package org.apache.geronimo.gshell.model.common;
 
+import org.apache.geronimo.gshell.model.ModelElement;
+
 /**
  * Support for {@link Dependency} and {@link DependencyGroup} elements.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
Sat May 31 23:44:31 2008
@@ -21,6 +21,8 @@
 
 import java.util.Properties;
 
+import org.apache.geronimo.gshell.model.ModelRoot;
+
 /**
  * Support for descriptor models.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
Sat May 31 23:44:31 2008
@@ -23,6 +23,8 @@
 
 import java.io.File;
 
+import org.apache.geronimo.gshell.model.ModelElement;
+
 /**
  * Local repository configuration.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
Sat May 31 23:44:31 2008
@@ -24,6 +24,8 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.apache.geronimo.gshell.model.ModelElement;
+
 /**
  * Remote repository configuration.
  *

Added: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java?rev=662151&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
(added)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
Sat May 31 23:44:31 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.model.interpolate;
+
+import org.apache.geronimo.gshell.model.ModelRoot;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.RecursionInterceptor;
+import org.codehaus.plexus.interpolation.ValueSource;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interpolator<T extends ModelRoot>
+{
+	void setPrefixPattern(String pattern);
+	
+	void setRecursionInterceptor(RecursionInterceptor interceptor);
+	
+	void addValueSource(ValueSource source);
+	
+	T interpolate(T input) throws InterpolationException;
+}

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/Interpolator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java?rev=662151&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
(added)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
Sat May 31 23:44:31 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.model.interpolate;
+
+import org.apache.geronimo.gshell.model.ModelRoot;
+import org.apache.geronimo.gshell.model.marshal.Marshaller;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.RecursionInterceptor;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+import org.codehaus.plexus.interpolation.ValueSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class InterpolatorSupport<T extends ModelRoot>
+	implements Interpolator<T>
+{
+	private final Logger log = LoggerFactory.getLogger(getClass());
+	
+	private org.codehaus.plexus.interpolation.Interpolator interpolator;
+	
+	private String prefixPattern;
+	
+	private RecursionInterceptor recursionInterceptor;
+	
+	public InterpolatorSupport() {
+		interpolator = new RegexBasedInterpolator();
+	}
+	
+	public void setPrefixPattern(final String pattern) {
+		this.prefixPattern = pattern;
+	}
+	
+	public void setRecursionInterceptor(final RecursionInterceptor interceptor) {
+		this.recursionInterceptor = interceptor;
+	}
+	
+	public void addValueSource(final ValueSource source) {
+		assert source != null;
+		
+		interpolator.addValueSource(source);
+	}
+
+	public T interpolate(final T input) throws InterpolationException {
+		assert input != null;
+		
+		Marshaller<T> marshaller = input.getMarshaller();
+		String xml = marshaller.marshal(input);
+		
+		log.trace("Interpolating: {}", xml);
+		
+		// HACK: current snapshot can't handle null here
+		if (prefixPattern == null) {
+			prefixPattern = "";
+		}
+		
+		String result = interpolator.interpolate(xml, prefixPattern, recursionInterceptor);
+		
+		log.trace("Interpolated result: {}", result);
+		
+		return marshaller.unmarshal(result);
+	}
+}

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
Sat May 31 23:44:31 2008
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.model.layout;
 
-import org.apache.geronimo.gshell.model.common.ModelElement;
+import org.apache.geronimo.gshell.model.ModelElement;
 
 /**
  * The rudimentary element of a layout.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
Sat May 31 23:44:31 2008
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.model.marshal;
 
-import org.apache.geronimo.gshell.model.common.ModelRoot;
+import org.apache.geronimo.gshell.model.ModelRoot;
 
 import java.io.InputStream;
 import java.io.Reader;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
Sat May 31 23:44:31 2008
@@ -31,7 +31,9 @@
 import java.io.Writer;
 import java.net.URL;
 
-import org.apache.geronimo.gshell.model.common.ModelRoot;
+import org.apache.geronimo.gshell.model.ModelRoot;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Support for model {@link Marshaller} implementations.
@@ -41,6 +43,8 @@
 public class MarshallerSupport<T extends ModelRoot>
     implements Marshaller<T>
 {
+	private final Logger log = LoggerFactory.getLogger(getClass());
+	
     private final Class rootType;
 
     protected MarshallerSupport(final Class rootType) {

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
Sat May 31 23:44:31 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.model.settings;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.common.ModelRoot;
+
+import org.apache.geronimo.gshell.model.ModelRoot;
 import org.apache.geronimo.gshell.model.common.RemoteRepository;
 
 import java.util.Properties;

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
(original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
Sat May 31 23:44:31 2008
@@ -26,6 +26,8 @@
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.LocalRepository;
 import org.apache.geronimo.gshell.model.common.RemoteRepository;
+import org.apache.geronimo.gshell.model.interpolate.Interpolator;
+import org.apache.geronimo.gshell.model.interpolate.InterpolatorSupport;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
 import org.apache.geronimo.gshell.plugin.CommandCollector;
 import org.apache.geronimo.gshell.plugin.CommandDiscoverer;
@@ -47,6 +49,7 @@
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -107,6 +110,10 @@
         // Validate the configuration
         config.validate();
 
+        // Interpolate the model
+        interpolate(config);
+        
+        // Configure the application
         configure(config.getApplication());
 
         // Create a new context
@@ -125,14 +132,31 @@
         };
     }
 
+    private void interpolate(ApplicationConfiguration config) throws Exception {
+    	assert config != null;
+    	
+        Application app = config.getApplication();
+        Interpolator<Application> interp = new InterpolatorSupport<Application>();
+
+        // Add value sources to resolve muck
+        interp.addValueSource(new PropertiesBasedValueSource(System.getProperties()));
+        
+        //
+        // TODO: Add more
+        //
+        
+        app = interp.interpolate(app);
+        
+        // Update the configuration with the new model
+        config.setApplication(app);
+    }
+    
     private void configure(final Application application) throws Exception {
         assert application != null;
 
-        // TODO: Add application interpolation here, include settings properties
-        
         log.debug("Application ID: {}", application.getId());
         log.trace("Application descriptor: {}", application);
-
+        
         // Apply artifact manager configuration settings for application
         configureArtifactManager(application);
 

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
(original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
Sat May 31 23:44:31 2008
@@ -21,9 +21,12 @@
 
 import org.apache.geronimo.gshell.artifact.ArtifactManager;
 import org.apache.geronimo.gshell.model.common.RemoteRepository;
+import org.apache.geronimo.gshell.model.interpolate.Interpolator;
+import org.apache.geronimo.gshell.model.interpolate.InterpolatorSupport;
 import org.apache.geronimo.gshell.model.settings.Settings;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,10 +61,13 @@
 
         // Validate the configuration
         config.validate();
+        
+        if (config.getSettings() != null) {
+	        // Interpolate the model
+	        interpolate(config);
 
-        Settings settings = config.getSettings();
-        if (settings != null) {
-            configure(settings);
+	        // Configure settings
+            configure(config.getSettings());
         }
         
         // TODO: Merge in some default settings or something?
@@ -69,6 +75,25 @@
         settingsConfiguration = config;
     }
 
+    private void interpolate(final SettingsConfiguration config) throws Exception {
+    	assert config != null;
+    	
+    	Settings settings = config.getSettings();
+        Interpolator<Settings> interp = new InterpolatorSupport<Settings>();
+
+        // Add value sources to resolve muck
+        interp.addValueSource(new PropertiesBasedValueSource(System.getProperties()));
+        
+        //
+        // TODO: Add more
+        //
+        
+        settings = interp.interpolate(settings);
+        
+        // Update the configuration with the new model
+        config.setSettings(settings);
+    }
+    
     private void configure(final Settings settings) throws Exception {
         assert settings != null;
 

Modified: geronimo/gshell/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/pom.xml?rev=662151&r1=662150&r2=662151&view=diff
==============================================================================
--- geronimo/gshell/trunk/pom.xml (original)
+++ geronimo/gshell/trunk/pom.xml Sat May 31 23:44:31 2008
@@ -136,6 +136,12 @@
             </dependency>
 
             <dependency>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-interpolation</artifactId>
+                <version>1.0-SNAPSHOT</version>
+            </dependency>
+
+            <dependency>
                 <groupId>org.apache.maven.artifact</groupId>
                 <artifactId>maven-artifact</artifactId>
                 <version>3.0-SNAPSHOT</version>



Mime
View raw message