You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by mm...@apache.org on 2005/01/08 02:06:31 UTC
svn commit: r124596 - in incubator/beehive/trunk/wsm: drt drt/tests/org/apache/beehive/wsm/jsr181/wsdl src/runtime/org/apache/beehive/wsm/jsr181/model src/runtime/org/apache/beehive/wsm/jsr181/processor/apt
Author: mmerz
Date: Fri Jan 7 17:06:30 2005
New Revision: 124596
URL: http://svn.apache.org/viewcvs?view=rev&rev=124596
Log:
Cleaned up serialization of object models.
Modified:
incubator/beehive/trunk/wsm/drt/build.xml
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
Modified: incubator/beehive/trunk/wsm/drt/build.xml
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/build.xml?view=diff&rev=124596&p1=incubator/beehive/trunk/wsm/drt/build.xml&r1=124595&p2=incubator/beehive/trunk/wsm/drt/build.xml&r2=124596
==============================================================================
--- incubator/beehive/trunk/wsm/drt/build.xml (original)
+++ incubator/beehive/trunk/wsm/drt/build.xml Fri Jan 7 17:06:30 2005
@@ -1,4 +1,5 @@
<?xml version="1.0" ?>
+
<project name="wsmdrt" default="drt">
<property environment="os"/>
@@ -50,7 +51,6 @@
<target name="usage">
<echo message=""/>
<echo message=""/>
- <echo message="wsm drt"/>
<echo message="================================================================"/>
<echo message="| Usage |"/>
<echo message="================================================================"/>
@@ -128,7 +128,6 @@
</target>
<target name="xbean">
- <!-- XMLBean build -->
<taskdef name="xmlbeanbuild" classname="org.apache.xmlbeans.impl.tool.XMLBean">
<classpath>
<path refid="drt.classpath"/>
Modified: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java?view=diff&rev=124596&p1=incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java&r1=124595&p2=incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java&r2=124596
==============================================================================
--- incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java (original)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessorTest.java Fri Jan 7 17:06:30 2005
@@ -50,7 +50,8 @@
*/
public class XmlBeanWSDLProcessorTest extends TestCase {
- private static final String BEEHIVE_HOME = System.getenv("BEEHIVE_HOME");
+ private static final String BEEHIVE_HOME = System.getenv("BEEHIVE_HOME"); // todo: needs to go -- the build process has been updated, BEEHIVE_HOME obsoleted
+ private static final String CLASSNAME = "org.apache.beehive.wsm.jsr181.wsdl.StarWars";
Jsr181TypeMetadata serverModel;
Jsr181TypeMetadata clientModel;
@@ -59,9 +60,7 @@
File f = new File(BEEHIVE_HOME,
"wsm/drt/tests/schemas/starwars.wsdl");
-// serverModel = (Jsr181TypeMetadata)WsmReflectionAnnotationProcessor
-// .getInstance().getObjectModel(StarWars.class);
- Class clazz = Class.forName("org.apache.beehive.wsm.jsr181.wsdl.StarWars");
+ Class clazz = Class.forName(CLASSNAME);
serverModel = Jsr181TypeMetadataImpl.load(clazz);
XmlBeanWSDLProcessor xbwp = new XmlBeanWSDLProcessor();
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java?view=diff&rev=124596&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r1=124595&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r2=124596
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java Fri Jan 7 17:06:30 2005
@@ -18,6 +18,7 @@
* $Header:$Factory
*/
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -441,204 +442,6 @@
// empty
}
- /**
- * Validate this (concrete) object model against contract (service endpoint
- * interface):
- * - If a service endpoint interface is referred, check if all declared
- * methods are implemented by implementation bean
- *
- * Note that this can only be called for concrete object models!
- * @throws ValidationException
- *
- * todo: store conrete object model in instance
- public void validate() throws ValidationException {
- // check if we have a service endpoint interface
- String endpointInterface = getServiceEndpointInterface().trim();
- if (null == endpointInterface && 0 >= endpointInterface.length()) {
- return;
- }
-
- // load abstract object model
- Jsr181TypeMetadataImpl aom = null;
- try {
- aom = (Jsr181TypeMetadataImpl) load(endpointInterface);
- }
- catch (IOException e) {
- throw new ValidationException("Cannot load abstract object model: " + endpointInterface);
- }
- catch (ClassNotFoundException e) {
- throw new ValidationException("Cannot load abstract object model: " + endpointInterface);
- }
- if (null == aom) {
- throw new ValidationException("Cannot load abstract object model: " + endpointInterface);
- }
-
- // check if all methods declared in the contract are implemented
- for (Jsr181MethodMetadata aomMethod : aom.getMethods()) {
- boolean foundImplementation = false;
- for (Jsr181MethodMetadata myMethod : methodMap.values()) {
- if (myMethod.equals(aomMethod)) {
- foundImplementation = true;
- break;
- }
- }
- if (! foundImplementation) {
- throw new ValidationException("Method not implemented by " + wsServiceName + ": " + aomMethod);
- }
- }
- }
- */
-
- /**
- * Verifies duplicated methods in object model.
- *
- * When a object model is created from the class having the following combinations
- * of methods, duplicated methods will appear in the object model.
- * Thus, we gotta prevent it.
- *
- * --------------------------------
- * @WebMethod(operationName = "Ope")
- * @WebResult
- * public boolean getNutty(int a);
- *
- * @WebMethod(operationName = "Ope")
- * @WebResult
- * public boolean getHome(int a);
- * --------------------------------
- * or
- * --------------------------------
- * @WebMethod(operationName = "Ope")
- * @WebResult
- * public boolean getNutty(int a);
- *
- * @WebMethod
- * @WebResult
- * public boolean Ope(int a);
- * --------------------------------
- *
- *
- * Need better name of this method ...
- private void validateDuplicatedMethods () throws ValidationException
- {
- Jsr181MethodMetadata[] methods = getMethods().toArray(new Jsr181MethodMetadata[]{});
- for ( int i = 0 ; i < methods.length ; i++ )
- {
- Jsr181MethodMetadata method = methods[i];
- String methodName = method.getWmOperationName();
- for ( int k = 0 ; k < methods.length ; k++ )
- {
- if ( i != k ) { // skip the same method.
-
- Jsr181MethodMetadata method_ = methods[k];
- if ( methodName.equals( method_.getWmOperationName() ) )
- {
- // Found the duplicated method's name !
- // make sure just an overloading method or duplicated method signature.
-
- if ( hasSameParameterTypes ( method, method_ ) )
- {
- if (0 < seiClassName.length())
- {
- throw new ValidationException("There're duplicated operationName ( "
- + method.getWmOperationName() + " ) of methods, ( "
- + method.getJavaMethodName() + " ) and ( "
- + method_.getJavaMethodName() + " ) , in class ( "
- + seiClassName + " ) " + i + " != " + k );
- }
- else
- {
- throw new ValidationException("There're duplicated operationName ( "
- + method.getWmOperationName() + " ) of methods, ( "
- + method.getJavaMethodName() + " ) and ( "
- + method_.getJavaMethodName() + " ) , in class ( "
- + sibClassName + " )" );
- }
- }
- }
- }
- }
- }
- }
- */
-
- /**
- * Checks the specified two methods has same paramater types.
- *
- * @param m1
- * @param m2
- * @return boolean
- private boolean hasSameParameterTypes ( Jsr181MethodMetadata m1, Jsr181MethodMetadata m2 )
- {
-
- Jsr181ParameterMetadata[] params1 = m1.getParams().toArray( new Jsr181ParameterMetadata[]{} );
- Jsr181ParameterMetadata[] params2 = m2.getParams().toArray( new Jsr181ParameterMetadata[]{} );
-
- // check number of parameters.
- if ( params1.length != params2.length )
- {
- return false;
- }
-
- for ( int i = 0 ; i < params1.length ; i++ )
- {
- if ( params1[i].getJavaType() != params2[i].getJavaType() )
- {
- return false;
- }
- }
-
- return true;
- }
- */
-
- /**
- * Compares the signature of specified methods.
- *
- * @param m
- * @return
- private boolean doesImplement(Class sibClass, Method m) {
- if (null == m) {
- return false;
- }
-
- // search methods
- boolean found = false;
- for (Method _m : sibClass.getMethods()) {
- // compare java method names; todo should this be the action/operation name instead?
- if (!m.getName().equals(_m.getName())) {
- continue;
- }
-
- // compare return types
- if (!m.getReturnType().equals(_m.getReturnType())) {
- continue;
- }
- Type[] mTypes = m.getParameterTypes();
- Type[] _mTypes = _m.getParameterTypes();
-
- // compare number of arguments
- if (mTypes.length != _mTypes.length) {
- continue;
- }
-
- // compare argument types
- boolean isEqual = true;
- for (int i = 0; i < mTypes.length; i++) {
- if (!mTypes[i].equals(_mTypes[i])) {
- isEqual = false;
- break;
- }
- }
- if (isEqual) {
- found = true;
- break;
- }
- }
- return found;
- }
- */
-
-
public DefinitionsDocument getWSDLAsDocument()
throws IOException, XmlException {
@@ -649,7 +452,6 @@
return null;
}
-
/**
* @return Returns the hcFileName.
*/
@@ -946,10 +748,19 @@
}
/**
+ * Encapsulates the encoding of the pathname for object models.
+ * @param
+ * @return
+ */
+ public static File getLocation(String className) {
+ return new File("models", className + ".ser");
+ }
+
+ /**
* @param clazz
*/
public static Jsr181TypeMetadata load(Class clazz) throws IOException, ClassNotFoundException {
- return load(clazz.getClassLoader().getResourceAsStream(clazz.getName() + ".ser"));
+ return load(clazz.getClassLoader().getResourceAsStream(getLocation(clazz.getName()).toString()));
}
/**
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java?view=diff&rev=124596&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r1=124595&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r2=124596
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java Fri Jan 7 17:06:30 2005
@@ -116,8 +116,7 @@
if (null != endpointInterface && 0 < endpointInterface.length()) {
// get object model for service endpoint interface
- // todo: ".ser" needs to move into Jsr181TypeMetadataImpl
- om = Jsr181TypeMetadataImpl.load(getClass().getClassLoader().getResourceAsStream(endpointInterface + ".ser"));
+ om = Jsr181TypeMetadataImpl.load(getClass().getClassLoader().getResourceAsStream(Jsr181TypeMetadataImpl.getLocation(endpointInterface).toString()));
if (null == om) {
messager.printError(classDecl.getPosition(), "cannot find service endpoint interface: " + endpointInterface);
}
@@ -137,8 +136,7 @@
// store the object model
if (null != om) {
- // todo: ".ser" needs to move into Jsr181TypeMetadataImpl
- Jsr181TypeMetadataImpl.store(_env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", new File(classDecl.getQualifiedName() + ".ser")), om);
+ Jsr181TypeMetadataImpl.store(_env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", Jsr181TypeMetadataImpl.getLocation(classDecl.getQualifiedName())), om);
}
}
@@ -153,8 +151,7 @@
// store the object model
if (null != om) {
- // todo: ".ser" needs to move into Jsr181TypeMetadataImpl
- Jsr181TypeMetadataImpl.store(_env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", new File(interfaceDecl.getQualifiedName() + ".ser")), om);
+ Jsr181TypeMetadataImpl.store(_env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", Jsr181TypeMetadataImpl.getLocation(interfaceDecl.getQualifiedName())), om);
}
}