Author: brett Date: Tue Aug 23 05:28:54 2005 New Revision: 239397 URL: http://svn.apache.org/viewcvs?rev=239397&view=rev Log: PR: MNG-758 add @component tag for requirements
Added: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java (with props) maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java (with props) maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java (with props) maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java (with props) Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java maven/components/trunk/maven-plugin-tools/maven-plugin-tools-beanshell/src/main/resources/extractor.bsh maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java (original) +++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java Tue Aug 23 05:28:54 2005 @@ -40,6 +40,8 @@ private String defaultValue; + private Requirement requirement; + // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @@ -149,4 +151,13 @@ return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']"; } + public Requirement getRequirement() + { + return requirement; + } + + public void setRequirement( Requirement requirement ) + { + this.requirement = requirement; + } } Added: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java?rev=239397&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java (added) +++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java Tue Aug 23 05:28:54 2005 @@ -0,0 +1,52 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Copyright 2001-2005 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. + */ + +/** + * Describes a component requirement. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a> + * @version $Id$ + */ +public class Requirement +{ + private final String role; + + private final String roleHint; + + public Requirement( String role ) + { + this.role = role; + this.roleHint = null; + } + + public Requirement( String role, String roleHint ) + { + this.role = role; + this.roleHint = roleHint; + } + + public String getRole() + { + return role; + } + + public String getRoleHint() + { + return roleHint; + } +} Propchange: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java Tue Aug 23 05:28:54 2005 @@ -19,6 +19,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.Requirement; import org.apache.maven.tools.plugin.util.PluginUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; @@ -28,11 +29,11 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -249,7 +250,7 @@ w.startElement( "parameters" ); - Collection requirements = new ArrayList(); + Map requirements = new HashMap(); Set configuration = new HashSet(); @@ -265,7 +266,15 @@ { // treat it as a component...a requirement, in other words. - requirements.add( parameter ); + // remove "component." plus expression delimiters + String role = expression.substring( "${component.".length(), expression.length() - 1 ); + + // TODO: remove deprecated expression + requirements.put( parameter.getName(), new Requirement( role ) ); + } + else if ( parameter.getRequirement() != null ) + { + requirements.put( parameter.getName(), parameter.getRequirement() ); } else { @@ -351,19 +360,21 @@ { w.startElement( "requirements" ); - for ( Iterator i = requirements.iterator(); i.hasNext(); ) + for ( Iterator i = requirements.keySet().iterator(); i.hasNext(); ) { - Parameter requirement = (Parameter) i.next(); + String key = (String) i.next(); + Requirement requirement = (Requirement) requirements.get( key ); w.startElement( "requirement" ); - // remove "component." plus expression delimiters - String expression = requirement.getExpression(); - String role = expression.substring( "${component.".length(), expression.length() - 1 ); + element( w, "role", requirement.getRole() ); - element( w, "role", role ); + if ( requirement.getRoleHint() != null ) + { + element( w, "role-hint", requirement.getRoleHint() ); + } - element( w, "field-name", requirement.getName() ); + element( w, "field-name", key ); w.endElement(); } Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java Tue Aug 23 05:28:54 2005 @@ -357,6 +357,10 @@ { w.writeMarkup( " <i>(Discovered)</i>" ); } + else if ( parameter.getRequirement() != null ) + { + w.writeMarkup( " <i>(Discovered)</i>" ); + } w.endElement(); // td Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-beanshell/src/main/resources/extractor.bsh URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-beanshell/src/main/resources/extractor.bsh?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-beanshell/src/main/resources/extractor.bsh (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-beanshell/src/main/resources/extractor.bsh Tue Aug 23 05:28:54 2005 @@ -16,6 +16,8 @@ this.expressionPattern = Pattern.compile( "expression\\s*=\\s*\"(.*?)\"" ); this.phasePattern = Pattern.compile( "phase\\s*=\\s*\"(.*?)\"" ); this.lifecyclePattern = Pattern.compile( "lifecycle\\s*=\\s*\"(.*?)\"" ); +this.rolePattern = Pattern.compile( "role\\s*=\\s*\"(.*?)\"" ); +this.roleHintPattern = Pattern.compile( "roleHint\\s*=\\s*\"(.*?)\"" ); setAccessibility( true ); @@ -59,6 +61,25 @@ { parameter.setExpression( m.group( 1 ) ); } + } + value = tags.get( "component" ); + if ( value != null ) + { + m = rolePattern.matcher( value ); + if ( m.find() ) + { + role = m.group( 1 ); + } + m = roleHintPattern.matcher( value ); + if ( m.find() ) + { + roleHint = m.group( 1 ); + } + else + { + roleHint = null; + } + parameter.setRequirement( new Requirement( role, roleHint ) ); } return parameter; } Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java Tue Aug 23 05:28:54 2005 @@ -16,29 +16,28 @@ * limitations under the License. */ +import com.thoughtworks.qdox.JavaDocBuilder; +import com.thoughtworks.qdox.model.DocletTag; +import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.model.JavaField; +import com.thoughtworks.qdox.model.JavaSource; import org.apache.maven.plugin.descriptor.InvalidParameterException; import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.Requirement; import org.apache.maven.project.MavenProject; import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor; import org.codehaus.modello.StringUtils; import org.codehaus.plexus.logging.AbstractLogEnabled; -import com.thoughtworks.qdox.JavaDocBuilder; -import com.thoughtworks.qdox.model.DocletTag; -import com.thoughtworks.qdox.model.JavaClass; -import com.thoughtworks.qdox.model.JavaField; -import com.thoughtworks.qdox.model.JavaSource; - import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; -import java.util.Map.Entry; /** @@ -51,7 +50,7 @@ implements MojoDescriptorExtractor { public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy"; - + public static final String CONFIGURATOR = "configurator"; public static final String PARAMETER = "parameter"; @@ -77,17 +76,19 @@ public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution"; public static final String GOAL_REQUIRES_PROJECT = "requiresProject"; - + public static final String GOAL_IS_AGGREGATOR = "aggregator"; public static final String GOAL_REQUIRES_ONLINE = "requiresOnline"; - + public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault"; public static final String GOAL_MULTI_EXECUTION_STRATEGY = "attainAlways"; - + public static final String GOAL_REQUIRES_DIRECT_INVOCATION = "requiresDirectInvocation"; + private static final String COMPONENT = "component"; + protected void validateParameter( Parameter parameter, int i ) throws InvalidParameterException { @@ -120,7 +121,8 @@ // Mojo descriptor creation from @tags // ---------------------------------------------------------------------- - private MojoDescriptor createMojoDescriptor( JavaSource javaSource, PluginDescriptor pluginDescriptor ) throws InvalidPluginDescriptorException + private MojoDescriptor createMojoDescriptor( JavaSource javaSource, PluginDescriptor pluginDescriptor ) + throws InvalidPluginDescriptorException { MojoDescriptor mojoDescriptor = new MojoDescriptor(); mojoDescriptor.setPluginDescriptor( pluginDescriptor ); @@ -151,7 +153,6 @@ mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY ); } - // ---------------------------------------------------------------------- // Configurator hint // ---------------------------------------------------------------------- @@ -162,7 +163,7 @@ { mojoDescriptor.setComponentConfigurator( configurator.getValue() ); } - + // ---------------------------------------------------------------------- // Goal name // ---------------------------------------------------------------------- @@ -239,7 +240,7 @@ if ( requiresProject != null ) { String requiresProjectValue = requiresProject.getValue(); - + if ( requiresProjectValue != null ) { mojoDescriptor.setProjectRequired( Boolean.valueOf( requiresProjectValue ).booleanValue() ); @@ -312,7 +313,8 @@ return tag; } - private void extractParameters( MojoDescriptor mojoDescriptor, JavaClass javaClass ) throws InvalidPluginDescriptorException + private void extractParameters( MojoDescriptor mojoDescriptor, JavaClass javaClass ) + throws InvalidPluginDescriptorException { // --------------------------------------------------------------------------------- // We're resolving class-level, ancestor-class-field, local-class-field order here. @@ -322,13 +324,11 @@ for ( Iterator it = rawParams.entrySet().iterator(); it.hasNext(); ) { - Map.Entry entry = (Entry) it.next(); + Map.Entry entry = (Map.Entry) it.next(); String paramName = (String) entry.getKey(); JavaField field = (JavaField) entry.getValue(); - DocletTag parameter = field.getTagByName( PARAMETER ); - Parameter pd = new Parameter(); pd.setName( paramName ); @@ -337,27 +337,43 @@ pd.setDescription( field.getComment() ); - pd.setRequired( field.getTagByName( REQUIRED ) != null ); - - pd.setEditable( field.getTagByName( READONLY ) == null ); - - DocletTag deprecationTag = field.getTagByName( DEPRECATED ); - if ( deprecationTag != null ) + DocletTag componentTag = field.getTagByName( COMPONENT ); + if ( componentTag != null ) { - pd.setDeprecated( deprecationTag.getValue() ); + String role = componentTag.getNamedParameter( "role" ); + if ( role == null ) + { + role = field.getType().toString(); + } + + String roleHint = componentTag.getNamedParameter( "roleHint" ); + pd.setRequirement( new Requirement( role, roleHint ) ); } + else + { + DocletTag parameter = field.getTagByName( PARAMETER ); - String alias = parameter.getNamedParameter( "alias" ); + pd.setRequired( field.getTagByName( REQUIRED ) != null ); - if ( !StringUtils.isEmpty( alias ) ) - { - pd.setAlias( alias ); - } + pd.setEditable( field.getTagByName( READONLY ) == null ); + + DocletTag deprecationTag = field.getTagByName( DEPRECATED ); + if ( deprecationTag != null ) + { + pd.setDeprecated( deprecationTag.getValue() ); + } - pd.setExpression( parameter.getNamedParameter( PARAMETER_EXPRESSION ) ); + String alias = parameter.getNamedParameter( "alias" ); - pd.setDefaultValue( parameter.getNamedParameter( PARAMETER_DEFAULT_VALUE ) ); + if ( !StringUtils.isEmpty( alias ) ) + { + pd.setAlias( alias ); + } + pd.setExpression( parameter.getNamedParameter( PARAMETER_EXPRESSION ) ); + + pd.setDefaultValue( parameter.getNamedParameter( PARAMETER_DEFAULT_VALUE ) ); + } mojoDescriptor.addParameter( pd ); } } @@ -387,9 +403,7 @@ { JavaField field = classFields[i]; - DocletTag paramTag = field.getTagByName( PARAMETER ); - - if ( paramTag != null ) + if ( field.getTagByName( PARAMETER ) != null || field.getTagByName( COMPONENT ) != null ) { rawParams.put( field.getName(), field ); } Modified: maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java Tue Aug 23 05:28:54 2005 @@ -167,9 +167,7 @@ private File buildDirectory; /** - * @parameter expression="${component.org.codehaus.plexus.compiler.manager.CompilerManager}" - * @required - * @readonly + * @component */ private CompilerManager compilerManager; @@ -261,12 +259,13 @@ try { - staleSources = computeStaleSources( compilerConfiguration, compiler, getSourceInclusionScanner( staleMillis ) ); + staleSources = computeStaleSources( compilerConfiguration, compiler, + getSourceInclusionScanner( staleMillis ) ); canUpdateTarget = compiler.canUpdateTarget( compilerConfiguration ); - if ( compiler.getCompilerOutputStyle() == CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES - && !canUpdateTarget ) + if ( compiler.getCompilerOutputStyle() == CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES && + !canUpdateTarget ) { getLog().info( "RESCANNING!" ); // TODO: This second scan for source files is sub-optimal @@ -354,7 +353,7 @@ } private Set computeStaleSources( CompilerConfiguration compilerConfiguration, Compiler compiler, - SourceInclusionScanner scanner ) + SourceInclusionScanner scanner ) throws MojoExecutionException, CompilerException { CompilerOutputStyle outputStyle = compiler.getCompilerOutputStyle(); @@ -403,8 +402,8 @@ } catch ( InclusionScanException e ) { - throw new MojoExecutionException( "Error scanning source root: \'" + sourceRoot + "\' " - + "for stale files to recompile.", e ); + throw new MojoExecutionException( + "Error scanning source root: \'" + sourceRoot + "\' " + "for stale files to recompile.", e ); } } Modified: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java (original) +++ maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java Tue Aug 23 05:28:54 2005 @@ -47,6 +47,9 @@ registerTag( "requiresDependencyResolution", RequiresDependencyResolutionTag.class ); registerTag( "requiresProject", RequiresProjectTag.class ); registerTag( "requiresOnline", RequiresOnlineTag.class ); + registerTag( "requirement", RequirementTag.class ); + registerTag( "role", RequirementRoleTag.class ); + registerTag( "roleHint", RequirementRoleHintTag.class ); registerTag( "type", ParamTypeTag.class ); } Modified: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java?rev=239397&r1=239396&r2=239397&view=diff ============================================================================== --- maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java (original) +++ maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java Tue Aug 23 05:28:54 2005 @@ -17,6 +17,7 @@ */ import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.descriptor.Requirement; import org.codehaus.marmalade.model.AbstractMarmaladeTag; import org.codehaus.marmalade.runtime.MarmaladeExecutionContext; import org.codehaus.marmalade.runtime.MarmaladeExecutionException; @@ -43,6 +44,8 @@ private String defaultVal; + private Requirement requirement = null; + protected void doExecute( MarmaladeExecutionContext context ) throws MarmaladeExecutionException { @@ -65,6 +68,7 @@ param.setType( type ); param.setDeprecated( deprecated ); param.setDefaultValue( defaultVal ); + param.setRequirement( requirement ); return param; } @@ -107,5 +111,10 @@ public void setDeprecated( String deprecated ) { this.deprecated = deprecated; + } + + public void setRequirement( Requirement requirement ) + { + this.requirement = requirement; } } Added: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java?rev=239397&view=auto ============================================================================== --- maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java (added) +++ maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java Tue Aug 23 05:28:54 2005 @@ -0,0 +1,36 @@ +package org.apache.maven.script.marmalade.tags; + +/* + * Copyright 2001-2005 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.runtime.MarmaladeExecutionException; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a> + * @version $Id$ + */ +public class RequirementRoleHintTag + extends AbstractStringValuedBodyTag +{ + + protected void setValue( String value ) + throws MarmaladeExecutionException + { + RequirementTag parent = (RequirementTag) requireParent( RequirementTag.class ); + parent.setRoleHint( value ); + } + +} \ No newline at end of file Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleHintTag.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java?rev=239397&view=auto ============================================================================== --- maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java (added) +++ maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java Tue Aug 23 05:28:54 2005 @@ -0,0 +1,36 @@ +package org.apache.maven.script.marmalade.tags; + +/* + * Copyright 2001-2005 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.runtime.MarmaladeExecutionException; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a> + * @version $Id$ + */ +public class RequirementRoleTag + extends AbstractStringValuedBodyTag +{ + + protected void setValue( String value ) + throws MarmaladeExecutionException + { + RequirementTag parent = (RequirementTag) requireParent( RequirementTag.class ); + parent.setRole( value ); + } + +} \ No newline at end of file Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementRoleTag.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java?rev=239397&view=auto ============================================================================== --- maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java (added) +++ maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java Tue Aug 23 05:28:54 2005 @@ -0,0 +1,55 @@ +package org.apache.maven.script.marmalade.tags; + +/* + * Copyright 2001-2005 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.descriptor.Requirement; +import org.codehaus.marmalade.model.AbstractMarmaladeTag; +import org.codehaus.marmalade.runtime.MarmaladeExecutionContext; +import org.codehaus.marmalade.runtime.MarmaladeExecutionException; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a> + * @version $Id$ + */ +public class RequirementTag + extends AbstractMarmaladeTag +{ + private String role; + + private String roleHint; + + protected void doExecute( MarmaladeExecutionContext context ) + throws MarmaladeExecutionException + { + processChildren( context ); + + Requirement requirement = new Requirement( role, roleHint ); + + ParameterTag paramTag = (ParameterTag) requireParent( ParameterTag.class ); + paramTag.setRequirement( requirement ); + } + + public void setRoleHint( String roleHint ) + { + this.roleHint = roleHint; + } + + public void setRole( String role ) + { + this.role = role; + } +} \ No newline at end of file Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequirementTag.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]