You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by pa...@apache.org on 2011/09/01 15:50:25 UTC
svn commit: r1164081 - in /incubator/ace/trunk:
ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/
ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/
ace-deployment-provider-base/src/m...
Author: pauls
Date: Thu Sep 1 13:50:25 2011
New Revision: 1164081
URL: http://svn.apache.org/viewvc?rev=1164081&view=rev
Log:
Add extra artifact metadata to generated deployment packages so that we can recreate the path of artifact->feature->distribution (ACE-178).
Modified:
incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/DeploymentArtifact.java
incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
incubator/ace/trunk/ace-deployment-provider-base/src/main/java/org/apache/ace/deployment/provider/impl/ArtifactDataImpl.java
Modified: incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/DeploymentArtifact.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/DeploymentArtifact.java?rev=1164081&r1=1164080&r2=1164081&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/DeploymentArtifact.java (original)
+++ incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/object/DeploymentArtifact.java Thu Sep 1 13:50:25 2011
@@ -42,6 +42,8 @@ public interface DeploymentArtifact {
*/
public static final String DIRECTIVE_KEY_BASEURL = "Base-Url";
+ public static final String REPOSITORY_PATH = "ACE-RepositoryPath";
+
/**
* @return the URL for this deployment artifact.
*/
Modified: incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java?rev=1164081&r1=1164080&r2=1164081&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java (original)
+++ incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java Thu Sep 1 13:50:25 2011
@@ -19,6 +19,7 @@
package org.apache.ace.client.repository.stateful.impl;
import java.io.IOException;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -27,6 +28,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -468,6 +470,7 @@ public class StatefulGatewayRepositoryIm
Map<ArtifactObject, String> bundles = new HashMap<ArtifactObject, String>();
Map<ArtifactObject, String> artifacts = new HashMap<ArtifactObject, String>();
+ Map<ArtifactObject, Map<GroupObject, List<LicenseObject>>> path = new HashMap<ArtifactObject, Map<GroupObject,List<LicenseObject>>>();
// First, find all basic bundles and artifacts. An while we're traversing the
// tree of objects, build the tree of properties.
@@ -481,6 +484,17 @@ public class StatefulGatewayRepositoryIm
else {
artifacts.put(artifact, artifact.getProcessorPID());
}
+ Map<GroupObject, List<LicenseObject>> groupToLicense = path.get(artifact);
+ if (groupToLicense == null) {
+ groupToLicense = new HashMap<GroupObject, List<LicenseObject>>();
+ path.put(artifact, groupToLicense);
+ }
+ List<LicenseObject> licenses = groupToLicense.get(group);
+ if (licenses == null) {
+ licenses = new ArrayList<LicenseObject>();
+ groupToLicense.put(group, licenses);
+ }
+ licenses.add(license);
}
}
}
@@ -519,6 +533,12 @@ public class StatefulGatewayRepositoryIm
}
directives.put(DeploymentArtifact.DIRECTIVE_KEY_BASEURL, bundle.getURL());
+
+ String repositoryPath = getRepositoryPath(bundle, path);
+ if (repositoryPath != null) {
+ directives.put(DeploymentArtifact.REPOSITORY_PATH, repositoryPath);
+ }
+
result.add(m_deploymentRepository.createDeploymentArtifact(bundle.getURL(), directives));
}
@@ -526,11 +546,33 @@ public class StatefulGatewayRepositoryIm
Map<String, String> directives = new HashMap<String, String>();
directives.put(DeploymentArtifact.DIRECTIVE_KEY_PROCESSORID, artifact.getProcessorPID());
directives.put(DeploymentArtifact.DIRECTIVE_KEY_BASEURL, artifact.getURL());
+
+ String repositoryPath = getRepositoryPath(artifact, path);
+ if (repositoryPath != null) {
+ directives.put(DeploymentArtifact.REPOSITORY_PATH, repositoryPath);
+ }
result.add(m_deploymentRepository.createDeploymentArtifact(m_artifactRepository.preprocessArtifact(artifact, go, gatewayID, version), directives));
}
return result.toArray(new DeploymentArtifact[result.size()]);
}
+
+ private String getRepositoryPath(ArtifactObject artifact, Map<ArtifactObject, Map<GroupObject, List<LicenseObject>>> path) {
+ StringBuilder builder = new StringBuilder();
+ Map<GroupObject, List<LicenseObject>> groupToLicense = path.get(artifact);
+ if (groupToLicense != null) {
+ for (Entry<GroupObject, List<LicenseObject>> entry : groupToLicense.entrySet()) {
+ for (LicenseObject l : entry.getValue()) {
+ builder.append(entry.getKey().getName()).append(';').append(l.getName()).append(',');
+ }
+ }
+ }
+ else {
+ return null;
+ }
+ builder.setLength(builder.length() - 1);
+ return builder.toString();
+ }
/**
* Quick method to find all artifacts that need to be deployed to a gateway.
Modified: incubator/ace/trunk/ace-deployment-provider-base/src/main/java/org/apache/ace/deployment/provider/impl/ArtifactDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-deployment-provider-base/src/main/java/org/apache/ace/deployment/provider/impl/ArtifactDataImpl.java?rev=1164081&r1=1164080&r2=1164081&view=diff
==============================================================================
--- incubator/ace/trunk/ace-deployment-provider-base/src/main/java/org/apache/ace/deployment/provider/impl/ArtifactDataImpl.java (original)
+++ incubator/ace/trunk/ace-deployment-provider-base/src/main/java/org/apache/ace/deployment/provider/impl/ArtifactDataImpl.java Thu Sep 1 13:50:25 2011
@@ -186,7 +186,11 @@ public class ArtifactDataImpl implements
a.putValue(CUSTOMIZER, "true");
}
}
-
+
+ String path = m_directives.get(DeploymentArtifact.REPOSITORY_PATH);
+ if (path != null) {
+ a.putValue(DeploymentArtifact.REPOSITORY_PATH, path);
+ }
if (!hasChanged() && fixPackage) {
a.putValue("DeploymentPackage-Missing", "true");
}