summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/workspace-impl
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-22 22:49:55 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-22 22:49:55 +0000
commit023a43d56c8af3f8aa7516b9b3b03bbe0d84ef2b (patch)
treedcb91796490834c99a16628855fb82ed07976910 /java/sca/modules/workspace-impl
parentb354c03aecb7f30bfd65f0ec02a81ab915ba4966 (diff)
Merge r767683 from 1.x branch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@767701 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/workspace-impl')
-rw-r--r--java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java42
-rw-r--r--java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java48
2 files changed, 47 insertions, 43 deletions
diff --git a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
index 9a16553460..da8f957d9e 100644
--- a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
+++ b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
@@ -6,15 +6,15 @@
* to you 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.
+ * under the License.
*/
package org.apache.tuscany.sca.workspace.processor.impl;
@@ -53,7 +53,7 @@ import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
/**
* URLArtifactProcessor that handles contribution files and the artifacts they contain
* and returns a contribution model.
- *
+ *
* @version $Rev$ $Date$
*/
public class ContributionContentProcessor implements URLArtifactProcessor<Contribution>{
@@ -76,7 +76,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
this.scanners = extensionPoints.getExtensionPoint(ContributionScannerExtensionPoint.class);
}
-
+
/*
public ContributionContentProcessor(FactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers,
URLArtifactProcessor<Object> artifactProcessor, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
@@ -89,17 +89,17 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
this.monitor = monitor;
}
*/
-
+
public String getArtifactType() {
return ".contribution/content";
}
-
+
public Class<Contribution> getModelType() {
return Contribution.class;
}
-
+
public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
-
+
// Create contribution model
Contribution contribution = contributionFactory.createContribution();
contribution.setURI(contributionURI.toString());
@@ -117,7 +117,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
scanner = new JarContributionScanner();
}
}
-
+
// Scan the contribution and list the artifacts contained in it
List<Artifact> artifacts = contribution.getArtifacts();
boolean contributionMetadata = false;
@@ -131,7 +131,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
artifact.setLocation(artifactURL.toString());
artifacts.add(artifact);
modelResolver.addModel(artifact);
-
+
// Read each artifact
Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
if (model != null) {
@@ -147,10 +147,12 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
contribution.getImports().addAll(c.getImports());
contribution.getExports().addAll(c.getExports());
contribution.getDeployables().addAll(c.getDeployables());
+ contribution.getExtensions().addAll(c.getExtensions());
+ contribution.getAttributeExtensions().addAll(c.getAttributeExtensions());
}
}
}
-
+
// If no sca-contribution.xml file was provided then just consider
// all composites in the contribution as deployables
if (!contributionMetadata) {
@@ -167,24 +169,24 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
DefaultExport defaultExport = contributionFactory.createDefaultExport();
contribution.getExports().add(defaultExport);
}
-
+
return contribution;
}
-
+
public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
-
+
// Resolve the contribution model itself
ModelResolver contributionResolver = contribution.getModelResolver();
contribution.setUnresolved(false);
contributionResolver.addModel(contribution);
-
+
// Resolve imports and exports
for (Export export: contribution.getExports()) {
if (export instanceof DefaultExport) {
-
+
// Initialize the default export's resolver
export.setModelResolver(contributionResolver);
-
+
} else {
extensionProcessor.resolve(export, contributionResolver);
}
@@ -192,7 +194,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
for (Import import_: contribution.getImports()) {
extensionProcessor.resolve(import_, contributionResolver);
}
-
+
// Resolve all artifact models
for (Artifact artifact : contribution.getArtifacts()) {
Object model = artifact.getModel();
@@ -204,7 +206,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
}
}
}
-
+
// Resolve deployable composites
List<Composite> deployables = contribution.getDeployables();
for (int i = 0, n = deployables.size(); i < n; i++) {
diff --git a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
index 6b7fc2f259..3af692c52c 100644
--- a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
+++ b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
@@ -6,15 +6,15 @@
* to you 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.
+ * under the License.
*/
package org.apache.tuscany.sca.workspace.processor.impl;
@@ -55,7 +55,7 @@ import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
/**
* URLArtifactProcessor that handles contribution files and returns a contribution
* info model.
- *
+ *
* @version $Rev$ $Date$
*/
public class ContributionInfoProcessor implements URLArtifactProcessor<Contribution>{
@@ -76,7 +76,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
this.extensionProcessor = extensionProcessor;
this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
}
-
+
public ContributionInfoProcessor(FactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor) {
this.modelFactories = modelFactories;
this.modelResolvers = modelResolvers;
@@ -84,17 +84,17 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
this.artifactProcessor = artifactProcessor;
this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
}
-
+
public String getArtifactType() {
return ".contribution/info";
}
-
+
public Class<Contribution> getModelType() {
return null;
}
-
+
public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
-
+
// Create contribution model
Contribution contribution = contributionFactory.createContribution();
contribution.setURI(contributionURI.toString());
@@ -110,7 +110,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
} else {
scanner = new JarContributionScanner();
}
-
+
// Read generated and user sca-contribution.xml files
boolean contributionMetadata = false;
for (String path: new String[]{
@@ -127,14 +127,16 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
continue;
}
contributionMetadata = true;
-
+
// Read the sca-contribution.xml file
ContributionMetadata c = (ContributionMetadata)artifactProcessor.read(contributionURL, URI.create(path), url);
contribution.getImports().addAll(c.getImports());
contribution.getExports().addAll(c.getExports());
contribution.getDeployables().addAll(c.getDeployables());
+ contribution.getExtensions().addAll(c.getExtensions());
+ contribution.getAttributeExtensions().addAll(c.getAttributeExtensions());
}
-
+
// If no sca-contribution.xml file was provided then consider
// all composites in the contribution as deployables, and also
// read any files that are explicitly asssigned artifact processors
@@ -160,10 +162,10 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
}
if (read) {
URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
-
+
// Read each artifact
Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
-
+
// In the absence of more info, consider all composites as deployable
if (model instanceof Composite) {
contribution.getDeployables().add((Composite)model);
@@ -171,7 +173,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
}
}
}
-
+
// Add default contribution import and export
DefaultImport defaultImport = contributionFactory.createDefaultImport();
defaultImport.setModelResolver(new DefaultModelResolver());
@@ -179,24 +181,24 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
DefaultExport defaultExport = contributionFactory.createDefaultExport();
contribution.getExports().add(defaultExport);
}
-
+
return contribution;
}
-
+
public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
-
+
// Mark the contribution model resolved
ModelResolver contributionResolver = contribution.getModelResolver();
contribution.setUnresolved(false);
contributionResolver.addModel(contribution);
-
+
// Resolve imports and exports
for (Export export: contribution.getExports()) {
if (export instanceof DefaultExport) {
-
+
// Initialize the default export's resolver
export.setModelResolver(contributionResolver);
-
+
} else {
extensionProcessor.resolve(export, contributionResolver);
}
@@ -204,12 +206,12 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut
for (Import import_: contribution.getImports()) {
extensionProcessor.resolve(import_, contributionResolver);
}
-
+
}
/**
* FIXME Temporary hack for testing the ClassLoaderModelResolver.
- *
+ *
* @param modelResolvers
*/
private static void hackResolvers(ModelResolverExtensionPoint modelResolvers) {