Author: richard.opalka(a)jboss.com
Date: 2009-09-23 06:42:05 -0400 (Wed, 23 Sep 2009)
New Revision: 10748
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/endpoint/
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/endpoint/
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/endpoint/
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
container/jboss50/branches/jbossws-jboss500/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
container/jboss50/branches/jbossws-jboss501/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
container/jboss50/branches/jbossws-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2674][JBWS-2754] resuscitating server side JAX-WS endpoint API
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -5,6 +5,7 @@
import org.jboss.logging.Logger;
import org.jboss.metadata.serviceref.VirtualFileAdaptor;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.ResourceLoaderAdapter;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -17,7 +18,7 @@
/**
* Base class for all deployment model builders.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
abstract class AbstractDeploymentModelBuilder implements DeploymentModelBuilder
@@ -43,7 +44,7 @@
/**
* @see
org.jboss.webservices.integration.deployers.deployment.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
- *
+ *
* @param unit deployment unit
*/
public final void newDeploymentModel(final DeploymentUnit unit)
@@ -58,7 +59,7 @@
/**
* Template method for subclasses to implement.
- *
+ *
* @param dep webservice deployment
* @param unit deployment unit
*/
@@ -66,7 +67,7 @@
/**
* Creates new Web Service endpoint.
- *
+ *
* @param endpointClass endpoint class name
* @param endpointName endpoint name
* @param dep deployment
@@ -93,7 +94,7 @@
/**
* Creates new Web Service deployment.
- *
+ *
* @param unit deployment unit
* @return archive deployment
*/
@@ -112,7 +113,14 @@
dep.setParent(parentDep);
}
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ }
+ else
+ {
+ dep.setRootFile(new ResourceLoaderAdapter(unit.getClassLoader()));
+ }
dep.setRuntimeClassLoader(unit.getClassLoader());
final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit,
DeploymentType.class);
dep.setType(deploymentType);
@@ -122,7 +130,7 @@
/**
* Creates new archive deployment.
- *
+ *
* @param name deployment name
* @param loader deployment loader
* @return new archive deployment
@@ -136,7 +144,7 @@
* Gets specified attachment from deployment unit.
* Checks it's not null and then propagates it to <b>dep</b>
* attachments. Finally it returns attachment value.
- *
+ *
* @param <A> class type
* @param attachment attachment
* @param unit deployment unit
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -4,7 +4,7 @@
/**
* Deployment builder interface.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
interface DeploymentModelBuilder
@@ -12,7 +12,7 @@
/**
* Creates Web Service deployment model and associates it with deployment.
- *
+ *
* @param unit deployment unit
*/
void newDeploymentModel(DeploymentUnit unit);
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.endpoint;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.Endpoint;
+
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * JAXWS HTTP server implementation that nestles inside JBoss AS.
+ * This implementation simply delegates deployment of dynamically created
+ * JBoss web deployment to JBoss main deployer.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class EndpointAPIHttpServer extends AbstractExtensible implements
HttpServer
+{
+
+ /** JBoss deployment factory. */
+ private final DeploymentFactory factory = new DeploymentFactory();
+ /** JBoss Main deployer. */
+ private final DeployerClient mainDeployer;
+ /** JBossWS SPI provider. */
+ private final SPIProvider spiProvider =
SPIProviderResolver.getInstance().getProvider();
+ /** Registered deployments. */
+ private final Map<String, Deployment> deployments = new HashMap<String,
Deployment>();
+
+ /**
+ * Constructor - invoked by MC.
+ *
+ * @param mainDeployer JBoss main deployer
+ */
+ public EndpointAPIHttpServer(final DeployerClient mainDeployer)
+ {
+ super();
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Starts an instance of this HTTP server.
+ */
+ public void start()
+ {
+ // Nothing to start, we're running inside JBoss AS
+ }
+
+ /**
+ * Creates an requested HTTP context.
+ *
+ * @param contextRoot context root name
+ * @return context instance
+ */
+ public synchronized HttpContext createContext(final String contextRoot)
+ {
+ return this.spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this,
contextRoot);
+ }
+
+ /**
+ * Publishes a JAXWS endpoint to the JBoss server.
+ *
+ * @param context web context
+ * @param endpoint to publish
+ */
+ public synchronized void publish(final HttpContext context, final Endpoint endpoint)
+ {
+ final String contextRoot = context.getContextRoot();
+ if (this.deployments.keySet().contains(contextRoot))
+ {
+ throw new WSFDeploymentException("Context root '" + contextRoot +
"' already exists");
+ }
+
+ final Class<?> endpointClass = this.getEndpointClass(endpoint);
+ final ClassLoader endpointClassLoader = endpointClass.getClassLoader();
+ final Deployment deployment =
this.createSimpleDeployment("http://jaxws-endpoint-api" + contextRoot);
+ final MutableAttachments mutableAttachments = (MutableAttachments)
deployment.getPredeterminedManagedObjects();
+ final JBossWebMetaData jbossWebMD = this.newJBossWebMetaData(contextRoot,
endpointClass);
+
+ mutableAttachments.addAttachment("org.jboss.web.explicitDocBase",
"/", String.class);
+ mutableAttachments.addAttachment(JBossWebMetaData.class, jbossWebMD);
+ mutableAttachments.addAttachment(ClassLoaderFactory.class, new
ContextClassLoaderFactory(endpointClassLoader));
+
+ try
+ {
+ this.mainDeployer.deploy(deployment);
+ this.deployments.put(contextRoot, deployment);
+ }
+ catch (DeploymentException de)
+ {
+ WSFDeploymentException.rethrow(de);
+ }
+ }
+
+ /**
+ * Destroys dynamically published JAXWS endpoint on the JBoss server.
+ *
+ * @param context to be destroyed
+ * @param endpoint to be unpublished
+ */
+ public synchronized void destroy(final HttpContext context, final Endpoint endpoint)
+ {
+ try
+ {
+ final String contextRoot = context.getContextRoot();
+ final Deployment deployment = this.deployments.remove(contextRoot);
+ if (deployment != null)
+ {
+ this.mainDeployer.undeploy(deployment);
+ }
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ /**
+ * Returns implementor class associated with endpoint.
+ *
+ * @param endpoint to get implementor class from
+ * @return implementor class
+ */
+ private Class<?> getEndpointClass(final Endpoint endpoint)
+ {
+ final Object implementor = endpoint.getImplementor();
+ return implementor instanceof Class<?> ? (Class<?>) implementor :
implementor.getClass();
+ }
+
+ /**
+ * Creates new JBoss web meta data.
+ *
+ * @param contextRoot context root
+ * @param endpointClass endpoint class
+ * @return new JBoss web meta data
+ */
+ private JBossWebMetaData newJBossWebMetaData(final String contextRoot, final
Class<?> endpointClass)
+ {
+ final JBossWebMetaData jbossWebMD = new JBossWebMetaData();
+ final JBossServletsMetaData servletsMD =
WebMetaDataHelper.getServlets(jbossWebMD);
+ final List<ServletMappingMetaData> servletMappingMD =
WebMetaDataHelper.getServletMappings(jbossWebMD);
+ final String servletName = "jaxws-dynamic-endpoint";
+
+ WebMetaDataHelper.newServlet(servletName, endpointClass.getName(), servletsMD);
+ WebMetaDataHelper.newServletMapping(servletName,
WebMetaDataHelper.getUrlPatterns("/*"), servletMappingMD);
+ jbossWebMD.setContextRoot(contextRoot);
+
+ return jbossWebMD;
+ }
+
+ /**
+ * Creates simple web deployment using deployers client api.
+ *
+ * @param name deployment name
+ * @return new deployment
+ */
+ private Deployment createSimpleDeployment(final String name)
+ {
+ final Deployment unit = new AbstractDeployment(name);
+ this.factory.addContext(unit, "");
+
+ return unit;
+ }
+
+ /**
+ * @see org.jboss.deployers.structure.spi.ClassLoaderFactory
+ */
+ private static class ContextClassLoaderFactory implements ClassLoaderFactory
+ {
+ /** Delegee. */
+ private ClassLoader classLoader;
+
+ /**
+ * Constructor.
+ *
+ * @param classLoader class loader
+ */
+ public ContextClassLoaderFactory(final ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#createClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @return class loader
+ * @throws Exception never thrown in our case
+ */
+ public ClassLoader createClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ return this.classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#removeClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @throws Exception never thrown in our case
+ */
+ public void removeClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ this.classLoader = null;
+ }
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -41,6 +41,7 @@
abstract class AbstractMetaDataBuilderEJB
{
+ /** Logger. */
protected final Logger log = Logger.getLogger(this.getClass());
/**
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -32,6 +32,7 @@
import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -266,7 +267,7 @@
/**
* Creates login-config part of web.xml descriptor.
- *
+ *
* <pre>
* <login-config>
* <auth-method>EjbDeploymentAuthMethod</auth-method>
Deleted:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -1,424 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.webservices.integration.tomcat;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.LoginConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-
-/**
- * Utility class that simplifies work with JBossWebMetaData object structure.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class WebMetaDataHelper
-{
-
- /** Star utility string. */
- private static final String STAR_STRING = "*";
-
- /** GET http method utility string. */
- private static final String GET_STRING = "GET";
-
- /** POST http method utility string. */
- private static final String POST_STRING = "POST";
-
- /** GET and POST methods utility list. */
- private static List<String> getAndPostMethods;
-
- /** POST method utility list. */
- private static List<String> onlyPostMethod;
-
- /** All roles utility list. */
- private static List<String> allRoles;
-
- static
- {
- final List<String> getAndPostList = new LinkedList<String>();
- getAndPostList.add(WebMetaDataHelper.GET_STRING);
- getAndPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
-
- final List<String> onlyPostList = new LinkedList<String>();
- onlyPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
-
- final List<String> roleNamesList = new LinkedList<String>();
- roleNamesList.add(WebMetaDataHelper.STAR_STRING);
- WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
- }
-
- /**
- * Constructor.
- */
- private WebMetaDataHelper()
- {
- super();
- }
-
- /**
- * Creates URL pattern list from passed string.
- *
- * @param urlPattern URL pattern
- * @return list wrapping passed parameter
- */
- static List<String> getUrlPatterns(final String urlPattern)
- {
- final List<String> linkedList = new LinkedList<String>();
-
- linkedList.add(urlPattern);
-
- return linkedList;
- }
-
- /**
- * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
- *
- * @param secureWsdlAccess whether WSDL is secured
- * @return web access methods
- */
- static List<String> getHttpMethods(final boolean secureWsdlAccess)
- {
- return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
- }
-
- /**
- * Returns all role list.
- *
- * @return all role list
- */
- static List<String> getAllRoles()
- {
- return WebMetaDataHelper.allRoles;
- }
-
- /**
- * Gests servlets meta data from jboss web meta data.
- * If not found it creates new servlets meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlets meta data
- */
- static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
- {
- JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
-
- if (servletsMD == null)
- {
- servletsMD = new JBossServletsMetaData();
- jbossWebMD.setServlets(servletsMD);
- }
-
- return servletsMD;
- }
-
- /**
- * Gests servlet mappings meta data from jboss web meta data.
- * If not found it creates new servlet mappings meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlet mappings meta data
- */
- static List<ServletMappingMetaData> getServletMappings(final JBossWebMetaData
jbossWebMD)
- {
- List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
-
- if (servletMappingsMD == null)
- {
- servletMappingsMD = new LinkedList<ServletMappingMetaData>();
- jbossWebMD.setServletMappings(servletMappingsMD);
- }
-
- return servletMappingsMD;
- }
-
- /**
- * Gests security constraints meta data from jboss web meta data.
- * If not found it creates new security constraints meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return security constraints meta data
- */
- static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
- {
- List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
-
- if (securityConstraintsMD == null)
- {
- securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
- jbossWebMD.setSecurityContraints(securityConstraintsMD);
- }
-
- return securityConstraintsMD;
- }
-
- /**
- * Gests login config meta data from jboss web meta data.
- * If not found it creates new login config meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return login config meta data
- */
- static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
- {
- LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
-
- if (loginConfigMD == null)
- {
- loginConfigMD = new LoginConfigMetaData();
- jbossWebMD.setLoginConfig(loginConfigMD);
- }
-
- return loginConfigMD;
- }
-
- /**
- * Gests context parameters meta data from jboss web meta data.
- * If not found it creates new context parameters meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return context parameters meta data
- */
- static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
- {
- List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
-
- if (contextParamsMD == null)
- {
- contextParamsMD = new LinkedList<ParamValueMetaData>();
- jbossWebMD.setContextParams(contextParamsMD);
- }
-
- return contextParamsMD;
- }
-
- /**
- * Gests web resource collections meta data from security constraint meta data.
- * If not found it creates new web resource collections meta data
- * and associates them with security constraint meta data.
- *
- * @param securityConstraintMD security constraint meta data
- * @return web resource collections meta data
- */
- static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
- {
- WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
-
- if (webResourceCollectionsMD == null)
- {
- webResourceCollectionsMD = new WebResourceCollectionsMetaData();
- securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
- }
-
- return webResourceCollectionsMD;
- }
-
- /**
- * Gests init parameters meta data from servlet meta data.
- * If not found it creates new init parameters meta data
- * and associates them with servlet meta data.
- *
- * @param servletMD servlet meta data
- * @return init parameters meta data
- */
- static List<ParamValueMetaData> getServletInitParams(final ServletMetaData
servletMD)
- {
- List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
-
- if (initParamsMD == null)
- {
- initParamsMD = new LinkedList<ParamValueMetaData>();
- servletMD.setInitParam(initParamsMD);
- }
-
- return initParamsMD;
- }
-
- /**
- * Creates new security constraint meta data and associates them with security
constraints meta data.
- *
- * @param securityConstraintsMD security constraints meta data
- * @return new security constraing meta data
- */
- static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
- {
- final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
-
- securityConstraintsMD.add(securityConstraintMD);
-
- return securityConstraintMD;
- }
-
- /**
- * Creates new web resource collection meta data and associates them with web resource
collections meta data.
- *
- * @param servletName servlet name
- * @param urlPattern URL pattern
- * @param securedWsdl whether WSDL access is secured
- * @param webResourceCollectionsMD web resource collections meta data
- * @return new web resource collection meta data
- */
- static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
- final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
- {
- final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
-
- webResourceCollectionMD.setWebResourceName(servletName);
-
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
-
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
- webResourceCollectionsMD.add(webResourceCollectionMD);
-
- return webResourceCollectionMD;
- }
-
- /**
- * Creates new servlet meta data and associates them with servlets meta data.
- *
- * @param servletName servlet name
- * @param servletClass servlet class name
- * @param servletsMD servlets meta data
- * @return new servlet meta data
- */
- static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
- final JBossServletsMetaData servletsMD)
- {
- final JBossServletMetaData servletMD = new JBossServletMetaData();
-
- servletMD.setServletName(servletName);
- servletMD.setServletClass(servletClass);
- servletsMD.add(servletMD);
-
- return servletMD;
- }
-
- /**
- * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
- *
- * @param servletName servlet name
- * @param urlPatterns URL patterns
- * @param servletMappingsMD servlet mapping meta data
- * @return new servlet mapping meta data
- */
- static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
- final List<ServletMappingMetaData> servletMappingsMD)
- {
- final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
-
- servletMappingMD.setServletName(servletName);
- servletMappingMD.setUrlPatterns(urlPatterns);
- servletMappingsMD.add(servletMappingMD);
-
- return servletMappingMD;
- }
-
- /**
- * Creates new authentication constraint and associates it with security constraint
meta data.
- *
- * @param roleNames roles
- * @param securityConstraintMD security constraint meta data
- * @return new authentication constraint meta data
- */
- static AuthConstraintMetaData newAuthConstraint(final List<String> roleNames,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
-
- authConstraintMD.setRoleNames(roleNames);
- securityConstraintMD.setAuthConstraint(authConstraintMD);
-
- return authConstraintMD;
- }
-
- /**
- * Creates new user constraint meta data and associates it with security constraint
meta data.
- *
- * @param transportGuarantee transport guarantee value
- * @param securityConstraintMD security constraint meta data
- * @return new user data constraint meta data
- */
- static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
- final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
-
- userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
- securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
-
- return userDataConstraintMD;
- }
-
- /**
- * Creates new parameter meta data and associates it with parameters meta data.
- *
- * @param key parameter key
- * @param value parameter value
- * @param paramsMD parameters meta data
- * @return new parameter meta data
- */
- static ParamValueMetaData newParamValue(final String key, final String value, final
List<ParamValueMetaData> paramsMD)
- {
- final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
-
- paramsMD.add(paramValueMD);
-
- return paramValueMD;
- }
-
- /**
- * Creates new parameter with specified key and value.
- *
- * @param key the key
- * @param value the value
- * @return new parameter
- */
- private static ParamValueMetaData newParamValue(final String key, final String value)
- {
- final ParamValueMetaData paramMD = new ParamValueMetaData();
-
- paramMD.setParamName(key);
- paramMD.setParamValue(value);
-
- return paramMD;
- }
-
-}
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -29,6 +29,7 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,424 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.util;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+
+/**
+ * Utility class that simplifies work with JBossWebMetaData object structure.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class WebMetaDataHelper
+{
+
+ /** Star utility string. */
+ private static final String STAR_STRING = "*";
+
+ /** GET http method utility string. */
+ private static final String GET_STRING = "GET";
+
+ /** POST http method utility string. */
+ private static final String POST_STRING = "POST";
+
+ /** GET and POST methods utility list. */
+ private static List<String> getAndPostMethods;
+
+ /** POST method utility list. */
+ private static List<String> onlyPostMethod;
+
+ /** All roles utility list. */
+ private static List<String> allRoles;
+
+ static
+ {
+ final List<String> getAndPostList = new LinkedList<String>();
+ getAndPostList.add(WebMetaDataHelper.GET_STRING);
+ getAndPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
+
+ final List<String> onlyPostList = new LinkedList<String>();
+ onlyPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
+
+ final List<String> roleNamesList = new LinkedList<String>();
+ roleNamesList.add(WebMetaDataHelper.STAR_STRING);
+ WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
+ }
+
+ /**
+ * Constructor.
+ */
+ private WebMetaDataHelper()
+ {
+ super();
+ }
+
+ /**
+ * Creates URL pattern list from passed string.
+ *
+ * @param urlPattern URL pattern
+ * @return list wrapping passed parameter
+ */
+ public static List<String> getUrlPatterns(final String urlPattern)
+ {
+ final List<String> linkedList = new LinkedList<String>();
+
+ linkedList.add(urlPattern);
+
+ return linkedList;
+ }
+
+ /**
+ * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
+ *
+ * @param secureWsdlAccess whether WSDL is secured
+ * @return web access methods
+ */
+ public static List<String> getHttpMethods(final boolean secureWsdlAccess)
+ {
+ return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
+ }
+
+ /**
+ * Returns all role list.
+ *
+ * @return all role list
+ */
+ public static List<String> getAllRoles()
+ {
+ return WebMetaDataHelper.allRoles;
+ }
+
+ /**
+ * Gests servlets meta data from jboss web meta data.
+ * If not found it creates new servlets meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlets meta data
+ */
+ public static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
+ {
+ JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
+
+ if (servletsMD == null)
+ {
+ servletsMD = new JBossServletsMetaData();
+ jbossWebMD.setServlets(servletsMD);
+ }
+
+ return servletsMD;
+ }
+
+ /**
+ * Gests servlet mappings meta data from jboss web meta data.
+ * If not found it creates new servlet mappings meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlet mappings meta data
+ */
+ public static List<ServletMappingMetaData> getServletMappings(final
JBossWebMetaData jbossWebMD)
+ {
+ List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
+
+ if (servletMappingsMD == null)
+ {
+ servletMappingsMD = new LinkedList<ServletMappingMetaData>();
+ jbossWebMD.setServletMappings(servletMappingsMD);
+ }
+
+ return servletMappingsMD;
+ }
+
+ /**
+ * Gests security constraints meta data from jboss web meta data.
+ * If not found it creates new security constraints meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return security constraints meta data
+ */
+ public static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
+ {
+ List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
+
+ if (securityConstraintsMD == null)
+ {
+ securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
+ jbossWebMD.setSecurityContraints(securityConstraintsMD);
+ }
+
+ return securityConstraintsMD;
+ }
+
+ /**
+ * Gests login config meta data from jboss web meta data.
+ * If not found it creates new login config meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return login config meta data
+ */
+ public static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
+ {
+ LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
+
+ if (loginConfigMD == null)
+ {
+ loginConfigMD = new LoginConfigMetaData();
+ jbossWebMD.setLoginConfig(loginConfigMD);
+ }
+
+ return loginConfigMD;
+ }
+
+ /**
+ * Gests context parameters meta data from jboss web meta data.
+ * If not found it creates new context parameters meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return context parameters meta data
+ */
+ public static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
+ {
+ List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
+
+ if (contextParamsMD == null)
+ {
+ contextParamsMD = new LinkedList<ParamValueMetaData>();
+ jbossWebMD.setContextParams(contextParamsMD);
+ }
+
+ return contextParamsMD;
+ }
+
+ /**
+ * Gests web resource collections meta data from security constraint meta data.
+ * If not found it creates new web resource collections meta data
+ * and associates them with security constraint meta data.
+ *
+ * @param securityConstraintMD security constraint meta data
+ * @return web resource collections meta data
+ */
+ public static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
+ {
+ WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
+
+ if (webResourceCollectionsMD == null)
+ {
+ webResourceCollectionsMD = new WebResourceCollectionsMetaData();
+ securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
+ }
+
+ return webResourceCollectionsMD;
+ }
+
+ /**
+ * Gests init parameters meta data from servlet meta data.
+ * If not found it creates new init parameters meta data
+ * and associates them with servlet meta data.
+ *
+ * @param servletMD servlet meta data
+ * @return init parameters meta data
+ */
+ public static List<ParamValueMetaData> getServletInitParams(final
ServletMetaData servletMD)
+ {
+ List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
+
+ if (initParamsMD == null)
+ {
+ initParamsMD = new LinkedList<ParamValueMetaData>();
+ servletMD.setInitParam(initParamsMD);
+ }
+
+ return initParamsMD;
+ }
+
+ /**
+ * Creates new security constraint meta data and associates them with security
constraints meta data.
+ *
+ * @param securityConstraintsMD security constraints meta data
+ * @return new security constraing meta data
+ */
+ public static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
+ {
+ final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
+
+ securityConstraintsMD.add(securityConstraintMD);
+
+ return securityConstraintMD;
+ }
+
+ /**
+ * Creates new web resource collection meta data and associates them with web resource
collections meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPattern URL pattern
+ * @param securedWsdl whether WSDL access is secured
+ * @param webResourceCollectionsMD web resource collections meta data
+ * @return new web resource collection meta data
+ */
+ public static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
+ final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
+ {
+ final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
+
+ webResourceCollectionMD.setWebResourceName(servletName);
+
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
+
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
+ webResourceCollectionsMD.add(webResourceCollectionMD);
+
+ return webResourceCollectionMD;
+ }
+
+ /**
+ * Creates new servlet meta data and associates them with servlets meta data.
+ *
+ * @param servletName servlet name
+ * @param servletClass servlet class name
+ * @param servletsMD servlets meta data
+ * @return new servlet meta data
+ */
+ public static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
+ final JBossServletsMetaData servletsMD)
+ {
+ final JBossServletMetaData servletMD = new JBossServletMetaData();
+
+ servletMD.setServletName(servletName);
+ servletMD.setServletClass(servletClass);
+ servletsMD.add(servletMD);
+
+ return servletMD;
+ }
+
+ /**
+ * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPatterns URL patterns
+ * @param servletMappingsMD servlet mapping meta data
+ * @return new servlet mapping meta data
+ */
+ public static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
+ final List<ServletMappingMetaData> servletMappingsMD)
+ {
+ final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
+
+ servletMappingMD.setServletName(servletName);
+ servletMappingMD.setUrlPatterns(urlPatterns);
+ servletMappingsMD.add(servletMappingMD);
+
+ return servletMappingMD;
+ }
+
+ /**
+ * Creates new authentication constraint and associates it with security constraint
meta data.
+ *
+ * @param roleNames roles
+ * @param securityConstraintMD security constraint meta data
+ * @return new authentication constraint meta data
+ */
+ public static AuthConstraintMetaData newAuthConstraint(final List<String>
roleNames,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
+
+ authConstraintMD.setRoleNames(roleNames);
+ securityConstraintMD.setAuthConstraint(authConstraintMD);
+
+ return authConstraintMD;
+ }
+
+ /**
+ * Creates new user constraint meta data and associates it with security constraint
meta data.
+ *
+ * @param transportGuarantee transport guarantee value
+ * @param securityConstraintMD security constraint meta data
+ * @return new user data constraint meta data
+ */
+ public static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
+ final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
+
+ userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
+ securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
+
+ return userDataConstraintMD;
+ }
+
+ /**
+ * Creates new parameter meta data and associates it with parameters meta data.
+ *
+ * @param key parameter key
+ * @param value parameter value
+ * @param paramsMD parameters meta data
+ * @return new parameter meta data
+ */
+ public static ParamValueMetaData newParamValue(final String key, final String value,
final List<ParamValueMetaData> paramsMD)
+ {
+ final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
+
+ paramsMD.add(paramValueMD);
+
+ return paramValueMD;
+ }
+
+ /**
+ * Creates new parameter with specified key and value.
+ *
+ * @param key the key
+ * @param value the value
+ * @return new parameter
+ */
+ private static ParamValueMetaData newParamValue(final String key, final String value)
+ {
+ final ParamValueMetaData paramMD = new ParamValueMetaData();
+
+ paramMD.setParamName(key);
+ paramMD.setParamValue(value);
+
+ return paramMD;
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss50/branches/jbossws-jboss500/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss500/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
10:42:05 UTC (rev 10748)
@@ -12,6 +12,15 @@
<property name="mbeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
</bean>
+ <!-- Endpoint API http server -->
+ <bean name="WSHTTPServer"
class="org.jboss.webservices.integration.endpoint.EndpointAPIHttpServer">
+ <constructor>
+ <parameter>
+ <inject bean="MainDeployer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
<!-- An abstraction of server configuration aspects. -->
<bean name="WSServerConfig"
class="org.jboss.webservices.integration.config.ServerConfigImpl">
<property name="mbeanServer"><inject
bean="WSMBeanServerLocator"
property="mbeanServer"/></property>
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -5,6 +5,7 @@
import org.jboss.logging.Logger;
import org.jboss.metadata.serviceref.VirtualFileAdaptor;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.ResourceLoaderAdapter;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -17,7 +18,7 @@
/**
* Base class for all deployment model builders.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
abstract class AbstractDeploymentModelBuilder implements DeploymentModelBuilder
@@ -43,7 +44,7 @@
/**
* @see
org.jboss.webservices.integration.deployers.deployment.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
- *
+ *
* @param unit deployment unit
*/
public final void newDeploymentModel(final DeploymentUnit unit)
@@ -58,7 +59,7 @@
/**
* Template method for subclasses to implement.
- *
+ *
* @param dep webservice deployment
* @param unit deployment unit
*/
@@ -66,7 +67,7 @@
/**
* Creates new Web Service endpoint.
- *
+ *
* @param endpointClass endpoint class name
* @param endpointName endpoint name
* @param dep deployment
@@ -93,7 +94,7 @@
/**
* Creates new Web Service deployment.
- *
+ *
* @param unit deployment unit
* @return archive deployment
*/
@@ -112,7 +113,14 @@
dep.setParent(parentDep);
}
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ }
+ else
+ {
+ dep.setRootFile(new ResourceLoaderAdapter(unit.getClassLoader()));
+ }
dep.setRuntimeClassLoader(unit.getClassLoader());
final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit,
DeploymentType.class);
dep.setType(deploymentType);
@@ -122,7 +130,7 @@
/**
* Creates new archive deployment.
- *
+ *
* @param name deployment name
* @param loader deployment loader
* @return new archive deployment
@@ -136,7 +144,7 @@
* Gets specified attachment from deployment unit.
* Checks it's not null and then propagates it to <b>dep</b>
* attachments. Finally it returns attachment value.
- *
+ *
* @param <A> class type
* @param attachment attachment
* @param unit deployment unit
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -4,7 +4,7 @@
/**
* Deployment builder interface.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
interface DeploymentModelBuilder
@@ -12,7 +12,7 @@
/**
* Creates Web Service deployment model and associates it with deployment.
- *
+ *
* @param unit deployment unit
*/
void newDeploymentModel(DeploymentUnit unit);
Added:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.endpoint;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.Endpoint;
+
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * JAXWS HTTP server implementation that nestles inside JBoss AS.
+ * This implementation simply delegates deployment of dynamically created
+ * JBoss web deployment to JBoss main deployer.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class EndpointAPIHttpServer extends AbstractExtensible implements
HttpServer
+{
+
+ /** JBoss deployment factory. */
+ private final DeploymentFactory factory = new DeploymentFactory();
+ /** JBoss Main deployer. */
+ private final DeployerClient mainDeployer;
+ /** JBossWS SPI provider. */
+ private final SPIProvider spiProvider =
SPIProviderResolver.getInstance().getProvider();
+ /** Registered deployments. */
+ private final Map<String, Deployment> deployments = new HashMap<String,
Deployment>();
+
+ /**
+ * Constructor - invoked by MC.
+ *
+ * @param mainDeployer JBoss main deployer
+ */
+ public EndpointAPIHttpServer(final DeployerClient mainDeployer)
+ {
+ super();
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Starts an instance of this HTTP server.
+ */
+ public void start()
+ {
+ // Nothing to start, we're running inside JBoss AS
+ }
+
+ /**
+ * Creates an requested HTTP context.
+ *
+ * @param contextRoot context root name
+ * @return context instance
+ */
+ public synchronized HttpContext createContext(final String contextRoot)
+ {
+ return this.spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this,
contextRoot);
+ }
+
+ /**
+ * Publishes a JAXWS endpoint to the JBoss server.
+ *
+ * @param context web context
+ * @param endpoint to publish
+ */
+ public synchronized void publish(final HttpContext context, final Endpoint endpoint)
+ {
+ final String contextRoot = context.getContextRoot();
+ if (this.deployments.keySet().contains(contextRoot))
+ {
+ throw new WSFDeploymentException("Context root '" + contextRoot +
"' already exists");
+ }
+
+ final Class<?> endpointClass = this.getEndpointClass(endpoint);
+ final ClassLoader endpointClassLoader = endpointClass.getClassLoader();
+ final Deployment deployment =
this.createSimpleDeployment("http://jaxws-endpoint-api" + contextRoot);
+ final MutableAttachments mutableAttachments = (MutableAttachments)
deployment.getPredeterminedManagedObjects();
+ final JBossWebMetaData jbossWebMD = this.newJBossWebMetaData(contextRoot,
endpointClass);
+
+ mutableAttachments.addAttachment("org.jboss.web.explicitDocBase",
"/", String.class);
+ mutableAttachments.addAttachment(JBossWebMetaData.class, jbossWebMD);
+ mutableAttachments.addAttachment(ClassLoaderFactory.class, new
ContextClassLoaderFactory(endpointClassLoader));
+ mutableAttachments.addAttachment(Module.class,
ClassLoading.getModuleForClassLoader(endpointClassLoader));
+
+ try
+ {
+ this.mainDeployer.deploy(deployment);
+ this.deployments.put(contextRoot, deployment);
+ }
+ catch (DeploymentException de)
+ {
+ WSFDeploymentException.rethrow(de);
+ }
+ }
+
+ /**
+ * Destroys dynamically published JAXWS endpoint on the JBoss server.
+ *
+ * @param context to be destroyed
+ * @param endpoint to be unpublished
+ */
+ public synchronized void destroy(final HttpContext context, final Endpoint endpoint)
+ {
+ try
+ {
+ final String contextRoot = context.getContextRoot();
+ final Deployment deployment = this.deployments.remove(contextRoot);
+ if (deployment != null)
+ {
+ this.mainDeployer.undeploy(deployment);
+ }
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ /**
+ * Returns implementor class associated with endpoint.
+ *
+ * @param endpoint to get implementor class from
+ * @return implementor class
+ */
+ private Class<?> getEndpointClass(final Endpoint endpoint)
+ {
+ final Object implementor = endpoint.getImplementor();
+ return implementor instanceof Class<?> ? (Class<?>) implementor :
implementor.getClass();
+ }
+
+ /**
+ * Creates new JBoss web meta data.
+ *
+ * @param contextRoot context root
+ * @param endpointClass endpoint class
+ * @return new JBoss web meta data
+ */
+ private JBossWebMetaData newJBossWebMetaData(final String contextRoot, final
Class<?> endpointClass)
+ {
+ final JBossWebMetaData jbossWebMD = new JBossWebMetaData();
+ final JBossServletsMetaData servletsMD =
WebMetaDataHelper.getServlets(jbossWebMD);
+ final List<ServletMappingMetaData> servletMappingMD =
WebMetaDataHelper.getServletMappings(jbossWebMD);
+ final String servletName = "jaxws-dynamic-endpoint";
+
+ WebMetaDataHelper.newServlet(servletName, endpointClass.getName(), servletsMD);
+ WebMetaDataHelper.newServletMapping(servletName,
WebMetaDataHelper.getUrlPatterns("/*"), servletMappingMD);
+ jbossWebMD.setContextRoot(contextRoot);
+
+ return jbossWebMD;
+ }
+
+ /**
+ * Creates simple web deployment using deployers client api.
+ *
+ * @param name deployment name
+ * @return new deployment
+ */
+ private Deployment createSimpleDeployment(final String name)
+ {
+ final Deployment unit = new AbstractDeployment(name);
+ this.factory.addContext(unit, "");
+
+ return unit;
+ }
+
+ /**
+ * @see org.jboss.deployers.structure.spi.ClassLoaderFactory
+ */
+ private static class ContextClassLoaderFactory implements ClassLoaderFactory
+ {
+ /** Delegee. */
+ private ClassLoader classLoader;
+
+ /**
+ * Constructor.
+ *
+ * @param classLoader class loader
+ */
+ public ContextClassLoaderFactory(final ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#createClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @return class loader
+ * @throws Exception never thrown in our case
+ */
+ public ClassLoader createClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ return this.classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#removeClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @throws Exception never thrown in our case
+ */
+ public void removeClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ this.classLoader = null;
+ }
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -41,6 +41,7 @@
abstract class AbstractMetaDataBuilderEJB
{
+ /** Logger. */
protected final Logger log = Logger.getLogger(this.getClass());
/**
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -32,6 +32,7 @@
import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -266,7 +267,7 @@
/**
* Creates login-config part of web.xml descriptor.
- *
+ *
* <pre>
* <login-config>
* <auth-method>EjbDeploymentAuthMethod</auth-method>
Deleted:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -1,424 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.webservices.integration.tomcat;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.LoginConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-
-/**
- * Utility class that simplifies work with JBossWebMetaData object structure.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class WebMetaDataHelper
-{
-
- /** Star utility string. */
- private static final String STAR_STRING = "*";
-
- /** GET http method utility string. */
- private static final String GET_STRING = "GET";
-
- /** POST http method utility string. */
- private static final String POST_STRING = "POST";
-
- /** GET and POST methods utility list. */
- private static List<String> getAndPostMethods;
-
- /** POST method utility list. */
- private static List<String> onlyPostMethod;
-
- /** All roles utility list. */
- private static List<String> allRoles;
-
- static
- {
- final List<String> getAndPostList = new LinkedList<String>();
- getAndPostList.add(WebMetaDataHelper.GET_STRING);
- getAndPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
-
- final List<String> onlyPostList = new LinkedList<String>();
- onlyPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
-
- final List<String> roleNamesList = new LinkedList<String>();
- roleNamesList.add(WebMetaDataHelper.STAR_STRING);
- WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
- }
-
- /**
- * Constructor.
- */
- private WebMetaDataHelper()
- {
- super();
- }
-
- /**
- * Creates URL pattern list from passed string.
- *
- * @param urlPattern URL pattern
- * @return list wrapping passed parameter
- */
- static List<String> getUrlPatterns(final String urlPattern)
- {
- final List<String> linkedList = new LinkedList<String>();
-
- linkedList.add(urlPattern);
-
- return linkedList;
- }
-
- /**
- * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
- *
- * @param secureWsdlAccess whether WSDL is secured
- * @return web access methods
- */
- static List<String> getHttpMethods(final boolean secureWsdlAccess)
- {
- return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
- }
-
- /**
- * Returns all role list.
- *
- * @return all role list
- */
- static List<String> getAllRoles()
- {
- return WebMetaDataHelper.allRoles;
- }
-
- /**
- * Gests servlets meta data from jboss web meta data.
- * If not found it creates new servlets meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlets meta data
- */
- static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
- {
- JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
-
- if (servletsMD == null)
- {
- servletsMD = new JBossServletsMetaData();
- jbossWebMD.setServlets(servletsMD);
- }
-
- return servletsMD;
- }
-
- /**
- * Gests servlet mappings meta data from jboss web meta data.
- * If not found it creates new servlet mappings meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlet mappings meta data
- */
- static List<ServletMappingMetaData> getServletMappings(final JBossWebMetaData
jbossWebMD)
- {
- List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
-
- if (servletMappingsMD == null)
- {
- servletMappingsMD = new LinkedList<ServletMappingMetaData>();
- jbossWebMD.setServletMappings(servletMappingsMD);
- }
-
- return servletMappingsMD;
- }
-
- /**
- * Gests security constraints meta data from jboss web meta data.
- * If not found it creates new security constraints meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return security constraints meta data
- */
- static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
- {
- List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
-
- if (securityConstraintsMD == null)
- {
- securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
- jbossWebMD.setSecurityContraints(securityConstraintsMD);
- }
-
- return securityConstraintsMD;
- }
-
- /**
- * Gests login config meta data from jboss web meta data.
- * If not found it creates new login config meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return login config meta data
- */
- static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
- {
- LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
-
- if (loginConfigMD == null)
- {
- loginConfigMD = new LoginConfigMetaData();
- jbossWebMD.setLoginConfig(loginConfigMD);
- }
-
- return loginConfigMD;
- }
-
- /**
- * Gests context parameters meta data from jboss web meta data.
- * If not found it creates new context parameters meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return context parameters meta data
- */
- static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
- {
- List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
-
- if (contextParamsMD == null)
- {
- contextParamsMD = new LinkedList<ParamValueMetaData>();
- jbossWebMD.setContextParams(contextParamsMD);
- }
-
- return contextParamsMD;
- }
-
- /**
- * Gests web resource collections meta data from security constraint meta data.
- * If not found it creates new web resource collections meta data
- * and associates them with security constraint meta data.
- *
- * @param securityConstraintMD security constraint meta data
- * @return web resource collections meta data
- */
- static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
- {
- WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
-
- if (webResourceCollectionsMD == null)
- {
- webResourceCollectionsMD = new WebResourceCollectionsMetaData();
- securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
- }
-
- return webResourceCollectionsMD;
- }
-
- /**
- * Gests init parameters meta data from servlet meta data.
- * If not found it creates new init parameters meta data
- * and associates them with servlet meta data.
- *
- * @param servletMD servlet meta data
- * @return init parameters meta data
- */
- static List<ParamValueMetaData> getServletInitParams(final ServletMetaData
servletMD)
- {
- List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
-
- if (initParamsMD == null)
- {
- initParamsMD = new LinkedList<ParamValueMetaData>();
- servletMD.setInitParam(initParamsMD);
- }
-
- return initParamsMD;
- }
-
- /**
- * Creates new security constraint meta data and associates them with security
constraints meta data.
- *
- * @param securityConstraintsMD security constraints meta data
- * @return new security constraing meta data
- */
- static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
- {
- final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
-
- securityConstraintsMD.add(securityConstraintMD);
-
- return securityConstraintMD;
- }
-
- /**
- * Creates new web resource collection meta data and associates them with web resource
collections meta data.
- *
- * @param servletName servlet name
- * @param urlPattern URL pattern
- * @param securedWsdl whether WSDL access is secured
- * @param webResourceCollectionsMD web resource collections meta data
- * @return new web resource collection meta data
- */
- static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
- final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
- {
- final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
-
- webResourceCollectionMD.setWebResourceName(servletName);
-
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
-
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
- webResourceCollectionsMD.add(webResourceCollectionMD);
-
- return webResourceCollectionMD;
- }
-
- /**
- * Creates new servlet meta data and associates them with servlets meta data.
- *
- * @param servletName servlet name
- * @param servletClass servlet class name
- * @param servletsMD servlets meta data
- * @return new servlet meta data
- */
- static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
- final JBossServletsMetaData servletsMD)
- {
- final JBossServletMetaData servletMD = new JBossServletMetaData();
-
- servletMD.setServletName(servletName);
- servletMD.setServletClass(servletClass);
- servletsMD.add(servletMD);
-
- return servletMD;
- }
-
- /**
- * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
- *
- * @param servletName servlet name
- * @param urlPatterns URL patterns
- * @param servletMappingsMD servlet mapping meta data
- * @return new servlet mapping meta data
- */
- static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
- final List<ServletMappingMetaData> servletMappingsMD)
- {
- final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
-
- servletMappingMD.setServletName(servletName);
- servletMappingMD.setUrlPatterns(urlPatterns);
- servletMappingsMD.add(servletMappingMD);
-
- return servletMappingMD;
- }
-
- /**
- * Creates new authentication constraint and associates it with security constraint
meta data.
- *
- * @param roleNames roles
- * @param securityConstraintMD security constraint meta data
- * @return new authentication constraint meta data
- */
- static AuthConstraintMetaData newAuthConstraint(final List<String> roleNames,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
-
- authConstraintMD.setRoleNames(roleNames);
- securityConstraintMD.setAuthConstraint(authConstraintMD);
-
- return authConstraintMD;
- }
-
- /**
- * Creates new user constraint meta data and associates it with security constraint
meta data.
- *
- * @param transportGuarantee transport guarantee value
- * @param securityConstraintMD security constraint meta data
- * @return new user data constraint meta data
- */
- static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
- final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
-
- userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
- securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
-
- return userDataConstraintMD;
- }
-
- /**
- * Creates new parameter meta data and associates it with parameters meta data.
- *
- * @param key parameter key
- * @param value parameter value
- * @param paramsMD parameters meta data
- * @return new parameter meta data
- */
- static ParamValueMetaData newParamValue(final String key, final String value, final
List<ParamValueMetaData> paramsMD)
- {
- final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
-
- paramsMD.add(paramValueMD);
-
- return paramValueMD;
- }
-
- /**
- * Creates new parameter with specified key and value.
- *
- * @param key the key
- * @param value the value
- * @return new parameter
- */
- private static ParamValueMetaData newParamValue(final String key, final String value)
- {
- final ParamValueMetaData paramMD = new ParamValueMetaData();
-
- paramMD.setParamName(key);
- paramMD.setParamValue(value);
-
- return paramMD;
- }
-
-}
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -29,6 +29,7 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
Added:
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss501/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,424 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.util;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+
+/**
+ * Utility class that simplifies work with JBossWebMetaData object structure.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class WebMetaDataHelper
+{
+
+ /** Star utility string. */
+ private static final String STAR_STRING = "*";
+
+ /** GET http method utility string. */
+ private static final String GET_STRING = "GET";
+
+ /** POST http method utility string. */
+ private static final String POST_STRING = "POST";
+
+ /** GET and POST methods utility list. */
+ private static List<String> getAndPostMethods;
+
+ /** POST method utility list. */
+ private static List<String> onlyPostMethod;
+
+ /** All roles utility list. */
+ private static List<String> allRoles;
+
+ static
+ {
+ final List<String> getAndPostList = new LinkedList<String>();
+ getAndPostList.add(WebMetaDataHelper.GET_STRING);
+ getAndPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
+
+ final List<String> onlyPostList = new LinkedList<String>();
+ onlyPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
+
+ final List<String> roleNamesList = new LinkedList<String>();
+ roleNamesList.add(WebMetaDataHelper.STAR_STRING);
+ WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
+ }
+
+ /**
+ * Constructor.
+ */
+ private WebMetaDataHelper()
+ {
+ super();
+ }
+
+ /**
+ * Creates URL pattern list from passed string.
+ *
+ * @param urlPattern URL pattern
+ * @return list wrapping passed parameter
+ */
+ public static List<String> getUrlPatterns(final String urlPattern)
+ {
+ final List<String> linkedList = new LinkedList<String>();
+
+ linkedList.add(urlPattern);
+
+ return linkedList;
+ }
+
+ /**
+ * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
+ *
+ * @param secureWsdlAccess whether WSDL is secured
+ * @return web access methods
+ */
+ public static List<String> getHttpMethods(final boolean secureWsdlAccess)
+ {
+ return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
+ }
+
+ /**
+ * Returns all role list.
+ *
+ * @return all role list
+ */
+ public static List<String> getAllRoles()
+ {
+ return WebMetaDataHelper.allRoles;
+ }
+
+ /**
+ * Gests servlets meta data from jboss web meta data.
+ * If not found it creates new servlets meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlets meta data
+ */
+ public static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
+ {
+ JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
+
+ if (servletsMD == null)
+ {
+ servletsMD = new JBossServletsMetaData();
+ jbossWebMD.setServlets(servletsMD);
+ }
+
+ return servletsMD;
+ }
+
+ /**
+ * Gests servlet mappings meta data from jboss web meta data.
+ * If not found it creates new servlet mappings meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlet mappings meta data
+ */
+ public static List<ServletMappingMetaData> getServletMappings(final
JBossWebMetaData jbossWebMD)
+ {
+ List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
+
+ if (servletMappingsMD == null)
+ {
+ servletMappingsMD = new LinkedList<ServletMappingMetaData>();
+ jbossWebMD.setServletMappings(servletMappingsMD);
+ }
+
+ return servletMappingsMD;
+ }
+
+ /**
+ * Gests security constraints meta data from jboss web meta data.
+ * If not found it creates new security constraints meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return security constraints meta data
+ */
+ public static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
+ {
+ List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
+
+ if (securityConstraintsMD == null)
+ {
+ securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
+ jbossWebMD.setSecurityContraints(securityConstraintsMD);
+ }
+
+ return securityConstraintsMD;
+ }
+
+ /**
+ * Gests login config meta data from jboss web meta data.
+ * If not found it creates new login config meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return login config meta data
+ */
+ public static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
+ {
+ LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
+
+ if (loginConfigMD == null)
+ {
+ loginConfigMD = new LoginConfigMetaData();
+ jbossWebMD.setLoginConfig(loginConfigMD);
+ }
+
+ return loginConfigMD;
+ }
+
+ /**
+ * Gests context parameters meta data from jboss web meta data.
+ * If not found it creates new context parameters meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return context parameters meta data
+ */
+ public static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
+ {
+ List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
+
+ if (contextParamsMD == null)
+ {
+ contextParamsMD = new LinkedList<ParamValueMetaData>();
+ jbossWebMD.setContextParams(contextParamsMD);
+ }
+
+ return contextParamsMD;
+ }
+
+ /**
+ * Gests web resource collections meta data from security constraint meta data.
+ * If not found it creates new web resource collections meta data
+ * and associates them with security constraint meta data.
+ *
+ * @param securityConstraintMD security constraint meta data
+ * @return web resource collections meta data
+ */
+ public static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
+ {
+ WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
+
+ if (webResourceCollectionsMD == null)
+ {
+ webResourceCollectionsMD = new WebResourceCollectionsMetaData();
+ securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
+ }
+
+ return webResourceCollectionsMD;
+ }
+
+ /**
+ * Gests init parameters meta data from servlet meta data.
+ * If not found it creates new init parameters meta data
+ * and associates them with servlet meta data.
+ *
+ * @param servletMD servlet meta data
+ * @return init parameters meta data
+ */
+ public static List<ParamValueMetaData> getServletInitParams(final
ServletMetaData servletMD)
+ {
+ List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
+
+ if (initParamsMD == null)
+ {
+ initParamsMD = new LinkedList<ParamValueMetaData>();
+ servletMD.setInitParam(initParamsMD);
+ }
+
+ return initParamsMD;
+ }
+
+ /**
+ * Creates new security constraint meta data and associates them with security
constraints meta data.
+ *
+ * @param securityConstraintsMD security constraints meta data
+ * @return new security constraing meta data
+ */
+ public static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
+ {
+ final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
+
+ securityConstraintsMD.add(securityConstraintMD);
+
+ return securityConstraintMD;
+ }
+
+ /**
+ * Creates new web resource collection meta data and associates them with web resource
collections meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPattern URL pattern
+ * @param securedWsdl whether WSDL access is secured
+ * @param webResourceCollectionsMD web resource collections meta data
+ * @return new web resource collection meta data
+ */
+ public static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
+ final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
+ {
+ final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
+
+ webResourceCollectionMD.setWebResourceName(servletName);
+
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
+
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
+ webResourceCollectionsMD.add(webResourceCollectionMD);
+
+ return webResourceCollectionMD;
+ }
+
+ /**
+ * Creates new servlet meta data and associates them with servlets meta data.
+ *
+ * @param servletName servlet name
+ * @param servletClass servlet class name
+ * @param servletsMD servlets meta data
+ * @return new servlet meta data
+ */
+ public static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
+ final JBossServletsMetaData servletsMD)
+ {
+ final JBossServletMetaData servletMD = new JBossServletMetaData();
+
+ servletMD.setServletName(servletName);
+ servletMD.setServletClass(servletClass);
+ servletsMD.add(servletMD);
+
+ return servletMD;
+ }
+
+ /**
+ * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPatterns URL patterns
+ * @param servletMappingsMD servlet mapping meta data
+ * @return new servlet mapping meta data
+ */
+ public static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
+ final List<ServletMappingMetaData> servletMappingsMD)
+ {
+ final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
+
+ servletMappingMD.setServletName(servletName);
+ servletMappingMD.setUrlPatterns(urlPatterns);
+ servletMappingsMD.add(servletMappingMD);
+
+ return servletMappingMD;
+ }
+
+ /**
+ * Creates new authentication constraint and associates it with security constraint
meta data.
+ *
+ * @param roleNames roles
+ * @param securityConstraintMD security constraint meta data
+ * @return new authentication constraint meta data
+ */
+ public static AuthConstraintMetaData newAuthConstraint(final List<String>
roleNames,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
+
+ authConstraintMD.setRoleNames(roleNames);
+ securityConstraintMD.setAuthConstraint(authConstraintMD);
+
+ return authConstraintMD;
+ }
+
+ /**
+ * Creates new user constraint meta data and associates it with security constraint
meta data.
+ *
+ * @param transportGuarantee transport guarantee value
+ * @param securityConstraintMD security constraint meta data
+ * @return new user data constraint meta data
+ */
+ public static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
+ final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
+
+ userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
+ securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
+
+ return userDataConstraintMD;
+ }
+
+ /**
+ * Creates new parameter meta data and associates it with parameters meta data.
+ *
+ * @param key parameter key
+ * @param value parameter value
+ * @param paramsMD parameters meta data
+ * @return new parameter meta data
+ */
+ public static ParamValueMetaData newParamValue(final String key, final String value,
final List<ParamValueMetaData> paramsMD)
+ {
+ final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
+
+ paramsMD.add(paramValueMD);
+
+ return paramValueMD;
+ }
+
+ /**
+ * Creates new parameter with specified key and value.
+ *
+ * @param key the key
+ * @param value the value
+ * @return new parameter
+ */
+ private static ParamValueMetaData newParamValue(final String key, final String value)
+ {
+ final ParamValueMetaData paramMD = new ParamValueMetaData();
+
+ paramMD.setParamName(key);
+ paramMD.setParamValue(value);
+
+ return paramMD;
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss501/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss50/branches/jbossws-jboss501/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss501/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
10:42:05 UTC (rev 10748)
@@ -12,6 +12,15 @@
<property name="mbeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
</bean>
+ <!-- Endpoint API http server -->
+ <bean name="WSHTTPServer"
class="org.jboss.webservices.integration.endpoint.EndpointAPIHttpServer">
+ <constructor>
+ <parameter>
+ <inject bean="MainDeployer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
<!-- An abstraction of server configuration aspects. -->
<bean name="WSServerConfig"
class="org.jboss.webservices.integration.config.ServerConfigImpl">
<property name="mbeanServer"><inject
bean="WSMBeanServerLocator"
property="mbeanServer"/></property>
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -12,6 +12,7 @@
import org.jboss.metadata.serviceref.VirtualFileAdaptor;
import org.jboss.virtual.VirtualFile;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.ResourceLoaderAdapter;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -24,7 +25,7 @@
/**
* Base class for all deployment model builders.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
abstract class AbstractDeploymentModelBuilder implements DeploymentModelBuilder
@@ -53,7 +54,7 @@
/**
* @see
org.jboss.webservices.integration.deployers.deployment.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
- *
+ *
* @param unit deployment unit
*/
public final void newDeploymentModel(final DeploymentUnit unit)
@@ -68,7 +69,7 @@
/**
* Template method for subclasses to implement.
- *
+ *
* @param dep webservice deployment
* @param unit deployment unit
*/
@@ -76,7 +77,7 @@
/**
* Creates new Web Service endpoint.
- *
+ *
* @param endpointClass endpoint class name
* @param endpointName endpoint name
* @param dep deployment
@@ -103,7 +104,7 @@
/**
* Creates new Web Service deployment.
- *
+ *
* @param unit deployment unit
* @return archive deployment
*/
@@ -142,7 +143,14 @@
dep.setParent(parentDep);
}
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+ }
+ else
+ {
+ dep.setRootFile(new ResourceLoaderAdapter(unit.getClassLoader()));
+ }
dep.setRuntimeClassLoader(unit.getClassLoader());
final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit,
DeploymentType.class);
dep.setType(deploymentType);
@@ -152,7 +160,7 @@
/**
* Creates new archive deployment.
- *
+ *
* @param name deployment name
* @param loader deployment loader
* @return new archive deployment
@@ -166,7 +174,7 @@
* Gets specified attachment from deployment unit.
* Checks it's not null and then propagates it to <b>dep</b>
* attachments. Finally it returns attachment value.
- *
+ *
* @param <A> class type
* @param attachment attachment
* @param unit deployment unit
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -4,7 +4,7 @@
/**
* Deployment builder interface.
- *
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
interface DeploymentModelBuilder
@@ -12,7 +12,7 @@
/**
* Creates Web Service deployment model and associates it with deployment.
- *
+ *
* @param unit deployment unit
*/
void newDeploymentModel(DeploymentUnit unit);
Added:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/endpoint/EndpointAPIHttpServer.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.endpoint;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.Endpoint;
+
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * JAXWS HTTP server implementation that nestles inside JBoss AS.
+ * This implementation simply delegates deployment of dynamically created
+ * JBoss web deployment to JBoss main deployer.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class EndpointAPIHttpServer extends AbstractExtensible implements
HttpServer
+{
+
+ /** JBoss deployment factory. */
+ private final DeploymentFactory factory = new DeploymentFactory();
+ /** JBoss Main deployer. */
+ private final DeployerClient mainDeployer;
+ /** JBossWS SPI provider. */
+ private final SPIProvider spiProvider =
SPIProviderResolver.getInstance().getProvider();
+ /** Registered deployments. */
+ private final Map<String, Deployment> deployments = new HashMap<String,
Deployment>();
+
+ /**
+ * Constructor - invoked by MC.
+ *
+ * @param mainDeployer JBoss main deployer
+ */
+ public EndpointAPIHttpServer(final DeployerClient mainDeployer)
+ {
+ super();
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Starts an instance of this HTTP server.
+ */
+ public void start()
+ {
+ // Nothing to start, we're running inside JBoss AS
+ }
+
+ /**
+ * Creates an requested HTTP context.
+ *
+ * @param contextRoot context root name
+ * @return context instance
+ */
+ public synchronized HttpContext createContext(final String contextRoot)
+ {
+ return this.spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this,
contextRoot);
+ }
+
+ /**
+ * Publishes a JAXWS endpoint to the JBoss server.
+ *
+ * @param context web context
+ * @param endpoint to publish
+ */
+ public synchronized void publish(final HttpContext context, final Endpoint endpoint)
+ {
+ final String contextRoot = context.getContextRoot();
+ if (this.deployments.keySet().contains(contextRoot))
+ {
+ throw new WSFDeploymentException("Context root '" + contextRoot +
"' already exists");
+ }
+
+ final Class<?> endpointClass = this.getEndpointClass(endpoint);
+ final ClassLoader endpointClassLoader = endpointClass.getClassLoader();
+ final Deployment deployment =
this.createSimpleDeployment("http://jaxws-endpoint-api" + contextRoot);
+ final MutableAttachments mutableAttachments = (MutableAttachments)
deployment.getPredeterminedManagedObjects();
+ final JBossWebMetaData jbossWebMD = this.newJBossWebMetaData(contextRoot,
endpointClass);
+
+ mutableAttachments.addAttachment("org.jboss.web.explicitDocBase",
"/", String.class);
+ mutableAttachments.addAttachment(JBossWebMetaData.class, jbossWebMD);
+ mutableAttachments.addAttachment(ClassLoaderFactory.class, new
ContextClassLoaderFactory(endpointClassLoader));
+ mutableAttachments.addAttachment(Module.class,
ClassLoading.getModuleForClassLoader(endpointClassLoader));
+
+ try
+ {
+ this.mainDeployer.deploy(deployment);
+ this.deployments.put(contextRoot, deployment);
+ }
+ catch (DeploymentException de)
+ {
+ WSFDeploymentException.rethrow(de);
+ }
+ }
+
+ /**
+ * Destroys dynamically published JAXWS endpoint on the JBoss server.
+ *
+ * @param context to be destroyed
+ * @param endpoint to be unpublished
+ */
+ public synchronized void destroy(final HttpContext context, final Endpoint endpoint)
+ {
+ try
+ {
+ final String contextRoot = context.getContextRoot();
+ final Deployment deployment = this.deployments.remove(contextRoot);
+ if (deployment != null)
+ {
+ this.mainDeployer.undeploy(deployment);
+ }
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ /**
+ * Returns implementor class associated with endpoint.
+ *
+ * @param endpoint to get implementor class from
+ * @return implementor class
+ */
+ private Class<?> getEndpointClass(final Endpoint endpoint)
+ {
+ final Object implementor = endpoint.getImplementor();
+ return implementor instanceof Class<?> ? (Class<?>) implementor :
implementor.getClass();
+ }
+
+ /**
+ * Creates new JBoss web meta data.
+ *
+ * @param contextRoot context root
+ * @param endpointClass endpoint class
+ * @return new JBoss web meta data
+ */
+ private JBossWebMetaData newJBossWebMetaData(final String contextRoot, final
Class<?> endpointClass)
+ {
+ final JBossWebMetaData jbossWebMD = new JBossWebMetaData();
+ final JBossServletsMetaData servletsMD =
WebMetaDataHelper.getServlets(jbossWebMD);
+ final List<ServletMappingMetaData> servletMappingMD =
WebMetaDataHelper.getServletMappings(jbossWebMD);
+ final String servletName = "jaxws-dynamic-endpoint";
+
+ WebMetaDataHelper.newServlet(servletName, endpointClass.getName(), servletsMD);
+ WebMetaDataHelper.newServletMapping(servletName,
WebMetaDataHelper.getUrlPatterns("/*"), servletMappingMD);
+ jbossWebMD.setContextRoot(contextRoot);
+
+ return jbossWebMD;
+ }
+
+ /**
+ * Creates simple web deployment using deployers client api.
+ *
+ * @param name deployment name
+ * @return new deployment
+ */
+ private Deployment createSimpleDeployment(final String name)
+ {
+ final Deployment unit = new AbstractDeployment(name);
+ this.factory.addContext(unit, "");
+
+ return unit;
+ }
+
+ /**
+ * @see org.jboss.deployers.structure.spi.ClassLoaderFactory
+ */
+ private static class ContextClassLoaderFactory implements ClassLoaderFactory
+ {
+ /** Delegee. */
+ private ClassLoader classLoader;
+
+ /**
+ * Constructor.
+ *
+ * @param classLoader class loader
+ */
+ public ContextClassLoaderFactory(final ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#createClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @return class loader
+ * @throws Exception never thrown in our case
+ */
+ public ClassLoader createClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ return this.classLoader;
+ }
+
+ /**
+ * @see
org.jboss.deployers.structure.spi.ClassLoaderFactory#removeClassLoader(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ * @throws Exception never thrown in our case
+ */
+ public void removeClassLoader(final DeploymentUnit unit) throws Exception
+ {
+ this.classLoader = null;
+ }
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -41,6 +41,7 @@
abstract class AbstractMetaDataBuilderEJB
{
+ /** Logger. */
protected final Logger log = Logger.getLogger(this.getClass());
/**
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreator.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -32,6 +32,7 @@
import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -266,7 +267,7 @@
/**
* Creates login-config part of web.xml descriptor.
- *
+ *
* <pre>
* <login-config>
* <auth-method>EjbDeploymentAuthMethod</auth-method>
Deleted:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -1,424 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.webservices.integration.tomcat;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.LoginConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-
-/**
- * Utility class that simplifies work with JBossWebMetaData object structure.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class WebMetaDataHelper
-{
-
- /** Star utility string. */
- private static final String STAR_STRING = "*";
-
- /** GET http method utility string. */
- private static final String GET_STRING = "GET";
-
- /** POST http method utility string. */
- private static final String POST_STRING = "POST";
-
- /** GET and POST methods utility list. */
- private static List<String> getAndPostMethods;
-
- /** POST method utility list. */
- private static List<String> onlyPostMethod;
-
- /** All roles utility list. */
- private static List<String> allRoles;
-
- static
- {
- final List<String> getAndPostList = new LinkedList<String>();
- getAndPostList.add(WebMetaDataHelper.GET_STRING);
- getAndPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
-
- final List<String> onlyPostList = new LinkedList<String>();
- onlyPostList.add(WebMetaDataHelper.POST_STRING);
- WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
-
- final List<String> roleNamesList = new LinkedList<String>();
- roleNamesList.add(WebMetaDataHelper.STAR_STRING);
- WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
- }
-
- /**
- * Constructor.
- */
- private WebMetaDataHelper()
- {
- super();
- }
-
- /**
- * Creates URL pattern list from passed string.
- *
- * @param urlPattern URL pattern
- * @return list wrapping passed parameter
- */
- static List<String> getUrlPatterns(final String urlPattern)
- {
- final List<String> linkedList = new LinkedList<String>();
-
- linkedList.add(urlPattern);
-
- return linkedList;
- }
-
- /**
- * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
- *
- * @param secureWsdlAccess whether WSDL is secured
- * @return web access methods
- */
- static List<String> getHttpMethods(final boolean secureWsdlAccess)
- {
- return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
- }
-
- /**
- * Returns all role list.
- *
- * @return all role list
- */
- static List<String> getAllRoles()
- {
- return WebMetaDataHelper.allRoles;
- }
-
- /**
- * Gests servlets meta data from jboss web meta data.
- * If not found it creates new servlets meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlets meta data
- */
- static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
- {
- JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
-
- if (servletsMD == null)
- {
- servletsMD = new JBossServletsMetaData();
- jbossWebMD.setServlets(servletsMD);
- }
-
- return servletsMD;
- }
-
- /**
- * Gests servlet mappings meta data from jboss web meta data.
- * If not found it creates new servlet mappings meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return servlet mappings meta data
- */
- static List<ServletMappingMetaData> getServletMappings(final JBossWebMetaData
jbossWebMD)
- {
- List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
-
- if (servletMappingsMD == null)
- {
- servletMappingsMD = new LinkedList<ServletMappingMetaData>();
- jbossWebMD.setServletMappings(servletMappingsMD);
- }
-
- return servletMappingsMD;
- }
-
- /**
- * Gests security constraints meta data from jboss web meta data.
- * If not found it creates new security constraints meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return security constraints meta data
- */
- static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
- {
- List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
-
- if (securityConstraintsMD == null)
- {
- securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
- jbossWebMD.setSecurityContraints(securityConstraintsMD);
- }
-
- return securityConstraintsMD;
- }
-
- /**
- * Gests login config meta data from jboss web meta data.
- * If not found it creates new login config meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return login config meta data
- */
- static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
- {
- LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
-
- if (loginConfigMD == null)
- {
- loginConfigMD = new LoginConfigMetaData();
- jbossWebMD.setLoginConfig(loginConfigMD);
- }
-
- return loginConfigMD;
- }
-
- /**
- * Gests context parameters meta data from jboss web meta data.
- * If not found it creates new context parameters meta data
- * and associates them with jboss web meta data.
- *
- * @param jbossWebMD jboss web meta data
- * @return context parameters meta data
- */
- static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
- {
- List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
-
- if (contextParamsMD == null)
- {
- contextParamsMD = new LinkedList<ParamValueMetaData>();
- jbossWebMD.setContextParams(contextParamsMD);
- }
-
- return contextParamsMD;
- }
-
- /**
- * Gests web resource collections meta data from security constraint meta data.
- * If not found it creates new web resource collections meta data
- * and associates them with security constraint meta data.
- *
- * @param securityConstraintMD security constraint meta data
- * @return web resource collections meta data
- */
- static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
- {
- WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
-
- if (webResourceCollectionsMD == null)
- {
- webResourceCollectionsMD = new WebResourceCollectionsMetaData();
- securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
- }
-
- return webResourceCollectionsMD;
- }
-
- /**
- * Gests init parameters meta data from servlet meta data.
- * If not found it creates new init parameters meta data
- * and associates them with servlet meta data.
- *
- * @param servletMD servlet meta data
- * @return init parameters meta data
- */
- static List<ParamValueMetaData> getServletInitParams(final ServletMetaData
servletMD)
- {
- List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
-
- if (initParamsMD == null)
- {
- initParamsMD = new LinkedList<ParamValueMetaData>();
- servletMD.setInitParam(initParamsMD);
- }
-
- return initParamsMD;
- }
-
- /**
- * Creates new security constraint meta data and associates them with security
constraints meta data.
- *
- * @param securityConstraintsMD security constraints meta data
- * @return new security constraing meta data
- */
- static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
- {
- final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
-
- securityConstraintsMD.add(securityConstraintMD);
-
- return securityConstraintMD;
- }
-
- /**
- * Creates new web resource collection meta data and associates them with web resource
collections meta data.
- *
- * @param servletName servlet name
- * @param urlPattern URL pattern
- * @param securedWsdl whether WSDL access is secured
- * @param webResourceCollectionsMD web resource collections meta data
- * @return new web resource collection meta data
- */
- static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
- final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
- {
- final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
-
- webResourceCollectionMD.setWebResourceName(servletName);
-
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
-
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
- webResourceCollectionsMD.add(webResourceCollectionMD);
-
- return webResourceCollectionMD;
- }
-
- /**
- * Creates new servlet meta data and associates them with servlets meta data.
- *
- * @param servletName servlet name
- * @param servletClass servlet class name
- * @param servletsMD servlets meta data
- * @return new servlet meta data
- */
- static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
- final JBossServletsMetaData servletsMD)
- {
- final JBossServletMetaData servletMD = new JBossServletMetaData();
-
- servletMD.setServletName(servletName);
- servletMD.setServletClass(servletClass);
- servletsMD.add(servletMD);
-
- return servletMD;
- }
-
- /**
- * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
- *
- * @param servletName servlet name
- * @param urlPatterns URL patterns
- * @param servletMappingsMD servlet mapping meta data
- * @return new servlet mapping meta data
- */
- static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
- final List<ServletMappingMetaData> servletMappingsMD)
- {
- final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
-
- servletMappingMD.setServletName(servletName);
- servletMappingMD.setUrlPatterns(urlPatterns);
- servletMappingsMD.add(servletMappingMD);
-
- return servletMappingMD;
- }
-
- /**
- * Creates new authentication constraint and associates it with security constraint
meta data.
- *
- * @param roleNames roles
- * @param securityConstraintMD security constraint meta data
- * @return new authentication constraint meta data
- */
- static AuthConstraintMetaData newAuthConstraint(final List<String> roleNames,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
-
- authConstraintMD.setRoleNames(roleNames);
- securityConstraintMD.setAuthConstraint(authConstraintMD);
-
- return authConstraintMD;
- }
-
- /**
- * Creates new user constraint meta data and associates it with security constraint
meta data.
- *
- * @param transportGuarantee transport guarantee value
- * @param securityConstraintMD security constraint meta data
- * @return new user data constraint meta data
- */
- static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
- final SecurityConstraintMetaData securityConstraintMD)
- {
- final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
- final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
-
- userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
- securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
-
- return userDataConstraintMD;
- }
-
- /**
- * Creates new parameter meta data and associates it with parameters meta data.
- *
- * @param key parameter key
- * @param value parameter value
- * @param paramsMD parameters meta data
- * @return new parameter meta data
- */
- static ParamValueMetaData newParamValue(final String key, final String value, final
List<ParamValueMetaData> paramsMD)
- {
- final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
-
- paramsMD.add(paramValueMD);
-
- return paramValueMD;
- }
-
- /**
- * Creates new parameter with specified key and value.
- *
- * @param key the key
- * @param value the value
- * @return new parameter
- */
- private static ParamValueMetaData newParamValue(final String key, final String value)
- {
- final ParamValueMetaData paramMD = new ParamValueMetaData();
-
- paramMD.setParamName(key);
- paramMD.setParamValue(value);
-
- return paramMD;
- }
-
-}
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -29,6 +29,7 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.webservices.integration.util.WebMetaDataHelper;
import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
Added:
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss510/src/main/java/org/jboss/webservices/integration/util/WebMetaDataHelper.java 2009-09-23
10:42:05 UTC (rev 10748)
@@ -0,0 +1,424 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.util;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+
+/**
+ * Utility class that simplifies work with JBossWebMetaData object structure.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class WebMetaDataHelper
+{
+
+ /** Star utility string. */
+ private static final String STAR_STRING = "*";
+
+ /** GET http method utility string. */
+ private static final String GET_STRING = "GET";
+
+ /** POST http method utility string. */
+ private static final String POST_STRING = "POST";
+
+ /** GET and POST methods utility list. */
+ private static List<String> getAndPostMethods;
+
+ /** POST method utility list. */
+ private static List<String> onlyPostMethod;
+
+ /** All roles utility list. */
+ private static List<String> allRoles;
+
+ static
+ {
+ final List<String> getAndPostList = new LinkedList<String>();
+ getAndPostList.add(WebMetaDataHelper.GET_STRING);
+ getAndPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.getAndPostMethods =
Collections.unmodifiableList(getAndPostList);
+
+ final List<String> onlyPostList = new LinkedList<String>();
+ onlyPostList.add(WebMetaDataHelper.POST_STRING);
+ WebMetaDataHelper.onlyPostMethod = Collections.unmodifiableList(onlyPostList);
+
+ final List<String> roleNamesList = new LinkedList<String>();
+ roleNamesList.add(WebMetaDataHelper.STAR_STRING);
+ WebMetaDataHelper.allRoles = Collections.unmodifiableList(roleNamesList);
+ }
+
+ /**
+ * Constructor.
+ */
+ private WebMetaDataHelper()
+ {
+ super();
+ }
+
+ /**
+ * Creates URL pattern list from passed string.
+ *
+ * @param urlPattern URL pattern
+ * @return list wrapping passed parameter
+ */
+ public static List<String> getUrlPatterns(final String urlPattern)
+ {
+ final List<String> linkedList = new LinkedList<String>();
+
+ linkedList.add(urlPattern);
+
+ return linkedList;
+ }
+
+ /**
+ * If WSDL access is secured, it returns both POST and GET methods, otherwise only
POST method.
+ *
+ * @param secureWsdlAccess whether WSDL is secured
+ * @return web access methods
+ */
+ public static List<String> getHttpMethods(final boolean secureWsdlAccess)
+ {
+ return secureWsdlAccess ? WebMetaDataHelper.getAndPostMethods :
WebMetaDataHelper.onlyPostMethod;
+ }
+
+ /**
+ * Returns all role list.
+ *
+ * @return all role list
+ */
+ public static List<String> getAllRoles()
+ {
+ return WebMetaDataHelper.allRoles;
+ }
+
+ /**
+ * Gests servlets meta data from jboss web meta data.
+ * If not found it creates new servlets meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlets meta data
+ */
+ public static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD)
+ {
+ JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
+
+ if (servletsMD == null)
+ {
+ servletsMD = new JBossServletsMetaData();
+ jbossWebMD.setServlets(servletsMD);
+ }
+
+ return servletsMD;
+ }
+
+ /**
+ * Gests servlet mappings meta data from jboss web meta data.
+ * If not found it creates new servlet mappings meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlet mappings meta data
+ */
+ public static List<ServletMappingMetaData> getServletMappings(final
JBossWebMetaData jbossWebMD)
+ {
+ List<ServletMappingMetaData> servletMappingsMD =
jbossWebMD.getServletMappings();
+
+ if (servletMappingsMD == null)
+ {
+ servletMappingsMD = new LinkedList<ServletMappingMetaData>();
+ jbossWebMD.setServletMappings(servletMappingsMD);
+ }
+
+ return servletMappingsMD;
+ }
+
+ /**
+ * Gests security constraints meta data from jboss web meta data.
+ * If not found it creates new security constraints meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return security constraints meta data
+ */
+ public static List<SecurityConstraintMetaData> getSecurityConstraints(final
JBossWebMetaData jbossWebMD)
+ {
+ List<SecurityConstraintMetaData> securityConstraintsMD =
jbossWebMD.getSecurityContraints();
+
+ if (securityConstraintsMD == null)
+ {
+ securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
+ jbossWebMD.setSecurityContraints(securityConstraintsMD);
+ }
+
+ return securityConstraintsMD;
+ }
+
+ /**
+ * Gests login config meta data from jboss web meta data.
+ * If not found it creates new login config meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return login config meta data
+ */
+ public static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD)
+ {
+ LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
+
+ if (loginConfigMD == null)
+ {
+ loginConfigMD = new LoginConfigMetaData();
+ jbossWebMD.setLoginConfig(loginConfigMD);
+ }
+
+ return loginConfigMD;
+ }
+
+ /**
+ * Gests context parameters meta data from jboss web meta data.
+ * If not found it creates new context parameters meta data
+ * and associates them with jboss web meta data.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return context parameters meta data
+ */
+ public static List<ParamValueMetaData> getContextParams(final JBossWebMetaData
jbossWebMD)
+ {
+ List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
+
+ if (contextParamsMD == null)
+ {
+ contextParamsMD = new LinkedList<ParamValueMetaData>();
+ jbossWebMD.setContextParams(contextParamsMD);
+ }
+
+ return contextParamsMD;
+ }
+
+ /**
+ * Gests web resource collections meta data from security constraint meta data.
+ * If not found it creates new web resource collections meta data
+ * and associates them with security constraint meta data.
+ *
+ * @param securityConstraintMD security constraint meta data
+ * @return web resource collections meta data
+ */
+ public static WebResourceCollectionsMetaData getWebResourceCollections(final
SecurityConstraintMetaData securityConstraintMD)
+ {
+ WebResourceCollectionsMetaData webResourceCollectionsMD =
securityConstraintMD.getResourceCollections();
+
+ if (webResourceCollectionsMD == null)
+ {
+ webResourceCollectionsMD = new WebResourceCollectionsMetaData();
+ securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
+ }
+
+ return webResourceCollectionsMD;
+ }
+
+ /**
+ * Gests init parameters meta data from servlet meta data.
+ * If not found it creates new init parameters meta data
+ * and associates them with servlet meta data.
+ *
+ * @param servletMD servlet meta data
+ * @return init parameters meta data
+ */
+ public static List<ParamValueMetaData> getServletInitParams(final
ServletMetaData servletMD)
+ {
+ List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
+
+ if (initParamsMD == null)
+ {
+ initParamsMD = new LinkedList<ParamValueMetaData>();
+ servletMD.setInitParam(initParamsMD);
+ }
+
+ return initParamsMD;
+ }
+
+ /**
+ * Creates new security constraint meta data and associates them with security
constraints meta data.
+ *
+ * @param securityConstraintsMD security constraints meta data
+ * @return new security constraing meta data
+ */
+ public static SecurityConstraintMetaData newSecurityConstraint(final
List<SecurityConstraintMetaData> securityConstraintsMD)
+ {
+ final SecurityConstraintMetaData securityConstraintMD = new
SecurityConstraintMetaData();
+
+ securityConstraintsMD.add(securityConstraintMD);
+
+ return securityConstraintMD;
+ }
+
+ /**
+ * Creates new web resource collection meta data and associates them with web resource
collections meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPattern URL pattern
+ * @param securedWsdl whether WSDL access is secured
+ * @param webResourceCollectionsMD web resource collections meta data
+ * @return new web resource collection meta data
+ */
+ public static WebResourceCollectionMetaData newWebResourceCollection(final String
servletName, final String urlPattern,
+ final boolean securedWsdl, final WebResourceCollectionsMetaData
webResourceCollectionsMD)
+ {
+ final WebResourceCollectionMetaData webResourceCollectionMD = new
WebResourceCollectionMetaData();
+
+ webResourceCollectionMD.setWebResourceName(servletName);
+
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
+
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
+ webResourceCollectionsMD.add(webResourceCollectionMD);
+
+ return webResourceCollectionMD;
+ }
+
+ /**
+ * Creates new servlet meta data and associates them with servlets meta data.
+ *
+ * @param servletName servlet name
+ * @param servletClass servlet class name
+ * @param servletsMD servlets meta data
+ * @return new servlet meta data
+ */
+ public static JBossServletMetaData newServlet(final String servletName, final String
servletClass,
+ final JBossServletsMetaData servletsMD)
+ {
+ final JBossServletMetaData servletMD = new JBossServletMetaData();
+
+ servletMD.setServletName(servletName);
+ servletMD.setServletClass(servletClass);
+ servletsMD.add(servletMD);
+
+ return servletMD;
+ }
+
+ /**
+ * Creates new servlet mapping meta data and associates them with servlet mappings
meta data.
+ *
+ * @param servletName servlet name
+ * @param urlPatterns URL patterns
+ * @param servletMappingsMD servlet mapping meta data
+ * @return new servlet mapping meta data
+ */
+ public static ServletMappingMetaData newServletMapping(final String servletName, final
List<String> urlPatterns,
+ final List<ServletMappingMetaData> servletMappingsMD)
+ {
+ final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
+
+ servletMappingMD.setServletName(servletName);
+ servletMappingMD.setUrlPatterns(urlPatterns);
+ servletMappingsMD.add(servletMappingMD);
+
+ return servletMappingMD;
+ }
+
+ /**
+ * Creates new authentication constraint and associates it with security constraint
meta data.
+ *
+ * @param roleNames roles
+ * @param securityConstraintMD security constraint meta data
+ * @return new authentication constraint meta data
+ */
+ public static AuthConstraintMetaData newAuthConstraint(final List<String>
roleNames,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
+
+ authConstraintMD.setRoleNames(roleNames);
+ securityConstraintMD.setAuthConstraint(authConstraintMD);
+
+ return authConstraintMD;
+ }
+
+ /**
+ * Creates new user constraint meta data and associates it with security constraint
meta data.
+ *
+ * @param transportGuarantee transport guarantee value
+ * @param securityConstraintMD security constraint meta data
+ * @return new user data constraint meta data
+ */
+ public static UserDataConstraintMetaData newUserDataConstraint(final String
transportGuarantee,
+ final SecurityConstraintMetaData securityConstraintMD)
+ {
+ final UserDataConstraintMetaData userDataConstraintMD = new
UserDataConstraintMetaData();
+ final TransportGuaranteeType transportGuaranteeValue =
TransportGuaranteeType.valueOf(transportGuarantee);
+
+ userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
+ securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
+
+ return userDataConstraintMD;
+ }
+
+ /**
+ * Creates new parameter meta data and associates it with parameters meta data.
+ *
+ * @param key parameter key
+ * @param value parameter value
+ * @param paramsMD parameters meta data
+ * @return new parameter meta data
+ */
+ public static ParamValueMetaData newParamValue(final String key, final String value,
final List<ParamValueMetaData> paramsMD)
+ {
+ final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key,
value);
+
+ paramsMD.add(paramValueMD);
+
+ return paramValueMD;
+ }
+
+ /**
+ * Creates new parameter with specified key and value.
+ *
+ * @param key the key
+ * @param value the value
+ * @return new parameter
+ */
+ private static ParamValueMetaData newParamValue(final String key, final String value)
+ {
+ final ParamValueMetaData paramMD = new ParamValueMetaData();
+
+ paramMD.setParamName(key);
+ paramMD.setParamValue(value);
+
+ return paramMD;
+ }
+
+}
Modified:
container/jboss50/branches/jbossws-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss50/branches/jbossws-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
03:31:04 UTC (rev 10747)
+++
container/jboss50/branches/jbossws-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-09-23
10:42:05 UTC (rev 10748)
@@ -12,6 +12,15 @@
<property name="mbeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
</bean>
+ <!-- Endpoint API http server -->
+ <bean name="WSHTTPServer"
class="org.jboss.webservices.integration.endpoint.EndpointAPIHttpServer">
+ <constructor>
+ <parameter>
+ <inject bean="MainDeployer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
<!-- An abstraction of server configuration aspects. -->
<bean name="WSServerConfig"
class="org.jboss.webservices.integration.config.ServerConfigImpl">
<property name="mbeanServer"><inject
bean="WSMBeanServerLocator"
property="mbeanServer"/></property>