Author: meerajk
Date: Sun Sep 17 04:00:06 2006
New Revision: 447045
URL: http://svn.apache.org/viewvc?view=rev&rev=447045
Log:
Added code for transitive dependencies.
Modified:
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
Modified:
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java?view=diff&rev=447045&r1=447044&r2=447045
==============================================================================
---
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
(original)
+++
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
Sun Sep 17 04:00:06 2006
@@ -19,24 +19,66 @@
package org.apache.tuscany.spi.services.artifact;
import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
/**
* Description of some packaged artifact such as a JAR file or a Composite.
- *
+ *
* @version $Rev$ $Date$
*/
public class Artifact {
+
+ /* Artifact group */
private String group;
+
+ /* Artifact name */
private String name;
+
+ /* Artifact version */
private String version;
+
+ /* Artifact classifier */
private String classifier;
+
+ /* Artifact type */
private String type;
+
+ /* Artifact url */
private URL url;
+ /* Transitive dependencies */
+ private Set<Artifact> dependencies = new HashSet<Artifact>();
+
+ /**
+ * Adds a transitive dependency to the artifact.
+ * @param artifact Dependency to be added.
+ */
+ public void addDependency(Artifact artifact) {
+ dependencies.add(artifact);
+ }
+
+ /**
+ * Gets the URLs for all the transitive dependencies.
+ * @return Sets of URLs for all the transitive dependencies.
+ */
+ public Set<URL> getUrls() {
+
+ Set<URL> urls = new HashSet<URL>();
+
+ for (Artifact artifact : dependencies) {
+ urls.add(artifact.getUrl());
+ }
+ urls.add(getUrl());
+
+ return urls;
+
+ }
+
/**
- * Returns the name of a logical grouping to which this artifact belongs.
- * For example, this might represent the original publisher of the
artifact.
- *
+ * Returns the name of a logical grouping to which this artifact belongs.
For example, this might represent the original publisher of the
+ * artifact.
+ *
* @return the name of a logical grouping to which this artifact belongs
*/
public String getGroup() {
@@ -45,8 +87,9 @@
/**
* Sets the name of a logical grouping to which this artifact belongs.
- *
- * @param group the name of a logical grouping to which this artifact
belongs
+ *
+ * @param group
+ * the name of a logical grouping to which this artifact belongs
*/
public void setGroup(String group) {
this.group = group;
@@ -54,7 +97,7 @@
/**
* Returns the name of an artifact.
- *
+ *
* @return the name of an artifact
*/
public String getName() {
@@ -63,8 +106,9 @@
/**
* Sets the name of an artifact.
- *
- * @param name the name of an artifact
+ *
+ * @param name
+ * the name of an artifact
*/
public void setName(String name) {
this.name = name;
@@ -72,7 +116,7 @@
/**
* Returns the version of an artifact.
- *
+ *
* @return the version of an artifact
*/
public String getVersion() {
@@ -81,19 +125,18 @@
/**
* Sets the version of an artifact.
- *
- * @param version the version of an artifact
+ *
+ * @param version
+ * the version of an artifact
*/
public void setVersion(String version) {
this.version = version;
}
/**
- * Returns a way of classifying an artifact.
- * This can be used to distinguish variants of an artifact that provide
the same function
- * but which may have platform specific requirements. For example, it may
contain the name
- * of a hardware platform for artifacts that contain native code.
- *
+ * Returns a way of classifying an artifact. This can be used to
distinguish variants of an artifact that provide the same function but which may
+ * have platform specific requirements. For example, it may contain the
name of a hardware platform for artifacts that contain native code.
+ *
* @return a way of classifying an artifact
*/
public String getClassifier() {
@@ -102,8 +145,9 @@
/**
* Sets a way of classifying an artifact
- *
- * @param classifier a way of classifying an artifact
+ *
+ * @param classifier
+ * a way of classifying an artifact
*/
public void setClassifier(String classifier) {
this.classifier = classifier;
@@ -111,7 +155,7 @@
/**
* Returns the type of artifact.
- *
+ *
* @return the type of artifact
*/
public String getType() {
@@ -120,7 +164,9 @@
/**
* Sets the type of artifact.
- * @param type the type of artifact
+ *
+ * @param type
+ * the type of artifact
*/
public void setType(String type) {
this.type = type;
@@ -128,7 +174,7 @@
/**
* Returns a URL from which the artifact can be obtained.
- *
+ *
* @return a URL from which the artifact can be obtained
*/
public URL getUrl() {
@@ -137,8 +183,9 @@
/**
* Sets a URL from which the artifact can be obtained.
- *
- * @param url a URL from which the artifact can be obtained
+ *
+ * @param url
+ * a URL from which the artifact can be obtained
*/
public void setUrl(URL url) {
this.url = url;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]