incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r788908 [2/8] - in /incubator/wink/contrib/ibm-jaxrs: src/com/ibm/ws/jaxrs/annotations/ src/com/ibm/ws/jaxrs/context/ src/com/ibm/ws/jaxrs/core/ src/com/ibm/ws/jaxrs/engine/ src/com/ibm/ws/jaxrs/exception/ src/com/ibm/ws/jaxrs/ext/ src/com/...
Date Sat, 27 Jun 2009 00:02:34 GMT
Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResourceSelector.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResourceSelector.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResourceSelector.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResourceSelector.java Sat Jun 27 00:02:26 2009
@@ -72,18 +72,17 @@
                 .getProperty(ContextConstants.MESSAGE_FLOW);
         ClassResourceInfo resource = (ClassResourceInfo) context
                 .getProperty(ContextConstants.ROOT_RESOURCE);
-        OperationResourceInfo opInfo = null;
-        boolean optionsResponseSet = false;
 
         // only proceed if this is the inbound flow
         if (RESTConstants.MESSAGE_FLOW_INBOUND.equals(flow) && resource == null) {
-            String acceptTypes = (String) context
+            OperationResourceInfo opInfo = null;
+            final String acceptTypes = (String) context
                     .getProperty(ContextConstants.HTTP_ACCEPT_HEADER);
-            String httpMethod = (String) context
+            final String httpMethod = (String) context
                     .getProperty(ContextConstants.HTTP_METHOD);
-            String contentType = (String) context
+            final String contentType = (String) context
                     .getProperty(ContextConstants.CONTENT_TYPE);
-            String pathInfo = (String) context
+            final String pathInfo = (String) context
                     .getProperty(ContextConstants.HTTP_PATH_INFO);
 
             // Now lets find which Class-level resource matches what the request URI
@@ -118,80 +117,76 @@
             }
 
             MultivaluedMap<String, String> values = new MetadataMap<String, String>();
-            resource = JAXRSUtils.selectResourceClass(resources, path, values);
+            resource = JAXRSUtils.selectResourceClass(metadata, path, values);
 
             if (resource == null) {
                 resource = JAXRSUtils.selectResourceClassFromAliases(resources,
                         path, values, context);
                 if (resource == null) {
-                    if ("OPTIONS".equalsIgnoreCase(httpMethod)) {
+                    if ("OPTIONS".equals(httpMethod)) {
                         RESTContext response = ResourceInvoker
                                 .handleOptionsRequest(context);
                         context.setProperty(
                                 ContextConstants.OPTIONS_RESPONSE_CONTEXT,
                                 response);
-                        optionsResponseSet = true;
-                    } else {
-                        Response rsp = Response.status(
-                                Response.Status.NOT_FOUND).build();
-                        throw new WebApplicationException(new RuntimeException(
-                                Messages.getMessage("resourceNotFound", path)),
-                                rsp);
+                        if (log.isDebugEnabled()) {
+                            log.debug("Options request at context root level");
+                            log.debug("ResourceSelector.invoke(): exit");
+                        }
+                        return;
                     }
+                    Response rsp = Response.status(Response.Status.NOT_FOUND)
+                            .build();
+                    throw new WebApplicationException(new RuntimeException(
+                            Messages.getMessage("resourceNotFound", path)), rsp);
                 }
             }
 
-            if (!optionsResponseSet) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Root resource ["
-                            + resource.getResourceClass().getName() + "]");
-                }
-                context.setProperty(ContextConstants.ROOT_RESOURCE, resource);
+            if (log.isDebugEnabled()) {
+                log.debug("Root resource ["
+                        + resource.getServiceClass().getName() + "]");
+            }
+            context.setProperty(ContextConstants.ROOT_RESOURCE, resource);
 
-                // add the resource and its path to our context
-                RESTEngineUtils.addMatchedResource(resource.getServiceClass(),
-                        context);
-
-                // add the matched URI to list
-                String matchedAliasPath = (String) context
-                        .getProperty(ContextConstants.MATCHED_ALIAS_PATH);
-                if (matchedAliasPath != null) {
-                    RESTEngineUtils.addMatchedUri(matchedAliasPath, context);
-                } else if (resource.getPath() != null) {
-                    RESTEngineUtils.addMatchedUri(resource.getPath(), context);
-                }
+            // add the resource and its path to our context
+            RESTEngineUtils.addMatchedResource(resource.getServiceClass(),
+                    context);
+
+            // add the matched URI to list
+            String matchedAliasPath = (String) context
+                    .getProperty(ContextConstants.MATCHED_ALIAS_PATH);
+            if (matchedAliasPath != null) {
+                RESTEngineUtils.addMatchedUri(matchedAliasPath, context);
+            } else if (resource.getPath() != null) {
+                RESTEngineUtils.addMatchedUri(resource.getPath(), context);
+            }
 
-                context.setProperty(ContextConstants.TEMPLATE_VALUES, values);
+            context.setProperty(ContextConstants.TEMPLATE_VALUES, values);
 
