You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by hi...@apache.org on 2011/02/17 17:01:56 UTC

svn commit: r1071697 [41/42] - in /incubator/easyant: buildtypes/ buildtypes/trunk/ buildtypes/trunk/build-osgi-bundle-java/ buildtypes/trunk/build-osgi-bundle-java/src/ buildtypes/trunk/build-osgi-bundle-java/src/main/ buildtypes/trunk/build-osgi-bund...

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,117 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.ivy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ivy.ant.IvyTask;
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.event.IvyEvent;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.plugins.resolver.IBiblioResolver;
+import org.apache.ivy.plugins.resolver.URLResolver;
+import org.apache.ivy.plugins.trigger.AbstractTrigger;
+import org.apache.ivy.plugins.trigger.Trigger;
+import org.apache.tools.ant.Project;
+
+public class MavenPublishTrigger extends AbstractTrigger implements Trigger {
+	
+	public static final String MAVEN_PUBLISH_TRIGGER_REFERENCE ="maven.publish.trigger.ref";
+	private List<PublishedArtifact> publishedArtifacts = new ArrayList<PublishedArtifact>();
+	private String publishUrl = null;
+
+	public MavenPublishTrigger() {
+		super();
+	}
+	
+	@Override
+	public void progress(IvyEvent event) {
+	
+		Project project = (Project) IvyContext
+				.peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY);
+		if (project == null) {
+			return;
+		}
+		if (project.getReference(MAVEN_PUBLISH_TRIGGER_REFERENCE) == null) {
+			project.addReference(MAVEN_PUBLISH_TRIGGER_REFERENCE, this);
+		}
+
+		Map attributes = event.getAttributes();
+		String artifact = (String) attributes.get("artifact");
+		String artifactFile = (String) attributes.get("file");
+		String type = (String) attributes.get("type");
+		String ext = (String) attributes.get("ext");
+		String resolver = (String) attributes.get("resolver");
+		
+		PublishedArtifact publishedArtifact = new PublishedArtifact();
+		publishedArtifact.setArtifact(artifact);
+		publishedArtifact.setExt(ext);
+		publishedArtifact.setFile(artifactFile);
+		publishedArtifact.setType(type);
+		
+		publishedArtifacts.add(publishedArtifact);
+		
+		extractDeployUrl(resolver);
+
+	}
+
+	/**
+	 * @param resolver
+	 */
+	protected void extractDeployUrl(String resolver) {
+		//try to get publish url if the Resolver used to publish was a IBiblioResolver
+		if (publishUrl == null) {
+			DependencyResolver dependencyResolver = IvyContext.getContext()
+					.getSettings().getResolver(resolver);
+			if (dependencyResolver instanceof IBiblioResolver) {
+				IBiblioResolver ibiblioResolver = (IBiblioResolver) dependencyResolver;
+				publishUrl = ibiblioResolver.getRoot();
+			} else 	if (dependencyResolver instanceof URLResolver) {
+				URLResolver urlResolver = (URLResolver) dependencyResolver;
+				//get the whole pattern
+				publishUrl = (String) urlResolver.getArtifactPatterns().get(0);
+				//only keep the token root
+				publishUrl = IvyPatternHelper.getTokenRoot(publishUrl);
+				
+			}
+		}
+	}
+
+	public List<PublishedArtifact> getPublishedArtifacts() {
+		return publishedArtifacts;
+	}
+
+	public void setPublishedArtifacts(List<PublishedArtifact> publishedArtifacts) {
+		this.publishedArtifacts = publishedArtifacts;
+	}
+
+	public String getPublishUrl() {
+		return publishUrl;
+	}
+
+	public void setPublishUrl(String publishUrl) {
+		this.publishUrl = publishUrl;
+	}
+	
+	
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/MavenPublishTrigger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,62 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.ivy;
+
+public class PublishedArtifact {
+	
+	private String artifact;
+	private String type;
+	private String ext;
+	private String resolver;
+	private String file;
+	
+	public String getArtifact() {
+		return artifact;
+	}
+	public void setArtifact(String artifact) {
+		this.artifact = artifact;
+	}
+	public String getExt() {
+		return ext;
+	}
+	public void setExt(String ext) {
+		this.ext = ext;
+	}
+	public String getResolver() {
+		return resolver;
+	}
+	public void setResolver(String resolver) {
+		this.resolver = resolver;
+	}
+	public String getFile() {
+		return file;
+	}
+	public void setFile(String file) {
+		this.file = file;
+	}
+	public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/ivy/PublishedArtifact.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,141 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks;
+
+import org.apache.ivy.ant.IvyTask;
+import org.apache.ivy.plugins.trigger.AbstractTrigger;
+import org.apache.ivy.plugins.trigger.Trigger;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.util.ClasspathUtils;
+
+public class RegisterTrigger extends IvyTask {
+	private String event;
+	private String eventFilter;
+	private String className;
+	private Path classpath;
+	
+	@Override
+	public void doExecute() throws BuildException {
+		
+		Trigger trigger = (Trigger) ClasspathUtils.newInstance(getClassName(),
+				getClassLoader(), Trigger.class);
+		if (trigger instanceof AbstractTrigger) {
+			AbstractTrigger abstractTrigger = (AbstractTrigger) trigger;
+			abstractTrigger.setEvent(getEvent());
+			getSettings().addTrigger(abstractTrigger);
+			getIvyInstance().getEventManager().addIvyListener(trigger, trigger.getEventFilter());
+		}
+
+	}
+
+	public String getEvent() {
+		return event;
+	}
+
+	public void setEvent(String event) {
+		this.event = event;
+	}
+	
+	
+
+	public String getEventFilter() {
+		return eventFilter;
+	}
+
+	public void setEventFilter(String eventFilter) {
+		this.eventFilter = eventFilter;
+	}
+
+	/**
+	 * Get the classname to register
+	 * 
+	 * @return a classname
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * Set the classname to register
+	 * 
+	 * @param className
+	 *            a classname
+	 */
+	public void setClassName(String className) {
+		this.className = className;
+	}
+
+	protected AntClassLoader getClassLoader() {
+		// defining a new specialized classloader and setting it as the thread
+		// context classloader
+		AntClassLoader loader = null;
+		if (classpath != null) {
+			loader = new AntClassLoader(this.getClass().getClassLoader(),
+					getProject(), classpath, true);
+		} else {
+			loader = new AntClassLoader(this.getClass().getClassLoader(), true);
+		}
+		loader.setThreadContextLoader();
+		return loader;
+	}
+
+	/**
+	 * Get the classpath used to locate the specified classname
+	 * 
+	 * @return a classpath
+	 */
+	public Path getClasspath() {
+		return classpath;
+	}
+
+	/**
+	 * The the classpath used to locate the specified classname
+	 * 
+	 * @param classpath
+	 */
+	public void setClasspath(Path classpath) {
+		createClasspath().append(classpath);
+	}
+
+	/**
+	 * Classpath to use, by reference, when compiling the rulebase
+	 * 
+	 * @param a
+	 *            reference to an existing classpath
+	 */
+	public void setClasspathref(Reference r) {
+		createClasspath().setRefid(r);
+	}
+
+	/**
+	 * Adds a path to the classpath.
+	 * 
+	 * @return created classpath
+	 */
+	public Path createClasspath() {
+		if (this.classpath == null) {
+			this.classpath = new Path(getProject());
+		}
+		return this.classpath.createPath();
+	}
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/RegisterTrigger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,67 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import org.apache.ivy.ant.IvyPostResolveTask;
+import org.apache.maven.artifact.ant.Pom;
+import org.apache.maven.model.Model;
+import org.apache.tools.ant.BuildException;
+
+public abstract class AbstractMavenIvyAdapter extends IvyPostResolveTask {
+
+	private String pomRefId;
+	private Pom pom;
+
+	public AbstractMavenIvyAdapter() {
+		super();
+	}
+
+	public String getPomRefId() {
+		return pomRefId;
+	}
+
+	public void setPomRefId(String pomRefId) {
+		this.pomRefId = pomRefId;
+	}
+
+	public Pom getPom() {
+		if (pom == null) {
+			pom = (Pom) getProject().getReference(pomRefId);
+		}
+		return pom;
+	}
+
+	public Model getModel() {
+		return getPom().getModel();
+	}
+
+	@Override
+	protected void prepareTask() {
+		super.prepareTask();
+		if (pomRefId == null) {
+			throw new BuildException("pomRefId is required !");
+		}
+		if (getPom() == null) {
+			throw new BuildException("pomRefId references an unexisting pom instance !");
+		}
+	}
+
+
+
+}
\ No newline at end of file

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/AbstractMavenIvyAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,88 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import java.util.Iterator;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorWriter.ConfigurationScopeMapping;
+import org.apache.maven.model.Dependency;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.codehaus.plexus.util.StringUtils;
+
+public class DependencyAdapter extends AbstractMavenIvyAdapter {
+
+	private ScopeMappings scopeMapping;
+
+	@Override
+	public void doExecute() throws BuildException {
+		prepareAndCheck();
+		//create a configuration scope mapping helper with our mapping
+		ConfigurationScopeMapping configurationScopeMapping= getScopeMapping().getConfigurationScopeMapping();
+		//loop on project dependencies to build maven dependencies entries
+		for (Iterator iterator = getResolvedReport().getDependencies().iterator(); iterator.hasNext();) {
+			IvyNode node = (IvyNode) iterator.next();
+			ModuleRevisionId dependencyRevisionId =node.getResolvedId();
+			Dependency mavenDependency = new Dependency();
+			log("Building maven dependency entry with " + dependencyRevisionId.toString(), Project.MSG_DEBUG);
+			mavenDependency.setGroupId(dependencyRevisionId.getOrganisation());
+			mavenDependency.setArtifactId(dependencyRevisionId.getName());
+			mavenDependency.setVersion(dependencyRevisionId.getRevision());
+			String confToCheck = StringUtils.join(node.getRootModuleConfigurations(),", ");
+			log("Checking mapping for configuration : " + confToCheck,Project.MSG_DEBUG);
+   		 	String scope = configurationScopeMapping.getScope(node.getRootModuleConfigurations());
+            if (scope != null) {
+            	StringBuilder sb = new StringBuilder();
+            	sb.append("Mapping found for configuration ").append(confToCheck);
+            	sb.append( " with scope ").append(scope);
+            	log(sb.toString(),Project.MSG_DEBUG);
+				mavenDependency.setScope(scope);
+            }
+
+            if (configurationScopeMapping.isOptional(node.getRootModuleConfigurations())) {
+            	log("Setting " + dependencyRevisionId.toString() + " as optional" ,Project.MSG_DEBUG);
+                mavenDependency.setOptional(true);
+            }
+
+			getPom().addConfiguredDependency(mavenDependency);
+		}
+
+	}
+
+	public void add(ScopeMappings scopeMappings) {
+		this.scopeMapping= scopeMappings;
+	}
+
+
+
+	public ScopeMappings getScopeMapping() {
+		if (scopeMapping == null) {
+			scopeMapping=  new ScopeMappings();
+			scopeMapping.setProject(getProject());
+		}
+		return scopeMapping;
+	}
+
+	public void setScopeMapping(ScopeMappings scopeMapping) {
+		this.scopeMapping = scopeMapping;
+	}
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/DependencyAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,119 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import java.io.File;
+
+import org.apache.easyant.ivy.MavenPublishTrigger;
+import org.apache.easyant.ivy.PublishedArtifact;
+import org.apache.easyant.tasks.adapters.TypeMappings.Mapping;
+import org.apache.maven.artifact.ant.AttachedArtifact;
+import org.apache.maven.artifact.ant.Authentication;
+import org.apache.maven.artifact.ant.DeployTask;
+import org.apache.maven.artifact.ant.RemoteRepository;
+import org.apache.maven.settings.Server;
+import org.apache.tools.ant.Project;
+
+public class Deploy extends DeployTask {
+	
+	private TypeMappings typeMappings;
+
+	@Override
+	protected void doExecute() {
+		MavenPublishTrigger trigger =  (MavenPublishTrigger) getProject().getReference(MavenPublishTrigger.MAVEN_PUBLISH_TRIGGER_REFERENCE);
+
+		RemoteRepository repo = getRemoteRepository();
+		if (getRemoteRepository().getRefid() != null) {
+			repo = (RemoteRepository) getProject().getReference( getRemoteRepository().getRefid());
+		}
+		boolean repoUrlIsEmpty = repo.getUrl() ==null || repo.getUrl().equals("");
+		if (repoUrlIsEmpty && trigger.getPublishUrl() != null) {
+			log("No repository url was specified, will use same as ivy publication context", Project.MSG_VERBOSE);
+			log("Repository url is now set to " + trigger.getPublishUrl(),Project.MSG_VERBOSE);
+			repo.setUrl(trigger.getPublishUrl());
+		}
+		
+		//the main artifact
+		PublishedArtifact mainArtifact = trigger.getPublishedArtifacts().get(0);
+		setFile(new File(mainArtifact.getFile()));
+		for (PublishedArtifact publishedArtifact : trigger.getPublishedArtifacts()) {
+			boolean isIvyFile = "ivy".equals(publishedArtifact.getType())
+						&& "xml".equals(publishedArtifact.getExt());
+			//ignore main artifact and ivy.xml file
+			if (!(publishedArtifact.equals(mainArtifact) || isIvyFile)){
+				Mapping mapping = getTypeMappings().findTypeMappings(
+						publishedArtifact.getType(), publishedArtifact.getExt());
+				if (mapping != null) {
+					if (mapping.getMvnPackaging() != null) {
+						AttachedArtifact artifact = createAttach();
+						artifact.setFile(new File(publishedArtifact.getFile()));
+						artifact.setType(mapping.getMvnPackaging());
+						artifact.setClassifier(mapping.getClassifier());
+						
+						StringBuilder sb = new StringBuilder();
+						sb.append("publishing ").append(publishedArtifact.getFile());
+						sb.append(" type='").append(artifact.getType()).append("'");
+						if (artifact.getClassifier() != null) {
+							sb.append(" classifier='").append(artifact.getClassifier()).append("'");
+						}
+						log(sb.toString());
+					}
+				}
+			}
+		}
+		
+		super.doExecute();
+	}
+	
+	public void addTypeMappings(TypeMappings typeMappings) {
+		this.typeMappings = typeMappings;
+	}
+
+	public TypeMappings getTypeMappings() {
+		if (typeMappings == null) {
+			// create a default one
+			typeMappings = new TypeMappings();
+			typeMappings.setProject(getProject());
+		}
+
+		return typeMappings;
+	}
+
+	public void setTypeMappings(TypeMappings typeMappings) {
+		this.typeMappings = typeMappings;
+	}
+	
+	@Override
+    protected void updateRepositoryWithSettings( RemoteRepository repository )
+    {
+        if ( repository.getAuthentication() == null )
+        {
+        	Server server = getSettings().getServer( repository.getId() );
+        	if ( repository.getRefid() != null && server != null)
+             {
+        		 RemoteRepository instance = (RemoteRepository) getProject().getReference( repository.getRefid());
+        		 instance.addAuthentication( new Authentication( server ) );
+             }
+        }
+         
+        super.updateRepositoryWithSettings(repository);
+    }
+
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/Deploy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,99 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import org.apache.easyant.tasks.adapters.TypeMappings.Mapping;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+public class InfoAdapter extends AbstractMavenIvyAdapter {
+
+	private TypeMappings typeMappings;
+	private static final String DEFAULT_GROUP_ID = "org.apache.maven";
+	private static final String DEFAULT_ARTIFACT_ID = "super-pom";
+	private static final String DEFAULT_VERSION = "2.0";
+	private static final String DEFAULT_APPLICATION_NAME = "Maven Default Project";
+
+	@Override
+	public void doExecute() throws BuildException {
+		prepareAndCheck();
+
+		ModuleRevisionId mrid = getResolvedReport().getModuleDescriptor()
+				.getModuleRevisionId();
+		if (getModel().getGroupId().equals(DEFAULT_GROUP_ID)) {
+			log("Setting groupId to : " + mrid.getOrganisation(),
+					Project.MSG_DEBUG);
+			getModel().setGroupId(mrid.getOrganisation());
+		}
+		if (getModel().getName().equals(DEFAULT_APPLICATION_NAME)) {
+			log("Setting name to : " + mrid.getName(), Project.MSG_DEBUG);
+			getModel().setName(mrid.getName());
+		}
+		if (getModel().getArtifactId().equals(DEFAULT_ARTIFACT_ID)) {
+			log("Setting artifactId to : " + mrid.getName(), Project.MSG_DEBUG);
+			getModel().setArtifactId(mrid.getName());
+		}
+		if (getModel().getVersion().equals(DEFAULT_VERSION)) {
+			log("Setting version to : " + mrid.getRevision(), Project.MSG_DEBUG);
+			getModel().setVersion(mrid.getRevision());
+		}
+		if (getModel().getDescription() == null) {
+			log("Setting description to : "
+					+ getResolvedReport().getModuleDescriptor()
+							.getDescription(), Project.MSG_DEBUG);
+			getModel().setDescription(
+					getResolvedReport().getModuleDescriptor().getDescription());
+		}
+		// TODO: Handle multiple artifacts
+		if (getResolvedReport().getModuleDescriptor().getAllArtifacts().length >= 1
+				&& getResolvedReport().getModuleDescriptor().getAllArtifacts()[0] != null) {
+			Artifact artifact = (Artifact) getResolvedReport()
+					.getModuleDescriptor().getAllArtifacts()[0];
+			Mapping mapping = getTypeMappings().findTypeMappings(
+					artifact.getType(), artifact.getExt());
+			if (mapping != null) {
+				if (mapping.getMvnPackaging() != null) {
+					getModel().setPackaging(mapping.getMvnPackaging());
+				}
+			}
+		}
+
+	}
+
+	public void addTypeMappings(TypeMappings typeMappings) {
+		this.typeMappings = typeMappings;
+	}
+
+	public TypeMappings getTypeMappings() {
+		if (typeMappings == null) {
+			// create a default one
+			typeMappings = new TypeMappings();
+			typeMappings.setProject(getProject());
+		}
+
+		return typeMappings;
+	}
+
+	public void setTypeMappings(TypeMappings typeMappings) {
+		this.typeMappings = typeMappings;
+	}
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/InfoAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,142 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+
+package org.apache.easyant.tasks.adapters;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorWriter.ConfigurationScopeMapping;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+public class ScopeMappings extends DataType {
+
+	private List<Mapping> mappings = new ArrayList<Mapping>();
+	private boolean useDefault=true;
+	private boolean isDefaultMappingAlreadyLoaded=false;
+
+	public Mapping createMapping() {
+		Mapping mapping = new Mapping();
+		this.mappings.add(mapping);
+		return mapping;
+	}
+
+	public List<Mapping> getMappings() {
+		if (isReference()) {
+			return ((ScopeMappings) getRefid().getReferencedObject())
+					.getMappings();
+		} else {
+			return mappings;
+		}
+	}
+
+	public void setMappings(List<Mapping> mappings) {
+		this.mappings = mappings;
+	}
+
+	public Map<String, String> getMappingsMap() {
+		Map<String, String> mappingsMap = new HashMap<String, String>();
+
+		for (Iterator<Mapping> iter = getMappings().iterator(); iter.hasNext();) {
+			Mapping mapping = (Mapping) iter.next();
+			mappingsMap.put(mapping.getConf(), mapping.getScope());
+		}
+		return mappingsMap;
+	}
+
+	public ConfigurationScopeMapping getConfigurationScopeMapping() {
+		if (getMappings().size() == 0) {
+			log("no configurationScopeMapping found, will use the default one",
+					Project.MSG_DEBUG);
+		}
+		
+		if (getMappings().size() == 0 || isUseDefault()) {
+			createDefaultConfigurationScopeMapping();
+		}
+		return new ConfigurationScopeMapping(getMappingsMap());
+		
+	}
+
+	/**
+	 * Creates the default configuration scope mapping
+	 */
+	public void createDefaultConfigurationScopeMapping() {
+		if (!isDefaultMappingAlreadyLoaded) {
+			mappings.add(new Mapping("default", "compile"));
+			// default that extends compile
+			mappings.add(new Mapping("default, compile", "compile"));
+			// default that extends runtime
+			mappings.add(new Mapping("default, runtime", "runtime"));
+			// default that extends runtime that extends compile
+			mappings.add(new Mapping("default, compile, runtime", "compile"));
+			// runtime that extends compile
+			mappings.add(new Mapping("compile, runtime", "compile"));
+			mappings.add(new Mapping("runtime", "runtime"));
+			mappings.add(new Mapping("provided", "provided"));
+			mappings.add(new Mapping("test", "test"));
+			mappings.add(new Mapping("system", "system"));
+			isDefaultMappingAlreadyLoaded=true;
+		}
+	}
+	
+	public boolean isUseDefault() {
+		return useDefault;
+	}
+
+	public void setUseDefault(boolean useDefault) {
+		this.useDefault = useDefault;
+	}
+
+
+
+	public class Mapping {
+		private String conf;
+		private String scope;
+
+		public Mapping() {
+		}
+		
+
+		public Mapping(String conf, String scope) {
+			this.conf=conf;
+			this.scope=scope;
+		}
+
+		public String getConf() {
+			return conf;
+		}
+
+		public void setConf(String conf) {
+			this.conf = conf;
+		}
+
+		public String getScope() {
+			return scope;
+		}
+
+		public void setScope(String scope) {
+			this.scope = scope;
+		}
+	}
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/ScopeMappings.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,184 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+
+package org.apache.easyant.tasks.adapters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+public class TypeMappings extends DataType {
+	private List<Mapping> mappings = new ArrayList<Mapping>();
+	private boolean useDefault=true;
+	private boolean isDefaultMappingAlreadyLoaded=false;
+
+
+	public Mapping createMapping() {
+		if (isReference()) {
+			throw noChildrenAllowed();
+		}
+		Mapping mapping = new Mapping();
+		this.mappings.add(mapping);
+		return mapping;
+	}
+
+	public List<Mapping> getMappings() {
+		if (isReference()) {
+			return ((TypeMappings) getRefid().getReferencedObject()).getMappings();
+		} else {
+			if (mappings.size() == 0) {
+				log("No typeMappings found, or the typeMappings was empty. Creating default typeMappings",Project.MSG_DEBUG);
+			}
+			if (mappings.size() == 0 || useDefault) {
+				createDefaultTypeMapping();
+			}
+			return mappings;
+		}
+	}
+
+	public void setTypeMappings(List<Mapping> mappings) {
+		this.mappings = mappings;
+	}
+	
+	public void createDefaultTypeMapping() {
+		if (!isDefaultMappingAlreadyLoaded) {
+			// basic mapping
+			mappings.add(new Mapping("jar"));
+			mappings.add(new Mapping("war"));
+			mappings.add(new Mapping("ear"));
+			mappings.add(new Mapping("javadoc","zip","zip","javadoc"));
+			mappings.add(new Mapping("javadoc","jar","jar","javadoc"));
+			mappings.add(new Mapping("source","jar","jar","sources"));
+			mappings.add(new Mapping("test-source","jar","jar","test-sources"));
+			mappings.add(new Mapping("test-jar","jar","jar","test-jar"));
+			// default mapping doesn't take care of type/ext, but set mvnPackaging
+			// to jar
+			mappings.add(new Mapping());
+			isDefaultMappingAlreadyLoaded=true;
+		}
+	}
+
+	public Mapping findTypeMappings(String typeToMatch, String extToMatch) {
+		StringBuffer sb = new StringBuffer();
+		sb.append("Looking for TypeMapping with type=").append(typeToMatch);
+		sb.append(" and ext=").append(extToMatch);
+		getProject().log(sb.toString(), Project.MSG_DEBUG);
+		for (Mapping mapping : getMappings()) {
+			boolean typeMatches = mapping.getType().equals(typeToMatch)
+					|| mapping.getType().equals("*");
+			boolean extMatches = mapping.getExt().equals(extToMatch)
+					|| mapping.getExt().equals("*");
+			if (typeMatches && extMatches) {
+				sb = new StringBuffer();
+				sb.append("TypeMapping found for type=").append(typeToMatch);
+				sb.append(" and ext=").append(extToMatch);
+				sb.append(" Result:  mvnPackaging=").append(
+						mapping.getMvnPackaging());
+				getProject().log(sb.toString(), Project.MSG_DEBUG);
+				return mapping;
+			}
+		}
+		sb = new StringBuffer();
+		sb.append("no TypeMapping found for type=").append(typeToMatch);
+		sb.append(" and ext=").append(extToMatch);
+		getProject().log(sb.toString(), Project.MSG_DEBUG);
+		return null;
+	}
+	
+	public boolean isUseDefault() {
+		return useDefault;
+	}
+
+	public void setUseDefault(boolean useDefault) {
+		this.useDefault = useDefault;
+	}
+
+
+
+	public class Mapping {
+		private String type;
+		private String ext;
+		private String mvnPackaging;
+		private String classifier;
+
+		public Mapping() {
+			type = "*";
+			ext = "*";
+			mvnPackaging = "jar";
+			classifier=null;
+		}
+
+		public Mapping(String type) {
+			this();
+			this.type = type;
+			this.ext = type;
+			this.mvnPackaging = type;
+		}
+
+		public Mapping(String type, String ext, String mvnPackaging) {
+			this();
+			this.type = type;
+			this.ext = ext;
+			this.mvnPackaging = mvnPackaging;
+		}
+		
+		public Mapping(String type, String ext, String mvnPackaging, String classifier) {
+			this(type,ext,mvnPackaging);
+			this.classifier = classifier;
+		}
+
+
+		public String getType() {
+			return type;
+		}
+
+		public void setType(String type) {
+			this.type = type;
+		}
+
+		public String getExt() {
+			return ext;
+		}
+
+		public void setExt(String ext) {
+			this.ext = ext;
+		}
+
+		public String getMvnPackaging() {
+			return mvnPackaging;
+		}
+
+		public void setMvnPackaging(String mvnPackaging) {
+			this.mvnPackaging = mvnPackaging;
+		}
+
+		public String getClassifier() {
+			return classifier;
+		}
+
+		public void setClassifier(String classifier) {
+			this.classifier = classifier;
+		}
+		
+		
+	}
+
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/java/org/apache/easyant/tasks/adapters/TypeMappings.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+   Copyright 2008-2010 the EasyAnt project
+
+	See the NOTICE file distributed with this work for additional information
+	regarding copyright ownership.
+
+	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.
+-->
+<antlib xmlns:current="ant:current">
+	<taskdef name="dependencyAdapter" classname="org.apache.easyant.tasks.adapters.DependencyAdapter"/>
+	<taskdef name="infoAdapter" classname="org.apache.easyant.tasks.adapters.InfoAdapter"/>
+	<typedef name="scopeMappings" classname="org.apache.easyant.tasks.adapters.ScopeMappings"/>
+	<typedef name="typeMappings" classname="org.apache.easyant.tasks.adapters.TypeMappings"/>
+	<taskdef name="deploy" classname="org.apache.easyant.tasks.adapters.Deploy"/>
+
+	<taskdef name="registertrigger" classname="org.apache.easyant.tasks.RegisterTrigger"/>
+</antlib>

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/main/resources/org/apache/easyant/tasks/adapters/antlib.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,88 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import org.apache.tools.ant.BuildFileTest;
+import org.junit.Test;
+
+public class DependencyAdapterTest extends BuildFileTest {
+
+	public DependencyAdapterTest() {
+		super();
+	}
+	
+	/**
+     * Assert that the given substring is not in the log messages.
+     */
+    public void assertDebugLogNotContaining(String substring) {
+        String realLog = getFullLog();
+        assertFalse("didn't expect debug log to contain \"" + substring + "\" debug log was \""
+                    + realLog + "\"",
+                    realLog.indexOf(substring) >= 0);
+    }
+
+
+	@Override
+	protected void setUp() throws Exception {
+		configureProject("src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml");
+	}
+	
+	@Test
+	public void testBasicUsage() {
+		executeTarget("basicUsage");
+		assertDebuglogContaining("Building maven dependency entry with org.apache.ivy#ivy;2.1.0");
+		assertDebuglogContaining("Checking mapping for configuration : default, runtime");
+		assertDebuglogContaining("Mapping found for configuration default, runtime with scope runtime");
+		
+		assertDebuglogContaining("Building maven dependency entry with hsqldb#hsqldb;1.8.0.7");
+		assertDebuglogContaining("Checking mapping for configuration : default");
+		assertDebuglogContaining("Mapping found for configuration default with scope compile");
+		assertDebuglogContaining("Building maven dependency entry with junit#junit;4.4");
+		assertDebuglogContaining("Checking mapping for configuration : test");
+		assertDebuglogContaining("Mapping found for configuration test with scope test");
+		
+	}
+	
+	@Test
+	public void testCustomMapping() {
+		executeTarget("customMapping");
+		assertDebuglogContaining("Building maven dependency entry with hsqldb#hsqldb;1.8.0.7");
+		assertDebuglogContaining("Checking mapping for configuration : default");
+		assertDebuglogContaining("Mapping found for configuration default with scope compile");
+		assertDebuglogContaining("Building maven dependency entry with junit#junit;4.4");
+		assertDebuglogContaining("Checking mapping for configuration : test");
+		assertDebuglogContaining("Mapping found for configuration test with scope test");
+	
+	}
+
+	
+	@Test
+	public void testWithoutPomRef() {
+		expectBuildException("withoutPomRef", "pomRefId is required !");
+			
+	}
+	
+	@Test
+	public void testWrongPomRef() {
+		expectBuildException("wrongPomRef", "pomRefId references an unexisting pom instance !");
+			
+	}
+
+	
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/DependencyAdapterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,107 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks.adapters;
+
+import org.apache.tools.ant.BuildFileTest;
+import org.junit.Test;
+
+public class InfoAdapterTest extends BuildFileTest {
+
+	public InfoAdapterTest() {
+		super();
+	}
+	
+	/**
+     * Assert that the given substring is not in the log messages.
+     */
+    public void assertDebugLogNotContaining(String substring) {
+        String realLog = getFullLog();
+        assertFalse("didn't expect debug log to contain \"" + substring + "\" debug log was \""
+                    + realLog + "\"",
+                    realLog.indexOf(substring) >= 0);
+    }
+
+
+	@Override
+	protected void setUp() throws Exception {
+		configureProject("src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml");
+	}
+	
+	@Test
+	public void testBasicUsage() {
+		executeTarget("basicUsage");
+		assertDebuglogContaining("Setting groupId to : org.mycompany");
+		assertDebuglogContaining("Setting name to : myProject");
+		assertDebuglogContaining("Setting artifactId to : myProject");
+
+		assertDebuglogContaining("Setting version to : 0.1");
+
+		assertDebuglogContaining("Setting description to : foobar description");
+
+		assertDebuglogContaining("No typeMappings found, or the typeMappings was empty. Creating default typeMappings");
+
+		assertDebuglogContaining("Looking for TypeMapping with type=jar and ext=jar");
+		assertDebuglogContaining("TypeMapping found for type=jar and ext=jar Result:  mvnPackaging=jar");
+	}
+	
+	@Test
+	public void testCustomMapping() {
+		executeTarget("customMapping");
+		assertDebuglogContaining("Setting groupId to : org.mycompany");
+		assertDebuglogContaining("Setting name to : myProject");
+		assertDebuglogContaining("Setting artifactId to : myProject");
+
+		assertDebuglogContaining("Setting version to : 0.1");
+
+		assertDebuglogContaining("Setting description to : foobar description");
+		assertDebugLogNotContaining("No typeMappings found, or the typeMappings was empty. Creating default typeMappings");
+
+		assertDebuglogContaining("Looking for TypeMapping with type=jar and ext=jar");
+		assertDebuglogContaining("TypeMapping found for type=jar and ext=jar Result:  mvnPackaging=myPackaging");
+	}
+
+	@Test
+	public void testContainingMvnMetadata() {
+		executeTarget("containingMvnMetadata");
+		//those three information are already set by the <pom> task 
+		assertDebugLogNotContaining("Setting groupId to : org.mycompany");
+		assertDebugLogNotContaining("Setting artifactId to : myProject");
+		assertDebugLogNotContaining("Setting version to : 0.1");
+		
+		assertDebuglogContaining("Setting name to : myProject");
+
+		assertDebuglogContaining("Setting description to : foobar description");
+		assertDebuglogContaining("Looking for TypeMapping with type=jar and ext=jar");
+		assertDebuglogContaining("TypeMapping found for type=jar and ext=jar Result:  mvnPackaging=jar");
+	}
+	
+	@Test
+	public void testWithoutPomRef() {
+		expectBuildException("withoutPomRef", "pomRefId is required !");
+			
+	}
+	
+	@Test
+	public void testWrongPomRef() {
+		expectBuildException("wrongPomRef", "pomRefId references an unexisting pom instance !");
+			
+	}
+
+	
+}

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/java/org/apache/easyant/tasks/adapters/InfoAdapterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,33 @@
+<project name="maven-ivy-adapters-test" xmlns:mvn="antlib:org.apache.maven.artifact.ant" xmlns:mavenivy="antlib:org.apache.easyant.tasks.adapters" xmlns:ivy="antlib:org.apache.ivy.ant">
+
+
+	<target name="basicUsage">
+		<ivy:resolve file="ivy.xml"/>
+
+		<mvn:pom id="mypom" />
+		<mavenivy:dependencyAdapter pomRefId="mypom"/>
+	</target>
+
+	<target name="customMapping">
+		<ivy:resolve file="ivy.xml"/>
+
+		<mvn:pom id="mypom" />
+		<mavenivy:dependencyAdapter pomRefId="mypom">
+			<mavenivy:scopeMappings>
+				<mapping conf="default" scope="compile"/>
+				<mapping conf="test" scope="test"/>
+			</mavenivy:scopeMappings>
+		</mavenivy:dependencyAdapter>
+	</target>
+
+	<target name="withoutPomRef">
+		<ivy:resolve file="ivy.xml"/>
+		<mavenivy:dependencyAdapter pomRefId="mypom"/>
+	</target>
+
+	<target name="wrongPomRef">
+		<ivy:resolve file="ivy.xml"/>
+		<mavenivy:dependencyAdapter/>
+	</target>
+
+</project>
\ No newline at end of file

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,38 @@
+<!--
+	Copyright 2008-2010 the EasyAnt project
+	
+	See the NOTICE file distributed with this work for additional information 
+	regarding copyright ownership.
+	
+	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.  
+-->
+<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
+	<info organisation="org.mycompany" module="myProject" revision="0.1" status="integration" >
+		<description>
+			foobar description
+		</description>
+	</info>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime"/>
+		<conf name="runtime" extends="compile"/>
+		<conf name="compile" />
+		
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
+	</configurations>
+	<dependencies>
+		<dependency org="hsqldb" name="hsqldb" rev="1.8.0.7" conf="default"/>
+		<dependency org="org.apache.ivy" name="ivy" rev="2.1.0" conf="runtime"/>
+		<dependency org="junit" name="junit" rev="4.4" conf="test->default" />
+
+	</dependencies>
+</ivy-module>

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/DependencyAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,39 @@
+<project name="maven-ivy-adapters-test" xmlns:mvn="antlib:org.apache.maven.artifact.ant" xmlns:mavenivy="antlib:org.apache.easyant.tasks.adapters" xmlns:ivy="antlib:org.apache.ivy.ant">
+
+
+	<target name="basicUsage">
+		<ivy:resolve file="ivy.xml"/>
+
+		<mvn:pom id="mypom" />
+		<mavenivy:infoAdapter pomRefId="mypom"/>
+	</target>
+
+	<target name="customMapping">
+		<ivy:resolve file="ivy.xml"/>
+
+		<mvn:pom id="mypom" />
+		<mavenivy:infoAdapter pomRefId="mypom">
+			<typeMappings>
+				<mapping type="jar" mvnPackaging="myPackaging"/>
+			</typeMappings>
+		</mavenivy:infoAdapter>
+	</target>
+
+	<target name="containingMvnMetadata">
+		<ivy:resolve file="ivy.xml"/>
+
+		<mvn:pom id="mypom" groupId="myGroupId" artifactId="foobar" version="1.0" />
+		<mavenivy:infoAdapter pomRefId="mypom"/>
+	</target>
+
+	<target name="withoutPomRef">
+		<ivy:resolve file="ivy.xml"/>
+		<mavenivy:infoAdapter pomRefId="mypom"/>
+	</target>
+
+	<target name="wrongPomRef">
+		<ivy:resolve file="ivy.xml"/>
+		<mavenivy:infoAdapter/>
+	</target>
+
+</project>
\ No newline at end of file

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml (added)
+++ incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,34 @@
+<!--
+	Copyright 2008-2010 the EasyAnt project
+	
+	See the NOTICE file distributed with this work for additional information 
+	regarding copyright ownership.
+	
+	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.  
+-->
+<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
+	<info organisation="org.mycompany" module="myProject" revision="0.1" status="integration" >
+		<description>
+			foobar description
+		</description>
+	</info>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/>
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
+	</configurations>
+	<dependencies>
+		<dependency org="hsqldb" name="hsqldb" rev="1.8.0.7" conf="default->default"/>
+		<dependency org="junit" name="junit" rev="4.4" conf="test->default" />
+
+	</dependencies>
+</ivy-module>

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/mavenivy-adapters/src/test/resources/org/apache/easyant/tasks/adapters/InfoAdapter/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy (added)
+++ incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy Thu Feb 17 17:01:07 2011
@@ -0,0 +1,20 @@
+<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
+	<info organisation="org.apache.easyant.tasks" module="partial-jnlp-task" 
+			status="integration" revision="0.1">
+		<description>
+			This task is used to modify existing jnlp file.
+		</description>
+		<ea:build module="build-std-java" revision="0.2"/>
+		<ea:property name="project.ivy.instance" value="easyant.ivy.instance"/>
+		<ea:property name="shared.resolver" value="easyant-modules"/>
+		<ea:property name="release.resolver" value="easyant-modules"/>
+	</info>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies artifact can be used with this conf"/>
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
+		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
+	</configurations>
+	<dependencies>
+		<dependency org="org.apache.ant" name="ant" rev="1.7.1" conf="provided->default"/>
+	</dependencies>
+</ivy-module>

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/module.ivy
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java (added)
+++ incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,331 @@
+/* 
+ *  Copyright 2008-2009 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  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.
+ */
+package org.apache.easyant.tasks;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.util.FileUtils;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+/**
+ * <p>
+ * This task is used to modify existing jnlp file.
+ * It modifies only the resources part of the file and nothing else. 
+ * (useful to make the dependencies inside).
+ * If a resources part already exists the program add just new jar entries, don't remove them.  
+ * </p>
+ * <p>
+ * There are three ways for resolving path with this task:
+ * </p>
+ * <ul>
+ * 	<li> Automatic path resolution (default)</li>
+ *  <li> Flat path resolution</li>
+ *  <li> Relative path resolution</li>
+ * </ul>
+ * <p>
+ * 	<b>The automatic path resolution</b> generates uri's corresponding to the fileset paths.<br/>
+ *  <b>The flat path resolution</b> permits to specify in hard the prefix for the path, it is useful if you want deploy the jnlp on a distant server.
+ *  <p>
+ *  	If the flat path value is http://myserver.com
+ *  	The Task will modify the jnlp file like that:
+ *  	{@literal  
+ *  		<resources>
+ *  			<jar href="http://myserver.com/myDependecy1.jar"/>
+ *  			<jar href="http://myserver.com/myDependecy2.jar"/>
+ *  		</resources>
+ *  	} 
+ *  </p>
+ *  <br/>
+ *  <b>The relative path resolution</b> generates path in relative corresponding to the fileset paths.<br/>
+ * </p>
+ * 
+ * @version 1.0
+ * 
+ */
+public class JNLPTask extends Task {
+
+	private Vector<FileSet> filesets = new Vector<FileSet>();
+
+	private static final String JAR_ENTITY = "jar";
+	private static final String RESOURCES_ENTITY = "resources";
+	private static final String DOM_IMPLEMENTATION = "LS";
+	private static final String PRETTY_PRINT_FORMAT = "format-pretty-print";
+	private static final String HREF_ATTRIBUTE = "href";
+	private static final String DOWNLOAD_ATTRIBUTE = "download";
+	private static final String MAIN_ATTRIBUTE = "main";
+
+	private String mainjar = null;
+	private String jnlpFile = null;
+	private String flatPath = null;
+	private final String tmpFile = "tmp.xml";
+	private PathType pathType = PathType.AUTOMATIC;
+
+
+
+	@Override
+	public synchronized void execute() throws BuildException {
+		validate();
+		log("JNLP modification...");
+		try {
+			DOMImplementationRegistry domRegistry = DOMImplementationRegistry
+					.newInstance();
+			DOMImplementationLS domImpl = (DOMImplementationLS) domRegistry
+					.getDOMImplementation(DOM_IMPLEMENTATION);
+
+			LSParser jnlpBuilder = domImpl.createLSParser(
+					DOMImplementationLS.MODE_SYNCHRONOUS, null);
+			Document jnlpDoc = jnlpBuilder.parseURI(jnlpFile);
+
+			Node root = null;
+			for (int i = 0; i < jnlpDoc.getChildNodes().getLength(); i++) {
+				if (jnlpDoc.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
+					root = jnlpDoc.getChildNodes().item(i);
+					break;
+				}
+			}
+			NodeList nodeList = root.getChildNodes();
+
+			if (nodeList.getLength() > 0) {
+				for (int i = 0; i < nodeList.getLength(); i++) {
+					if (RESOURCES_ENTITY.equals(nodeList.item(i).getNodeName())) {
+						root.removeChild(nodeList.item(i));
+					}
+				}
+			}
+			Element resourcesElement = jnlpDoc.createElement(RESOURCES_ENTITY);
+			root.appendChild(resourcesElement);
+
+			appendAllResources(jnlpDoc, resourcesElement);
+			LSOutput lsOutput = domImpl.createLSOutput();
+			lsOutput.setByteStream(new FileOutputStream(new File(tmpFile)));
+			LSSerializer serializer = domImpl.createLSSerializer();
+			serializer.getDomConfig().setParameter(PRETTY_PRINT_FORMAT, true);
+			serializer.write(jnlpDoc, lsOutput);
+			replaceFile(new File(tmpFile), new File(jnlpFile));
+			log("JNLP modification done !");
+		} catch (IOException e) {
+			throw new BuildException(e.getMessage());
+		} catch (ClassCastException e) {
+			throw new BuildException(e.getMessage());
+		} catch (ClassNotFoundException e) {
+			throw new BuildException(e.getMessage());
+		} catch (InstantiationException e) {
+			throw new BuildException(e.getMessage());
+		} catch (IllegalAccessException e) {
+			throw new BuildException(e.getMessage());
+		} catch (DOMException e) {
+			throw new BuildException(e.getMessage());
+		} catch (Exception e) {
+			throw new BuildException(e.getMessage());
+		}
+
+	}
+
+	private void validate() throws BuildException {
+
+		// less one resources has to be setted.
+		if (null == this.filesets || this.filesets.isEmpty()) {
+			throw new BuildException("the parameter filesets can not be empty");
+		}
+
+		// mainjar can't be empty or null
+		if (null == mainjar || "".equals(mainjar)) {
+			throw new BuildException("the parameter mainjar have to be setted");
+		}
+
+		// jnlp can't null or not exist
+		if (null == jnlpFile) {
+			throw new BuildException("the parameter jnlpFile have to be setted");
+		}
+
+		if (!(new File(jnlpFile).exists())) {
+			throw new BuildException("the jnlpFile " + jnlpFile
+					+ " doesn't exist");
+		}
+
+		if (flatPath != null) {
+			pathType = PathType.FLAT;
+		} else {
+			pathType = PathType.AUTOMATIC;
+		}
+		
+		// check if the main jar parameter is included in the resources and if
+		// the resources exists.
+		for (FileSet currentResource : filesets) {
+
+			for (File currentFile : currentResource.getDir().listFiles()) {
+
+				if (checkDirectories(currentResource, currentFile)) {
+					if (!currentFile.exists()) {
+						throw new BuildException("the resource: "
+								+ currentFile.getAbsolutePath()
+								+ " doesnot exists !");
+					}
+
+				}
+			}
+		}
+		if (!new File(mainjar).exists()) {
+			throw new BuildException("the mainJar does not exists");
+		}
+
+	}
+
+	private void replaceFile(File src, File dest) throws IOException {
+		FileUtils.delete(dest);
+		FileUtils.getFileUtils().copyFile(src, dest);
+	}
+
+	
+	private void appendElement(File currentFile, Document document,
+			Element rootElement, boolean main) throws DOMException, Exception {
+		Element currentElement = document.createElement(JAR_ENTITY);
+
+		currentElement.setAttribute(HREF_ATTRIBUTE, computePath(currentFile,
+				pathType));
+		 // TODO: the download attribute should be parameterizable => lazy or eager, from the moment it's only "eager".
+		currentElement.setAttribute(DOWNLOAD_ATTRIBUTE, "eager");
+
+		if (main) {
+			currentElement.setAttribute(MAIN_ATTRIBUTE, "true");
+		} else {
+			currentElement.setAttribute(MAIN_ATTRIBUTE, "false");
+		}
+
+		rootElement.appendChild(currentElement);
+	}
+
+	private void appendAllResources(Document jnlpDoc, Element element)
+			throws DOMException, Exception {
+
+		appendElement(new File(mainjar), jnlpDoc, element, true);
+
+		for (FileSet currentResource : filesets) {
+
+			for (File currentFile : currentResource.getDir().listFiles()) {
+				if (checkDirectories(currentResource, currentFile)) {
+					appendElement(currentFile, jnlpDoc, element, false);
+				}
+			}
+
+		}
+	}
+
+	private String computePath(File currentFile, PathType type)
+			throws Exception {
+		switch (type) {
+		case FLAT:
+			return computeFlat(currentFile);
+		default:
+			return computeAutomatic(currentFile);
+		}
+	}
+
+
+
+	private String computeFlat(File currentFile) {
+
+		String finalPath = null;
+		
+		int separatorPos = flatPath.lastIndexOf(File.separator);
+		
+		if (separatorPos == flatPath.length() - 1) {
+			finalPath = flatPath+currentFile.getName();
+		} else {
+			finalPath = flatPath+File.separator + currentFile.getName();
+		}
+		
+		
+		
+		return finalPath;
+	}
+
+	private String computeAutomatic(File currentFile) {
+		return currentFile.toURI().toString();
+	}
+
+	private boolean checkDirectories(FileSet fileset, File file) {
+		for (String fileName : fileset.getDirectoryScanner().getIncludedFiles()) {
+			if (file.getName().equals(fileName)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Set the jar resources to include inside the jnlp.
+	 * 
+	 * @param fileset
+	 *            the resources to include inside the jnlp.
+	 */
+	public void addConfiguredFileset(FileSet fileset) {
+		filesets.add(fileset);
+
+	}
+
+	/**
+	 * Set the main jar file (that contain the main class to load).
+	 * 
+	 * @param mainjar
+	 *            the main jar file (that contain the main class to load).
+	 */
+	public void setMainJar(String mainjar) {
+		this.mainjar = mainjar;
+	}
+
+	/**
+	 * Set the jnlp file to modify.
+	 * 
+	 * @param jnlpFile
+	 *            the jnlp file to modify.
+	 */
+	public void setJnlpFile(String jnlpFile) {
+		this.jnlpFile = jnlpFile;
+	}
+
+	/**
+	 * Force the resources path in the jnlp file.
+	 * 
+	 * @param flatPath
+	 *            the prefix path to use.
+	 */
+	public void setFlatPathResources(String flatPath) {
+		this.flatPath = flatPath;
+	}
+	
+	private enum PathType {
+		FLAT, AUTOMATIC;
+	}
+}

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml (added)
+++ incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml Thu Feb 17 17:01:07 2011
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+   Copyright 2008-2009 the EasyAnt project
+
+	See the NOTICE file distributed with this work for additional information 
+	regarding copyright ownership.
+	
+	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.
+-->
+<antlib xmlns:current="ant:current">
+	<typedef name="jnlp" classname="org.apache.easyant.tasks.JNLPTask"/>
+</antlib>

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy (added)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy Thu Feb 17 17:01:07 2011
@@ -0,0 +1,19 @@
+<ivy-module version="2.0" xmlns:ea="http://www.easyant.org">
+	<info organisation="org.apache.easyant.tasks" module="xooki-menu-generator"
+			status="integration" revision="0.1">
+		<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2">
+            <ea:property name="project.ivy.instance" value="easyant.ivy.instance"/>
+            <ea:property name="shared.resolver" value="easyant-shared-modules"/>
+		</ea:build>
+	</info>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies artifact can be used with this conf"/>
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
+		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
+	</configurations>
+	<dependencies>
+		<dependency org="org.apache.easyant" name="easyant-core" rev="latest.integration" conf="provided->default"/>
+		<dependency org="org.apache.ant" name="ant" rev="1.8.1" conf="provided->default"/>
+		<dependency org="junit" name="junit" rev="4.4" conf="test->default"/>
+	</dependencies>
+</ivy-module>

Propchange: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy
------------------------------------------------------------------------------
    svn:mime-type = text/xml