summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-28 17:59:27 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-28 17:59:27 +0000
commit717185ace58cc017538097c811f896a770ab3e22 (patch)
tree1e7890f3ba37e0041400b024d54621ffbe3ceb15 /branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution
parent1c74e1e3677538fd77cb880282665e272653f694 (diff)
TUSCANY-3052 - Add module info object to the EJB implementation generated model object. Add in the web implementation generated model object.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@779701 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java17
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java43
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java31
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java10
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java51
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java60
-rw-r--r--branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java66
7 files changed, 240 insertions, 38 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
index f486b63904..f51a86c003 100644
--- 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
@@ -23,22 +23,21 @@ import org.apache.tuscany.sca.assembly.Implementation;
/**
- * The model representing an EJB implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
+ * The model representing an EJB implementation in an SCA assembly model when the
+ * EJB implementation has been generated by introspecting a non-enhanced EAR
*/
public interface EJBImplementationGenerated extends Implementation {
/**
- * Returns the EJB link URI.
- * @return the EJB link URI
+ * Return the EjbInfo which generated this EJB component implementation
+ * @return
*/
- String getEJBLink();
+ EjbInfo getEJBInfo();
/**
- * Sets the EJB link URI.
- * @param ejbLink the EJB link URI
+ * Set the EjbInfo which generated this EJB component implementation
+ * @param ejbInfo
*/
- void setEJBLink(String ejbLink);
+ void setEJBInfo(EjbInfo ejbInfo);
}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java
new file mode 100644
index 0000000000..ee3b057ee6
--- /dev/null
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java
@@ -0,0 +1,43 @@
+/*
+ * 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 a WEB implementation in an SCA assembly model when the
+ * WEB implementation has been generated by introspecting a non-enhanced EAR
+ */
+public interface WebImplementationGenerated extends Implementation {
+
+ /**
+ * Return the WebModuleInfo which generated this Web component implementation
+ * @return
+ */
+ WebModuleInfo getWebInfo();
+
+ /**
+ * Set the WebModuleInfo which generated this Web component implementation
+ * @param webInfo
+ */
+ void setWebInfo(WebModuleInfo webInfo);
+
+}
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
index cd23887312..21be3d07c2 100644
--- 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
@@ -18,25 +18,18 @@
*/
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;
-
+import org.apache.tuscany.sca.contribution.jee.EjbInfo;
/**
- * The model representing an EJB implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
+ * The model representing an EJB implementation in an SCA assembly model when the
+ * EJB implementation has been generated by introspecting a non-enhanced EAR $
*/
class EJBImplementationGeneratedImpl extends ImplementationImpl implements EJBImplementationGenerated {
- private String ejbLink;
+ private EjbInfo ejbInfo;
/**
* Constructs a new EJB implementation.
@@ -50,18 +43,18 @@ class EJBImplementationGeneratedImpl extends ImplementationImpl implements EJBIm
// 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;
+
+ public EjbInfo getEJBInfo() {
+ return ejbInfo;
+ }
+
+ public void setEJBInfo(EjbInfo ejbInfo) {
+ this.ejbInfo = ejbInfo;
}
}
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 6934069516..a1a18c834b 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
@@ -109,7 +109,7 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
- Component component = findComponent(composite, ejbInfo.beanName);
+ Component component = findComponent(composite, ejbInfo);
if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
for(Class<?> intf : ejbInfo.businessRemote) {
@@ -161,7 +161,7 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
- Component component = findComponent(composite, ejbInfo.beanName);
+ Component component = findComponent(composite, ejbInfo);
if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
for(Class<?> intf : ejbInfo.businessRemote) {
@@ -211,11 +211,12 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
* 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 ejbInfo
* @param componentName
* @return
*/
- private Component findComponent(Composite composite, String componentName){
+ private Component findComponent(Composite composite, EjbInfo ejbInfo){
+ String componentName = ejbInfo.beanName;
Component component = null;
for (Component tmpComponent : composite.getComponents()){
@@ -233,6 +234,7 @@ public class JavaEEExtensionImpl implements JavaEEExtension {
EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
implementation.setUnresolved(true);
+ implementation.setEJBInfo(ejbInfo);
component.setImplementation(implementation);
}
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 d1b22c5631..0dc5667823 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
@@ -42,6 +42,7 @@ import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo;
import org.apache.tuscany.sca.contribution.jee.EnvEntryInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
+import org.apache.tuscany.sca.contribution.jee.WebImplementationGenerated;
import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
@@ -176,7 +177,7 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
public void createImplementationJeeComposite(WebModuleInfo webModule, Composite composite) {
- Component component = findComponent(composite, webModule.getModuleName());
+ Component component = findComponent(composite, webModule);
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry : webModule.getEjbReferences().entrySet()) {
@@ -205,7 +206,7 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
- Component component = findComponent(composite, ejbInfo.beanName);
+ Component component = findComponent(composite, ejbInfo);
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
@@ -240,7 +241,7 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
EjbInfo ejbInfo = entry.getValue();
- Component component = findComponent(composite, ejbInfo.beanName);
+ Component component = findComponent(composite, ejbInfo);
// Process Remote EJB References
for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
@@ -268,15 +269,16 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
}
/**
- * We are fluffing up the JEEImplemention composite to represented the components
+ * We are fluffing up the JEEImplemention composite to represent 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
+ * @param ejbInfo
* @return
*/
- private Component findComponent(Composite composite, String componentName){
+ private Component findComponent(Composite composite, EjbInfo ejbInfo){
+ String componentName = ejbInfo.beanName;
Component component = null;
for (Component tmpComponent : composite.getComponents()){
@@ -294,6 +296,7 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
implementation.setUnresolved(true);
+ implementation.setEJBInfo(ejbInfo);
component.setImplementation(implementation);
}
@@ -301,6 +304,42 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
}
/**
+ * We are fluffing up the JEEImplemention composite to represent 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 ejbInfo
+ * @return
+ */
+ private Component findComponent(Composite composite, WebModuleInfo webInfo){
+ String componentName = webInfo.getModuleName();
+ Component component = null;
+
+ for (Component tmpComponent : composite.getComponents()){
+ if (tmpComponent.getName().equals(componentName)){
+ component = tmpComponent;
+ break;
+ }
+ }
+
+ if (component == null){
+ component = assemblyFactory.createComponent();
+ component.setName(componentName);
+ component.setUnresolved(true);
+ composite.getComponents().add(component);
+
+ WebImplementationGenerated implementation = new WebImplementationGeneratedImpl();
+ implementation.setUnresolved(true);
+ // need generated impl to represent web modules
+ implementation.setWebInfo(webInfo);
+ component.setImplementation(implementation);
+ }
+
+ return component;
+ }
+
+ /**
* Add a component reference and fluff up a composite reference to match
*
* @param composite
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java
new file mode 100644
index 0000000000..d898bd4ea0
--- /dev/null
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.ConstrainingType;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.contribution.jee.WebImplementationGenerated;
+import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
+
+
+/**
+ * The model representing a WEB implementation in an SCA assembly model when the
+ * WEB implementation has been generated by introspecting a non-enhanced EAR
+ */
+class WebImplementationGeneratedImpl extends ImplementationImpl implements WebImplementationGenerated {
+
+ private WebModuleInfo webInfo;
+
+ /**
+ * Constructs a new EJB implementation.
+ */
+ WebImplementationGeneratedImpl() {
+ super();
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The Web implementation does not support constrainingTypes
+ return null;
+ }
+
+ @Override
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The Web implementation does not support constrainingTypes
+ }
+
+ public WebModuleInfo getWebInfo() {
+ return webInfo;
+ }
+
+ public void setWebInfo(WebModuleInfo webInfo) {
+ this.webInfo = webInfo;
+ }
+}
diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java
new file mode 100644
index 0000000000..4e50b15960
--- /dev/null
+++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+
+/**
+ * Dummy processor that's used to mark WebImplementationGeneratedImpl instance
+ * as resolved at the appropriate point in the resolution processing
+ *
+ */
+public class WebImplementationGeneratedProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WebImplementationGeneratedImpl> {
+
+ public WebImplementationGeneratedProcessor(ExtensionPointRegistry registry,
+ Monitor monitor) {
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<WebImplementationGeneratedImpl> getModelType() {
+ // Returns the type of model processed by this processor
+ return WebImplementationGeneratedImpl.class;
+ }
+
+ public WebImplementationGeneratedImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ return null;
+ }
+
+ public void resolve(WebImplementationGeneratedImpl implementation, ModelResolver resolver) throws ContributionResolveException {
+ implementation.setUnresolved(false);
+ }
+
+ public void write(WebImplementationGeneratedImpl implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ }
+}