You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@multitask.com.au on 2003/05/01 05:04:44 UTC
Re: cvs commit: maven-new/core/src/java/org/apache/maven/artifact
ArtifactVerifier.java ArtifactListProcessor.java
DefaultArtifactListProcessor.java DefaultArtifact.java Artifact.java
DefaultArtifactFactory.java RepositoryLayout.java ArtifactHandler.java
DefaultRepositoryLayout.java DefaultArtifactVerifier.java
ArtifactFactory.java
Hey Michal,
as the resident commit message reader and critic, can you please make the
descriptions a little more descriptive?
--
dIon Gillard, Multitask Consulting
Blog: http://www.freeroller.net/page/dion/Weblog
Work: http://www.multitask.com.au
michal@apache.org wrote on 30/04/2003 06:29:41 PM:
> michal 2003/04/30 01:29:40
>
> Added: core/src/java/org/apache/maven/artifact/handlers
> JarHandler.java PluginHandler.java
> core/src/java/org/apache/maven/artifact
> ArtifactVerifier.java ArtifactListProcessor.java
> DefaultArtifactListProcessor.java
> DefaultArtifact.java Artifact.java
> DefaultArtifactFactory.java
RepositoryLayout.java
> ArtifactHandler.java
DefaultRepositoryLayout.java
> DefaultArtifactVerifier.java
ArtifactFactory.java
> Log:
> added to repository
>
> Revision Changes Path
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/handlers/JarHandler.java
>
> Index: JarHandler.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact.handlers;
>
> import org.apache.maven.artifact.Artifact;
> import org.apache.maven.artifact.ArtifactHandler;
> import org.apache.maven.project.Project;
>
> /**
> * Artifact Handler resposible of processing
> * artifacts of type like jars, ejb, etc.
> * Artifact path is appended to build class path
> *
> * @todo implement me!
> *
> * @author Michal Maczka
> * @version $Revision: 1.1 $ $Date: 2003/04/30 08:29:39 $
> */
> public class JarHandler implements ArtifactHandler
> {
>
> /**
> * @see org.apache.maven.artifact.ArtifactHandler#process(org.
> apache.maven.artifact.Artifact, org.apache.maven.project.Project)
> */
> public void process(Artifact artifact, Project project)
> {
> project.setDependencyPath(artifact.getName(),
artifact.getPath());
> }
>
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/handlers/PluginHandler.java
>
> Index: PluginHandler.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact.handlers;
>
> import org.apache.maven.artifact.Artifact;
> import org.apache.maven.artifact.ArtifactHandler;
> import org.apache.maven.project.Project;
>
> /**
> * {@link ArtifactHandler} for Maven Plugins
> *
> * @todo implement me!
> *
> * @author Michal Maczka
> * @version $Revision: 1.1 $ $Date: 2003/04/30 08:29:39 $
> */
> public class PluginHandler implements ArtifactHandler
> {
> /**
> * @see org.apache.maven.artifact.ArtifactHandler#process(org.
> apache.maven.artifact.Artifact, org.apache.maven.project.Project)
> */
> public void process(Artifact artifact, Project project)
> {
> }
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/ArtifactVerifier.java
>
> Index: ArtifactVerifier.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import org.apache.maven.verifier.ChecksumVerificationException;
>
> /**
> * The interface defining an artifact (which probably lives in the
> * repository).
> *
> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> * @version $Id: ArtifactVerifier.java,v 1.1 2003/04/30 08:29:40
michal Exp $
> */
> public interface ArtifactVerifier
> {
> void verify(Artifact artifact) throws
ChecksumVerificationException;
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/ArtifactListProcessor.java
>
> Index: ArtifactListProcessor.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import org.apache.maven.project.Project;
>
> /**
> * Class resposible to convert information kept in
> * the {@link Project} into the list of artifacts.
> *
> * @author <a href="mailto:michal.maczka@dimatics.com">Michal
Maczka</a>
> * @version $Id: ArtifactListProcessor.java,v 1.1 2003/04/30 08:29:
> 40 michal Exp $
> */
> public interface ArtifactListProcessor
> {
> public static final String ROLE =
ArtifactListProcessor.class.getName();
>
> /**
> * Return an list of artifacts based on the information kept in
> the Project.
> * There is one to one relation between project's dependiencies
> and artifacts
> * and currently for each dependecy one artifact should created.
> *
> *
> * @param project The project for which the artifact list will
> be resolved
> * @return The list contating resolved artifacts.
> */
> public void processArtifacts(Project project) throws Exception;
>
> }
>
>
>
> 1.1 maven-
>
new/core/src/java/org/apache/maven/artifact/DefaultArtifactListProcessor.java
>
> Index: DefaultArtifactListProcessor.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> F* SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.File;
> import java.io.InputStream;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.Properties;
>
> import org.apache.avalon.framework.activity.Initializable;
> import org.apache.maven.MavenConstants;
> import org.apache.maven.MavenException;
> import org.apache.maven.project.Project;
>
> /**
> * Simple factory for creating Artifact implementations based on a
dependency
> * type.
> *
> * @author <a href="mailto:michal.maczka@dimatics.com">Michal
Maczka</a>
> * @version $Id: DefaultArtifactListProcessor.java,v 1.1 2003/04/30
> 08:29:40 michal Exp $
> */
> public class DefaultArtifactListProcessor
> implements Initializable, ArtifactListProcessor
> {
>
> /**
> * Maps type to its handler Object
> */
> private Map cachedGlobalHandlers = new HashMap();
>
> /**
> * Configuraation file.
> * We will lazy load handlers. Once we need one
> * for given type we will instattiate it
> * and put to cachedGlobalHandlers map
> */
> private Properties globalHandlers = null;
>
> //
----------------------------------------------------------------------
> // Lifecycle Management
> //
----------------------------------------------------------------------
>
> /**
> * @see
org.apache.avalon.framework.activity.Initializable#initialize()
> */
> public void initialize() throws Exception
> {
> InputStream inputStream = null;
> File configFile = null;
> try
> {
> Class clazz = DefaultArtifactListProcessor.class;
> inputStream =
> clazz.getResourceAsStream(
> MavenConstants.ARTIFACT_HANDLER_PROPERTIES);
> globalHandlers = new Properties();
> globalHandlers.load(inputStream);
> }
> catch (Exception e)
> {
> String message = "Cannot read global layout.properties
file";
> throw new MavenException(message, e);
> }
> finally
> {
> if (inputStream != null)
> {
> try
> {
> inputStream.close();
> }
> catch (Exception e)
> {
> }
> }
> }
> }
>
> /**
> * @see org.apache.maven.artifact.
> ArtifactListProcessor#processArtifacts(org.apache.maven.project.Project)
> */
> public void processArtifacts(Project project) throws Exception
> {
> List artifacts = project.getArtifacts();
> for (Iterator iter = artifacts.iterator(); iter.hasNext();)
> {
> Artifact artifact = (Artifact) iter.next();
> String type = artifact.getType();
> ArtifactHandler artifactHandler = getHandler(type);
> if (artifactHandler != null)
> {
> artifactHandler.process(artifact, project);
> }
> }
> }
>
> /**
> * @param type
> * @return
> */
> private ArtifactHandler getHandler(String type) throws Exception
> {
> if (cachedGlobalHandlers.containsKey(type))
> {
> return (ArtifactHandler) cachedGlobalHandlers.get(type);
> }
> String handlerClassname = globalHandlers.getProperty(type);
> if (handlerClassname == null)
> {
> return null;
> }
> Class clazz = Class.forName(handlerClassname);
> ArtifactHandler artifactHandler = (ArtifactHandler) clazz.
> newInstance();
> cachedGlobalHandlers.put(type, artifactHandler);
> return artifactHandler;
> }
>
> }
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/DefaultArtifact.java
>
> Index: DefaultArtifact.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.File;
>
> import org.apache.maven.MavenConstants;
> import org.apache.maven.project.Dependency;
>
> /**
> * The default implemenation of {@link Artifact}
> * interface
> *
> * @author <a href="jason@zenplex.com">Jason van Zyl</a>
> * @version $Id: DefaultArtifact.java,v 1.1 2003/04/30 08:29:40 michal
Exp $
> */
>
> public class DefaultArtifact implements Artifact {
>
> /** Platform specific file separator used for file system
operations. */
> protected final static String PATH_SEPARATOR = File.separator;
>
> /**
> * The id of this artifact
> */
> private String id;
>
> /**
> *
> *The group id for the artifact.
> */
> private String groupId;
>
> /**
> * Version of this artifact
> */
> private String version;
>
> /**
> * Type such as "jar" or "war"
> */
> private String type;
>
> /**
> * The artifact file.
> */
> private File file;
>
> /**
> *
> * Assocaiated dependency
> */
> private Dependency dependency = null;
>
> /**
> * @see org.apache.maven.artifact.Artifact#setId(java.lang.String)
> */
> public void setId(String id) {
> this.id = id;
>
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getId()
> */
> public String getId() {
> return id;
> }
>
> /**
> * @see
org.apache.maven.artifact.Artifact#setGroupId(java.lang.String)
> */
> public void setGroupId(String groupId) {
> this.groupId = groupId;
>
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getGroupId()
> */
> public String getGroupId() {
> return groupId;
> }
>
> /**
> * @see
org.apache.maven.artifact.Artifact#setVersion(java.lang.String)
> */
> public void setVersion(String version) {
> this.version = version;
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getVersion()
> */
> public String getVersion() {
> return version;
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getType()
> */
> public String getType() {
>
> return type;
> }
>
> /**
> * @see
org.apache.maven.artifact.Artifact#setType(java.lang.String)
> */
> public void setType(String type) {
> this.type = type;
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getPath()
> */
> public String getPath() {
> return PATH_SEPARATOR + getFile();
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getUrlPath()
> */
> public String getUrlPath() {
>
> return "/" + getFile();
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getChecksumUrl()
> */
> public String getChecksumUrl() {
> return getUrlPath() + ".md5";
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#isSnapshot()
> */
> public boolean isSnapshot() {
> return getVersion().endsWith(MavenConstants.SNAPSHOT_SIGNIFIER);
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#exists()
> */
> public boolean exists() {
> if (getFile().exists()) {
> return true;
> }
> else {
> return false;
> }
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getFile()
> */
> public File getFile() {
> return file;
> }
>
> /**
> * @see
org.apache.maven.artifact.Artifact#setFile(java.lang.String)
> */
> public void setFile(String file) {
> setFile(new File(file));
>
> }
>
> /**
> * @ see org.apache.maven.artifact.Artifact #
setFile(java.lang.String)
> */
> public void setFile(File file) {
> this.file = file;
>
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getDependency()
> */
> public Dependency getDependency() {
>
> return dependency;
> }
>
> /**
> * @see org.apache.maven.artifact.Artifact#getName()
> */
> public String getName() {
> return getGroupId() + ":" + getId();
> }
> /**
> * @see org.apache.maven.artifact.Artifact#setDependency(null)
> */
> public void setDependency(Dependency dependency) {
> this.dependency = dependency;
> }
>
> }
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/Artifact.java
>
> Index: Artifact.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.File;
>
> import org.apache.maven.project.Dependency;
>
> /**
> * The interface defining an artifact (which probably lives in the
> * repository).
> *
> *
> * @author <a href="jason@zenplex.com">Jason van Zyl</a>
> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> * @version $Id: Artifact.java,v 1.1 2003/04/30 08:29:40 michal Exp $
> */
> public interface Artifact {
>
> /**
> * Set the dependency for this JAR artifact.
> *
> * @param dependency Dependency this artifact is based on.
> */
> void setDependency(Dependency dependency);
>
> /**
> * Get the dependency.
> *
> * @return The dependency this artifact is based on.
> */
> Dependency getDependency();
>
> /**
> * Set id
> * @param id Id of the artifact
> */
> void setId(String id);
>
> /**
> * Get id
> * @return id of this artifact
> */
> String getId();
>
> /**
> * Set the group id.
> *
> * @param groupId Group id for the artifact.
> */
> void setGroupId(String groupId);
>
> /**
> * Get the group id.
> *
> * @return The group id for the artifact.
> */
> String getGroupId();
>
> /**
> * Set the version for this artifact.
> *
> * @param version Version for this artifact
> */
> void setVersion(String version);
>
> /**
> * Get the version of this artifact.
> *
> * @return Version of this artifact
> */
> String getVersion();
>
> /**
> * Get the type of the artifact.
> *
> * @return dependency type such as "compile" or "test"
> */
> String getType();
>
> /**
> * Sets the dependency type such as "compile" or "test"
> *
> * @param type The type of artifact.
> */
> void setType(String type);
>
> /**
> * Set the path to the artifact. The maven jar override facilty can
be
> * used to change the path to the artifact if the user specifies
the
> * use of a specific version.
> *
> * @param path Path to the artifact.
> */
> void setFile(String file);
>
> /**
> * Return a path that is platform agnostic.
> *
> * @return URL of the artifact.
> */
> String getPath();
>
> /**
> * Return an URL path that is platform agnostic.
> *
> * @return URL of the artifact.
> */
> String getUrlPath();
>
> /**
> * Return the url to the checksum file for this artifact.
> *
> * @return URL of the checksum file for this artifact.
> */
> String getChecksumUrl();
>
> /**
> * Boolean flag indicating whether this artifact is a snapshot.
> *
> * @return Flag indicating whether this artifact is a snapshot.
> */
> boolean isSnapshot();
>
> /**
> * Boolean flag indicating whether this artifact exists.
> *
> * @return Flag indicating the existance of the artifact in the
> local repository.
> */
> boolean exists();
>
> /**
> * Get the location of the artifact in the local file system.
> *
> * @return The location of the artifact in the local file system.
> */
> File getFile();
>
> /**
> * Returns "groupId:id"
> *
> * @return "groupId:id"
> */
> String getName();
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/DefaultArtifactFactory.java
>
> Index: DefaultArtifactFactory.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> F* SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.File;
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
>
> import org.apache.avalon.framework.service.ServiceException;
> import org.apache.avalon.framework.service.ServiceManager;
> import org.apache.avalon.framework.service.Serviceable;
> import org.apache.maven.project.Dependency;
> import org.apache.maven.project.Project;
>
> /**
> * Simple factory for creating Artifact implementations based on a
dependency
> * type.
> *
> * @author <a href="mailto:michal.maczka@dimatics.com">Michal
Maczka</a>
> * @version $Id: DefaultArtifactFactory.java,v 1.1 2003/04/30 08:29:
> 40 michal Exp $
> */
> public class DefaultArtifactFactory
> implements Serviceable, ArtifactFactory
> {
>
> private RepositoryLayout repositoryLayout = null;
>
> /**
> * Return an appropriate Artifact implementation based on the
dependency
> * type.
> *
> * @param dependency The base dependency.
> * @return The appropriate artifact based on the dependency type.
> */
> public List createArtifacts(Project project) throws Exception
> {
> List dependencies = project.getDependencies();
> List artifacts = new ArrayList();
> boolean mavenJarOverride = project.getMavenJarOverride().
> booleanValue();
> for (Iterator iter = dependencies.iterator(); iter.hasNext();)
> {
> Dependency dependency = (Dependency) iter.next();
> if (dependency.getType() == null
> || dependency.getType().trim().length() == 0)
> {
> dependency.setType("jar");
> }
> Artifact artifact = new DefaultArtifact();
> artifact.setDependency(dependency);
> artifact.setId(dependency.getArtifactId());
> artifact.setGroupId(dependency.getArtifactDirectory());
> artifact.setType(dependency.getType());
>
> // JAR OVERRIDING
> String mavenJarProperty =
> project.getMavenJarOverride(
> Project.standardToLegacyId(dependency.getId()));
>
> String path = null;
> String version = dependency.getVersion();
>
> if (mavenJarOverride
> && mavenJarProperty != null
> && mavenJarProperty.length() > 0)
> {
> // The jar override option has been set and we have a
property
> // for the this dependency so override the path with
the user
> // specified value.
> if (Character.isDigit(mavenJarProperty.charAt(0)))
> {
> // User is requesting a specific version of a
dependency
> // be used.
> version = mavenJarProperty;
> }
> else
> {
> // User is requesting a specific path to a
dependency
> // be used.
> path = new
File(mavenJarProperty).getAbsolutePath();
> }
> }
> artifact.setVersion(version);
> if (path == null)
> {
> path = generatePath(artifact);
> }
> artifact.setFile(path);
> artifacts.add(artifact);
> }
> return artifacts;
> }
>
> /**
> * @param artifact
> * @return
> */
> private String generatePath(Artifact artifact) throws Exception
> {
> return repositoryLayout.generatePath(artifact);
> }
>
> //
----------------------------------------------------------------------
> // Lifecycle Management
> //
----------------------------------------------------------------------
>
> /**
> * @see org.apache.avalon.framework.service.
> Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
> */
> public void service(ServiceManager serviceManager) throws
ServiceException
> {
> repositoryLayout =
> (RepositoryLayout)
serviceManager.lookup(RepositoryLayout.ROLE);
> }
>
> }
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/RepositoryLayout.java
>
> Index: RepositoryLayout.java
> ===================================================================
> package org.apache.maven.artifact;
>
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
>
> /**
> * <code>RepositoryLayout</code> describes how artifacts are to
> * be arranged in a user's local repository.
> *
> * @author <a href="jason@zenplex.com">Jason van Zyl</a>
> * @version $Id: RepositoryLayout.java,v 1.1 2003/04/30 08:29:40
michal Exp $
> */
> public interface RepositoryLayout
> {
>
> public static final String ROLE = RepositoryLayout.class.getName();
>
> /**
> *
> * @param artifact
> * @return
> */
> String generatePath(Artifact artifact) throws Exception;
>
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/ArtifactHandler.java
>
> Index: ArtifactHandler.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import org.apache.maven.project.Project;
>
> /**
> * The interface defining a contract for the class
> * resposible to process artifact
> *
> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> * @version $Id: ArtifactHandler.java,v 1.1 2003/04/30 08:29:40 michal
Exp $
> */
> public interface ArtifactHandler
> {
> /**
> *
> * @param artifact
> */
> void process(Artifact artifact, Project project);
>
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/DefaultRepositoryLayout.java
>
> Index: DefaultRepositoryLayout.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.File;
> import java.io.InputStream;
> import java.util.Properties;
>
> import org.apache.avalon.framework.activity.Initializable;
> import org.apache.maven.MavenConstants;
> import org.apache.maven.MavenException;
> import org.apache.plexus.util.StringUtils;
>
> /**
> * The standard {@link org.apache.maven.repository.RepositoryLayout}
> * implementation.
> *
> * @author <a href="jason@zenplex.com">Jason van Zyl</a>
> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> * @version $Id: DefaultRepositoryLayout.java,v 1.1 2003/04/30 08:
> 29:40 michal Exp $
> */
> public class DefaultRepositoryLayout implements Initializable,
> RepositoryLayout
> {
>
> private final static String DEFAULT_LAYOUT =
> "${groupId}/${type}s/${id}-${version}.${type}";
>
> /**
> * List of cachedGlobalLayouts.
> */
> private Properties globalLayouts = new Properties();
>
> public String generatePath(Artifact artifact) throws Exception
> {
> // see if we have layout for this artifact type alredy in the
cache
> String type = artifact.getType();
> String layout = (String) globalLayouts.get(type);
> if (layout == null)
> {
> layout = DEFAULT_LAYOUT;
> globalLayouts.put(type,layout);
> }
> // interpolation of layout
> layout = StringUtils.replace(layout, "${id}", artifact.
> getId());
> layout =
> StringUtils.replace(layout, "${groupId}",
artifact.getGroupId());
>
> layout = StringUtils.replace(layout, "${type}",
artifact.getType());
> layout =
> StringUtils.replace(layout, "${version}",
artifact.getVersion());
> return layout;
> }
>
> //
----------------------------------------------------------------------
> // Lifecycle Management
> //
----------------------------------------------------------------------
>
> /**
> * @see
org.apache.avalon.framework.activity.Initializable#initialize()
> */
> public void initialize() throws Exception
> {
> InputStream inputStream = null;
> File configFile = null;
> try
> {
> inputStream =
> DefaultRepositoryLayout.class.getResourceAsStream(
> MavenConstants.LAYOUT_PROPERTIES);
> globalLayouts.load(inputStream);
> }
> catch (Exception e)
> {
> String message = "Cannot read global layout.properties
file";
> throw new MavenException(message, e);
> }
> finally
> {
> if (inputStream != null)
> {
> try
> {
> inputStream.close();
> }
> catch (Exception e)
> {
> }
> }
> }
> }
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/DefaultArtifactVerifier.java
>
> Index: DefaultArtifactVerifier.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.io.BufferedInputStream;
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.IOException;
> import java.io.InputStream;
>
> import org.apache.maven.util.I18NUtils;
> import org.apache.maven.util.MD5Sum;
> import org.apache.maven.verifier.ChecksumVerificationException;
>
> /**
> * The interface defining an artifact (which probably lives in the
> * repository).
> *
> * @author <a href="jason@zenplex.com">Jason van Zyl</a>
> * @version $Id: DefaultArtifactVerifier.java,v 1.1 2003/04/30 08:
> 29:40 michal Exp $
> */
> public class DefaultArtifactVerifier
> {
>
> //
----------------------------------------------------------------------
> // C H E C K S U M V E R I F I C A T I O N
> //
----------------------------------------------------------------------
>
> public void verify(Artifact artifact) throws
ChecksumVerificationException
> {
>
> File artifactFile = artifact.getFile();
> File checksumFile = new File(artifactFile.getName() + ".md5");
>
> // The central repository is not fully populated with md5
> // checksum files yet so we'll be a little lax right now but
> // hopefully in the future we can differentiate or specify
> // repositories whose artifacts must undergo verification.
> if (checksumFile.exists() == false)
> {
> return;
> }
>
> String actualChecksum = null;
> MD5Sum md5 = null;
> try
> {
> md5 = new MD5Sum();
> md5.setFile(artifactFile);
> md5.execute();
>
> actualChecksum = fileRead(checksumFile);
> actualChecksum =
> actualChecksum.substring(0, actualChecksum.length() -
1);
> }
> catch (Exception e)
> {
> return;
> }
> System.out.println("'" + actualChecksum + "'");
> System.out.println("'" + md5.getChecksum() + "'");
> if (actualChecksum.equals(md5.getChecksum()) == false)
> {
> throw new ChecksumVerificationException(
> I18NUtils.getMessage(
> "checksum.verification.error",
> artifact.getPath()));
> }
> }
>
> /**
> * Reads the contents of a file.
> *
> * @param file The name of the file to read.
> * @return The file contents or null if read failed.
> */
> private String fileRead(File file) throws IOException
> {
> InputStream in = null;
> try
> {
> StringBuffer buf = new StringBuffer();
> in = new BufferedInputStream(new FileInputStream(file));
> int count;
> byte[] b = new byte[512];
> while ((count = in.read(b)) > 0) // blocking read
> {
> buf.append(new String(b, 0, count));
> }
> return buf.toString();
> }
> finally
> {
> if (in != null)
> {
> in.close();
> }
> }
> }
>
> }
>
>
>
> 1.1 maven-
> new/core/src/java/org/apache/maven/artifact/ArtifactFactory.java
>
> Index: ArtifactFactory.java
> ===================================================================
> /*
====================================================================
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 2002 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above
copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software
itself,
> * if and wherever such third-party acknowledgments normally
appear.
> *
> * 4. The names "Apache" and "Apache Software Foundation" and
> * "Apache MavenSession" must not be used to endorse or promote
products
> * derived from this software without prior written permission. For
> * written permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * "Apache MavenSession", nor may "Apache" appear in their name,
without
> * prior written permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> *
====================================================================
> */
> package org.apache.maven.artifact;
>
> import java.util.List;
>
> import org.apache.maven.project.Project;
>
> /**
> * Class resposible for converting {@link Project}'s list
> * of dependicies into the list of artifacts.
> *
> * @author <a href="mailto:michal.maczka@dimatics.com">Michal
Maczka</a>
> * @version $Id: ArtifactFactory.java,v 1.1 2003/04/30 08:29:40 michal
Exp $
> */
> public interface ArtifactFactory
> {
>
> public static final String ROLE = ArtifactFactory.class.getName();
>
> /**
> * Return an list of artifacts based on the information kept in
> the Project.
> * There is one to one relation between project's dependiencies
> and artifacts
> * and currently for each dependecy one artifact should created.
> *
> *
> * @param project The project for which the artifact list will
> be resolved
> * @return The list contating resolved artifacts.
> */
> public List createArtifacts(Project project) throws Exception;
>
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
RE: cvs commit: maven-new/core/src/java/org/apache/maven/artifact ArtifactVerifier.java ArtifactListProcessor.java DefaultArtifactListProcessor.java DefaultArtifact.java Artifact.java DefaultArtifactFactory.java RepositoryLayout.java ArtifactHandler.java
Posted by Michal Maczka <mm...@interia.pl>.
> -----Original Message-----
> From: dion@multitask.com.au [mailto:dion@multitask.com.au]
> Sent: Thursday, May 01, 2003 5:05 AM
> To: Maven Developers List
> Subject: Re: cvs commit:
> maven-new/core/src/java/org/apache/maven/artifact
> ArtifactVerifier.java ArtifactListProcessor.java
> DefaultArtifactListProcessor.java DefaultArtifact.java
> Artifact.java DefaultArtifactFactory.java RepositoryLayout.java
> ArtifactHandler.java
>
>
> Hey Michal,
>
> as the resident commit message reader and critic, can you please make the
> descriptions a little more descriptive?
> --
> dIon Gillard, Multitask Consulting
> Blog: http://www.freeroller.net/page/dion/Weblog
> Work: http://www.multitask.com.au
>
>
Hey Dion,
Well I will do my best next time...
Simply I believed that when you commit to CVS all you have to do is to
describe the change you did to a file.
Since I just added file to repository...I just supplied information "added
to repository".
regards
Michal
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org