Author: jim.ma
Date: 2010-05-19 22:24:07 -0400 (Wed, 19 May 2010)
New Revision: 12279
Added:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/JMSDeploymentAspect.java
Modified:
common/branches/jms-integration/pom.xml
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/ResourceLoaderAdapter.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/URLLoaderAdapter.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceFieldFinder.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceMethodFinder.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/AbstractDeploymentAspect.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/WSHelper.java
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java
Log:
[JBWS-2791]:Add JMSDeploymentAspet class and synched code with trunk
Modified: common/branches/jms-integration/pom.xml
===================================================================
--- common/branches/jms-integration/pom.xml 2010-05-19 16:25:37 UTC (rev 12278)
+++ common/branches/jms-integration/pom.xml 2010-05-20 02:24:07 UTC (rev 12279)
@@ -7,6 +7,7 @@
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-common</artifactId>
<packaging>jar</packaging>
+ <description>JBossWS Common</description>
<version>1.3.0-SNAPSHOT</version>
@@ -14,7 +15,7 @@
<parent>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-parent</artifactId>
- <version>1.0.4.GA</version>
+ <version>1.0.6.GA</version>
</parent>
<!-- Source Control Management -->
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/ResourceLoaderAdapter.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/ResourceLoaderAdapter.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/ResourceLoaderAdapter.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -140,8 +140,8 @@
try
{
//get the jar and open it
- String folder = jarRoot.substring(5,jarRoot.lastIndexOf(File.separator));
- String filename = jarRoot.substring(jarRoot.lastIndexOf(File.separator)+1);
+ String folder = jarRoot.substring(5,jarRoot.lastIndexOf("/"));
+ String filename = jarRoot.substring(jarRoot.lastIndexOf("/")+1);
final File jar = new File(folder, filename);
PrivilegedAction<JarFile> action = new
PrivilegedAction<JarFile>()
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/URLLoaderAdapter.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/URLLoaderAdapter.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/URLLoaderAdapter.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -151,8 +151,8 @@
try
{
- String folder = jarRoot.substring(5,jarRoot.lastIndexOf(File.separator));
- String filename = jarRoot.substring(jarRoot.lastIndexOf(File.separator)+1);
+ String folder = jarRoot.substring(5,jarRoot.lastIndexOf("/"));
+ String filename = jarRoot.substring(jarRoot.lastIndexOf("/")+1);
final File jar = new File(folder, filename);
PrivilegedAction<JarFile> action = new
PrivilegedAction<JarFile>()
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -28,6 +28,7 @@
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.naming.Context;
+import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.ws.WebServiceContext;
@@ -109,7 +110,7 @@
injectResourceAnnotatedAccessibleObjects(instance, injections, ctx);
// inject @EJB annotated methods and fields
- injectEJBAnnotatedAccessibleObjects(instance, injections, ctx);
+ injectEJBAnnotatedAccessibleObjects(instance, injections);
}
/**
@@ -323,10 +324,11 @@
* @see org.jboss.wsf.common.injection.finders.EJBMethodFinder
* @see javax.ejb.EJB
*/
- private static void injectEJBAnnotatedAccessibleObjects(final Object instance, final
InjectionsMetaData injections, final Context ctx)
+ private static void injectEJBAnnotatedAccessibleObjects(final Object instance, final
InjectionsMetaData injections)
{
final Collection<Field> ejbAnnotatedFields =
EJB_FIELD_FINDER.process(instance.getClass());
final Collection<Method> ejbAnnotatedMethods =
EJB_METHOD_FINDER.process(instance.getClass());
+ final Context ctx = InjectionHelper.getDefaultContext();
// Inject @EJB annotated fields
for (Field field : ejbAnnotatedFields)
@@ -496,4 +498,26 @@
return result.isEmpty() ? null : result.iterator().next();
}
+ /**
+ * Returns default JNDI context.
+ *
+ * @return default JNDI context
+ */
+ private static Context getDefaultContext()
+ {
+ Context ctx = null;
+
+ try
+ {
+ ctx = new InitialContext();
+ }
+ catch (NamingException ne)
+ {
+ final String message = "Cannot create default JNDI context";
+ InjectionException.rethrow(message, ne);
+ }
+
+ return ctx;
+ }
+
}
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceFieldFinder.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceFieldFinder.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceFieldFinder.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -37,7 +37,7 @@
* method declaration if necessary. The name of the resource, if not declared, is the
* name of the JavaBeans property as determined starting from the name of the setter
* method in question. The setter method must follow the standard JavaBeans
- * convention - name starts with a “set”, void return type and only one parameter.
+ * convention - name starts with a 'set', void return type and only one
parameter.
* Additionally, the type of the parameter must be compatible with the type specified
* as a property of the Resource if present.
*
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceMethodFinder.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceMethodFinder.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/injection/finders/ResourceMethodFinder.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -36,7 +36,7 @@
* method declaration if necessary. The name of the resource, if not declared, is the
* name of the JavaBeans property as determined starting from the name of the setter
* method in question. The setter method must follow the standard JavaBeans
- * convention - name starts with a “set”, void return type and only one parameter.
+ * convention - name starts with a 'set', void return type and only one
parameter.
* Additionally, the type of the parameter must be compatible with the type specified
* as a property of the Resource if present.
*
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/AbstractDeploymentAspect.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/AbstractDeploymentAspect.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/AbstractDeploymentAspect.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -134,8 +134,8 @@
public boolean canHandle(Deployment dep)
{
- return (this.isForJaxWs && WSHelper.isJaxwsDeployment(dep) ||
- this.isForJaxRpc && WSHelper.isJaxrpcDeployment(dep));
+ return (this.isForJaxWs() && WSHelper.isJaxwsDeployment(dep) ||
+ this.isForJaxRpc() && WSHelper.isJaxrpcDeployment(dep));
}
public boolean isForJaxWs()
Added:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/JMSDeploymentAspect.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/JMSDeploymentAspect.java
(rev 0)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/JMSDeploymentAspect.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.wsf.common.integration;
+
+import org.jboss.wsf.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+
+public class JMSDeploymentAspect extends AbstractDeploymentAspect
+{
+ @Override
+ public boolean canHandle(Deployment dep)
+ {
+ return isForJaxWs() && dep.getAttachment(JMSEndpointsMetaData.class) !=
null;
+ }
+}
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/WSHelper.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/WSHelper.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/integration/WSHelper.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -24,7 +24,6 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.metadata.endpoints.EndpointsMetaData;
/**
* Cross WS stack and JBoss AS integration helper.
@@ -134,6 +133,18 @@
{
return DeploymentType.JAXWS_JSE.equals( dep.getType() );
}
+
+
+ /**
+ * Returns true if deployment represents JAXWS JMS deployment.
+ *
+ * @param dep webservice deployment
+ * @return true if JAXWS JMS deployment, false otherwise
+ */
+ public static boolean isJaxwsJmsDeployment( final Deployment dep )
+ {
+ return DeploymentType.JAXWS_JMS.equals(dep.getType());
+ }
/**
* Returns true if deployment represents either JAXWS JSE or JAXRPC JSE deployment.
@@ -190,10 +201,4 @@
return isJaxrpcEjb || isJaxrpcJse;
}
-
- public static boolean hasEndpointsDeployment(final Deployment dep)
- {
- return WSHelper.getOptionalAttachment(dep, EndpointsMetaData.class) != null ? true
: false;
- }
-
}
Modified:
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java
===================================================================
---
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -97,7 +97,7 @@
log.debug("Using local host: " + localHost.getHostName());
host = localHost.getHostName();
}
- this.webServiceHost = host;
+ this.webServiceHost = "127.0.0.1".equals(host) ? "localhost" :
host; // TCK workaround
}
public void setWebServicePort(int port)
Modified:
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java
===================================================================
---
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -72,7 +72,7 @@
UnifiedVirtualFile common = ula.findChild("org/jboss/wsf/common/");
assertNotNull(common);
- assertTrue(common.toURL().toExternalForm().contains("target" +
File.separator + "classes")); //check we got a URL to dir
+ assertTrue(common.toURL().toExternalForm().contains("target/classes"));
//check we got a URL to dir
assertEquals("common/", common.getName());
List<UnifiedVirtualFile> children = common.getChildren();
assertNotNull(children);
Modified:
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java
===================================================================
---
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java 2010-05-19
16:25:37 UTC (rev 12278)
+++
common/branches/jms-integration/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java 2010-05-20
02:24:07 UTC (rev 12279)
@@ -76,7 +76,7 @@
UnifiedVirtualFile common = ula.findChild("org/jboss/wsf/common/");
assertNotNull(common);
- assertTrue(common.toURL().toExternalForm().contains("target" +
File.separator + "classes")); //check we got a URL to dir
+ assertTrue(common.toURL().toExternalForm().contains("target/classes"));
//check we got a URL to dir
assertEquals("common/", common.getName());
List<UnifiedVirtualFile> children = common.getChildren();
assertNotNull(children);