Author: richard.opalka(a)jboss.com
Date: 2011-09-12 04:38:24 -0400 (Mon, 12 Sep 2011)
New Revision: 14975
Added:
container/jboss70/branches/jbossws-jboss700/pom.xml
container/jboss70/branches/jbossws-jboss700/src/
container/jboss70/branches/jbossws-jboss700/src/main/
container/jboss70/branches/jbossws-jboss700/src/main/java/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigFactoryImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/AspectDeploymentProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/EndpointServiceDeploymentAspect.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/SecurityActions.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/TCCLDeploymentProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDependenciesProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDescriptorDeploymentProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSEJBIntegrationProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSJMSIntegrationProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSModelDeploymentProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSTypeDeploymentProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WebServiceContextResourceProcessor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/AbstractDeploymentModelBuilder.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilder.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_EJB21.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_JSE.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB3.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_JSE.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSDeploymentBuilder.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSVirtualFileFilter.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Constants.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Element.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigAdd.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigRemove.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/ModelDeploymentAspect.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Namespace.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/SecurityActions.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSDeploymentActivator.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointAdd.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointMetrics.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointRemove.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemDescribe.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemProviders.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WebservicesSubsystemParser.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/injection/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/injection/WebServiceContextInjectionSource.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerEJB3.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerFactoryImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyFactoryImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/ContainerMetaDataDeploymentAspect.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderEJB3.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderJSE.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/PublishLocationAdapterImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeclaration.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeployment.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/parser/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/parser/WSDeploymentAspectParser.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorFactoryImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityDomainContextAdaptor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointRegistryService.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointService.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/SecurityActions.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/ServerConfigService.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB21.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB3.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/ServletDelegateFactoryImpl.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreatingDeploymentAspect.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifier.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifyingDeploymentAspect.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ASHelper.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ModuleClassLoaderProvider.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSServices.java
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WebMetaDataHelper.java
container/jboss70/branches/jbossws-jboss700/src/main/resources/
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.ServletDelegateFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.ioc.IoCContainerProxyFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/stack-agnostic-deployment-aspects.xml
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/dmr/
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/dmr/LocalDescriptions.properties
Log:
create new AS700 ASIL customization
Added: container/jboss70/branches/jbossws-jboss700/pom.xml
===================================================================
--- container/jboss70/branches/jbossws-jboss700/pom.xml (rev 0)
+++ container/jboss70/branches/jbossws-jboss700/pom.xml 2011-09-12 08:38:24 UTC (rev
14975)
@@ -0,0 +1,86 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Container JBoss-7.0.0.Final</name>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-jboss700</artifactId>
+ <description>JBossWS Container integration for JBoss AS
7.0.0.Final</description>
+
+ <version>4.0.0-SNAPSHOT</version>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-parent</artifactId>
+ <version>1.0.10-SNAPSHOT</version>
+ </parent>
+
+ <!-- Source Control Management -->
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/container/jb...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/contai...
+
<
url>http://fisheye.jboss.com/viewrep/JBossWS/container/jboss70/branche...
+ </scm>
+
+ <!-- Properties -->
+ <properties>
+ <jbossws.api.version>1.0.0.Beta1</jbossws.api.version>
+ <jbossws.spi.version>2.0.0.Beta5</jbossws.spi.version>
+ <jbossws.common.version>2.0.0.Beta4</jbossws.common.version>
+ <jboss.msc.version>1.0.0.GA</jboss.msc.version>
+ <jboss.version>7.0.0.Final</jboss.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-api</artifactId>
+ <version>${jbossws.api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-spi</artifactId>
+ <version>${jbossws.spi.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common</artifactId>
+ <version>${jbossws.common.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.msc</groupId>
+ <artifactId>jboss-msc</artifactId>
+ <version>${jboss.msc.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${jboss.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-ee</artifactId>
+ <version>${jboss.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-ejb3</artifactId>
+ <version>${jboss.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-web</artifactId>
+ <version>${jboss.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigFactoryImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigFactoryImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigFactoryImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.config;
+
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.ioc.IoCContainerProxy;
+import org.jboss.wsf.spi.ioc.IoCContainerProxyFactory;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+
+/**
+ * Retrieves webservices stack specific config.
+ *
+ * @author <a href="mailto:hbraun@redhat.com">Heiko Braun</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class ServerConfigFactoryImpl extends ServerConfigFactory {
+ /**
+ * Constructor.
+ */
+ public ServerConfigFactoryImpl() {
+ super();
+ }
+
+ /**
+ * Returns config registered in MC kernel.
+ *
+ * @return config
+ */
+ public ServerConfig getServerConfig() {
+ final ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ final SPIProvider spiProvider =
SPIProviderResolver.getInstance(cl).getProvider();
+ final IoCContainerProxyFactory iocContainerFactory =
spiProvider.getSPI(IoCContainerProxyFactory.class, cl);
+ final IoCContainerProxy iocContainer = iocContainerFactory.getContainer();
+
+ // TODO review IoCContainer spi to avoid conversion to/from String/Service
+ return iocContainer.getBean(WSServices.CONFIG_SERVICE.getCanonicalName(),
ServerConfig.class);
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.config;
+
+import java.io.File;
+
+import javax.management.MBeanServer;
+
+import org.jboss.as.server.ServerEnvironment;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.ws.common.management.AbstractServerConfigMBean;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+
+/**
+ * AS specific ServerConfig.
+ *
+ * @author <a href="mailto:asoldano@redhat.com">Alessio
Soldano</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class ServerConfigImpl extends AbstractServerConfig implements
AbstractServerConfigMBean {
+
+ private static final ServerConfigImpl INSTANCE = new ServerConfigImpl();
+
+ private final InjectedValue<MBeanServer> injectedMBeanServer = new
InjectedValue<MBeanServer>();
+ private final InjectedValue<ServerEnvironment> injectedServerEnvironment = new
InjectedValue<ServerEnvironment>();
+
+ /**
+ * Constructor.
+ */
+ private ServerConfigImpl() {
+ // forbidden inheritance
+ }
+
+ /**
+ * Gets server temp directory.
+ *
+ * @return temp directory
+ */
+ public File getServerTempDir() {
+ return getServerEnvironment().getServerTempDir();
+ }
+
+ /**
+ * Gets server home directory.
+ *
+ * @return home directory
+ */
+ public File getHomeDir() {
+ return getServerEnvironment().getHomeDir();
+ }
+
+ /**
+ * Gets server data directory.
+ *
+ * @return data directory
+ */
+ public File getServerDataDir() {
+ return getServerEnvironment().getServerDataDir();
+ }
+
+ @Override
+ public MBeanServer getMbeanServer() {
+ return injectedMBeanServer.getValue();
+ }
+
+ @Override
+ public void setMbeanServer(final MBeanServer mbeanServer) {
+ throw new RuntimeException(
+ this.getClass()
+ + " does not support setting MBeanServer instance; the value
should have already been automatically injected");
+ }
+
+ public InjectedValue<MBeanServer> getMBeanServerInjector() {
+ return injectedMBeanServer;
+ }
+
+ public InjectedValue<ServerEnvironment> getServerEnvironmentInjector() {
+ return injectedServerEnvironment;
+ }
+
+ private ServerEnvironment getServerEnvironment() {
+ return injectedServerEnvironment.getValue();
+ }
+
+ public static ServerConfigImpl getInstance() {
+ return INSTANCE;
+ }
+
+
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/AspectDeploymentProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/AspectDeploymentProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/AspectDeploymentProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+/**
+ * Adaptor of DeploymentAspect to DeploymentUnitProcessor
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ * @since 17-Jan-2011
+ */
+public final class AspectDeploymentProcessor extends TCCLDeploymentProcessor implements
DeploymentUnitProcessor {
+
+ private static Logger log = Logger.getLogger(AspectDeploymentProcessor.class);
+
+ private Class<? extends DeploymentAspect> clazz;
+ private String aspectClass;
+ private DeploymentAspect aspect;
+
+ public AspectDeploymentProcessor(Class<? extends DeploymentAspect> aspectClass)
{
+ this.clazz = aspectClass;
+ }
+
+ public AspectDeploymentProcessor(String aspectClass) {
+ this.aspectClass = aspectClass;
+ }
+
+ public AspectDeploymentProcessor(DeploymentAspect aspect) {
+ this.aspect = aspect;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void internalDeploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ if (ASHelper.isWebServiceDeployment(unit)) {
+ if (aspect == null) {
+ try {
+ if (clazz == null) {
+ clazz = (Class<? extends DeploymentAspect>)
SecurityActions.getContextClassLoader().loadClass(aspectClass);
+ }
+ aspect = clazz.newInstance();
+ } catch (Exception e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+ log.debug(this.aspect + " start: " + unit.getName());
+ final Deployment dep = ASHelper.getRequiredAttachment(unit,
WSAttachmentKeys.DEPLOYMENT_KEY);
+ dep.addAttachment(DeploymentPhaseContext.class, phaseContext);
+ aspect.start(dep);
+ dep.removeAttachment(DeploymentPhaseContext.class);
+ }
+ }
+
+ @Override
+ public void internalUndeploy(org.jboss.as.server.deployment.DeploymentUnit context)
{
+ if (ASHelper.isWebServiceDeployment(context)) {
+ log.debug(this.aspect + " stop: " + context.getName());
+ final Deployment dep = ASHelper.getRequiredAttachment(context,
WSAttachmentKeys.DEPLOYMENT_KEY);
+ aspect.stop(dep);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/EndpointServiceDeploymentAspect.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/EndpointServiceDeploymentAspect.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/EndpointServiceDeploymentAspect.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.webservices.service.EndpointService;
+import org.jboss.msc.service.ServiceTarget;
+import org.jboss.ws.common.deployment.EndpointLifecycleDeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Creates Endpoint Service instance when starting the Endpoint
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-May-2011
+ */
+public final class EndpointServiceDeploymentAspect extends
EndpointLifecycleDeploymentAspect {
+
+ @Override
+ public void start(Deployment dep) {
+ super.start(dep);
+ final DeploymentPhaseContext context =
dep.getAttachment(DeploymentPhaseContext.class);
+ final ServiceTarget target = context.getServiceTarget();
+ for (Endpoint ep : dep.getService().getEndpoints()) {
+ EndpointService.install(target, ep);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/SecurityActions.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/SecurityActions.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/SecurityActions.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Security actions helper.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 17-Feb-2010
+ */
+class SecurityActions {
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ return Thread.currentThread().getContextClassLoader();
+ } else {
+ return AccessController.doPrivileged(new
PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader) {
+ if (System.getSecurityManager() == null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/TCCLDeploymentProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/TCCLDeploymentProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/TCCLDeploymentProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+
+/**
+ * A DUP that sets the context classloader
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 14-Jan-2011
+ */
+public abstract class TCCLDeploymentProcessor implements DeploymentUnitProcessor {
+
+ public final void deploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
+ try {
+
SecurityActions.setContextClassLoader(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
+ internalDeploy(phaseContext);
+ } finally {
+ SecurityActions.setContextClassLoader(origClassLoader);
+ }
+ }
+
+ public final void undeploy(final DeploymentUnit context) {
+ ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
+ try {
+
SecurityActions.setContextClassLoader(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
+ internalUndeploy(context);
+ } finally {
+ SecurityActions.setContextClassLoader(origClassLoader);
+ }
+ }
+
+ public abstract void internalDeploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException;
+
+ public abstract void internalUndeploy(final DeploymentUnit context);
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDependenciesProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDependenciesProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDependenciesProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.deployers;
+
+//import static org.jboss.as.webservices.util.WSAttachmentKeys.DEPLOYMENT_TYPE_KEY;
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.server.deployment.module.ModuleDependency;
+import org.jboss.as.server.deployment.module.ModuleSpecification;
+import org.jboss.logging.Logger;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
+
+/**
+ * A DUP that sets the dependencies required for using WS classes in WS deployments
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class WSDependenciesProcessor implements DeploymentUnitProcessor {
+
+ private static final Logger LOGGER =
Logger.getLogger(WSDependenciesProcessor.class);
+ public static final ModuleIdentifier JBOSSWS_API =
ModuleIdentifier.create("org.jboss.ws.api");
+ public static final ModuleIdentifier JBOSSWS_SPI =
ModuleIdentifier.create("org.jboss.ws.spi");
+
+ public void deploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ final ModuleLoader moduleLoader = Module.getBootModuleLoader();
+ final ModuleSpecification moduleSpec =
unit.getAttachment(Attachments.MODULE_SPECIFICATION);
+ moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, JBOSSWS_API,
false, true, true));
+ moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, JBOSSWS_SPI,
false, true, true));
+ }
+
+ public void undeploy(final DeploymentUnit context) {
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDescriptorDeploymentProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDescriptorDeploymentProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSDescriptorDeploymentProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.as.webservices.util.VirtualFileAdaptor;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * DUP for parsing webservices.xml (JSR-109)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 12-Jan-2011
+ */
+public class WSDescriptorDeploymentProcessor implements DeploymentUnitProcessor {
+
+ public void deploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ final ResourceRoot deploymentRoot =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ UnifiedVirtualFile uvf = new VirtualFileAdaptor(deploymentRoot.getRoot());
+ WebservicesMetaData wsmd = WebservicesFactory.loadFromVFSRoot(uvf);
+ if (wsmd != null) {
+ deploymentUnit.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY,
wsmd);
+ }
+ }
+
+ public void undeploy(final DeploymentUnit context) {
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSEJBIntegrationProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSEJBIntegrationProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSEJBIntegrationProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import static org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION;
+import static org.jboss.as.webservices.util.WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.as.ee.component.ComponentDescription;
+import org.jboss.as.ee.component.EEModuleDescription;
+import org.jboss.as.ejb3.component.EJBViewDescription;
+import org.jboss.as.ejb3.component.session.SessionBeanComponentDescription;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationTarget;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.as.webservices.metadata.WebServiceDeclaration;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+
+/**
+ * WebServiceDeployment deployer processes EJB containers and its metadata and creates WS
adapters wrapping it.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class WSEJBIntegrationProcessor implements DeploymentUnitProcessor {
+
+ @Override
+ public void deploy(final DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ final WebServiceDeployment wsDeploymentAdapter = new
WebServiceDeploymentAdapter();
+ processAnnotation(unit, ASHelper.WEB_SERVICE_ANNOTATION, wsDeploymentAdapter);
+ processAnnotation(unit, ASHelper.WEB_SERVICE_PROVIDER_ANNOTATION,
wsDeploymentAdapter);
+ if (!wsDeploymentAdapter.getServiceEndpoints().isEmpty()) {
+ unit.putAttachment(WEBSERVICE_DEPLOYMENT_KEY, wsDeploymentAdapter);
+ }
+ }
+
+ @Override
+ public void undeploy(final DeploymentUnit context) {
+ // NOOP
+ }
+
+ private static void processAnnotation(final DeploymentUnit unit, final DotName
annotation, final WebServiceDeployment wsDeployment) {
+ final List<AnnotationInstance> webServiceAnnotations =
ASHelper.getAnnotations(unit, annotation);
+ final List<WebServiceDeclaration> endpoints =
wsDeployment.getServiceEndpoints();
+ final EEModuleDescription moduleDescription =
unit.getAttachment(EE_MODULE_DESCRIPTION);
+
+ for (final AnnotationInstance webServiceAnnotation : webServiceAnnotations) {
+ final AnnotationTarget target = webServiceAnnotation.target();
+ final ClassInfo webServiceClassInfo = (ClassInfo) target;
+ final String beanClassName = webServiceClassInfo.name().toString();
+
+ final List<ComponentDescription> componentDescriptions =
moduleDescription.getComponentsByClassName(beanClassName);
+
+ final List<SessionBeanComponentDescription> sessionBeans =
getSessionBeans(componentDescriptions);
+ for(SessionBeanComponentDescription sessionBean : sessionBeans) {
+ if (sessionBean.isStateless() || sessionBean.isSingleton()) {
+ final EJBViewDescription ejbViewDescription =
sessionBean.addWebserviceEndpointView();
+ final String ejbViewName =
ejbViewDescription.getServiceName().getCanonicalName();
+ endpoints.add(new WebServiceDeclarationAdapter(sessionBean,
webServiceClassInfo, ejbViewName));
+ }
+ }
+ }
+ }
+
+ private static List<SessionBeanComponentDescription> getSessionBeans(final
List<ComponentDescription> componentDescriptions) {
+ final List<SessionBeanComponentDescription> beans = new
ArrayList<SessionBeanComponentDescription>(1);
+ for(ComponentDescription componentDescription : componentDescriptions) {
+ if (componentDescription instanceof SessionBeanComponentDescription) {
+ beans.add((SessionBeanComponentDescription)componentDescription);
+ }
+ }
+ return beans;
+ }
+
+ /**
+ * Adopts EJB3 bean meta data to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration}.
+ */
+ private static final class WebServiceDeclarationAdapter implements
WebServiceDeclaration {
+
+ /** EJB meta data. */
+ private final SessionBeanComponentDescription ejbMD;
+ private final ClassInfo webServiceClassInfo; // TODO: propagate just annotations?
+ private final String containerName;
+
+ /**
+ * Constructor.
+ *
+ * @param ejbMD EJB metadata
+ */
+ private WebServiceDeclarationAdapter(final SessionBeanComponentDescription ejbMD,
final ClassInfo webServiceClassInfo, final String containerName) {
+ this.ejbMD = ejbMD;
+ this.webServiceClassInfo = webServiceClassInfo;
+ this.containerName = containerName;
+ }
+
+ /**
+ * Returns EJB container name.
+ *
+ * @return container name
+ */
+ public String getContainerName() {
+ return containerName;
+ }
+
+ /**
+ * Returns EJB name.
+ *
+ * @return name
+ */
+ public String getComponentName() {
+ return ejbMD.getComponentName();
+ }
+
+ /**
+ * Returns EJB class name.
+ *
+ * @return class name
+ */
+ public String getComponentClassName() {
+ return ejbMD.getComponentClassName();
+ }
+
+ /**
+ * Returns requested annotation associated with EJB container or EJB bean.
+ *
+ * @param annotationType annotation type
+ * @param <T> annotation class type
+ * @return requested annotation or null if not found
+ */
+ public AnnotationInstance getAnnotation(final DotName annotationType) {// DotName
+ List<AnnotationInstance> list =
webServiceClassInfo.annotations().get(annotationType);
+ if (list != null) {
+ return list.get(0);
+ }
+ return null;
+// throw new UnsupportedOperationException(); // TODO: implement
+// final boolean haveEjbContainer = this.ejbContainer != null;
+//
+// if (haveEjbContainer)
+// {
+// return this.ejbContainer.getAnnotation(annotationType);
+// }
+// else
+// {
+// final Class<?> bean = this.getComponentClass();
+// return (T) bean.getAnnotation(annotationType);
+// }
+ }
+
+ }
+
+ /**
+ * Adopts an EJB deployment to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeployment}.
+ */
+ private static final class WebServiceDeploymentAdapter implements WebServiceDeployment
{
+ /** List of EJB endpoints. */
+ private final List<WebServiceDeclaration> endpoints = new
ArrayList<WebServiceDeclaration>();
+
+ /**
+ * Constructor.
+ */
+ private WebServiceDeploymentAdapter() {
+ super();
+ }
+
+ /**
+ * Returns endpoints list.
+ *
+ * @return endpoints list
+ */
+ public List<WebServiceDeclaration> getServiceEndpoints() {
+ return this.endpoints;
+ }
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSJMSIntegrationProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSJMSIntegrationProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSJMSIntegrationProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import static org.jboss.as.webservices.util.WSAttachmentKeys.JMS_ENDPOINT_METADATA_KEY;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.VirtualFileAdaptor;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationValue;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.deployment.SOAPAddressWSDLParser;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+
+/**
+ * DUP for detecting JMS WS endpoints
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+public final class WSJMSIntegrationProcessor implements DeploymentUnitProcessor {
+
+ private static Logger LOG = Logger.getLogger(WSJMSIntegrationProcessor.class);
+ private static final String WSDL_LOCATION = "wsdlLocation";
+ private static final String PORT_NAME = "portName";
+ private static final String SERVICE_NAME = "serviceName";
+ private static final String TARGET_NAMESPACE = "targetNamespace";
+
+ @Override
+ public void deploy(final DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ final List<AnnotationInstance> webServiceAnnotations =
ASHelper.getAnnotations(unit, ASHelper.WEB_SERVICE_ANNOTATION);
+
+ //group @WebService annotations in the deployment by wsdl contract location
+ Map<String, List<AnnotationInstance>> map = new HashMap<String,
List<AnnotationInstance>>();
+ for (AnnotationInstance webServiceAnnotation : webServiceAnnotations) {
+ final AnnotationValue wsdlLocation =
webServiceAnnotation.value(WSDL_LOCATION);
+ final AnnotationValue port = webServiceAnnotation.value(PORT_NAME);
+ final AnnotationValue service = webServiceAnnotation.value(SERVICE_NAME);
+ //support for contract-first development only: pick-up @WebService
annotations referencing a provided wsdl contract only
+ if (wsdlLocation != null && port != null && service != null)
{
+ String key = wsdlLocation.asString();
+ List<AnnotationInstance> annotations = map.get(key);
+ if (annotations == null) {
+ annotations = new LinkedList<AnnotationInstance>();
+ map.put(key, annotations);
+ }
+ annotations.add(webServiceAnnotation);
+ }
+ }
+
+ //extract SOAP-over-JMS 1.0 bindings
+ if (!map.isEmpty()) {
+ final JMSEndpointsMetaData endpointsMetaData = new JMSEndpointsMetaData();
+ final ResourceRoot deploymentRoot =
unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final UnifiedVirtualFile uvf = new
VirtualFileAdaptor(deploymentRoot.getRoot());
+
+ final boolean trace = LOG.isTraceEnabled();
+ for (String wsdlLocation : map.keySet()) {
+ if (trace) {
+ LOG.tracef("Scanning wsdlLocation: %s", wsdlLocation);
+ }
+ try {
+ URL url = uvf.findChild(wsdlLocation).toURL();
+ SOAPAddressWSDLParser parser = new SOAPAddressWSDLParser(url);
+ for (AnnotationInstance ai : map.get(wsdlLocation)) {
+ String port = ai.value(PORT_NAME).asString();
+ String service = ai.value(SERVICE_NAME).asString();
+ AnnotationValue targetNS = ai.value(TARGET_NAMESPACE);
+ String tns = targetNS != null ? targetNS.asString() : null;
+ QName serviceName = new QName(tns, service);
+ QName portName = new QName(tns, port);
+ if (trace) {
+ LOG.tracef(" serviceName: %s", serviceName);
+ LOG.tracef(" portName: %s", portName);
+ }
+ String soapAddress = parser.filterSoapAddress(serviceName,
portName, SOAPAddressWSDLParser.SOAP_OVER_JMS_NS);
+ if (soapAddress != null) {
+ ClassInfo webServiceClassInfo = (ClassInfo) ai.target();
+ String beanClassName =
webServiceClassInfo.name().toString();
+ //service name ?
+ JMSEndpointMetaData endpointMetaData = new
JMSEndpointMetaData(endpointsMetaData);
+ endpointMetaData.setEndpointName(port);
+ endpointMetaData.setImplementor(beanClassName);
+ //endpointMetaData.setName(name);
+ endpointMetaData.setSoapAddress(soapAddress);
+ endpointMetaData.setWsdlLocation(wsdlLocation);
+ endpointsMetaData.addEndpointMetaData(endpointMetaData);
+ }
+ }
+ } catch (Exception e) {
+ if (trace) {
+ LOG.warnf("Could not read WSDL at '%s'",
wsdlLocation, e);
+ } else {
+ LOG.warnf("Could not read WSDL at '%s'",
wsdlLocation);
+ }
+ }
+ }
+
+ if (!endpointsMetaData.getEndpointsMetaData().isEmpty()) {
+ unit.putAttachment(JMS_ENDPOINT_METADATA_KEY, endpointsMetaData);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(final DeploymentUnit context) {
+ // NOOP
+ }
+}
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSModelDeploymentProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSModelDeploymentProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSModelDeploymentProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.webservices.deployers.deployment.WSDeploymentBuilder;
+import org.jboss.as.webservices.util.ASHelper;
+
+/**
+ * This deployer initializes JBossWS deployment meta data.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+public final class WSModelDeploymentProcessor extends TCCLDeploymentProcessor implements
DeploymentUnitProcessor {
+
+ @Override
+ public void internalDeploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ if (ASHelper.isWebServiceDeployment(unit)) {
+ //create new Web Service deployment and register it with deployment unit
+ WSDeploymentBuilder.getInstance().build(unit);
+ }
+ }
+
+ @Override
+ public void internalUndeploy(org.jboss.as.server.deployment.DeploymentUnit context)
{
+ //NOOP
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSTypeDeploymentProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSTypeDeploymentProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WSTypeDeploymentProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.web.deployment.WarMetaData;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+
+/**
+ * Detects Web Service deployment type.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+public final class WSTypeDeploymentProcessor implements DeploymentUnitProcessor {
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ final DeploymentUnit unit = phaseContext.getDeploymentUnit();
+ if (this.isJaxwsJseDeployment(unit)) {
+ unit.putAttachment(WSAttachmentKeys.DEPLOYMENT_TYPE_KEY,
DeploymentType.JAXWS_JSE);
+ } else if (this.isJaxwsEjbDeployment(unit)) {
+ unit.putAttachment(WSAttachmentKeys.DEPLOYMENT_TYPE_KEY,
DeploymentType.JAXWS_EJB3);
+ } else if (this.isJaxrpcJseDeployment(unit)) {
+ unit.putAttachment(WSAttachmentKeys.DEPLOYMENT_TYPE_KEY,
DeploymentType.JAXRPC_JSE);
+ } else if (this.isJaxrpcEjbDeployment(unit)) {
+ unit.putAttachment(WSAttachmentKeys.DEPLOYMENT_TYPE_KEY,
DeploymentType.JAXRPC_EJB21);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit context) {
+ //NOOP
+ }
+
+ /**
+ * Returns true if JAXRPC EJB deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC EJB, false otherwise
+ */
+ private boolean isJaxrpcEjbDeployment(final DeploymentUnit unit) {
+ //TODO
+// final boolean hasWebservicesMD = ASHelper.hasAttachment(unit,
AttachmentKeys.WEBSERVICES_METADATA_KEY);
+// final boolean hasJBossMD = unit.getAllMetaData(JBossMetaData.class).size() >
0;
+//
+// return hasWebservicesMD && hasJBossMD;
+ return false;
+ }
+
+ /**
+ * Returns true if JAXRPC JSE deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC JSE, false otherwise
+ */
+ private boolean isJaxrpcJseDeployment(final DeploymentUnit unit) {
+ final boolean hasWebservicesMD = ASHelper.hasAttachment(unit,
WSAttachmentKeys.WEBSERVICES_METADATA_KEY);
+ final boolean hasJBossWebMD = ASHelper.getJBossWebMetaData(unit) != null;
+
+ if (hasWebservicesMD && hasJBossWebMD) {
+ return ASHelper.getJaxrpcServlets(unit).size() > 0;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns true if JAXWS EJB deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS EJB, false otherwise
+ */
+ private boolean isJaxwsEjbDeployment(final DeploymentUnit unit) {
+ return ASHelper.hasAttachment(unit, WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY);
+ }
+
+ /**
+ * Returns true if JAXWS JSE deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS JSE, false otherwise
+ */
+ private boolean isJaxwsJseDeployment(final DeploymentUnit unit) {
+ final boolean hasWarMetaData = ASHelper.hasAttachment(unit,
WarMetaData.ATTACHMENT_KEY);
+ if (hasWarMetaData) {
+ //once the deployment is a WAR, the endpoint(s) can be on either http
(servlet) transport or jms transport
+ return ASHelper.getJaxwsServlets(unit).size() > 0 ||
ASHelper.hasAttachment(unit, WSAttachmentKeys.JMS_ENDPOINT_METADATA_KEY);
+ } else {
+ //otherwise the (JAR) deployment can be a jaxws_jse one if there're jms
transport endpoints only (no ejb3)
+ return !ASHelper.hasAttachment(unit,
WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY) &&
+ ASHelper.hasAttachment(unit,
WSAttachmentKeys.JMS_ENDPOINT_METADATA_KEY);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WebServiceContextResourceProcessor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WebServiceContextResourceProcessor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/WebServiceContextResourceProcessor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.deployers;
+
+import org.jboss.as.ee.component.EEModuleClassDescription;
+import org.jboss.as.ee.component.EEModuleDescription;
+import org.jboss.as.ee.component.EEResourceReferenceProcessor;
+import org.jboss.as.ee.component.InjectionSource;
+import org.jboss.as.ee.component.InjectionTarget;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.webservices.injection.WebServiceContextInjectionSource;
+import org.jboss.logging.Logger;
+
+import javax.xml.ws.WebServiceContext;
+
+/**
+ * Processes {@link javax.annotation.Resource @Resource} and {@link
javax.annotation.Resources @Resources} annotations
+ * for a {@link WebServiceContext} type resource
+ * <p/>
+ * User : Jaikiran Pai
+ */
+public class WebServiceContextResourceProcessor implements EEResourceReferenceProcessor
{
+
+ private static final Logger logger =
Logger.getLogger(WebServiceContextResourceProcessor.class);
+
+ @Override
+ public String getResourceReferenceType() {
+ return WebServiceContext.class.getName();
+ }
+
+ @Override
+ public InjectionSource getResourceReferenceBindingSource(final DeploymentPhaseContext
phaseContext, final EEModuleDescription eeModuleDescription,
+ final
EEModuleClassDescription classDescription, final String resourceReferenceType,
+ final String
localContextName, final InjectionTarget injectionTarget) throws
DeploymentUnitProcessingException {
+ logger.debug("Processing @Resource of type: " +
WebServiceContext.class.getName() + " for ENC name: " + localContextName);
+ // webservice context binding source
+ final InjectionSource bindingSource = new WebServiceContextInjectionSource();
+ return bindingSource;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/AbstractDeploymentModelBuilder.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/AbstractDeploymentModelBuilder.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/AbstractDeploymentModelBuilder.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,236 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers.deployment;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.as.webservices.util.VirtualFileAdaptor;
+import org.jboss.logging.Logger;
+import org.jboss.modules.Module;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+
+/**
+ * Base class for all deployment model builders.
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+abstract class AbstractDeploymentModelBuilder implements DeploymentModelBuilder {
+ /** WSDL, XSD and XML files filter. */
+ private static final WSVirtualFileFilter WS_FILE_FILTER = new WSVirtualFileFilter();
+
+ /** Logger. */
+ protected final Logger log = Logger.getLogger(this.getClass());
+
+ /** Deployment model factory. */
+ private final DeploymentModelFactory deploymentModelFactory;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractDeploymentModelBuilder() {
+ super();
+
+ // deployment factory
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ this.deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.deployers.deployment.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
+ *
+ * @param unit deployment unit
+ */
+ public final void newDeploymentModel(final DeploymentUnit unit) {
+ final ArchiveDeployment dep;
+ try {
+ dep = this.newDeployment(unit);
+ } catch (DeploymentUnitProcessingException e) {
+ throw new RuntimeException(e);
+ }
+
+ this.build(dep, unit);
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.putAttachment(WSAttachmentKeys.DEPLOYMENT_KEY, dep);
+ }
+
+ /**
+ * Template method for subclasses to implement.
+ *
+ * @param dep webservice deployment
+ * @param unit deployment unit
+ */
+ protected abstract void build(Deployment dep, DeploymentUnit unit);
+
+ /**
+ * Creates new Http Web Service endpoint.
+ *
+ * @param endpointClass endpoint class name
+ * @param endpointName endpoint name
+ * @param dep deployment
+ * @return WS endpoint
+ */
+ protected final Endpoint newHttpEndpoint(final String endpointClass, final String
endpointName, final Deployment dep) {
+ if (endpointName == null) {
+ throw new NullPointerException("Null endpoint name");
+ }
+
+ if (endpointClass == null) {
+ throw new NullPointerException("Null endpoint class");
+ }
+
+ final Endpoint endpoint =
this.deploymentModelFactory.newHttpEndpoint(endpointClass);
+ endpoint.setShortName(endpointName);
+ dep.getService().addEndpoint(endpoint);
+
+ return endpoint;
+ }
+
+ /**
+ * Creates new JMS Web Service endpoint.
+ *
+ * @param endpointClass endpoint class name
+ * @param endpointName endpoint name
+ * @param dep deployment
+ * @return WS endpoint
+ */
+ protected final Endpoint newJMSEndpoint(final String endpointClass, final String
endpointName, final String soapAddress, final Deployment dep) {
+ if (endpointName == null) {
+ throw new NullPointerException("Null endpoint name");
+ }
+
+ if (endpointClass == null) {
+ throw new NullPointerException("Null endpoint class");
+ }
+
+ final Endpoint endpoint =
this.deploymentModelFactory.newJMSEndpoint(endpointClass);
+ endpoint.setAddress(soapAddress);
+ endpoint.setShortName(endpointName);
+ dep.getService().addEndpoint(endpoint);
+
+ return endpoint;
+ }
+
+ /**
+ * Creates new Web Service deployment.
+ *
+ * @param unit deployment unit
+ * @return archive deployment
+ */
+ private ArchiveDeployment newDeployment(final DeploymentUnit unit) throws
DeploymentUnitProcessingException {
+ this.log.debug("Creating new WS deployment model for: " + unit);
+ final ResourceRoot deploymentRoot =
unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final VirtualFile root = deploymentRoot.getRoot();
+ final Module module = unit.getAttachment(Attachments.MODULE);
+ if (module == null) {
+ throw new DeploymentUnitProcessingException("failed to resolve module
for deployment " + deploymentRoot);
+ }
+ final ClassLoader classLoader = module.getClassLoader();
+ final ArchiveDeployment dep = this.newDeployment(unit.getName(), classLoader);
+
+ try {
+ List<VirtualFile> virtualFiles =
root.getChildrenRecursively(WS_FILE_FILTER);
+ final Set<UnifiedVirtualFile> uVirtualFiles = new
HashSet<UnifiedVirtualFile>();
+ for (VirtualFile vf : virtualFiles) {
+ // Adding the roots of the virtual files.
+ uVirtualFiles.add(new VirtualFileAdaptor(vf));
+ }
+ dep.setMetadataFiles(new
LinkedList<UnifiedVirtualFile>(uVirtualFiles));
+ } catch (IOException e) {
+ this.log.warn("Could not load metadata files for deployment root "
+ root, e);
+ }
+
+ if (unit.getParent() != null) {
+ final String parentDeploymentName = unit.getParent().getName();
+ final Module parentModule =
unit.getParent().getAttachment(Attachments.MODULE);
+ if (parentModule == null) {
+ throw new DeploymentUnitProcessingException("failed to resolve
module for parent of deployment "
+ + deploymentRoot);
+ }
+ final ClassLoader parentClassLoader = parentModule.getClassLoader();
+
+ this.log.debug("Creating new WS deployment model for parent: " +
unit.getParent());
+ final ArchiveDeployment parentDep = this.newDeployment(parentDeploymentName,
parentClassLoader);
+ dep.setParent(parentDep);
+ }
+
+ dep.setRootFile(new VirtualFileAdaptor(root));
+ dep.setRuntimeClassLoader(classLoader);
+ final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit,
WSAttachmentKeys.DEPLOYMENT_TYPE_KEY);
+ dep.setType(deploymentType);
+
+ return dep;
+ }
+
+ /**
+ * Creates new archive deployment.
+ *
+ * @param name deployment name
+ * @param loader deployment loader
+ * @return new archive deployment
+ */
+ private ArchiveDeployment newDeployment(final String name, final ClassLoader loader)
{
+ return (ArchiveDeployment) this.deploymentModelFactory.newDeployment(name,
loader);
+ }
+
+ /**
+ * 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
+ * @param dep deployment
+ * @return attachment value if found in unit
+ */
+ protected final <A> A getAndPropagateAttachment(final AttachmentKey<A>
attachment, final Class<?> attachmentClass, final DeploymentUnit unit, final
Deployment dep) {
+ final A attachmentValue = ASHelper.getOptionalAttachment(unit, attachment);
+
+ if (attachmentValue != null) {
+ dep.addAttachment(attachmentClass, attachmentValue); // TODO: eliminate
attachmentClass parameter - investigate how ...
+ return attachmentValue;
+ }
+
+ throw new IllegalStateException("Deployment unit does not contain " +
attachment);
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilder.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilder.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilder.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers.deployment;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+
+/**
+ * Deployment builder interface.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+interface DeploymentModelBuilder {
+ /**
+ * Creates Web Service deployment model and associates it with deployment.
+ *
+ * @param unit deployment unit
+ */
+ void newDeploymentModel(DeploymentUnit unit);
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_EJB21.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_EJB21.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_EJB21.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,69 @@
+/*
+ * 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.as.webservices.deployers.deployment;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Creates new JAXRPC EJB21 deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class DeploymentModelBuilderJAXRPC_EJB21 extends AbstractDeploymentModelBuilder {
+ /**
+ * Constructor.
+ */
+ DeploymentModelBuilderJAXRPC_EJB21() {
+ super();
+ }
+
+ /**
+ * Creates new JAXRPC EJB21 deployment and registers it with deployment unit.
+ *
+ * @param dep webservice deployment
+ * @param unit deployment unit
+ */
+ @Override
+ protected void build(final Deployment dep, final DeploymentUnit unit) {
+// final JBossMetaData jbmd = this.getAndPropagateAttachment(JBossMetaData.class,
unit, dep);
+// final WebservicesMetaData wsMetaData =
this.getAndPropagateAttachment(WebservicesMetaData.class, unit, dep);
+// this.getAndPropagateAttachment(WebServiceDeployment.class, unit, dep);
+//
+// this.log.debug("Creating JAXRPC EJB21 endpoints meta data model");
+// for (final WebserviceDescriptionMetaData webserviceDescriptionMD :
wsMetaData.getWebserviceDescriptions()) {
+// for (final PortComponentMetaData portComponentMD :
webserviceDescriptionMD.getPortComponents()) {
+// final String ejbName = portComponentMD.getEjbLink();
+// this.log.debug("EJB21 name: " + ejbName);
+// final JBossEnterpriseBeanMetaData beanMetaData =
jbmd.getEnterpriseBean(ejbName);
+// final String ejbClass = beanMetaData.getEjbClass();
+// this.log.debug("EJB21 class: " + ejbClass);
+//
+// this.newHttpEndpoint(ejbClass, ejbName, dep);
+// }
+// }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_JSE.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_JSE.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXRPC_JSE.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,77 @@
+/*
+ * 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.as.webservices.deployers.deployment;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Creates new JAXRPC JSE deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class DeploymentModelBuilderJAXRPC_JSE extends AbstractDeploymentModelBuilder {
+ /**
+ * Constructor.
+ */
+ DeploymentModelBuilderJAXRPC_JSE() {
+ super();
+ }
+
+ /**
+ * Creates new JAXRPC JSE deployment and registers it with deployment unit.
+ *
+ * @param dep webservice deployment
+ * @param unit deployment unit
+ */
+ @Override
+ protected void build(final Deployment dep, final DeploymentUnit unit) {
+ final JBossWebMetaData webMetaData = ASHelper.getJBossWebMetaData(unit);
+ if (webMetaData != null) {
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+ }
+ final WebservicesMetaData wsMetaData = ASHelper.getOptionalAttachment(unit,
WSAttachmentKeys.WEBSERVICES_METADATA_KEY);
+ if (wsMetaData != null) {
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ }
+
+ this.log.debug("Creating JAXRPC JSE endpoints meta data model");
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
{
+ for (PortComponentMetaData pcmd : wsd.getPortComponents()) {
+ final String servletName = pcmd.getServletLink();
+ this.log.debug("JSE name: " + servletName);
+ final ServletMetaData servletMD = ASHelper.getServletForName(webMetaData,
servletName);
+ final String servletClass = ASHelper.getEndpointName(servletMD);
+ this.log.debug("JSE class: " + servletClass);
+
+ this.newHttpEndpoint(servletClass, servletName, dep);
+ }
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB3.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB3.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB3.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,68 @@
+/*
+ * 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.as.webservices.deployers.deployment;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+//import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.as.webservices.metadata.WebServiceDeclaration;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+
+/**
+ * Creates new JAXWS EJB3 deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class DeploymentModelBuilderJAXWS_EJB3 extends AbstractDeploymentModelBuilder {
+ /**
+ * Constructor.
+ */
+ DeploymentModelBuilderJAXWS_EJB3() {
+ super();
+ }
+
+ /**
+ * Creates new JAXWS EJB3 deployment and registers it with deployment unit.
+ *
+ * @param dep webservice deployment
+ * @param unit deployment unit
+ */
+ @Override
+ protected void build(final Deployment dep, final DeploymentUnit unit) {
+ this.getAndPropagateAttachment(WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY,
WebServiceDeployment.class, unit, dep);
+ //this.getAndPropagateAttachment(JBossMetaData.class, unit, dep); // TODO:
propagate?
+
+ this.log.debug("Creating JAXWS EJB3 endpoints meta data model");
+ for (final WebServiceDeclaration container : ASHelper.getJaxwsEjbs(unit)) {
+ final String ejbName = container.getComponentName();
+ this.log.debug("EJB3 name: " + ejbName);
+ final String ejbClass = container.getComponentClassName();
+ this.log.debug("EJB3 class: " + ejbClass);
+
+ final Endpoint ep = this.newHttpEndpoint(ejbClass, ejbName, dep);
+ ep.setProperty(ASHelper.CONTAINER_NAME, container.getContainerName());
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_JSE.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_JSE.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_JSE.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers.deployment;
+
+import java.util.List;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+
+/**
+ * Creates new JAXWS JSE deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class DeploymentModelBuilderJAXWS_JSE extends AbstractDeploymentModelBuilder {
+ /**
+ * Constructor.
+ */
+ DeploymentModelBuilderJAXWS_JSE() {
+ super();
+ }
+
+ /**
+ * Creates new JAXWS JSE deployment and registers it with deployment unit.
+ *
+ * @param dep webservice deployment
+ * @param unit deployment unit
+ */
+ @Override
+ protected void build(final Deployment dep, final DeploymentUnit unit) {
+ this.log.debug("Creating JAXWS JSE endpoints meta data model");
+ final JBossWebMetaData webMetaData = ASHelper.getJBossWebMetaData(unit);
+ if (webMetaData != null) {
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+ final List<ServletMetaData> servlets =
ASHelper.getJaxwsServlets(unit);
+ for (ServletMetaData servlet : servlets) {
+ final String servletName = servlet.getName();
+ this.log.debug("JSE name: " + servletName);
+ final String servletClass = ASHelper.getEndpointName(servlet);
+ this.log.debug("JSE class: " + servletClass);
+
+ this.newHttpEndpoint(servletClass, servletName, dep);
+ }
+ }
+
+ final JMSEndpointsMetaData jmsEndpointsMD = ASHelper.getOptionalAttachment(unit,
WSAttachmentKeys.JMS_ENDPOINT_METADATA_KEY);
+ if (jmsEndpointsMD != null) {
+ dep.addAttachment(JMSEndpointsMetaData.class, jmsEndpointsMD);
+ for (JMSEndpointMetaData endpoint : jmsEndpointsMD.getEndpointsMetaData()) {
+ if (endpoint.getName() == null) {
+ endpoint.setName(endpoint.getImplementor());
+ }
+ this.newJMSEndpoint(endpoint.getImplementor(), endpoint.getName(),
endpoint.getSoapAddress(), dep);
+ }
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSDeploymentBuilder.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSDeploymentBuilder.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSDeploymentBuilder.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers.deployment;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+
+/**
+ * JBossWS deployment model builder.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class WSDeploymentBuilder {
+ /** Builder instance. */
+ private static final WSDeploymentBuilder SINGLETON = new WSDeploymentBuilder();
+
+ /** Builders registry. */
+ private static final Map<DeploymentType, DeploymentModelBuilder> builders = new
HashMap<DeploymentType, DeploymentModelBuilder>();;
+
+ static {
+ WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_JSE, new
DeploymentModelBuilderJAXWS_JSE());
+ WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_JSE, new
DeploymentModelBuilderJAXRPC_JSE());
+ WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_EJB3, new
DeploymentModelBuilderJAXWS_EJB3());
+ WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_EJB21, new
DeploymentModelBuilderJAXRPC_EJB21());
+ }
+
+ /**
+ * Constructor.
+ */
+ private WSDeploymentBuilder() {
+ super();
+ }
+
+ /**
+ * Factory method for obtaining builder instance.
+ *
+ * @return builder instance
+ */
+ public static WSDeploymentBuilder getInstance() {
+ return WSDeploymentBuilder.SINGLETON;
+ }
+
+ /**
+ * Builds JBossWS deployment model if web service deployment is detected.
+ *
+ * @param unit deployment unit
+ */
+ public void build(final DeploymentUnit unit) {
+ final DeploymentType deploymentType = ASHelper.getOptionalAttachment(unit,
WSAttachmentKeys.DEPLOYMENT_TYPE_KEY);
+
+ if (deploymentType != null) {
+ WSDeploymentBuilder.builders.get(deploymentType).newDeploymentModel(unit);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSVirtualFileFilter.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSVirtualFileFilter.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/deployers/deployment/WSVirtualFileFilter.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.deployers.deployment;
+
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilterWithAttributes;
+import org.jboss.vfs.VisitorAttributes;
+
+/**
+ * WS file filter for files with the '.wsdl', or '.xsd' or '.xml'
suffix.
+ *
+ * @author <a href="mailto:dbevenius@jboss.com">Daniel
Bevenius</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSVirtualFileFilter implements VirtualFileFilterWithAttributes {
+ /** The tree walking attributes. */
+ private VisitorAttributes attributes;
+
+ /**
+ * Constructor.
+ */
+ WSVirtualFileFilter() {
+ this(VisitorAttributes.RECURSE_LEAVES_ONLY);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param attributes visit attributes
+ */
+ WSVirtualFileFilter(final VisitorAttributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * Gets VisitorAttributes for this instance.
+ *
+ * @return visitor attributes
+ */
+ public VisitorAttributes getAttributes() {
+ return this.attributes;
+ }
+
+ /**
+ * Accepts files that end with '.wsdl' or '.xsd' or '.xml'.
+ *
+ * @param file to analyze
+ * @return true if expected file extension, false otherwise
+ */
+ public boolean accepts(final VirtualFile file) {
+ if (file == null) {
+ return false;
+ }
+
+ final String fileName = file.getLowerCaseName();
+ final boolean hasWsdlSuffix = fileName.endsWith(".wsdl");
+ final boolean hasXsdSuffix = fileName.endsWith(".xsd");
+ final boolean hasXmlSuffix = fileName.endsWith(".xml");
+
+ return hasWsdlSuffix || hasXsdSuffix || hasXmlSuffix;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Constants.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Constants.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Constants.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+/**
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran
Lofthouse</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class Constants {
+ private Constants() {
+ // forbidden inheritance
+ }
+ public static final String MODIFY_WSDL_ADDRESS = "modify-wsdl-address";
+ public static final String WSDL_HOST = "wsdl-host";
+ public static final String WSDL_PORT = "wsdl-port";
+ public static final String WSDL_SECURE_PORT = "wsdl-secure-port";
+ public static final String ENDPOINT = "endpoint";
+ public static final String ENDPOINT_NAME = "name";
+ public static final String ENDPOINT_CONTEXT = "context";
+ public static final String ENDPOINT_CLASS = "class";
+ public static final String ENDPOINT_TYPE = "type";
+ public static final String ENDPOINT_WSDL = "wsdl-url";
+ public static final String ENDPOINT_CONFIG = "endpoint-config";
+ public static final String CONFIG_NAME = "config-name";
+ public static final String PROPERTY="property";
+ public static final String PROPERTY_NAME="property-name";
+ public static final String PROPERTY_VALUE="property-value";
+ public static final String FEATURE="feature";
+ public static final String FEATURE_NAME="feature-name";
+ public static final String FEATURE_DATA="feature-data";
+ public static final String PRE_HANDLER_CHAINS="pre-handler-chains";
+ public static final String POST_HANDLER_CHAINS="post-handler-chains";
+ public static final String HANDLER_CHAIN="handler-chain";
+ public static final String PROTOCOL_BINDING="protocol-bindings";
+ public static final String SERVICE_NAME_PATTERN="service-name-pattern";
+ public static final String PORT_NAME_PATTERN="port-name-pattern";
+ public static final String HANDLER="handler";
+ public static final String HANDLER_NAME="handler-name";
+ public static final String HANDLER_CLASS="handler-class";
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Element.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Element.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Element.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.dmr;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * WS configuration elements.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+enum Element {
+
+ /** always the first **/
+ UNKNOWN(null),
+ SUBSYSTEM("subsystem"),
+ MODIFY_WSDL_ADDRESS(Constants.MODIFY_WSDL_ADDRESS),
+ WSDL_HOST(Constants.WSDL_HOST),
+ WSDL_PORT(Constants.WSDL_PORT),
+ WSDL_SECURE_PORT(Constants.WSDL_SECURE_PORT),
+ ENDPOINT_CONFIG(Constants.ENDPOINT_CONFIG),
+ CONFIG_NAME(Constants.CONFIG_NAME),
+ PROPERTY(Constants.PROPERTY),
+ PROPERTY_NAME(Constants.PROPERTY_NAME),
+ PROPERTY_VALUE(Constants.PROPERTY_VALUE),
+ FEATURE(Constants.FEATURE),
+ FEATURE_NAME(Constants.FEATURE_NAME),
+ FEATURE_DATA(Constants.FEATURE_DATA),
+ PRE_HANDLER_CHAINS(Constants.PRE_HANDLER_CHAINS),
+ POST_HANDLER_CHAINS(Constants.POST_HANDLER_CHAINS),
+ HANDLER_CHAIN(Constants.HANDLER_CHAIN),
+ PROTOCOL_BINDING(Constants.PROTOCOL_BINDING),
+ SERVICE_NAME_PATTERN(Constants.SERVICE_NAME_PATTERN),
+ PORT_NAME_PATTERN(Constants.PORT_NAME_PATTERN),
+ HANDLER(Constants.HANDLER),
+ HANDLER_NAME(Constants.HANDLER_NAME),
+ HANDLER_CLASS(Constants.HANDLER_CLASS);
+
+ private final String name;
+
+ private Element(final String name) {
+ this.name = name;
+ }
+
+ private static final Map<String, Element> MAP;
+
+ static {
+ final Map<String, Element> map = new HashMap<String, Element>();
+ for (final Element element : values()) {
+ final String name = element.getLocalName();
+ if (name != null)
+ map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ static Element forName(final String localName) {
+ final Element element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ String getLocalName() {
+ return name;
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigAdd.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigAdd.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigAdd.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+import org.jboss.wsf.spi.metadata.config.Feature;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+
+/**
+ * OperationHandler to add an endpoint configuration to {@link
org.jboss.as.webservices.service.ServerConfigService ServerConfigService}
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class EndpointConfigAdd extends AbstractAddStepHandler {
+
+ static final EndpointConfigAdd INSTANCE = new EndpointConfigAdd();
+
+ @Override
+ protected void populateModel(ModelNode operation, ModelNode model) throws
OperationFailedException {
+
+ if (operation.hasDefined(Constants.PRE_HANDLER_CHAINS)) {
+ ModelNode preHandlers = operation.get(Constants.PRE_HANDLER_CHAINS);
+ model.get(Constants.PRE_HANDLER_CHAINS).set(preHandlers);
+ }
+
+ if (operation.hasDefined(Constants.POST_HANDLER_CHAINS)) {
+ ModelNode postHandlers = operation.get(Constants.POST_HANDLER_CHAINS);
+ model.get(Constants.POST_HANDLER_CHAINS).set(postHandlers);
+ }
+
+ if (operation.hasDefined(Constants.PROPERTY)) {
+ ModelNode property = operation.get(Constants.PROPERTY);
+ model.get(Constants.PROPERTY).set(property);
+ }
+ if (operation.hasDefined(Constants.FEATURE)) {
+ ModelNode feature = operation.get(Constants.FEATURE);
+ model.get(Constants.FEATURE).set(feature);
+ }
+ }
+
+ @Override
+ protected void performRuntime(OperationContext context, ModelNode operation,
ModelNode model,
+ ServiceVerificationHandler verificationHandler,
+ List<ServiceController<?>> newControllers)
throws OperationFailedException {
+
+ ServiceController<?> configService =
context.getServiceRegistry(true).getService(WSServices.CONFIG_SERVICE);
+ if (configService != null) {
+
+ final PathAddress address =
PathAddress.pathAddress(operation.require(OP_ADDR));
+ final String name = address.getLastElement().getValue();
+
+ ServerConfig config = (ServerConfig) configService.getValue();
+ EndpointConfig endpointConfig = new EndpointConfig();
+ endpointConfig.setConfigName(name);
+ if (model.hasDefined(Constants.PRE_HANDLER_CHAINS)) {
+ ModelNode preHandlers = model.get(Constants.PRE_HANDLER_CHAINS);
+ endpointConfig.setPreHandlerChains(buildChainMD(preHandlers));
+ }
+ if (model.hasDefined(Constants.POST_HANDLER_CHAINS)) {
+ ModelNode postHandlers = model.get(Constants.POST_HANDLER_CHAINS);
+ endpointConfig.setPostHandlerChains(buildChainMD(postHandlers));
+ }
+
+ if (model.hasDefined(Constants.PROPERTY)) {
+ for (String key : model.get(Constants.PROPERTY).keys()) {
+ endpointConfig.setProperty(key,
model.get(Constants.PROPERTY).get(key).asString());
+ }
+ }
+ if (model.hasDefined(Constants.FEATURE)) {
+ for (String key : model.get(Constants.FEATURE).keys()) {
+ endpointConfig.setFeature(new Feature(key), true);
+ }
+ }
+ config.addEndpointConfig(endpointConfig);
+ }
+ }
+
+
+ private List<UnifiedHandlerChainMetaData> buildChainMD(ModelNode
handlerChainsNode) {
+ List<UnifiedHandlerChainMetaData> handlerChains = new
ArrayList<UnifiedHandlerChainMetaData>();
+ if (handlerChainsNode.getType() == ModelType.LIST) {
+ for (ModelNode chainNode : handlerChainsNode.asList()) {
+ UnifiedHandlerChainMetaData chainMetaData = new
UnifiedHandlerChainMetaData();
+ if (chainNode.hasDefined(Constants.PROTOCOL_BINDING)) {
+
chainMetaData.setProtocolBindings(chainNode.get(Constants.PROTOCOL_BINDING).asString());
+ }
+ if (chainNode.hasDefined(Constants.SERVICE_NAME_PATTERN)) {
+ chainMetaData.setServiceNamePattern(new
QName(chainNode.get(Constants.SERVICE_NAME_PATTERN).asString()));
+ }
+ if (chainNode.hasDefined(Constants.PORT_NAME_PATTERN)) {
+ chainMetaData.setPortNamePattern(new
QName(chainNode.get(Constants.PORT_NAME_PATTERN).asString()));
+ }
+ if (chainNode.hasDefined(Constants.HANDLER)) {
+ for (String key : chainNode.get(Constants.HANDLER).keys()) {
+ UnifiedHandlerMetaData handlerMD = new UnifiedHandlerMetaData();
+ handlerMD.setHandlerName(key);
+
handlerMD.setHandlerClass(chainNode.get(Constants.HANDLER).get(key).asString());
+ chainMetaData.addHandler(handlerMD);
+ }
+
+ }
+ handlerChains.add(chainMetaData);
+ }
+ }
+ return handlerChains;
+
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigRemove.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigRemove.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/EndpointConfigRemove.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
+import org.jboss.as.controller.AbstractRemoveStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.dmr.ModelNode;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+
+/**
+ * OperationHandler to remove the endpoint configuration
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class EndpointConfigRemove extends AbstractRemoveStepHandler {
+
+ static final EndpointConfigRemove INSTANCE = new EndpointConfigRemove();
+
+ @Override
+ protected void performRemove(OperationContext context, ModelNode operation, ModelNode
model) throws OperationFailedException {
+
+ ServiceController<?> configService =
context.getServiceRegistry(true).getService(WSServices.CONFIG_SERVICE);
+ if (configService != null) {
+
+ final PathAddress address =
PathAddress.pathAddress(operation.require(OP_ADDR));
+ final String name = address.getLastElement().getValue();
+
+ ServerConfig config = (ServerConfig) configService.getValue();
+ EndpointConfig target = null;
+ for (EndpointConfig epConfig : config.getEndpointConfigs()) {
+ if (epConfig.getConfigName().equals(name)) {
+ target = epConfig;
+ }
+ }
+ if (target != null) {
+ config.getEndpointConfigs().remove(target);
+ }
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/ModelDeploymentAspect.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/ModelDeploymentAspect.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/ModelDeploymentAspect.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CLASS;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONTEXT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_NAME;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_TYPE;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_WSDL;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.dmr.ModelNode;
+import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Deployment aspect that modifies DMR WS endpoint model.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class ModelDeploymentAspect extends AbstractDeploymentAspect {
+
+ public ModelDeploymentAspect() {
+ super();
+ }
+
+ @Override
+ public void start(final Deployment dep) {
+ final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ for (final Endpoint endpoint : dep.getService().getEndpoints()) {
+
+ ModelNode op = null;
+ try {
+ op = unit.createDeploymentSubModel(WSExtension.SUBSYSTEM_NAME,
+ PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint),
"UTF-8")));
+ } catch (final UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+
+ op.get(ENDPOINT_NAME).set(getName(endpoint));
+ op.get(ENDPOINT_CONTEXT).set(getContext(endpoint));
+ op.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName());
+ op.get(ENDPOINT_TYPE).set(getType(endpoint));
+ op.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl");
+ }
+ }
+
+ @Override
+ public void stop(final Deployment dep) {
+ //
+ }
+
+ private String getType(final Endpoint endpoint) {
+ return endpoint.getService().getDeployment().getType().toString();
+ }
+
+ private String getName(final Endpoint endpoint) {
+ return endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ }
+
+ private String getContext(final Endpoint endpoint) {
+ return endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ }
+
+ private String getId(final Endpoint endpoint) {
+ final StringBuilder sb = new StringBuilder();
+ sb.append(getContext(endpoint));
+ sb.append(':');
+ sb.append(getName(endpoint));
+ return sb.toString();
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Namespace.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Namespace.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/Namespace.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.dmr;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+enum Namespace {
+
+ // must be first
+ UNKNOWN(null),
+
+ WEBSERVICES_1_0("urn:jboss:domain:webservices:1.0"),
+
+
JAVAEE("http://java.sun.com/xml/ns/javaee"),
+
+ JAXWSCONFIG("urn:jboss:jbossws-jaxws-config:4.0");
+
+ /**
+ * The current namespace version.
+ */
+ static final Namespace CURRENT = WEBSERVICES_1_0;
+
+ private final String name;
+
+ private Namespace(final String name) {
+ this.name = name;
+ }
+
+ private static final Map<String, Namespace> MAP;
+
+ static {
+ final Map<String, Namespace> map = new HashMap<String, Namespace>();
+ for (final Namespace namespace : values()) {
+ final String name = namespace.getUriString();
+ if (name != null)
+ map.put(name, namespace);
+ }
+ MAP = map;
+ }
+
+ static Namespace forUri(final String uri) {
+ final Namespace element = MAP.get(uri);
+ return element == null ? UNKNOWN : element;
+ }
+
+ /**
+ * Get the URI of this namespace.
+ *
+ * @return the URI
+ */
+ String getUriString() {
+ return name;
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/SecurityActions.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/SecurityActions.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/SecurityActions.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.dmr;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Security actions helper.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class SecurityActions {
+
+ private SecurityActions() {
+ // forbidden inheritance
+ }
+
+ /**
+ * Gets context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader() {
+ if (System.getSecurityManager() == null) {
+ return Thread.currentThread().getContextClassLoader();
+ } else {
+ return AccessController.doPrivileged(new
PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Sets context classloader.
+ *
+ * @param classLoader
+ * the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader) {
+ if (System.getSecurityManager() == null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSDeploymentActivator.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSDeploymentActivator.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSDeploymentActivator.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import org.jboss.as.ee.component.EEResourceReferenceProcessorRegistry;
+import org.jboss.as.server.DeploymentProcessorTarget;
+import org.jboss.as.server.deployment.Phase;
+import org.jboss.as.webservices.deployers.AspectDeploymentProcessor;
+import org.jboss.as.webservices.deployers.WSDependenciesProcessor;
+import org.jboss.as.webservices.deployers.WSDescriptorDeploymentProcessor;
+import org.jboss.as.webservices.deployers.WSEJBIntegrationProcessor;
+import org.jboss.as.webservices.deployers.WSJMSIntegrationProcessor;
+import org.jboss.as.webservices.deployers.WSModelDeploymentProcessor;
+import org.jboss.as.webservices.deployers.WSTypeDeploymentProcessor;
+import org.jboss.as.webservices.deployers.WebServiceContextResourceProcessor;
+import org.jboss.as.webservices.parser.WSDeploymentAspectParser;
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.sort.DeploymentAspectSorter;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSDeploymentActivator {
+
+ private static final Logger LOGGER = Logger.getLogger(WSDeploymentActivator.class);
+
+ static void activate(final DeploymentProcessorTarget processorTarget) {
+
+ processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEBSERVICES_XML,
new WSDescriptorDeploymentProcessor());
+ processorTarget.addDeploymentProcessor(Phase.PARSE,
Phase.PARSE_WS_EJB_INTEGRATION, new WSEJBIntegrationProcessor());
+ processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WS,
new WSDependenciesProcessor());
+ processorTarget.addDeploymentProcessor(Phase.POST_MODULE,
Phase.POST_MODULE_WS_JMS_INTEGRATION, new WSJMSIntegrationProcessor());
+ //processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES,
Phase.DEPENDENCIES_JAXRPC, new WSJAXRPCDependenciesDeploymentProcessor());
+ processorTarget.addDeploymentProcessor(Phase.INSTALL,
Phase.INSTALL_WS_DEPLOYMENT_TYPE_DETECTOR, new WSTypeDeploymentProcessor());
+ processorTarget.addDeploymentProcessor(Phase.INSTALL,
Phase.INSTALL_WS_UNIVERSAL_META_DATA_MODEL, new WSModelDeploymentProcessor());
+
+ addDeploymentProcessors(processorTarget, Phase.INSTALL,
Phase.INSTALL_WS_DEPLOYMENT_ASPECTS);
+
+ // Add a EEResourceReferenceProcessor which handles @Resource references of type
WebServiceContext.
+ // Note that we do it here instead of a DUP because the @Resource reference
processor for WebServiceContext *isn't*
+ // per DU
+ EEResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(new
WebServiceContextResourceProcessor());
+ }
+
+ private static List<DeploymentAspect> getDeploymentAspects(final ClassLoader
cl, final String resourcePath)
+ {
+ try {
+ Enumeration<URL> urls =
WSDeploymentActivator.class.getClassLoader().getResources(resourcePath);
+ if (urls != null) {
+ URL url = urls.nextElement();
+ InputStream is = null;
+ try {
+ is = url.openStream();
+ return WSDeploymentAspectParser.parse(is, cl);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+ }
+ else {
+ throw new RuntimeException("Could not load WS deployment aspects
from " + resourcePath);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Could not load WS deployment aspects from
" + resourcePath, e);
+ }
+ }
+
+ private static void addDeploymentProcessors(final DeploymentProcessorTarget
processorTarget, final Phase phase, final int priority) {
+ int index = 1;
+ for (final DeploymentAspect da : getSortedDeploymentAspects()) {
+ LOGGER.tracef("Installing aspect %s", da.getClass().getName());
+ processorTarget.addDeploymentProcessor(phase, priority + index++, new
AspectDeploymentProcessor(da));
+ }
+ }
+
+ private static List<DeploymentAspect> getSortedDeploymentAspects() {
+ final List<DeploymentAspect> deploymentAspects = new
LinkedList<DeploymentAspect>();
+ ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ deploymentAspects.addAll(getDeploymentAspects(cl,
"/META-INF/stack-agnostic-deployment-aspects.xml"));
+ deploymentAspects.addAll(getDeploymentAspects(cl,
"/META-INF/stack-specific-deployment-aspects.xml"));
+ return DeploymentAspectSorter.getInstance().sort(deploymentAspects);
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointAdd.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointAdd.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointAdd.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.PathAddress;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CLASS;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONTEXT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_NAME;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_TYPE;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_WSDL;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Registers WS endpoint into webservices subsystem model.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSEndpointAdd extends AbstractAddStepHandler {
+
+ static final WSEndpointAdd INSTANCE = new WSEndpointAdd();
+
+ private WSEndpointAdd() {
+ // forbidden instantiation
+ }
+
+ protected void populateModel(ModelNode operation, ModelNode model) {
+ final ModelNode opAddr = operation.require(OP_ADDR);
+ final PathAddress address = PathAddress.pathAddress(opAddr);
+ final String name = address.getLastElement().getValue();
+
+ // Get operation parameters
+ final String endpointName = operation.require(ENDPOINT_NAME).asString();
+ final String endpointContext = operation.require(ENDPOINT_CONTEXT).asString();
+ final String endpointClass = operation.require(ENDPOINT_CLASS).asString();
+ final String endpointType = operation.require(ENDPOINT_TYPE).asString();
+ final String endpointWSDL = operation.require(ENDPOINT_WSDL).asString();
+
+ model.get(NAME).set(name);
+ model.get(ENDPOINT_NAME).set(endpointName);
+ model.get(ENDPOINT_CONTEXT).set(endpointContext);
+ model.get(ENDPOINT_CLASS).set(endpointClass);
+ model.get(ENDPOINT_TYPE).set(endpointType);
+ model.get(ENDPOINT_WSDL).set(endpointWSDL);
+ }
+
+ protected boolean requiresRuntime(OperationContext context) {
+ return false;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointMetrics.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointMetrics.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointMetrics.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationStepHandler;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.dmr.ModelNode;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+
+/**
+ * Provides WS endpoint metrics.
+ *
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSEndpointMetrics implements OperationStepHandler {
+
+ static final WSEndpointMetrics INSTANCE = new WSEndpointMetrics();
+ static final String[] ATTRIBUTES;
+
+ private static final String FALLBACK_MESSAGE = "No metrics available";
+
+ static final String MIN_PROCESSING_TIME = "min-processing-time";
+ static final String MAX_PROCESSING_TIME = "max-processing-time";
+ static final String AVERAGE_PROCESSING_TIME = "average-processing-time";
+ static final String TOTAL_PROCESSING_TIME = "total-processing-time";
+ static final String REQUEST_COUNT = "request-count";
+ static final String RESPONSE_COUNT = "response-count";
+ static final String FAULT_COUNT = "fault-count";
+
+ static {
+ ATTRIBUTES = new String[] {
+ MIN_PROCESSING_TIME, MAX_PROCESSING_TIME, AVERAGE_PROCESSING_TIME,
+ TOTAL_PROCESSING_TIME, REQUEST_COUNT, RESPONSE_COUNT, FAULT_COUNT
+ };
+ }
+
+ private WSEndpointMetrics() {
+ // forbidden instantiation
+ }
+
+ /** {@inheritDoc} */
+ public void execute(OperationContext context, ModelNode operation) throws
OperationFailedException {
+ if (context.getType() == OperationContext.Type.SERVER) {
+ context.addStep(new OperationStepHandler() {
+ public void execute(OperationContext context, ModelNode operation) throws
OperationFailedException {
+ final ServiceController<?> controller =
context.getServiceRegistry(false).getService(WSServices.REGISTRY_SERVICE);
+ if (controller != null) {
+ try {
+ context.getResult().set(getEndpointMetricsFragment(operation,
controller));
+ } catch (Exception e) {
+ throw new OperationFailedException(new
ModelNode().set(getFallbackMessage() + ": " + e.getMessage()));
+ }
+ } else {
+ context.getResult().set(getFallbackMessage());
+ }
+ context.completeStep();
+ }
+ }, OperationContext.Stage.RUNTIME);
+ } else {
+ context.getResult().set(getFallbackMessage());
+ }
+ context.completeStep();
+ }
+
+ private ModelNode getEndpointMetricsFragment(final ModelNode operation, final
ServiceController<?> controller) throws OperationFailedException {
+ final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
+ String endpointId = null;
+ try {
+ endpointId = URLDecoder.decode(address.getLastElement().getValue(),
"UTF-8");
+ } catch (final UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ final String metricName = operation.require(NAME).asString();
+ final String webContext = endpointId.substring(0,
endpointId.indexOf(":"));
+ final String endpointName =
endpointId.substring(endpointId.indexOf(":") + 1);
+ ObjectName endpointObjectName = null;
+ try {
+ endpointObjectName = new ObjectName("jboss.ws:context=" +
webContext + ",endpoint=" + endpointName);
+ } catch (final MalformedObjectNameException e) {
+ throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+ }
+
+ final EndpointRegistry registry = (EndpointRegistry) controller.getValue();
+ final Endpoint endpoint = registry.getEndpoint(endpointObjectName);
+
+ final ModelNode result = new ModelNode();
+ if (endpoint != null && endpoint.getEndpointMetrics() != null) {
+ final EndpointMetrics endpointMetrics = endpoint.getEndpointMetrics();
+ if (MIN_PROCESSING_TIME.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getMinProcessingTime()));
+ } else if (MAX_PROCESSING_TIME.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getMaxProcessingTime()));
+ } else if (AVERAGE_PROCESSING_TIME.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getTotalProcessingTime()));
+ } else if (TOTAL_PROCESSING_TIME.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getTotalProcessingTime()));
+ } else if (REQUEST_COUNT.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getRequestCount()));
+ } else if (RESPONSE_COUNT.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getResponseCount()));
+ } else if (FAULT_COUNT.equals(metricName)) {
+ result.set(String.valueOf(endpointMetrics.getFaultCount()));
+ }
+ } else {
+ result.set(getFallbackMessage());
+ }
+
+ return result;
+ }
+
+ private static String getFallbackMessage() {
+ return FALLBACK_MESSAGE;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointRemove.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointRemove.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSEndpointRemove.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import org.jboss.as.controller.AbstractRemoveStepHandler;
+
+/**
+ * Removes WS endpoint from webservices subsystem model.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSEndpointRemove extends AbstractRemoveStepHandler {
+
+ static final WSEndpointRemove INSTANCE = new WSEndpointRemove();
+
+ private WSEndpointRemove() {
+ // forbidden instantiation
+ }
+
+ /*
+ * if (context.getRuntimeContext() != null) {
+ * context.getRuntimeContext().setRuntimeTask(new RuntimeTask() { public
+ * void execute(RuntimeTaskContext context) throws
+ * OperationFailedException { final ServiceController<?> controller =
+ * context.getServiceRegistry()
+ * .getService(ThreadsServices.threadFactoryName(name)); if (controller
+ * != null) { controller.setMode(ServiceController.Mode.REMOVE); }
+ * resultHandler.handleResultComplete(); } }); } else {
+ * resultHandler.handleResultComplete(); }
+ */
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static org.jboss.as.controller.registry.OperationEntry.EntryType.PRIVATE;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONFIG;
+
+import org.jboss.as.controller.Extension;
+import org.jboss.as.controller.ExtensionContext;
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.controller.SubsystemRegistration;
+import org.jboss.as.controller.parsing.ExtensionParsingContext;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+import org.jboss.dmr.ModelNode;
+import org.jboss.logging.Logger;
+
+import java.util.Locale;
+
+/**
+ * The webservices extension.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran
Lofthouse</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public final class WSExtension implements Extension {
+
+ private static final Logger log =
Logger.getLogger("org.jboss.as.webservices");
+
+ public static final String SUBSYSTEM_NAME = "webservices";
+
+ @Override
+ public void initialize(ExtensionContext context) {
+ log.debugf("Activating WebServices Extension");
+ final SubsystemRegistration subsystem =
context.registerSubsystem(SUBSYSTEM_NAME);
+ subsystem.registerXMLElementWriter(WebservicesSubsystemParser.getInstance());
+ // ws subsystem
+ final ManagementResourceRegistration registration =
subsystem.registerSubsystemModel(WSSubsystemProviders.SUBSYSTEM);
+ registration.registerOperationHandler(ADD, WSSubsystemAdd.INSTANCE,
WSSubsystemProviders.SUBSYSTEM_ADD, false);
+ registration.registerOperationHandler(DESCRIBE, WSSubsystemDescribe.INSTANCE,
WSSubsystemProviders.SUBSYSTEM_DESCRIBE, false, PRIVATE);
+ // ws endpont configuration
+ final ManagementResourceRegistration epConfigs =
registration.registerSubModel(PathElement.pathElement(ENDPOINT_CONFIG),
WSSubsystemProviders.ENDPOINTCONFIG_DESCRIPTION);
+ epConfigs.registerOperationHandler(ADD, EndpointConfigAdd.INSTANCE,
WSSubsystemProviders.ENDPOINTCONFIG_ADD_DESCRIPTION, false);
+ epConfigs.registerOperationHandler(REMOVE, EndpointConfigRemove.INSTANCE,
WSSubsystemProviders.ENDPOINTCONFIG_REMOVE_DESCRIPTION, false);
+
+
+ final ManagementResourceRegistration deployments =
subsystem.registerDeploymentModel(new DescriptionProvider() {
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ return new ModelNode();
+ }
+ });
+ // ws endpoint children
+ final ManagementResourceRegistration endpoints =
deployments.registerSubModel(PathElement.pathElement(ENDPOINT),
WSSubsystemProviders.ENDPOINT_DESCRIPTION);
+ for (final String attributeName : WSEndpointMetrics.ATTRIBUTES) {
+ endpoints.registerMetric(attributeName, WSEndpointMetrics.INSTANCE);
+ }
+ }
+
+ @Override
+ public void initializeParsers(ExtensionParsingContext context) {
+ context.setSubsystemXmlMapping(Namespace.CURRENT.getUriString(),
WebservicesSubsystemParser.getInstance());
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONFIG;
+import static org.jboss.as.webservices.dmr.Constants.MODIFY_WSDL_ADDRESS;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
+
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.jboss.as.controller.AbstractBoottimeAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.operations.validation.ModelTypeValidator;
+import org.jboss.as.controller.operations.validation.ParametersValidator;
+import org.jboss.as.server.AbstractDeploymentChainStep;
+import org.jboss.as.server.DeploymentProcessorTarget;
+import org.jboss.as.server.deployment.Phase;
+import org.jboss.as.webservices.config.ServerConfigImpl;
+import org.jboss.as.webservices.service.EndpointRegistryService;
+import org.jboss.as.webservices.service.ServerConfigService;
+import org.jboss.as.webservices.util.ModuleClassLoaderProvider;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.logging.Logger;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceTarget;
+
+/**
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran
Lofthouse</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class WSSubsystemAdd extends AbstractBoottimeAddStepHandler {
+ private static final Logger log =
Logger.getLogger("org.jboss.as.webservices");
+
+ static final WSSubsystemAdd INSTANCE = new WSSubsystemAdd();
+
+ private final ParametersValidator configValidator = new ParametersValidator();
+
+ // Private to ensure a singleton.
+ private WSSubsystemAdd() {
+ configValidator.registerValidator(WSDL_HOST, new
ModelTypeValidator(ModelType.STRING));
+ configValidator.registerValidator(MODIFY_WSDL_ADDRESS, new
ModelTypeValidator(ModelType.BOOLEAN));
+ configValidator.registerValidator(WSDL_PORT, new
ModelTypeValidator(ModelType.INT, true, true));
+ configValidator.registerValidator(WSDL_SECURE_PORT, new
ModelTypeValidator(ModelType.INT, true, true));
+ }
+
+ protected void populateModel(final ModelNode operation, final ModelNode submodel)
throws OperationFailedException {
+ configValidator.validate(operation);
+
+ submodel.get(MODIFY_WSDL_ADDRESS).set(operation.require(MODIFY_WSDL_ADDRESS));
+ submodel.get(WSDL_HOST).set(operation.require(WSDL_HOST));
+ if (operation.has(WSDL_PORT)) {
+ submodel.get(WSDL_PORT).set(operation.require(WSDL_PORT));
+ }
+ if (operation.has(WSDL_SECURE_PORT)) {
+ submodel.get(WSDL_SECURE_PORT).set(operation.require(WSDL_SECURE_PORT));
+ }
+ submodel.get(ENDPOINT_CONFIG).setEmptyObject();
+ submodel.get(ENDPOINT).setEmptyObject();
+ }
+
+ protected void performBoottime(OperationContext context, ModelNode operation,
ModelNode model, ServiceVerificationHandler verificationHandler,
List<ServiceController<?>> newControllers) {
+
+ context.addStep(new AbstractDeploymentChainStep() {
+ protected void execute(DeploymentProcessorTarget processorTarget) {
+ // add the DUP for dealing with WS deployments
+ WSDeploymentActivator.activate(processorTarget);
+ }
+ }, OperationContext.Stage.RUNTIME);
+
+ log.info("Activating WebServices Extension");
+ ModuleClassLoaderProvider.register();
+ WSServices.saveContainerRegistry(context.getServiceRegistry(false));
+
+ ServiceTarget serviceTarget = context.getServiceTarget();
+
+ ServerConfigImpl serverConfig = createServerConfig(operation);
+ newControllers.add(ServerConfigService.install(serviceTarget, serverConfig,
verificationHandler));
+ newControllers.add(EndpointRegistryService.install(serviceTarget,
verificationHandler));
+ }
+
+ private static ServerConfigImpl createServerConfig(ModelNode configuration) {
+ final ServerConfigImpl config = ServerConfigImpl.getInstance();
+ try {
+ config.setWebServiceHost(configuration.require(WSDL_HOST).asString());
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+
config.setModifySOAPAddress(configuration.require(MODIFY_WSDL_ADDRESS).asBoolean());
+ if (configuration.hasDefined(WSDL_PORT)) {
+ config.setWebServicePort(configuration.require(WSDL_PORT).asInt());
+ }
+ if (configuration.hasDefined(WSDL_SECURE_PORT)) {
+
config.setWebServiceSecurePort(configuration.require(WSDL_SECURE_PORT).asInt());
+ }
+ return config;
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemDescribe.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemDescribe.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemDescribe.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationStepHandler;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+import static org.jboss.as.webservices.dmr.Constants.MODIFY_WSDL_ADDRESS;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * @author Emanuel Muckenhuber
+ */
+final class WSSubsystemDescribe implements OperationStepHandler {
+
+ static final WSSubsystemDescribe INSTANCE = new WSSubsystemDescribe();
+
+ private WSSubsystemDescribe() {
+ // forbidden inheritance
+ }
+
+ /** {@inheritDoc} */
+ public void execute(OperationContext context, ModelNode operation) throws
OperationFailedException {
+ final PathAddress rootAddress =
PathAddress.pathAddress(PathAddress.pathAddress(operation.require(OP_ADDR))
+ .getLastElement());
+ final ModelNode subModel = context.readModel(PathAddress.EMPTY_ADDRESS);
+
+ final ModelNode subsystemAdd = new ModelNode();
+ subsystemAdd.get(OP).set(ADD);
+ subsystemAdd.get(OP_ADDR).set(rootAddress.toModelNode());
+
+ if (subModel.hasDefined(MODIFY_WSDL_ADDRESS)) {
+
subsystemAdd.get(MODIFY_WSDL_ADDRESS).set(subModel.get(MODIFY_WSDL_ADDRESS));
+ }
+
+ if (subModel.hasDefined(WSDL_HOST)) {
+ subsystemAdd.get(WSDL_HOST).set(subModel.get(WSDL_HOST));
+ }
+
+ if (subModel.hasDefined(WSDL_PORT)) {
+ subsystemAdd.get(WSDL_PORT).set(subModel.get(WSDL_PORT));
+ }
+
+ if (subModel.hasDefined(WSDL_SECURE_PORT)) {
+ subsystemAdd.get(WSDL_SECURE_PORT).set(subModel.get(WSDL_SECURE_PORT));
+ }
+
+ context.getResult().add(subsystemAdd);
+ context.completeStep();
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemProviders.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemProviders.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemProviders.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,477 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.dmr;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ATTRIBUTES;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CHILDREN;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.HEAD_COMMENT_ALLOWED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAMESPACE;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.REPLY_PROPERTIES;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED;
+import static
org.jboss.as.controller.descriptions.ModelDescriptionConstants.TAIL_COMMENT_ALLOWED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.TYPE;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CLASS;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONFIG;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONTEXT;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_NAME;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_TYPE;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_WSDL;
+import static org.jboss.as.webservices.dmr.Constants.MODIFY_WSDL_ADDRESS;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.AVERAGE_PROCESSING_TIME;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.FAULT_COUNT;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.MAX_PROCESSING_TIME;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.MIN_PROCESSING_TIME;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.REQUEST_COUNT;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.RESPONSE_COUNT;
+import static org.jboss.as.webservices.dmr.WSEndpointMetrics.TOTAL_PROCESSING_TIME;
+
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.controller.descriptions.common.CommonDescriptions;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Deployment model providers.
+ *
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran
Lofthouse</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WSSubsystemProviders {
+
+ static final String RESOURCE_NAME = WSSubsystemProviders.class.getPackage().getName()
+ ".LocalDescriptions";
+
+ private WSSubsystemProviders() {
+ super();
+ }
+
+ static final DescriptionProvider SUBSYSTEM = new DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getSubsystem(locale);
+ }
+ };
+
+ static final DescriptionProvider SUBSYSTEM_ADD = new DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getSubsystemAdd(locale);
+ }
+ };
+
+ static final DescriptionProvider SUBSYSTEM_DESCRIBE = new DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return CommonDescriptions.getSubsystemDescribeOperation(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINT_DESCRIPTION = new DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointDescription(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINT_ADD_DESCRIPTION = new DescriptionProvider()
{
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointAddDescription(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINT_REMOVE_DESCRIPTION = new
DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointRemoveDescription(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINTCONFIG_DESCRIPTION = new
DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointConfigDescription(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINTCONFIG_ADD_DESCRIPTION = new
DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointConfigAddDescription(locale);
+ }
+ };
+
+ static final DescriptionProvider ENDPOINTCONFIG_REMOVE_DESCRIPTION = new
DescriptionProvider() {
+ public ModelNode getModelDescription(final Locale locale) {
+ return Descriptions.getEndpointConfigRemoveDescription(locale);
+ }
+ };
+
+
+ private static ResourceBundle getResourceBundle(final Locale locale) {
+ return ResourceBundle.getBundle(RESOURCE_NAME, locale == null ?
Locale.getDefault() : locale);
+ }
+
+ private static class Descriptions {
+ static ModelNode getSubsystem(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+
+ final ModelNode subsystem = new ModelNode();
+
+ subsystem.get(DESCRIPTION).set(bundle.getString("ws"));
+ subsystem.get(HEAD_COMMENT_ALLOWED).set(true);
+ subsystem.get(TAIL_COMMENT_ALLOWED).set(true);
+ subsystem.get(NAMESPACE).set(Namespace.WEBSERVICES_1_0.getUriString());
+
+ subsystem.get(ATTRIBUTES, MODIFY_WSDL_ADDRESS,
DESCRIPTION).set(bundle.getString("modify.wsdl.address"));
+ subsystem.get(ATTRIBUTES, MODIFY_WSDL_ADDRESS, TYPE).set(ModelType.BOOLEAN);
+ subsystem.get(ATTRIBUTES, MODIFY_WSDL_ADDRESS, REQUIRED).set(true);
+
+ subsystem.get(ATTRIBUTES, WSDL_HOST,
DESCRIPTION).set(bundle.getString("wsdl.host"));
+ subsystem.get(ATTRIBUTES, WSDL_HOST, TYPE).set(ModelType.STRING);
+ subsystem.get(ATTRIBUTES, WSDL_HOST, REQUIRED).set(true);
+
+ subsystem.get(ATTRIBUTES, WSDL_PORT,
DESCRIPTION).set(bundle.getString("wsdl.port"));
+ subsystem.get(ATTRIBUTES, WSDL_PORT,
TYPE).set(ModelType.INT);
+ subsystem.get(ATTRIBUTES, WSDL_PORT, REQUIRED).set(false);
+
+ subsystem.get(ATTRIBUTES, WSDL_SECURE_PORT,
DESCRIPTION).set(bundle.getString("wsdl.secure.port"));
+ subsystem.get(ATTRIBUTES, WSDL_SECURE_PORT,
TYPE).set(ModelType.INT);
+ subsystem.get(ATTRIBUTES, WSDL_SECURE_PORT, REQUIRED).set(false);
+
+ subsystem.get(CHILDREN, ENDPOINT_CONFIG,
DESCRIPTION).set(bundle.getString("endpoint.config"));
+ subsystem.get(CHILDREN, ENDPOINT,
DESCRIPTION).set(bundle.getString("endpoint"));
+ subsystem.get(CHILDREN, ENDPOINT, REQUIRED).set(false);
+
+ return subsystem;
+ }
+
+ static ModelNode getEndpointAddDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode operation = new ModelNode();
+
+ operation.get(OPERATION_NAME).set(ADD);
+ operation.get(DESCRIPTION).set(bundle.getString("endpoint.add"));
+
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_NAME,
DESCRIPTION).set(bundle.getString("endpoint.name"));
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_NAME,
TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_NAME, REQUIRED).set(true);
+
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CONTEXT,
DESCRIPTION).set(bundle.getString("endpoint.context"));
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CONTEXT,
TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CONTEXT, REQUIRED).set(true);
+
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CLASS,
DESCRIPTION).set(bundle.getString("endpoint.class"));
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CLASS,
TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_CLASS, REQUIRED).set(false);
+
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_TYPE,
DESCRIPTION).set(bundle.getString("endpoint.type"));
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_TYPE,
TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_TYPE, REQUIRED).set(false);
+
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_WSDL,
DESCRIPTION).set(bundle.getString("endpoint.wsdl"));
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_WSDL,
TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, ENDPOINT_WSDL, REQUIRED).set(false);
+
+ operation.get(REPLY_PROPERTIES).setEmptyObject();
+
+ return operation;
+ }
+
+ static ModelNode getEndpointRemoveDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode operation = new ModelNode();
+
+ operation.get(OPERATION_NAME).set(REMOVE);
+
operation.get(DESCRIPTION).set(bundle.getString("endpoint.remove"));
+
+ operation.get(REQUEST_PROPERTIES, NAME,
DESCRIPTION).set(bundle.getString("endpoint.name"));
+ operation.get(REQUEST_PROPERTIES, NAME, TYPE).set(ModelType.STRING);
+ operation.get(REQUEST_PROPERTIES, NAME, REQUIRED).set(true);
+
+ operation.get(REPLY_PROPERTIES).setEmptyObject();
+
+ return operation;
+ }
+
+ static ModelNode getEndpointDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode node = new ModelNode();
+
+ node.get(DESCRIPTION).set(bundle.getString("endpoint"));
+ node.get(HEAD_COMMENT_ALLOWED).set(true);
+ node.get(TAIL_COMMENT_ALLOWED).set(true);
+
+ node.get(ATTRIBUTES, ENDPOINT_NAME,
DESCRIPTION).set(bundle.getString("endpoint.name"));
+ node.get(ATTRIBUTES, ENDPOINT_NAME, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, ENDPOINT_NAME, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, ENDPOINT_CONTEXT,
DESCRIPTION).set(bundle.getString("endpoint.context"));
+ node.get(ATTRIBUTES, ENDPOINT_CONTEXT, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, ENDPOINT_CONTEXT, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, ENDPOINT_CLASS,
DESCRIPTION).set(bundle.getString("endpoint.class"));
+ node.get(ATTRIBUTES, ENDPOINT_CLASS, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, ENDPOINT_CLASS, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, ENDPOINT_TYPE,
DESCRIPTION).set(bundle.getString("endpoint.type"));
+ node.get(ATTRIBUTES, ENDPOINT_TYPE, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, ENDPOINT_TYPE, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, ENDPOINT_WSDL,
DESCRIPTION).set(bundle.getString("endpoint.wsdl"));
+ node.get(ATTRIBUTES, ENDPOINT_WSDL, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, ENDPOINT_WSDL, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, AVERAGE_PROCESSING_TIME,
DESCRIPTION).set(bundle.getString("average.processing.time"));
+ node.get(ATTRIBUTES, AVERAGE_PROCESSING_TIME,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, AVERAGE_PROCESSING_TIME, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, MIN_PROCESSING_TIME,
DESCRIPTION).set(bundle.getString("min.processing.time"));
+ node.get(ATTRIBUTES, MIN_PROCESSING_TIME,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, MIN_PROCESSING_TIME, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, MAX_PROCESSING_TIME,
DESCRIPTION).set(bundle.getString("max.processing.time"));
+ node.get(ATTRIBUTES, MAX_PROCESSING_TIME,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, MAX_PROCESSING_TIME, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, TOTAL_PROCESSING_TIME,
DESCRIPTION).set(bundle.getString("total.processing.time"));
+ node.get(ATTRIBUTES, TOTAL_PROCESSING_TIME,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, TOTAL_PROCESSING_TIME, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, REQUEST_COUNT,
DESCRIPTION).set(bundle.getString("request.count"));
+ node.get(ATTRIBUTES, REQUEST_COUNT,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, REQUEST_COUNT, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, RESPONSE_COUNT,
DESCRIPTION).set(bundle.getString("response.count"));
+ node.get(ATTRIBUTES, RESPONSE_COUNT,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, RESPONSE_COUNT, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, FAULT_COUNT,
DESCRIPTION).set(bundle.getString("fault.count"));
+ node.get(ATTRIBUTES, FAULT_COUNT,
TYPE).set(ModelType.INT);
+ node.get(ATTRIBUTES, FAULT_COUNT, REQUIRED).set(false);
+
+ return node;
+ }
+
+ static ModelNode getEndpointConfigDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode node = new ModelNode();
+
+ node.get(DESCRIPTION).set(bundle.getString("endpoint.config"));
+ node.get(HEAD_COMMENT_ALLOWED).set(true);
+ node.get(TAIL_COMMENT_ALLOWED).set(true);
+
+ node.get(ATTRIBUTES, Constants.CONFIG_NAME, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.CONFIG_NAME,
DESCRIPTION).set(bundle.getString("endpoint.config.name"));
+ node.get(ATTRIBUTES, Constants.CONFIG_NAME, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING,
DESCRIPTION).set(bundle.getString("protocol.binding"));
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING, REQUIRED).set(false);
+
+
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("portname.pattern"));
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("servicename.pattern"));
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME,
DESCRIPTION).set(bundle.getString("handler.name"));
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS,
DESCRIPTION).set(bundle.getString("handler.class"));
+ node.get(ATTRIBUTES, Constants.PRE_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS, REQUIRED).set(true);
+
+
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING,
DESCRIPTION).set(bundle.getString("protocol.binding"));
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PROTOCOL_BINDING, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("portname.pattern"));
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.PORT_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("servicename.pattern"));
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.SERVICE_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME,
DESCRIPTION).set(bundle.getString("handler.name"));
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_NAME, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS,
DESCRIPTION).set(bundle.getString("handler.class"));
+ node.get(ATTRIBUTES, Constants.POST_HANDLER_CHAINS, Constants.HANDLER_CHAIN,
Constants.HANDLER, Constants.HANDLER_CLASS, REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_NAME,
TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_NAME,
DESCRIPTION).set(bundle.getString("property.name"));
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_NAME,
REQUIRED).set(true);
+
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
DESCRIPTION).set(bundle.getString("property.value"));
+ node.get(ATTRIBUTES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
REQUIRED).set(true);
+
+
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_NAME,
TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_NAME,
DESCRIPTION).set(bundle.getString("feature.name"));
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_NAME,
REQUIRED).set(true);
+
+ /* not supported yet
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_DATA,
TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_DATA,
DESCRIPTION).set(bundle.getString("feature.value"));
+ node.get(ATTRIBUTES, Constants.FEATURE, Constants.FEATURE_DATA,
REQUIRED).set(true);
+ */
+ return node;
+ }
+
+ static ModelNode getEndpointConfigAddDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+
+ final ModelNode node = new ModelNode();
+ node.get(OPERATION_NAME).set(ADD);
+
node.get(DESCRIPTION).set(bundle.getString("endpoint.config.add"));
+
+ node.get(REQUEST_PROPERTIES, Constants.CONFIG_NAME,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.CONFIG_NAME,
DESCRIPTION).set(bundle.getString("endpoint.config.name"));
+ node.get(REQUEST_PROPERTIES, Constants.CONFIG_NAME, REQUIRED).set(true);
+
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING,
DESCRIPTION).set(bundle.getString("protocol.binding"));
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING, REQUIRED).set(false);
+
+
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("portname.pattern"));
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("servicename.pattern"));
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME,
DESCRIPTION).set(bundle.getString("handler.name"));
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME, REQUIRED).set(true);
+
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS,
DESCRIPTION).set(bundle.getString("handler.class"));
+ node.get(REQUEST_PROPERTIES, Constants.PRE_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS, REQUIRED).set(true);
+
+
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING,
DESCRIPTION).set(bundle.getString("protocol.binding"));
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PROTOCOL_BINDING, REQUIRED).set(false);
+
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("portname.pattern"));
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.PORT_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN,
DESCRIPTION).set(bundle.getString("servicename.pattern"));
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.SERVICE_NAME_PATTERN, REQUIRED).set(false);
+
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME,
DESCRIPTION).set(bundle.getString("handler.name"));
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_NAME, REQUIRED).set(true);
+
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS,
DESCRIPTION).set(bundle.getString("handler.class"));
+ node.get(REQUEST_PROPERTIES, Constants.POST_HANDLER_CHAINS,
Constants.HANDLER_CHAIN, Constants.HANDLER, Constants.HANDLER_CLASS, REQUIRED).set(true);
+
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_NAME,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_NAME,
DESCRIPTION).set(bundle.getString("property.name"));
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_NAME,
REQUIRED).set(true);
+
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
DESCRIPTION).set(bundle.getString("property.value"));
+ node.get(REQUEST_PROPERTIES, Constants.PROPERTY, Constants.PROPERTY_VALUE,
REQUIRED).set(true);
+
+
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_NAME,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_NAME,
DESCRIPTION).set(bundle.getString("feature.name"));
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_NAME,
REQUIRED).set(true);
+
+ /*Not supported
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_DATA,
TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_DATA,
DESCRIPTION).set(bundle.getString("feature.value"));
+ node.get(REQUEST_PROPERTIES, Constants.FEATURE, Constants.FEATURE_DATA,
REQUIRED).set(true);
+ */
+
+ return node;
+ }
+
+ static ModelNode getEndpointConfigRemoveDescription(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode node = new ModelNode();
+
+ node.get(OPERATION_NAME).set(REMOVE);
+
node.get(DESCRIPTION).set(bundle.getString("endpoint.config.remove"));
+
+ node.get(REQUEST_PROPERTIES, NAME,
DESCRIPTION).set(bundle.getString("endpoint.config.name"));
+ node.get(REQUEST_PROPERTIES, NAME, TYPE).set(ModelType.STRING);
+ node.get(REQUEST_PROPERTIES, NAME, REQUIRED).set(true);
+
+ node.get(REPLY_PROPERTIES).setEmptyObject();
+
+ return node;
+ }
+
+
+
+ static ModelNode getSubsystemAdd(final Locale locale) {
+ final ResourceBundle bundle = getResourceBundle(locale);
+ final ModelNode op = new ModelNode();
+
+ op.get(OPERATION_NAME).set(ADD);
+ op.get(DESCRIPTION).set(bundle.getString("ws.add"));
+
+ op.get(REQUEST_PROPERTIES, MODIFY_WSDL_ADDRESS,
DESCRIPTION).set(bundle.getString("modify.wsdl.address"));
+ op.get(REQUEST_PROPERTIES, MODIFY_WSDL_ADDRESS,
TYPE).set(ModelType.BOOLEAN);
+ op.get(REQUEST_PROPERTIES, MODIFY_WSDL_ADDRESS, REQUIRED).set(true);
+
+ op.get(REQUEST_PROPERTIES, WSDL_HOST,
DESCRIPTION).set(bundle.getString("wsdl.host"));
+ op.get(REQUEST_PROPERTIES, WSDL_HOST, TYPE).set(ModelType.STRING);
+ op.get(REQUEST_PROPERTIES, WSDL_HOST, REQUIRED).set(true);
+
+ op.get(REQUEST_PROPERTIES, WSDL_PORT,
DESCRIPTION).set(bundle.getString("wsdl.port"));
+ op.get(REQUEST_PROPERTIES, WSDL_PORT,
TYPE).set(ModelType.INT);
+ op.get(REQUEST_PROPERTIES, WSDL_PORT, REQUIRED).set(false);
+
+ op.get(REQUEST_PROPERTIES, WSDL_SECURE_PORT,
DESCRIPTION).set(bundle.getString("wsdl.secure.port"));
+ op.get(REQUEST_PROPERTIES, WSDL_SECURE_PORT,
TYPE).set(ModelType.INT);
+ op.get(REQUEST_PROPERTIES, WSDL_SECURE_PORT, REQUIRED).set(false);
+
+ op.get(REPLY_PROPERTIES).setEmptyObject();
+
+ return op;
+ }
+
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WebservicesSubsystemParser.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WebservicesSubsystemParser.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/dmr/WebservicesSubsystemParser.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,436 @@
+package org.jboss.as.webservices.dmr;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
+import static org.jboss.as.controller.parsing.ParseUtils.missingRequiredElement;
+import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
+import static org.jboss.as.controller.parsing.ParseUtils.unexpectedElement;
+import static org.jboss.as.webservices.dmr.Constants.ENDPOINT_CONFIG;
+import static org.jboss.as.webservices.dmr.Constants.MODIFY_WSDL_ADDRESS;
+import static org.jboss.as.webservices.dmr.Constants.POST_HANDLER_CHAINS;
+import static org.jboss.as.webservices.dmr.Constants.PRE_HANDLER_CHAINS;
+import static org.jboss.as.webservices.dmr.Constants.PROPERTY;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
+import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
+import static org.jboss.wsf.spi.util.StAXUtils.match;
+
+import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.staxmapper.XMLElementReader;
+import org.jboss.staxmapper.XMLElementWriter;
+import org.jboss.staxmapper.XMLExtendedStreamReader;
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+final class WebservicesSubsystemParser implements XMLStreamConstants,
XMLElementReader<List<ModelNode>>,
+ XMLElementWriter<SubsystemMarshallingContext> {
+
+ private static final WebservicesSubsystemParser INSTANCE = new
WebservicesSubsystemParser();
+
+ static WebservicesSubsystemParser getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext
context) throws XMLStreamException {
+ //context = new SubsystemMarshallingContext(context.getModelNode(), writer);//
for test
+ context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
+ writer.writeNamespace("javaee", Namespace.JAVAEE.getUriString());
+ writer.writeNamespace("jaxwsconfig",
Namespace.JAXWSCONFIG.getUriString());
+ ModelNode node = context.getModelNode();
+ writeElement(writer, Element.WSDL_HOST, node.require(WSDL_HOST));
+ writeElement(writer, Element.MODIFY_WSDL_ADDRESS,
node.require(MODIFY_WSDL_ADDRESS));
+ if (has(node, WSDL_SECURE_PORT)) {
+ writeElement(writer, Element.WSDL_SECURE_PORT,
node.require(WSDL_SECURE_PORT));
+ }
+ if (has(node, WSDL_PORT)) {
+ writeElement(writer, Element.WSDL_PORT, node.require(WSDL_PORT));
+ }
+ if (has(node, ENDPOINT_CONFIG)) {
+ for (String name : node.get(ENDPOINT_CONFIG).keys()) {
+ writeEndpointConfig(writer, name, node.get(ENDPOINT_CONFIG, name));
+ }
+ }
+
+ writer.writeEndElement(); // End of subsystem element
+ }
+
+ private boolean has(ModelNode node, String name) {
+ return node.has(name) && node.get(name).isDefined();
+ }
+
+ private void writeEndpointConfig(final XMLExtendedStreamWriter writer, String name,
final ModelNode value)
+ throws XMLStreamException {
+ writer.writeStartElement(Constants.ENDPOINT_CONFIG);
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.CONFIG_NAME);
+ writer.writeCharacters(name);
+ writer.writeEndElement();
+ if (value.hasDefined(Constants.PRE_HANDLER_CHAINS)) {
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.PRE_HANDLER_CHAINS);
+ ModelNode handlerChains = value.get(Constants.PRE_HANDLER_CHAINS);
+ writeHandlerChains(writer, handlerChains);
+ writer.writeEndElement();
+ }
+
+ if (value.hasDefined(Constants.POST_HANDLER_CHAINS)) {
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.POST_HANDLER_CHAINS);
+ ModelNode handlerChains = value.get(Constants.POST_HANDLER_CHAINS);
+ writeHandlerChains(writer, handlerChains);
+ writer.writeEndElement();
+ }
+
+ if (value.hasDefined(Constants.PROPERTY)) {
+ for (String key : value.get(PROPERTY).keys()) {
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.PROPERTY);
+
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.PROPERTY_NAME);
+ writer.writeCharacters(key);
+ writer.writeEndElement();
+
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.PROPERTY_VALUE);
+ writer.writeCharacters(value.get(PROPERTY).get(key).asString());
+ writer.writeEndElement();
+
+ writer.writeEndElement();
+ }
+ }
+
+ if (value.hasDefined(Constants.FEATURE)) {
+ for (String key : value.get(Constants.FEATURE).keys()) {
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.FEATURE);
+
+ writer.writeStartElement(Namespace.JAXWSCONFIG.getUriString(),
Constants.FEATURE_NAME);
+ writer.writeCharacters(key);
+ writer.writeEndElement();
+ //TODO: Feature data support
+ writer.writeEndElement();
+ }
+ }
+ writer.writeEndElement();
+ }
+
+ private void writeHandlerChains(final XMLExtendedStreamWriter writer, final ModelNode
handlerChains)
+ throws XMLStreamException {
+ if (handlerChains.getType() == ModelType.LIST) {
+ for (ModelNode handlerChain : handlerChains.asList()) {
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.HANDLER_CHAIN);
+ if (handlerChain.hasDefined(Constants.PROTOCOL_BINDING)) {
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.PROTOCOL_BINDING);
+
writer.writeCharacters(handlerChain.get(Constants.PROTOCOL_BINDING).asString());
+ writer.writeEndElement();
+ }
+
+ if (handlerChain.hasDefined(Constants.SERVICE_NAME_PATTERN)) {
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.SERVICE_NAME_PATTERN);
+
writer.writeCharacters(handlerChain.get(Constants.SERVICE_NAME_PATTERN).asString());
+ writer.writeEndElement();
+ }
+
+ if (handlerChain.hasDefined(Constants.PORT_NAME_PATTERN)) {
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.PORT_NAME_PATTERN);
+
writer.writeCharacters(handlerChain.get(Constants.PORT_NAME_PATTERN).asString());
+ writer.writeEndElement();
+ }
+
+ if (handlerChain.hasDefined(Constants.HANDLER)) {
+
+ for (String key : handlerChain.get(Constants.HANDLER).keys()) {
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.HANDLER);
+
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.HANDLER_NAME);
+ writer.writeCharacters(key);
+ writer.writeEndElement();
+
+ writer.writeStartElement(Namespace.JAVAEE.getUriString(),
Constants.HANDLER_CLASS);
+
writer.writeCharacters(handlerChain.get(Constants.HANDLER).get(key).asString());
+ writer.writeEndElement();
+
+ writer.writeEndElement();
+ }
+
+ }
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void writeElement(final XMLExtendedStreamWriter writer, final Element
element, final ModelNode value)
+ throws XMLStreamException {
+ writer.writeStartElement(element.getLocalName());
+ writer.writeCharacters(value.asString());
+ writer.writeEndElement();
+ }
+
+ @Override
+ public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list)
throws XMLStreamException {
+ // no attributes
+ requireNoAttributes(reader);
+
+ final ModelNode subsystem = new ModelNode();
+ subsystem.get(OP).set(ADD);
+ subsystem.get(OP_ADDR).add(SUBSYSTEM, WSExtension.SUBSYSTEM_NAME);
+
+ final List<ModelNode> endpointConfigs = new ArrayList<ModelNode>();
+
+ // elements
+ final EnumSet<Element> required = EnumSet.of(Element.MODIFY_WSDL_ADDRESS,
Element.WSDL_HOST);
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
+ switch (Namespace.forUri(reader.getNamespaceURI())) {
+ case WEBSERVICES_1_0: {
+ final Element element = Element.forName(reader.getLocalName());
+ required.remove(element);
+ if (element != Element.ENDPOINT_CONFIG &&
!encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case WSDL_HOST: {
+
subsystem.get(WSDL_HOST).set(parseElementNoAttributes(reader));
+ break;
+ }
+ case MODIFY_WSDL_ADDRESS: {
+ boolean b =
Boolean.parseBoolean(parseElementNoAttributes(reader));
+ subsystem.get(MODIFY_WSDL_ADDRESS).set(b);
+ break;
+ }
+ case WSDL_SECURE_PORT: {
+ int port =
Integer.valueOf(parseElementNoAttributes(reader));
+ subsystem.get(WSDL_SECURE_PORT).set(port);
+ break;
+ }
+ case ENDPOINT_CONFIG: {
+ readEndpointConfig(reader, subsystem.get(OP_ADDR),
endpointConfigs);
+ break;
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ break;
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+
+ if (!required.isEmpty()) {
+ throw missingRequiredElement(reader, required);
+ }
+
+ list.add(subsystem);
+ list.addAll(endpointConfigs);
+ }
+
+ private String parseElementNoAttributes(XMLExtendedStreamReader reader) throws
XMLStreamException {
+ // no attributes
+ requireNoAttributes(reader);
+
+ return reader.getElementText().trim();
+ }
+
+ private void readEndpointConfig(XMLExtendedStreamReader reader, ModelNode address,
List<ModelNode> operationList) throws XMLStreamException {
+ String configName = null;
+ ModelNode preHandlers = null;
+ ModelNode postHandlers = null;
+ final ModelNode node = new ModelNode();
+ node.get(OP).set(ADD);
+
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (element != Element.FEATURE && element != Element.PROPERTY
+ && !encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case CONFIG_NAME: {
+ configName = parseElementNoAttributes(reader);
+ node.get(OP_ADDR).set(address).add(ENDPOINT_CONFIG, configName);
+ break;
+ }
+ case PRE_HANDLER_CHAINS: {
+ preHandlers = parseHandlerChains(reader);
+ node.get(PRE_HANDLER_CHAINS).set(preHandlers);
+ break;
+ }
+ case POST_HANDLER_CHAINS: {
+ postHandlers = parseHandlerChains(reader);
+ node.get(POST_HANDLER_CHAINS).set(postHandlers);
+ break;
+ }
+ case PROPERTY : {
+ parseProperty(reader, node);
+ break;
+ }
+ case FEATURE : {
+ parseFeature(reader, node);
+ break;
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+ operationList.add(node);
+ }
+
+ private void parseProperty(XMLExtendedStreamReader reader, ModelNode node) throws
XMLStreamException {
+ String propertyName = null;
+ String propertyValue = null;
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (!encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case PROPERTY_NAME: {
+ propertyName = parseElementNoAttributes(reader);
+ break;
+ }
+ case PROPERTY_VALUE : {
+ propertyValue = parseElementNoAttributes(reader);
+ break;
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+ node.get(Constants.PROPERTY).get(propertyName).set(propertyValue);
+ }
+
+ private void parseFeature(XMLExtendedStreamReader reader, ModelNode node) throws
XMLStreamException {
+ String featureName = null;
+ String featureData = "";
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (!encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case FEATURE_NAME: {
+ featureName = parseElementNoAttributes(reader);
+ break;
+ }
+ case FEATURE_DATA: {
+ //skip the feature data content
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT
+ && match(reader,
Namespace.JAXWSCONFIG.getUriString(), Constants.FEATURE_DATA)) {
+ break;
+ }
+ }
+ break;
+
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+ node.get(Constants.FEATURE).get(featureName).set(featureData);
+ }
+
+ private ModelNode parseHandlerChains(XMLExtendedStreamReader reader) throws
XMLStreamException {
+ ModelNode chainsNode = new ModelNode();
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (element != Element.HANDLER_CHAIN && !encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+
+ switch (element) {
+ case HANDLER_CHAIN: {
+ ModelNode chainNode = new ModelNode();
+ parseHandlerChain(reader, chainNode);
+ chainsNode.add(chainNode);
+ break;
+ }
+
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+ return chainsNode;
+
+ }
+
+ private void parseHandlerChain(XMLExtendedStreamReader reader, ModelNode chainNode)
throws XMLStreamException {
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (element != Element.HANDLER && !encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case PROTOCOL_BINDING: {
+ String binding = parseElementNoAttributes(reader);
+ chainNode.get(Constants.PROTOCOL_BINDING).set(binding);
+
+ break;
+ }
+ case SERVICE_NAME_PATTERN: {
+ String serviceNamePattern = parseElementNoAttributes(reader);
+
chainNode.get(Constants.SERVICE_NAME_PATTERN).set(serviceNamePattern);
+ break;
+ }
+
+ case PORT_NAME_PATTERN: {
+ String portNamePattern = parseElementNoAttributes(reader);
+ chainNode.get(Constants.PORT_NAME_PATTERN).set(portNamePattern);
+ break;
+ }
+ case HANDLER: {
+ parseHandler(reader, chainNode);
+ break;
+ }
+
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+
+ }
+
+ private void parseHandler(XMLExtendedStreamReader reader, ModelNode chainNode) throws
XMLStreamException {
+ String handlerName = null;
+ String handlerClass = null;
+ final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
+ while (reader.nextTag() != END_ELEMENT) {
+ final Element element = Element.forName(reader.getLocalName());
+ if (!encountered.add(element)) {
+ throw unexpectedElement(reader);
+ }
+ switch (element) {
+ case HANDLER_NAME: {
+ handlerName = parseElementNoAttributes(reader);
+ break;
+ }
+ case HANDLER_CLASS: {
+ handlerClass = parseElementNoAttributes(reader);
+ break;
+ }
+ default: {
+ throw unexpectedElement(reader);
+ }
+ }
+ }
+ chainNode.get(Constants.HANDLER).get(handlerName).set(handlerClass);
+ }
+}
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/injection/WebServiceContextInjectionSource.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/injection/WebServiceContextInjectionSource.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/injection/WebServiceContextInjectionSource.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.injection;
+
+import org.jboss.as.ee.component.InjectionSource;
+import org.jboss.as.naming.ManagedReference;
+import org.jboss.as.naming.ManagedReferenceFactory;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.msc.inject.Injector;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.ws.common.injection.ThreadLocalAwareWebServiceContext;
+
+/**
+ * {@link InjectionSource} for {@link javax.xml.ws.WebServiceContext} resource.
+ *
+ * User: Jaikiran Pai
+ */
+public class WebServiceContextInjectionSource extends InjectionSource {
+ @Override
+ public void getResourceValue(ResolutionContext resolutionContext,
ServiceBuilder<?> serviceBuilder, DeploymentPhaseContext phaseContext,
Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException
{
+ injector.inject(new WebServiceContextManagedReferenceFactory());
+ }
+
+ private class WebServiceContextManagedReferenceFactory implements
ManagedReferenceFactory {
+
+ @Override
+ public ManagedReference getReference() {
+ return new WebServiceContextManagedReference();
+ }
+ }
+
+ private class WebServiceContextManagedReference implements ManagedReference {
+
+ @Override
+ public void release() {
+ }
+
+ @Override
+ public Object getInstance() {
+ // return the WebServiceContext
+ return ThreadLocalAwareWebServiceContext.getInstance();
+ }
+ }
+
+ // all context injection sources are equal since they are thread locals
+ public boolean equals(Object o) {
+ return o instanceof WebServiceContextInjectionSource;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerEJB3.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerEJB3.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerEJB3.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,192 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.invocation;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.as.ee.component.Component;
+import org.jboss.as.ee.component.ComponentView;
+import org.jboss.as.ee.component.ComponentViewInstance;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.invocation.InterceptorContext;
+import org.jboss.ws.common.injection.ThreadLocalAwareWebServiceContext;
+import org.jboss.ws.common.invocation.AbstractInvocationHandler;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.ioc.IoCContainerProxy;
+import org.jboss.wsf.spi.ioc.IoCContainerProxyFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class InvocationHandlerEJB3 extends AbstractInvocationHandler {
+ /** EJB3 JNDI context. */
+ private static final String EJB3_JNDI_PREFIX = "java:env/";
+
+ /** MC kernel controller. */
+ private final IoCContainerProxy iocContainer;
+
+ /** EJB3 container name. */
+ private String ejbName;
+
+ /** EJB3 container. */
+ private volatile ComponentViewInstance ejbComponentViewInstance;
+
+ /**
+ * Constructor.
+ */
+ InvocationHandlerEJB3() {
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ final IoCContainerProxyFactory iocContainerFactory =
spiProvider.getSPI(IoCContainerProxyFactory.class);
+ iocContainer = iocContainerFactory.getContainer();
+ }
+
+ /**
+ * Initializes EJB3 container name.
+ *
+ * @param endpoint web service endpoint
+ */
+ public void init(final Endpoint endpoint) {
+ ejbName = (String) endpoint.getProperty(ASHelper.CONTAINER_NAME);
+
+ if (ejbName == null) {
+ throw new IllegalArgumentException("Container name cannot be null");
+ }
+ }
+
+ /**
+ * Gets EJB 3 container lazily.
+ *
+ * @return EJB3 container
+ */
+ private ComponentViewInstance getComponentViewInstance() {
+ if (ejbComponentViewInstance == null) {
+ synchronized(this) {
+ if (ejbComponentViewInstance == null) {
+ final ComponentView ejbView = iocContainer.getBean(ejbName,
ComponentView.class);
+ if (ejbView == null) {
+ throw new WebServiceException("Cannot find ejb: " +
ejbName);
+ }
+ ejbComponentViewInstance = ejbView.createInstance();
+ }
+ }
+ }
+
+ return ejbComponentViewInstance;
+ }
+
+ /**
+ * Invokes EJB 3 endpoint.
+ *
+ * @param endpoint EJB 3 endpoint
+ * @param wsInvocation web service invocation
+ * @throws Exception if any error occurs
+ */
+ public void invoke(final Endpoint endpoint, final Invocation wsInvocation) throws
Exception {
+ try {
+ // prepare for invocation
+ onBeforeInvocation(wsInvocation);
+ // prepare invocation data
+ final ComponentViewInstance componentViewInstance = getComponentViewInstance();
+ final Method method = getEJBMethod(wsInvocation.getJavaMethod(),
componentViewInstance.allowedMethods());
+ final InterceptorContext context = new InterceptorContext();
+ context.setMethod(method);
+ context.setContextData(getWebServiceContext(wsInvocation).getMessageContext());
+ context.setParameters(wsInvocation.getArgs());
+ context.setTarget(componentViewInstance.createProxy());
+ context.putPrivateData(Component.class, componentViewInstance.getComponent());
+ context.putPrivateData(ComponentViewInstance.class, componentViewInstance);
+ // invoke method
+ final Object retObj =
componentViewInstance.getEntryPoint(method).processInvocation(context);
+ // set return value
+ wsInvocation.setReturnValue(retObj);
+ }
+ catch (Throwable t) {
+ log.error("Method invocation failed with exception: " +
t.getMessage(), t);
+ handleInvocationException(t);
+ }
+ finally {
+ onAfterInvocation(wsInvocation);
+ }
+ }
+
+ private Method getEJBMethod(final Method seiMethod, final Collection<Method>
methods) {
+ for (final Method method : methods) {
+ if (seiMethod.equals(method)) {
+ return method;
+ }
+ }
+
+ throw new IllegalStateException();
+ }
+
+ public Context getJNDIContext(final Endpoint ep) throws NamingException {
+ return null; // TODO: implement
+// final EJBContainer ejb3Container = (EJBContainer) getComponentViewInstance();
+// return (Context) ejb3Container.getEnc().lookup(EJB3_JNDI_PREFIX);
+ }
+
+ /**
+ * Injects webservice context on target bean.
+ *
+ * @param invocation current invocation
+ */
+ @Override
+ public void onBeforeInvocation(final Invocation invocation) {
+ final WebServiceContext wsContext = getWebServiceContext(invocation);
+ ThreadLocalAwareWebServiceContext.getInstance().setMessageContext(wsContext);
+ }
+
+ /**
+ * Cleanups injected webservice context on target bean.
+ *
+ * @param invocation current invocation
+ */
+ @Override
+ public void onAfterInvocation(final Invocation invocation) {
+ ThreadLocalAwareWebServiceContext.getInstance().setMessageContext(null);
+ }
+
+ /**
+ * Returns WebServiceContext associated with this invocation.
+ *
+ * @param invocation current invocation
+ * @return web service context or null if not available
+ */
+ private WebServiceContext getWebServiceContext(final Invocation invocation) {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+
+ return invocationContext.getAttachment(WebServiceContext.class);
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerFactoryImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerFactoryImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/invocation/InvocationHandlerFactoryImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.invocation;
+
+import org.jboss.ws.common.invocation.InvocationHandlerJAXRPC;
+import org.jboss.ws.common.invocation.InvocationHandlerJAXWS;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.InvocationHandlerFactory;
+import org.jboss.wsf.spi.invocation.InvocationType;
+
+/**
+ * The default invocation model factory for JBoss AS.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class InvocationHandlerFactoryImpl extends InvocationHandlerFactory {
+ /**
+ * Constructor.
+ */
+ public InvocationHandlerFactoryImpl() {
+ super();
+ }
+
+ /**
+ * Returns invocation handler associated with invocation type.
+ *
+ * @param type invocation type
+ * @return invocation handler
+ */
+ public InvocationHandler newInvocationHandler(final InvocationType type) {
+ InvocationHandler handler = null;
+
+ switch (type) {
+ case JAXRPC_JSE:
+ handler = new InvocationHandlerJAXRPC();
+ break;
+// TODO !!
+// case JAXRPC_EJB21:
+// handler = new InvocationHandlerEJB21();
+// break;
+// case JAXRPC_MDB21:
+// handler = new InvocationHandlerMDB21();
+// break;
+ case JAXWS_JSE:
+ handler = new InvocationHandlerJAXWS();
+ break;
+ case JAXWS_EJB3:
+ handler = new InvocationHandlerEJB3();
+ break;
+// case JAXWS_MDB3:
+// handler = new InvocationHandlerMDB3();
+// break;
+ default:
+ throw new IllegalArgumentException("Unable to resolve
spi.invocation.InvocationHandler for type " + type);
+ }
+
+ return handler;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyFactoryImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyFactoryImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyFactoryImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,51 @@
+/*
+ * 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.as.webservices.ioc;
+
+import org.jboss.wsf.spi.ioc.IoCContainerProxy;
+import org.jboss.wsf.spi.ioc.IoCContainerProxyFactory;
+
+/**
+ * @see org.jboss.wsf.spi.ioc.IoCContainerProxyFactory
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class IoCContainerProxyFactoryImpl implements IoCContainerProxyFactory {
+ /** Container proxy singleton. */
+ private static final IoCContainerProxy CONTAINER =
IoCContainerProxyImpl.getInstance();
+
+ /**
+ * Constructor.
+ */
+ public IoCContainerProxyFactoryImpl() {
+ super();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.ioc.IoCContainerProxyFactory#getContainer()
+ *
+ * @return IoC container proxy
+ */
+ public IoCContainerProxy getContainer() {
+ return IoCContainerProxyFactoryImpl.CONTAINER;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/ioc/IoCContainerProxyImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,69 @@
+/*
+ * 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.as.webservices.ioc;
+
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.wsf.spi.ioc.IoCContainerProxy;
+
+/**
+ * @see org.jboss.wsf.spi.ioc.IoCContainerProxy
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+public final class IoCContainerProxyImpl implements IoCContainerProxy {
+ /** Singleton. */
+ private static final IoCContainerProxy SINGLETON = new IoCContainerProxyImpl();
+
+ /**
+ * Constructor.
+ */
+ public IoCContainerProxyImpl() {
+ super();
+ }
+
+ /**
+ * Returns container proxy instance.
+ *
+ * @return container proxy instance
+ */
+ static IoCContainerProxy getInstance() {
+ return IoCContainerProxyImpl.SINGLETON;
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.ioc.IoCContainerProxy#getBean(java.lang.String,
java.lang.Class)
+ *
+ * @param <T> bean type
+ * @param beanName bean name inside IoC registry
+ * @param clazz bean type class
+ * @return bean instance
+ * @throws IllegalArgumentException if bean is not found
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getBean(final String beanName, final Class<T> clazz) {
+ ServiceController<T> service =
(ServiceController<T>)WSServices.getContainerRegistry().getService(ServiceName.parse(beanName));
+ return service != null ? service.getValue() : null;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.metadata;
+
+import java.util.Iterator;
+
+import org.jboss.as.web.deployment.WarMetaData;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter;
+
+/**
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+abstract class AbstractMetaDataBuilderEJB {
+ /** Logger. */
+ protected final Logger log = Logger.getLogger(this.getClass());
+
+ /**
+ * Builds universal EJB meta data model that is AS agnostic.
+ *
+ * @param dep
+ * webservice deployment
+ * @return universal EJB meta data model
+ */
+ final EJBArchiveMetaData create(final Deployment dep) {
+ this.log.debug("Building JBoss agnostic meta data for EJB webservice
deployment: " + dep.getSimpleName());
+
+ final EJBArchiveMetaData ejbArchiveMD = new EJBArchiveMetaData();
+
+ this.buildEnterpriseBeansMetaData(dep, ejbArchiveMD);
+ this.buildWebservicesMetaData(dep, ejbArchiveMD);
+
+ return ejbArchiveMD;
+ }
+
+ /**
+ * Template method for build enterprise beans meta data.
+ *
+ * @param dep
+ * webservice deployment
+ * @param ejbMetaData
+ * universal EJB meta data model
+ */
+ protected abstract void buildEnterpriseBeansMetaData(Deployment dep,
EJBArchiveMetaData ejbMetaData);
+
+ /**
+ * Builds webservices meta data. This methods sets:
+ * <ul>
+ * <li>context root</li>
+ * <li>wsdl location resolver</li>
+ * <li>config name</li>
+ * <li>config file</li>
+ * </ul>
+ *
+ * @param dep
+ * webservice deployment
+ * @param ejbArchiveMD
+ * universal EJB meta data model
+ */
+ private void buildWebservicesMetaData(final Deployment dep, final EJBArchiveMetaData
ejbArchiveMD) {
+ return;
+ /* TODO: implement
+ final JBossMetaData jbossMD = WSHelper.getRequiredAttachment(dep,
JBossMetaData.class);
+ final WebservicesMetaData webservicesMD = jbossMD.getWebservices();
+
+ if (webservicesMD == null) {
+ return;
+ }
+
+ // set context root
+ String contextRoot = webservicesMD.getContextRoot();
+ final WebserviceDescriptionsMetaData wsDescriptionsMD =
webservicesMD.getWebserviceDescriptions();
+
+ if (wsDescriptionsMD != null) {
+ // set wsdl location resolver
+ final PublishLocationAdapter resolver = new
PublishLocationAdapterImpl(wsDescriptionsMD);
+ ejbArchiveMD.setPublishLocationAdapter(resolver);
+
+ /*
+ * TODO: implement final WebserviceDescriptionMetaData
+ * wsDescriptionMD = ASHelper
+ * .getWebserviceDescriptionMetaData(wsDescriptionsMD); if
+ * (wsDescriptionMD != null) { if (!Constants.BC_CONTEXT_MODE &&
+ * contextRoot == null && !hasContextRoot(ejbArchiveMD)) {
+ * contextRoot = wsDescriptionMD.getWebserviceDescriptionName(); //
+ * TCK6 fallback }
+ *
+ * final String configName = wsDescriptionMD.getConfigName(); final
+ * String configFile = wsDescriptionMD.getConfigFile();
+ *
+ * // set config name this.log.debug("Setting config name: " +
+ * configName);
+ * ejbArchiveMD.setConfigName(wsDescriptionMD.getConfigName());
+ *
+ * // set config file this.log.debug("Setting config file: " +
+ * configFile);
+ * ejbArchiveMD.setConfigFile(wsDescriptionMD.getConfigFile()); }
+ */
+// }
+//
+// ejbArchiveMD.setWebServiceContextRoot(contextRoot);
+// this.log.debug("Setting context root: " + contextRoot);
+ }
+
+ /**
+ * Returns true if has context root, false otherwise.
+ *
+ * @param ejbArchiveMD
+ * ejb archive MD
+ * @return true if has context root, false otherwise
+ */
+ private boolean hasContextRoot(final EJBArchiveMetaData ejbArchiveMD) {
+ for (final Iterator<EJBMetaData> ejbMDs =
ejbArchiveMD.getEnterpriseBeans(); ejbMDs.hasNext();) {
+ final EJBMetaData ejbMD = ejbMDs.next();
+ if (ejbMD.getPortComponentURI() != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/ContainerMetaDataDeploymentAspect.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/ContainerMetaDataDeploymentAspect.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/ContainerMetaDataDeploymentAspect.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.metadata;
+
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+
+/**
+ * An aspect that builds container independent meta data.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class ContainerMetaDataDeploymentAspect extends AbstractDeploymentAspect {
+ /** JSE meta data builder. */
+ private final MetaDataBuilderJSE metaDataBuilderJSE = new MetaDataBuilderJSE();
+
+ /** EJB3 meta data builder. */
+ private final MetaDataBuilderEJB3 metaDataBuilderEJB3 = new MetaDataBuilderEJB3();
+// TODO
+// /** EJB21 meta data builder. */
+// private final MetaDataBuilderEJB21 metaDataBuilderEJB21 = new
MetaDataBuilderEJB21();
+
+ /**
+ * Constructor.
+ */
+ public ContainerMetaDataDeploymentAspect() {
+ super();
+ }
+
+ /**
+ * Build container independent meta data.
+ *
+ * @param dep webservice deployment
+ */
+ @Override
+ public void start(final Deployment dep) {
+ if (WSHelper.isJseDeployment(dep)) {
+ this.log.debug("Creating JBoss agnostic JSE meta data for deployment:
" + dep.getSimpleName());
+ if (WSHelper.hasAttachment(dep, JBossWebMetaData.class)) {
+ final JSEArchiveMetaData jseMetaData =
this.metaDataBuilderJSE.create(dep);
+ dep.addAttachment(JSEArchiveMetaData.class, jseMetaData);
+ }
+ }
+ else if (WSHelper.isJaxwsEjbDeployment(dep)) {
+ this.log.debug("Creating JBoss agnostic EJB3 meta data for deployment:
" + dep.getSimpleName());
+ final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB3.create(dep);
+ dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
+ }
+// else if (WSHelper.isJaxrpcEjbDeployment(dep))
+// {
+// this.log.debug("Creating JBoss agnostic EJB21 meta data for deployment:
" + dep.getSimpleName());
+// final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB21.create(dep);
+// dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
+// }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderEJB3.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderEJB3.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderEJB3.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.metadata;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.SLSBMetaData;
+
+/**
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class MetaDataBuilderEJB3 extends AbstractMetaDataBuilderEJB {
+ /**
+ * Constructor.
+ */
+ MetaDataBuilderEJB3() {
+ super();
+ }
+
+ /**
+ * @see AbstractMetaDataBuilderEJB#buildEnterpriseBeansMetaData(Deployment,
+ * EJBArchiveMetaData)
+ *
+ * @param dep
+ * webservice deployment
+ * @param ejbArchiveMD
+ * EJB archive meta data
+ */
+ @Override
+ protected void buildEnterpriseBeansMetaData(final Deployment dep, final
EJBArchiveMetaData ejbArchiveMD) {
+ final WebServiceDeployment ejb3Deployment = WSHelper.getRequiredAttachment(dep,
WebServiceDeployment.class);
+ final List<EJBMetaData> wsEjbsMD = new LinkedList<EJBMetaData>();
+
+ for (final WebServiceDeclaration jbossEjbMD :
ejb3Deployment.getServiceEndpoints()) {
+ this.buildEnterpriseBeanMetaData(wsEjbsMD, jbossEjbMD);
+ }
+
+ ejbArchiveMD.setEnterpriseBeans(wsEjbsMD);
+ }
+
+ /**
+ * Builds JBoss agnostic EJB meta data.
+ *
+ * @param wsEjbsMD
+ * jboss agnostic EJBs meta data
+ * @param jbossEjbMD
+ * jboss specific EJB meta data
+ */
+ private void buildEnterpriseBeanMetaData(final List<EJBMetaData> wsEjbsMD,
final WebServiceDeclaration jbossEjbMD) {
+ final EJBMetaData wsEjbMD = this.newEjbMetaData(jbossEjbMD);
+
+ if (wsEjbMD != null) {
+ // set EJB name and class
+ wsEjbMD.setEjbName(jbossEjbMD.getComponentName());
+ wsEjbMD.setEjbClass(jbossEjbMD.getComponentClassName());
+
+ /*
+ * TODO: implement final PortComponentSpec portComponentAnnotation =
+ * jbossEjbMD.getAnnotation(PortComponentSpec.class); if
+ * (portComponentAnnotation != null) { // set port component meta
+ * data wsEjbMD.setPortComponentName(portComponentAnnotation.
+ * portComponentName());
+ * wsEjbMD.setPortComponentURI(portComponentAnnotation
+ * .portComponentURI());
+ *
+ * // set security meta data final EJBSecurityMetaData
+ * wsEjbSecurityMD = new EJBSecurityMetaData();
+ * wsEjbSecurityMD.setAuthMethod
+ * (portComponentAnnotation.authMethod());
+ * wsEjbSecurityMD.setTransportGuarantee
+ * (portComponentAnnotation.transportGuarantee());
+ * wsEjbSecurityMD.setSecureWSDLAccess
+ * (portComponentAnnotation.secureWSDLAccess());
+ * wsEjbMD.setSecurityMetaData(wsEjbSecurityMD); }
+ */
+
+ wsEjbsMD.add(wsEjbMD);
+ }
+
+ }
+
+ /**
+ * Creates new JBoss agnostic EJB bean meta data model.
+ *
+ * @param jbossEjbMD
+ * jboss EJB meta data
+ * @return webservices EJB meta data
+ */
+ private EJBMetaData newEjbMetaData(final WebServiceDeclaration jbossEjbMD) {
+ return new SLSBMetaData();
+ /*
+ * TODO: implement final MessageDriven mdbAnnotation =
+ * jbossEjbMD.getAnnotation(MessageDriven.class);
+ *
+ * if (mdbAnnotation == null) { this.log.debug(
+ * "Creating JBoss agnostic EJB3 meta data for session bean: " +
+ * jbossEjbMD.getComponentClassName()); return new SLSBMetaData(); }
+ * else { this.log.debug(
+ * "Creating JBoss agnostic EJB3 meta data for message driven bean: "
+
+ * jbossEjbMD.getComponentClassName()); final MDBMetaData mdbMD = new
+ * MDBMetaData();
+ *
+ * final String destinationName =
+ * this.getActivationProperty("destination",
+ * mdbAnnotation.activationConfig());
+ * mdbMD.setDestinationJndiName(destinationName);
+ *
+ * return mdbMD; }
+ */
+ }
+
+ /**
+ * Returns activation config property value or null if not found.
+ *
+ * @param name
+ * activation property name
+ * @param activationConfigProperties
+ * activation config properties
+ * @return activation config property value
+ */
+ /*
+ * private String getActivationProperty(final String name, final
+ * ActivationConfigProperty[] activationConfigProperties) { if
+ * (activationConfigProperties != null) { for (final
+ * ActivationConfigProperty activationConfigProperty :
+ * activationConfigProperties) { if
+ * (activationConfigProperty.propertyName().equals(name)) { return
+ * activationConfigProperty.propertyValue(); } } }
+ *
+ * return null; }
+ */
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderJSE.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderJSE.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/MetaDataBuilderJSE.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,260 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.metadata;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ear.spec.ModuleMetaData;
+import org.jboss.metadata.ear.spec.WebModuleMetaData;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+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.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.ws.common.integration.WSConstants;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
+import org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter;
+
+/**
+ * Builds container independent meta data from WEB container meta data.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+final class MetaDataBuilderJSE {
+ /** Logger. */
+ private final Logger log = Logger.getLogger(MetaDataBuilderJSE.class);
+
+ /**
+ * Constructor.
+ */
+ MetaDataBuilderJSE() {
+ super();
+ }
+
+ /**
+ * Builds universal JSE meta data model that is AS agnostic.
+ *
+ * @param dep webservice deployment
+ * @return universal JSE meta data model
+ */
+ JSEArchiveMetaData create(final Deployment dep) {
+ final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep,
JBossWebMetaData.class);
+ final JSEArchiveMetaData jseArchiveMD = new JSEArchiveMetaData();
+
+ // set context root
+ final String contextRoot = this.getContextRoot(dep, jbossWebMD);
+ jseArchiveMD.setContextRoot(contextRoot);
+
+ // set servlet url patterns mappings
+ final Map<String, String> servletMappings =
this.getServletUrlPatternsMappings(jbossWebMD);
+ jseArchiveMD.setServletMappings(servletMappings);
+
+ // set servlet class names mappings
+ final Map<String, String> servletClassNamesMappings =
this.getServletClassMappings(jbossWebMD);
+ jseArchiveMD.setServletClassNames(servletClassNamesMappings);
+
+ // set security domain
+ final String securityDomain = jbossWebMD.getSecurityDomain();
+ jseArchiveMD.setSecurityDomain(securityDomain);
+
+ // set wsdl location resolver
+ final PublishLocationAdapter resolver = new
PublishLocationAdapterImpl(jbossWebMD.getWebserviceDescriptions());
+ jseArchiveMD.setPublishLocationAdapter(resolver);
+
+ // set security meta data
+ final List<JSESecurityMetaData> jseSecurityMDs =
this.getSecurityMetaData(jbossWebMD.getSecurityConstraints());
+ jseArchiveMD.setSecurityMetaData(jseSecurityMDs);
+
+ // set config name and file
+ this.setConfigNameAndFile(jseArchiveMD, jbossWebMD);
+
+ return jseArchiveMD;
+ }
+
+ /**
+ * Sets config name and config file.
+ *
+ * @param jseArchiveMD universal JSE meta data model
+ * @param jbossWebMD jboss web meta data
+ */
+ private void setConfigNameAndFile(final JSEArchiveMetaData jseArchiveMD, final
JBossWebMetaData jbossWebMD) {
+ final WebserviceDescriptionsMetaData wsDescriptionsMD =
jbossWebMD.getWebserviceDescriptions();
+ final WebserviceDescriptionMetaData wsDescriptionMD =
ASHelper.getWebserviceDescriptionMetaData(wsDescriptionsMD);
+ if (wsDescriptionMD != null) {
+ if (wsDescriptionMD.getConfigName() != null) {
+ jseArchiveMD.setConfigName(wsDescriptionMD.getConfigName());
+ jseArchiveMD.setConfigFile(wsDescriptionMD.getConfigFile());
+
+ // ensure higher priority against web.xml context parameters
+ return;
+ }
+ }
+
+ final List<ParamValueMetaData> contextParams =
jbossWebMD.getContextParams();
+ if (contextParams != null) {
+ for (final ParamValueMetaData contextParam : contextParams) {
+ if (WSConstants.JBOSSWS_CONFIG_NAME.equals(contextParam.getParamName()))
{
+ jseArchiveMD.setConfigName(contextParam.getParamValue());
+ }
+ if (WSConstants.JBOSSWS_CONFIG_FILE.equals(contextParam.getParamName()))
{
+ jseArchiveMD.setConfigFile(contextParam.getParamValue());
+ }
+ }
+ }
+ }
+
+ /**
+ * Builds security meta data.
+ *
+ * @param securityConstraintsMD security constraints meta data
+ * @return universal JSE security meta data model
+ */
+ private List<JSESecurityMetaData> getSecurityMetaData(final
List<SecurityConstraintMetaData> securityConstraintsMD) {
+ final List<JSESecurityMetaData> jseSecurityMDs = new
LinkedList<JSESecurityMetaData>();
+
+ if (securityConstraintsMD != null) {
+ for (final SecurityConstraintMetaData securityConstraintMD :
securityConstraintsMD) {
+ final JSESecurityMetaData jseSecurityMD = new JSESecurityMetaData();
+
+ // transport guarantee
+
jseSecurityMD.setTransportGuarantee(securityConstraintMD.getTransportGuarantee().name());
+
+ // web resources
+ this.setWebResources(jseSecurityMD, securityConstraintMD);
+
+ jseSecurityMDs.add(jseSecurityMD);
+ }
+ }
+
+ return jseSecurityMDs;
+ }
+
+ /**
+ * Sets web resources in universal meta data model.
+ *
+ * @param jseSecurityMD universal JSE security meta data model
+ * @param securityConstraintMD security constraint meta data
+ */
+ private void setWebResources(final JSESecurityMetaData jseSecurityMD, final
SecurityConstraintMetaData securityConstraintMD) {
+ final WebResourceCollectionsMetaData webResources =
securityConstraintMD.getResourceCollections();
+
+ for (final WebResourceCollectionMetaData webResourceMD : webResources) {
+ final JSEResourceCollection jseResource =
jseSecurityMD.addWebResource(webResourceMD.getName());
+
+ for (final String webResourceUrlPatterns : webResourceMD.getUrlPatterns()) {
+ jseResource.addPattern(webResourceUrlPatterns);
+ }
+ }
+ }
+
+ /**
+ * Returns servlet name to url pattern mappings.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlet name to url pattern mappings
+ */
+ private Map<String, String> getServletUrlPatternsMappings(final
JBossWebMetaData jbossWebMD) {
+ final Map<String, String> mappings = new HashMap<String, String>();
+ final List<ServletMappingMetaData> servletMappings =
jbossWebMD.getServletMappings();
+
+ if (servletMappings != null) {
+ for (final ServletMappingMetaData mapping : servletMappings) {
+ mappings.put(mapping.getServletName(), mapping.getUrlPatterns().get(0));
+ }
+ }
+
+ return mappings;
+ }
+
+ /**
+ * Returns servlet name to servlet class mappings.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @return servlet name to servlet mappings
+ */
+ private Map<String, String> getServletClassMappings(final JBossWebMetaData
jbossWebMD) {
+ final Map<String, String> mappings = new HashMap<String, String>();
+ final JBossServletsMetaData servlets = jbossWebMD.getServlets();
+
+ if (servlets != null) {
+ for (final ServletMetaData servlet : servlets) {
+ if (servlet.getServletClass() == null ||
servlet.getServletClass().trim().length() == 0) {
+ // Skip JSPs
+ continue;
+ }
+
+ this.log.debug("Creating JBoss agnostic JSE meta data for POJO bean:
" + servlet.getServletClass());
+ mappings.put(servlet.getName(), servlet.getServletClass());
+ }
+ }
+
+ return mappings;
+ }
+
+ /**
+ * Returns context root associated with webservice deployment.
+ *
+ * If there's application.xml descriptor provided defining nested web module,
then context root defined there will be
+ * returned. Otherwise context root defined in jboss-web.xml will be returned.
+ *
+ * @param dep webservice deployment
+ * @param jbossWebMD jboss web meta data
+ * @return context root
+ */
+ private String getContextRoot(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep,
DeploymentUnit.class);
+ final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null :
ASHelper.getOptionalAttachment(unit.getParent(),
+ WSAttachmentKeys.JBOSS_APP_METADATA_KEY);
+
+ String contextRoot = null;
+
+ if (jbossAppMD != null) {
+ final ModuleMetaData moduleMD = jbossAppMD.getModule(dep.getSimpleName());
+ if (moduleMD != null) {
+ final WebModuleMetaData webModuleMD = (WebModuleMetaData)
moduleMD.getValue();
+ contextRoot = webModuleMD.getContextRoot();
+ }
+ }
+
+ // prefer context root defined in application.xml over one defined in
jboss-web.xml
+ return contextRoot != null ? contextRoot : jbossWebMD.getContextRoot();
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/PublishLocationAdapterImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/PublishLocationAdapterImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/PublishLocationAdapterImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.metadata;
+
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter;
+
+/**
+ * Publish location adapter implementation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class PublishLocationAdapterImpl implements PublishLocationAdapter {
+ /** Webservice descriptions meta data. */
+ private final WebserviceDescriptionsMetaData wsDescriptionsMD;
+
+ /**
+ * Constructor.
+ *
+ * @param wsDescriptionsMD webservice descriptions meta data
+ */
+ PublishLocationAdapterImpl(final WebserviceDescriptionsMetaData wsDescriptionsMD) {
+ super();
+
+ this.wsDescriptionsMD = wsDescriptionsMD;
+ }
+
+ /**
+ * @see
org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter#getWsdlPublishLocationByName(String)
+ *
+ * @param endpointName endpoint name
+ * @return publish location
+ */
+ public String getWsdlPublishLocationByName(final String endpointName) {
+ if (this.wsDescriptionsMD != null) {
+ final WebserviceDescriptionMetaData endpointMD =
this.wsDescriptionsMD.get(endpointName);
+
+ if (endpointMD != null) {
+ return endpointMD.getWsdlPublishLocation();
+ }
+ }
+
+ return null;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeclaration.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeclaration.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeclaration.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.webservices.metadata;
+
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.DotName;
+
+/**
+ * A minimum web service meta data representation that offers a generic
+ * way to access more fine grained meta data through {@link #getAnnotation(Class)}
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+// TODO: get rid of this class
+@Deprecated
+public interface WebServiceDeclaration {
+ /**
+ * A distinct identifier across deployments.<br>
+ * In case of EJB3 this would be the <code>ObjectName</code> under which
get's registered with the MC.
+ * @return
+ */
+ String getContainerName();
+
+ /**
+ * An identifier within a deployment.
+ * In case of EJB3 this would be the <code>ejb-name</code>.
+ * @return a name, that can be used to susequently address the service impl.
+ */
+ String getComponentName();
+
+ /**
+ * Web service endpoint implementation class
+ * @return
+ */
+ String getComponentClassName();
+
+ /**
+ * Get a unified meta data view represented by an annotation.
+ *
+ * @param t
+ * @return
+ */
+ AnnotationInstance getAnnotation(DotName dotName);
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeployment.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeployment.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/metadata/WebServiceDeployment.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.webservices.metadata;
+
+import java.util.List;
+
+/**
+ * A web service deployment contains {@link WebServiceDeclaration} declarations.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+// TODO: get rid of this class
+@Deprecated
+public interface WebServiceDeployment {
+ List<WebServiceDeclaration> getServiceEndpoints();
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/parser/WSDeploymentAspectParser.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/parser/WSDeploymentAspectParser.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/parser/WSDeploymentAspectParser.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,390 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.parser;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.jboss.wsf.spi.util.StAXUtils.match;
+
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.ws.common.JavaUtils;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.util.StAXUtils;
+
+/**
+ * A parser for WS deployment aspects
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Jan-2011
+ *
+ */
+public class WSDeploymentAspectParser {
+
+ private static final String NS = "urn:jboss:ws:deployment:aspects:1.0";
+ private static final String DEPLOYMENT_ASPECTS = "deploymentAspects";
+ private static final String DEPLOYMENT_ASPECT = "deploymentAspect";
+ private static final String CLASS = "class";
+ private static final String PRIORITY = "priority";
+ private static final String PROPERTY = "property";
+ private static final String NAME = "name";
+ private static final String MAP = "map";
+ private static final String KEY_CLASS = "keyClass";
+ private static final String VALUE_CLASS = "valueClass";
+ private static final String ENTRY = "entry";
+ private static final String KEY = "key";
+ private static final String VALUE = "value";
+ private static final String LIST = "list";
+ private static final String ELEMENT_CLASS = "elementClass";
+
+ public static List<DeploymentAspect> parse(InputStream is, ClassLoader loader)
{
+ try {
+ XMLStreamReader xmlr = StAXUtils.createXMLStreamReader(is);
+ return parse(xmlr, loader);
+ } catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public static List<DeploymentAspect> parse(XMLStreamReader reader, ClassLoader
loader) throws XMLStreamException {
+ int iterate;
+ try {
+ iterate = reader.nextTag();
+ } catch (XMLStreamException e) {
+ // skip non-tag elements
+ iterate = reader.nextTag();
+ }
+ List<DeploymentAspect> deploymentAspects = null;
+ switch (iterate) {
+ case END_ELEMENT: {
+ // we're done
+ break;
+ }
+ case START_ELEMENT: {
+
+ if (match(reader, NS, DEPLOYMENT_ASPECTS)) {
+ deploymentAspects = parseDeploymentAspects(reader, loader);
+ } else {
+ throw new IllegalStateException("Unexpected element: " +
reader.getLocalName());
+ }
+ }
+ }
+ return deploymentAspects;
+ }
+
+ private static List<DeploymentAspect> parseDeploymentAspects(XMLStreamReader
reader, ClassLoader loader) throws XMLStreamException {
+ List<DeploymentAspect> deploymentAspects = new
LinkedList<DeploymentAspect>();
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, DEPLOYMENT_ASPECTS)) {
+ return deploymentAspects;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, DEPLOYMENT_ASPECT)) {
+ deploymentAspects.add(parseDeploymentAspect(reader, loader));
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ private static DeploymentAspect parseDeploymentAspect(XMLStreamReader reader,
ClassLoader loader) throws XMLStreamException {
+ String deploymentAspectClass = reader.getAttributeValue(null, CLASS);
+ if (deploymentAspectClass == null) {
+ throw new IllegalStateException("Could not find class attribute for
deployment aspect!");
+ }
+ DeploymentAspect deploymentAspect = null;
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends DeploymentAspect> clazz = (Class<? extends
DeploymentAspect>) Class.forName(deploymentAspectClass, true, loader);
+ ClassLoader orig = getContextClassLoader();
+ try {
+ setContextClassLoader(loader);
+ deploymentAspect = clazz.newInstance();
+ } finally {
+ setContextClassLoader(orig);
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException("Could not create a deploymeny aspect of
class: " + deploymentAspectClass, e);
+ }
+ String priority = reader.getAttributeValue(null, PRIORITY);
+ if (priority != null) {
+ deploymentAspect.setRelativeOrder(Integer.parseInt(priority.trim()));
+ }
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, DEPLOYMENT_ASPECT)) {
+ return deploymentAspect;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, PROPERTY)) {
+ parseProperty(reader, deploymentAspect, loader);
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static void parseProperty(XMLStreamReader reader, DeploymentAspect
deploymentAspect, ClassLoader loader) throws XMLStreamException {
+ Class<? extends DeploymentAspect> deploymentAspectClass =
deploymentAspect.getClass();
+ String propName = reader.getAttributeValue(null, NAME);
+ if (propName == null) {
+ throw new IllegalStateException("Could not find property name attribute
for deployment aspect: " + deploymentAspect);
+ }
+ String propClass = reader.getAttributeValue(null, CLASS);
+ if (propClass == null) {
+ throw new IllegalStateException("Could not find property class attribute
for deployment aspect: "
+ + deploymentAspect);
+ } else {
+ try {
+ if (isSupportedPropertyClass(propClass)) {
+ Method m = selectMethod(deploymentAspectClass, propName, propClass);
+ m.invoke(deploymentAspect, parseSimpleValue(reader, propClass));
+ return;
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, PROPERTY)) {
+ return;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, MAP)) {
+ try {
+ Method m = selectMethod(deploymentAspectClass, propName,
propClass);
+ Map map = parseMapProperty(reader, propClass,
reader.getAttributeValue(null, KEY_CLASS),
+ reader.getAttributeValue(null, VALUE_CLASS),
loader);
+ m.invoke(deploymentAspect, map);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ } else if (match(reader, NS, LIST)) {
+ try {
+ Method m = selectMethod(deploymentAspectClass, propName,
propClass);
+ List list = parseListProperty(reader, propClass,
reader.getAttributeValue(null, ELEMENT_CLASS));
+ m.invoke(deploymentAspect, list);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ private static Method selectMethod(Class<?> deploymentAspectClass, String
propName, String propClass) throws ClassNotFoundException {
+ //TODO improve this (better support for primitives, edge cases, etc.)
+ Method[] methods = deploymentAspectClass.getMethods();
+ for (Method m : methods) {
+ if (m.getName().equals("set" + JavaUtils.capitalize(propName))) {
+ Class<?>[] pars = m.getParameterTypes();
+ if (pars.length == 1 && (propClass.equals(pars[0].getName()) ||
(pars[0].isAssignableFrom(Class.forName(propClass))))) {
+ return m;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static boolean isSupportedPropertyClass(String propClass) {
+ return (String.class.getName().equals(propClass) ||
Boolean.class.getName().equals(propClass) || Integer.class
+ .getName().equals(propClass) || JavaUtils.isPrimitive(propClass));
+ }
+
+ private static Object parseSimpleValue(XMLStreamReader reader, String propClass)
throws XMLStreamException {
+ if (String.class.getName().equals(propClass)) {
+ return StAXUtils.elementAsString(reader);
+ } else if (Boolean.class.getName().equals(propClass)) {
+ return StAXUtils.elementAsBoolean(reader);
+ } else if (Integer.class.getName().equals(propClass)) {
+ return StAXUtils.elementAsInt(reader);
+ } else if (boolean.class.getName().equals(propClass)) {
+ return StAXUtils.elementAsBoolean(reader);
+ } else {
+ throw new IllegalArgumentException("Unsupported property class: " +
propClass);
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private static List parseListProperty(XMLStreamReader reader, String propClass,
String elementClass)
+ throws XMLStreamException {
+ List list = null;
+ try {
+ list = (List) Class.forName(propClass).newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException("Could not create list of type: " +
propClass, e);
+ }
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, LIST)) {
+ return list;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, VALUE)) {
+ list.add(parseSimpleValue(reader, elementClass));
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static Map parseMapProperty(XMLStreamReader reader, String propClass, String
keyClass, String valueClass, ClassLoader loader)
+ throws XMLStreamException {
+ Map map = null;
+ try {
+ map = (Map) Class.forName(propClass, true, loader).newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException("Could not create map of type: " +
propClass, e);
+ }
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, MAP)) {
+ return map;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, ENTRY)) {
+ parseMapEntry(reader, map, keyClass, valueClass);
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private static void parseMapEntry(XMLStreamReader reader, Map map, String keyClass,
String valueClass)
+ throws XMLStreamException {
+ boolean keyStartDone = false, valueStartDone = false;
+ Object key = null;
+ Object value = null;
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case XMLStreamConstants.END_ELEMENT: {
+ if (match(reader, NS, ENTRY) && keyStartDone &&
valueStartDone) {
+ map.put(key, value);
+ return;
+ } else {
+ throw new IllegalStateException("Unexpected end tag: "
+ reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT: {
+ if (match(reader, NS, KEY)) {
+ keyStartDone = true;
+ key = parseSimpleValue(reader, keyClass);
+ } else if (match(reader, NS, VALUE)) {
+ valueStartDone = true;
+ value = parseSimpleValue(reader, valueClass);
+ } else {
+ throw new IllegalStateException("Unexpected element: "
+ reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document
unexpectedly");
+ }
+
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ private static ClassLoader getContextClassLoader() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ return Thread.currentThread().getContextClassLoader();
+ } else {
+ return AccessController.doPrivileged(new
PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ private static void setContextClassLoader(final ClassLoader classLoader) {
+ if (System.getSecurityManager() == null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorFactoryImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorFactoryImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorFactoryImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.security;
+
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+
+/**
+ * Security adapters factory.
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+public final class SecurityAdaptorFactoryImpl extends SecurityAdaptorFactory {
+ /**
+ * Constructor.
+ */
+ public SecurityAdaptorFactoryImpl() {
+ super();
+ }
+
+ /**
+ * Creates new security adapter instance.
+ *
+ * @return security adapter
+ */
+ public SecurityAdaptor newSecurityAdapter() {
+ return new SecurityAdaptorImpl();
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityAdaptorImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.security;
+
+import java.security.Principal;
+
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+/**
+ * The JBoss AS specific SecurityAssociation adapter.
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+final class SecurityAdaptorImpl implements SecurityAdaptor {
+ /**
+ * Constructor.
+ */
+ SecurityAdaptorImpl() {
+ super();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
+ *
+ * @return principal
+ */
+ public Principal getPrincipal() {
+ return SecurityContextAssociation.getPrincipal();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
+ *
+ * @param principal principal
+ */
+ public void setPrincipal(final Principal principal) {
+ SecurityContextAssociation.setPrincipal(principal);
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
+ *
+ * @return credential
+ */
+ public Object getCredential() {
+ return SecurityContextAssociation.getCredential();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
+ *
+ * @param credential credential
+ */
+ public void setCredential(final Object credential) {
+ SecurityContextAssociation.setCredential(credential);
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityDomainContextAdaptor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityDomainContextAdaptor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/security/SecurityDomainContextAdaptor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.security;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.SecurityContextFactory;
+
+/**
+ * Adaptor of org.jboss.as.security.plugins.SecurityDomainContext to
org.jboss.wsf.spi.security.SecurityDomainContext
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-May-2011
+ */
+public final class SecurityDomainContextAdaptor implements
org.jboss.wsf.spi.security.SecurityDomainContext {
+
+ private SecurityDomainContext context;
+
+ public SecurityDomainContextAdaptor(SecurityDomainContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public boolean isValid(Principal principal, Object credential, Subject activeSubject)
{
+ return context.getAuthenticationManager().isValid(principal, credential,
activeSubject);
+ }
+
+ @Override
+ public boolean doesUserHaveRole(Principal principal, Set<Principal> roles) {
+ return context.getAuthorizationManager().doesUserHaveRole(principal, roles);
+ }
+
+ @Override
+ public String getSecurityDomain() {
+ return context.getAuthenticationManager().getSecurityDomain();
+ }
+
+ @Override
+ public Set<Principal> getUserRoles(Principal principal) {
+ return context.getAuthorizationManager().getUserRoles(principal);
+ }
+
+ @Override
+ public void pushSubjectContext(final Subject subject, final Principal principal,
final Object credential) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+ public Void run() {
+ SecurityContext securityContext =
SecurityContextAssociation.getSecurityContext();
+ if (securityContext == null) {
+ securityContext = createSecurityContext(getSecurityDomain());
+ setSecurityContextOnAssociation(securityContext);
+ }
+ securityContext.getUtil().createSubjectInfo(principal, credential,
subject);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create a JBoss Security Context with the given security domain name
+ *
+ * @param domain the security domain name (such as "other" )
+ * @return an instanceof {@code SecurityContext}
+ */
+ private static SecurityContext createSecurityContext(final String domain) {
+ return AccessController.doPrivileged(new
PrivilegedAction<SecurityContext>() {
+
+ @Override
+ public SecurityContext run() {
+ try {
+ return SecurityContextFactory.createSecurityContext(domain);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * Set the {@code SecurityContext} on the {@code SecurityContextAssociation}
+ *
+ * @param sc the security context
+ */
+ private static void setSecurityContextOnAssociation(final SecurityContext sc) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+ @Override
+ public Void run() {
+ SecurityContextAssociation.setSecurityContext(sc);
+ return null;
+ }
+ });
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointRegistryService.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointRegistryService.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointRegistryService.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.service;
+
+import javax.management.MBeanServer;
+
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.logging.Logger;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceListener;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.ServiceTarget;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.ws.common.management.DefaultEndpointRegistry;
+import org.jboss.ws.common.management.ManagedEndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+
+/**
+ * The service for the endpoint registry
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class EndpointRegistryService implements Service<EndpointRegistry> {
+
+ private static final Logger log = Logger.getLogger(EndpointRegistryService.class);
+ private static final ServiceName MBEAN_SERVER_NAME =
ServiceName.JBOSS.append("mbean", "server");
+ private static final EndpointRegistryService INSTANCE = new
EndpointRegistryService();
+
+ private EndpointRegistry registry;
+ private InjectedValue<MBeanServer> injectedMBeanServer = new
InjectedValue<MBeanServer>();
+
+ private EndpointRegistryService() {
+ // forbidden inheritance
+ }
+
+ @Override
+ public EndpointRegistry getValue() {
+ return registry;
+ }
+
+ @Override
+ public void start(final StartContext context) throws StartException {
+ log.tracef("Starting %s", EndpointRegistryService.class.getName());
+ if (injectedMBeanServer.getValue() != null) {
+ final ManagedEndpointRegistry managedEndpointRegistry = new
ManagedEndpointRegistry();
+ managedEndpointRegistry.setMbeanServer(injectedMBeanServer.getValue());
+ registry = managedEndpointRegistry;
+ } else {
+ registry = new DefaultEndpointRegistry();
+ }
+ }
+
+ @Override
+ public void stop(final StopContext context) {
+ log.tracef("Stopping %s", EndpointRegistryService.class.getName());
+ }
+
+ private InjectedValue<MBeanServer> getMBeanServerInjector() {
+ return injectedMBeanServer;
+ }
+
+ public static ServiceController<?> install(final ServiceTarget serviceTarget,
final ServiceListener<Object>... listeners) {
+ final ServiceBuilder<EndpointRegistry> builder =
serviceTarget.addService(WSServices.REGISTRY_SERVICE, INSTANCE);
+ builder.addDependency(DependencyType.REQUIRED, MBEAN_SERVER_NAME,
MBeanServer.class, INSTANCE.getMBeanServerInjector());
+ builder.addListener(listeners);
+ builder.setInitialMode(Mode.ACTIVE);
+ return builder.install();
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointService.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointService.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/EndpointService.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.as.webservices.service;
+
+import javax.management.ObjectName;
+
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.as.security.service.SecurityDomainService;
+import org.jboss.as.webservices.security.SecurityDomainContextAdaptor;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.msc.inject.Injector;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.ServiceTarget;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityUtil;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * WS endpoint service; this is meant for setting the lazy deployment time info into the
Endpoint (stuff coming from
+ * dependencies upon other AS services that are started during the deployment)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-May-2011
+ */
+public final class EndpointService implements Service<Endpoint> {
+
+ private static final Logger log = Logger.getLogger(EndpointService.class);
+ private final Endpoint endpoint;
+ private ServiceName name;
+ private final InjectedValue<SecurityDomainContext> securityDomainContextValue =
new InjectedValue<SecurityDomainContext>();
+
+ private EndpointService(final Endpoint endpoint) {
+ this.endpoint = endpoint;
+ final ObjectName on = endpoint.getName();
+ this.name =
WSServices.ENDPOINT_SERVICE.append(on.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT)).append(
+ on.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT));
+ }
+
+ @Override
+ public Endpoint getValue() {
+ return endpoint;
+ }
+
+ public ServiceName getName() {
+ return name;
+ }
+
+ @Override
+ public void start(final StartContext context) throws StartException {
+ log.infof("Starting %s", name);
+ endpoint.setSecurityDomainContext(new
SecurityDomainContextAdaptor(securityDomainContextValue.getValue()));
+ }
+
+ @Override
+ public void stop(final StopContext context) {
+ log.infof("Stopping %s", name);
+ endpoint.setSecurityDomainContext(null);
+ }
+
+ /**
+ * Target {@code Injector}
+ *
+ * @return target
+ */
+ public Injector<SecurityDomainContext> getSecurityDomainContextInjector() {
+ return securityDomainContextValue;
+ }
+
+ public static void install(final ServiceTarget serviceTarget, final Endpoint
endpoint) {
+ final EndpointService service = new EndpointService(endpoint);
+ final ServiceBuilder<Endpoint> builder =
serviceTarget.addService(service.getName(), service);
+ builder.addDependency(DependencyType.REQUIRED,
+
SecurityDomainService.SERVICE_NAME.append(getDeploymentSecurityDomainName(endpoint)),
+ SecurityDomainContext.class,
service.getSecurityDomainContextInjector());
+ builder.setInitialMode(Mode.ACTIVE);
+ builder.install();
+ }
+
+ private static String getDeploymentSecurityDomainName(Endpoint ep) {
+ JBossWebMetaData metadata =
ep.getService().getDeployment().getAttachment(JBossWebMetaData.class);
+ String metaDataSecurityDomain = metadata != null ? metadata.getSecurityDomain() :
null;
+ return metaDataSecurityDomain == null ?
SecurityConstants.DEFAULT_APPLICATION_POLICY : SecurityUtil
+ .unprefixSecurityDomain(metaDataSecurityDomain.trim());
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/SecurityActions.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/SecurityActions.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/SecurityActions.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.service;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Security actions helper.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class SecurityActions {
+
+ private SecurityActions() {
+ // forbidden inheritance
+ }
+
+ /**
+ * Gets context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader() {
+ if (System.getSecurityManager() == null) {
+ return Thread.currentThread().getContextClassLoader();
+ } else {
+ return AccessController.doPrivileged(new
PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Sets context classloader.
+ *
+ * @param classLoader
+ * the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader) {
+ if (System.getSecurityManager() == null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/ServerConfigService.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/ServerConfigService.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/service/ServerConfigService.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.service;
+
+import javax.management.MBeanServer;
+
+import org.jboss.as.server.ServerEnvironment;
+import org.jboss.as.server.ServerEnvironmentService;
+import org.jboss.as.webservices.config.ServerConfigImpl;
+import org.jboss.as.webservices.util.WSServices;
+import org.jboss.logging.Logger;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceListener;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.ServiceTarget;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
+
+/**
+ * WS server config service.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class ServerConfigService implements Service<ServerConfig> {
+
+ private static final Logger log = Logger.getLogger(ServerConfigService.class);
+ private static final ServiceName MBEAN_SERVER_NAME =
ServiceName.JBOSS.append("mbean", "server");
+ private final AbstractServerConfig serverConfig;
+
+ private ServerConfigService(final AbstractServerConfig serverConfig) {
+ this.serverConfig = serverConfig;
+ }
+
+ @Override
+ public ServerConfig getValue() {
+ return serverConfig;
+ }
+
+ @Override
+ public void start(final StartContext context) throws StartException {
+ log.tracef("Starting %s", ServerConfigService.class.getName());
+ try {
+ serverConfig.create();
+ } catch (final Exception e) {
+ log.fatal("Error while creating configuration service", e);
+ throw new StartException(e);
+ }
+ }
+
+ @Override
+ public void stop(final StopContext context) {
+ log.tracef("Stopping %s", ServerConfigService.class.getName());
+ try {
+ serverConfig.destroy();
+ } catch (final Exception e) {
+ log.error("Error while destroying configuration service", e);
+ }
+ }
+
+ public static ServiceController<?> install(final ServiceTarget serviceTarget,
final ServerConfigImpl serverConfig, final ServiceListener<Object>... listeners) {
+ final ServiceBuilder<ServerConfig> builder =
serviceTarget.addService(WSServices.CONFIG_SERVICE, new
ServerConfigService(serverConfig));
+ builder.addDependency(DependencyType.REQUIRED, MBEAN_SERVER_NAME,
MBeanServer.class, serverConfig.getMBeanServerInjector());
+ builder.addDependency(ServerEnvironmentService.SERVICE_NAME,
ServerEnvironment.class, serverConfig.getServerEnvironmentInjector());
+ builder.addListener(listeners);
+ builder.setInitialMode(Mode.ACTIVE);
+ return builder.install();
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityUtil;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+
+/**
+ * Creates web app security meta data for EJB deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+abstract class AbstractSecurityMetaDataAccessorEJB implements SecurityMetaDataAccessorEJB
{
+
+ /**
+ * Constructor.
+ */
+ protected AbstractSecurityMetaDataAccessorEJB() {
+ super();
+ }
+
+ /**
+ * Appends 'java:jboss/jaas/' prefix to security domain if it's not
prefixed with it.
+ *
+ * @param securityDomain security domain to be prefixed
+ * @return security domain prefixed with jaas JNDI prefix
+ */
+ protected final String appendJaasPrefix(final String securityDomain) {
+ if (securityDomain != null) {
+ SecurityUtil.unprefixSecurityDomain(securityDomain);
+ return SecurityConstants.JAAS_CONTEXT_ROOT + securityDomain;
+ }
+
+ return securityDomain;
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#getAuthMethod(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return authentication method or null if not specified
+ */
+ public String getAuthMethod(final Endpoint endpoint) {
+ final EJBSecurityMetaData ejbSecurityMD = this.getEjbSecurityMetaData(endpoint);
+ final boolean hasEjbSecurityMD = ejbSecurityMD != null;
+
+ return hasEjbSecurityMD ? ejbSecurityMD.getAuthMethod() : null;
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#isSecureWsdlAccess(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return whether WSDL access have to be secured
+ */
+ public boolean isSecureWsdlAccess(final Endpoint endpoint) {
+ final EJBSecurityMetaData ejbSecurityMD = this.getEjbSecurityMetaData(endpoint);
+ final boolean hasEjbSecurityMD = ejbSecurityMD != null;
+
+ return hasEjbSecurityMD ? ejbSecurityMD.getSecureWSDLAccess() : false;
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#getTransportGuarantee(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return transport guarantee or null if not specified
+ */
+ public String getTransportGuarantee(final Endpoint endpoint) {
+ final EJBSecurityMetaData ejbSecurityMD = this.getEjbSecurityMetaData(endpoint);
+ final boolean hasEjbSecurityMD = ejbSecurityMD != null;
+
+ return hasEjbSecurityMD ? ejbSecurityMD.getTransportGuarantee() : null;
+ }
+
+ /**
+ * Gets EJB security meta data if associated with EJB endpoint.
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return EJB security meta data or null
+ */
+ private EJBSecurityMetaData getEjbSecurityMetaData(final Endpoint endpoint) {
+ final String ejbName = endpoint.getShortName();
+ final Deployment dep = endpoint.getService().getDeployment();
+ final EJBArchiveMetaData ejbArchiveMD = WSHelper.getOptionalAttachment(dep,
EJBArchiveMetaData.class);
+ final EJBMetaData ejbMD = ejbArchiveMD != null ?
ejbArchiveMD.getBeanByEjbName(ejbName) : null;
+
+ return ejbMD != null ? ejbMD.getSecurityMetaData() : null;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Creates web app security meta data for EJB deployments.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+interface SecurityMetaDataAccessorEJB {
+ /**
+ * Obtains security domain from EJB deployment.
+ *
+ * @param dep webservice deployment
+ * @return security domain associated with EJB deployment
+ */
+ String getSecurityDomain(Deployment dep);
+
+ /**
+ * Obtains security roles from EJB deployment.
+ *
+ * @param dep webservice deployment
+ * @return security roles associated with EJB deployment
+ */
+ SecurityRolesMetaData getSecurityRoles(Deployment dep);
+
+ /**
+ * Whether WSDL access have to be secured.
+ *
+ * @param endpoint webservice EJB endpoint
+ * @return authentication method or null if not specified
+ */
+ boolean isSecureWsdlAccess(Endpoint endpoint);
+
+ /**
+ * Gets EJB authentication method.
+ *
+ * @param endpoint webservice EJB endpoint
+ * @return authentication method or null if not specified
+ */
+ String getAuthMethod(Endpoint endpoint);
+
+ /**
+ * Gets EJB transport guarantee.
+ *
+ * @param endpoint webservice EJB endpoint
+ * @return transport guarantee or null if not specified
+ */
+ String getTransportGuarantee(Endpoint endpoint);
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB21.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB21.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB21.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,71 @@
+/*
+ * 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.as.webservices.tomcat;
+
+import org.jboss.metadata.common.ejb.IAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+
+/**
+ * Creates web app security meta data for EJB 21 deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class SecurityMetaDataAccessorEJB21 extends AbstractSecurityMetaDataAccessorEJB {
+
+ /**
+ * Constructor.
+ */
+ SecurityMetaDataAccessorEJB21() {
+ super();
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityDomain(Deployment)
+ *
+ * @param dep webservice deployment
+ * @return security domain associated with EJB 21 deployment
+ */
+ public String getSecurityDomain(final Deployment dep) {
+ final EJBArchiveMetaData ejbMetaData = WSHelper.getRequiredAttachment(dep,
EJBArchiveMetaData.class);
+
+ //return super.appendJaasPrefix(ejbMetaData.getSecurityDomain()); TODO: properly
removed?
+ return ejbMetaData.getSecurityDomain();
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityRoles(Deployment)
+ *
+ * @param dep webservice deployment
+ * @return security roles associated with EJB 21 deployment
+ */
+ public SecurityRolesMetaData getSecurityRoles(final Deployment dep) {
+ final JBossMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep,
JBossMetaData.class);
+ final IAssemblyDescriptorMetaData assemblyDescriptorMD =
jbossWebMD.getAssemblyDescriptor();
+
+ return (assemblyDescriptorMD != null) ? assemblyDescriptorMD.getSecurityRoles() :
null;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB3.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB3.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB3.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import java.util.Iterator;
+
+import javax.annotation.security.RolesAllowed;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.DotName;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.ws.api.annotation.WebContext;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.as.webservices.metadata.WebServiceDeclaration;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+
+/**
+ * Creates web app security meta data for EJB 3 deployment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class SecurityMetaDataAccessorEJB3 extends AbstractSecurityMetaDataAccessorEJB {
+
+ private static final DotName ROLES_ALLOWED_DOT_NAME =
DotName.createSimple(RolesAllowed.class.getName());
+ private static final DotName SECURITY_DOMAIN_DOT_NAME =
DotName.createSimple(SecurityDomain.class.getName());
+
+ /**
+ * Constructor.
+ */
+ SecurityMetaDataAccessorEJB3() {
+ super();
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityDomain(Deployment)
+ *
+ * @param dep webservice deployment
+ * @return security domain associated with EJB 3 deployment
+ */
+ public String getSecurityDomain(final Deployment dep) {
+ final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment(dep,
WebServiceDeployment.class);
+ String securityDomain = null;
+ final Iterator<WebServiceDeclaration> ejbContainers =
wsDeployment.getServiceEndpoints().iterator();
+
+ while (ejbContainers.hasNext()) {
+ final WebServiceDeclaration ejbContainer = ejbContainers.next();
+ //final SecurityDomain nextSecurityDomain =
ejbContainer.getAnnotation(SecurityDomain.class);
+ final AnnotationInstance nextSecurityDomain =
ejbContainer.getAnnotation(SECURITY_DOMAIN_DOT_NAME);
+
+ securityDomain = getDomain(securityDomain, nextSecurityDomain);
+ }
+
+ // return super.appendJaasPrefix(securityDomain); TODO: properly removed?
+ return securityDomain;
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityRoles(Deployment)
+ *
+ * @param dep webservice deployment
+ * @return security roles associated with EJB 21 deployment
+ */
+ public SecurityRolesMetaData getSecurityRoles(final Deployment dep) {
+ final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment(dep,
WebServiceDeployment.class);
+ final SecurityRolesMetaData securityRolesMD = new SecurityRolesMetaData();
+ final Iterator<WebServiceDeclaration> ejbContainers =
wsDeployment.getServiceEndpoints().iterator();
+
+ while (ejbContainers.hasNext()) {
+ final WebServiceDeclaration ejbContainer = ejbContainers.next();
+ //final RolesAllowed allowedRoles =
ejbContainer.getAnnotation(RolesAllowed.class);
+ final AnnotationInstance allowedRoles =
ejbContainer.getAnnotation(ROLES_ALLOWED_DOT_NAME);
+ final boolean hasAllowedRoles = allowedRoles != null;
+
+ if (hasAllowedRoles) {
+ for (final String roleName : allowedRoles.value().asStringArray()) {
+ final SecurityRoleMetaData securityRoleMD = new
SecurityRoleMetaData();
+
+ securityRoleMD.setRoleName(roleName);
+ securityRolesMD.add(securityRoleMD);
+ }
+ }
+ }
+
+ return securityRolesMD;
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#getAuthMethod(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return authentication method or null if not specified
+ */
+ public String getAuthMethod(final Endpoint endpoint) {
+ final WebContext webContext = this.getWebContextAnnotation(endpoint);
+ final boolean hasAuthMethod = (webContext != null) &&
(webContext.authMethod().length() > 0);
+
+ return hasAuthMethod ? webContext.authMethod() : super.getAuthMethod(endpoint);
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#isSecureWsdlAccess(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return whether WSDL access have to be secured
+ */
+ public boolean isSecureWsdlAccess(final Endpoint endpoint) {
+ final WebContext webContext = this.getWebContextAnnotation(endpoint);
+ final boolean hasSecureWsdlAccess = (webContext != null) &&
(webContext.secureWSDLAccess());
+
+ return hasSecureWsdlAccess ? true : super.isSecureWsdlAccess(endpoint);
+ }
+
+ /**
+ * @see
org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#getTransportGuarantee(Endpoint)
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return transport guarantee or null if not specified
+ */
+ public String getTransportGuarantee(final Endpoint endpoint) {
+ final WebContext webContext = this.getWebContextAnnotation(endpoint);
+ final boolean hasTransportGuarantee = (webContext != null) &&
(webContext.transportGuarantee().length() > 0);
+
+ return hasTransportGuarantee ? webContext.transportGuarantee() :
super.getTransportGuarantee(endpoint);
+ }
+
+ /**
+ * Gets <b>WebContext</b> if associated with EJB endpoint.
+ *
+ * @param endpoint EJB webservice endpoint
+ * @return web context associated with EJB or null
+ */
+ @SuppressWarnings({ "unchecked" })
+ private WebContext getWebContextAnnotation(final Endpoint endpoint) {
+ // TODO: rework to use Jandex
+ return (WebContext)
endpoint.getTargetBeanClass().getAnnotation(WebContext.class);
+ }
+
+ /**
+ * Returns security domain value. This method checks domain is the same for every EJB
3 endpoint.
+ *
+ * @param oldSecurityDomain our security domain
+ * @param nextSecurityDomain next security domain
+ * @return security domain value
+ * @throws IllegalStateException if domains have different values
+ */
+ private String getDomain(final String oldSecurityDomain, final AnnotationInstance
nextSecurityDomain) {
+ if (nextSecurityDomain == null) {
+ return oldSecurityDomain;
+ }
+
+ if (oldSecurityDomain == null) {
+ return nextSecurityDomain.value().asString();
+ }
+
+ ensureSameDomains(oldSecurityDomain, nextSecurityDomain.value().asString());
+
+ return oldSecurityDomain;
+ }
+
+ /**
+ * This method ensures both passed domains contain the same value.
+ *
+ * @param oldSecurityDomain our security domain
+ * @param newSecurityDomain next security domain
+ * @throws IllegalStateException if domains have different values
+ */
+ private void ensureSameDomains(final String oldSecurityDomain, final String
newSecurityDomain) {
+ final boolean domainsDiffer = !oldSecurityDomain.equals(newSecurityDomain);
+
+ if (domainsDiffer) {
+ final String errorMessage = "Multiple security domains not supported.
";
+ final String firstDomain = "First domain: '" +
oldSecurityDomain + "' ";
+ final String secondDomain = "second domain: '" +
newSecurityDomain + "'";
+
+ throw new IllegalStateException(errorMessage + firstDomain + secondDomain);
+ }
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/ServletDelegateFactoryImpl.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/ServletDelegateFactoryImpl.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/ServletDelegateFactoryImpl.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.ServletDelegate;
+import org.jboss.wsf.spi.deployment.ServletDelegateFactory;
+
+/**
+ * AS7 implementation of {@link org.jboss.wsf.spi.deployment.ServletDelegateFactory}
+ * that uses modular classloading for creating the delegate instance.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 06-Apr-2011
+ *
+ */
+public class ServletDelegateFactoryImpl implements ServletDelegateFactory {
+
+ @Override
+ public ServletDelegate newServletDelegate(String servletClassName) {
+ try {
+ ClassLoader classLoader =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ Class<?> clazz = classLoader.loadClass(servletClassName);
+ return (ServletDelegate) clazz.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException("Could not create servlet delegate: " +
servletClassName, e);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreatingDeploymentAspect.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreatingDeploymentAspect.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreatingDeploymentAspect.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+
+/**
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class WebMetaDataCreatingDeploymentAspect extends AbstractDeploymentAspect
{
+
+ private WebMetaDataCreator webMetaDataCreator = new WebMetaDataCreator();
+
+ /**
+ * Constructor.
+ */
+ public WebMetaDataCreatingDeploymentAspect() {
+ super();
+ }
+
+ @Override
+ public void start(final Deployment dep) {
+ final boolean isEjbDeployment = WSHelper.isEjbDeployment(dep);
+
+ if (isEjbDeployment) {
+ log.debug("Creating web meta data for EJB webservice deployment: " +
dep.getSimpleName());
+ webMetaDataCreator.create(dep);
+ }
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,371 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import java.util.List;
+
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.web.deployment.WarMetaData;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WebMetaDataHelper;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+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.WebResourceCollectionsMetaData;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.HttpEndpoint;
+
+/**
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class WebMetaDataCreator {
+
+ /** Our Realm. */
+ private static final String EJB_WEBSERVICE_REALM = "EJBWebServiceEndpointServlet
Realm";
+
+ /** EJB 21 security meta data builder. */
+ private final SecurityMetaDataAccessorEJB ejb21SecurityAccessor = new
SecurityMetaDataAccessorEJB21();
+
+ /** EJB 3 security meta data builder. */
+ private final SecurityMetaDataAccessorEJB ejb3SecurityAccessor = new
SecurityMetaDataAccessorEJB3();
+
+ /** Logger. */
+ private final Logger log = Logger.getLogger(WebMetaDataCreator.class);
+
+ /**
+ * Constructor.
+ */
+ WebMetaDataCreator() {
+ super();
+ }
+
+ /**
+ * Creates web meta data for EJB deployments.
+ *
+ * @param dep
+ * webservice deployment
+ */
+ void create(final Deployment dep) {
+ final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep,
DeploymentUnit.class);
+ WarMetaData warMD = ASHelper.getOptionalAttachment(unit,
WarMetaData.ATTACHMENT_KEY);
+ JBossWebMetaData jbossWebMD = warMD != null ? warMD.getJbossWebMetaData() :
null;
+
+ if (warMD == null) {
+ warMD = new WarMetaData();
+ }
+ if (jbossWebMD == null) {
+ jbossWebMD = new JBossWebMetaData();
+ warMD.setMergedJBossWebMetaData(jbossWebMD);
+ unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD);
+ }
+
+ createWebAppDescriptor(dep, jbossWebMD);
+ createJBossWebAppDescriptor(dep, jbossWebMD);
+
+ dep.addAttachment(JBossWebMetaData.class, jbossWebMD);
+ }
+
+ /**
+ * Creates web.xml descriptor meta data.
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createWebAppDescriptor(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ log.debug("Creating web descriptor");
+ createServlets(dep, jbossWebMD);
+ createServletMappings(dep, jbossWebMD);
+ createSecurityConstraints(dep, jbossWebMD);
+ createLoginConfig(dep, jbossWebMD);
+ createSecurityRoles(dep, jbossWebMD);
+ }
+
+ /**
+ * Creates jboss-web.xml descriptor meta data.
+ *
+ * <pre>
+ * <jboss-web>
+ *
<security-domain>java:/jaas/custom-security-domain</security-domain>
+ * <context-root>/custom-context-root</context-root>
+ * <virtual-host>host1</virtual-host>
+ * ...
+ * <virtual-host>hostN</virtual-host>
+ * </jboss-web>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createJBossWebAppDescriptor(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ log.debug("Creating jboss web descriptor");
+ final SecurityMetaDataAccessorEJB ejbMDAccessor =
getEjbSecurityMetaDataAccessor(dep);
+
+ // Set security domain
+ final String securityDomain = ejbMDAccessor.getSecurityDomain(dep);
+ final boolean hasSecurityDomain = securityDomain != null;
+
+ if (hasSecurityDomain) {
+ log.debug("Setting security domain: " + securityDomain);
+ jbossWebMD.setSecurityDomain(securityDomain);
+ }
+
+ // Set virtual hosts
+ final List<String> virtualHosts = dep.getService().getVirtualHosts();
+ log.debug("Setting virtual hosts: " + virtualHosts);
+ jbossWebMD.setVirtualHosts(virtualHosts);
+ }
+
+ /**
+ * Creates servlets part of web.xml descriptor.
+ *
+ * <pre>
+ * <servlet>
+ * <servlet-name>EJBEndpointShortName</servlet-name>
+ *
<servlet-class>EJBEndpointTargetBeanName</servlet-class>
+ * </servlet>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createServlets(final Deployment dep, final JBossWebMetaData jbossWebMD)
{
+ log.debug("Creating servlets");
+ final JBossServletsMetaData servlets =
WebMetaDataHelper.getServlets(jbossWebMD);
+
+ for (final Endpoint endpoint : dep.getService().getEndpoints()) {
+ final String endpointName = endpoint.getShortName();
+ final String endpointClassName = endpoint.getTargetBeanName();
+
+ log.debug("Servlet name: " + endpointName + ", servlet class:
" + endpointClassName);
+ WebMetaDataHelper.newServlet(endpointName, endpointClassName, servlets);
+ }
+ }
+
+ /**
+ * Creates servlet-mapping part of web.xml descriptor.
+ *
+ * <pre>
+ * <servlet-mapping>
+ * <servlet-name>EJBEndpointShortName</servlet-name>
+ * <url-pattern>EJBEndpointURLPattern</url-pattern>
+ * </servlet-mapping>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createServletMappings(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ log.debug("Creating servlet mappings");
+ final List<ServletMappingMetaData> servletMappings =
WebMetaDataHelper.getServletMappings(jbossWebMD);
+
+ for (final Endpoint ep : dep.getService().getEndpoints()) {
+ if (ep instanceof HttpEndpoint) {
+ final String endpointName = ep.getShortName();
+ final List<String> urlPatterns =
WebMetaDataHelper.getUrlPatterns(((HttpEndpoint)ep).getURLPattern());
+
+ log.debug("Servlet name: " + endpointName + ", URL
patterns: " + urlPatterns);
+ WebMetaDataHelper.newServletMapping(endpointName, urlPatterns,
servletMappings);
+ }
+ }
+ }
+
+ /**
+ * Creates security constraints part of web.xml descriptor.
+ *
+ * <pre>
+ * <security-constraint>
+ * <web-resource-collection>
+ *
<web-resource-name>EJBEndpointShortName</web-resource-name>
+ * <url-pattern>EJBEndpointURLPattern</url-pattern>
+ * <http-method>GET</http-method>
+ * <http-method>POST</http-method>
+ * </web-resource-collection>
+ * <auth-constraint>
+ * <role-name>*</role-name>
+ * </auth-constraint>
+ * <user-data-constraint>
+ *
<transport-guarantee>EjbTransportGuarantee</transport-guarantee>
+ * </user-data-constraint>
+ * </security-constraint>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployemnt
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createSecurityConstraints(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ log.debug("Creating security constraints");
+ final SecurityMetaDataAccessorEJB ejbMDAccessor =
getEjbSecurityMetaDataAccessor(dep);
+
+ for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
+ final boolean secureWsdlAccess =
ejbMDAccessor.isSecureWsdlAccess(ejbEndpoint);
+ final String transportGuarantee =
ejbMDAccessor.getTransportGuarantee(ejbEndpoint);
+ final boolean hasTransportGuarantee = transportGuarantee != null;
+ final String authMethod = ejbMDAccessor.getAuthMethod(ejbEndpoint);
+ final boolean hasAuthMethod = authMethod != null;
+
+ if (ejbEndpoint instanceof HttpEndpoint && (hasAuthMethod ||
hasTransportGuarantee)) {
+ final List<SecurityConstraintMetaData> securityConstraints =
WebMetaDataHelper
+ .getSecurityConstraints(jbossWebMD);
+
+ // security-constraint
+ final SecurityConstraintMetaData securityConstraint = WebMetaDataHelper
+ .newSecurityConstraint(securityConstraints);
+
+ // web-resource-collection
+ final WebResourceCollectionsMetaData webResourceCollections =
WebMetaDataHelper
+ .getWebResourceCollections(securityConstraint);
+ final String endpointName = ejbEndpoint.getShortName();
+ final String urlPattern = ((HttpEndpoint)ejbEndpoint).getURLPattern();
+ log.debug("Creating web resource collection for endpoint: " +
endpointName + ", URL pattern: "
+ + urlPattern);
+ WebMetaDataHelper.newWebResourceCollection(endpointName, urlPattern,
secureWsdlAccess,
+ webResourceCollections);
+
+ // auth-constraint
+ if (hasAuthMethod) {
+ log.debug("Creating auth constraint for endpoint: " +
endpointName);
+ WebMetaDataHelper.newAuthConstraint(WebMetaDataHelper.getAllRoles(),
securityConstraint);
+ }
+
+ // user-data-constraint
+ if (hasTransportGuarantee) {
+ log.debug("Creating new user data constraint for endpoint:
" + endpointName
+ + ", transport guarantee: " + transportGuarantee);
+ WebMetaDataHelper.newUserDataConstraint(transportGuarantee,
securityConstraint);
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates login-config part of web.xml descriptor.
+ *
+ * <pre>
+ * <login-config>
+ * <auth-method>EjbDeploymentAuthMethod</auth-method>
+ * <realm-name>EJBWebServiceEndpointServlet
Realm</realm-name>
+ * </login-config>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createLoginConfig(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ final String authMethod = getAuthMethod(dep);
+ final boolean hasAuthMethod = authMethod != null;
+
+ if (hasAuthMethod) {
+ log.debug("Creating new login config: " +
WebMetaDataCreator.EJB_WEBSERVICE_REALM + ", auth method: "
+ + authMethod);
+ final LoginConfigMetaData loginConfig =
WebMetaDataHelper.getLoginConfig(jbossWebMD);
+ loginConfig.setRealmName(WebMetaDataCreator.EJB_WEBSERVICE_REALM);
+ loginConfig.setAuthMethod(authMethod);
+ }
+ }
+
+ /**
+ * Creates security roles part of web.xml descriptor.
+ *
+ * <pre>
+ * <security-role>
+ * <role-name>role1</role-name>
+ * ...
+ * <role-name>roleN</role-name>
+ * </security-role>
+ * </pre>
+ *
+ * @param dep
+ * webservice deployment
+ * @param jbossWebMD
+ * jboss web meta data
+ */
+ private void createSecurityRoles(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ final String authMethod = getAuthMethod(dep);
+ final boolean hasAuthMethod = authMethod != null;
+
+ if (hasAuthMethod) {
+ final SecurityMetaDataAccessorEJB ejbMDAccessor =
getEjbSecurityMetaDataAccessor(dep);
+ final SecurityRolesMetaData securityRolesMD =
ejbMDAccessor.getSecurityRoles(dep);
+ final boolean hasSecurityRolesMD = securityRolesMD != null;
+
+ if (hasSecurityRolesMD) {
+ log.debug("Setting security roles: " + securityRolesMD);
+ jbossWebMD.setSecurityRoles(securityRolesMD);
+ }
+ }
+ }
+
+ /**
+ * Returns deployment authentication method.
+ *
+ * @param dep
+ * webservice deployment
+ * @return deployment authentication method
+ */
+ private String getAuthMethod(final Deployment dep) {
+ final SecurityMetaDataAccessorEJB ejbMDAccessor =
getEjbSecurityMetaDataAccessor(dep);
+
+ for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
+ final String beanAuthMethod = ejbMDAccessor.getAuthMethod(ejbEndpoint);
+ final boolean hasBeanAuthMethod = beanAuthMethod != null;
+
+ if (hasBeanAuthMethod) {
+ // First found auth-method defines war
+ // login-config/auth-method
+ return beanAuthMethod;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns security builder associated with EJB deployment.
+ *
+ * @param dep
+ * webservice EJB deployment
+ * @return security builder for EJB deployment
+ */
+ private SecurityMetaDataAccessorEJB getEjbSecurityMetaDataAccessor(final Deployment
dep) {
+ final boolean isJaxws = WSHelper.isJaxwsDeployment(dep);
+
+ return isJaxws ? ejb3SecurityAccessor : ejb21SecurityAccessor;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifier.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifier.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifier.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WebMetaDataHelper;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.ws.common.integration.WSConstants;
+import org.jboss.ws.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.WSFServlet;
+
+/**
+ * The modifier of jboss web meta data. It configures WS transport for every webservice
endpoint plus propagates WS stack
+ * specific context parameters if required.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
+ */
+final class WebMetaDataModifier {
+ /** Logger. */
+ private final Logger log = Logger.getLogger(WebMetaDataModifier.class);
+
+ /**
+ * Constructor.
+ */
+ WebMetaDataModifier() {
+ super();
+ }
+
+ /**
+ * Modifies web meta data to configure webservice stack transport and properties.
+ *
+ * @param dep webservice deployment
+ */
+ void modify(final Deployment dep) {
+ final JBossWebMetaData jbossWebMD = WSHelper.getOptionalAttachment(dep,
JBossWebMetaData.class);
+
+ if (jbossWebMD != null) {
+ this.configureEndpoints(dep, jbossWebMD);
+ this.modifyContextRoot(dep, jbossWebMD);
+ }
+ }
+
+ /**
+ * Configures transport servlet class for every found webservice endpoint.
+ *
+ * @param dep webservice deployment
+ * @param jbossWebMD web meta data
+ */
+ private void configureEndpoints(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ final String transportClassName = this.getTransportClassName(dep);
+ this.log.trace("Modifying servlets");
+
+ // get a list of the endpoint bean class names
+ final Set<String> epNames = new HashSet<String>();
+ for (Endpoint ep : dep.getService().getEndpoints()) {
+ epNames.add(ep.getTargetBeanName());
+ }
+
+ // fix servlet class names for endpoints
+ for (final ServletMetaData servletMD : jbossWebMD.getServlets()) {
+ final String endpointClassName = ASHelper.getEndpointName(servletMD);
+ if (endpointClassName != null && endpointClassName.length() > 0) {
// exclude JSP
+ if (epNames.contains(endpointClassName)) {
+ // set transport servlet
+ servletMD.setServletClass(WSFServlet.class.getName());
+ this.log.debug("Setting transport class: " +
transportClassName + " for servlet: " + endpointClassName);
+ final List<ParamValueMetaData> initParams =
WebMetaDataHelper.getServletInitParams(servletMD);
+ // configure transport class name
+
WebMetaDataHelper.newParamValue(WSFServlet.STACK_SERVLET_DELEGATE_CLASS,
transportClassName, initParams);
+ // configure webservice endpoint
+ WebMetaDataHelper.newParamValue(Endpoint.SEPID_DOMAIN_ENDPOINT,
endpointClassName, initParams);
+ }
+ }
+ }
+ }
+
+ /**
+ * Modifies context root.
+ *
+ * @param dep webservice deployment
+ * @param jbossWebMD web meta data
+ */
+ private void modifyContextRoot(final Deployment dep, final JBossWebMetaData
jbossWebMD) {
+ final String contextRoot = dep.getService().getContextRoot();
+ this.log.debug("Setting context root: " + contextRoot + " for
deployment: " + dep.getSimpleName());
+ jbossWebMD.setContextRoot(contextRoot);
+ }
+
+ /**
+ * Returns stack specific transport class name.
+ *
+ * @param dep webservice deployment
+ * @return stack specific transport class name
+ * @throws IllegalStateException if transport class name is not found in deployment
properties map
+ */
+ private String getTransportClassName(final Deployment dep) {
+ String transportClassName = (String)
dep.getProperty(WSConstants.STACK_TRANSPORT_CLASS);
+
+ if (transportClassName == null) {
+ throw new IllegalStateException("Cannot obtain deployment property :
" + WSConstants.STACK_TRANSPORT_CLASS);
+ }
+
+ return transportClassName;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifyingDeploymentAspect.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifyingDeploymentAspect.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataModifyingDeploymentAspect.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.tomcat;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+
+/**
+ * Modifies web meta data to configure webservice stack endpoints and properties.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class WebMetaDataModifyingDeploymentAspect extends AbstractDeploymentAspect
{
+ /** Web meta data modifier. */
+ private WebMetaDataModifier webMetaDataModifier = new WebMetaDataModifier();
+
+ /**
+ * Constructor.
+ */
+ public WebMetaDataModifyingDeploymentAspect() {
+ super();
+ }
+
+ /**
+ * Modifies web meta data.
+ *
+ * @param dep webservice deployment
+ */
+ @Override
+ public void start(final Deployment dep) {
+ this.log.debug("Modifying web meta data for webservice deployment: " +
dep.getSimpleName());
+ this.webMetaDataModifier.modify(dep);
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ASHelper.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ASHelper.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ASHelper.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,293 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.annotation.CompositeIndex;
+import org.jboss.as.web.deployment.WarMetaData;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.as.webservices.metadata.WebServiceDeclaration;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+
+/**
+ * JBoss AS integration helper class.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ * @author <a href="alessio.soldano(a)jboss.com">Alessio Soldano</a>
+ */
+public final class ASHelper {
+
+ /**
+ * EJB invocation property.
+ */
+ public static final String CONTAINER_NAME =
"org.jboss.wsf.spi.invocation.ContainerName";
+
+ /** Logger. */
+ private static final Logger LOGGER = Logger.getLogger(ASHelper.class);
+
+ /** @WebService jandex annotation. */
+ public static final DotName WEB_SERVICE_ANNOTATION =
DotName.createSimple(WebService.class.getName());
+
+ /** @WebServiceProvider jandex annotation. */
+ public static final DotName WEB_SERVICE_PROVIDER_ANNOTATION =
DotName.createSimple(WebServiceProvider.class.getName());
+
+ /**
+ * Forbidden constructor.
+ */
+ private ASHelper() {
+ super();
+ }
+
+ /**
+ * Returns true if unit contains JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB
deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment, false
otherwise.
+ */
+ public static boolean isWebServiceDeployment(final DeploymentUnit unit) {
+ return ASHelper.getOptionalAttachment(unit, WSAttachmentKeys.DEPLOYMENT_TYPE_KEY)
!= null;
+ }
+
+ /**
+ * Gets list of JAXWS servlets meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXWS servlets meta data
+ */
+ public static List<ServletMetaData> getJaxwsServlets(final DeploymentUnit unit)
{
+ return ASHelper.getWebServiceServlets(unit, true);
+ }
+
+ /**
+ * Gets list of JAXRPC servlets meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXRPC servlets meta data
+ */
+ public static List<ServletMetaData> getJaxrpcServlets(final DeploymentUnit
unit) {
+ return ASHelper.getWebServiceServlets(unit, false);
+ }
+
+ /**
+ * Gets list of JAXWS EJBs meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXWS EJBs meta data
+ */
+ public static List<WebServiceDeclaration> getJaxwsEjbs(final DeploymentUnit
unit) {
+ final WebServiceDeployment wsDeployment = ASHelper.getRequiredAttachment(unit,
WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY);
+
+ return Collections.unmodifiableList(wsDeployment.getServiceEndpoints());
+ }
+
+ /**
+ * Returns endpoint class name.
+ *
+ * @param servletMD servlet meta data
+ * @return endpoint class name
+ */
+ public static String getEndpointName(final ServletMetaData servletMD) {
+ final String endpointClass = servletMD.getServletClass();
+
+ return endpointClass != null ? endpointClass.trim() : null;
+ }
+
+ /**
+ * Returns servlet meta data for requested servlet name.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @param servletName servlet name
+ * @return servlet meta data
+ */
+ public static ServletMetaData getServletForName(final JBossWebMetaData jbossWebMD,
final String servletName) {
+ for (JBossServletMetaData servlet : jbossWebMD.getServlets()) {
+ if (servlet.getName().equals(servletName)) {
+ return servlet;
+ }
+ }
+
+ throw new IllegalStateException("Cannot find servlet for link: " +
servletName);
+ }
+
+ /**
+ * Returns required attachment value from deployment unit.
+ *
+ * @param <A> expected value
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return required attachment
+ * @throws IllegalStateException if attachment value is null
+ */
+ public static <A> A getRequiredAttachment(final DeploymentUnit unit, final
AttachmentKey<A> key) {
+ final A value = unit.getAttachment(key);
+ if (value == null) {
+ ASHelper.LOGGER.error("Cannot find attachment in deployment unit: "
+ key);
+ throw new IllegalStateException();
+ }
+
+ return value;
+ }
+
+ /**
+ * Returns optional attachment value from deployment unit or null if not bound.
+ *
+ * @param <A> expected value
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return optional attachment value or null
+ */
+ public static <A> A getOptionalAttachment(final DeploymentUnit unit, final
AttachmentKey<A> key) {
+ return unit.getAttachment(key);
+ }
+
+ /**
+ * Returns true if deployment unit have attachment value associated with the
<b>key</b>.
+ *
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return true if contains attachment, false otherwise
+ */
+ public static boolean hasAttachment(final DeploymentUnit unit, final
AttachmentKey<?> key) {
+ return ASHelper.getOptionalAttachment(unit, key) != null;
+ }
+
+ /**
+ * Returns first webservice description meta data or null if not found.
+ *
+ * @param wsDescriptionsMD webservice descriptions
+ * @return webservice description
+ */
+ public static WebserviceDescriptionMetaData getWebserviceDescriptionMetaData(
+ final WebserviceDescriptionsMetaData wsDescriptionsMD) {
+ if (wsDescriptionsMD != null) {
+ if (wsDescriptionsMD.size() > 1) {
+ ASHelper.LOGGER.warn("Multiple <webservice-description>
elements not supported");
+ }
+
+ if (wsDescriptionsMD.size() > 0) {
+ return wsDescriptionsMD.iterator().next();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets list of JAXRPC or JAXWS servlets meta data.
+ *
+ * @param unit deployment unit
+ * @param jaxws if passed value is <b>true</b> JAXWS servlets list will
be returned, otherwise JAXRPC servlets list
+ * @return either JAXRPC or JAXWS servlets list
+ */
+ private static List<ServletMetaData> getWebServiceServlets(final DeploymentUnit
unit, final boolean jaxws) {
+ final JBossWebMetaData jbossWebMD = getJBossWebMetaData(unit);
+ final CompositeIndex compositeIndex = ASHelper.getRequiredAttachment(unit,
Attachments.COMPOSITE_ANNOTATION_INDEX);
+ return selectWebServiceServlets(compositeIndex, jbossWebMD.getServlets(),
jaxws);
+ }
+
+ /**
+ * Return a new sublist of the provided ServletMetaData list including the WS servlet
data only
+ *
+ * @param annotationIndex the annotation index to use for scanning for annotations
+ * @param smd the initial servlet metadata collection
+ * @param jaxws if passed value is <b>true</b> JAXWS servlets list will
be returned, otherwise JAXRPC servlets list
+ * @return either JAXRPC or JAXWS servlets list
+ */
+ public static <T extends ServletMetaData> List<ServletMetaData>
selectWebServiceServlets(final CompositeIndex index, final Collection<T> smd, final
boolean jaxws) {
+ if (smd == null) return Collections.emptyList();
+
+ final List<ServletMetaData> endpoints = new
ArrayList<ServletMetaData>();
+
+ for (final ServletMetaData servletMD : smd) {
+ final boolean isWebServiceEndpoint = isWebserviceEndpoint(servletMD, index);
+ final boolean isJaxwsEndpoint = jaxws && isWebServiceEndpoint;
+ final boolean isJaxrpcEndpoint = !jaxws && isWebServiceEndpoint;
+
+ if (isJaxwsEndpoint || isJaxrpcEndpoint) {
+ endpoints.add(servletMD);
+ }
+ }
+
+ return endpoints;
+ }
+
+ private static boolean isWebserviceEndpoint(final ServletMetaData servletMD, final
CompositeIndex index) {
+ final String endpointClassName = ASHelper.getEndpointName(servletMD);
+ if (isJSP(endpointClassName)) return false;
+ final DotName endpointDotName = DotName.createSimple(endpointClassName);
+ final ClassInfo endpointClassInfo = index.getClassByName(endpointDotName);
+
+ if (endpointClassInfo != null) {
+ if (endpointClassInfo.annotations().containsKey(WEB_SERVICE_ANNOTATION))
+ return true;
+ if
(endpointClassInfo.annotations().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION))
+ return true;
+ }
+
+ return false;
+ }
+
+ private static boolean isJSP(final String endpointClassName) {
+ return endpointClassName == null || endpointClassName.length() == 0;
+ }
+
+ /**
+ * Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment
unit, if any.
+ *
+ * @param unit
+ * @return the JBossWebMetaData or null if either that or the parent WarMetaData are
not found.
+ */
+ public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) {
+ final WarMetaData warMetaData = ASHelper.getOptionalAttachment(unit,
WarMetaData.ATTACHMENT_KEY);
+ JBossWebMetaData result = null;
+ if (warMetaData != null) {
+ result = warMetaData.getMergedJBossWebMetaData();
+ if (result == null) {
+ result = warMetaData.getJbossWebMetaData();
+ }
+ }
+ return result;
+ }
+
+ public static List<AnnotationInstance> getAnnotations(final DeploymentUnit
unit, final DotName annotation) {
+ final CompositeIndex compositeIndex = ASHelper.getRequiredAttachment(unit,
Attachments.COMPOSITE_ANNOTATION_INDEX);
+ return compositeIndex.getAnnotations(annotation);
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ModuleClassLoaderProvider.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ModuleClassLoaderProvider.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/ModuleClassLoaderProvider.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.webservices.util;
+
+import java.lang.ref.WeakReference;
+
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+
+/**
+ * AS7 version of {@link org.jboss.wsf.spi.classloading.ClassLoaderProvider}, relying on
modular classloading.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class ModuleClassLoaderProvider extends ClassLoaderProvider {
+
+ private static final ModuleIdentifier ASIL =
ModuleIdentifier.create("org.jboss.as.webservices.server.integration");
+ private WeakReference<ClassLoader> integrationClassLoader;
+
+ @Override
+ public ClassLoader getWebServiceSubsystemClassLoader() {
+ return this.getClass().getClassLoader();
+ }
+
+ @Override
+ public ClassLoader getServerIntegrationClassLoader() {
+ if (integrationClassLoader == null || integrationClassLoader.get() == null) {
+ try {
+ Module module = Module.getBootModuleLoader().loadModule(ASIL);
+ integrationClassLoader = new
WeakReference<ClassLoader>(module.getClassLoader());
+ } catch (ModuleLoadException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return integrationClassLoader.get();
+ }
+
+ public static void register() {
+ ClassLoaderProvider.setDefaultProvider(new ModuleClassLoaderProvider());
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.as.webservices.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.WritableUnifiedVirtualFile;
+
+/**
+ * A VirtualFile adaptor.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Ales.Justin(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ */
+public final class VirtualFileAdaptor implements WritableUnifiedVirtualFile {
+ private static final long serialVersionUID = -4509594124653184348L;
+
+ private static final ObjectStreamField[] serialPersistentFields = { new
ObjectStreamField("rootUrl", URL.class),
+ new ObjectStreamField("path", String.class), new
ObjectStreamField("requiresMount", boolean.class) };
+
+ /** Minimal info to get full vfs file structure */
+ private URL rootUrl;
+ private String path;
+ private boolean requiresMount;
+ /** The virtual file */
+ private transient VirtualFile file;
+
+ public VirtualFileAdaptor(VirtualFile file) {
+ this.file = file;
+ }
+
+ public VirtualFileAdaptor(URL rootUrl, String path) {
+ this(rootUrl, path, false);
+ }
+
+ protected VirtualFileAdaptor(URL rootUrl, String path, boolean requiresMount) {
+ if (rootUrl == null)
+ throw new IllegalArgumentException("Null root url");
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ this.rootUrl = rootUrl;
+ this.path = path;
+ this.requiresMount = requiresMount;
+ }
+
+ /**
+ * Get the virtual file. Create file from root url and path if it doesn't exist
yet.
+ *
+ * @return virtual file root
+ * @throws IOException for any error
+ */
+ protected VirtualFile getFile() throws IOException {
+ if (file == null) {
+ VirtualFile root;
+ try {
+ root = VFS.getChild(rootUrl);
+ } catch (URISyntaxException e) {
+ throw new IOException("Unable to get Virtualfile from URL: " +
rootUrl, e);
+ }
+ file = root.getChild(path);
+
+ if (!file.exists()) {
+ throw new IOException("VirtualFile " + file + " does not
exist");
+ } else if (requiresMount && !isMounted(root, file)) {
+ throw new IOException("VirtualFile " + file + " is not
mounted");
+ }
+ }
+ return file;
+ }
+
+ private static boolean isMounted(VirtualFile root, VirtualFile child) throws
IOException {
+ return !(root.getPathName().equals(root.getPhysicalFile().getAbsolutePath())
&& child.getPathName().equals(
+ child.getPhysicalFile().getAbsolutePath()));
+ }
+
+ public UnifiedVirtualFile findChild(String child) throws IOException {
+ final VirtualFile virtualFile = getFile();
+ final VirtualFile childFile = file.getChild(child);
+ if (!childFile.exists())
+ throw new IOException("Child '" + child + "' not found
for VirtualFile " + virtualFile);
+ return new VirtualFileAdaptor(childFile);
+ }
+
+ public URL toURL() {
+ try {
+ return getFile().toURL();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public void writeContent(OutputStream bos) throws IOException {
+ writeContent(bos, null);
+ }
+
+ public void writeContent(OutputStream bos, NameFilter filter) throws IOException {
+ InputStream is = null;
+ try {
+ is = getFile().openStream();
+ if (is instanceof JarInputStream) {
+ JarInputStream jis = (JarInputStream) is;
+ JarOutputStream os = new JarOutputStream(bos);
+ JarEntry je = null;
+ while ((je = jis.getNextJarEntry()) != null) {
+ if (filter != null && filter.accept(je.getName())) {
+ os.putNextEntry(je);
+ VFSUtils.copyStream(jis, os);
+ }
+ }
+ VFSUtils.safeClose(os);
+ } else {
+ VFSUtils.copyStream(is, bos);
+ }
+ } finally {
+ VFSUtils.safeClose(is);
+ }
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException,
URISyntaxException {
+ VirtualFile file = getFile();
+ URL url = rootUrl;
+ if (url == null) {
+ VirtualFile parentFile = file.getParent();
+ url = parentFile != null ? parentFile.toURL() : null;
+ }
+ String pathName = path;
+ if (pathName == null)
+ pathName = file.getName();
+
+ ObjectOutputStream.PutField fields = out.putFields();
+ fields.put("rootUrl", url);
+ fields.put("path", pathName);
+
+ VirtualFile newRoot = VFS.getChild(url);
+ VirtualFile newChild = newRoot.getChild(pathName);
+ fields.put("requiresMount", isMounted(newRoot, newChild));
+
+ out.writeFields();
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
+ ObjectInputStream.GetField fields = in.readFields();
+ rootUrl = (URL) fields.get("rootUrl", null);
+ path = (String) fields.get("path", null);
+ requiresMount = fields.get("requiresMount", false);
+ }
+
+ public List<UnifiedVirtualFile> getChildren() throws IOException {
+ List<VirtualFile> vfList = getFile().getChildren();
+ if (vfList == null)
+ return null;
+ List<UnifiedVirtualFile> uvfList = new
LinkedList<UnifiedVirtualFile>();
+ for (VirtualFile vf : vfList) {
+ uvfList.add(new VirtualFileAdaptor(vf));
+ }
+ return uvfList;
+ }
+
+ public String getName() {
+ try {
+ return getFile().getName();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.util;
+
+import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.as.webservices.metadata.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Collection of attachment keys
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 11-Nov-2010
+ */
+public final class WSAttachmentKeys {
+
+ public static final AttachmentKey<Deployment> DEPLOYMENT_KEY =
AttachmentKey.create(Deployment.class);
+ public static final AttachmentKey<DeploymentType> DEPLOYMENT_TYPE_KEY =
AttachmentKey.create(DeploymentType.class);
+ public static final AttachmentKey<JBossAppMetaData> JBOSS_APP_METADATA_KEY =
AttachmentKey.create(JBossAppMetaData.class);
+ public static final AttachmentKey<JMSEndpointsMetaData>
JMS_ENDPOINT_METADATA_KEY = AttachmentKey.create(JMSEndpointsMetaData.class);
+ public static final AttachmentKey<WebServiceDeployment>
WEBSERVICE_DEPLOYMENT_KEY = AttachmentKey.create(WebServiceDeployment.class);
+ public static final AttachmentKey<WebservicesMetaData> WEBSERVICES_METADATA_KEY
= AttachmentKey.create(WebservicesMetaData.class);
+
+ private WSAttachmentKeys() {
+ // forbidden inheritance
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSServices.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSServices.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WSServices.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., 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.as.webservices.util;
+
+import java.lang.ref.WeakReference;
+
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.ServiceRegistry;
+
+/**
+ * WSServices
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 09-Nov-2010
+ *
+ */
+public final class WSServices {
+
+ public static final ServiceName WS_SERVICE =
ServiceName.JBOSS.append("ws");
+ public static final ServiceName CONFIG_SERVICE =
WS_SERVICE.append("config");
+ public static final ServiceName REGISTRY_SERVICE =
WS_SERVICE.append("registry");
+ public static final ServiceName MODEL_SERVICE =
WS_SERVICE.append("model");
+ public static final ServiceName ENDPOINT_SERVICE =
WS_SERVICE.append("endpoint");
+
+ private static WeakReference<ServiceRegistry> registry;
+
+ public static void saveContainerRegistry(ServiceRegistry containerRegistry) {
+ registry = new WeakReference<ServiceRegistry>(containerRegistry);
+ }
+
+ public static ServiceRegistry getContainerRegistry() {
+ return registry.get();
+ }
+
+ private WSServices() {
+ // forbidden inheritance
+ }
+
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WebMetaDataHelper.java
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WebMetaDataHelper.java
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/java/org/jboss/as/webservices/util/WebMetaDataHelper.java 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,387 @@
+/*
+ * 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.as.webservices.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.getSecurityConstraints();
+
+ if (securityConstraintsMD == null) {
+ securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
+ jbossWebMD.setSecurityConstraints(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;
+ }
+}
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.as.controller.Extension 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,23 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2011, Red Hat, Inc., 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.
+#
+
+org.jboss.as.webservices.dmr.WSExtension
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.ws.common.deployment.ArchiveDeploymentModelFactory
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.ServletDelegateFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.ServletDelegateFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.ServletDelegateFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.as.webservices.tomcat.ServletDelegateFactoryImpl
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.as.webservices.invocation.InvocationHandlerFactoryImpl
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.as.webservices.security.SecurityAdaptorFactoryImpl
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.ioc.IoCContainerProxyFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.ioc.IoCContainerProxyFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.ioc.IoCContainerProxyFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.as.webservices.ioc.IoCContainerProxyFactoryImpl
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1 @@
+org.jboss.as.webservices.config.ServerConfigFactoryImpl
\ No newline at end of file
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/stack-agnostic-deployment-aspects.xml
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/stack-agnostic-deployment-aspects.xml
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/META-INF/stack-agnostic-deployment-aspects.xml 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., 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.
+ -->
+
+<deploymentAspects xmlns="urn:jboss:ws:deployment:aspects:1.0">
+
+ <deploymentAspect
class="org.jboss.as.webservices.metadata.ContainerMetaDataDeploymentAspect">
+ <property name="provides"
class="java.lang.String">ContainerMetaData, VFSRoot</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.BackwardCompatibleContextRootDeploymentAspect">
+ <property name="requires"
class="java.lang.String">ContainerMetaData</property>
+ <property name="provides"
class="java.lang.String">ContextRoot</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.EndpointAddressDeploymentAspect">
+ <property name="requires"
class="java.lang.String">URLPattern</property>
+ <property name="provides"
class="java.lang.String">EndpointAddress</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.deployers.EndpointServiceDeploymentAspect">
+ <property name="provides"
class="java.lang.String">LifecycleHandler</property>
+ <property name="last"
class="boolean">true</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.EndpointMetricsDeploymentAspect">
+ <property name="provides"
class="java.lang.String">EndpointMetrics</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.EndpointNameDeploymentAspect">
+ <property name="requires"
class="java.lang.String">URLPattern</property>
+ <property name="provides"
class="java.lang.String">EndpointName</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.EndpointRegistryDeploymentAspect">
+ <property name="requires"
class="java.lang.String">EndpointName, EndpointAddress</property>
+ <property name="provides"
class="java.lang.String">RegisteredEndpoint</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.URLPatternDeploymentAspect">
+ <property name="requires"
class="java.lang.String">ContextRoot, ContainerMetaData</property>
+ <property name="provides"
class="java.lang.String">URLPattern</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.tomcat.WebMetaDataModifyingDeploymentAspect">
+ <property name="requires"
class="java.lang.String">WebMetaData, ContextProperties,
StackDescriptor</property>
+ <property name="provides"
class="java.lang.String">WebMetaData</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.tomcat.WebMetaDataCreatingDeploymentAspect">
+ <!--property name="requires"
class="java.lang.String">VirtualHosts,URLPattern,EndpointAddress</property--><!--
TODO will AS7 provide virtual hosts feature? -->
+ <property name="requires"
class="java.lang.String">URLPattern,EndpointAddress</property>
+ <property name="provides"
class="java.lang.String">WebMetaData</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.dmr.ModelDeploymentAspect">
+ <property name="requires"
class="java.lang.String">EndpointName, EndpointAddress</property>
+ <property name="provides"
class="java.lang.String">ModelMetaData</property>
+ </deploymentAspect>
+
+ <!--
+
+ <deploymentAspect
class="org.jboss.ws.common.deployment.VirtualHostDeploymentAspect">
+ <property name="requires"
class="java.lang.String">ContainerMetaData</property>
+ <property name="provides"
class="java.lang.String">VirtualHosts</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.weld.WeldDeploymentAspect">
+ <property name="requires"
class="java.lang.String">StackEndpointHandler</property>
+ <property name="provides"
class="java.lang.String">CDIInjection</property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.injection.InjectionMetaDataDeploymentAspect">
+ <property name="requires"
class="java.lang.String">WebMetaData</property>
+ <property name="provides"
class="java.lang.String">InjectionMetaData</property>
+ <property name="ejbReferenceResolver"><inject
bean="org.jboss.ejb3.ejbref.resolver.EjbReferenceResolver"/></property>
+ </deploymentAspect>
+
+ <deploymentAspect
class="org.jboss.as.webservices.security.JACCPermissionsDeploymentAspect">
+ <property name="requires"
class="java.lang.String">WebMetaData</property>
+ <property name="provides"
class="java.lang.String">JACCPermisions</property>
+ </deploymentAspect>
+
+ -->
+
+</deploymentAspects>
Added:
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/dmr/LocalDescriptions.properties
===================================================================
---
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/dmr/LocalDescriptions.properties
(rev 0)
+++
container/jboss70/branches/jbossws-jboss700/src/main/resources/org/jboss/as/webservices/dmr/LocalDescriptions.properties 2011-09-12
08:38:24 UTC (rev 14975)
@@ -0,0 +1,35 @@
+ws=The configuration of the web services subsystem.
+ws.add=Adds the web services subsystem.
+endpoint=Webservice endpoint.
+endpoint.name=Webservice endpoint name.
+endpoint.context=Webservice endpoint context.
+endpoint.class=Webservice endpoint class.
+endpoint.type=Webservice endpoint type.
+endpoint.wsdl=Webservice endpoint WSDL URL.
+endpoint.add=Adds webservice endpoint.
+endpoint.remove=Removes webservice endpoint.
+modify.wsdl.address=Whether the soap address can be modified.
+wsdl.host=The WSDL, that is a required deployment artifact for an endpoint, has a
<soap:address> element which points to the location of the endpoint. JBoss supports
rewriting of that SOAP address. If the content of <soap:address> is a valid URL,
JBossWS will not rewrite it unless 'modify-wsdl-address' is true. If the content
of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute
values given below. If 'wsdl-host' is set to 'jbossws.undefined.host',
JBossWS uses requesters host when rewriting the <soap:address>
+wsdl.port=The non-secure port that will be used for rewriting the SOAP address. If absent
the port will be identified by querying the list of installed connectors.
+wsdl.secure.port=The secure port that will be used for rewriting the SOAP address. If
absent the port will be identified by querying the list of installed connectors.
+average.processing.time=Average endpoint processing time.
+min.processing.time=Minimal endpoint processing time.
+max.processing.time=Maximal endpoint processing time.
+total.processing.time=Total endpoint processing time.
+request.count=Count of requests the endpoint processed.
+response.count=Count of responses the endpoint generated.
+fault.count=Count of faults the endpoint generated.
+
+endpoint.config=Webservice Endpoint configuration
+endpoint.config.add=Add a new endpoint configuration
+endpoint.config.remove=Remove a endpoint configuration
+endpoint.config.name=Endpoint configuration name
+protocol.binding=Protocol binding value
+servicename.pattern=Service name pattern
+portname.pattern=Port name pattern
+handler.name=Handler name
+handler.class=Handler class
+property.name=Property name
+property.value=Property value
+feature.name=Feature name
+feature.value=Feature value