Author: richard.opalka(a)jboss.com
Date: 2008-04-25 09:15:58 -0400 (Fri, 25 Apr 2008)
New Revision: 6700
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/log/MessageLogPipelineHook.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java
Log:
refactoring + removing @NotNull annotation
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-04-25
12:18:47 UTC (rev 6699)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-04-25
13:15:58 UTC (rev 6700)
@@ -49,7 +49,6 @@
import org.xml.sax.EntityResolver;
-import com.sun.istack.NotNull;
import com.sun.xml.ws.api.BindingID;
import com.sun.xml.ws.api.WSBinding;
import com.sun.xml.ws.api.server.Container;
@@ -76,10 +75,7 @@
/**
* A copy of DeploymentDescriptorParser
- *
- *
* @see com.sun.xml.ws.transport.http.servlet.WSServletContextListener
- *
* @author WS Development Team
* @author Kohsuke Kawaguchi
* @author Thomas.Diesler(a)jboss.org
@@ -87,6 +83,24 @@
*/
public class DeploymentDescriptorParserExt<A>
{
+ private static final Logger logger =
Logger.getLogger(com.sun.xml.ws.util.Constants.LoggingDomain + ".server.http");
+
+ public static final String NS_RUNTIME =
"http://java.sun.com/xml/ns/jax-ws/ri/runtime";
+ public static final String JAXWS_WSDL_DD_DIR = "WEB-INF/wsdl";
+ public static final QName QNAME_ENDPOINTS = new QName(NS_RUNTIME,
"endpoints");
+ public static final QName QNAME_ENDPOINT = new QName(NS_RUNTIME,
"endpoint");
+ public static final String ATTR_VERSION = "version";
+ public static final String ATTR_NAME = "name";
+ public static final String ATTR_IMPLEMENTATION = "implementation";
+ public static final String ATTR_WSDL = "wsdl";
+ public static final String ATTR_SERVICE = "service";
+ public static final String ATTR_PORT = "port";
+ public static final String ATTR_URL_PATTERN = "url-pattern";
+ public static final String ATTR_ENABLE_MTOM = "enable-mtom";
+ public static final String ATTR_MTOM_THRESHOLD_VALUE =
"mtom-threshold-value";
+ public static final String ATTR_BINDING = "binding";
+ public static final String ATTRVALUE_VERSION_1_0 = "2.0";
+
private final Container container;
private final ClassLoader classLoader;
private final ResourceLoader loader;
@@ -156,8 +170,7 @@
* Parses the {@code sun-jaxws.xml} file and configures
* a set of {@link HttpAdapter}s.
*/
- public @NotNull
- List<A> parse(String systemId, InputStream is)
+ public List<A> parse(String systemId, InputStream is)
{
XMLStreamReader reader = null;
try
@@ -194,8 +207,7 @@
* Parses the {@code sun-jaxws.xml} file and configures
* a set of {@link HttpAdapter}s.
*/
- public @NotNull
- List<A> parse(File f) throws IOException
+ public List<A> parse(File f) throws IOException
{
FileInputStream in = new FileInputStream(f);
try
@@ -259,10 +271,10 @@
}
String implementationName = getMandatoryNonEmptyAttribute(reader, attrs,
ATTR_IMPLEMENTATION);
- Class<?> implementorClass = getImplementorClass(implementationName,
reader);
+ Class<?> implementorClass = getImplementorClass(implementationName,
reader, this.classLoader);
EndpointFactory.verifyImplementorClass(implementorClass);
- SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs,
implementorClass);
+ SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs,
implementorClass, this.classLoader, this.docs);
QName serviceName = getQNameAttribute(attrs, ATTR_SERVICE);
if (serviceName == null)
@@ -284,12 +296,12 @@
// TODO use 'docs' as the metadata. If wsdl is non-null it's the
primary.
- boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName,
portName);
+ boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName,
portName, this.classLoader);
ensureNoContent(reader);
Invoker invoker = createInvoker(implementorClass);
WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass,
!handlersSetInDD, invoker,
- serviceName, portName, container, binding, primaryWSDL, docs.values(),
createEntityResolver(), false);
+ serviceName, portName, container, binding, primaryWSDL, docs.values(),
createEntityResolver(this.loader), false);
adapters.add(adapterFactory.createAdapter(name, urlPattern, endpoint));
}
else
@@ -317,7 +329,7 @@
* @return
* is returned with only MTOMFeature set resolving the various precendece rules
*/
- private static WSBinding createBinding(String ddBindingId, Class implClass, String
mtomEnabled, String mtomThreshold)
+ private static WSBinding createBinding(String ddBindingId, Class<?> implClass,
String mtomEnabled, String mtomThreshold)
{
// Features specified through DD
WebServiceFeatureList features;
@@ -373,9 +385,7 @@
*
* @return returns corresponding API's binding ID or the same lexical
*/
- public static @NotNull
- String getBindingIdForToken(@NotNull
- String lexical)
+ private static String getBindingIdForToken(String lexical)
{
if (lexical.equals("##SOAP11_HTTP"))
{
@@ -407,9 +417,15 @@
* @return
* The pointed WSDL, if any. Otherwise null.
*/
- private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs,
Class<?> implementorClass)
+ private static SDDocumentSource getPrimaryWSDL
+ (
+ XMLStreamReader xsr,
+ Attributes attrs,
+ Class<?> implementorClass,
+ ClassLoader loader,
+ Map<String, SDDocumentSource> docs
+ )
{
-
String wsdlFile = getAttribute(attrs, ATTR_WSDL);
if (wsdlFile == null)
{
@@ -418,21 +434,7 @@
if (wsdlFile != null)
{
- /*if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR))
- {
- logger.warning("Ignoring wrong wsdl=" + wsdlFile + ". It
should start with " + JAXWS_WSDL_DD_DIR + ". Going to generate and publish a new
WSDL.");
- return null;
- }*/
-
- URL wsdl;
- try
- {
- wsdl = loader.getResource(wsdlFile);
- }
- catch (MalformedURLException e)
- {
- throw new
LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e,
xsr);
- }
+ URL wsdl = loader.getResource(wsdlFile);
if (wsdl == null)
{
throw new
LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile),
xsr);
@@ -452,7 +454,7 @@
/**
* Creates an {@link EntityResolver} that consults {@code
/WEB-INF/jax-ws-catalog.xml}.
*/
- private EntityResolver createEntityResolver()
+ private static EntityResolver createEntityResolver(ResourceLoader loader)
{
try
{
@@ -464,7 +466,7 @@
}
}
- protected String getAttribute(Attributes attrs, String name)
+ private static String getAttribute(Attributes attrs, String name)
{
String value = attrs.getValue(name);
if (value != null)
@@ -474,7 +476,7 @@
return value;
}
- protected QName getQNameAttribute(Attributes attrs, String name)
+ private static QName getQNameAttribute(Attributes attrs, String name)
{
String value = getAttribute(attrs, name);
if (value == null || value.equals(""))
@@ -487,7 +489,8 @@
}
}
- protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String
name)
+ /*
+ private static String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs,
String name)
{
String value = getAttribute(attrs, name);
if (value != null && value.equals(""))
@@ -497,7 +500,7 @@
return value;
}
- protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs,
String name)
+ private static String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs,
String name)
{
String value = getAttribute(attrs, name);
if (value == null)
@@ -505,9 +508,9 @@
failWithLocalName("runtime.parser.missing.attribute", reader, name);
}
return value;
- }
+ }*/
- protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes
attributes, String name)
+ private static String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes
attributes, String name)
{
String value = getAttribute(attributes, name);
if (value == null)
@@ -524,20 +527,16 @@
/**
* Parses the handler and role information and sets it
* on the {@link WSBinding}.
- * @return true if <handler-chains> element present in DD
- * false otherwise.
+ * @return true if <handler-chains> element present in DD false otherwise.
*/
- protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName
serviceName, QName portName)
+ private static boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader,
QName serviceName, QName portName, ClassLoader classLoader)
{
-
if (XMLStreamReaderUtil.nextElementContent(reader) ==
XMLStreamConstants.END_ELEMENT ||
!reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS))
{
-
return false;
}
HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(reader,
classLoader, serviceName, portName, binding);
-
binding.setHandlerChain(handlerInfo.getHandlers());
if (binding instanceof SOAPBinding)
{
@@ -549,7 +548,7 @@
return true;
}
- protected static void ensureNoContent(XMLStreamReader reader)
+ private static void ensureNoContent(XMLStreamReader reader)
{
if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)
{
@@ -557,47 +556,32 @@
}
}
- protected static void fail(String key, XMLStreamReader reader)
+ private static void fail(String key, XMLStreamReader reader)
{
logger.log(Level.SEVERE, key + reader.getLocation().getLineNumber());
throw new ServerRtException(key,
Integer.toString(reader.getLocation().getLineNumber()));
}
- protected static void failWithFullName(String key, XMLStreamReader reader)
+ private static void failWithFullName(String key, XMLStreamReader reader)
{
throw new ServerRtException(key, reader.getLocation().getLineNumber(),
reader.getName());
}
- protected static void failWithLocalName(String key, XMLStreamReader reader)
+ private static void failWithLocalName(String key, XMLStreamReader reader)
{
throw new ServerRtException(key, reader.getLocation().getLineNumber(),
reader.getLocalName());
}
- protected static void failWithLocalName(String key, XMLStreamReader reader, String
arg)
+ private static void failWithLocalName(String key, XMLStreamReader reader, String arg)
{
throw new ServerRtException(key, reader.getLocation().getLineNumber(),
reader.getLocalName(), arg);
}
- protected Class loadClass(String name)
- {
- try
- {
- return Class.forName(name, true, classLoader);
- }
- catch (ClassNotFoundException e)
- {
- logger.log(Level.SEVERE, e.getMessage(), e);
- throw new ServerRtException("runtime.parser.classNotFound", name);
- }
- }
-
/**
* Loads the class of the given name.
- *
- * @param xsr
- * Used to report the source location information if there's any error.
+ * @param reader used to report the source location information if there's any
error
*/
- private Class getImplementorClass(String name, XMLStreamReader xsr)
+ private static Class<?> getImplementorClass(String name, XMLStreamReader reader,
ClassLoader classLoader)
{
try
{
@@ -606,28 +590,7 @@
catch (ClassNotFoundException e)
{
logger.log(Level.SEVERE, e.getMessage(), e);
- throw new
LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_CLASS_NOT_FOUND(name), e,
xsr);
+ throw new
LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_CLASS_NOT_FOUND(name), e,
reader);
}
}
-
- public static final String NS_RUNTIME =
"http://java.sun.com/xml/ns/jax-ws/ri/runtime";
-
- public static final String JAXWS_WSDL_DD_DIR = "WEB-INF/wsdl";
-
- public static final QName QNAME_ENDPOINTS = new QName(NS_RUNTIME,
"endpoints");
- public static final QName QNAME_ENDPOINT = new QName(NS_RUNTIME,
"endpoint");
-
- public static final String ATTR_VERSION = "version";
- public static final String ATTR_NAME = "name";
- public static final String ATTR_IMPLEMENTATION = "implementation";
- public static final String ATTR_WSDL = "wsdl";
- public static final String ATTR_SERVICE = "service";
- public static final String ATTR_PORT = "port";
- public static final String ATTR_URL_PATTERN = "url-pattern";
- public static final String ATTR_ENABLE_MTOM = "enable-mtom";
- public static final String ATTR_MTOM_THRESHOLD_VALUE =
"mtom-threshold-value";
- public static final String ATTR_BINDING = "binding";
-
- public static final String ATTRVALUE_VERSION_1_0 = "2.0";
- private static final Logger logger =
Logger.getLogger(com.sun.xml.ws.util.Constants.LoggingDomain + ".server.http");
}
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/log/MessageLogPipelineHook.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/log/MessageLogPipelineHook.java 2008-04-25
12:18:47 UTC (rev 6699)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/log/MessageLogPipelineHook.java 2008-04-25
13:15:58 UTC (rev 6700)
@@ -24,7 +24,6 @@
import com.sun.xml.ws.api.server.ServerPipelineHook;
import com.sun.xml.ws.api.pipe.Pipe;
import com.sun.xml.ws.api.pipe.ServerPipeAssemblerContext;
-import com.sun.istack.NotNull;
/**
* @author Heiko.Braun(a)jboss.com
@@ -32,10 +31,7 @@
*/
public class MessageLogPipelineHook extends ServerPipelineHook
{
-
- public
- @NotNull
- Pipe createMonitoringPipe(ServerPipeAssemblerContext ctxt, @NotNull Pipe tail)
+ public Pipe createMonitoringPipe(ServerPipeAssemblerContext ctxt, Pipe tail)
{
return new DumpPipe("Message Log", System.out, tail);
}
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java 2008-04-25
12:18:47 UTC (rev 6699)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java 2008-04-25
13:15:58 UTC (rev 6700)
@@ -21,7 +21,6 @@
*/
package org.jboss.wsf.stack.metro.metadata;
-import com.sun.istack.NotNull;
import com.sun.xml.ws.api.server.BoundEndpoint;
import com.sun.xml.ws.api.server.Container;
import com.sun.xml.ws.api.server.Module;
@@ -185,8 +184,7 @@
{
private final List<BoundEndpoint> endpoints = new
ArrayList<BoundEndpoint>();
- public @NotNull
- List<BoundEndpoint> getBoundEndpoints()
+ public List<BoundEndpoint> getBoundEndpoints()
{
return endpoints;
}