summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/implementation-jee
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-22 16:52:57 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-22 16:52:57 +0000
commit76f33c9cd9b1ca39509e9ca956d5596901138df2 (patch)
tree9d2aee2a548c2b9eae0ad741e0895b6235d17cf9 /branches/sca-java-1.x/modules/implementation-jee
parent0552a30cb71d1ecf4209d88a0d0c2306e149f532 (diff)
TUSCANY-3052 - Correct the way that JEEImplementations are represented so that they appear as composites. In that way an application composite, when present, can naturally be included in the component hierarchy. When an application composite isn't present then the composite is created on the fly based on the information from the introspected archive.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@777618 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-jee')
-rw-r--r--branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java4
-rw-r--r--branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java6
-rw-r--r--branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java63
3 files changed, 42 insertions, 31 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java
index 90b71223b4..779ac976ee 100644
--- a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java
+++ b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java
@@ -18,14 +18,14 @@
*/
package org.apache.tuscany.sca.implementation.jee;
-import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Composite;
/**
* The model representing a JEE implementation in an SCA assembly model.
*
* @version $Rev$ $Date$
*/
-public interface JEEImplementation extends Implementation {
+public interface JEEImplementation extends Composite {
/**
* Returns the archive.
diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java
index 4d16dbf35d..39f3c12816 100644
--- a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java
+++ b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java
@@ -19,7 +19,7 @@
package org.apache.tuscany.sca.implementation.jee.impl;
import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
/**
@@ -27,7 +27,7 @@ import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
*
* @version $Rev$ $Date$
*/
-public class JEEImplementationImpl extends ImplementationImpl implements JEEImplementation {
+public class JEEImplementationImpl extends CompositeImpl implements JEEImplementation {
private String archive;
@@ -56,4 +56,6 @@ public class JEEImplementationImpl extends ImplementationImpl implements JEEImpl
public void setArchive(String archive) {
this.archive = archive;
}
+
+
}
diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
index 072394df75..53bc9fab32 100644
--- a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
+++ b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
@@ -185,21 +185,19 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
unresolved.setUri(URI.create("WEB-INF/web.composite"));
ModelObject resolved = resolver.resolveModel(ModelObject.class, unresolved);
if(resolved != unresolved) {
- // Found web composite
+ // Found web composite so the war itself must have been the contribution
Composite appComposite = (Composite)resolved.getObject();
- implementation.getServices().addAll(appComposite.getServices());
- implementation.getReferences().addAll(appComposite.getReferences());
- implementation.getProperties().addAll(appComposite.getProperties());
+ mergeCompositeInfo(appComposite, implementation);
}
// TODO: Obtain includeDefaults value from the composite
boolean includeDefaults = false;
if(includeDefaults || resolved == unresolved) {
+ // there is either no application composite or we are ignoring it as the
+ // war is nested inside another contribution
if(jeeOptionalExtension != null) {
- ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((WebModuleInfo)moduleInfo);
- implementation.getReferences().addAll(ct.getReferences());
- implementation.getProperties().addAll(ct.getProperties());
+ jeeOptionalExtension.createImplementationJeeComposite((WebModuleInfo)moduleInfo, implementation);
}
}
} else if(moduleInfo instanceof EjbModuleInfo) {
@@ -208,11 +206,9 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
unresolved.setUri(URI.create("META-INF/ejb-jar.composite"));
ModelObject resolved = resolver.resolveModel(ModelObject.class, unresolved);
if(resolved != unresolved) {
- // Found ejb-jar composite
+ // Found ejb-jar composite so the ejb jar itself must have been the contribution
Composite appComposite = (Composite)resolved.getObject();
- implementation.getServices().addAll(appComposite.getServices());
- implementation.getReferences().addAll(appComposite.getReferences());
- implementation.getProperties().addAll(appComposite.getProperties());
+ mergeCompositeInfo(appComposite, implementation);
}
// TODO: Obtain includeDefaults value from the composite
@@ -220,14 +216,11 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
if(includeDefaults || resolved == unresolved) {
if(jeeExtension != null) {
- ComponentType ct = jeeExtension.createImplementationJeeComponentType((EjbModuleInfo)moduleInfo);
- implementation.getServices().addAll(ct.getServices());
+ jeeExtension.createImplementationJeeComposite((EjbModuleInfo)moduleInfo, implementation);
+
}
if(jeeOptionalExtension != null) {
- ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((EjbModuleInfo)moduleInfo);
- implementation.getServices().addAll(ct.getServices());
- implementation.getReferences().addAll(ct.getReferences());
- implementation.getProperties().addAll(ct.getProperties());
+ jeeOptionalExtension.createImplementationJeeComposite((EjbModuleInfo)moduleInfo, implementation);
}
}
} else if(moduleInfo instanceof JavaEEApplicationInfo) {
@@ -246,10 +239,9 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
}
if(appComposite != null) {
- // Found application composite
- implementation.getServices().addAll(appComposite.getServices());
- implementation.getReferences().addAll(appComposite.getReferences());
- implementation.getProperties().addAll(appComposite.getProperties());
+ // Found application composite so copy it's details across into
+ // the implementation (which is itself a composite)
+ mergeCompositeInfo(appComposite, implementation);
}
// TODO: Obtain includeDefaults value from the composite
@@ -257,20 +249,37 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
if(includeDefaults || appComposite == null) {
if(jeeExtension != null) {
- ComponentType ct = jeeExtension.createImplementationJeeComponentType((JavaEEApplicationInfo)moduleInfo);
- implementation.getServices().addAll(ct.getServices());
+ jeeExtension.createImplementationJeeComposite((JavaEEApplicationInfo)moduleInfo, implementation);
}
if(jeeOptionalExtension != null) {
- ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((JavaEEApplicationInfo)moduleInfo);
- implementation.getServices().addAll(ct.getServices());
- implementation.getReferences().addAll(ct.getReferences());
- implementation.getProperties().addAll(ct.getProperties());
+ jeeOptionalExtension.createImplementationJeeComposite((JavaEEApplicationInfo)moduleInfo, implementation);
}
}
}
}
implementation.setUnresolved(false);
}
+
+ private void mergeCompositeInfo(Composite fromComposite, Composite intoComposite){
+ intoComposite.getApplicablePolicySets().addAll(fromComposite.getApplicablePolicySets());
+ intoComposite.getAttributeExtensions().addAll(fromComposite.getAttributeExtensions());
+ intoComposite.setAutowire(fromComposite.getAutowire());
+ intoComposite.getComponents().addAll(fromComposite.getComponents());
+ intoComposite.setConstrainingType(fromComposite.getConstrainingType());
+ intoComposite.getExtensions().addAll(fromComposite.getExtensions());
+ intoComposite.setLocal(fromComposite.isLocal());
+ intoComposite.getIncludes().addAll(fromComposite.getIncludes());
+ intoComposite.setName(fromComposite.getName());
+ intoComposite.getPolicySets().addAll(fromComposite.getPolicySets());
+ intoComposite.getProperties().addAll(fromComposite.getProperties());
+ intoComposite.getReferences().addAll(fromComposite.getReferences());
+ intoComposite.getRequiredIntents().addAll(fromComposite.getRequiredIntents());
+ intoComposite.getServices().addAll(fromComposite.getServices());
+ intoComposite.setType(fromComposite.getType());
+ intoComposite.setUnresolved(fromComposite.isUnresolved());
+ intoComposite.setURI(fromComposite.getURI());
+ intoComposite.getWires().addAll(fromComposite.getWires());
+ }
public void write(JEEImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {