Author: ekoneil
Date: Mon Jun 6 08:08:15 2005
New Revision: 180317
URL: http://svn.apache.org/viewcvs?rev=180317&view=rev
Log:
Various bug fixes and cleanup in WSM.
- privatize member variables in TwoPhaseAnnotationProcessor and
AnnotatedWebServiceDeploymentHandler
- privatize a bunch of member methods
- fix bug where only a single control would be initialized by the
ControlProvider. Remove an errant "break".
- cleanup some Javadoc
- remove unused "print" methods
- tighten up error check in WSDL2JavaTask that would prevent fewer than two
arguments but allow mroe than two arguments
- fix InputStream leak in Jsr181TypeMetadataImpl
BB: self
DRT: Beehive pass / service control pass
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ControlProvider.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ant/WSDL2AJavaTask.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/SystemTypeLookupService.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/BeehiveMemorySecurityModel.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializer.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializerFactory.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializer.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WebServiceMetadataViewer.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Mon Jun 6 08:08:15 2005
@@ -124,8 +124,7 @@
String operationName = meth.getWmOperationName();
if(null != operationName && 0 < operationName.length()) {
// set the Operations properties
- OperationDesc od = sd.getOperationByName(meth
- .getJavaMethodName());
+ OperationDesc od =
sd.getOperationByName(meth.getJavaMethodName());
od.setElementQName(new QName(targetNamespace, operationName));
od.setName(operationName);
od.setSoapAction(meth.getWmAction());
@@ -237,11 +236,10 @@
*/
private static Class getDataHandlerClass() {
try {
- return AxisHook.class.getClassLoader().loadClass(
- "javax.activation.DataHandler");
+ return
AxisHook.class.getClassLoader().loadClass("javax.activation.DataHandler");
}
catch(ClassNotFoundException e) {
- // ignore the class was not found
+ /* todo: this should log a warning */
}
return null;
}
@@ -258,13 +256,12 @@
"javax.mail.internet.MimeMultipart");
}
catch(ClassNotFoundException e) {
- // ignore the class was not found
+ /* todo: this should log a warning */
}
return null;
}
- private static QName configureTypeMapping(ServiceDesc desc, Class type,
- String defaultNameSpace)
+ private static QName configureTypeMapping(ServiceDesc desc, Class type,
String defaultNameSpace)
throws InvalidTypeMappingException {
try {
if(Void.TYPE.equals(type))
@@ -529,14 +526,6 @@
e.printStackTrace();
throw e;
}
- }
-
- private static QName generateQName(Class type, ServiceDesc desc) {
- String namespace = Namespaces.makeNamespace(type.getName());
- if(namespace == null || namespace.endsWith("DefaultNamespace")) {
- namespace = desc.getDefaultNamespace();
- }
- return new QName(namespace,
Types.getLocalNameFromFullName(type.getName()));
}
protected static void configureSoapBinding(ServiceDesc sd,
BeehiveWsSOAPBindingInfo sbi) {
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ControlProvider.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ControlProvider.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ControlProvider.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ControlProvider.java
Mon Jun 6 08:08:15 2005
@@ -32,39 +32,35 @@
import org.apache.beehive.controls.api.context.ControlThreadContext;
/**
- * ****************************************************************************
*
- * @author Jonathan Colwell
*/
public class ControlProvider
extends RPCProvider {
-
+
+ /* todo: perf. consider caching fields here */
protected Object makeNewServiceObject(MessageContext msgContext, String
clsName)
throws Exception {
- Object obj = super.makeNewServiceObject(msgContext, clsName);
- initializeControls(obj);
- return obj;
- }
- private void initializeControls(Object obj)
- throws Exception {
+ Object client = super.makeNewServiceObject(msgContext, clsName);
- Class cls = obj.getClass();
+ Class clientClass = client.getClass();
- // search for fields with @Control annotations
- for(Field field : cls.getFields()) {
+ /* search for fields with @Control annotations */
+ for(Field field : clientClass.getFields()) {
if(null != field.getAnnotation(Control.class)) {
- //attempt to load using client initializer.
+ /* attempt to instantiate a Beehive control using the
control's ClientInitializer */
ControlContainerContext ccc =
ControlThreadContext.getContext();
- if(null == ccc) {
+ if(null == ccc)
throw new Exception("no control container context found");
- }
- Class clientInitializer =
cls.getClassLoader().loadClass(cls.getName() + "ClientInitializer");
- Method init = clientInitializer.getMethod("initialize",
ControlBeanContext.class, cls);
- init.invoke(null, ccc, obj);
- break;
+
+ Class clientInitializer =
clientClass.getClassLoader().loadClass(clientClass.getName() +
"ClientInitializer");
+ Method init = clientInitializer.getMethod("initialize",
ControlBeanContext.class, clientClass);
+ /* note, the first parameter here is null because the
*ClientInitializer.initialize(...) method is static */
+ init.invoke(null, ccc, client);
}
}
+
+ return client;
}
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ant/WSDL2AJavaTask.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ant/WSDL2AJavaTask.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ant/WSDL2AJavaTask.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/ant/WSDL2AJavaTask.java
Mon Jun 6 08:08:15 2005
@@ -34,7 +34,6 @@
public WSDL2AJavaTask() {
super();
- // TODO Auto-generated constructor stub
}
public void setWSDLFile(File wsdl) {
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
Mon Jun 6 08:08:15 2005
@@ -42,8 +42,8 @@
}
/*
- * @see TypeLookUpServices#getClassQName(java.lang.Class)
- */
+ * @see TypeLookUpServices#getClassQName(java.lang.Class)
+ */
public QName class2qname(Class cls) {
if(cls.isArray())
cls = cls.getComponentType();
@@ -60,7 +60,6 @@
}
return class2qname(cls, namespace);
}
-
}
/**
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/SystemTypeLookupService.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/SystemTypeLookupService.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/SystemTypeLookupService.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/databinding/SystemTypeLookupService.java
Mon Jun 6 08:08:15 2005
@@ -26,25 +26,19 @@
import org.apache.beehive.wsm.databinding.BindingLookupService;
import org.apache.beehive.wsm.databinding.xmlbeans.XmlBeanTypeLookup;
-
public class SystemTypeLookupService
implements BindingLookupService {
+
List<BindingLookupService> lookupServiceList = new
ArrayList<BindingLookupService>();
- /**
- *
- */
public SystemTypeLookupService() {
lookupServiceList.add(new XmlBeanTypeLookup());
lookupServiceList.add(new AxisTypeLookup());
-
}
/*
- * (non-Javadoc)
- *
- * @see TypeLookUpServices#getClassQName(java.lang.Class)
- */
+ * @see TypeLookUpServices#getClassQName(java.lang.Class)
+ */
public QName class2qname(Class cls) {
QName qname = null;
@@ -56,10 +50,8 @@
}
/*
- * (non-Javadoc)
- *
- * @see TypeLookUpServices#getClassQName(java.lang.Class)
- */
+ * @see TypeLookUpServices#getClassQName(java.lang.Class)
+ */
public QName class2qname(Class cls, String namespace) {
QName qname = null;
@@ -71,10 +63,8 @@
}
/*
- * (non-Javadoc)
- *
- * @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
- */
+ * @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
+ */
public Class qname2class(QName qname) {
Class cls = null;
for(BindingLookupService lookUpService : lookupServiceList) {
@@ -85,5 +75,4 @@
cls = Object.class;
return cls;
}
-
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
Mon Jun 6 08:08:15 2005
@@ -1,5 +1,4 @@
package org.apache.beehive.wsm.axis.handlers;
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
@@ -17,7 +16,6 @@
* limitations under the License.
*
*/
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -59,9 +57,11 @@
*/
public class AnnotatedWebServiceDeploymentHandler
extends BasicHandler {
- protected static Logger logger =
Logger.getLogger(AnnotatedWebServiceDeploymentHandler.class);
- protected Map<String, SOAPService> soapServices = new HashMap<String,
SOAPService>();
+ private static final String JWS_EXTENSION = ".jws";
+ private static Logger logger =
Logger.getLogger(AnnotatedWebServiceDeploymentHandler.class);
+
+ private Map<String, SOAPService> soapServices = new HashMap<String,
SOAPService>();
/**
* @param mc
@@ -111,7 +111,8 @@
if(null != clazz) {
ss = soapServices.get(clazz.getName());
if(null == ss) {
- ss = createSOAPService(Jsr181ObjectModelStore.load(clazz),
clazz);
+ BeehiveWsTypeMetadata typeMetadata =
Jsr181ObjectModelStore.load(clazz);
+ ss = createSOAPService(typeMetadata, clazz);
}
}
return ss;
@@ -123,19 +124,18 @@
* @return SOAPService
* @throws Exception
*/
- protected SOAPService createSOAPService(BeehiveWsTypeMetadata wsm, Class
cls)
+ private SOAPService createSOAPService(BeehiveWsTypeMetadata wsm, Class cls)
throws Exception {
SOAPService ss = null;
if(null != wsm) {
- // HandlerHandler hh = new HandlerHandler(wsm);
- // hh.init();
+
// // NOTE [EMAIL PROTECTED] 2004-Nov-01 --
// // not calling ss.init() since ControlProvider won't do anything
// // with it and I don't want the HandlerHandler initialized
twice.
// ss = new SOAPService(hh, new ControlProvider(), hh);
- // create soap service without any handlers.
+ /* todo: can the ControlProvider be used statically? */
ss = new SOAPService(null, new ControlProvider(), null);
// Add jaxrpc handlers if there are any.
@@ -157,6 +157,12 @@
ss.setServiceDescription(sd);
List allowedMethodNames = sd.getAllowedMethods();
Iterator allowIt = allowedMethodNames.iterator();
+
+ /*
+ todo: can StringBuilder be used here since there's no need for
synchronization?
+ todo: can the output String be cached? Presumably, the lsit of
+ methods doesn't change for a single deploymentx
+ */
StringBuffer sb = new StringBuffer();
boolean firstPass = true;
while(allowIt.hasNext()) {
@@ -169,10 +175,8 @@
ss.setOption(RPCProvider.OPTION_ALLOWEDMETHODS, sb.toString());
ss.setOption(RPCProvider.OPTION_WSDL_PORTTYPE, wsm.getWsName());
ss.setOption(RPCProvider.OPTION_WSDL_SERVICEPORT, wsm.getWsName());
- ss.setOption(RPCProvider.OPTION_WSDL_SERVICEELEMENT, wsm
- .getWsServiceName());
- ss.setOption(RPCProvider.OPTION_WSDL_TARGETNAMESPACE, wsm
- .getWsTargetNamespace());
+ ss.setOption(RPCProvider.OPTION_WSDL_SERVICEELEMENT,
wsm.getWsServiceName());
+ ss.setOption(RPCProvider.OPTION_WSDL_TARGETNAMESPACE,
wsm.getWsTargetNamespace());
ss.setStyle(sd.getStyle());
ss.setUse(sd.getUse());
soapServices.put(cls.getName(), ss);
@@ -180,13 +184,13 @@
return ss;
}
- protected HandlerInfoChainFactory getJaxRPCHandlerChainFactory(
- BeehiveWsTypeMetadata wsm)
+ private HandlerInfoChainFactory
getJaxRPCHandlerChainFactory(BeehiveWsTypeMetadata wsm)
throws ClassNotFoundException {
+
HandlerInfoChainFactory res = null;
List<? extends BeehiveWsSOAPMessageHandlerInfo> handlers =
wsm.getSoapHandlers();
- if(handlers.size() > 0) { // there are handlers to install
+ if(handlers.size() > 0) {
ArrayList<HandlerInfo> infoList = new ArrayList<HandlerInfo>();
HashSet<String> roles = new HashSet<String>();
@@ -196,6 +200,7 @@
infoList.add(new HandlerInfo(handlerClass,
handler.getParameterMap(), handlerHeaders));
roles.addAll(handler.getRoles());
}
+
res = new HandlerInfoChainFactory(infoList);
String[] roleArray = roles.toArray(new String[0]);
res.setRoles(roleArray);
@@ -208,54 +213,36 @@
* @return web service Class
* @throws Exception
*/
- protected Class getWebServiceClass(MessageContext mc)
+ private Class getWebServiceClass(MessageContext mc)
throws Exception {
+
// check message context
- if(null == mc) {
+ if(null == mc)
throw new IllegalArgumentException("message context not set");
- }
// retrieve & check relative path
String relativePath = mc.getStrProp(Constants.MC_RELATIVE_PATH);
- if(null == relativePath) {
+ if(null == relativePath)
throw new Exception("relative path not set properly in message
context");
- }
// turn relative path into fq class name
- final String JWS_EXTENSION = ".jws";
-
-/*
- if ((! relativePath.startsWith("/")) || (!
relativePath.endsWith(JWS_EXTENSION))) {
- throw new Exception ("invalid relative path: " + relativePath);
- }
- String className = relativePath.substring(1,
- relativePath.length() - JWS_EXTENSION.length()).replaceAll("/",
- ".");
-*/
-
- if(! relativePath.startsWith("/")) {
+ if(!relativePath.startsWith("/"))
throw new Exception("invalid relative path: " + relativePath);
- }
String className = null;
- if(relativePath.endsWith(JWS_EXTENSION)) {
+ if(relativePath.endsWith(JWS_EXTENSION))
className = relativePath.substring(1, relativePath.length() -
JWS_EXTENSION.length()).replaceAll("/", ".");
- }
- else {
+ else
className = relativePath.substring(1,
relativePath.length()).replaceAll("/", ".");
- }
// load class
- if(logger.isDebugEnabled()) {
+ if(logger.isDebugEnabled())
logger.debug("trying to load web service class: " + className);
- }
Class clazz = Jsr181ObjectModelStore.loadWebServiceClass(className);
- if(null == clazz) {
- if(logger.isDebugEnabled()) {
+ if(null == clazz)
+ if(logger.isDebugEnabled())
logger.debug("failed to load web service class: " + className);
- }
- }
return clazz;
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/BeehiveMemorySecurityModel.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/BeehiveMemorySecurityModel.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/BeehiveMemorySecurityModel.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/BeehiveMemorySecurityModel.java
Mon Jun 6 08:08:15 2005
@@ -1,8 +1,5 @@
package org.apache.beehive.wsm.axis.security.model;
-
/*
- * DropInDeploymentHandler.java
- *
* Copyright 2001-2004 The Apache Software Foundation.
*
*
@@ -36,6 +33,7 @@
public class BeehiveMemorySecurityModel
implements SecurityModel {
+
protected static Logger logger =
Logger.getLogger(BeehiveMemorySecurityModel.class);
private static final String BEEHIVE_ROLE_FILE = "beehive-role.xml";
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
Mon Jun 6 08:08:15 2005
@@ -1,12 +1,4 @@
package org.apache.beehive.wsm.axis.tools;
-
-import java.io.InputStream;
-
-import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
-import org.apache.beehive.wsm.wsdl.AbstractWsdl2AJava;
-
/*
* Wsld2AJava.java
*
@@ -26,13 +18,19 @@
* limitations under the License.
*/
+import java.io.InputStream;
+
+import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
+import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
+import org.apache.beehive.wsm.wsdl.AbstractWsdl2AJava;
+
public class Wsdl2AJava
extends AbstractWsdl2AJava {
public Wsdl2AJava()
throws Exception {
super();
- // TODO Auto-generated constructor stub
}
protected BeehiveWsTypeMetadata getWSObjectModel(InputStream wsdl)
@@ -40,15 +38,16 @@
XmlBeanWSDLProcessor processor = new XmlBeanWSDLProcessor(wsdl);
SystemTypeLookupService lookupService = new SystemTypeLookupService();
return processor.getObjectModel(lookupService);
-
}
public static int main(String args[])
throws Exception {
- if(args.length < 2) {
+
+ if(args.length != 2) {
System.out.println("Usage: Wsdl2AJava <wsdlFileName> <base source
dir>");
- return (-1);
+ return -1;
}
+
Wsdl2AJava processor = new Wsdl2AJava();
processor.init();
processor.generateAnnotatedJavaFromWSDL(args[0], args[1]);
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializer.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializer.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializer.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializer.java
Mon Jun 6 08:08:15 2005
@@ -46,7 +46,6 @@
public XmlBeanDeserializer(Class javaType, QName xmlType) {
mJavaType = javaType;
- mXmlType = xmlType;
}
public void onStartElement(String namespace,
@@ -67,6 +66,8 @@
}
else {
XmlObject[] children = xObj.selectChildren(QNameSet.ALL);
+
+ /* review: what does this do? st is never used. */
for(XmlObject kid : children) {
st = kid.schemaType();
converted = xObj.changeType(jt);
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializerFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializerFactory.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializerFactory.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanDeserializerFactory.java
Mon Jun 6 08:08:15 2005
@@ -26,9 +26,7 @@
import org.apache.axis.encoding.ser.BaseDeserializerFactory;
/**
- * ****************************************************************************
- *
- * @author Jonathan Colwell
+ *
*/
public class XmlBeanDeserializerFactory
extends BaseDeserializerFactory {
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializer.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializer.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializer.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializer.java
Mon Jun 6 08:08:15 2005
@@ -63,6 +63,7 @@
public void serialize(QName name, Attributes attributes, Object value,
SerializationContext context)
throws IOException {
+
if(!(value instanceof XmlObject)) {
throw new IOException(
((value != null) ? value.getClass().getName() : "null") + " is
not an " + XmlObject.class.getName());
@@ -124,7 +125,6 @@
/**
* @param types
* @param docType
- * @return
* @throws Exception
*/
private void writeSchemaForDocType(SchemaType docType, Types types)
@@ -167,9 +167,8 @@
}
/**
- * @param nxtType
+ * @param qname
* @return null for classes that are not found, or if they are primitive
types
- * *
*/
private Class q2UserClass(QName qname) {
SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
@@ -188,10 +187,11 @@
}
/**
+ * Walk all the nodes under the nodeInWSDL if there is an 'element' type
the
+ * add its types or references to the dependent type.
+ *
* @param nodeInWSDL
* @param dependentTypes
- * @return Walk all the nodes under the nodeInWSDL if there is an
'element' type the
- * add its types or references to the dependent type.
*/
private void getAllDependentTypes(XmlObject nodeInWSDL, Set<QName>
dependentTypes) {
// scan for any node under the type that has "type" or "ref" attribute
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
Mon Jun 6 08:08:15 2005
@@ -1,5 +1,4 @@
package org.apache.beehive.wsm.model.jsr181;
-
/*
* Copyright 2005 The Apache Software Foundation
*
@@ -36,7 +35,7 @@
public class Jsr181ObjectModelStore {
private final static String EXTENSION = ".ser";
- private final static String LOCATOR = ".webservices";
+ private final static String FILE_NAME_LOCATOR = ".webservices";
private static boolean isMarked = false;
@@ -96,13 +95,13 @@
*/
public static BeehiveWsTypeMetadata load(InputStream is)
throws IOException, ClassNotFoundException {
+
+ if(null == is)
+ throw new IOException("cannot load object model without input
stream");
+
Jsr181TypeMetadataImpl objectModel = null;
ObjectInputStream ois = null;
-
try {
- if(null == is) {
- throw new IOException("cannot load object model without input
stream");
- }
ois = new ObjectInputStream(is);
objectModel = (Jsr181TypeMetadataImpl)ois.readObject();
}
@@ -111,7 +110,6 @@
ois.close();
}
}
-
return objectModel;
}
@@ -136,8 +134,8 @@
oos = new ObjectOutputStream(os);
oos.writeObject(objectModel);
- if(! isMarked) {
- env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "",
new java.io.File(LOCATOR));
+ if(!isMarked) {
+ env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "",
new java.io.File(FILE_NAME_LOCATOR));
isMarked = true;
}
}
@@ -170,9 +168,8 @@
}
// try className as simple class name
catch(ClassNotFoundException e) {
- final File wsDirectory = new File(new
File(cl.getResource(LOCATOR).getFile()).getParent());
+ final File wsDirectory = new File(new
File(cl.getResource(FILE_NAME_LOCATOR).getFile()).getParent());
String fqClassName = getFullyQualifiedClassName(wsDirectory,
className);
- // todo: we do this for the TCK only...
if(null == fqClassName) {
fqClassName = getFullyQualifiedClassName(wsDirectory,
className.substring(0, className.length() - "Service".length()));
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java
Mon Jun 6 08:08:15 2005
@@ -19,6 +19,8 @@
*/
import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.MalformedURLException;
import java.net.URL;
@@ -77,7 +79,6 @@
* Default constructor.
*/
public Jsr181TypeMetadataImpl() {
- // empty
}
/**
@@ -167,12 +168,22 @@
}
String wsdlLocation = webService.wsdlLocation();
if(null != wsdlLocation && 0 < wsdlLocation.trim().length()) {
+ InputStream is = null;
try {
- findResource(wsdlLocation.trim(), baseLocation).openStream();
+ /* todo: seems that this is just trying to open a stream
+ as a check to see if the file exists. this seems
+ like it could be done another way...
+ */
+ is = findResource(wsdlLocation.trim(),
baseLocation).openStream();
}
- catch(Throwable t) {
+ catch(Exception e) {
jt.logError("wsdlLocation does not exist: " + wsdlLocation);
}
+ finally {
+ if(is != null)
+ try{is.close();}
+ catch(IOException ignore) {}
+ }
}
// initilize instance
@@ -364,10 +375,8 @@
URL resourceURL = null;
- // validate path
- if(null == resourcePath || 0 == resourcePath.length()) {
+ if(null == resourcePath || 0 == resourcePath.length())
return null;
- }
// handle absolute URL
if(resourcePath.startsWith("http://") ||
resourcePath.startsWith("file:/")) {
@@ -376,6 +385,7 @@
return resourceURL;
}
catch(MalformedURLException e) {
+ /* todo: this needs to report the error... */
return null;
}
}
@@ -773,6 +783,7 @@
*/
public void merge(JavaTypeInfo jt)
throws Exception {
+ /* note: this method is used at build time */
// check if this has endpointInterface --> error
String myEndpointInterface = getWsEndpointInterface();
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
Mon Jun 6 08:08:15 2005
@@ -142,7 +142,8 @@
BeehiveWsTypeMetadata wsm,
Map<String, BeehiveWsMethodMetadata>
methodMap,
Map<String, TPart[]> messageMap,
- TBinding tBind, TTypes types)
+ TBinding tBind,
+ TTypes types)
throws Exception {
String opName = op.getName();
TParam outputParam = op.getOutput();
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java
Mon Jun 6 08:08:15 2005
@@ -65,8 +65,8 @@
abstract public class TwoPhaseAnnotationProcessor
implements AnnotationProcessor {
- Set<AnnotationTypeDeclaration> _atds;
- AnnotationProcessorEnvironment _env;
+ private Set<AnnotationTypeDeclaration> _atds;
+ private AnnotationProcessorEnvironment _env;
public TwoPhaseAnnotationProcessor(Set<AnnotationTypeDeclaration> atds,
AnnotationProcessorEnvironment env) {
_atds = atds;
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WebServiceMetadataViewer.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WebServiceMetadataViewer.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WebServiceMetadataViewer.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WebServiceMetadataViewer.java
Mon Jun 6 08:08:15 2005
@@ -37,9 +37,11 @@
" "
};
+ /* whack
public static void print(BeehiveWsTypeMetadata webServiceTYPEMetadata) {
print(0, webServiceTYPEMetadata);
}
+ */
public static void print(int tab, BeehiveWsTypeMetadata
webServiceTYPEMetadata) {
print(tab, "<TYPE > > >WebServiceTYPEMetadata");
@@ -58,9 +60,11 @@
print(tab, webServiceTYPEMetadata.getSoapBinding());
}
+ /* whack
public static void print(Collection collection) {
print(0, collection);
}
+ */
public static void print(int tab, Collection collection) {
if(collection == null)
@@ -78,9 +82,11 @@
}
}
+ /* whack
public static void print(BeehiveWsMethodMetadata webServiceMETHODMetadata)
{
print(0, webServiceMETHODMetadata);
}
+ */
public static void print(int tab, BeehiveWsMethodMetadata
webServiceMETHODMetadata) {
if(webServiceMETHODMetadata == null)
@@ -105,9 +111,11 @@
print(tab, webServiceMETHODMetadata.getParams());
}
+ /* whack
public static void print(BeehiveWsParameterMetadata
webServicePARAMETERMetadata) {
print(0, webServicePARAMETERMetadata);
}
+ */
public static void print(int tab, BeehiveWsParameterMetadata
webServicePARAMETERMetadata) {
if(webServicePARAMETERMetadata == null)
@@ -122,9 +130,11 @@
print("");
}
+ /* whack
public static void print(BeehiveWsSOAPBindingInfo soapBindingInfo) {
print(0, soapBindingInfo);
}
+ */
public static void print(int tab, BeehiveWsSOAPBindingInfo
soapBindingInfo) {
if(soapBindingInfo == null)
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java?rev=180317&r1=180316&r2=180317&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java
Mon Jun 6 08:08:15 2005
@@ -36,7 +36,6 @@
import org.apache.beehive.wsm.model.jsr181.Jsr181ObjectModelStore;
import org.apache.beehive.wsm.model.jsr181.Jsr181TypeMetadataImpl;
-
/**
* WsmAnnotationProcessor provides an API for IDEs and other applications to
* perform code validation.
@@ -64,24 +63,27 @@
@Override
public void check(Declaration _decl) {
- Messager messager = _env.getMessager();
- try {
- // check if we've already handled this declaration
- if(handledDecls.contains(_decl)) {
- return;
- }
+ AnnotationProcessorEnvironment env =
getAnnotationProcessorEnvironment();
+ Messager messager = env.getMessager();
- // check if we're interested in declaration
- if(! (_decl instanceof TypeDeclaration)) {
- return;
- }
+ // check if we've already handled this declaration
+ if(handledDecls.contains(_decl))
+ return;
+
+ // check if we're interested in declaration
+ if(!(_decl instanceof TypeDeclaration))
+ return;
+
+ try {
WebService wsAnnotation = _decl.getAnnotation(WebService.class);
if(null == wsAnnotation) {
messager.printError(_decl.getPosition(),
- "@WebService annotation missing; unable to
process: " + ((TypeDeclaration)_decl).getQualifiedName());
+ "@WebService annotation missing; unable to
process: " +
+
((TypeDeclaration)_decl).getQualifiedName());
}
// store declaration so we don't handle it multiple times
+ /* todo: does this ever happen in a single APT run? */
handledDecls.add((TypeDeclaration)_decl);
// service implementation bean
@@ -94,17 +96,15 @@
// start from endpoint interface
if(null != endpointInterface && 0 <
endpointInterface.length()) {
-
// get object model for service endpoint interface
om = getEndpointInterfaceObjectModel(endpointInterface);
// merge abstract and concrete object models
- om.merge(new MirrorTypeInfo(classDecl, _env));
+ om.merge(new MirrorTypeInfo(classDecl, env));
}
-
// create object model from scratch
else {
- om = new Jsr181TypeMetadataImpl(new
MirrorTypeInfo(classDecl, _env));
+ om = new Jsr181TypeMetadataImpl(new
MirrorTypeInfo(classDecl, env));
}
// check if we have an object model
@@ -122,7 +122,8 @@
messager.printNotice("processing service endpoint interface: "
+ interfaceDecl.getQualifiedName());
// create object model
- BeehiveWsTypeMetadata om = new Jsr181TypeMetadataImpl(new
MirrorTypeInfo(interfaceDecl, _env));
+ BeehiveWsTypeMetadata om = new Jsr181TypeMetadataImpl(new
MirrorTypeInfo(interfaceDecl, env));
+
if(null == om) {
return;
}
@@ -130,14 +131,14 @@
// store the object model
oms.store(om);
}
-
// @WebService annotation on unknown/unsupported type definition
else {
messager.printError(_decl.getPosition(), "found unsupported
type of TypeDeclaration:" + _decl.getSimpleName());
}
}
- catch(Throwable t) {
- messager.printError(_decl.getPosition(), t.getMessage());
+ catch(Exception e) {
+ messager.printError(_decl.getPosition(), "Exception occurred
checking type \"" +
+ ((TypeDeclaration)_decl).getQualifiedName() + "\". Cause: " +
e.getMessage());
}
}
@@ -146,18 +147,22 @@
*/
@Override
public void generate(Declaration _decl) {
- // todo: persist all object models that have been created [by check()]
+ /* the generate phase is unused as this work is performed in the
"check()" method */
}
private BeehiveWsTypeMetadata getEndpointInterfaceObjectModel(String
endpointInterface) {
BeehiveWsTypeMetadata om = null;
- // search for persistent object model
+ /*
+ check to see if an object model has already been persisted for the
given
+ endpointInterface name
+ */
InputStream is = null;
try {
File file = Jsr181ObjectModelStore.getLocation(endpointInterface);
assert file != null : "Found null endpoint location file";
+
is =
getClass().getClassLoader().getResourceAsStream(file.toString());
om = Jsr181ObjectModelStore.load(is);
}
@@ -171,14 +176,19 @@
}
}
- // try to generate object model
+ /*
+ No object model has been generated for the given endpointInterface.
+ Attempt to generate one.
+ */
if(null == om) {
+ AnnotationProcessorEnvironment env =
getAnnotationProcessorEnvironment();
try {
- _env.getMessager().printNotice("-> loading object model for
required endpoint interface:" + endpointInterface);
- check(_env.getTypeDeclaration(endpointInterface));
+ env.getMessager().printNotice("loading object model for
required endpoint interface:" + endpointInterface);
+ check(env.getTypeDeclaration(endpointInterface));
File file =
Jsr181ObjectModelStore.getLocation(endpointInterface);
assert file != null : "Found null endpoint interface file";
+
is =
getClass().getClass().getResourceAsStream(file.toString());
om = Jsr181ObjectModelStore.load(is);
}