JBossWS SVN: r17080 - in common/branches/JBWS3551/src: main/java/org/jboss/ws/common/deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-14 19:20:42 -0500 (Fri, 14 Dec 2012)
New Revision: 17080
Modified:
common/branches/JBWS3551/src/main/java/org/jboss/ws/common/Loggers.java
common/branches/JBWS3551/src/main/java/org/jboss/ws/common/ResourceLoaderAdapter.java
common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java
common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java
common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java
common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java
Log:
Impl failsafe methods
Modified: common/branches/JBWS3551/src/main/java/org/jboss/ws/common/Loggers.java
===================================================================
--- common/branches/JBWS3551/src/main/java/org/jboss/ws/common/Loggers.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/main/java/org/jboss/ws/common/Loggers.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -214,4 +214,12 @@
@LogMessage(level = TRACE)
@Message(id = 22114, value = "%s doesn't work on %s")
void aspectDoesNotWorkOnDeployment(Class<?> aspect, Class<?> deployment);
+
+ @LogMessage(level = TRACE)
+ @Message(id = 22115, value = "Cannot get URL for %s")
+ void cannotGetURLFor(String path);
+
+ @LogMessage(level = TRACE)
+ @Message(id = 22116, value = "Could not find %s in the additional metadatafiles")
+ void cannotFindInAdditionalMetaData(String resourcePath);
}
Modified: common/branches/JBWS3551/src/main/java/org/jboss/ws/common/ResourceLoaderAdapter.java
===================================================================
--- common/branches/JBWS3551/src/main/java/org/jboss/ws/common/ResourceLoaderAdapter.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/main/java/org/jboss/ws/common/ResourceLoaderAdapter.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -68,7 +68,7 @@
this.loader = loader;
}
- public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+ private UnifiedVirtualFile findChild(String resourcePath, boolean throwExceptionIfNotFound) throws IOException
{
URL resourceURL = null;
if (resourcePath != null)
@@ -113,11 +113,38 @@
}
if (resourceURL == null)
- throw MESSAGES.cannotGetURLFor(resourcePath);
+ {
+ if (throwExceptionIfNotFound)
+ {
+ throw MESSAGES.cannotGetURLFor(resourcePath);
+ }
+ else
+ {
+ if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.cannotGetURLFor(resourcePath);
+ return null;
+ }
+ }
return new ResourceLoaderAdapter(loader, resourceURL);
}
+ public UnifiedVirtualFile findChild(String child) throws IOException
+ {
+ return findChild(child, true);
+ }
+
+ public UnifiedVirtualFile findChildFailSafe(String child)
+ {
+ try
+ {
+ return findChild(child, false);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
public URL toURL()
{
if (null == this.resourceURL)
Modified: common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java
===================================================================
--- common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -63,9 +63,11 @@
try
{
// META-INF first
- UnifiedVirtualFile vfs = archive.getRootFile().findChild(META_INF_JAXB_INTROS_XML);
- url = vfs.toURL();
- introsConfigStream = url.openStream();
+ UnifiedVirtualFile vfs = archive.getRootFile().findChildFailSafe(META_INF_JAXB_INTROS_XML);
+ if (vfs != null) {
+ url = vfs.toURL();
+ introsConfigStream = url.openStream();
+ }
} catch (Exception e) {}
if(null == introsConfigStream)
@@ -73,9 +75,11 @@
try
{
// WEB-INF second
- UnifiedVirtualFile vfs = archive.getRootFile().findChild(WEB_INF_JAXB_INTROS_XML);
- url = vfs.toURL();
- introsConfigStream = url.openStream();
+ UnifiedVirtualFile vfs = archive.getRootFile().findChildFailSafe(WEB_INF_JAXB_INTROS_XML);
+ if (vfs != null) {
+ url = vfs.toURL();
+ introsConfigStream = url.openStream();
+ }
} catch (Exception e) {
return;
}
Modified: common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java
===================================================================
--- common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -124,4 +124,78 @@
return resourceURL;
}
+ public URL resolveFailSafe(String resourcePath)
+ {
+ final boolean traceEnabled = ROOT_LOGGER.isTraceEnabled();
+ URL resourceURL = null;
+ if (resourcePath != null && resourcePath.length() > 0)
+ {
+ if (resourcePath.startsWith("/"))
+ resourcePath = resourcePath.substring(1);
+
+ try
+ {
+ // assign an absolute URL
+ resourceURL = new URL(resourcePath);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ if (resourceURL == null && rootFile != null)
+ {
+ UnifiedVirtualFile vfResource = rootFile.findChildFailSafe(resourcePath);
+ if (vfResource == null)
+ {
+ if (metadataFiles == null || metadataFiles.isEmpty())
+ {
+ if (traceEnabled) ROOT_LOGGER.cannotGetRootResourceFrom(resourcePath, rootFile, null);
+ }
+ else
+ {
+ if (traceEnabled) ROOT_LOGGER.cannotGetRootFileTryingWithAdditionalMetaData(resourcePath);
+ }
+ }
+ else
+ {
+ resourceURL = vfResource.toURL();
+ }
+ }
+ //scan additional metadata files (for instance originally attached to a VFSDeploymentUnit)
+ if (resourceURL == null && metadataFiles != null && !metadataFiles.isEmpty())
+ {
+ UnifiedVirtualFile vfResource = null;
+ for (Iterator<UnifiedVirtualFile> it = metadataFiles.iterator(); it.hasNext() && vfResource == null;)
+ {
+ UnifiedVirtualFile uvf = it.next();
+ URL wsdlUrl = uvf.toURL();
+ String wsdlPath = wsdlUrl.getPath();
+ if (wsdlPath.startsWith("/"))
+ wsdlPath = wsdlPath.substring(1);
+ if (resourcePath.equals(wsdlPath))
+ {
+ vfResource = uvf;
+ }
+ else
+ {
+ vfResource = uvf.findChildFailSafe(resourcePath);
+ if (traceEnabled && vfResource == null) {
+ ROOT_LOGGER.cannotGetRootResourceFrom(resourcePath, uvf, null);
+ }
+ }
+ }
+ if (vfResource == null)
+ {
+ if (traceEnabled) ROOT_LOGGER.cannotFindInAdditionalMetaData(resourcePath);
+ }
+ else
+ {
+ resourceURL = vfResource.toURL();
+ }
+ }
+ }
+ return resourceURL;
+ }
+
}
Modified: common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java
===================================================================
--- common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/ResourceLoaderAdapterTestCase.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.common;
+import java.io.IOException;
import java.util.List;
import junit.framework.TestCase;
@@ -85,4 +86,22 @@
assertNotNull(utils);
assertTrue(resourceLoaderAdapter.getChildren().size() == 0);
}
+
+ public void testFailSafeGetChild()
+ {
+ ClassLoader cl = UnifiedVirtualFile.class.getClassLoader();
+ ResourceLoaderAdapter ula = new ResourceLoaderAdapter(cl);
+ try {
+ ula.findChild("foo/bar/");
+ fail("IOException expected");
+ } catch (IOException e) {
+ //expected
+ }
+ try {
+ UnifiedVirtualFile uvf = ula.findChildFailSafe("foo/bar/");
+ assertNull(uvf);
+ } catch (Exception e) {
+ fail("Exception not expected, 'null' should have been returned instead: " + e.getMessage());
+ }
+ }
}
Modified: common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java
===================================================================
--- common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java 2012-12-15 00:19:54 UTC (rev 17079)
+++ common/branches/JBWS3551/src/test/java/org/jboss/test/ws/common/URLLoaderAdapterTestCase.java 2012-12-15 00:20:42 UTC (rev 17080)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.common;
+import java.io.IOException;
import java.net.URL;
import java.util.List;
@@ -90,6 +91,26 @@
assertTrue(urlLoaderAdapter.getChildren().size() == 0);
}
+ public void testFailSafeGetChild() throws Exception
+ {
+ ClassLoader cl = UnifiedVirtualFile.class.getClassLoader();
+ URL rootURL = getJarUrl(cl.getResource("org/jboss/wsf/spi/deployment"));
+ assertNotNull(rootURL);
+ URLLoaderAdapter ula = new URLLoaderAdapter(rootURL);
+ try {
+ ula.findChild("foo/bar/");
+ fail("IOException expected");
+ } catch (IOException e) {
+ //expected
+ }
+ try {
+ UnifiedVirtualFile uvf = ula.findChildFailSafe("foo/bar/");
+ assertNull(uvf);
+ } catch (Exception e) {
+ fail("Exception not expected, 'null' should have been returned instead: " + e.getMessage());
+ }
+ }
+
private static URL getJarUrl(URL url) throws Exception
{
String urlString = url.toExternalForm();
11 years, 4 months
JBossWS SVN: r17079 - common/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-14 19:19:54 -0500 (Fri, 14 Dec 2012)
New Revision: 17079
Added:
common/branches/JBWS3551/
Log:
11 years, 4 months
JBossWS SVN: r17078 - in spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi: deployment and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-14 19:19:33 -0500 (Fri, 14 Dec 2012)
New Revision: 17078
Modified:
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/Loggers.java
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
Log:
New dailsafe methods
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/Loggers.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/Loggers.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/Loggers.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -21,8 +21,9 @@
*/
package org.jboss.wsf.spi;
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.TRACE;
import static org.jboss.logging.Logger.Level.WARN;
-import static org.jboss.logging.Logger.Level.ERROR;
import java.net.URL;
import java.util.Collection;
@@ -32,7 +33,6 @@
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
-import org.jboss.logging.Logger.Level;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
@@ -71,4 +71,8 @@
@Message(id = 21018, value = "Cannot get name for resource %s")
void cannotGetNameForResource(@Cause Throwable cause, URL url);
+ @LogMessage(level = TRACE)
+ @Message(id = 21019, value = "Cannot get URL for %s")
+ void cannotGetURLFor(String path);
+
}
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -41,4 +41,13 @@
*/
public URL resolve(String resourcePath) throws IOException;
+ /**
+ * Same as resolve(String resourcePath) except it does not throw exception
+ * when resource is not found, simply returns null.
+ *
+ * @param resourcePath
+ * @return
+ */
+ public URL resolveFailSafe(String resourcePath);
+
}
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -27,16 +27,24 @@
import java.util.List;
/**
- * An adaptor to a VirtualFile from jboss-vfs.jar
- * jboss-vfs cannot be used in jboss-4.x because of its dependeny on jboss-common-core.jar
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 05-May-2006
*/
public interface UnifiedVirtualFile extends Serializable
{
UnifiedVirtualFile findChild(String child) throws IOException;
+ /**
+ * Same as findChild(String child) but does not throw any exception
+ * on child not found, simply returns null.
+ *
+ * @param child
+ * @return
+ */
+ UnifiedVirtualFile findChildFailSafe(String child);
+
List<UnifiedVirtualFile> getChildren() throws IOException;
String getName();
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -86,20 +86,11 @@
public static JBossWebservicesMetaData loadFromVFSRoot(final UnifiedVirtualFile root) {
JBossWebservicesMetaData webservices = null;
- UnifiedVirtualFile wsdd = null;
- try {
- wsdd = root.findChild("META-INF/jboss-webservices.xml");
- } catch (IOException e) {
- //
- }
+ UnifiedVirtualFile wsdd = root.findChildFailSafe("META-INF/jboss-webservices.xml");
// Maybe a web application deployment?
if (null == wsdd) {
- try {
- wsdd = root.findChild("WEB-INF/jboss-webservices.xml");
- } catch (IOException e) {
- //
- }
+ wsdd = root.findChildFailSafe("WEB-INF/jboss-webservices.xml");
}
// the descriptor is optional
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -96,27 +96,12 @@
{
WebservicesMetaData webservices = null;
- UnifiedVirtualFile wsdd = null;
- try
- {
- wsdd = root.findChild("META-INF/webservices.xml");
- }
- catch (IOException e)
- {
- //
- }
+ UnifiedVirtualFile wsdd = root.findChildFailSafe("META-INF/webservices.xml");
// Maybe a web application deployment?
if (null == wsdd)
{
- try
- {
- wsdd = root.findChild("WEB-INF/webservices.xml");
- }
- catch (IOException e)
- {
- //
- }
+ wsdd = root.findChildFailSafe("WEB-INF/webservices.xml");
}
// the descriptor is optional
Modified: spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
===================================================================
--- spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2012-12-15 00:18:36 UTC (rev 17077)
+++ spi/branches/JBWS3551/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2012-12-15 00:19:33 UTC (rev 17078)
@@ -69,7 +69,7 @@
this.loader = loader;
}
- public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+ private UnifiedVirtualFile findChild(String resourcePath, boolean throwExceptionIfNotFound) throws IOException
{
URL resourceURL = null;
if (resourcePath != null)
@@ -114,11 +114,38 @@
}
if (resourceURL == null)
- throw Messages.MESSAGES.cannotGetURLFor(resourcePath);
+ {
+ if (throwExceptionIfNotFound)
+ {
+ throw Messages.MESSAGES.cannotGetURLFor(resourcePath);
+ }
+ else
+ {
+ if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.cannotGetURLFor(resourcePath);
+ return null;
+ }
+ }
return new URLLoaderAdapter(rootURL, loader, resourceURL);
}
+ public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+ {
+ return findChild(resourcePath, true);
+ }
+
+ public UnifiedVirtualFile findChildFailSafe(String resourcePath)
+ {
+ try
+ {
+ return findChild(resourcePath, false);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
public URL toURL()
{
if (resourceURL != null)
11 years, 4 months
JBossWS SVN: r17077 - spi/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-14 19:18:36 -0500 (Fri, 14 Dec 2012)
New Revision: 17077
Added:
spi/branches/JBWS3551/
Log:
11 years, 4 months
JBossWS SVN: r17076 - stack/cxf/branches.
by jbossws-commits@lists.jboss.org
Author: mmusaji
Date: 2012-12-14 09:15:34 -0500 (Fri, 14 Dec 2012)
New Revision: 17076
Added:
stack/cxf/branches/jbossws-cxf-4.0.6.GA_JBPAPP6-1725/
Log:
[JBPAPP6-1725] - Create one off patch for CXF Stack changes
11 years, 4 months
JBossWS SVN: r17075 - thirdparty/cxf/branches.
by jbossws-commits@lists.jboss.org
Author: mmusaji
Date: 2012-12-14 04:12:52 -0500 (Fri, 14 Dec 2012)
New Revision: 17075
Added:
thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP6-1725/
Log:
[JBPAPP6-1725] - Create one off patch branch
11 years, 4 months
JBossWS SVN: r17074 - stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-13 14:12:57 -0500 (Thu, 13 Dec 2012)
New Revision: 17074
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
Log:
[JBWS-3577] Native RequestHandler as singleton
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerFactoryImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerFactoryImpl.java 2012-12-13 19:12:34 UTC (rev 17073)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerFactoryImpl.java 2012-12-13 19:12:57 UTC (rev 17074)
@@ -30,8 +30,15 @@
*/
public class RequestHandlerFactoryImpl extends RequestHandlerFactory
{
+ @Deprecated
public RequestHandler newRequestHandler()
{
return new RequestHandlerImpl();
}
+
+ @Override
+ public RequestHandler getRequestHandler()
+ {
+ return RequestHandlerImpl.getInstance();
+ }
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2012-12-13 19:12:34 UTC (rev 17073)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2012-12-13 19:12:57 UTC (rev 17074)
@@ -50,6 +50,7 @@
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.DOMWriter;
import org.jboss.ws.common.IOUtils;
+import org.jboss.ws.common.management.AbstractServerConfig;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
@@ -68,15 +69,11 @@
import org.jboss.ws.core.soap.utils.SOAPUtils;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.EndpointState;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.w3c.dom.Document;
/**
@@ -87,30 +84,21 @@
*/
public class RequestHandlerImpl implements RequestHandler
{
- protected ServerConfig serverConfig;
- protected MessageFactoryImpl msgFactory;
-
- public RequestHandlerImpl()
+ private static RequestHandlerImpl me;
+
+ RequestHandlerImpl()
{
- final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- final ServerConfig serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
-
- this.init(serverConfig);
+ //NOOP
}
- public RequestHandlerImpl(final ServerConfig serverConfig)
+ static synchronized RequestHandlerImpl getInstance()
{
- if (serverConfig == null)
- throw MESSAGES.serverConfigCannotBeNull();
-
- this.init(serverConfig);
+ if (me == null)
+ {
+ me = new RequestHandlerImpl();
+ }
+ return me;
}
-
- private void init(final ServerConfig serverConfig)
- {
- this.serverConfig = serverConfig;
- this.msgFactory = new MessageFactoryImpl();
- }
public void handleHttpRequest(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException
{
@@ -346,7 +334,7 @@
SOAPMessage reqMessage;
- msgFactory.setStyle(sepMetaData.getStyle());
+ MessageFactoryImpl msgFactory = ep.getAttachment(MessageFactoryImpl.class);
reqMessage = msgFactory.createMessage(headers, inputStream);
// Associate current message with message context
@@ -417,7 +405,7 @@
ROOT_LOGGER.trace("END handleRequest: " + ep.getName());
}
}
-
+
private long initRequestMetrics(Endpoint endpoint)
{
long beginTime = 0;
@@ -556,7 +544,7 @@
URL wsdlLocation = epMetaData.getServiceMetaData().getWsdlLocation();
String wsdlPublishLoc = epMetaData.getServiceMetaData().getWsdlPublishLocation();
- WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(wsdlLocation, wsdlPublishLoc, serverConfig);
+ WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(wsdlLocation, wsdlPublishLoc, AbstractServerConfig.getServerIntegrationServerConfig());
Document document = wsdlRequestHandler.getDocumentForPath(reqURL, resPath);
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2012-12-13 19:12:34 UTC (rev 17073)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2012-12-13 19:12:57 UTC (rev 17074)
@@ -27,6 +27,7 @@
import static org.jboss.ws.common.integration.WSHelper.isJaxrpcDeployment;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
@@ -74,6 +75,10 @@
sepMetaData.setEndpoint(ep);
ep.addAttachment(ServerEndpointMetaData.class, sepMetaData);
+
+ MessageFactoryImpl messageFactory = new MessageFactoryImpl();
+ messageFactory.setStyle(sepMetaData.getStyle());
+ ep.addAttachment(MessageFactoryImpl.class, messageFactory);
String targetBean = ep.getTargetBeanName();
if (targetBean != null)
11 years, 4 months
JBossWS SVN: r17073 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-13 14:12:34 -0500 (Thu, 13 Dec 2012)
New Revision: 17073
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
Log:
[JBWS-3577] CXF RequestHandler as singleton
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java 2012-12-13 19:11:49 UTC (rev 17072)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java 2012-12-13 19:12:34 UTC (rev 17073)
@@ -30,8 +30,14 @@
*/
public class RequestHandlerFactoryImpl extends RequestHandlerFactory
{
+ @Deprecated
public RequestHandler newRequestHandler()
{
return new RequestHandlerImpl();
}
+
+ public RequestHandler getRequestHandler()
+ {
+ return RequestHandlerImpl.getInstance();
+ }
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2012-12-13 19:11:49 UTC (rev 17072)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2012-12-13 19:12:34 UTC (rev 17073)
@@ -63,10 +63,21 @@
*/
public class RequestHandlerImpl implements RequestHandler
{
+ private static RequestHandlerImpl me;
+
RequestHandlerImpl()
{
-
+ //NOOP
}
+
+ static synchronized RequestHandlerImpl getInstance()
+ {
+ if (me == null)
+ {
+ me = new RequestHandlerImpl();
+ }
+ return me;
+ }
public void handleHttpRequest(Endpoint ep, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException
{
11 years, 4 months
JBossWS SVN: r17072 - common/trunk/src/main/java/org/jboss/ws/common/deployment.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-13 14:11:49 -0500 (Thu, 13 Dec 2012)
New Revision: 17072
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandlerFactory.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
Log:
[JBWS-3577] RequestHandler and LifecycleHandler usage as singletons
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java 2012-12-13 19:11:07 UTC (rev 17071)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java 2012-12-13 19:11:49 UTC (rev 17072)
@@ -36,6 +36,17 @@
*/
public class DefaultLifecycleHandler implements LifecycleHandler
{
+ private static DefaultLifecycleHandler me;
+
+ public static DefaultLifecycleHandler getInstance()
+ {
+ if (me == null)
+ {
+ me = new DefaultLifecycleHandler();
+ }
+ return me;
+ }
+
public void start(Endpoint ep)
{
EndpointState state = ep.getState();
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandlerFactory.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandlerFactory.java 2012-12-13 19:11:07 UTC (rev 17071)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandlerFactory.java 2012-12-13 19:11:49 UTC (rev 17072)
@@ -30,8 +30,15 @@
*/
public class DefaultLifecycleHandlerFactory extends LifecycleHandlerFactory
{
+ @Deprecated
public LifecycleHandler newLifecycleHandler()
{
return new DefaultLifecycleHandler();
}
+
+ @Override
+ public LifecycleHandler getLifecycleHandler()
+ {
+ return DefaultLifecycleHandler.getInstance();
+ }
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2012-12-13 19:11:07 UTC (rev 17071)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2012-12-13 19:11:49 UTC (rev 17072)
@@ -52,22 +52,24 @@
@Override
public void start(final Deployment dep)
{
+ final RequestHandler reqHandler = getRequestHandler();
+ final LifecycleHandler lcHandler = getLifecycleHandler();
for (final Endpoint ep : dep.getService().getEndpoints())
{
- ep.setRequestHandler(getRequestHandler());
- ep.setLifecycleHandler(getLifecycleHandler());
+ ep.setRequestHandler(reqHandler);
+ ep.setLifecycleHandler(lcHandler);
ep.setInvocationHandler(getInvocationHandler(ep));
}
}
private RequestHandler getRequestHandler()
{
- return spiProvider.getSPI(RequestHandlerFactory.class).newRequestHandler();
+ return spiProvider.getSPI(RequestHandlerFactory.class).getRequestHandler();
}
private LifecycleHandler getLifecycleHandler()
{
- return spiProvider.getSPI(LifecycleHandlerFactory.class).newLifecycleHandler();
+ return spiProvider.getSPI(LifecycleHandlerFactory.class).getLifecycleHandler();
}
private InvocationHandler getInvocationHandler(final Endpoint ep)
11 years, 4 months
JBossWS SVN: r17071 - in spi/trunk/src/main/java/org/jboss/wsf/spi: invocation and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-13 14:11:07 -0500 (Thu, 13 Dec 2012)
New Revision: 17071
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/LifecycleHandlerFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/invocation/RequestHandlerFactory.java
Log:
[JBWS-3577] Updating spi, deprecating methods to be replaced
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/LifecycleHandlerFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/LifecycleHandlerFactory.java 2012-12-13 15:14:27 UTC (rev 17070)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/LifecycleHandlerFactory.java 2012-12-13 19:11:07 UTC (rev 17071)
@@ -29,5 +29,8 @@
*/
public abstract class LifecycleHandlerFactory implements SPIView
{
+ @Deprecated
public abstract LifecycleHandler newLifecycleHandler();
+
+ public abstract LifecycleHandler getLifecycleHandler();
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/invocation/RequestHandlerFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/invocation/RequestHandlerFactory.java 2012-12-13 15:14:27 UTC (rev 17070)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/invocation/RequestHandlerFactory.java 2012-12-13 19:11:07 UTC (rev 17071)
@@ -29,5 +29,8 @@
*/
public abstract class RequestHandlerFactory implements SPIView
{
+ @Deprecated
public abstract RequestHandler newRequestHandler();
+
+ public abstract RequestHandler getRequestHandler();
}
11 years, 4 months