jvanzyl 2004/05/20 13:26:31
Modified: maven-core/src/main/java/org/apache/maven/script/taglib
AbstractGoalDecoratorTag.java
MavenScriptTagLibrary.java MavenTag.java
PostGoalTag.java PreGoalTag.java
maven-core/src/main/java/org/apache/maven/script
DefaultGoalDecorator.java GoalDecorator.java
MavenScript.java
Log:
o adding lics while perusing the code.
Revision Changes Path
1.2 +24 -14
maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/AbstractGoalDecoratorTag.java
Index: AbstractGoalDecoratorTag.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/AbstractGoalDecoratorTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractGoalDecoratorTag.java 12 May 2004 23:38:40 -0000 1.1
+++ AbstractGoalDecoratorTag.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script.taglib;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.script.DefaultGoalDecorator;
import org.apache.maven.script.GoalDecorator;
import org.apache.maven.script.MavenScript;
@@ -14,19 +29,14 @@
/**
* @author jdcasey
*/
-public abstract class AbstractGoalDecoratorTag extends AbstractTag
+public abstract class AbstractGoalDecoratorTag
+ extends AbstractTag
{
-
public static final String NAME_ATTRIBUTE = "name";
private String goalName;
- private MarmaladeScriptAggregator aggregator = new MarmaladeScriptAggregator();
- /**
- */
- protected AbstractGoalDecoratorTag()
- {
- }
+ private MarmaladeScriptAggregator aggregator = new MarmaladeScriptAggregator();
protected abstract void addDecorator( MavenScript script, GoalDecorator
decorator );
@@ -41,9 +51,9 @@
public Object end( String element ) throws TagException, TagalogParseException
{
MavenScript script = (MavenScript) getContext().get(
MavenScript.PARSE_CTX_KEY );
- addDecorator( script,
- new DefaultGoalDecorator( goalName,
- new MarmaladeScript(
getDecoratorClass() + ":" + goalName, aggregator ) ) );
+
+ addDecorator( script, new DefaultGoalDecorator( goalName,
+ new MarmaladeScript( getDecoratorClass() + ":" + goalName, aggregator )
) );
return null;
}
@@ -51,6 +61,7 @@
public boolean recycle()
{
this.goalName = null;
+
return true;
}
@@ -60,10 +71,9 @@
}
public static final class MarmaladeScriptAggregator extends AbstractMarmaladeTag
- {
+ {
MarmaladeScriptAggregator()
{
}
}
-
}
1.2 +20 -6
maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/MavenScriptTagLibrary.java
Index: MavenScriptTagLibrary.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/MavenScriptTagLibrary.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenScriptTagLibrary.java 12 May 2004 23:38:40 -0000 1.1
+++ MavenScriptTagLibrary.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script.taglib;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.codehaus.marmalade.abstractions.AbstractMarmaladeTagLibrary;
import org.codehaus.tagalog.AbstractTag;
import org.codehaus.tagalog.AbstractTagLibrary;
@@ -8,16 +23,15 @@
/**
* @author jdcasey
*/
-public class MavenScriptTagLibrary extends AbstractMarmaladeTagLibrary
+public class MavenScriptTagLibrary
+ extends AbstractMarmaladeTagLibrary
{
-
- /**
- */
public MavenScriptTagLibrary()
{
registerTag( MavenTag.TAG, MavenTag.class );
+
registerTag( PreGoalTag.TAG, PreGoalTag.class );
+
registerTag( PostGoalTag.TAG, PostGoalTag.class );
}
-
}
1.2 +23 -12
maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/MavenTag.java
Index: MavenTag.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/MavenTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenTag.java 12 May 2004 23:38:40 -0000 1.1
+++ MavenTag.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script.taglib;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.script.MavenScript;
import org.codehaus.tagalog.AbstractTag;
import org.codehaus.tagalog.Attributes;
@@ -10,25 +25,20 @@
/**
* @author jdcasey
*/
-public class MavenTag extends AbstractTag
+public class MavenTag
+ extends AbstractTag
{
-
public static final String TAG = "project";
+
public static final String DEFAULT_GOAL_TAG = "default";
private MavenScript script = new MavenScript();
- /**
- *
- */
- public MavenTag()
- {
- }
-
public void begin( String element, Attributes attributes )
throws TagException, TagalogParseException
{
String defGoal = attributes.getValue( DEFAULT_GOAL_TAG );
+
script.setDefaultGoal( defGoal );
getContext().put( MavenScript.PARSE_CTX_KEY, script );
@@ -37,12 +47,13 @@
public boolean recycle()
{
this.script = null;
+
return true;
}
- public Object end( String element ) throws TagException, TagalogParseException
+ public Object end( String element )
+ throws TagException, TagalogParseException
{
return script;
}
-
}
1.2 +18 -10
maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/PostGoalTag.java
Index: PostGoalTag.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/PostGoalTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PostGoalTag.java 12 May 2004 23:38:40 -0000 1.1
+++ PostGoalTag.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,23 +1,32 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script.taglib;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.script.GoalDecorator;
import org.apache.maven.script.MavenScript;
/**
* @author jdcasey
*/
-public class PostGoalTag extends AbstractGoalDecoratorTag
+public class PostGoalTag
+ extends AbstractGoalDecoratorTag
{
-
public static final String TAG = "postGoal";
- /**
- */
- public PostGoalTag()
- {
- }
-
protected void addDecorator( MavenScript script, GoalDecorator decorator )
{
script.addPostGoal( decorator );
@@ -27,5 +36,4 @@
{
return "postGoal";
}
-
}
1.2 +16 -9
maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/PreGoalTag.java
Index: PreGoalTag.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/taglib/PreGoalTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PreGoalTag.java 12 May 2004 23:38:40 -0000 1.1
+++ PreGoalTag.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script.taglib;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.script.GoalDecorator;
import org.apache.maven.script.MavenScript;
@@ -9,15 +24,8 @@
*/
public class PreGoalTag extends AbstractGoalDecoratorTag
{
-
public static final String TAG = "preGoal";
- /**
- */
- public PreGoalTag()
- {
- }
-
protected void addDecorator( MavenScript script, GoalDecorator decorator )
{
script.addPreGoal( decorator );
@@ -27,5 +35,4 @@
{
return "preGoal";
}
-
}
1.2 +22 -4
maven-components/maven-core/src/main/java/org/apache/maven/script/DefaultGoalDecorator.java
Index: DefaultGoalDecorator.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/DefaultGoalDecorator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultGoalDecorator.java 12 May 2004 23:40:02 -0000 1.1
+++ DefaultGoalDecorator.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 6, 2004 */
package org.apache.maven.script;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import org.codehaus.marmalade.MarmaladeScript;
@@ -13,15 +28,17 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">John Casey</a>
*/
-public class DefaultGoalDecorator implements GoalDecorator
+public class DefaultGoalDecorator
+ implements GoalDecorator
{
-
private String goal;
+
private MarmaladeScript script;
public DefaultGoalDecorator( String goal, MarmaladeScript script )
{
this.goal = goal;
+
this.script = script;
}
@@ -38,7 +55,9 @@
public void execute( PluginExecutionRequest request, PluginExecutionResponse
response )
{
Map params = request.getParameters();
+
DefaultContext ctx = new DefaultContext( params );
+
try
{
script.execute( ctx );
@@ -48,5 +67,4 @@
response.setException( e );
}
}
-
}
1.2 +16 -2
maven-components/maven-core/src/main/java/org/apache/maven/script/GoalDecorator.java
Index: GoalDecorator.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/GoalDecorator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GoalDecorator.java 12 May 2004 23:40:02 -0000 1.1
+++ GoalDecorator.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 5, 2004 */
package org.apache.maven.script;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
@@ -13,7 +28,6 @@
*/
public interface GoalDecorator
{
-
String getGoal();
void execute( PluginExecutionRequest request, PluginExecutionResponse response
);
1.2 +22 -8
maven-components/maven-core/src/main/java/org/apache/maven/script/MavenScript.java
Index: MavenScript.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/script/MavenScript.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenScript.java 12 May 2004 23:40:02 -0000 1.1
+++ MavenScript.java 20 May 2004 20:26:31 -0000 1.2
@@ -1,6 +1,21 @@
-/* Created on Apr 9, 2004 */
package org.apache.maven.script;
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -12,15 +27,14 @@
*/
public class MavenScript
{
-
public static final String PARSE_CTX_KEY = "maven-script";
private Map preGoals = new HashMap();
+
private Map postGoals = new HashMap();
+
private String defaultGoal = "jar:jar";
- /**
- */
public MavenScript()
{
}
@@ -38,20 +52,24 @@
public List getPreGoals( String goal )
{
List result = (List) preGoals.get( goal );
+
if ( result == null )
{
result = Collections.EMPTY_LIST;
}
+
return Collections.unmodifiableList( result );
}
public List getPostGoals( String goal )
{
List result = (List) postGoals.get( goal );
+
if ( result == null )
{
result = Collections.EMPTY_LIST;
}
+
return Collections.unmodifiableList( result );
}
@@ -69,9 +87,6 @@
decorators.add( decorator );
}
- /**
- * @param defGoal
- */
public void setDefaultGoal( String defGoal )
{
this.defaultGoal = defGoal;
@@ -81,5 +96,4 @@
{
return defaultGoal;
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]