geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r396772 - in /geronimo/gbuild/trunk: gbuild-agent/pom.xml gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/StringTemplateTest.java pom.xml
Date Tue, 25 Apr 2006 05:26:11 GMT
Author: dblevins
Date: Mon Apr 24 22:26:07 2006
New Revision: 396772

URL: http://svn.apache.org/viewcvs?rev=396772&view=rev
Log:
Replaced the StringTemplate impl with the one from codehaus.

Removed:
    geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/StringTemplateTest.java
Modified:
    geronimo/gbuild/trunk/gbuild-agent/pom.xml
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java
    geronimo/gbuild/trunk/pom.xml

Modified: geronimo/gbuild/trunk/gbuild-agent/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/pom.xml?rev=396772&r1=396771&r2=396772&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/pom.xml Mon Apr 24 22:26:07 2006
@@ -46,7 +46,12 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
         </dependency>
-    
+        <dependency>
+            <groupId>org.codehaus.swizzle</groupId>
+            <artifactId>swizzle-stream</artifactId>
+            <version>1.0</version>
+        </dependency>
+
     <!-- ActiveMQ deps -->
         <dependency>
             <groupId>incubator-activemq</groupId>

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java?rev=396772&r1=396771&r2=396772&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/StringTemplate.java
Mon Apr 24 22:26:07 2006
@@ -25,61 +25,8 @@
 /**
  * @version $Rev$ $Date$
  */
-public class StringTemplate {
-
-    private static final Pattern expr = Pattern.compile("\\{([^}]*)\\}");
-
-    private final String[] tokens;
-    private final String mask;
-    private final Pattern[] patterns;
-
-    public StringTemplate(String mask) {
-        this.mask = mask;
-        this.tokens = getTokens(mask);
-        this.patterns = getPatterns(tokens);
-    }
-
-    /**
-     * Pull tokens one at a time and replace
-     * them on the string (loop)
-     * <p/>
-     * Notice that when referenced data is pulled from the
-     * context, we don't apply a related StringTemplate.  This could
-     * cause a circular reference and is complicated to code.
-     * We are just skipping this feature for the moment.
-     */
-    public String apply(Map context) {
-        String data = mask;
-        try {
-            synchronized (context) {
-                for (int i = 0; i < tokens.length; i++) {
-                    Matcher matcher = patterns[i].matcher(data);
-                    Object object = context.get(tokens[i]);
-                    if (object != null){
-                        data = matcher.replaceAll(object.toString());
-                    }
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return data;
-    }
-
-    private String[] getTokens(String str) {
-        List tokens = new ArrayList();
-        Matcher matcher = expr.matcher(str);
-        while (matcher.find()) {
-            tokens.add(matcher.group(1));
-        }
-        return (String[]) tokens.toArray(new String[]{});
-    }
-
-    private Pattern[] getPatterns(String[] tokens) {
-        Pattern[] patterns = new Pattern[tokens.length];
-        for (int i = 0; i < patterns.length; i++) {
-            patterns[i] = Pattern.compile("\\{" + tokens[i] + "\\}");
-        }
-        return patterns;
+public class StringTemplate extends org.codehaus.swizzle.stream.StringTemplate {
+    public StringTemplate(String string) {
+        super(string);
     }
 }

Modified: geronimo/gbuild/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/pom.xml?rev=396772&r1=396771&r2=396772&view=diff
==============================================================================
--- geronimo/gbuild/trunk/pom.xml (original)
+++ geronimo/gbuild/trunk/pom.xml Mon Apr 24 22:26:07 2006
@@ -147,23 +147,22 @@
     <repositories>
         <repository>
             <id>apache</id>
-            <name>Apche Repository</name>
+            <name>Apache Repository</name>
             <url>http://cvs.apache.org/repository</url>
             <layout>legacy</layout>
         </repository>
         <repository>
-            <id>dblevins</id>
-            <name>Apche Repository</name>
-            <url>http://people.apache.org/~dblevins/maven</url>
-            <layout>legacy</layout>
-        </repository>
-        <repository>
             <releases>
                 <enabled>false</enabled>
             </releases>
             <id>snapshots</id>
             <name>Maven Snapshot Development Repository</name>
             <url>http://snapshots.maven.codehaus.org/maven2</url>
+        </repository>
+        <repository>
+            <id>codehaus</id>
+            <name>Codehaus Repository</name>
+            <url>http://repository.codehaus.org</url>
         </repository>
     </repositories>
     <pluginRepositories>



Mime
View raw message