summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/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/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/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/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee')
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java44
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java10
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java12
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java67
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java90
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java94
6 files changed, 277 insertions, 40 deletions
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java
new file mode 100644
index 0000000000..f486b63904
--- /dev/null
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package org.apache.tuscany.sca.contribution.jee;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBImplementationGenerated extends Implementation {
+
+ /**
+ * Returns the EJB link URI.
+ * @return the EJB link URI
+ */
+ String getEJBLink();
+
+ /**
+ * Sets the EJB link URI.
+ * @param ejbLink the EJB link URI
+ */
+ void setEJBLink(String ejbLink);
+
+}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java
index a78448521f..7b7d1f161f 100644
--- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.contribution.jee;
import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
/**
* Compute componentType with EJB3 business interfaces translating into SCA services.
@@ -26,7 +27,12 @@ import org.apache.tuscany.sca.assembly.ComponentType;
* @version $Rev$ $Date$
*/
public interface JavaEEExtension {
+ // The EJBImplementation model is a straight implementation so we deal in
+ // component types
ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName);
- ComponentType createImplementationJeeComponentType(EjbModuleInfo ejbModule);
- ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo);
+
+ // The JEEImplemenation model is a composite and so we have to fluff
+ // up the composite contents to match the JEE artifact
+ void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite);
+ void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite);
}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java
index 3461b149e4..50a449ce78 100644
--- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.contribution.jee;
import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
/**
* Compute componentType with Remote EJB references translating into SCA references and env-entries translating into
@@ -27,9 +28,14 @@ import org.apache.tuscany.sca.assembly.ComponentType;
* @version $Rev$ $Date$
*/
public interface JavaEEOptionalExtension {
+ // The EJBImplementation and WEBImplemenation models are straight implementations so
+ // we deals in component types
ComponentType createImplementationWebComponentType(WebModuleInfo webModule);
ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName);
- ComponentType createImplementationJeeComponentType(WebModuleInfo webModule);
- ComponentType createImplementationJeeComponentType(EjbModuleInfo ejbModule);
- ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo);
+
+ // The JEEImplemenation model is a composite and so we have to fluff
+ // up the composite contents to match the JEE artifact
+ void createImplementationJeeComposite(WebModuleInfo webModule, Composite composite);
+ void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite);
+ void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite);
}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java
new file mode 100644
index 0000000000..cd23887312
--- /dev/null
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package org.apache.tuscany.sca.contribution.jee.impl;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+class EJBImplementationGeneratedImpl extends ImplementationImpl implements EJBImplementationGenerated {
+
+ private String ejbLink;
+
+ /**
+ * Constructs a new EJB implementation.
+ */
+ EJBImplementationGeneratedImpl() {
+ super();
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The EJB implementation does not support constrainingTypes
+ return null;
+ }
+
+ public String getEJBLink() {
+ return ejbLink;
+ }
+
+ @Override
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The EJB implementation does not support constrainingTypes
+ }
+
+ public void setEJBLink(String ejbLink) {
+ this.ejbLink = ejbLink;
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java
index 8d8d0f4c35..c4e180bf82 100644
--- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java
@@ -23,9 +23,14 @@ import java.util.Map;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
import org.apache.tuscany.sca.contribution.jee.EjbInfo;
import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
@@ -97,14 +102,16 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
return componentType;
}
- public ComponentType createImplementationJeeComponentType(EjbModuleInfo ejbModule) {
- ComponentType componentType = assemblyFactory.createComponentType();
-
+ public void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite) {
+
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
+
+ Component component = findComponent(composite, ejbInfo.beanName);
+
if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
for(Class<?> intf : ejbInfo.businessRemote) {
- Service service = assemblyFactory.createComponentService();
+ ComponentService service = assemblyFactory.createComponentService();
String intfName = intf.getName();
String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
serviceName = ejbInfo.beanName+"_"+serviceName;
@@ -117,11 +124,12 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
e.printStackTrace();
}
service.setInterfaceContract(ic);
- componentType.getServices().add(service);
+
+ addComponentService(composite, component, service);
}
for(Class<?> intf : ejbInfo.businessLocal) {
- Service service = assemblyFactory.createComponentService();
+ ComponentService service = assemblyFactory.createComponentService();
String intfName = intf.getName();
String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
serviceName = ejbInfo.beanName+"_"+serviceName;
@@ -136,25 +144,25 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
service.setInterfaceContract(ic);
service.getRequiredIntents().add(EJB_INTENT);
- componentType.getServices().add(service);
+ addComponentService(composite, component, service);
}
}
}
-
- return componentType;
}
-
- public ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo) {
- ComponentType componentType = assemblyFactory.createComponentType();
+
+ public void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite) {
for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
EjbModuleInfo ejbModule = entry0.getValue();
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
+
+ Component component = findComponent(composite, ejbInfo.beanName);
+
if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
for(Class<?> intf : ejbInfo.businessRemote) {
- Service service = assemblyFactory.createComponentService();
+ ComponentService service = assemblyFactory.createComponentService();
String intfName = intf.getName();
String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
serviceName = ejbInfo.mappedName+"_"+serviceName;
@@ -167,11 +175,12 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
e.printStackTrace();
}
service.setInterfaceContract(ic);
- componentType.getServices().add(service);
+
+ addComponentService(composite, component, service);
}
for(Class<?> intf : ejbInfo.businessLocal) {
- Service service = assemblyFactory.createComponentService();
+ ComponentService service = assemblyFactory.createComponentService();
String intfName = intf.getName();
String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
serviceName = ejbInfo.mappedName+"_"+serviceName;
@@ -186,12 +195,59 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
service.setInterfaceContract(ic);
service.getRequiredIntents().add(EJB_INTENT);
- componentType.getServices().add(service);
+ addComponentService(composite, component, service);
}
}
}
}
+ }
+
+ /**
+ * We are fluffing up the JEEImplemention composite to represented the components
+ * in the JEE archive. Given the JEEimplemenation composite find a named component
+ * it if already exists or create it if it doesn't.
+ *
+ * @param composite
+ * @param componentName
+ * @return
+ */
+ private Component findComponent(Composite composite, String componentName){
+ Component component = null;
- return componentType;
+ for (Component tmpComponent : composite.getComponents()){
+ if (tmpComponent.getName().equals(componentName)){
+ component = tmpComponent;
+ break;
+ }
+ }
+
+ if (component == null){
+ component = assemblyFactory.createComponent();
+ component.setName(componentName);
+ composite.getComponents().add(component);
+
+ EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
+ component.setImplementation(implementation);
+ }
+
+ return component;
+ }
+
+ /**
+ * Add a component service and fluff up a composite service to match
+ *
+ * @param composite
+ * @param component
+ * @param service
+ */
+ private void addComponentService(Composite composite, Component component, ComponentService service){
+ component.getImplementation().getServices().add(service);
+
+ CompositeService compositeService = assemblyFactory.createCompositeService();
+ composite.getServices().add(compositeService);
+
+ compositeService.setName(service.getName());
+ compositeService.setPromotedComponent(component);
+ compositeService.setPromotedService(service);
}
}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java
index f02b74bd8d..ad7e54b84f 100644
--- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java
@@ -24,11 +24,18 @@ import java.util.Map;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
import org.apache.tuscany.sca.contribution.jee.EjbInfo;
import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo;
@@ -167,15 +174,16 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
return componentType;
}
- public ComponentType createImplementationJeeComponentType(WebModuleInfo webModule) {
- ComponentType componentType = assemblyFactory.createComponentType();
+ public void createImplementationJeeComposite(WebModuleInfo webModule, Composite composite) {
+
+ Component component = findComponent(composite, webModule.getModuleName());
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry : webModule.getEjbReferences().entrySet()) {
EjbReferenceInfo ejbRef = entry.getValue();
String referenceName = entry.getKey();
referenceName = referenceName.replace("/", "_");
- Reference reference = assemblyFactory.createComponentReference();
+ ComponentReference reference = assemblyFactory.createComponentReference();
reference.setName(referenceName);
InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
try {
@@ -187,24 +195,25 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
reference.setInterfaceContract(ic);
reference.getRequiredIntents().add(EJB_INTENT);
reference.setMultiplicity(Multiplicity.ZERO_ONE);
- componentType.getReferences().add(reference);
+
+ addComponentReference(composite, component, reference);
}
-
- return componentType;
}
- public ComponentType createImplementationJeeComponentType(EjbModuleInfo ejbModule) {
- ComponentType componentType = assemblyFactory.createComponentType();
+ public void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite) {
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
+
+ Component component = findComponent(composite, ejbInfo.beanName);
+
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
EjbReferenceInfo ejbRef = entry1.getValue();
String referenceName = ejbRef.referenceName;
referenceName = referenceName.replace("/", "_");
referenceName = ejbInfo.beanName + "_" + referenceName;
- Reference reference = assemblyFactory.createComponentReference();
+ ComponentReference reference = assemblyFactory.createComponentReference();
reference.setName(referenceName);
InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
try {
@@ -216,28 +225,30 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
reference.setInterfaceContract(ic);
reference.getRequiredIntents().add(EJB_INTENT);
reference.setMultiplicity(Multiplicity.ZERO_ONE);
- componentType.getReferences().add(reference);
+
+ addComponentReference(composite, component, reference);
}
}
-
- return componentType;
}
- public ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo) {
- ComponentType componentType = assemblyFactory.createComponentType();
+
+ public void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite) {
for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
EjbModuleInfo ejbModule = entry0.getValue();
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
+
+ Component component = findComponent(composite, ejbInfo.beanName);
+
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
EjbReferenceInfo ejbRef = entry1.getValue();
String referenceName = ejbRef.referenceName;
referenceName = referenceName.replace("/", "_");
referenceName = ejbInfo.beanName + "_" + referenceName;
- Reference reference = assemblyFactory.createComponentReference();
+ ComponentReference reference = assemblyFactory.createComponentReference();
reference.setName(referenceName);
InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
try {
@@ -249,11 +260,58 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
reference.setInterfaceContract(ic);
reference.getRequiredIntents().add(EJB_INTENT);
reference.setMultiplicity(Multiplicity.ZERO_ONE);
- componentType.getReferences().add(reference);
+
+ addComponentReference(composite, component, reference);
}
}
}
+ }
+
+ /**
+ * We are fluffing up the JEEImplemention composite to represented the components
+ * in the JEE archive. Given the JEEimplemenation composite find a named component
+ * it if already exists or create it if it doesn't.
+ *
+ * @param composite
+ * @param componentName
+ * @return
+ */
+ private Component findComponent(Composite composite, String componentName){
+ Component component = null;
- return componentType;
- }
+ for (Component tmpComponent : composite.getComponents()){
+ if (tmpComponent.getName().equals(componentName)){
+ component = tmpComponent;
+ break;
+ }
+ }
+
+ if (component == null){
+ component = assemblyFactory.createComponent();
+ component.setName(componentName);
+ composite.getComponents().add(component);
+
+ EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
+ component.setImplementation(implementation);
+ }
+
+ return component;
+ }
+
+ /**
+ * Add a component reference and fluff up a composite reference to match
+ *
+ * @param composite
+ * @param component
+ * @param service
+ */
+ private void addComponentReference(Composite composite, Component component, ComponentReference reference){
+ component.getImplementation().getReferences().add(reference);
+
+ CompositeReference compositeReference = assemblyFactory.createCompositeReference();
+ composite.getReferences().add(compositeReference);
+
+ compositeReference.setName(reference.getName());
+ compositeReference.getPromotedReferences().add(reference);
+ }
}