Author: mmerz
Date: Tue Apr 5 14:22:44 2005
New Revision: 160223
URL: http://svn.apache.org/viewcvs?view=rev&rev=160223
Log:
Added support for holders.
Updated the samples for the holders.
Fixed referenced to the common login.
Contributor: Daryoush Mehrtash
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/server-config.wsdd
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralBareSample.jws
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralWrappedSample.jws
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.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/handlers/AuthenticationHandler.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeRegistrar.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/AxisSecurityModel.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/security/model/ServletSecurityModel.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/BindingLookupService.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/registration/TypeRegistrar.java
Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/server-config.wsdd
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/server-config.wsdd?view=diff&r1=160222&r2=160223
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/server-config.wsdd
(original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/server-config.wsdd Tue
Apr 5 14:22:44 2005
@@ -7,6 +7,8 @@
<parameter name="sendXsiTypes" value="true"/>
<parameter name="sendXMLDeclaration" value="true"/>
<requestFlow>
+ <handler
type="java:org.apache.beehive.wsm.axis.util.DebugPrintMessageHandler">
+ </handler>
<handler
type="java:org.apache.beehive.wsm.axis.handlers.AnnotatedWebServiceDeploymentHandler">
<parameter name="scope" value="session"/>
</handler>
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralBareSample.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralBareSample.jws?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralBareSample.jws
(original)
+++
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralBareSample.jws
Tue Apr 5 14:22:44 2005
@@ -48,7 +48,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromBodyResult")
- public Address returnAddressFromBody(@WebParam(name="in-param-body",
mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromBody(@WebParam(name="in_param_body",
mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -59,7 +59,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromHeaderResult")
- public Address returnAddressFromHeader(@WebParam(name="in-param-header",
header=true, mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromHeader(@WebParam(name="in_param_header",
header=true, mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -70,7 +70,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInBodyResult")
- public int createAddressInBody(@WebParam(name="out-param-body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInBody(@WebParam(name="out_param_body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -85,7 +85,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInHeaderResult")
- public int createAddressInHeader(@WebParam(name="out-param-header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInHeader(@WebParam(name="out_param_header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -100,7 +100,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInBodyResult")
- public int changeAddressInBody(@WebParam(name="inout-param-body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInBody(@WebParam(name="inout_param_body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -113,7 +113,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInHeaderResult")
- public int changeAddressInHeader(@WebParam(name="inout-param-header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInHeader(@WebParam(name="inout_param_header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -127,7 +127,7 @@
*/
@WebMethod
@WebResult(name="ThrowAddressExceptionResult")
- public int throwAddressException(@WebParam(name="in-param") int value)
throws AddressException {
+ public int throwAddressException(@WebParam(name="in_param") int value)
throws AddressException {
throw new AddressException("This is a sample message
for:\n\tAddressException; input value=\"" + value + "\"");
}
}
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralWrappedSample.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralWrappedSample.jws?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralWrappedSample.jws
(original)
+++
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/DocumentLiteralWrappedSample.jws
Tue Apr 5 14:22:44 2005
@@ -48,7 +48,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromBodyResult")
- public Address returnAddressFromBody(@WebParam(name="in-param-body",
mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromBody(@WebParam(name="in_param_body",
mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -59,7 +59,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromHeaderResult")
- public Address returnAddressFromHeader(@WebParam(name="in-param-header",
header=true, mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromHeader(@WebParam(name="in_param_header",
header=true, mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -70,7 +70,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInBodyResult")
- public int createAddressInBody(@WebParam(name="out-param-body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInBody(@WebParam(name="out_param_body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -85,7 +85,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInHeaderResult")
- public int createAddressInHeader(@WebParam(name="out-param-header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInHeader(@WebParam(name="out_param_header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -100,7 +100,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInBodyResult")
- public int changeAddressInBody(@WebParam(name="inout-param-body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInBody(@WebParam(name="inout_param_body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -113,7 +113,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInHeaderResult")
- public int changeAddressInHeader(@WebParam(name="inout-param-header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInHeader(@WebParam(name="inout_param_header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -127,7 +127,7 @@
*/
@WebMethod
@WebResult(name="ThrowAddressExceptionResult")
- public int throwAddressException(@WebParam(name="in-param") int value)
throws AddressException {
+ public int throwAddressException(@WebParam(name="in_param") int value)
throws AddressException {
throw new AddressException("This is a sample message
for:\n\tAddressException; input value=\"" + value + "\"");
}
}
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
(original)
+++
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
Tue Apr 5 14:22:44 2005
@@ -47,7 +47,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromBodyResult")
- public Address returnAddressFromBody(@WebParam(name="in-param-body",
mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromBody(@WebParam(name="in_param_body",
mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -58,7 +58,7 @@
*/
@WebMethod
@WebResult(name="ReturnAddressFromHeaderResult")
- public Address returnAddressFromHeader(@WebParam(name="in-param-header",
header=true, mode=WebParam.Mode.IN) Address address) {
+ public Address returnAddressFromHeader(@WebParam(name="in_param_header",
header=true, mode=WebParam.Mode.IN) Address address) {
return address;
}
@@ -69,7 +69,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInBodyResult")
- public int createAddressInBody(@WebParam(name="out-param-body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInBody(@WebParam(name="out_param_body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -84,7 +84,7 @@
*/
@WebMethod
@WebResult(name="ReturnCreateAddressInHeaderResult")
- public int createAddressInHeader(@WebParam(name="out-param-header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ public int createAddressInHeader(@WebParam(name="out_param_header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
StateType state = new StateType("WA");
Phone phoneNumber = new Phone(425, "555", "1234");
Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
@@ -99,7 +99,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInBodyResult")
- public int changeAddressInBody(@WebParam(name="inout-param-body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInBody(@WebParam(name="inout_param_body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -112,7 +112,7 @@
*/
@WebMethod
@WebResult(name="ChangeAddressInHeaderResult")
- public int changeAddressInHeader(@WebParam(name="inout-param-header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ public int changeAddressInHeader(@WebParam(name="inout_param_header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
Address address = addressHolder.value;
address.setZip(address.getZip() + 1);
return 0;
@@ -126,7 +126,7 @@
*/
@WebMethod
@WebResult(name="ThrowAddressExceptionResult")
- public int throwAddressException(@WebParam(name="in-param") int value)
throws AddressException {
+ public int throwAddressException(@WebParam(name="in_param") int value)
throws AddressException {
throw new AddressException("This is a sample message
for:\n\tAddressException; input value=\"" + value + "\"");
}
}
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?view=diff&r1=160222&r2=160223
==============================================================================
---
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
Tue Apr 5 14:22:44 2005
@@ -24,15 +24,21 @@
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.utils.BeanPropertyDescriptor;
+import org.apache.axis.utils.BeanUtils;
+import org.apache.axis.utils.JavaUtils;
import org.apache.axis.wsdl.fromJava.Namespaces;
import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
+import org.apache.beehive.wsm.axis.registration.AxisTypeMappingMetaData;
import org.apache.beehive.wsm.axis.util.encoding.XmlBeanDeserializerFactory;
import org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
import org.apache.beehive.wsm.jsr181.model.BeehiveWsMethodMetadata;
import org.apache.beehive.wsm.jsr181.model.BeehiveWsParameterMetadata;
import org.apache.beehive.wsm.jsr181.model.BeehiveWsSOAPBindingInfo;
import org.apache.beehive.wsm.jsr181.model.BeehiveWsTypeMetadata;
import org.apache.beehive.wsm.jsr181.util.InvalidTypeMappingException;
+import org.apache.beehive.wsm.registration.TypeRegistrar;
import org.apache.log4j.Logger;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlObject;
@@ -40,6 +46,8 @@
import javax.jws.WebParam;
import javax.wsdl.OperationType;
import javax.xml.namespace.QName;
+import javax.xml.rpc.holders.Holder;
+
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -131,8 +139,8 @@
final Class paramType = param.getJavaType();
if (pd.getTypeQName() == null) { // set the typeQName if
- // it is not set
- // already.
+ // it is not set
+ // already.
QName typeQName = configureTypeMapping(sd, paramType,
param.getWpTargetNamespace());
/*
@@ -244,17 +252,45 @@
private static QName configureTypeMapping(ServiceDesc desc, Class type,
String defaultNameSpace) throws InvalidTypeMappingException {
- if (Void.TYPE.equals(type)) {
- return null;
- } else {
+ try {
+ if (Void.TYPE.equals(type))
+ return null;
+
+// // If type is holder or it is generic holder, strip it to its
base type
+// type = TypeRegistrar.getUnderlyingType(type);
+//
+ if (AxisTypeMappingMetaData.isBuiltInType(type))
+ return AxisTypeMappingMetaData.getBuiltInTypeQname(type);
+
+ if(Holder.class.isAssignableFrom(type )) {
+ type = TypeRegistrar.getHoldersValueClass(type);
+ // NOTE: May need to register the holder type also.
+ }
+
+ // if type needs to be registered
TypeMapping tm = desc.getTypeMapping();
- QName q = tm.getTypeQName(type);
+ // QName q = tm.getTypeQName(type);
+ // System.out.println("###################################type: "
+ // + type.getCanonicalName() + " qname is: " + q
+ // + " default namesapce: " + defaultNameSpace);
+ // if (null == q || // Not registered
+ // !q.getNamespaceURI().equals(defaultNameSpace)) { // registered
+ // // but not
+ // // in
+ // // current
+ // // namespace
+ // // q = generateQName(type, desc);
+ // q = new QName(defaultNameSpace, Types
+ // .getLocalNameFromFullName(type.getName()));
+ // System.out
+ // .println("CREATE QNAME: #############################type: "
+ // + type.getCanonicalName() + " qname is: " + q);
+ // }
- if (null == q) {
- // q = generateQName(type, desc);
- q = new QName(defaultNameSpace, Types
- .getLocalNameFromFullName(type.getName()));
- }
+ BindingLookupService lookupService = new
SystemTypeLookupService(tm);
+ QName q = lookupService.class2qname(type, defaultNameSpace);
+
+
if (type.isArray()) {
/*
* [EMAIL PROTECTED] 2005-Mar-16 -- don't register array
@@ -271,7 +307,7 @@
q = qcomp;
}
} else if (!tm.isRegistered(type, q)) {
- if (XmlObject.class.isAssignableFrom(type)) {
+ if (XmlObject.class.isAssignableFrom(type)) {
q = XmlBeans.typeForClass(type).getName();
tm.register(type, q, new XmlBeanSerializerFactory(type, q),
new XmlBeanDeserializerFactory(type, q));
@@ -331,15 +367,23 @@
*/
&& !File.class.isAssignableFrom(type)) {
TypeDesc td = TypeDesc.getTypeDescForClass(type);
+
+ // if type was registered in a different namespace, then
+ // ignore this and create a new td
+ if (td != null
+ && !td.getXmlType().getNamespaceURI().equals(
+ q.getNamespaceURI())) {
+ td = null;
+ }
TypeDesc superTd = null;
BeanPropertyDescriptor[] superPd = null;
// type desc is used for java-xml mapping, make sure the
// class and all its super classes have a type desc
defined.
if (null == td) {
td = new TypeDesc(type); // create type descriptor
- // for this class --- NOT
- // its super classes at
this
- // point.
+ // for this class --- NOT
+ // its super classes at this
+ // point.
// add super class types.
Class supa = type.getSuperclass();
if ((supa != null) && (supa != java.lang.Object.class)
@@ -353,16 +397,16 @@
// super class.
superTd = TypeDesc.getTypeDescForClass(supa);
if (superTd != null) // super class is a regular java
- // bean with axis typedesc.
+ // bean with axis typedesc.
{
superPd = superTd.getPropertyDescriptors(); // this
- // is
- //
mapping
- // for
- // all
- // my
- //
super
- //
classes.
+ // is
+ // mapping
+ // for
+ // all
+ // my
+ // super
+ // classes.
}
td.setXmlType(q);
TypeDesc.registerTypeDescForClass(type, td);
@@ -373,21 +417,38 @@
// !=null)
} else {
td = null; // we don't need type desc. any more this is
- // a complete td
+ // a complete td
}
+ //
+ // // At this all parent bean classes and their properties
+ // // (attributes) have been registered with typedecriptor
+ // and
+ // // type mapping.
+ // // next regidster type for this class.
+ // tm.register(type, q, new BeanSerializerFactory(type, q),
+ // /*
+ // * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- should check
that
+ // * the type to deserialize has a default contructor but
+ // with
+ // * this setup there is no way to know if it is used only
+ // in
+ // * serialization.
+ // */
+ // new BeanDeserializerFactory(type, q));
// At this all parent bean classes and their properties
// (attributes) have been registered with typedecriptor and
// type mapping.
// next regidster type for this class.
- tm.register(type, q, new BeanSerializerFactory(type, q),
+ tm.register(type, q, new EnhancedBeanSerializerFactory(
+ type, q, td),
/*
* NOTE [EMAIL PROTECTED] 2004-Oct-11 -- should check that
* the type to deserialize has a default contructor but
with
* this setup there is no way to know if it is used only in
* serialization.
*/
- new BeanDeserializerFactory(type, q));
+ new EnhancedBeanDeSerializerFactory(type, q, td));
// now register the types for this bean properties
// (attributes)
@@ -406,27 +467,27 @@
.getName().startsWith("javax."))) {
configureTypeMapping(desc, subType,
defaultNameSpace); // if this was XML bean
- // this recursion would
- // take care of it
+ // this recursion would
+ // take care of it
}
if (td != null) { // if I didn't have type descriptor
- // when I came to this method... I
- // created partially filled one
- // above
+ // when I came to this method... I
+ // created partially filled one
+ // above
// now need to complete this.
String ns = q.getNamespaceURI(); // name space
- // for the
class
- // if there is
- // no parent
+ // for the class
+ // if there is
+ // no parent
// find proper namespace for this element... we
need
// to find out whihc class in the hierarchy the
// element came from
// once you know where the element came form (which
// class) then you know the element's name space.
if (superTd != null && superPd != null) { // if I
- // had
a
- //
parent,
+ // had a
+ // parent,
for (int j = 0; j < superPd.length; j++) {
if (beanProps.getName().equals(
superPd[j].getName())) {
@@ -459,6 +520,11 @@
}
}
return q;
+
+ } catch (RuntimeException e) {
+ logger.error("Error in type registeration", e);
+ e.printStackTrace();
+ throw e;
}
}
@@ -503,4 +569,37 @@
}
}
}
+}
+
+/*
+ * A TEMP SOLUTION TO BEAN Serialization/Deserialization problem The problem is
+ * that the Axis factories use the types that are defined for a class, so a
+ * given class can't be in multiple name spaces. In this solution the factory
+ * gets the type descriptor in the constructor
+ */
+
+class EnhancedBeanSerializerFactory extends BeanSerializerFactory {
+ public EnhancedBeanSerializerFactory(Class javaType, QName xmlType,
+ TypeDesc typeDesc) {
+ super(javaType, xmlType);
+
+ this.typeDesc = typeDesc;
+
+ if (typeDesc != null) {
+ propertyDescriptor = typeDesc.getPropertyDescriptors();
+ } else {
+ propertyDescriptor = BeanUtils.getPd(javaType, null);
+ }
+ }
+}
+
+class EnhancedBeanDeSerializerFactory extends BeanDeserializerFactory {
+ public EnhancedBeanDeSerializerFactory(Class javaType, QName xmlType,
+ TypeDesc typeDesc) {
+ super(javaType, xmlType);
+
+ this.typeDesc = typeDesc;
+ propertyMap = getProperties(javaType, typeDesc);
+ }
+
}
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?view=diff&r1=160222&r2=160223
==============================================================================
---
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
Tue Apr 5 14:22:44 2005
@@ -26,6 +26,7 @@
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.wsdl.fromJava.Namespaces;
import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.beehive.wsm.axis.registration.AxisTypeMappingMetaData;
import org.apache.beehive.wsm.databinding.BindingLookupService;
@@ -51,10 +52,20 @@
.endsWith("DefaultNamespace")) {
namespace = "http://no.namespace.specified";
}
- return new QName(namespace,
- Types.getLocalNameFromFullName(cls.getName()));
+ return class2qname(cls, namespace);
}
+
+ /**
+ * @param cls
+ * @param namespace
+ * @return
+ */
+ public QName class2qname(Class cls, String namespace) {
+ if(AxisTypeMappingMetaData.isBuiltInType(cls)) return
AxisTypeMappingMetaData.getBuiltInTypeQname(cls);
+ return new QName(namespace,
+ Types.getLocalNameFromFullName(cls.getName()));
+ }
public Class qname2class(QName qType) {
return tm.getClassForQName(qType);
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?view=diff&r1=160222&r2=160223
==============================================================================
---
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
Tue Apr 5 14:22:44 2005
@@ -47,16 +47,26 @@
public QName class2qname(Class cls) {
QName qname = null;
- // DOES THE LOOK UP SERVICE CHECK FOR THE PRIMITIVE TPYTES? IF
so we don't need this here.
- if(cls == String.class) {
- return XMLType.XSD_STRING;
- }
for(BindingLookupService lookUpService : lookupServiceList) {
if( null != (qname = lookUpService.class2qname(cls)))
break;
}
return qname;
}
+
+
+ /* (non-Javadoc)
+ * @see TypeLookUpServices#getClassQName(java.lang.Class)
+ */
+ public QName class2qname(Class cls, String namespace) {
+ QName qname = null;
+
+
+ for(BindingLookupService lookUpService : lookupServiceList) {
+ if( null != (qname = lookUpService.class2qname(cls, namespace)))
break;
+ }
+ return qname;
+ }
/* (non-Javadoc)
* @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
*/
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?view=diff&r1=160222&r2=160223
==============================================================================
---
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
Tue Apr 5 14:22:44 2005
@@ -28,6 +28,8 @@
import java.util.List;
import java.util.Map;
+
+
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.HandlerInfo;
@@ -44,7 +46,6 @@
import org.apache.axis.providers.java.RPCProvider;
import org.apache.axis.utils.ClassUtils;
-import org.apache.commons.logging.Log;
import org.apache.beehive.wsm.axis.AxisHook;
import org.apache.beehive.wsm.axis.ControlProvider;
@@ -53,7 +54,7 @@
import org.apache.beehive.wsm.jsr181.model.jsr181.Jsr181ObjectModelStore;
import org.w3c.dom.Element;
-
+import org.apache.log4j.Logger;
/**
* ****************************************************************************
* A few annotation specific things added and lots of code copied from the
@@ -68,8 +69,7 @@
*/
public class AnnotatedWebServiceDeploymentHandler extends BasicHandler {
- protected static Log log = LogFactory
- .getLog(AnnotatedWebServiceDeploymentHandler.class.getName());
+ protected static Logger logger =
Logger.getLogger(AnnotatedWebServiceDeploymentHandler.class);
protected Map<String, SOAPService> soapServices = new HashMap<String,
SOAPService>();
@@ -254,13 +254,13 @@
}
// load class
- if (log.isDebugEnabled()) {
- log.debug("trying to load web service class: " + className);
+ if (logger.isDebugEnabled()) {
+ logger.debug("trying to load web service class: " + className);
}
Class clazz = Jsr181ObjectModelStore.loadWebServiceClass(className);
if (null == clazz) {
- if (log.isDebugEnabled()) {
- log.debug("failed to load web service class: " + className);
+ if (logger.isDebugEnabled()) {
+ logger.debug("failed to load web service class: " + className);
}
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AuthenticationHandler.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AuthenticationHandler.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AuthenticationHandler.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AuthenticationHandler.java
Tue Apr 5 14:22:44 2005
@@ -59,7 +59,7 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
-import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
/*******************************************************************************
@@ -68,8 +68,7 @@
*/
public class AuthenticationHandler extends BasicHandler {
- protected static Log log =
- LogFactory.getLog(AuthenticationHandler.class.getName());
+ protected static Logger logger =
Logger.getLogger(AuthenticationHandler.class);
/* cache Jsr181MethodMetadata objects associated with a Method object */
private static Map<Method, BeehiveWsMethodMetadata> methodCache =
@@ -79,8 +78,8 @@
public void invoke(MessageContext msgContext) throws AxisFault
{
- if (log.isDebugEnabled()) {
- log.debug("Enter: AuthenticationHandler::invoke");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enter: AuthenticationHandler::invoke");
}
ServiceDesc serviceDesc =
msgContext.getService().getServiceDescription();
@@ -127,9 +126,9 @@
return;
}
- if (log.isDebugEnabled())
+ if (logger.isDebugEnabled())
{
- log.debug("WsmAuthenticationHandler::invoke ( [ServiceName] : " +
+ logger.debug("WsmAuthenticationHandler::invoke ( [ServiceName] : "
+
wsm.getWsName() + " [Method] " + operationDesc.getName() +
")");
}
@@ -164,15 +163,15 @@
{
// Both the method and the class requested by client is not
annotated
// with
@SecurityRoles.rolesAllowed.
- log.debug("NO SECURITY ROLE RESTRICTION ! -> OK");
+ logger.debug("NO SECURITY ROLE RESTRICTION ! -> OK");
return;
}
- if (log.isDebugEnabled()) {
- log.debug("Required roles to access the resource.");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Required roles to access the resource.");
for ( String role : rolesAllowed )
{
- log.debug("ROLE : " + role);
+ logger.debug("ROLE : " + role);
}
}
@@ -180,22 +179,22 @@
if (result)
{
- if (log.isDebugEnabled())
+ if (logger.isDebugEnabled())
{
- log.debug("AUTH SUCCEEDED ! -> OK");
+ logger.debug("AUTH SUCCEEDED ! -> OK");
}
}
else
{
- if (log.isDebugEnabled())
+ if (logger.isDebugEnabled())
{
- log.debug("AUTH FAILED ! -> NG");
+ logger.debug("AUTH FAILED ! -> NG");
}
throw new AxisFault("Server.Unauthenticated", "Authorization
failed", null, null);
}
- if (log.isDebugEnabled()) {
- log.debug("Exit: WsmAuthenticationHandler::invoke");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Exit: WsmAuthenticationHandler::invoke");
}
}
@@ -225,9 +224,9 @@
if (null == securityModelImpl)
{
String securityModel = (String) getOption("securityModel");
- if (log.isDebugEnabled())
+ if (logger.isDebugEnabled())
{
- log.debug("WsmAuthenticationHandler::init securityMode ["+
securityModel +"]");
+ logger.debug("WsmAuthenticationHandler::init securityMode
["+ securityModel +"]");
}
try
@@ -237,19 +236,19 @@
}
catch (NullPointerException e)
{
- log.error("The securityModel class is not specified: " +
e.getMessage(), e);
+ logger.error("The securityModel class is not specified: "
+ e.getMessage(), e);
}
catch (ClassNotFoundException e)
{
- log.error("The securityModel ["+ securityModel +"] class
specified was not found: " + e.getMessage(), e);
+ logger.error("The securityModel ["+ securityModel +"]
class specified was not found: " + e.getMessage(), e);
}
catch (InstantiationException e)
{
- log.error(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
- log.error(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
}
}
@@ -321,7 +320,7 @@
{
// ignore this exception.
// let Axis handle this exception.
- log.debug("ClassNotFoundException ["+ serviceName +"]: " +
cnfe.getMessage());
+ logger.debug("ClassNotFoundException ["+ serviceName +"]: " +
cnfe.getMessage());
}
catch( Exception e)
{
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeRegistrar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeRegistrar.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeRegistrar.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeRegistrar.java
Tue Apr 5 14:22:44 2005
@@ -57,8 +57,7 @@
public AxisTypeRegistrar(TypeMapping tm, BindingLookupService
lookupService) {
super(tm, lookupService);
- initBuildInTypes();
-
+
}
@@ -67,20 +66,10 @@
* @return boolean
*/
protected boolean isBuiltInType(Class cls) {
- return (builtInTypes.containsKey(cls));
+ return (AxisTypeMappingMetaData.isBuiltInType(cls));
}
- // Class cls = super.q2Class(qType);
- // if (Object.class.equals(cls) && mTypeMapping != null) {
- // cls = mTypeMapping.getClassForQName(qType);
- // return cls;
- // }
- // else {
- // return null;
- // }
- // }
-
/**
* @param cls
* @param q
@@ -243,204 +232,12 @@
}
- Map<Class, QName> builtInTypes = new HashMap<Class, QName>();
-
- /**
- *
- */
- private void initBuildInTypes() {
- // HexBinary binary data needs to use the hex binary
- // serializer/deserializer
- addBuiltInType(Constants.XSD_HEXBIN, HexBinary.class);
- addBuiltInType(Constants.XSD_HEXBIN, byte[].class);
-
- addBuiltInType(Constants.XSD_BYTE, byte[].class);
-
- addBuiltInType(Constants.XSD_BASE64, byte[].class);
-
- // anySimpleType is mapped to java.lang.String according to JAX-RPC 1.1
- // spec.
- addBuiltInType(Constants.XSD_ANYSIMPLETYPE, java.lang.String.class);
-
- // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives.
- addBuiltInType(Constants.XSD_STRING, java.lang.String.class);
- addBuiltInType(Constants.XSD_BOOLEAN, java.lang.Boolean.class);
- addBuiltInType(Constants.XSD_DOUBLE, java.lang.Double.class);
- addBuiltInType(Constants.XSD_FLOAT, java.lang.Float.class);
- addBuiltInType(Constants.XSD_INT, java.lang.Integer.class);
- addBuiltInType(Constants.XSD_INTEGER, java.math.BigInteger.class);
- addBuiltInType(Constants.XSD_DECIMAL, java.math.BigDecimal.class);
- addBuiltInType(Constants.XSD_LONG, java.lang.Long.class);
- addBuiltInType(Constants.XSD_SHORT, java.lang.Short.class);
- addBuiltInType(Constants.XSD_BYTE, java.lang.Byte.class);
-
- // The XSD Primitives are mapped to java primitives.
- addBuiltInType(Constants.XSD_BOOLEAN, boolean.class);
- addBuiltInType(Constants.XSD_DOUBLE, double.class);
- addBuiltInType(Constants.XSD_FLOAT, float.class);
- addBuiltInType(Constants.XSD_INT, int.class);
- addBuiltInType(Constants.XSD_LONG, long.class);
- addBuiltInType(Constants.XSD_SHORT, short.class);
- addBuiltInType(Constants.XSD_BYTE, byte.class);
-
- // Map QNAME to the jax rpc QName class
- addBuiltInType(Constants.XSD_QNAME, javax.xml.namespace.QName.class);
-
- // The closest match for anytype is Object
- addBuiltInType(Constants.XSD_ANYTYPE, java.lang.Object.class);
-
- // See the SchemaVersion classes for where the registration of
- // dateTime (for 2001) and timeInstant (for 1999 & 2000) happen.
- addBuiltInType(Constants.XSD_DATE, java.sql.Date.class);
-
- // See the SchemaVersion classes for where the registration of
- // dateTime (for 2001) and timeInstant (for 1999 & 2000) happen.
- addBuiltInType(Constants.XSD_DATE, java.util.Date.class);
-
- // Mapping for xsd:time. Map to Axis type Time
- addBuiltInType(Constants.XSD_TIME, org.apache.axis.types.Time.class);
- // These are the g* types (gYearMonth, etc) which map to Axis types
- addBuiltInType(Constants.XSD_YEARMONTH,
- org.apache.axis.types.YearMonth.class);
- addBuiltInType(Constants.XSD_YEAR, org.apache.axis.types.Year.class);
- addBuiltInType(Constants.XSD_MONTH, org.apache.axis.types.Month.class);
- addBuiltInType(Constants.XSD_DAY, org.apache.axis.types.Day.class);
- addBuiltInType(Constants.XSD_MONTHDAY,
- org.apache.axis.types.MonthDay.class);
-
- // Serialize all extensions of Map to SOAP_MAP
- // Order counts here, HashMap should be last.
- addBuiltInType(Constants.SOAP_MAP, java.util.Hashtable.class);
- addBuiltInType(Constants.SOAP_MAP, java.util.Map.class);
- // The SOAP_MAP will be deserialized into a HashMap by default.
- addBuiltInType(Constants.SOAP_MAP, java.util.HashMap.class);
-
- // Use the Element Serializeration for elements
- addBuiltInType(Constants.SOAP_ELEMENT, org.w3c.dom.Element.class);
-
- // Use the Document Serializeration for Document's
- addBuiltInType(Constants.SOAP_DOCUMENT, org.w3c.dom.Document.class);
-
- addBuiltInType(Constants.SOAP_VECTOR, java.util.Vector.class);
-
- // if (JavaUtils.isAttachmentSupported()) {
- // addBuiltInType(Constants.MIME_IMAGE, java.awt.Image.class);
- // addBuiltInType(Constants.MIME_MULTIPART,
- // javax.mail.internet.MimeMultipart.class);
- // addBuiltInType(Constants.MIME_SOURCE,
- // javax.xml.transform.Source.class);
- // addBuiltInType(Constants.MIME_OCTETSTREAM, OctetStream.class);
- // addBuiltInType(Constants.MIME_DATA_HANDLER,
- // javax.activation.DataHandler.class);
- // }
-
- // xsd:token
- addBuiltInType(Constants.XSD_TOKEN, org.apache.axis.types.Token.class);
-
- // a xsd:normalizedString
- addBuiltInType(Constants.XSD_NORMALIZEDSTRING,
- org.apache.axis.types.NormalizedString.class);
-
- // a xsd:unsignedLong
- addBuiltInType(Constants.XSD_UNSIGNEDLONG,
- org.apache.axis.types.UnsignedLong.class);
-
- // a xsd:unsignedInt
- addBuiltInType(Constants.XSD_UNSIGNEDINT,
- org.apache.axis.types.UnsignedInt.class);
-
- // a xsd:unsignedShort
- addBuiltInType(Constants.XSD_UNSIGNEDSHORT,
- org.apache.axis.types.UnsignedShort.class);
-
- // a xsd:unsignedByte
- addBuiltInType(Constants.XSD_UNSIGNEDBYTE,
- org.apache.axis.types.UnsignedByte.class);
-
- // a xsd:nonNegativeInteger
- addBuiltInType(Constants.XSD_NONNEGATIVEINTEGER,
- org.apache.axis.types.NonNegativeInteger.class);
-
- // a xsd:negativeInteger
- addBuiltInType(Constants.XSD_NEGATIVEINTEGER,
- org.apache.axis.types.NegativeInteger.class);
-
- // a xsd:positiveInteger
- addBuiltInType(Constants.XSD_POSITIVEINTEGER,
- org.apache.axis.types.PositiveInteger.class);
-
- // a xsd:nonPositiveInteger
- addBuiltInType(Constants.XSD_NONPOSITIVEINTEGER,
- org.apache.axis.types.NonPositiveInteger.class);
-
- // a xsd:Name
- addBuiltInType(Constants.XSD_NAME, org.apache.axis.types.Name.class);
-
- // a xsd:NCName
- addBuiltInType(Constants.XSD_NCNAME,
org.apache.axis.types.NCName.class);
-
- // a xsd:ID
- addBuiltInType(Constants.XSD_ID, org.apache.axis.types.Id.class);
-
- // a xml:lang
- addBuiltInType(Constants.XML_LANG,
org.apache.axis.types.Language.class);
-
- // a xsd:language
- addBuiltInType(Constants.XSD_LANGUAGE,
- org.apache.axis.types.Language.class);
-
- // a xsd:NmToken
- addBuiltInType(Constants.XSD_NMTOKEN,
- org.apache.axis.types.NMToken.class);
-
- // a xsd:NmTokens
- addBuiltInType(Constants.XSD_NMTOKENS,
- org.apache.axis.types.NMTokens.class);
-
- // a xsd:NOTATION
- addBuiltInType(Constants.XSD_NOTATION,
- org.apache.axis.types.Notation.class);
-
- // a xsd:XSD_ENTITY
- addBuiltInType(Constants.XSD_ENTITY,
org.apache.axis.types.Entity.class);
-
- // a xsd:XSD_ENTITIES
- addBuiltInType(Constants.XSD_ENTITIES,
- org.apache.axis.types.Entities.class);
-
- // a xsd:XSD_IDREF
- addBuiltInType(Constants.XSD_IDREF, org.apache.axis.types.IDRef.class);
-
- // a xsd:XSD_XSD_IDREFS
- addBuiltInType(Constants.XSD_IDREFS,
org.apache.axis.types.IDRefs.class);
-
- // a xsd:Duration
- addBuiltInType(Constants.XSD_DURATION,
- org.apache.axis.types.Duration.class);
-
- // a xsd:anyURI
- addBuiltInType(Constants.XSD_ANYURI, org.apache.axis.types.URI.class);
-
- // a xsd:schema
- addBuiltInType(Constants.XSD_SCHEMA,
org.apache.axis.types.Schema.class);
-
- addBuiltInType(Constants.SOAP_ARRAY, java.util.ArrayList.class);
- }
-
- /**
- * @param xsd_hexbin
- * @param name
- */
- private void addBuiltInType(QName q, Class c) {
- builtInTypes.put(c, q);
-
- }
-
+
/* (non-Javadoc)
* @see
org.apache.beehive.wsm.registration.TypeRegistrar#getBuiltInTypeQname(java.lang.Class)
*/
protected QName getBuiltInTypeQname(Class cls) {
- return builtInTypes.get(cls);
+ return AxisTypeMappingMetaData.getBuiltInTypeQname(cls);
}
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/AxisSecurityModel.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/AxisSecurityModel.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/AxisSecurityModel.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/AxisSecurityModel.java
Tue Apr 5 14:22:44 2005
@@ -31,12 +31,11 @@
import org.apache.axis.security.SecurityProvider;
import org.apache.axis.security.simple.SimpleSecurityProvider;
import org.apache.axis.security.servlet.ServletSecurityProvider;
-import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
public class AxisSecurityModel implements SecurityModel {
- protected static Log log =
- LogFactory.getLog(AxisSecurityModel.class.getName());
+ protected static Logger logger =
Logger.getLogger(AxisSecurityModel.class);
public void init ( MessageContext msgContext )
{
@@ -48,8 +47,8 @@
*/
public boolean isUserInRole ( MessageContext msgContext,
Collection<String> rolesAllowed ){
- if (log.isDebugEnabled()) {
- log.debug("Enter: AxisSecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enter: AxisSecurityModel::isUserInRole");
}
SecurityProvider provider =
(SecurityProvider)msgContext.getProperty(MessageContext.SECURITY_PROVIDER);
@@ -62,27 +61,27 @@
if (provider != null) {
String userID = msgContext.getUsername();
- if (log.isDebugEnabled()) {
- log.debug("user : " + userID );
+ if (logger.isDebugEnabled()) {
+ logger.debug("user : " + userID );
}
// in order to authenticate, the user must exist
if ( userID == null || userID.equals("") )
{
- log.debug("userID is null");
+ logger.debug("userID is null");
return false;
}
String passwd = msgContext.getPassword();
- if (log.isDebugEnabled()) {
- log.debug("password : " + passwd );
+ if (logger.isDebugEnabled()) {
+ logger.debug("password : " + passwd );
}
AuthenticatedUser authUser = provider.authenticate(msgContext);
// if a password is defined, then it must match
if ( authUser == null) {
- log.debug("authuser is null");
+ logger.debug("authuser is null");
return false;
}
@@ -92,8 +91,8 @@
{
// BINGO !!
- if (log.isDebugEnabled()) {
- log.debug( "auth : " + userID + " is in role [" + role
+ "]");
+ if (logger.isDebugEnabled()) {
+ logger.debug( "auth : " + userID + " is in role [" +
role + "]");
}
msgContext.setProperty(SecurityModel.BEEHIVE_AUTHUSER,
authUser);
return true;
@@ -101,8 +100,8 @@
}
}
- if (log.isDebugEnabled()) {
- log.debug("Exit: AxisSecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Exit: AxisSecurityModel::isUserInRole");
}
return false;
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?view=diff&r1=160222&r2=160223
==============================================================================
---
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
Tue Apr 5 14:22:44 2005
@@ -39,12 +39,11 @@
import org.apache.axis.security.AuthenticatedUser;
import org.apache.axis.security.SecurityProvider;
import org.apache.axis.security.simple.SimpleSecurityProvider;
-import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
public class BeehiveMemorySecurityModel implements SecurityModel {
- protected static Log log =
- LogFactory.getLog(BeehiveMemorySecurityModel.class.getName());
+ protected static Logger logger =
Logger.getLogger(BeehiveMemorySecurityModel.class);
private static final String BEEHIVE_ROLE_FILE = "beehive-role.xml";
@@ -54,8 +53,8 @@
public void init ( MessageContext msgContext )
{
- if (log.isDebugEnabled()) {
- log.debug("Enter: BeehiveMemorySecurityModel::init");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enter: BeehiveMemorySecurityModel::init");
}
if ( userList != null )
@@ -80,8 +79,8 @@
configPath += File.separator;
}
- if (log.isDebugEnabled()) {
- log.debug("BEEHIVE_ROLE_FILE : " + configPath +
BEEHIVE_ROLE_FILE );
+ if (logger.isDebugEnabled()) {
+ logger.debug("BEEHIVE_ROLE_FILE : " + configPath +
BEEHIVE_ROLE_FILE );
}
BeehiveRoleDocument brd = null;
@@ -89,7 +88,7 @@
try{
brd = BeehiveRoleDocument.Factory.parse( new File (
configPath + BEEHIVE_ROLE_FILE ) );
}catch(Exception e){
- log.error("BeehiveRoleDocument couldn't parse the file ("+
configPath + BEEHIVE_ROLE_FILE +") : " + e.getMessage(), e);
+ logger.error("BeehiveRoleDocument couldn't parse the file
("+ configPath + BEEHIVE_ROLE_FILE +") : " + e.getMessage(), e);
return;
}
@@ -99,8 +98,8 @@
} // synchronized
- if (log.isDebugEnabled()) {
- log.debug("Exit : BeehiveMemorySecurityModel::init");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Exit : BeehiveMemorySecurityModel::init");
}
}
@@ -136,8 +135,8 @@
Role memoryRole = userList.getRole( role.getName() );
if ( memoryRole != null )
{
- if (log.isDebugEnabled()) {
- log.debug("GROUP : " + memoryGroup.getName() +
" in ROLE : " + memoryRole.getName() );
+ if (logger.isDebugEnabled()) {
+ logger.debug("GROUP : " +
memoryGroup.getName() + " in ROLE : " + memoryRole.getName() );
}
memoryGroup.addRole ( memoryRole );
}
@@ -164,8 +163,8 @@
Group memoryGroup = userList.getGroup( group.getName()
);
if ( memoryGroup != null )
{
- if (log.isDebugEnabled()) {
- log.debug("USER : " + memoryUser.getName() + "
in GROUP : " + memoryGroup.getName() );
+ if (logger.isDebugEnabled()) {
+ logger.debug("USER : " + memoryUser.getName()
+ " in GROUP : " + memoryGroup.getName() );
}
// User and Group hold references to each other
@@ -193,8 +192,8 @@
Role memoryRole = userList.getRole( role.getName() );
if ( memoryRole != null )
{
- if (log.isDebugEnabled()) {
- log.debug("USER : " + memoryUser.getName() + "
in ROLE : " + memoryRole.getName() );
+ if (logger.isDebugEnabled()) {
+ logger.debug("USER : " + memoryUser.getName()
+ " in ROLE : " + memoryRole.getName() );
}
memoryUser.addRole( memoryRole );
}
@@ -209,59 +208,59 @@
public boolean isUserInRole ( MessageContext msgContext,
Collection<String> rolesAllowed ){
- if (log.isDebugEnabled()) {
- log.debug("Enter: BeehiveMemorySecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enter: BeehiveMemorySecurityModel::isUserInRole");
}
String username = msgContext.getUsername();
- if (log.isDebugEnabled()) {
- log.debug("username from client : " + username);
+ if (logger.isDebugEnabled()) {
+ logger.debug("username from client : " + username);
}
if ( username == null ){
return false; // user didn't specify username.
}
- if (log.isDebugEnabled()) {
- log.debug("username from client : " + username);
+ if (logger.isDebugEnabled()) {
+ logger.debug("username from client : " + username);
}
User user = userList.getUser ( username );
if ( user == null ) {
- if (log.isDebugEnabled()) {
- log.debug("user returned from userList is null");
+ if (logger.isDebugEnabled()) {
+ logger.debug("user returned from userList is null");
}
return false; // user doesn't exist.
}
if ( ! user.authenticate( msgContext.getPassword() ) )
{
- if (log.isDebugEnabled()) {
- log.debug("authenticate failed");
+ if (logger.isDebugEnabled()) {
+ logger.debug("authenticate failed");
}
return false; // password doesn't match.
}
- if (log.isDebugEnabled()) {
- log.debug("authenticate passed (" + username + ")");
+ if (logger.isDebugEnabled()) {
+ logger.debug("authenticate passed (" + username + ")");
}
for ( Role role : user.getRoles() )
{
- if (log.isDebugEnabled()) {
- log.debug("user [" + user.getName() + "] role ["+
role.getName() +"]");
+ if (logger.isDebugEnabled()) {
+ logger.debug("user [" + user.getName() + "] role ["+
role.getName() +"]");
}
for ( String roleAllowed : rolesAllowed )
{
if ( role.getName().equals( roleAllowed ) )
{
- if (log.isDebugEnabled()) {
- log.debug( "auth : " + user.getName()+ " is in role ["
+ roleAllowed + "]");
+ if (logger.isDebugEnabled()) {
+ logger.debug( "auth : " + user.getName()+ " is in role
[" + roleAllowed + "]");
}
msgContext.setProperty(SecurityModel.BEEHIVE_AUTHUSER,
user);
return true;
@@ -270,8 +269,8 @@
}
- if (log.isDebugEnabled()) {
- log.debug("Exit: BeehiveMemorySecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Exit: BeehiveMemorySecurityModel::isUserInRole");
}
return false;
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/ServletSecurityModel.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/ServletSecurityModel.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/ServletSecurityModel.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/security/model/ServletSecurityModel.java
Tue Apr 5 14:22:44 2005
@@ -29,12 +29,11 @@
import org.apache.axis.security.AuthenticatedUser;
import org.apache.axis.security.SecurityProvider;
import org.apache.axis.security.simple.SimpleSecurityProvider;
-import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
public class ServletSecurityModel implements SecurityModel {
- protected static Log log =
- LogFactory.getLog(ServletSecurityModel.class.getName());
+ protected static Logger logger =
Logger.getLogger(ServletSecurityModel.class);
public void init ( MessageContext msgContext )
{
@@ -46,8 +45,8 @@
*/
public boolean isUserInRole ( MessageContext msgContext,
Collection<String> rolesAllowed ){
- if (log.isDebugEnabled()) {
- log.debug("Enter: ServletSecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enter: ServletSecurityModel::isUserInRole");
}
SecurityProvider provider =
(SecurityProvider)msgContext.getProperty(MessageContext.SECURITY_PROVIDER);
@@ -58,27 +57,27 @@
if (provider != null) {
String userID = msgContext.getUsername();
- if (log.isDebugEnabled()) {
- log.debug("user : " + userID );
+ if (logger.isDebugEnabled()) {
+ logger.debug("user : " + userID );
}
// in order to authenticate, the user must exist
if ( userID == null || userID.equals("") )
{
- log.debug("userID is null");
+ logger.debug("userID is null");
return false;
}
String passwd = msgContext.getPassword();
- if (log.isDebugEnabled()) {
- log.debug("password : " + passwd );
+ if (logger.isDebugEnabled()) {
+ logger.debug("password : " + passwd );
}
AuthenticatedUser authUser = provider.authenticate(msgContext);
// if a password is defined, then it must match
if ( authUser == null) {
- log.debug("authuser is null");
+ logger.debug("authuser is null");
return false;
}
@@ -88,8 +87,8 @@
{
// BINGO !!
- if (log.isDebugEnabled()) {
- log.debug( "auth : " + userID + " is in role [" + role
+ "]");
+ if (logger.isDebugEnabled()) {
+ logger.debug( "auth : " + userID + " is in role [" +
role + "]");
}
msgContext.setProperty(SecurityModel.BEEHIVE_AUTHUSER,
authUser);
return true;
@@ -97,8 +96,8 @@
}
}
- if (log.isDebugEnabled()) {
- log.debug("Exit: ServletSecurityModel::isUserInRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Exit: ServletSecurityModel::isUserInRole");
}
return false;
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/BindingLookupService.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/BindingLookupService.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/BindingLookupService.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/BindingLookupService.java
Tue Apr 5 14:22:44 2005
@@ -36,5 +36,6 @@
*/
public interface BindingLookupService {
public abstract QName class2qname(Class cls);
+ public QName class2qname(Class cls, String namespace);
public Class qname2class(QName qname);
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
Tue Apr 5 14:22:44 2005
@@ -43,6 +43,12 @@
}
return null;
}
+
+ public QName class2qname(Class cls, String defaultnamespace) {
+ QName res = class2qname(cls);
+ // for xmlbeans we can ignore default name space.
+ return res;
+ }
/* (non-Javadoc)
* @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
@@ -92,15 +98,6 @@
}
}
}
- /*
- else if (st.isSimpleType()){
- System.out.println(clName + " is simple but not built
in");
- }
- else {
- System.out.println(clName + " is NOT built in");
- }
- System.out.println("resulting class: " +
xmlClass.getName());
- */
return xmlClass;
}
else {
@@ -113,8 +110,9 @@
private Class scanDeclaredMethodsForViableReturnType
(Method[] declared) {
-
- System.out.println("POSSIBLE BUG..... NEED TO USE TABLE LOOK UP
FOR PRIMITIVE TYPES");
+ /* TODO: Does this make sense? IT looks as if the type of the class
is determined based on the
+ * method return types.
+ */
for (Method meth : declared) {
Class returnType = meth.getReturnType();
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/registration/TypeRegistrar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/registration/TypeRegistrar.java?view=diff&r1=160222&r2=160223
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/registration/TypeRegistrar.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/registration/TypeRegistrar.java
Tue Apr 5 14:22:44 2005
@@ -22,6 +22,7 @@
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.rmi.Remote;
import java.util.HashMap;
@@ -123,6 +124,8 @@
if (q == null)
throw new RuntimeException(
"Invalid registeration requestion qname is null");
+
+
if (isBuiltInType(cls))
return getBuiltInTypeQname(cls);
if (cls.isArray()) {
@@ -134,10 +137,7 @@
// if (expectedType != null) {
// q = expectedType;
// }
- } else if (!classIsRegistered(cls, q)) { // WHY
- // IS
- // THIS
- // NEEDED?
+ } else if (!classIsRegistered(cls, q)) {
if (org.apache.xmlbeans.XmlObject.class.isAssignableFrom(cls))
{
registerClassAsXMLBeans(cls, q);
}
@@ -216,45 +216,39 @@
return null;
}
+
/**
* @param t
* @throws Exception
*/
- static public Class getUnderlyingType(Type t) {
- Class nxtType = null;
- if (t instanceof Class) {
- // for holder class we need to get the value field type
- if (Holder.class.isAssignableFrom((Class) t)) {
- Field[] publicFields = ((Class) t).getFields();
+ static public Class getHoldersValueClass(Type t) {
+ Class res = null;
+
+ if (t instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType)t;
+ Type raw = pt.getRawType();
+ if( GenericHolder.class.isAssignableFrom((Class)raw)) {
+ Type[] typeArgs = pt.getActualTypeArguments();
+ res = (Class) typeArgs[0];
+ }else {
+ throw new RuntimeException("Invalid parameterized type for
holder: " + t);
+ }
+
+ } else if (t instanceof Class) {
+ if(Holder.class.isAssignableFrom((Class)t)) {
+ // if type is not a holder type, there is no point to dig any
deeper
+ Field[] publicFields = ((Class)t).getFields();
for (int i = 0; i < publicFields.length; i++) {
if (0 == "value".compareTo(publicFields[i].getName())) {
- nxtType = publicFields[i].getType();
- System.out
- .println("******************************class
: "
- + t.getClass().getCanonicalName()
- + " is converted to: "
- + nxtType.getCanonicalName());
- break;
+ res = publicFields[i].getType();
+ break;
}
}
- } else { // if it is not a holder just use the type as is
- nxtType = (Class) t;
- }
- } else if (t instanceof java.lang.reflect.ParameterizedType) {
- java.lang.reflect.ParameterizedType pt =
((java.lang.reflect.ParameterizedType) t);
- Type[] typeArgs = pt.getActualTypeArguments();
- Type raw = pt.getRawType();
- if (GenericHolder.class.isAssignableFrom((Class) raw)
- && typeArgs.length == 1) {
- nxtType = (Class) typeArgs[0];
} else {
- throw new RuntimeException(raw + " ~ " + typeArgs[0]);
+ throw new RuntimeException("Invalid class. Type: " + t + " is
not a holder.");
}
- } else {
- throw new RuntimeException("Only Classes and ParameterizedTypes"
- + " are currently handled, support for " + t.getClass()
- + " should be added.");
}
- return nxtType;
+ // other wise just return the type
+ return res;
}
}