Author: objectiser
Date: 2010-11-16 10:01:17 -0500 (Tue, 16 Nov 2010)
New Revision: 1108
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
trunk/runtime/engine/src/main/java/org/jboss/soa/si/InvocationAdapter.java
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java
Log:
Make use of the annotation to find the web service provider factory.
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-11-16
13:36:29 UTC (rev 1107)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-11-16
15:01:17 UTC (rev 1108)
@@ -142,7 +142,8 @@
metaData.getEndpointId(),
wsdlRef,
classLoader,
- handlerFile
+ handlerFile,
+ ODEWebServiceFactory.class
);
log.debug("Created dynamic endpoint class " +
providerImpl.getClass().getName());
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/si/InvocationAdapter.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/si/InvocationAdapter.java 2010-11-16
13:36:29 UTC (rev 1107)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/si/InvocationAdapter.java 2010-11-16
15:01:17 UTC (rev 1108)
@@ -24,7 +24,6 @@
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.jboss.soa.bpel.runtime.engine.BPELEngine;
import javax.xml.namespace.QName;
@@ -36,20 +35,23 @@
*
* @author Heiko Braun <hbraun(a)redhat.com>
*/
-public interface InvocationAdapter<T>
-{
- String getOperationName();
- QName getServiceName();
- String getPortName();
+public interface InvocationAdapter<T> {
- /**
- * Callback from the Engine towards the adapter when
- * turning an external message representation into an ODE request {@link
org.apache.ode.bpel.iapi.Message}
- * @param mex
- * @param odeRequest
- */
- void parseRequest(MyRoleMessageExchange mex, Message odeRequest);
+ String getOperationName();
+
+ QName getServiceName();
+
+ String getPortName();
+ /**
+ * Callback from the Service towards the adapter when
+ * turning an external message representation into a Service request.
+ *
+ * @param mex
+ * @param odeRequest
+ */
+ void parseRequest(MyRoleMessageExchange mex, Message odeRequest);
+
/**
* Callback from the Engine towards the adapter when
* turning an ODE response {@link org.apache.ode.bpel.iapi.Message} into an external
format <T>
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java 2010-11-16
13:36:29 UTC (rev 1107)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java 2010-11-16
15:01:17 UTC (rev 1108)
@@ -69,7 +69,24 @@
this.serviceQName = QName.valueOf(getServiceName());
this.soapAdapter = new SOAPMessageAdapter(wsdlDefinition, serviceQName,
getPortName());
- this.serviceFactory = new ODEWebServiceFactory();
+ WebServiceDetails details=getClass().getAnnotation(WebServiceDetails.class);
+
+ if (details != null) {
+ try {
+ Class<?> cls=Class.forName(details.factory());
+
+ serviceFactory = (WebServiceFactory)cls.newInstance();
+
+ } catch(ClassNotFoundException cnfe) {
+ throw new RuntimeException("Unable to find Web Service Factory class
'"+
+ details.factory()+"'", cnfe);
+ } catch(Exception ex) {
+ throw new RuntimeException("Failed to instantiate Web Service Factory
class '"+
+ details.factory()+"'", ex);
+ }
+ } else {
+ throw new RuntimeException("Web service details not defined on Web Service
endpoint");
+ }
}
catch (WSDLException e)
{
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java 2010-11-16
13:36:29 UTC (rev 1107)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java 2010-11-16
15:01:17 UTC (rev 1108)
@@ -49,7 +49,8 @@
String endpointId,
WSDLReference wsdlRef,
ClassLoader loader,
- java.io.File handlerFile
+ java.io.File handlerFile,
+ Class<? extends WebServiceFactory> providerFactory
)
throws Exception
{
@@ -143,6 +144,16 @@
attr.addAnnotation(annotation2);
+ // Specify the web service providerdetails
+ Annotation detailsAnnotation = new Annotation(
+ org.jboss.soa.si.ws.WebServiceDetails.class.getName(), constantPool);
+
+ detailsAnnotation.addMemberValue("factory",
+ new StringMemberValue(providerFactory.getName(), constantPool));
+
+ attr.addAnnotation(detailsAnnotation);
+
+
classFile.addAttribute(attr);