Author: thomas.diesler(a)jboss.com
Date: 2007-03-04 10:31:41 -0500 (Sun, 04 Mar 2007)
New Revision: 2517
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/UnifiedVirtualFile.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/UnifiedWebServiceRefHandler.java
Log:
Decouple handler chain loading from vfs adaptor
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java 2007-03-04
14:46:36 UTC (rev 2516)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java 2007-03-04
15:31:41 UTC (rev 2517)
@@ -38,7 +38,7 @@
public class VirtualFileAdaptor implements UnifiedVirtualFile
{
private static final long serialVersionUID = 6547394037548338042L;
-
+
private VirtualFile root;
public VirtualFileAdaptor(VirtualFile root)
@@ -46,11 +46,6 @@
this.root = root;
}
- public String getName()
- {
- return root.getName();
- }
-
public UnifiedVirtualFile findChild(String child) throws IOException
{
VirtualFile vf = root.findChild(child);
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/UnifiedVirtualFile.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/UnifiedVirtualFile.java 2007-03-04
14:46:36 UTC (rev 2516)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/UnifiedVirtualFile.java 2007-03-04
15:31:41 UTC (rev 2517)
@@ -36,8 +36,6 @@
*/
public interface UnifiedVirtualFile extends Serializable
{
- String getName();
-
UnifiedVirtualFile findChild(String child) throws IOException;
URL toURL();
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/UnifiedWebServiceRefHandler.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/UnifiedWebServiceRefHandler.java 2007-03-04
14:46:36 UTC (rev 2516)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/UnifiedWebServiceRefHandler.java 2007-03-04
15:31:41 UTC (rev 2517)
@@ -54,7 +54,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 17-Jan-2007
*/
-public class UnifiedWebServiceRefHandler
+public class UnifiedWebServiceRefHandler
{
// logging support
private static Logger log = Logger.getLogger(UnifiedWebServiceRefHandler.class);
@@ -62,7 +62,7 @@
protected void setupWebServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedVirtualFile vfsRoot, Source metadata) throws NamingException
{
WebServiceRef wsref = null;
-
+
// Build the list of @WebServiceRef relevant annotations
List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
for (Annotation an : anElement.getAnnotations())
@@ -145,13 +145,15 @@
HandlerChain anHandlerChain = anElement.getAnnotation(HandlerChain.class);
if (handlerChain == null && anHandlerChain != null &&
anHandlerChain.file().length() > 0)
handlerChain = anHandlerChain.file();
-
+
// Resolve path to handler chain
if (handlerChain != null)
{
+ boolean validHandlerChain = false;
try
{
new URL(handlerChain);
+ validHandlerChain = true;
}
catch (MalformedURLException ex)
{
@@ -162,27 +164,32 @@
declaringClass = ((Method)anElement).getDeclaringClass();
else if (anElement instanceof Class)
declaringClass = (Class)anElement;
-
- handlerChain = declaringClass.getPackage().getName().replace('.',
'/') + "/" + handlerChain;
- if (vfsRoot.getName().endsWith(".war"))
- handlerChain = "WEB-INF/classes/" + handlerChain;
-
- try
+
+ String resource =
declaringClass.getPackage().getName().replace('.', '/') + "/" +
handlerChain;
+ if (findHandlerChain(vfsRoot, resource))
{
- vfsRoot.findChild(handlerChain);
+ validHandlerChain = true;
+ handlerChain = resource;
}
- catch (IOException ioex)
+
+ resource = "WEB-INF/classes/" + resource;
+ if (findHandlerChain(vfsRoot, resource))
{
- throw new IllegalStateException("Cannot find handler chain: "
+ handlerChain, ioex);
+ validHandlerChain = true;
+ handlerChain = resource;
}
+
+ if (validHandlerChain == false)
+ throw new IllegalStateException("Cannot find handler chain: "
+ handlerChain);
}
+
usRef.setHandlerChain(handlerChain);
}
// Do not use rebind, the binding should be unique
// [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
Util.rebind(encCtx, encName, new ServiceReferenceable(serviceClassName,
targetClassName, usRef));
-
+
log.debug("<service-ref> bound to: java:comp/env/" + encName);
}
catch (RuntimeException rte)
@@ -194,4 +201,17 @@
throw new WSException("Cannot bind web service ref: " + encName, ex);
}
}
+
+ private boolean findHandlerChain(UnifiedVirtualFile vfsRoot, String handlerChain)
+ {
+ try
+ {
+ vfsRoot.findChild(handlerChain);
+ return true;
+ }
+ catch (IOException io)
+ {
+ return false;
+ }
+ }
}
Show replies by date