You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/06/24 20:06:33 UTC
svn commit: r957655 [12/15] - in /geronimo/server/trunk: ./
framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/
framework/configs/geronimo-gbean-deployer/src/main/history/
framework/configs/jsr88-cli/src/main/history/ framework/config...
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -16,35 +16,32 @@
*/
package org.apache.geronimo.jaxws.builder;
-import java.io.IOException;
-import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.handler.Handler;
-
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.j2ee.deployment.EARContext;
import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.jaxws.HandlerChainsUtils;
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
import org.apache.geronimo.naming.deployment.ServiceRefBuilder;
import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefDocument;
import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
-import org.apache.geronimo.xbeans.javaee6.HandlerChainType;
-import org.apache.geronimo.xbeans.javaee6.HandlerChainsType;
-import org.apache.geronimo.xbeans.javaee6.HandlerType;
-import org.apache.geronimo.xbeans.javaee6.PortComponentRefType;
-import org.apache.geronimo.xbeans.javaee6.ServiceRefType;
+import org.apache.openejb.jee.HandlerChain;
+import org.apache.openejb.jee.HandlerChains;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.PortComponentRef;
+import org.apache.openejb.jee.ServiceRef;
import org.apache.xmlbeans.QNameSet;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,21 +62,23 @@ public abstract class JAXWSServiceRefBui
serviceRefQNameSet = buildQNameSet(eeNamespaces, "service-ref");
}
- protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) {
- return specDD.selectChildren(serviceRefQNameSet).length > 0;
+ @Override
+ protected boolean willMergeEnvironment(JndiConsumer specDD, XmlObject plan) {
+ return !specDD.getServiceRef().isEmpty();
}
- public void buildNaming(XmlObject specDD,
+ @Override
+ public void buildNaming(JndiConsumer specDD,
XmlObject plan,
Module module,
Map<EARContext.Key, Object> componentContext) throws DeploymentException {
- List<ServiceRefType> serviceRefsUntyped = convert(specDD.selectChildren(serviceRefQNameSet), JEE_CONVERTER, ServiceRefType.class, ServiceRefType.type);
+ Collection<ServiceRef> serviceRefsUntyped = specDD.getServiceRef();
XmlObject[] gerServiceRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_SERVICE_REF_QNAME_SET);
Map<String, GerServiceRefType> serviceRefMap = mapServiceRefs(gerServiceRefsUntyped);
- for (ServiceRefType serviceRef : serviceRefsUntyped) {
+ for (ServiceRef serviceRef : serviceRefsUntyped) {
String name = getStringValue(serviceRef.getServiceRefName());
- addInjections(name, serviceRef.getInjectionTargetArray(), componentContext);
+ addInjections(name, serviceRef.getInjectionTarget(), componentContext);
GerServiceRefType serviceRefType = serviceRefMap.remove(name);
buildNaming(serviceRef, serviceRefType, module, componentContext);
}
@@ -97,13 +96,8 @@ public abstract class JAXWSServiceRefBui
}
}
- public void buildNaming(XmlObject serviceRef, GerServiceRefType gerServiceRefType, Module module, Map componentContext) throws DeploymentException {
- ServiceRefType serviceRefType =
- (ServiceRefType)convert(serviceRef, JEE_CONVERTER, ServiceRefType.type);
- buildNaming(serviceRefType, gerServiceRefType, module, componentContext);
- }
-
- public void buildNaming(ServiceRefType serviceRef, GerServiceRefType gerServiceRef, Module module, Map<EARContext.Key, Object> componentContext) throws DeploymentException {
+ @Override
+ public void buildNaming(ServiceRef serviceRef, GerServiceRefType gerServiceRef, Module module, Map<EARContext.Key, Object> componentContext) throws DeploymentException {
Bundle bundle = module.getEarContext().getDeploymentBundle();
String name = getStringValue(serviceRef.getServiceRefName());
@@ -113,14 +107,11 @@ public abstract class JAXWSServiceRefBui
throw new DeploymentException(serviceInterfaceName + " service class does not extend " + Service.class.getName());
}
- QName serviceQName = null;
- if (serviceRef.isSetServiceQname()) {
- serviceQName = serviceRef.getServiceQname().getQNameValue();
- }
+ QName serviceQName = serviceRef.getServiceQname();
URI wsdlURI = null;
- if (serviceRef.isSetWsdlFile()) {
- String wsdlLocation = serviceRef.getWsdlFile().getStringValue().trim();
+ if (serviceRef.getWsdlFile() != null) {
+ String wsdlLocation = serviceRef.getWsdlFile().trim();
try {
wsdlURI = new URI(wsdlLocation);
} catch (URISyntaxException e) {
@@ -129,15 +120,15 @@ public abstract class JAXWSServiceRefBui
}
Class serviceReferenceType = null;
- if (serviceRef.isSetServiceRefType()) {
- String referenceClassName = getStringValue(serviceRef.getServiceRefType());
+ if (serviceRef.getServiceRefType() != null) {
+ String referenceClassName = serviceRef.getServiceRefType();
serviceReferenceType = loadClass(referenceClassName, bundle, "service reference");
}
- if (serviceRef.isSetHandlerChains()) {
- HandlerChainsType handlerChains = serviceRef.getHandlerChains();
- for (HandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
- for (HandlerType handler : handlerChain.getHandlerArray()) {
+ if (serviceRef.getHandlerChains() != null) {
+ HandlerChains handlerChains = serviceRef.getHandlerChains();
+ for (HandlerChain handlerChain : handlerChains.getHandlerChain()) {
+ for (org.apache.openejb.jee.Handler handler : handlerChain.getHandler()) {
String handlerClassName = getStringValue(handler.getHandlerClass());
Class handlerClass = loadClass(handlerClassName, bundle, "handler");
if (!Handler.class.isAssignableFrom(handlerClass)) {
@@ -147,18 +138,14 @@ public abstract class JAXWSServiceRefBui
}
}
- Map<Class, PortComponentRefType> portComponentRefMap = new HashMap<Class, PortComponentRefType>();
- PortComponentRefType[] portComponentRefs = serviceRef.getPortComponentRefArray();
- if (portComponentRefs != null) {
- for (int j = 0; j < portComponentRefs.length; j++) {
- PortComponentRefType portComponentRef = portComponentRefs[j];
- String serviceEndpointInterfaceType = getStringValue(portComponentRef.getServiceEndpointInterface());
- Class serviceEndpointClass = loadClass(serviceEndpointInterfaceType, bundle, "service endpoint");
+ Map<Class, PortComponentRef> portComponentRefMap = new HashMap<Class, PortComponentRef>();
+ for (PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
+ String serviceEndpointInterfaceType = getStringValue(portComponentRef.getServiceEndpointInterface());
+ Class serviceEndpointClass = loadClass(serviceEndpointInterfaceType, bundle, "service endpoint");
- // TODO: check if it is annotated?
+ // TODO: check if it is annotated?
- portComponentRefMap.put(serviceEndpointClass, portComponentRef);
- }
+ portComponentRefMap.put(serviceEndpointClass, portComponentRef);
}
Object ref = createService(serviceRef, gerServiceRef, module, bundle,
@@ -167,10 +154,10 @@ public abstract class JAXWSServiceRefBui
put(name, ref, module.getJndiContext());
}
- public abstract Object createService(ServiceRefType serviceRef, GerServiceRefType gerServiceRef,
+ public abstract Object createService(ServiceRef serviceRef, GerServiceRefType gerServiceRef,
Module module, Bundle bundle, Class serviceInterfaceClass,
QName serviceQName, URI wsdlURI, Class serviceReferenceType,
- Map<Class, PortComponentRefType> portComponentRefMap) throws DeploymentException;
+ Map<Class, PortComponentRef> portComponentRefMap) throws DeploymentException;
private static Map<String, GerServiceRefType> mapServiceRefs(XmlObject[] refs) {
Map<String, GerServiceRefType> refMap = new HashMap<String, GerServiceRefType>();
@@ -193,16 +180,10 @@ public abstract class JAXWSServiceRefBui
return GER_SERVICE_REF_QNAME_SET;
}
- public static String getHandlerChainAsString(HandlerChainsType handlerChains)
- throws IOException {
- String xml = null;
+ public static String getHandlerChainAsString(HandlerChains handlerChains) throws JAXBException {
if (handlerChains != null) {
- StringWriter w = new StringWriter();
- XmlOptions options = new XmlOptions();
- options.setSaveSyntheticDocumentElement(HandlerChainsUtils.HANDLER_CHAINS_QNAME);
- handlerChains.save(w, options);
- xml = w.toString();
+ return JaxbJavaee.marshal(HandlerChains.class, handlerChains);
}
- return xml;
+ return null;
}
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java Thu Jun 24 18:06:24 2010
@@ -26,9 +26,9 @@ import org.apache.geronimo.j2ee.deployme
import org.apache.geronimo.j2ee.deployment.WebModule;
import org.apache.geronimo.jaxws.JAXWSUtils;
import org.apache.geronimo.jaxws.PortInfo;
-import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
-import org.apache.geronimo.xbeans.javaee6.ServletType;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.openejb.jee.Servlet;
+import org.apache.openejb.jee.ServletMapping;
+import org.apache.openejb.jee.WebApp;
import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,12 +51,12 @@ public class SimpleWARWebServiceFinder i
Map<String, PortInfo> map)
throws DeploymentException {
Bundle bundle = module.getEarContext().getDeploymentBundle();
- WebAppType webApp = (WebAppType) module.getSpecDD();
+ WebApp webApp = (WebApp) module.getSpecDD();
// find web services
- ServletType[] servletTypes = webApp.getServletArray();
+ List<Servlet> servletTypes = webApp.getServlet();
- if (webApp.getDomNode().getChildNodes().getLength() == 0) {
+ if (webApp.getServlet().size() == 0) {
// web.xml not present (empty really), discover annotated
// classes and update DD
List<Class> services = WARWebServiceFinder.discoverWebServices(module.getModuleFile(), false, this.getClass().getClassLoader());
@@ -70,15 +70,15 @@ public class SimpleWARWebServiceFinder i
LOG.debug("Discovered POJO Web Service: " + service.getName());
// add new <servlet/> element
- ServletType servlet = webApp.addNewServlet();
- servlet.addNewServletName().setStringValue(service.getName());
- servlet.addNewServletClass().setStringValue(service.getName());
-
+ Servlet servlet = new Servlet();
+ servlet.setServletName(service.getName());
+ servlet.setServletClass(service.getName());
+ webApp.getServlet().add(servlet);
// add new <servlet-mapping/> element
String location = "/" + JAXWSUtils.getServiceName(service);
- ServletMappingType servletMapping = webApp.addNewServletMapping();
- servletMapping.addNewServletName().setStringValue(service.getName());
- servletMapping.addNewUrlPattern().setStringValue(location);
+ ServletMapping servletMapping = new ServletMapping();
+ servletMapping.setServletName(service.getName());
+ servletMapping.getUrlPattern().add(location);
// map service
PortInfo portInfo = new PortInfo();
@@ -88,10 +88,10 @@ public class SimpleWARWebServiceFinder i
} else {
// web.xml present, examine servlet classes and check for web
// services
- for (ServletType servletType : servletTypes) {
- String servletName = servletType.getServletName().getStringValue().trim();
- if (servletType.isSetServletClass()) {
- String servletClassName = servletType.getServletClass().getStringValue().trim();
+ for (Servlet servletType : servletTypes) {
+ String servletName = servletType.getServletName().trim();
+ if (servletType.getServletClass() != null) {
+ String servletClassName = servletType.getServletClass().trim();
try {
Class servletClass = bundle.loadClass(servletClassName);
if (JAXWSUtils.isWebService(servletClass)) {
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml Thu Jun 24 18:06:24 2010
@@ -92,16 +92,20 @@
<artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.schema</groupId>
- <artifactId>geronimo-schema-javaee_6</artifactId>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.geronimo.schema</groupId>-->
+ <!--<artifactId>geronimo-schema-javaee_6</artifactId>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.geronimo.schema</groupId>-->
+ <!--<artifactId>geronimo-schema-jee_5</artifactId>-->
+ <!--</dependency>-->
<dependency>
- <groupId>org.apache.geronimo.schema</groupId>
- <artifactId>geronimo-schema-jee_5</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-jee</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xmlbeans</artifactId>
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/HandlerChainsUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/HandlerChainsUtils.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/HandlerChainsUtils.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/HandlerChainsUtils.java Thu Jun 24 18:06:24 2010
@@ -25,9 +25,6 @@ import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsDocument;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
-import org.apache.xmlbeans.XmlException;
public class HandlerChainsUtils {
@@ -51,16 +48,4 @@ public class HandlerChainsUtils {
return handlerChains;
}
- public static HandlerChainsType getHandlerChains(String xml) throws XmlException {
- HandlerChainsType types = null;
- if (xml != null) {
- try {
- types = HandlerChainsDocument.Factory.parse(xml).getHandlerChains();
- } catch (XmlException e){
- types = HandlerChainsType.Factory.parse(xml);
- }
- }
- return types;
- }
-
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/AnnotationHandlerChainBuilder.java Thu Jun 24 18:06:24 2010
@@ -17,6 +17,7 @@
package org.apache.geronimo.jaxws.handler;
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -27,12 +28,10 @@ import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.LogicalHandler;
+import org.apache.openejb.jee.HandlerChains;
+import org.apache.openejb.jee.JaxbJavaee;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.geronimo.xbeans.javaee.HandlerChainType;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsDocument;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
-import org.apache.geronimo.xbeans.javaee.PortComponentHandlerType;
/**
* @version $Rev$ $Date$
@@ -61,14 +60,20 @@ public class AnnotationHandlerChainBuild
try {
URL handlerFileURL = clz.getResource(hcAnn.getFileName());
- HandlerChainsType handlerChainsType = HandlerChainsDocument.Factory.parse(handlerFileURL).getHandlerChains();
+ InputStream in = handlerFileURL.openStream();
+ HandlerChains handlerChainsType;
+ try {
+ handlerChainsType = (HandlerChains) JaxbJavaee.unmarshal(HandlerChains.class, in);
+ } finally {
+ in.close();
+ }
- if (null == handlerChainsType || handlerChainsType.getHandlerChainArray() == null) {
+ if (null == handlerChainsType || handlerChainsType.getHandlerChain().isEmpty()) {
throw new WebServiceException("Chain not specified");
}
chain = new ArrayList<Handler>();
- for (HandlerChainType hc : handlerChainsType.getHandlerChainArray()) {
+ for (org.apache.openejb.jee.HandlerChain hc : handlerChainsType.getHandlerChain()) {
chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));
}
@@ -135,15 +140,14 @@ public class AnnotationHandlerChainBuild
return hcAnn;
}
- protected List<Handler> buildHandlerChain(HandlerChainType hc, ClassLoader classLoader) {
+ protected List<Handler> buildHandlerChain(org.apache.openejb.jee.HandlerChain hc, ClassLoader classLoader) {
List<Handler> handlerChain = new ArrayList<Handler>();
- for (PortComponentHandlerType ht : hc.getHandlerArray()) {
+ for (org.apache.openejb.jee.Handler ht : hc.getHandler()) {
try {
- log.debug("loading handler :" + trimString(ht.getHandlerName().getStringValue()));
+ log.debug("loading handler :" + trimString(ht.getHandlerName()));
Class<? extends Handler> handlerClass = Class.forName(
- trimString(ht.getHandlerClass()
- .getStringValue()), true, classLoader)
+ trimString(ht.getHandlerClass()), true, classLoader)
.asSubclass(Handler.class);
Handler handler = handlerClass.newInstance();
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerChainBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerChainBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerChainBuilder.java Thu Jun 24 18:06:24 2010
@@ -18,7 +18,6 @@
package org.apache.geronimo.jaxws.handler;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -26,20 +25,15 @@ import java.util.regex.Pattern;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.PortInfo;
-
import org.apache.geronimo.jaxws.JAXWSUtils;
-import org.apache.geronimo.xbeans.javaee.HandlerChainType;
+import org.apache.openejb.jee.HandlerChain;
import org.apache.xbean.osgi.bundle.util.BundleClassLoader;
-import org.apache.xmlbeans.XmlCursor;
import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* @version $Rev$ $Date$
*/
public class GeronimoHandlerChainBuilder extends AnnotationHandlerChainBuilder {
- private static final Logger log = LoggerFactory.getLogger(GeronimoHandlerChainBuilder.class);
private Bundle bundle = null;
private PortInfo portInfo;
@@ -54,7 +48,7 @@ public class GeronimoHandlerChainBuilder
return bundle;
}
- protected List<Handler> buildHandlerChain(HandlerChainType hc,
+ protected List<Handler> buildHandlerChain(HandlerChain hc,
Bundle bundle) {
if (matchServiceName(portInfo, hc)
&& matchPortName(portInfo, hc)
@@ -65,31 +59,31 @@ public class GeronimoHandlerChainBuilder
}
}
- private boolean matchServiceName(PortInfo info, HandlerChainType hc) {
- if (hc.isSetServiceNamePattern()) {
+ private boolean matchServiceName(PortInfo info, HandlerChain hc) {
+ if (hc.getServiceNamePattern() != null) {
QName serviceName = (info == null) ? null : info.getServiceName();
- return match(hc.xgetServiceNamePattern().newCursor(), serviceName, hc.getServiceNamePattern());
+ return match(serviceName, hc.getServiceNamePattern());
} else {
// handler matches since no service-name-pattern
return true;
}
}
- private boolean matchPortName(PortInfo info, HandlerChainType hc) {
- if (hc.isSetPortNamePattern()) {
+ private boolean matchPortName(PortInfo info, HandlerChain hc) {
+ if (hc.getPortNamePattern() != null) {
QName portName = (info == null) ? null : info.getPortName();
- return match(hc.xgetPortNamePattern().newCursor(), portName, hc.getPortNamePattern());
+ return match(portName, hc.getPortNamePattern());
} else {
// handler maches no port-name-pattern
return true;
}
}
- private boolean matchBinding(PortInfo info, HandlerChainType hc) {
+ private boolean matchBinding(PortInfo info, HandlerChain hc) {
return match((info == null ? null : info.getBindingID()), hc.getProtocolBindings());
}
- private boolean match(String binding, List bindings) {
+ private boolean match(String binding, List<String> bindings) {
if (binding == null) {
return (bindings == null || bindings.isEmpty());
} else {
@@ -97,9 +91,7 @@ public class GeronimoHandlerChainBuilder
return true;
} else {
String actualBindingURI = JAXWSUtils.getBindingURI(binding);
- Iterator iter = bindings.iterator();
- while (iter.hasNext()) {
- String bindingToken = (String) iter.next();
+ for (String bindingToken : bindings) {
String bindingURI = JAXWSUtils.getBindingURI(bindingToken);
if (actualBindingURI.equals(bindingURI)) {
return true;
@@ -110,7 +102,7 @@ public class GeronimoHandlerChainBuilder
}
}
- public List<Handler> buildHandlerChainFromConfiguration(HandlerChainType hc) {
+ public List<Handler> buildHandlerChainFromConfiguration(HandlerChain hc) {
if (null == hc) {
return null;
}
@@ -120,32 +112,17 @@ public class GeronimoHandlerChainBuilder
/*
* Performs basic localName matching, namespaces are not checked!
*/
- private boolean match(XmlCursor node, QName name, String namePattern) {
+ private boolean match(QName name, QName namePattern) {
if (name == null) {
- return (namePattern == null || namePattern.equals("*"));
+ return (namePattern == null || namePattern.getLocalPart().equals("*"));
} else {
if (namePattern == null) {
return true;
} else {
- String localNamePattern;
-
- // get the local name from pattern
- int pos = namePattern.indexOf(':');
- if (pos == -1) {
- localNamePattern = namePattern;
- } else {
- localNamePattern = namePattern.substring(pos + 1);
-
- String prefix = namePattern.substring(0, pos);
- String namespace = node.namespaceForPrefix(prefix.trim());
- if (namespace == null) {
- namespace = prefix;
- }
-
- // check namespace
- if (!namespace.equals(name.getNamespaceURI())) {
- return false;
- }
+ String localNamePattern = namePattern.getLocalPart();
+ // check namespace
+ if (!namePattern.getNamespaceURI().equals(name.getNamespaceURI())) {
+ return false;
}
// check local name
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolver.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolver.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolver.java Thu Jun 24 18:06:24 2010
@@ -26,8 +26,8 @@ import javax.xml.ws.handler.HandlerResol
import org.apache.geronimo.jaxws.annotations.AnnotationException;
import org.apache.geronimo.jaxws.annotations.AnnotationProcessor;
-import org.apache.geronimo.xbeans.javaee.HandlerChainType;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
+import org.apache.openejb.jee.HandlerChain;
+import org.apache.openejb.jee.HandlerChains;
import org.osgi.framework.Bundle;
/**
@@ -35,7 +35,7 @@ import org.osgi.framework.Bundle;
*/
public class GeronimoHandlerResolver implements HandlerResolver {
- private HandlerChainsType handlerChains;
+ private HandlerChains handlerChains;
private Bundle bundle;
@@ -45,7 +45,7 @@ public class GeronimoHandlerResolver imp
public GeronimoHandlerResolver(Bundle bundle,
Class serviceClass,
- HandlerChainsType handlerChains,
+ HandlerChains handlerChains,
AnnotationProcessor annotationProcessor) {
this.bundle = bundle;
this.serviceClass = serviceClass;
@@ -63,7 +63,7 @@ public class GeronimoHandlerResolver imp
handlers = builder.buildHandlerChainFromClass(this.serviceClass);
} else {
handlers = new ArrayList<Handler>();
- for (HandlerChainType handlerChain : this.handlerChains.getHandlerChainArray()) {
+ for (HandlerChain handlerChain : this.handlerChains.getHandlerChain()) {
handlers.addAll(builder.buildHandlerChainFromConfiguration(handlerChain));
}
handlers = builder.sortHandlers(handlers);
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/test/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolverTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/test/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolverTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/test/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolverTest.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/test/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolverTest.java Thu Jun 24 18:06:24 2010
@@ -25,16 +25,16 @@ import javax.xml.ws.handler.PortInfo;
import org.apache.geronimo.kernel.osgi.MockBundle;
import org.apache.geronimo.testsupport.TestSupport;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsDocument;
-import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
+import org.apache.openejb.jee.HandlerChains;
+import org.apache.openejb.jee.JaxbJavaee;
public class GeronimoHandlerResolverTest extends TestSupport {
public void testBasic() throws Exception {
InputStream in = getClass().getResourceAsStream("/handlers.xml");
assertTrue(in != null);
- HandlerChainsType handlerChains = toHandlerChains(in);
- assertEquals(3, handlerChains.getHandlerChainArray().length);
+ HandlerChains handlerChains = toHandlerChains(in);
+ assertEquals(3, handlerChains.getHandlerChain().size());
GeronimoHandlerResolver resolver = new GeronimoHandlerResolver(new MockBundle(getClass().getClassLoader(), null, 11L), getClass(), handlerChains, null);
@@ -47,8 +47,8 @@ public class GeronimoHandlerResolverTest
public void testServiceMatching() throws Exception {
InputStream in = getClass().getResourceAsStream("/handlers_service.xml");
assertTrue(in != null);
- HandlerChainsType handlerChains = toHandlerChains(in);
- assertEquals(4, handlerChains.getHandlerChainArray().length);
+ HandlerChains handlerChains = toHandlerChains(in);
+ assertEquals(4, handlerChains.getHandlerChain().size());
GeronimoHandlerResolver resolver = new GeronimoHandlerResolver(new MockBundle(getClass().getClassLoader(), null, 11L), getClass(), handlerChains, null);
@@ -81,8 +81,8 @@ public class GeronimoHandlerResolverTest
public void testBindingMatching() throws Exception {
InputStream in = getClass().getResourceAsStream("/handlers_bindings.xml");
assertTrue(in != null);
- HandlerChainsType handlerChains = toHandlerChains(in);
- assertEquals(4, handlerChains.getHandlerChainArray().length);
+ HandlerChains handlerChains = toHandlerChains(in);
+ assertEquals(4, handlerChains.getHandlerChain().size());
GeronimoHandlerResolver resolver = new GeronimoHandlerResolver(new MockBundle(getClass().getClassLoader(), null, 11L), getClass(), handlerChains, null);
List<Handler> handlers = null;
@@ -112,8 +112,8 @@ public class GeronimoHandlerResolverTest
public void testPortMatching() throws Exception {
InputStream in = getClass().getResourceAsStream("/handlers_port.xml");
assertTrue(in != null);
- HandlerChainsType handlerChains = toHandlerChains(in);
- assertEquals(4, handlerChains.getHandlerChainArray().length);
+ HandlerChains handlerChains = toHandlerChains(in);
+ assertEquals(4, handlerChains.getHandlerChain().size());
GeronimoHandlerResolver resolver = new GeronimoHandlerResolver(new MockBundle(getClass().getClassLoader(), null, 11L), getClass(), handlerChains, null);
@@ -146,8 +146,8 @@ public class GeronimoHandlerResolverTest
public void testMixedMatching() throws Exception {
InputStream in = getClass().getResourceAsStream("/handlers_mixed.xml");
assertTrue(in != null);
- HandlerChainsType handlerChains = toHandlerChains(in);
- assertEquals(3, handlerChains.getHandlerChainArray().length);
+ HandlerChains handlerChains = toHandlerChains(in);
+ assertEquals(3, handlerChains.getHandlerChain().size());
GeronimoHandlerResolver resolver = new GeronimoHandlerResolver(new MockBundle(getClass().getClassLoader(), null, 11L), getClass(), handlerChains, null);
@@ -172,8 +172,8 @@ public class GeronimoHandlerResolverTest
assertEquals(1, handlers.size());
}
- private static HandlerChainsType toHandlerChains(InputStream input) throws Exception {
- return HandlerChainsDocument.Factory.parse(input).getHandlerChains();
+ private static HandlerChains toHandlerChains(InputStream input) throws Exception {
+ return (HandlerChains) JaxbJavaee.unmarshal(HandlerChains.class, input);
}
private static class TestPortInfo implements PortInfo {
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/pom.xml Thu Jun 24 18:06:24 2010
@@ -45,7 +45,11 @@
<artifactId>geronimo-jetty8</artifactId>
<version>${project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-jee</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>geronimo-kernel</artifactId>
@@ -89,14 +93,6 @@
<_exportcontents>schemaorg_apache_xmlbeans*</_exportcontents>
<DynamicImport-Package>schemaorg_apache_xmlbeans.*</DynamicImport-Package>
<Import-Package>
- org.apache.geronimo.xbeans.javaee.impl,
- org.apache.geronimo.xbeans.javaee,
- org.apache.geronimo.xbeans.persistence.impl,
- org.apache.geronimo.xbeans.persistence,
- org.apache.geronimo.xbeans.j2ee.impl,
- org.apache.geronimo.xbeans.j2ee,
- org.w3.xml.x1998.namespace.impl,
- org.w3.xml.x1998.namespace,
org.apache.geronimo.deployment.xbeans.impl,
org.apache.geronimo.deployment.javabean.xbeans.impl,
org.apache.geronimo.deployment.xbeans,
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java Thu Jun 24 18:06:24 2010
@@ -22,6 +22,7 @@ import static java.lang.Boolean.TRUE;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Serializable;
import java.net.URI;
import java.net.URL;
@@ -40,6 +41,7 @@ import java.util.jar.JarFile;
import javax.management.ObjectName;
import javax.servlet.Servlet;
+import javax.xml.bind.JAXBException;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.Deployable;
@@ -67,7 +69,6 @@ import org.apache.geronimo.j2ee.deployme
import org.apache.geronimo.j2ee.deployment.NamingBuilder;
import org.apache.geronimo.j2ee.deployment.WebModule;
import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedWebApp;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.jetty8.DefaultServletHolderWrapper;
import org.apache.geronimo.jetty8.FilterHolderWrapper;
@@ -108,26 +109,7 @@ import org.apache.geronimo.xbeans.geroni
import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
import org.apache.geronimo.xbeans.geronimo.web.jetty.config.GerJettyDocument;
-import org.apache.geronimo.xbeans.javaee6.DispatcherType;
-import org.apache.geronimo.xbeans.javaee6.ErrorPageType;
-import org.apache.geronimo.xbeans.javaee6.FilterMappingType;
-import org.apache.geronimo.xbeans.javaee6.FilterType;
-import org.apache.geronimo.xbeans.javaee6.FormLoginConfigType;
-import org.apache.geronimo.xbeans.javaee6.JspConfigType;
-import org.apache.geronimo.xbeans.javaee6.JspPropertyGroupType;
-import org.apache.geronimo.xbeans.javaee6.ListenerType;
-import org.apache.geronimo.xbeans.javaee6.LocaleEncodingMappingListType;
-import org.apache.geronimo.xbeans.javaee6.LocaleEncodingMappingType;
-import org.apache.geronimo.xbeans.javaee6.LoginConfigType;
-import org.apache.geronimo.xbeans.javaee6.MimeMappingType;
-import org.apache.geronimo.xbeans.javaee6.ParamValueType;
-import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
-import org.apache.geronimo.xbeans.javaee6.ServletType;
-import org.apache.geronimo.xbeans.javaee6.TaglibType;
-import org.apache.geronimo.xbeans.javaee6.UrlPatternType;
-import org.apache.geronimo.xbeans.javaee6.WebAppDocument;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.geronimo.xbeans.javaee6.WelcomeFileListType;
+import org.apache.openejb.jee.*;
import org.apache.xbean.osgi.bundle.util.BundleUtils;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@@ -255,20 +237,21 @@ public class JettyModuleBuilder extends
}
String specDD = null;
- WebAppType webApp = null;
+ WebApp webApp = null;
URL specDDUrl = BundleUtils.getEntry(bundle, "WEB-INF/web.xml");
if (specDDUrl == null) {
- webApp = WebAppType.Factory.newInstance();
+ webApp = new WebApp();
} else {
try {
specDD = JarUtils.readAll(specDDUrl);
- XmlObject parsed = XmlBeansUtil.parse(specDD);
- WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
- webApp = webAppDoc.getWebApp();
- WebDeploymentValidationUtils.validateWebApp(webApp);
- } catch (XmlException e) {
- throw new DeploymentException("Error parsing web.xml for " + bundle.getSymbolicName(), e);
+ InputStream in = specDDUrl.openStream();
+ try {
+ webApp = (WebApp) JaxbJavaee.unmarshal(WebApp.class, in);
+ } finally {
+ in.close();
+ }
+// WebDeploymentValidationUtils.validateWebApp(webApp);
} catch (Exception e) {
throw new DeploymentException("Error reading web.xml for " + bundle.getSymbolicName(), e);
}
@@ -285,7 +268,7 @@ public class JettyModuleBuilder extends
EnvironmentType environmentType = jettyWebApp.getEnvironment();
Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
- if (webApp.getDistributableArray().length == 1) {
+ if (webApp.getDistributable().size() == 1) {
clusteringBuilders.buildEnvironment(jettyWebApp, environment);
}
@@ -299,15 +282,12 @@ public class JettyModuleBuilder extends
moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
}
- // Create the AnnotatedApp interface for the WebModule
- AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
-
- String name = getModuleName(webApp);
+ String name = webApp.getModuleName();
if (name == null) {
name = bundle.getSymbolicName();
}
- WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextPath, JETTY_NAMESPACE, annotatedWebApp, shareJndi(null), null);
+ WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextPath, JETTY_NAMESPACE, shareJndi(null), null);
for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
mbe.createModule(module, bundle, naming, idBuilder);
}
@@ -321,7 +301,7 @@ public class JettyModuleBuilder extends
// parse the spec dd
String specDD = null;
- WebAppType webApp = null;
+ WebApp webApp = null;
try {
if (specDDUrl == null) {
specDDUrl = JarUtils.createJarURL(moduleFile, "WEB-INF/web.xml");
@@ -332,11 +312,14 @@ public class JettyModuleBuilder extends
specDD = JarUtils.readAll(specDDUrl);
// we found web.xml, if it won't parse that's an error.
- XmlObject parsed = XmlBeansUtil.parse(specDD);
- WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
- webApp = webAppDoc.getWebApp();
- WebDeploymentValidationUtils.validateWebApp(webApp);
- } catch (XmlException e) {
+ InputStream in = specDDUrl.openStream();
+ try {
+ webApp = (WebApp) JaxbJavaee.unmarshal(WebApp.class, in);
+ } finally {
+ in.close();
+ }
+// WebDeploymentValidationUtils.validateWebApp(webApp);
+ } catch (JAXBException e) {
// Output the target path in the error to make it clearer to the user which webapp
// has the problem. The targetPath is used, as moduleFile may have an unhelpful
// value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
@@ -350,7 +333,7 @@ public class JettyModuleBuilder extends
}
if (webApp == null) {
- webApp = WebAppType.Factory.newInstance();
+ webApp = new WebApp();
}
Deployable deployable = new DeployableJarFile(moduleFile);
@@ -362,7 +345,7 @@ public class JettyModuleBuilder extends
EnvironmentType environmentType = jettyWebApp.getEnvironment();
Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
- if (webApp.getDistributableArray().length == 1) {
+ if (webApp.getDistributable().size() == 1) {
clusteringBuilders.buildEnvironment(jettyWebApp, environment);
}
@@ -388,10 +371,7 @@ public class JettyModuleBuilder extends
moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
}
- // Create the AnnotatedApp interface for the WebModule
- AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
-
- String name = getModuleName(webApp);
+ String name = webApp.getModuleName();
if (name == null) {
if (standAlone) {
name = FileUtils.removeExtension(new File(moduleFile.getName()).getName(), ".war");
@@ -400,14 +380,14 @@ public class JettyModuleBuilder extends
}
}
- WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextRoot, JETTY_NAMESPACE, annotatedWebApp, shareJndi(parentModule), parentModule);
+ WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextRoot, JETTY_NAMESPACE, shareJndi(parentModule), parentModule);
for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
mbe.createModule(module, plan, moduleFile, targetPath, specDDUrl, environment, contextRoot, earName, naming, idBuilder);
}
return module;
}
- String getContextRoot(JettyWebAppType jettyWebApp, String contextRoot, WebAppType webApp, boolean standAlone, JarFile moduleFile, String targetPath) {
+ String getContextRoot(JettyWebAppType jettyWebApp, String contextRoot, WebApp webApp, boolean standAlone, JarFile moduleFile, String targetPath) {
if (jettyWebApp.isSetContextRoot()) {
contextRoot = jettyWebApp.getContextRoot();
} else if (contextRoot == null || contextRoot.trim().equals("")) {
@@ -418,7 +398,7 @@ public class JettyModuleBuilder extends
return contextRoot;
}
- JettyWebAppType getJettyWebApp(Object plan, Deployable deployable, boolean standAlone, String targetPath, WebAppType webApp) throws DeploymentException {
+ JettyWebAppType getJettyWebApp(Object plan, Deployable deployable, boolean standAlone, String targetPath, WebApp webApp) throws DeploymentException {
XmlObject rawPlan = null;
try {
// load the geronimo-web.xml from either the supplied plan or from the earFile
@@ -482,7 +462,7 @@ public class JettyModuleBuilder extends
AbstractName moduleName = module.getModuleName();
WebModule webModule = (WebModule) module;
- WebAppType webApp = (WebAppType) webModule.getSpecDD();
+ WebApp webApp = (WebApp) webModule.getSpecDD();
JettyWebAppType jettyWebApp = (JettyWebAppType) webModule.getVendorDD();
GBeanData webModuleData = new GBeanData(moduleName, WebAppContextWrapper.class);
@@ -492,7 +472,7 @@ public class JettyModuleBuilder extends
GBeanResourceEnvironmentBuilder rebuilder = new GBeanResourceEnvironmentBuilder(webModuleData);
//N.B. use earContext not moduleContext
//TODO fix this for javaee 5 !!!
- resourceEnvironmentSetter.setResourceEnvironment(rebuilder, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
+ resourceEnvironmentSetter.setResourceEnvironment(rebuilder, webApp.getResourceRef(), jettyWebApp.getResourceRefArray());
try {
moduleContext.addGBean(webModuleData);
@@ -527,9 +507,7 @@ public class JettyModuleBuilder extends
webModuleData.setReferencePattern("JettyContainer", jettyContainerObjectName);
}
//stuff that jetty used to do
- if (webApp.getDisplayNameArray().length > 0) {
- webModuleData.setAttribute("displayName", webApp.getDisplayNameArray()[0].getStringValue());
- }
+ webModuleData.setAttribute("displayName", webApp.getDisplayName());
// configure context parameters.
configureContextParams(webApp, webModuleData);
@@ -538,11 +516,11 @@ public class JettyModuleBuilder extends
configureListeners(webApp, webModuleData);
webModuleData.setAttribute(WebAppContextWrapper.GBEAN_ATTR_SESSION_TIMEOUT,
- (webApp.getSessionConfigArray().length == 1 && webApp.getSessionConfigArray(0).getSessionTimeout() != null) ?
- webApp.getSessionConfigArray(0).getSessionTimeout().getBigIntegerValue().intValue() * 60 :
+ (webApp.getSessionConfig().size() == 1 && webApp.getSessionConfig().get(0).getSessionTimeout() != null) ?
+ webApp.getSessionConfig().get(0).getSessionTimeout().intValue() * 60 :
defaultSessionTimeoutSeconds);
- Boolean distributable = webApp.getDistributableArray().length == 1 ? TRUE : FALSE;
+ Boolean distributable = webApp.getDistributable().size() == 1 ? TRUE : FALSE;
webModuleData.setAttribute("distributable", distributable);
if (TRUE == distributable) {
clusteringBuilders.build(jettyWebApp, earContext, moduleContext);
@@ -638,8 +616,8 @@ public class JettyModuleBuilder extends
}
//set up servlet gbeans.
- ServletType[] servletTypes = webApp.getServletArray();
- addServlets(moduleName, webModule, servletTypes, servletMappings, moduleContext);
+ List<org.apache.openejb.jee.Servlet> servlets = webApp.getServlet();
+ addServlets(moduleName, webModule, servlets, servletMappings, moduleContext);
if (jettyWebApp.isSetSecurityRealmName()) {
configureSecurityRealm(earContext, webApp, jettyWebApp, bundle, webModuleData);
@@ -656,7 +634,7 @@ public class JettyModuleBuilder extends
}
//not truly metadata complete until MBEs have run
- if (!webApp.getMetadataComplete()) {
+ if (!webApp.isMetadataComplete()) {
webApp.setMetadataComplete(true);
if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f) {
String specDeploymentPlan = getSpecDDAsString(webModule);
@@ -684,7 +662,7 @@ public class JettyModuleBuilder extends
// moduleContext.addGBean(beanData);
}
- private void configureSecurityRealm(EARContext earContext, WebAppType webApp, JettyWebAppType jettyWebApp, Bundle bundle, GBeanData webModuleData) throws DeploymentException {
+ private void configureSecurityRealm(EARContext earContext, WebApp webApp, JettyWebAppType jettyWebApp, Bundle bundle, GBeanData webModuleData) throws DeploymentException {
AbstractName moduleName = webModuleData.getAbstractName();
if (earContext.getSecurityConfiguration() == null) {
throw new DeploymentException(
@@ -725,18 +703,18 @@ public class JettyModuleBuilder extends
return servletGBeanData;
}
- private void addFiltersGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebAppType webApp) throws GBeanAlreadyExistsException {
- FilterType[] filterArray = webApp.getFilterArray();
- for (FilterType filterType : filterArray) {
- String filterName = filterType.getFilterName().getStringValue().trim();
+ private void addFiltersGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebApp webApp) throws GBeanAlreadyExistsException {
+ List<org.apache.openejb.jee.Filter> filters = webApp.getFilter();
+ for (org.apache.openejb.jee.Filter filter : filters) {
+ String filterName = filter.getFilterName().trim();
AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
GBeanData filterData = new GBeanData(filterAbstractName, FilterHolderWrapper.class);
filterData.setAttribute("filterName", filterName);
- filterData.setAttribute("filterClass", filterType.getFilterClass().getStringValue().trim());
+ filterData.setAttribute("filterClass", filter.getFilterClass().trim());
Map<String, String> initParams = new HashMap<String, String>();
- ParamValueType[] initParamArray = filterType.getInitParamArray();
- for (ParamValueType paramValueType : initParamArray) {
- initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim());
+ List<ParamValue> initParamArray = filter.getInitParam();
+ for (ParamValue paramValue : initParamArray) {
+ initParams.put(paramValue.getParamName().trim(), paramValue.getParamValue().trim());
}
filterData.setAttribute("initParams", initParams);
filterData.setReferencePattern("JettyServletRegistration", moduleName);
@@ -744,10 +722,10 @@ public class JettyModuleBuilder extends
}
}
- private void addFilterMappingsGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebAppType webApp, AbstractName previous) throws GBeanAlreadyExistsException {
- FilterMappingType[] filterMappingArray = webApp.getFilterMappingArray();
- for (FilterMappingType filterMappingType : filterMappingArray) {
- String filterName = filterMappingType.getFilterName().getStringValue().trim();
+ private void addFilterMappingsGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebApp webApp, AbstractName previous) throws GBeanAlreadyExistsException {
+ List<FilterMapping> filterMappingArray = webApp.getFilterMapping();
+ for (FilterMapping filterMapping : filterMappingArray) {
+ String filterName = filterMapping.getFilterName().trim();
GBeanData filterMappingData = new GBeanData(JettyFilterMapping.class);
if (previous != null) {
filterMappingData.addDependency(previous);
@@ -756,19 +734,16 @@ public class JettyModuleBuilder extends
AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
AbstractName filterMappingName = null;
- if (filterMappingType.sizeOfUrlPatternArray() > 0) {
- String[] urlPatterns = new String[filterMappingType.sizeOfUrlPatternArray()];
- for (int j = 0; j < urlPatterns.length; j++) {
- urlPatterns[j] = filterMappingType.getUrlPatternArray(j).getStringValue().trim();
- }
+ if (!filterMapping.getUrlPattern().isEmpty()) {
+ String[] urlPatterns = filterMapping.getUrlPattern().toArray(new String[filterMapping.getUrlPattern().size()]);
filterMappingData.setAttribute("urlPatterns", urlPatterns);
filterMappingName = earContext.getNaming().createChildName(filterAbstractName, ObjectName.quote(Arrays.deepToString(urlPatterns)), NameFactory.URL_WEB_FILTER_MAPPING);
}
- if (filterMappingType.sizeOfServletNameArray() > 0) {
+ if (!filterMapping.getServletName().isEmpty()) {
Set<AbstractName> servletNameSet = new HashSet<AbstractName>();
- for (int j = 0; j < filterMappingType.sizeOfServletNameArray(); j++) {
- String servletName = filterMappingType.getServletNameArray(j).getStringValue().trim();
+ for (String servletName: filterMapping.getServletName()) {
+ //TODO trim
AbstractName abstractServletName = earContext.getNaming().createChildName(moduleName, servletName, NameFactory.SERVLET);
servletNameSet.add(abstractServletName);
filterMappingData.addDependency(abstractServletName);
@@ -781,19 +756,18 @@ public class JettyModuleBuilder extends
filterMappingData.setAbstractName(filterMappingName);
previous = filterMappingName;
- boolean request = filterMappingType.getDispatcherArray().length == 0;
+ boolean request = filterMapping.getDispatcher().size() == 0;
boolean forward = false;
boolean include = false;
boolean error = false;
- for (int j = 0; j < filterMappingType.getDispatcherArray().length; j++) {
- DispatcherType dispatcherType = filterMappingType.getDispatcherArray()[j];
- if (dispatcherType.getStringValue().equals("REQUEST")) {
+ for (Dispatcher dispatcher : filterMapping.getDispatcher()) {
+ if (dispatcher.equals(Dispatcher.REQUEST)) {
request = true;
- } else if (dispatcherType.getStringValue().equals("FORWARD")) {
+ } else if (dispatcher.equals(Dispatcher.FORWARD)) {
forward = true;
- } else if (dispatcherType.getStringValue().equals("INCLUDE")) {
+ } else if (dispatcher.equals(Dispatcher.INCLUDE)) {
include = true;
- } else if (dispatcherType.getStringValue().equals("ERROR")) {
+ } else if (dispatcher.equals(Dispatcher.ERROR)) {
error = true;
}
}
@@ -838,29 +812,29 @@ public class JettyModuleBuilder extends
return previous;
}
- private void buildServletMappings(Module module, WebAppType webApp, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings) throws DeploymentException {
- ServletType[] servletTypes = webApp.getServletArray();
+ private void buildServletMappings(Module module, WebApp webApp, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings) throws DeploymentException {
+ List<org.apache.openejb.jee.Servlet> servlets = webApp.getServlet();
Set<String> knownServlets = new HashSet<String>();
- for (ServletType type : servletTypes) {
- knownServlets.add(type.getServletName().getStringValue().trim());
+ for (org.apache.openejb.jee.Servlet servlet : servlets) {
+ knownServlets.add(servlet.getServletName().trim());
}
- ServletMappingType[] servletMappingArray = webApp.getServletMappingArray();
- for (ServletMappingType servletMappingType : servletMappingArray) {
- String servletName = servletMappingType.getServletName().getStringValue().trim();
+ List<ServletMapping> servletMappingArray = webApp.getServletMapping();
+ for (ServletMapping servletMapping : servletMappingArray) {
+ String servletName = servletMapping.getServletName().trim();
if (!knownServlets.contains(servletName)) {
throw new DeploymentException("Web app " + module.getName() +
" contains a servlet mapping that refers to servlet '" + servletName +
"' but no such servlet was found!");
}
- UrlPatternType[] urlPatterns = servletMappingType.getUrlPatternArray();
+ List<String> urlPatterns = servletMapping.getUrlPattern();
addMappingsForServlet(servletName, urlPatterns, knownServletMappings, servletMappings);
}
}
- private void addMappingsForServlet(String servletName, UrlPatternType[] urlPatterns, Set<String> knownServletMappings, Map<String, Set<String>> servletMappings) throws DeploymentException {
- for (UrlPatternType patternType : urlPatterns) {
- String urlPattern = patternType.getStringValue().trim();
+ private void addMappingsForServlet(String servletName, List<String> urlPatterns, Set<String> knownServletMappings, Map<String, Set<String>> servletMappings) throws DeploymentException {
+ for (String pattern : urlPatterns) {
+ String urlPattern = pattern.trim();
if (!urlPattern.startsWith("*") && !urlPattern.startsWith("/")) {
urlPattern = "/" + urlPattern;
}
@@ -880,14 +854,14 @@ public class JettyModuleBuilder extends
}
}
- private void configureAuthentication(Module module, WebAppType webApp, JettyWebAppType jettyWebApp, GBeanData webModuleData) throws DeploymentException, GBeanAlreadyExistsException {
+ private void configureAuthentication(Module module, WebApp webApp, JettyWebAppType jettyWebApp, GBeanData webModuleData) throws DeploymentException, GBeanAlreadyExistsException {
EARContext moduleContext = module.getEarContext();
- LoginConfigType[] loginConfigArray = webApp.getLoginConfigArray();
- if (loginConfigArray.length > 1) {
- throw new DeploymentException("Web app " + module.getName() + " cannot have more than one login-config element. Currently has " + loginConfigArray.length + " login-config elements.");
+ List<LoginConfig> loginConfigs = webApp.getLoginConfig();
+ if (loginConfigs.size() > 1) {
+ throw new DeploymentException("Web app " + module.getName() + " cannot have more than one login-config element. Currently has " + loginConfigs.size() + " login-config elements.");
}
JettyAuthenticationType authType = jettyWebApp.getAuthentication();
- if (loginConfigArray.length == 1 || authType != null || jettyWebApp.isSetSecurityRealmName()) {
+ if (loginConfigs.size() == 1 || authType != null || jettyWebApp.isSetSecurityRealmName()) {
AbstractName factoryName = moduleContext.getNaming().createChildName(module.getModuleName(), "securityHandlerFactory", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
webModuleData.setReferencePattern("SecurityHandlerFactory", factoryName);
@@ -902,24 +876,24 @@ public class JettyModuleBuilder extends
configureLocalJaspicProvider(new JettyAuthenticationWrapper(authType), contextPath, module, securityFactoryData);
//otherwise rely on pre-configured jaspi
} else {
- LoginConfigType loginConfig = loginConfigArray.length == 1? loginConfigArray[0]: null;
+ LoginConfig loginConfig = loginConfigs.size() == 1? loginConfigs.get(0): null;
GBeanData securityFactoryData = new GBeanData(factoryName, JettySecurityHandlerFactory.class);
configureConfigurationFactory(jettyWebApp, loginConfig, securityFactoryData);
BuiltInAuthMethod auth = BuiltInAuthMethod.NONE;
if (loginConfig != null) {
- if (loginConfig.isSetAuthMethod()) {
- String authMethod = loginConfig.getAuthMethod().getStringValue().trim();
+ if (loginConfig.getAuthMethod() != null) {
+ String authMethod = loginConfig.getAuthMethod().trim();
auth = BuiltInAuthMethod.getValueOf(authMethod);
if (auth == BuiltInAuthMethod.BASIC) {
- securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().getStringValue().trim());
+ securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().trim());
} else if (auth == BuiltInAuthMethod.DIGEST) {
- securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().getStringValue().trim());
+ securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().trim());
} else if (auth == BuiltInAuthMethod.FORM) {
- if (loginConfig.isSetFormLoginConfig()) {
- FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
- securityFactoryData.setAttribute("loginPage", formLoginConfig.getFormLoginPage().getStringValue());
- securityFactoryData.setAttribute("errorPage", formLoginConfig.getFormErrorPage().getStringValue());
+ if (loginConfig.getFormLoginConfig() != null) {
+ FormLoginConfig formLoginConfig = loginConfig.getFormLoginConfig();
+ securityFactoryData.setAttribute("loginPage", formLoginConfig.getFormLoginPage());
+ securityFactoryData.setAttribute("errorPage", formLoginConfig.getFormErrorPage());
}
} else if (auth == BuiltInAuthMethod.CLIENTCERT) {
//nothing to do
@@ -930,8 +904,8 @@ public class JettyModuleBuilder extends
} else {
throw new DeploymentException("No auth method configured and no jaspi configured");
}
- if (loginConfig.isSetRealmName()) {
- webModuleData.setAttribute("realmName", loginConfig.getRealmName().getStringValue());
+ if (loginConfig.getRealmName() != null) {
+ webModuleData.setAttribute("realmName", loginConfig.getRealmName());
}
}
securityFactoryData.setAttribute("authMethod", auth);
@@ -980,70 +954,70 @@ public class JettyModuleBuilder extends
}
}
- private void configureConfigurationFactory(JettyWebAppType jettyWebApp, LoginConfigType loginConfig, GBeanData securityFactoryData) {
+ private void configureConfigurationFactory(JettyWebAppType jettyWebApp, LoginConfig loginConfig, GBeanData securityFactoryData) {
String securityRealmName;
if (jettyWebApp.isSetSecurityRealmName()) {
securityRealmName = jettyWebApp.getSecurityRealmName().trim();
} else {
if (loginConfig == null) return;
- securityRealmName = loginConfig.getRealmName().getStringValue().trim();
+ securityRealmName = loginConfig.getRealmName().trim();
}
AbstractNameQuery configurationFactoryName = new AbstractNameQuery(null, Collections.singletonMap("name", securityRealmName), ConfigurationFactory.class.getName());
securityFactoryData.setReferencePattern("ConfigurationFactory", configurationFactoryName);
}
- private void configureTagLibs(Module module, WebAppType webApp, GBeanData webModuleData, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings, String jspServletName) throws DeploymentException {
- JspConfigType[] jspConfigArray = webApp.getJspConfigArray();
- if (jspConfigArray.length > 1) {
- throw new DeploymentException("Web app " + module.getName() + " cannot have more than one jsp-config element. Currently has " + jspConfigArray.length + " jsp-config elements.");
+ private void configureTagLibs(Module module, WebApp webApp, GBeanData webModuleData, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings, String jspServletName) throws DeploymentException {
+ List<JspConfig> jspConfigArray = webApp.getJspConfig();
+ if (jspConfigArray.size() > 1) {
+ throw new DeploymentException("Web app " + module.getName() + " cannot have more than one jsp-config element. Currently has " + jspConfigArray.size() + " jsp-config elements.");
}
Map<String, String> tagLibMap = new HashMap<String, String>();
- for (JspConfigType aJspConfigArray : jspConfigArray) {
- TaglibType[] tagLibArray = aJspConfigArray.getTaglibArray();
- for (TaglibType taglib : tagLibArray) {
- tagLibMap.put(taglib.getTaglibUri().getStringValue().trim(), taglib.getTaglibLocation().getStringValue().trim());
+ for (JspConfig aJspConfigArray : jspConfigArray) {
+ List<Taglib> tagLibArray = aJspConfigArray.getTaglib();
+ for (Taglib taglib : tagLibArray) {
+ tagLibMap.put(taglib.getTaglibUri().trim(), taglib.getTaglibLocation().trim());
}
- for (JspPropertyGroupType propertyGroup : aJspConfigArray.getJspPropertyGroupArray()) {
- UrlPatternType[] urlPatterns = propertyGroup.getUrlPatternArray();
+ for (JspPropertyGroup propertyGroup : aJspConfigArray.getJspPropertyGroup()) {
+ List<String> urlPatterns = propertyGroup.getUrlPattern();
addMappingsForServlet(jspServletName, urlPatterns, knownServletMappings, servletMappings);
}
}
webModuleData.setAttribute("tagLibMap", tagLibMap);
}
- private void configureErrorPages(WebAppType webApp, GBeanData webModuleData) {
- ErrorPageType[] errorPageArray = webApp.getErrorPageArray();
+ private void configureErrorPages(WebApp webApp, GBeanData webModuleData) {
+ List<ErrorPage> errorPageArray = webApp.getErrorPage();
Map<String, String> errorPageMap = new HashMap<String, String>();
- for (ErrorPageType errorPageType : errorPageArray) {
- if (errorPageType.isSetErrorCode()) {
- errorPageMap.put(errorPageType.getErrorCode().getStringValue().trim(), errorPageType.getLocation().getStringValue().trim());
+ for (ErrorPage errorPage : errorPageArray) {
+ if (errorPage.getErrorCode() != null) {
+ errorPageMap.put(errorPage.getErrorCode() + "", errorPage.getLocation().trim());
} else {
- errorPageMap.put(errorPageType.getExceptionType().getStringValue().trim(), errorPageType.getLocation().getStringValue().trim());
+ errorPageMap.put(errorPage.getExceptionType().trim(), errorPage.getLocation().trim());
}
}
webModuleData.setAttribute("errorPages", errorPageMap);
}
- private void configureLocaleEncodingMappingLists(WebAppType webApp, GBeanData webModuleData) {
- LocaleEncodingMappingListType[] localeEncodingMappingListArray = webApp.getLocaleEncodingMappingListArray();
+ private void configureLocaleEncodingMappingLists(WebApp webApp, GBeanData webModuleData) {
+ List<LocaleEncodingMappingList> localeEncodingMappingListArray = webApp.getLocaleEncodingMappingList();
Map<String, String> localeEncodingMappingMap = new HashMap<String, String>(defaultLocaleEncodingMappings);
- for (LocaleEncodingMappingListType aLocaleEncodingMappingListArray : localeEncodingMappingListArray) {
- LocaleEncodingMappingType[] localeEncodingMappingArray = aLocaleEncodingMappingListArray.getLocaleEncodingMappingArray();
- for (LocaleEncodingMappingType localeEncodingMapping : localeEncodingMappingArray) {
+ for (LocaleEncodingMappingList aLocaleEncodingMappingListArray : localeEncodingMappingListArray) {
+ List<LocaleEncodingMapping> localeEncodingMappingArray = aLocaleEncodingMappingListArray.getLocaleEncodingMapping();
+ for (LocaleEncodingMapping localeEncodingMapping : localeEncodingMappingArray) {
localeEncodingMappingMap.put(localeEncodingMapping.getLocale().trim(), localeEncodingMapping.getEncoding().trim());
}
}
webModuleData.setAttribute("localeEncodingMapping", localeEncodingMappingMap);
}
- private void configureWelcomeFileLists(WebAppType webApp, GBeanData webModuleData) {
- WelcomeFileListType[] welcomeFileArray = webApp.getWelcomeFileListArray();
+ private void configureWelcomeFileLists(WebApp webApp, GBeanData webModuleData) {
+ List<WelcomeFileList> welcomeFileArray = webApp.getWelcomeFileList();
List<String> welcomeFiles;
- if (welcomeFileArray.length > 0) {
+ if (welcomeFileArray.size() > 0) {
welcomeFiles = new ArrayList<String>();
- for (WelcomeFileListType aWelcomeFileArray : welcomeFileArray) {
- String[] welcomeFileListType = aWelcomeFileArray.getWelcomeFileArray();
- for (String welcomeFile : welcomeFileListType) {
+ for (WelcomeFileList aWelcomeFileArray : welcomeFileArray) {
+ List<String> welcomeFileList = aWelcomeFileArray.getWelcomeFile();
+ for (String welcomeFile : welcomeFileList) {
welcomeFiles.add(welcomeFile.trim());
}
}
@@ -1053,29 +1027,29 @@ public class JettyModuleBuilder extends
webModuleData.setAttribute("welcomeFiles", welcomeFiles.toArray(new String[welcomeFiles.size()]));
}
- private void configureMimeMappings(WebAppType webApp, GBeanData webModuleData) {
- MimeMappingType[] mimeMappingArray = webApp.getMimeMappingArray();
+ private void configureMimeMappings(WebApp webApp, GBeanData webModuleData) {
+ List<MimeMapping> mimeMappingArray = webApp.getMimeMapping();
Map<String, String> mimeMappingMap = new HashMap<String, String>(defaultMimeTypeMappings);
- for (MimeMappingType mimeMappingType : mimeMappingArray) {
- mimeMappingMap.put(mimeMappingType.getExtension().getStringValue().trim(), mimeMappingType.getMimeType().getStringValue().trim());
+ for (MimeMapping mimeMapping : mimeMappingArray) {
+ mimeMappingMap.put(mimeMapping.getExtension().trim(), mimeMapping.getMimeType().trim());
}
webModuleData.setAttribute("mimeMap", mimeMappingMap);
}
- private void configureListeners(WebAppType webApp, GBeanData webModuleData) {
- ListenerType[] listenerArray = webApp.getListenerArray();
+ private void configureListeners(WebApp webApp, GBeanData webModuleData) {
+ List<Listener> listenerArray = webApp.getListener();
Collection<String> listeners = new ArrayList<String>();
- for (ListenerType listenerType : listenerArray) {
- listeners.add(listenerType.getListenerClass().getStringValue().trim());
+ for (Listener listener : listenerArray) {
+ listeners.add(listener.getListenerClass().trim());
}
webModuleData.setAttribute("listenerClassNames", listeners);
}
- private void configureContextParams(WebAppType webApp, GBeanData webModuleData) {
- ParamValueType[] contextParamArray = webApp.getContextParamArray();
+ private void configureContextParams(WebApp webApp, GBeanData webModuleData) {
+ List<ParamValue> contextParamArray = webApp.getContextParam();
Map<String, String> contextParams = new HashMap<String, String>();
- for (ParamValueType contextParam : contextParamArray) {
- contextParams.put(contextParam.getParamName().getStringValue().trim(), contextParam.getParamValue().getStringValue().trim());
+ for (ParamValue contextParam : contextParamArray) {
+ contextParams.put(contextParam.getParamName().trim(), contextParam.getParamValue().trim());
}
webModuleData.setAttribute("contextParamMap", contextParams);
}
@@ -1109,23 +1083,23 @@ public class JettyModuleBuilder extends
*
* @param webModuleName an <code>ObjectName</code> value
* @param module a <code>Module</code> value
- * @param servletTypes a <code>ServletType[]</code> value, contains the <code>servlet</code> entries from <code>web.xml</code>.
+ * @param servlets a <code>Servlet[]</code> value, contains the <code>servlet</code> entries from <code>web.xml</code>.
* @param servletMappings a <code>Map</code> value
* @param moduleContext an <code>EARContext</code> value
* @throws DeploymentException if an error occurs
*/
private void addServlets(AbstractName webModuleName,
Module module,
- ServletType[] servletTypes,
+ List<org.apache.openejb.jee.Servlet> servlets,
Map<String, Set<String>> servletMappings,
EARContext moduleContext) throws DeploymentException {
- // this TreeSet will order the ServletTypes based on whether
+ // this TreeSet will order the Servlets based on whether
// they have a load-on-startup element and what its value is
- TreeSet<ServletType> loadOrder = new TreeSet<ServletType>(new StartupOrderComparator());
+ TreeSet<org.apache.openejb.jee.Servlet> loadOrder = new TreeSet<org.apache.openejb.jee.Servlet>(new StartupOrderComparator());
// add all of the servlets to the sorted set
- loadOrder.addAll(Arrays.asList(servletTypes));
+ loadOrder.addAll(servlets);
// now that they're sorted, read them in order and add them to
// the context. we'll use a GBean reference to enforce the
@@ -1137,9 +1111,8 @@ public class JettyModuleBuilder extends
// of how to do this.
// http://issues.apache.org/jira/browse/GERONIMO-645
AbstractName previousServlet = null;
- for (Object aLoadOrder : loadOrder) {
- ServletType servletType = (ServletType) aLoadOrder;
- previousServlet = addServlet(webModuleName, module, previousServlet, servletType, servletMappings, moduleContext);
+ for (org.apache.openejb.jee.Servlet servlet : loadOrder) {
+ previousServlet = addServlet(webModuleName, module, previousServlet, servlet, servletMappings, moduleContext);
}
}
@@ -1147,7 +1120,7 @@ public class JettyModuleBuilder extends
* @param webModuleName AbstractName of the web module
* @param module the web module being added
* @param previousServlet the servlet to start before this one in init order
- * @param servletType XMLObject specifying the servlet configuration
+ * @param servlet XMLObject specifying the servlet configuration
* @param servletMappings Map of servlet name to set of ServletMapping strings for this web app
* @param moduleContext deployment context for this module
* @return AbstractName of servlet gbean added
@@ -1156,16 +1129,16 @@ public class JettyModuleBuilder extends
private AbstractName addServlet(AbstractName webModuleName,
Module module,
AbstractName previousServlet,
- ServletType servletType,
+ org.apache.openejb.jee.Servlet servlet,
Map<String, Set<String>> servletMappings,
EARContext moduleContext) throws DeploymentException {
- String servletName = servletType.getServletName().getStringValue().trim();
+ String servletName = servlet.getServletName().trim();
AbstractName servletAbstractName = moduleContext.getNaming().createChildName(webModuleName, servletName, NameFactory.SERVLET);
GBeanData servletData;
Map<String, String> initParams = new HashMap<String, String>();
- if (servletType.isSetServletClass()) {
+ if (servlet.getServletClass() != null) {
Bundle webBundle = moduleContext.getDeploymentBundle();
- String servletClassName = servletType.getServletClass().getStringValue().trim();
+ String servletClassName = servlet.getServletClass().trim();
Class servletClass;
try {
servletClass = webBundle.loadClass(servletClassName);
@@ -1201,9 +1174,9 @@ public class JettyModuleBuilder extends
throw new DeploymentException("POJO web service: " + servletName + " not configured by any web service builder");
}
}
- } else if (servletType.isSetJspFile()) {
+ } else if (servlet.getJspFile() != null) {
servletData = new GBeanData(servletAbstractName, ServletHolderWrapper.class);
- servletData.setAttribute("jspFile", servletType.getJspFile().getStringValue().trim());
+ servletData.setAttribute("jspFile", servlet.getJspFile().trim());
servletData.setAttribute("servletClass", jspServlet.getServletClassName());
initParams.put("development", "false");
} else {
@@ -1220,13 +1193,13 @@ public class JettyModuleBuilder extends
//TODO in init param setter, add classpath if jspFile is not null.
servletData.setReferencePattern("JettyServletRegistration", webModuleName);
servletData.setAttribute("servletName", servletName);
- ParamValueType[] initParamArray = servletType.getInitParamArray();
- for (ParamValueType paramValueType : initParamArray) {
- initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim());
+ List<ParamValue> initParamArray = servlet.getInitParam();
+ for (ParamValue paramValue : initParamArray) {
+ initParams.put(paramValue.getParamName().trim(), paramValue.getParamValue().trim());
}
servletData.setAttribute("initParams", initParams);
- if (servletType.isSetLoadOnStartup()) {
- Integer loadOnStartup = new Integer(servletType.xgetLoadOnStartup().getStringValue());
+ if (servlet.getLoadOnStartup() != null) {
+ Integer loadOnStartup = servlet.getLoadOnStartup();
servletData.setAttribute("loadOnStartup", loadOnStartup);
}
@@ -1234,8 +1207,8 @@ public class JettyModuleBuilder extends
servletData.setAttribute("servletMappings", mappings == null ? Collections.EMPTY_SET : mappings);
//run-as
- if (servletType.isSetRunAs()) {
- String runAsRole = servletType.getRunAs().getRoleName().getStringValue().trim();
+ if (servlet.getRunAs() != null) {
+ String runAsRole = servlet.getRunAs().getRoleName().trim();
servletData.setAttribute("runAsRole", runAsRole);
}
@@ -1248,42 +1221,42 @@ public class JettyModuleBuilder extends
}
- static class StartupOrderComparator implements Comparator<ServletType>, Serializable {
+ static class StartupOrderComparator implements Comparator<org.apache.openejb.jee.Servlet>, Serializable {
/**
* comparator that compares first on the basis of startup order, and then on the lexicographical
* ordering of servlet name. Since the servlet names have a uniqueness constraint, this should
* provide a total ordering consistent with equals. All servlets with no startup order are after
* all servlets with a startup order.
*
- * @param s1 first ServletType object
- * @param s2 second ServletType object
+ * @param s1 first Servlet object
+ * @param s2 second Servlet object
* @return an int < 0 if o1 precedes o2, 0 if they are equal, and > 0 if o2 preceeds o1.
*/
- public int compare(ServletType s1, ServletType s2) {
+ public int compare(org.apache.openejb.jee.Servlet s1, org.apache.openejb.jee.Servlet s2) {
// load-on-startup is set for neither. the
// ordering at this point doesn't matter, but we
// should return "0" only if the two objects say
// they are equal
- if (!s1.isSetLoadOnStartup() && !s2.isSetLoadOnStartup()) {
- return s1.equals(s2) ? 0 : s1.getServletName().getStringValue().trim().compareTo(s2.getServletName().getStringValue().trim());
+ if (s1.getLoadOnStartup() == null && s2.getLoadOnStartup() == null) {
+ return s1.equals(s2) ? 0 : s1.getServletName().trim().compareTo(s2.getServletName().trim());
}
// load-on-startup is set for one but not the
// other. whichever one is set will be "less
// than", i.e. it will be loaded first
- if (s1.isSetLoadOnStartup() && !s2.isSetLoadOnStartup()) {
+ if (s1.getLoadOnStartup() != null && s2.getLoadOnStartup() == null) {
return -1;
}
- if (!s1.isSetLoadOnStartup() && s2.isSetLoadOnStartup()) {
+ if (s1.getLoadOnStartup() == null && s2.getLoadOnStartup() != null) {
return 1;
}
// load-on-startup is set for both. whichever one
// has a smaller value is "less than"
- int comp = new Integer(s1.xgetLoadOnStartup().getStringValue()).compareTo(new Integer(s2.xgetLoadOnStartup().getStringValue()));
+ int comp = new Integer(s1.getLoadOnStartup()).compareTo(s2.getLoadOnStartup());
if (comp == 0) {
- return s1.getServletName().getStringValue().trim().compareTo(s2.getServletName().getStringValue().trim());
+ return s1.getServletName().trim().compareTo(s2.getServletName().trim());
}
return comp;
}
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/xsd/geronimo-jetty-2.0.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/xsd/geronimo-jetty-2.0.2.xsd?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/xsd/geronimo-jetty-2.0.2.xsd (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/xsd/geronimo-jetty-2.0.2.xsd Thu Jun 24 18:06:24 2010
@@ -24,9 +24,9 @@
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:jaspi="http://geronimo.apache.org/xml/ns/geronimo-jaspi"
- xmlns:ee="http://java.sun.com/xml/ns/persistence"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1.0">
+ <!--xmlns:ee="http://java.sun.com/xml/ns/persistence"-->
<xs:annotation>
<xs:documentation>
@@ -83,7 +83,7 @@
</xs:annotation>
</xs:import>
- <xs:import namespace="http://java.sun.com/xml/ns/persistence" schemaLocation="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"/>
+ <!--<xs:import namespace="http://java.sun.com/xml/ns/persistence" schemaLocation="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"/>-->
<xs:import namespace="http://geronimo.apache.org/xml/ns/geronimo-jaspi" schemaLocation="geronimo-jaspi.xsd"/>
<xs:element name="web-app" type="web:web-appType">
@@ -242,7 +242,7 @@
</xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="sys:service" minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="sys:service">
<xs:annotation>
<xs:documentation>
Reference to abstract service element defined in imported
@@ -250,7 +250,8 @@
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element ref="ee:persistence"/>
+ <!--<xs:element ref="ee:persistence"/>-->
+ <xs:any namespace="http://java.sun.com/xml/ns/persistence"/>
</xs:choice>
</xs:sequence>
</xs:complexType>