-                List<MediaType> acceptContentTypes = JAXRSUtils
-                        .sortMediaTypes(acceptTypes);
-                context.setProperty(ContextConstants.ACCEPT_CONTENT_TYPES,
-                        acceptContentTypes);
-
-                opInfo = JAXRSUtils.findTargetMethod(resource, values
-                        .getFirst(URITemplate.FINAL_MATCH_GROUP), httpMethod,
-                        values, contentType, acceptContentTypes);
-
-                // add the matched URI and property if we found it, otherwise do nothing, this may
-                // be an options request, in either case we'll let the invocation handler report
-                // an error if appropriate
-                if (opInfo != null) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Target method httpMethod: "
-                                + opInfo.getHttpMethod() + " Java method: "
-                                + opInfo.getMethodToInvoke().getName());
-                    }
-                    RESTEngineUtils.addMatchedUri(JAXRSUtils
-                            .getPathForOperation(values
-                                    .getFirst(URITemplate.FINAL_MATCH_GROUP),
-                                    pathInfo), context);
-                    context.setProperty(ContextConstants.OPERATION_RESOURCE,
-                            opInfo);
-                }
-            } else {
+            List<MediaType> acceptContentTypes = JAXRSUtils
+                    .sortMediaTypes(JAXRSUtils.parseMediaTypes(acceptTypes));
+            context.setProperty(ContextConstants.ACCEPT_CONTENT_TYPES,
+                    acceptContentTypes);
+
+            opInfo = JAXRSUtils.findTargetMethod(resource, values
+                    .getFirst(URITemplate.FINAL_MATCH_GROUP), httpMethod,
+                    values, contentType, acceptContentTypes);
+
+            // add the matched URI and property if we found it, otherwise do nothing, this may
+            // be an options request, in either case we'll let the invocation handler report
+            // an error if appropriate
+            if (opInfo != null) {
                 if (log.isDebugEnabled()) {
-                    log.debug("Options request at context root level");
-                }
+                    log.debug("Target method httpMethod: "
+                            + opInfo.getHttpMethod() + " Java method: "
+                            + opInfo.getMethodToInvoke().getName());
+                }
+                RESTEngineUtils.addMatchedUri(JAXRSUtils.getPathForOperation(
+                        values.getFirst(URITemplate.FINAL_MATCH_GROUP),
+                        pathInfo), context);
+                context
+                        .setProperty(ContextConstants.OPERATION_RESOURCE,
+                                opInfo);
             }
         }
 

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResourceSelector.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResponseHandler.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResponseHandler.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/handler/internal/ResponseHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessageBundle.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessageBundle.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessageBundle.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/Messages.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/Messages.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/Messages.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessagesConstants.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessagesConstants.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/MessagesConstants.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/ProjectResourceBundle.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/ProjectResourceBundle.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/ProjectResourceBundle.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/resource.properties
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/resource.properties?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/i18n/resource.properties
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalContextResolver.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalContextResolver.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalContextResolver.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalHttpServletResponse.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalHttpServletResponse.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalHttpServletResponse.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalProviders.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalProviders.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalProviders.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletConfig.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletConfig.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletConfig.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletContext.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletContext.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/injection/ThreadLocalServletContext.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ApplicationProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ApplicationProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ApplicationProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultApplication.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultApplication.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultJAXRSProviderCacheProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultJAXRSProviderCacheProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultJAXRSProviderCacheProvider.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultJAXRSProviderCacheProvider.java Sat Jun 27 00:02:26 2009
@@ -29,10 +29,10 @@
     final private ConcurrentMap<Object, ProviderFactory> cache = new ConcurrentHashMap<Object, ProviderFactory>();
 
     public void cacheProviderFactory(Object key, ProviderFactory pf) {
-        if(key == null) {
+        if (key == null) {
             return;
         }
-        cache.put(key, pf);
+        cache.putIfAbsent(key, pf);
     }
 
     public ProviderFactory getProviderFactory(Object key) {

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultJAXRSProviderCacheProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultResponseWriter.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultResponseWriter.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/DefaultResponseWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/IntegrationRegistry.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/IntegrationRegistry.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/IntegrationRegistry.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/JAXRSProviderCacheProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/JAXRSProviderCacheProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/JAXRSProviderCacheProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/MetaDataProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/MetaDataProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/MetaDataProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/OptionsResponseProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/OptionsResponseProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/OptionsResponseProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ResponseWriter.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ResponseWriter.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/integration/ResponseWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/ContentMonitor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/ContentMonitor.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/ContentMonitor.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/DelegatingOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/DelegatingOutputStream.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/DelegatingOutputStream.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogInputStream.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogInputStream.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogInputStream.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogOutputStream.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/io/LogOutputStream.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/BaseLifecycleManager.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/BaseLifecycleManager.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/BaseLifecycleManager.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/BaseLifecycleManager.java Sat Jun 27 00:02:26 2009
@@ -144,7 +144,7 @@
      * This method will create and inject the constructor parameters.
      *
      */
-    Object[] getParamInstances(AbstractResourceInfo info, RESTContext context, Constructor cstr) {
+    static Object[] getParamInstances(AbstractResourceInfo info, RESTContext context, Constructor cstr) {
         try {
             Object[] paramInstances = null;
             Map<Class<?>, ThreadLocalProxy> cstrProxies = info

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/BaseLifecycleManager.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleException.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleException.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManager.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManager.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManager.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManagerFactory.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManagerFactory.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManagerFactory.java Sat Jun 27 00:02:26 2009
@@ -36,9 +36,9 @@
     public static LifecycleManager getLifeCycleManager(AbstractResourceInfo info)
             throws IllegalArgumentException {
         if (info instanceof ProviderInfo) {
-            return new ProviderLifecycleManager();
+            return ProviderLifecycleManager.getInstance();
         } else if (info instanceof ClassResourceInfo) {
-            return new ResourceLifecycleManager();
+            return ResourceLifecycleManager.getInstance();
         } else {
             throw new IllegalArgumentException(Messages.getMessage(
                     "invalidInput00", (info != null ? info.getClass().getName()

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/LifecycleManagerFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ProviderLifecycleManager.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ProviderLifecycleManager.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ProviderLifecycleManager.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ProviderLifecycleManager.java Sat Jun 27 00:02:26 2009
@@ -39,6 +39,12 @@
     private static final Log log = LogFactory
             .getLog(ProviderLifecycleManager.class);
 
+    private static final ProviderLifecycleManager manager = new ProviderLifecycleManager();
+
+    public static ProviderLifecycleManager getInstance() {
+        return manager;
+    }
+
     /**
      * This method will create an instance of a class that was annotated with
      * the @Provider annotation. If the creation of an instance fails, a

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ProviderLifecycleManager.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ResourceLifecycleManager.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ResourceLifecycleManager.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ResourceLifecycleManager.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ResourceLifecycleManager.java Sat Jun 27 00:02:26 2009
@@ -40,6 +40,12 @@
     private static final Log log = LogFactory
             .getLog(ResourceLifecycleManager.class);
 
+    private static final ResourceLifecycleManager manager = new ResourceLifecycleManager();
+
+    public static ResourceLifecycleManager getInstance() {
+        return manager;
+    }
+
     /**
      * This method will create an instance of a class that was annotated with
      * the
@@ -71,7 +77,7 @@
         /*
          * this inject's the JAX-RS root resource classes with the root resource specific parameters
          */
-        if(instance == null) {
+        if (instance == null) {
             return null;
         }
         try {

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/lifecycle/ResourceLifecycleManager.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/MetadataRegistry.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/MetadataRegistry.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/MetadataRegistry.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/RESTMetaData.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/RESTMetaData.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/RESTMetaData.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/RESTMetaData.java Sat Jun 27 00:02:26 2009
@@ -20,7 +20,9 @@
 package com.ibm.ws.jaxrs.metadata;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.ProviderInfo;
@@ -33,9 +35,25 @@
  */
 public class RESTMetaData {
 
-    private List<ClassResourceInfo> classInfoList;
+    final private List<ClassResourceInfo> classInfoList;
 
-    private List<ProviderInfo> providerInfoList;
+    final private List<ProviderInfo> providerInfoList;
+
+    final private int CACHE_SIZE = 128;
+
+    final private ThreadLocal<Map<String, ClassResourceInfo>> classInfoCache = new ThreadLocal<Map<String, ClassResourceInfo>>() {
+
+        @Override
+        public Map<String, ClassResourceInfo> initialValue() {
+            return new LinkedHashMap<String, ClassResourceInfo>(16, 0.75f, true) {
+
+                @Override
+                public boolean removeEldestEntry(Map.Entry<String, ClassResourceInfo> eldestEntry) {
+                    return size() > CACHE_SIZE;
+                }
+            };
+        }
+    };
 
     public RESTMetaData() {
         classInfoList = new ArrayList<ClassResourceInfo>();
@@ -50,6 +68,10 @@
         return providerInfoList;
     }
 
+    public Map<String, ClassResourceInfo> getClassInfoCache() {
+        return classInfoCache.get();
+    }
+
     // Only for unit test purposes
     void clear() {
         classInfoList.clear();

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/metadata/RESTMetaData.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ApplicationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ApplicationProcessor.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ApplicationProcessor.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilder.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilder.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactory.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactoryImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoBuilderFactoryImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoInput.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoInput.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoInput.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoOutput.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoOutput.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoOutput.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoOutput.java Sat Jun 27 00:02:26 2009
@@ -51,7 +51,7 @@
         this.classInfoList = classInfoList;
         if (classInfoList != null) {
             for (ClassResourceInfo info : classInfoList) {
-                classMapping.put(info.getResourceClass().getName(), info);
+                classMapping.put(info.getServiceClass().getName(), info);
             }
         }
     }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/JAXRSInfoOutput.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ReflectiveJAXRSInfoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ReflectiveJAXRSInfoBuilder.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ReflectiveJAXRSInfoBuilder.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ReflectiveJAXRSInfoBuilder.java Sat Jun 27 00:02:26 2009
@@ -140,7 +140,7 @@
      * returned;
      *
      */
-    ClassResourceInfo processResourceClass(Class<?> clazz, Class<?> parentClazz, Object singleton, boolean isRoot) {
+    public static ClassResourceInfo processResourceClass(Class<?> clazz, Class<?> parentClazz, Object singleton, boolean isRoot) {
         ClassResourceInfo info = new ClassResourceInfoImpl(clazz, singleton,
                 isRoot);
         setTemplates(info);
@@ -148,17 +148,15 @@
         return info;
     }
 
-    void setTemplates(ClassResourceInfo info) {
-
+    static void setTemplates(ClassResourceInfo info) {
         // first get the @Path template
-        URITemplate tmpl = URITemplate.createTemplate(info, info.getPath());
-        info.setURITemplate(tmpl);
+        URITemplate tmpl = URITemplate.createTemplate(info.getPath());
 
         // now get the @Aliases/@Alias template
         String[] aliasPaths = info.getAliasPaths();
         if (aliasPaths != null) {
             for (String aliasPath : aliasPaths) {
-                tmpl = URITemplate.createTemplate(info, aliasPath);
+                tmpl = URITemplate.createTemplate(aliasPath);
                 info.addURIAliasTemplate(tmpl);
             }
         }
@@ -174,10 +172,9 @@
      * be built.
      *
      */
-    void processMethods(Class<?> clazz, Class<?> parentClazz, ClassResourceInfo classInfo) {
+    static void processMethods(Class<?> clazz, Class<?> parentClazz, ClassResourceInfo classInfo) {
         Method[] methods = clazz.getDeclaredMethods();
-        MethodDispatcher md = new MethodDispatcher();
-        classInfo.setMethodDispatcher(md);
+        MethodDispatcher md = classInfo.getMethodDispatcher();
         for (Method method : methods) {
             boolean resourceMethod = AnnotationUtils.isResourceMethod(method);
             boolean subResourceMethod = AnnotationUtils
@@ -206,13 +203,8 @@
                             + clazz.getName());
                 }
                 OperationResourceInfo ori = new OperationResourceInfoImpl(
-                        method, classInfo);
-                ori.setIsSubResourceLocator(subResourceLocator);
-                ori.setIsSubResourceMethod(subResourceMethod);
-                URITemplate t = URITemplate.createTemplate(classInfo, ori
-                        .getPath());
-                ori.setURITemplate(t);
-                setHttpMethodType(ori);
+                        method, classInfo, getHttpMethodType(method),
+                        subResourceMethod, subResourceLocator);
                 md.bind(ori, method);
             }
 
@@ -246,7 +238,7 @@
      * on a super class that is a JAX-RS resource method, subresource method,
      * or subresource locator.
      */
-    Method getInheritedMethod(Class<?> clazz, Method method) {
+    static Method getInheritedMethod(Class<?> clazz, Method method) {
         Class<?> parent = clazz.getSuperclass();
         while (parent != null && Object.class != parent) {
             Method inheritedMethod = null;
@@ -277,7 +269,7 @@
      * on a super interface that is a JAX-RS resource method, subresource method,
      * or subresource locator.
      */
-    Method getInheritedMethod(Class<?>[] interfaces, Method method) {
+    static Method getInheritedMethod(Class<?>[] interfaces, Method method) {
         Method inheritedMethod = null;
         if (interfaces != null) {
             for (Class<?> inter : interfaces) {
@@ -310,41 +302,34 @@
 
     /**
      * This method will determine the appropriate HTTP method type of the
-     * supplied OperationResourceInfo object. If multiple HTTP methods types
+     * supplied Method object. If multiple HTTP methods types
      * are declared on the method, a warning will be logged.
      */
-    void setHttpMethodType(OperationResourceInfo ori) {
-        Annotation[] annotations = ori.getAnnotatedMethod().getAnnotations();
+    static String getHttpMethodType(Method m) {
+        Annotation[] annotations = m.getAnnotations();
+        String value = null;
         for (Annotation annotation : annotations) {
             if (annotation.annotationType().getAnnotation(HttpMethod.class) != null) {
-                String value = annotation.annotationType().getAnnotation(
-                        HttpMethod.class).value();
-                if (ori.getHttpMethod() == null) {
+                if (value == null) {
+                    value = annotation.annotationType().getAnnotation(
+                            HttpMethod.class).value();
+
                     if (log.isDebugEnabled()) {
-                        log.debug("For the "
-                                + ori.getAnnotatedMethod().getName()
-                                + " method in "
-                                + "the "
-                                + ori.getAnnotatedMethod().getDeclaringClass()
-                                        .getName()
+                        log.debug("For the " + m.getName() + " method in "
+                                + "the " + m.getDeclaringClass().getName()
                                 + " class, setting HTTP method to: " + value);
                     }
-                    ori.setHttpMethod(value);
-                }
-
-                // log a warning
-                else {
+                } else {
                     if (log.isWarnEnabled()) {
                         String msg = Messages.getMessage(
-                                "methodInvalidAnnot00", ori
-                                        .getAnnotatedMethod().getName(), ori
-                                        .getAnnotatedMethod()
+                                "methodInvalidAnnot00", m.getName(), m
                                         .getDeclaringClass().getName());
                         log.warn(msg);
                     }
                 }
             }
         }
+        return value;
     }
 
     /**

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/ReflectiveJAXRSInfoBuilder.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLJAXRSInfoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLJAXRSInfoBuilder.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLJAXRSInfoBuilder.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLJAXRSInfoBuilder.java Sat Jun 27 00:02:26 2009
@@ -40,7 +40,6 @@
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
-import com.ibm.ws.jaxrs.i18n.Messages;
 import com.ibm.ws.jaxrs.lifecycle.LifecycleManagerFactory;
 import com.ibm.ws.jaxrs.model.dd.jaxb.MethodType;
 import com.ibm.ws.jaxrs.model.dd.jaxb.MethodsType;
@@ -115,7 +114,7 @@
                     }
                     classesProcessed.add(resource.getClassName());
                     ClassResourceInfo classInfo = processResource(resource,
-                            null, null);
+                            null);
                     classInfoList.add(classInfo);
                 }
             }
@@ -172,26 +171,29 @@
      * @param resource
      * @throws Exception
      */
-    ClassResourceInfo processResource(ResourceType resource, ClassResourceInfo subResourceInfo, Class<?> parentClazz)
+    ClassResourceInfo processResource(ResourceType resource, ClassResourceInfo subResourceInfo)
             throws Exception {
         Class<?> resourceClass = ClassUtils.loadClass(resource.getClassName()
                 .trim(), classLoader);
 
+        boolean isClassResourceInfoFromClassOutput = false;
         ClassResourceInfo ddClassInfo = subResourceInfo;
         if (ddClassInfo == null && classOutput != null) {
             ddClassInfo = classOutput.getClassResourceInfo(resourceClass
                     .getName());
+            if (ddClassInfo != null) {
+                classOutput.getClassInfoList().remove(ddClassInfo);
+                isClassResourceInfoFromClassOutput = true;
+            }
         }
 
         // process the resource class
         ddClassInfo = ddClassInfo == null ? new ClassResourceInfoImpl(
                 resourceClass) : ddClassInfo;
 
-        if (!StringUtils.isEmpty(resource.getPath())) {
-            ddClassInfo.setValue(ClassResourceInfo.Property.PATH, resource
-                    .getPath());
-        }
-
+        String path = !StringUtils.isEmpty(resource.getPath()) ? resource
+                .getPath() : ddClassInfo.getPath();
+        List<MediaType> consumes = ddClassInfo.getConsumes();
         // get the value of the consumes mime types
         if (resource.getConsumes() != null
                 && resource.getConsumes().getMimeType() != null) {
@@ -199,26 +201,32 @@
                     .getMimeType().size()];
             consumesTypes = resource.getConsumes().getMimeType().toArray(
                     consumesTypes);
-            ddClassInfo.setValue(ClassResourceInfo.Property.CONSUMES,
-                    JAXRSUtils.getMediaTypes(consumesTypes));
+            consumes = JAXRSUtils.getMediaTypes(consumesTypes);
         }
 
+        List<MediaType> produces = ddClassInfo.getProduces();
         // get the value of the produces mime types
         if (resource.getProduces() != null
                 && resource.getProduces().getMimeType() != null) {
             String[] producesTypes = new String[resource.getProduces()
                     .getMimeType().size()];
             resource.getProduces().getMimeType().toArray(producesTypes);
-            ddClassInfo.setValue(ClassResourceInfo.Property.PRODUCES,
-                    JAXRSUtils.getMediaTypes(producesTypes));
+            produces = JAXRSUtils.getMediaTypes(producesTypes);
         }
 
-        // create the URI template
-        URITemplate template = URITemplate.createTemplate(ddClassInfo, resource
-                .getPath());
-        ddClassInfo.setURITemplate(template);
+        ddClassInfo = new ClassResourceInfoImpl(ddClassInfo.getServiceClass(),
+                ddClassInfo.getSingleton(), ddClassInfo.isRoot(), path,
+                consumes, produces, ddClassInfo.getAliasPaths(), URITemplate
+                        .createTemplate(resource.getPath()), ddClassInfo
+                        .getMethodDispatcher(), ddClassInfo
+                        .getSubClassResourceInfoMap(), ddClassInfo
+                        .getURIAliasTemplates());
 
         processMethods(resource.getMethods(), ddClassInfo);
+
+        if (isClassResourceInfoFromClassOutput) {
+            classOutput.getClassInfoList().add(ddClassInfo);
+        }
         return ddClassInfo;
     }
 
@@ -227,15 +235,16 @@
      * the supplied 'parentInfo'. Returns null if a ClassResourceInfo is not found.
      */
     ClassResourceInfo getSubResourceInfo(String className, ClassResourceInfo parentInfo) {
-        List<ClassResourceInfo> srInfos = parentInfo.getSubClassResourceInfo();
-        if (srInfos != null) {
-            for (ClassResourceInfo srInfo : srInfos) {
-                if (className.equals(srInfo.getResourceClass().getName())) {
-                    return srInfo;
-                }
-            }
+        if (parentInfo.getSubClassResourceInfo(className) != null) {
+            return parentInfo.getSubClassResourceInfo(className);
         }
-        return null;
+        try {
+            parentInfo.addSubClassResourceInfo(new ClassResourceInfoImpl(
+                    ClassUtils.loadClass(className, classLoader)));
+        } catch (Exception e) {
+            log.debug("Could not load class: " + className, e);
+        }
+        return parentInfo.getSubClassResourceInfo(className);
     }
 
     /**
@@ -244,11 +253,8 @@
      */
     void processMethods(MethodsType methods, ClassResourceInfo classInfo)
             throws Exception {
-        Class<?> resourceClass = classInfo.getResourceClass();
-        MethodDispatcher md = classInfo.getMethodDispatcher() != null ? classInfo
-                .getMethodDispatcher()
-                : new MethodDispatcher();
-        classInfo.setMethodDispatcher(md);
+        Class<?> resourceClass = classInfo.getServiceClass();
+        MethodDispatcher md = classInfo.getMethodDispatcher();
         List<MethodType> methodTypes = methods.getMethod();
 
         // go through all the methods defined in XML
@@ -262,51 +268,94 @@
                     method.getParameter(), resourceClass);
             OperationResourceInfo opInfo = md
                     .getOperationResourceInfo(javaMethod);
-            opInfo = opInfo == null ? new OperationResourceInfoImpl(javaMethod,
-                    classInfo) : opInfo;
-
-            // set the path if it was specified
-            if (!StringUtils.isEmpty(method.getPath())) {
-                opInfo.setValue(OperationResourceInfo.Property.PATH, method
-                        .getPath());
-            }
 
-            // set the HTTP method type if it was specified
-            if (!StringUtils.isEmpty(method.getMethodType())) {
-                opInfo.setHttpMethod(method.getMethodType());
+            String httpMethodName = method.getMethodType();
+            if (httpMethodName == null && opInfo != null) {
+                httpMethodName = opInfo.getHttpMethod();
+            }
+
+            String path = (!StringUtils.isEmpty(method.getPath()) ? method
+                    .getPath() : null);
+            if (path == null && opInfo != null) {
+                path = opInfo.getPath();
+            }
+
+            boolean isSubResourceMethod = (method.getMethodType() != null)
+                    && (path != null);
+            if (!isSubResourceMethod && opInfo != null) {
+                isSubResourceMethod = opInfo.isSubResourceMethod();
+            }
+            boolean isSubResourceLocator = (method.getMethodType() == null)
+                    && (path != null);
+            if (!isSubResourceLocator && opInfo != null) {
+                isSubResourceLocator = opInfo.isSubResourceLocator();
             }
 
             // get the value of the consumes mime types
+
+            List<MediaType> consumeMediaTypes = null;
             if (method.getConsumes() != null
                     && method.getConsumes().getMimeType() != null) {
-                String[] consumesTypes = new String[method.getConsumes()
-                        .getMimeType().size()];
+                String[] consumesTypes = null;
+                consumesTypes = new String[method.getConsumes().getMimeType()
+                        .size()];
                 consumesTypes = method.getConsumes().getMimeType().toArray(
                         consumesTypes);
-                opInfo.setValue(OperationResourceInfo.Property.CONSUMES,
-                        JAXRSUtils.getMediaTypes(consumesTypes));
+                consumeMediaTypes = JAXRSUtils.getMediaTypes(consumesTypes);
+            }
+            if (opInfo != null) {
+                if (consumeMediaTypes == null) {
+                    consumeMediaTypes = opInfo.getConsumes();
+                } else {
+                    List<MediaType> existing = new ArrayList<MediaType>(opInfo
+                            .getConsumes());
+                    if (existing.size() == 1) {
+                        existing.remove(MediaType.WILDCARD_TYPE);
+                    }
+                    consumeMediaTypes.addAll(existing);
+                }
             }
 
             // get the value of the produces mime types
+            List<MediaType> produceMediaTypes = null;
             if (method.getProduces() != null
                     && method.getProduces().getMimeType() != null) {
-                String[] producesTypes = new String[method.getProduces()
-                        .getMimeType().size()];
-                method.getProduces().getMimeType().toArray(producesTypes);
-                opInfo.setValue(OperationResourceInfo.Property.PRODUCES,
-                        JAXRSUtils.getMediaTypes(producesTypes));
+                String[] producesTypes = null;
+                producesTypes = new String[method.getProduces().getMimeType()
+                        .size()];
+                producesTypes = method.getProduces().getMimeType().toArray(
+                        producesTypes);
+                produceMediaTypes = JAXRSUtils.getMediaTypes(producesTypes);
+            }
+            if (opInfo != null) {
+                if (produceMediaTypes == null) {
+                    produceMediaTypes = opInfo.getProduces();
+                } else {
+                    List<MediaType> existing = new ArrayList<MediaType>(opInfo
+                            .getProduces());
+                    if (existing.size() == 1) {
+                        existing.remove(MediaType.WILDCARD_TYPE);
+                    }
+                    produceMediaTypes.addAll(existing);
+                }
             }
 
-            if (method.isEncoded() != null) {
-                opInfo.setValue(OperationResourceInfo.Property.ENCODED, method
-                        .isEncoded());
+            String defaultValue = method.getDefaultValue();
+            if (defaultValue == null && opInfo != null) {
+                defaultValue = opInfo.getDefaultParameterValue();
             }
 
-            if (method.getDefaultValue() != null) {
-                opInfo.setValue(OperationResourceInfo.Property.DEFAULT_VALUE,
-                        method.getDefaultValue());
+            Boolean isEncoded = method.isEncoded();
+            if (isEncoded == null && opInfo != null) {
+                isEncoded = Boolean.valueOf(opInfo.isEncodedEnabled());
             }
 
+            opInfo = new OperationResourceInfoImpl(javaMethod, classInfo,
+                    httpMethodName, isSubResourceMethod, isSubResourceLocator,
+                    path, defaultValue, (isEncoded == null) ? false : isEncoded
+                            .booleanValue(), consumeMediaTypes,
+                    produceMediaTypes);
+
             // now we need to determine the resource method type, if it has an HTTP
             // method designator it is a sub resource method, the assumption here is
             // that the method would NOT be defined in the XML unless it was either
@@ -314,33 +363,25 @@
 
             // if it is a subresource locator, we need to process the return type
             // as a resource class unless we have already done so
-            if (opInfo.getHttpMethod() == null) {
+            if (isSubResourceLocator) {
                 if (log.isDebugEnabled()) {
                     log.debug("The " + javaMethod.getName()
                             + " method is a subresource " + "locator method");
                 }
-                opInfo.setIsSubResourceLocator(true);
-                opInfo.setIsSubResourceMethod(false);
                 Class<?> returnType = javaMethod.getReturnType();
                 if (!classesProcessed.contains(returnType.getName())) {
                     classesProcessed.add(returnType.getName());
                     ResourceType subResource = findResourceForClass(returnType
                             .getName());
-                    if (subResource == null) {
-                        String msg = Messages.getMessage("subResourceNotInXML",
-                                returnType.getName(), javaMethod.getName(),
-                                resourceClass.getName());
-                        throw new RuntimeException(msg);
-                    }
-                    if (log.isDebugEnabled()) {
-                        log.debug("Processing the " + returnType.getName()
-                                + " subresource class");
-                    }
-                    ClassResourceInfo subInfo = getSubResourceInfo(subResource
-                            .getClassName(), classInfo);
-                    ClassResourceInfo subResourceInfo = processResource(
-                            subResource, subInfo, classInfo.getResourceClass());
-                    if (subInfo == null) {
+                    if (subResource != null) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Processing the " + returnType.getName()
+                                    + " subresource class");
+                        }
+                        ClassResourceInfo subInfo = getSubResourceInfo(
+                                subResource.getClassName(), classInfo);
+                        ClassResourceInfo subResourceInfo = processResource(
+                                subResource, subInfo);
                         classInfo.addSubClassResourceInfo(subResourceInfo);
                     }
                 } else {
@@ -350,13 +391,7 @@
                                 + "has already been processed");
                     }
                 }
-            } else {
-                opInfo.setIsSubResourceLocator(false);
-                opInfo.setIsSubResourceMethod(true);
-            }
-            URITemplate template = URITemplate.createTemplate(classInfo, opInfo
-                    .getPath());
-            opInfo.setURITemplate(template);
+            }
             md.bind(opInfo, javaMethod);
         }
     }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLJAXRSInfoBuilder.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLReflectionInfoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLReflectionInfoBuilder.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/XMLReflectionInfoBuilder.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/AliasesType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/AliasesType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/AliasesType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ConsumesType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ConsumesType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ConsumesType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodsType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodsType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/MethodsType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ObjectFactory.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ObjectFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ParameterType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ParameterType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ParameterType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProducesType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProducesType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProducesType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProviderType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProviderType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ProviderType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourceType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourceType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourceType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourcesType.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourcesType.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/ResourcesType.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/jaxrs_dd_schema.xsd
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/jaxrs_dd_schema.xsd?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/jaxrs_dd_schema.xsd
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/package-info.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/package-info.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/dd/jaxb/package-info.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/AbstractResourceInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/AbstractResourceInfoImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/AbstractResourceInfoImpl.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/AbstractResourceInfoImpl.java Sat Jun 27 00:02:26 2009
@@ -25,15 +25,12 @@
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.Resource;
 import javax.ws.rs.CookieParam;
 import javax.ws.rs.HeaderParam;
 import javax.ws.rs.MatrixParam;
@@ -58,15 +55,13 @@
 
     final private boolean root;
 
-    final private Class<?> resourceClass;
-
     final private Class<?> serviceClass;
 
-    private List<Field> contextFields;
+    final private List<Field> contextFields;
 
-    private List<Field> resourceFields;
+    final private List<Field> resourceFields = Collections.EMPTY_LIST;
 
-    private Map<Class<?>, Method> contextMethods;
+    final private Map<Class<?>, Method> contextMethods;
 
     private Map<Field, ThreadLocalProxy> fieldProxyMap;
 
@@ -78,14 +73,17 @@
 
     final private Constructor<?> selectedConstructor;
 
-    protected AbstractResourceInfoImpl(Class<?> resourceClass, Class<?> serviceClass, boolean isRoot) {
+    protected AbstractResourceInfoImpl(Class<?> serviceClass, boolean isRoot) {
         this.serviceClass = serviceClass;
-        this.resourceClass = resourceClass;
         root = isRoot;
-        if (root && resourceClass != null) {
+        if (root && serviceClass != null) {
             initConstructorParams();
-            initContextFields();
-            initContextSetterMethods();
+            contextFields = Collections.unmodifiableList(initContextFields());
+            contextMethods = Collections
+                    .unmodifiableMap(initContextSetterMethods());
+        } else {
+            contextFields = Collections.EMPTY_LIST;
+            contextMethods = Collections.EMPTY_MAP;
         }
         if (this.serviceClass != null) {
             selectedConstructor = selectConstructor(this.serviceClass);
@@ -108,7 +106,7 @@
      *
      */
     public void initConstructorParams() {
-        Constructor<?>[] cstrs = resourceClass.getDeclaredConstructors();
+        Constructor<?>[] cstrs = serviceClass.getDeclaredConstructors();
         for (Constructor<?> cstr : cstrs) {
             Class<?>[] paramTypes = cstr.getParameterTypes();
             Annotation[][] allAnnots = cstr.getParameterAnnotations();
@@ -147,82 +145,58 @@
         }
     }
 
-    public void initContextFields() {
-        if (resourceClass == null || !root) {
-            return;
+    private List<Field> initContextFields() {
+        if (serviceClass == null || !root) {
+            return Collections.EMPTY_LIST;
         }
 
+        List<Field> fields = new ArrayList<Field>();
+
         for (Field f : getServiceClass().getDeclaredFields()) {
             for (Annotation a : f.getAnnotations()) {
                 if (a.annotationType() == Context.class) {
-                    if (contextFields == null) {
-                        contextFields = new ArrayList<Field>();
-                    }
-                    contextFields.add(f);
+                    fields.add(f);
                     if (fieldProxyMap == null) {
                         fieldProxyMap = new HashMap<Field, ThreadLocalProxy>();
                     }
                     fieldProxyMap.put(f, InjectionUtils
                             .createThreadLocalProxy(f.getType()));
-                } else if (a.annotationType() == Resource.class) {
-                    /*
-                     * should eventually add the other resources
-                     */
-                    if (resourceFields == null) {
-                        resourceFields = new ArrayList<Field>();
-                    }
-                    resourceFields.add(f);
-                    if (resourceProxyMap == null) {
-                        resourceProxyMap = new HashMap<Field, ThreadLocalProxy>();
-                    }
-                    resourceProxyMap.put(f, InjectionUtils
-                            .createThreadLocalProxy(f.getType()));
                 }
             }
         }
+        return fields;
     }
 
-    public void initContextSetterMethods() {
+    private Map<Class<?>, Method> initContextSetterMethods() {
+        Map<Class<?>, Method> methodMap = new HashMap<Class<?>, Method>();
 
         for (Method m : getServiceClass().getMethods()) {
-
             if (!m.getName().startsWith("set")
                     || m.getParameterTypes().length != 1) {
                 continue;
             }
             for (Annotation a : m.getAnnotations()) {
                 if (a.annotationType() == Context.class) {
-                    checkContextMethod(m);
+                    Class<?> type = m.getParameterTypes()[0];
+                    if (AnnotationUtils.isContextClass(type)
+                            && m.getName().startsWith("set")) {
+                        methodMap.put(type, m);
+                        if (setterProxyMap == null) {
+                            setterProxyMap = new HashMap<Method, ThreadLocalProxy>();
+                        }
+                        setterProxyMap.put(m,
+                                InjectionUtils.createThreadLocalProxy(m
+                                        .getParameterTypes()[0]));
+                    }
                     break;
                 }
             }
         }
+        return methodMap;
     }
 
-    private void checkContextMethod(Method m) {
-        Class<?> type = m.getParameterTypes()[0];
-        if (AnnotationUtils.isContextClass(type)
-                && m.getName().startsWith("set")) {
-            addContextMethod(type, m);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
     public Map<Class<?>, Method> getContextMethods() {
-        return contextMethods == null ? Collections.EMPTY_MAP : Collections
-                .unmodifiableMap(contextMethods);
-    }
-
-    private void addContextMethod(Class<?> contextClass, Method m) {
-        if (contextMethods == null) {
-            contextMethods = new HashMap<Class<?>, Method>();
-        }
-        contextMethods.put(contextClass, m);
-        if (setterProxyMap == null) {
-            setterProxyMap = new HashMap<Method, ThreadLocalProxy>();
-        }
-        setterProxyMap.put(m, InjectionUtils.createThreadLocalProxy(m
-                .getParameterTypes()[0]));
+        return contextMethods;
     }
 
     public boolean isRoot() {
@@ -230,25 +204,15 @@
     }
 
     public Class<?> getResourceClass() {
-        return resourceClass;
+        return serviceClass;
     }
 
     public List<Field> getContextFields() {
-        return getList(contextFields);
+        return contextFields;
     }
 
     public List<Field> getResourceFields() {
-        return getList(resourceFields);
-    }
-
-    private static List<Field> getList(List<Field> fields) {
-        List<Field> ret;
-        if (fields != null) {
-            ret = Collections.unmodifiableList(fields);
-        } else {
-            ret = Collections.emptyList();
-        }
-        return ret;
+        return resourceFields;
     }
 
     public Map<Class<?>, ThreadLocalProxy> getConstructorContextProxies(Constructor<?> cstr) {

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/AbstractResourceInfoImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/ClassResourceInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/ClassResourceInfoImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/ClassResourceInfoImpl.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/ClassResourceInfoImpl.java Sat Jun 27 00:02:26 2009
@@ -24,9 +24,9 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Path;
@@ -45,151 +45,203 @@
 
 public class ClassResourceInfoImpl extends AbstractResourceInfoImpl implements ClassResourceInfo {
 
-    protected URITemplate uriTemplate;
+    final protected URITemplate uriTemplate;
 
-    protected List<URITemplate> uriAliasTemplates;
+    final protected MethodDispatcher methodDispatcher;
 
-    protected MethodDispatcher methodDispatcher;
+    final protected Map<String, ClassResourceInfo> subClassResourceInfo = new ConcurrentHashMap<String, ClassResourceInfo>();
 
-    protected List<ClassResourceInfo> subClassResourceInfo = new ArrayList<ClassResourceInfo>();
+    final protected List<URITemplate> uriAliasTemplates;
 
-    protected List<Field> paramFields;
+    final protected List<Field> paramFields;
 
-    protected List<Method> paramMethods;
+    final protected List<Method> paramMethods;
 
-    protected boolean isSingleton = false;
+    final private Object singleton;
 
-    protected Object singleton;
+    final private List<MediaType> produces;
 
-    protected Map<Property, Object> values = new HashMap<Property, Object>();
+    final private List<MediaType> consumes;
 
-    private List<MediaType> produces = null;
+    final private String path;
 
-    private List<MediaType> consumes = null;
+    final private String[] aliasPaths;
 
-    private String path = null;
-
-    private boolean pathInit = false;
+    public ClassResourceInfoImpl(Class<?> theResourceClass) {
+        this(theResourceClass, null, false);
+    }
 
-    private String[] aliasPaths = null;
+    public ClassResourceInfoImpl(Class<?> theResourceClass, Object singleton, boolean isRoot) {
+        this(theResourceClass, singleton, isRoot, null,
+                (theResourceClass == null) ? null : JAXRSUtils
+                        .getConsumeTypes((Consumes) AnnotationUtils
+                                .getClassAnnotation(theResourceClass,
+                                        Consumes.class)),
+                (theResourceClass == null) ? null : JAXRSUtils
+                        .getProduceTypes((Produces) AnnotationUtils
+                                .getClassAnnotation(theResourceClass,
+                                        Produces.class)), null, null, null,
+                null, null);
+    }
+
+    public ClassResourceInfoImpl(Class<?> theResourceClass, Object singleton, boolean isRoot, String path, List<MediaType> consumes, List<MediaType> produces, String[] aliasPaths, URITemplate uriTemplate, MethodDispatcher md, Map<String, ClassResourceInfo> subClassResourceInfo, List<URITemplate> uriAliasTemplates) {
+        super(theResourceClass, isRoot);
+        this.singleton = singleton;
+        if (isRoot) {
+            paramFields = Collections.unmodifiableList(initParamFields());
+            paramMethods = Collections.unmodifiableList(initParamMethods());
+            if (singleton != null) {
+                InjectionUtils.injectContextProxies(this, singleton);
+            }
+        } else {
+            paramFields = Collections.EMPTY_LIST;
+            paramMethods = Collections.EMPTY_LIST;
+        }
+
+        if (consumes == null) {
+            this.consumes = Collections.singletonList(MediaType.WILDCARD_TYPE);
+        } else {
+            List<MediaType> temp = new ArrayList<MediaType>();
+            temp.addAll(consumes);
+            this.consumes = Collections.unmodifiableList(JAXRSUtils
+                    .sortMediaTypes(temp));
+        }
+        if (produces == null) {
+            this.produces = Collections.singletonList(MediaType.WILDCARD_TYPE);
+        } else {
+            List<MediaType> temp = new ArrayList<MediaType>();
+            temp.addAll(produces);
+            this.produces = Collections.unmodifiableList(JAXRSUtils
+                    .sortMediaTypes(temp));
+        }
+
+        if (path != null) {
+            this.path = path;
+        } else {
+            Path pathAnnot = (Path) AnnotationUtils.getClassAnnotation(
+                    getServiceClass(), Path.class);
+            this.path = pathAnnot != null ? pathAnnot.value() : null;
+        }
 
-    private boolean apInit = false;
+        if (aliasPaths != null) {
+            this.aliasPaths = aliasPaths;
+        } else {
+            // look for @Aliases first
+            Aliases aliases = (Aliases) AnnotationUtils.getClassAnnotation(
+                    getServiceClass(), Aliases.class);
+            if (aliases != null && aliases.value() != null) {
+                this.aliasPaths = new String[aliases.value().length];
+                int i = 0;
+                for (Alias alias : aliases.value()) {
+                    this.aliasPaths[i] = alias.value();
+                    i++;
+                }
+            }
+            // if not found look for @Alias
+            else {
+                Alias alias = (Alias) AnnotationUtils.getClassAnnotation(
+                        getServiceClass(), Alias.class);
+                if (alias != null && alias.value() != null) {
+                    this.aliasPaths = new String[1];
+                    this.aliasPaths[0] = alias.value();
+                } else {
+                    this.aliasPaths = null;
+                }
+            }
+        }
 
-    public ClassResourceInfoImpl(Class<?> theResourceClass, Object singleton, boolean isRoot) {
-        this(theResourceClass, theResourceClass, isRoot);
-        if (singleton != null) {
-            this.singleton = singleton;
-            isSingleton = true;
-            InjectionUtils.injectContextProxies(this, singleton);
+        if (uriTemplate != null) {
+            this.uriTemplate = uriTemplate;
+        } else if (this.path != null) {
+            this.uriTemplate = URITemplate.createTemplate(this.path);
+        } else {
+            this.uriTemplate = null;
         }
-        uriAliasTemplates = new ArrayList<URITemplate>();
-    }
 
-    public ClassResourceInfoImpl(Class<?> theResourceClass) {
-        this(theResourceClass, theResourceClass, false);
-    }
+        if (md != null) {
+            this.methodDispatcher = md;
+        } else {
+            this.methodDispatcher = new MethodDispatcher();
+        }
 
-    public ClassResourceInfoImpl(Class<?> theResourceClass, Class<?> theServiceClass, boolean theRoot) {
-        super(theResourceClass, theServiceClass, theRoot);
-        if (theRoot) {
-            initParamFields();
-            initParamMethods();
+        if (subClassResourceInfo != null) {
+            this.subClassResourceInfo.putAll(subClassResourceInfo);
         }
-    }
 
-    private void initParamFields() {
-        if (getResourceClass() == null || !isRoot()) {
-            return;
+        if (uriAliasTemplates != null) {
+            this.uriAliasTemplates = new ArrayList<URITemplate>();
+            this.uriAliasTemplates.addAll(uriAliasTemplates);
+        } else {
+            this.uriAliasTemplates = new ArrayList<URITemplate>();
         }
+    }
 
+    private List<Field> initParamFields() {
+        List<Field> fields = new ArrayList<Field>();
         for (Field f : getServiceClass().getDeclaredFields()) {
             for (Annotation a : f.getAnnotations()) {
                 if (AnnotationUtils.isParamAnnotationClass(a.annotationType())) {
-                    if (paramFields == null) {
-                        paramFields = new ArrayList<Field>();
-                    }
-                    paramFields.add(f);
+                    fields.add(f);
                 }
             }
         }
+        return fields;
     }
 
-    private void initParamMethods() {
-
+    private List<Method> initParamMethods() {
+        List<Method> methods = new ArrayList<Method>();
         for (Method m : getServiceClass().getMethods()) {
-
             if (!m.getName().startsWith("set")
                     || m.getParameterTypes().length != 1) {
                 continue;
             }
             for (Annotation a : m.getAnnotations()) {
                 if (AnnotationUtils.isParamAnnotationClass(a.annotationType())) {
-                    checkParamMethod(m, AnnotationUtils.getAnnotationValue(a));
+                    methods.add(m);
                     break;
                 }
             }
         }
+        return methods;
     }
 
     public URITemplate getURITemplate() {
         return uriTemplate;
     }
 
-    public void setURITemplate(URITemplate u) {
-        uriTemplate = u;
-    }
-
     public MethodDispatcher getMethodDispatcher() {
         return methodDispatcher;
     }
 
-    public void setMethodDispatcher(MethodDispatcher md) {
-        methodDispatcher = md;
-    }
-
     public boolean hasSubResources() {
         return !subClassResourceInfo.isEmpty();
     }
 
     public void addSubClassResourceInfo(ClassResourceInfo cri) {
-        subClassResourceInfo.add(cri);
+        subClassResourceInfo.put(cri.getServiceClass().getName(), cri);
     }
 
     public List<ClassResourceInfo> getSubClassResourceInfo() {
+        return new ArrayList<ClassResourceInfo>(subClassResourceInfo.values());
+    }
+
+    public Map<String, ClassResourceInfo> getSubClassResourceInfoMap() {
         return subClassResourceInfo;
     }
 
+    public ClassResourceInfo getSubClassResourceInfo(String className) {
+        return subClassResourceInfo.get(className);
+    }
+
     public List<MediaType> getProduces() {
-        if (values.containsKey(Property.PRODUCES)) {
-            produces = (List<MediaType>) values.get(Property.PRODUCES);
-        } else if (produces == null) {
-            Produces producesAnnot = (Produces) AnnotationUtils
-                    .getClassAnnotation(getServiceClass(), Produces.class);
-            produces = JAXRSUtils.getProduceTypes(producesAnnot);
-        }
         return produces;
     }
 
     public List<MediaType> getConsumes() {
-        if (values.containsKey(Property.CONSUMES)) {
-            consumes = (List<MediaType>) values.get(Property.CONSUMES);
-        } else if (consumes == null) {
-            Consumes consumesAnnot = (Consumes) AnnotationUtils
-                    .getClassAnnotation(getServiceClass(), Consumes.class);
-            consumes = JAXRSUtils.getConsumeTypes(consumesAnnot);
-        }
         return consumes;
     }
 
     public String getPath() {
-        if (values.containsKey(Property.PATH)) {
-            path = (String) values.get(Property.PATH);
-        } else if (!pathInit) {
-            Path pathAnnot = (Path) AnnotationUtils.getClassAnnotation(
-                    getServiceClass(), Path.class);
-            path = pathAnnot != null ? pathAnnot.value() : null;
-            pathInit = true;
-        }
         return path;
     }
 
@@ -198,64 +250,15 @@
      * optionally be present on the class.
      */
     public String[] getAliasPaths() {
-        if (values.containsKey(Property.ALIAS_PATHS)) {
-            aliasPaths = (String[]) values.get(Property.ALIAS_PATHS);
-        } else if (!apInit) {
-            if (values.containsKey(Property.ALIAS_PATH)) {
-                String[] myAliasPaths = new String[1];
-                myAliasPaths[0] = (String) values.get(Property.ALIAS_PATH);
-            } else {
-                // look for @Aliases first
-                Aliases aliases = (Aliases) AnnotationUtils.getClassAnnotation(
-                        getServiceClass(), Aliases.class);
-                if (aliases != null && aliases.value() != null) {
-                    aliasPaths = new String[aliases.value().length];
-                    int i = 0;
-                    for (Alias alias : aliases.value()) {
-                        aliasPaths[i] = alias.value();
-                        i++;
-                    }
-                }
-
-                // if not found look for @Alias
-                else {
-                    Alias alias = (Alias) AnnotationUtils.getClassAnnotation(
-                            getServiceClass(), Alias.class);
-                    if (alias != null && alias.value() != null) {
-                        aliasPaths = new String[1];
-                        aliasPaths[0] = alias.value();
-                    }
-                }
-            }
-            apInit = true;
-        }
-
         return aliasPaths;
     }
 
-    private void addParamMethod(Method m) {
-        if (paramMethods == null) {
-            paramMethods = new ArrayList<Method>();
-        }
-        paramMethods.add(m);
-    }
-
-    @SuppressWarnings("unchecked")
     public List<Method> getParameterMethods() {
-        return paramMethods == null ? Collections.EMPTY_LIST : Collections
-                .unmodifiableList(paramMethods);
+        return paramMethods;
     }
 
-    @SuppressWarnings("unchecked")
     public List<Field> getParameterFields() {
-        return paramFields == null ? Collections.EMPTY_LIST : Collections
-                .unmodifiableList(paramFields);
-    }
-
-    private void checkParamMethod(Method m, String value) {
-        if (m.getName().equalsIgnoreCase("set" + value)) {
-            addParamMethod(m);
-        }
+        return paramFields;
     }
 
     public void addURIAliasTemplate(URITemplate myURITemplate) {
@@ -268,16 +271,11 @@
 
     @Override
     public boolean isSingleton() {
-        return isSingleton;
+        return singleton != null;
     }
 
     @Override
     public Object getSingleton() {
         return singleton;
     }
-
-    public void setValue(Property property, Object value) {
-        values.put(property, value);
-    }
-
 }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/model/reflective/ClassResourceInfoImpl.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message