wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject svn commit: r815706 - in /incubator/wink/trunk: wink-client/src/main/java/org/apache/wink/client/ wink-client/src/test/java/org/apache/wink/client/ wink-common/src/main/java/org/apache/wink/common/internal/application/ wink-common/src/main/java/org/apa...
Date Wed, 16 Sep 2009 10:08:20 GMT
Author: elman
Date: Wed Sep 16 10:08:18 2009
New Revision: 815706

URL: http://svn.apache.org/viewvc?rev=815706&view=rev
Log:
automatic registration of wink-application
See [WINK-181]

Added:
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonArrayProvider.java
      - copied, changed from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonJAXBProvider.java
      - copied, changed from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonProvider.java
      - copied, changed from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/wink-application
Removed:
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java
Modified:
    incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/ClientConfig.java
    incubator/wink/trunk/wink-client/src/test/java/org/apache/wink/client/ProvidersTest.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/application/ApplicationFileLoader.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/FileLoader.java
    incubator/wink/trunk/wink-common/src/main/resources/org/apache/wink/common/internal/i18n/resource.properties
    incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/application/ApplicationFileLoaderTest.java
    incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/atom/AtomTest.java
    incubator/wink/trunk/wink-examples/apps/QADefect/src/main/webapp/WEB-INF/application
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/org/apache/wink/providers/json/internal/JsonProviderTest.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/application/ServletApplicationFileLoader.java
    incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties

Modified: incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/ClientConfig.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/ClientConfig.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/ClientConfig.java
(original)
+++ incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/ClientConfig.java
Wed Sep 16 10:08:18 2009
@@ -52,6 +52,7 @@
     private LinkedList<Application>   applications;
     private boolean                   modifiable;
     private boolean                   isAcceptHeaderAutoSet;
+    private boolean                   loadWinkApplications = true;
 
     /**
      * Construct a new ClientConfig with the following default settings:
@@ -78,7 +79,8 @@
     private void initDefaultApplication() {
 
         try {
-            final Set<Class<?>> classes = new ApplicationFileLoader().getClasses();
+            final Set<Class<?>> classes =
+                new ApplicationFileLoader(loadWinkApplications).getClasses();
 
             applications(new WinkApplication() {
                 @Override
@@ -336,4 +338,12 @@
         }
     }
 
+    public void setLoadWinkApplications(boolean loadWinkApplications) {
+        this.loadWinkApplications = loadWinkApplications;
+    }
+
+    public boolean isLoadWinkApplications() {
+        return loadWinkApplications;
+    }
+
 }

Modified: incubator/wink/trunk/wink-client/src/test/java/org/apache/wink/client/ProvidersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-client/src/test/java/org/apache/wink/client/ProvidersTest.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-client/src/test/java/org/apache/wink/client/ProvidersTest.java
(original)
+++ incubator/wink/trunk/wink-client/src/test/java/org/apache/wink/client/ProvidersTest.java
Wed Sep 16 10:08:18 2009
@@ -39,7 +39,6 @@
 import org.apache.wink.common.internal.contexts.ProvidersImpl;
 import org.apache.wink.common.internal.lifecycle.LifecycleManagersRegistry;
 import org.apache.wink.common.internal.lifecycle.ScopeLifecycleManager;
-import org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider;
 import org.apache.wink.common.internal.registry.ProvidersRegistry;
 import org.apache.wink.common.internal.registry.metadata.ProviderMetadataCollector;
 import org.apache.wink.common.internal.runtime.AbstractRuntimeContext;
@@ -102,7 +101,7 @@
         ProvidersRegistry providersRegistry =
             new ProvidersRegistry(ofFactoryRegistry, new ApplicationValidator());
 
-        Set<Class<?>> classes = new ApplicationFileLoader().getClasses();
+        Set<Class<?>> classes = new ApplicationFileLoader(true).getClasses();
         if (classes != null) {
             for (Class<?> cls : classes) {
                 if (ProviderMetadataCollector.isProvider(cls)) {

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/application/ApplicationFileLoader.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/application/ApplicationFileLoader.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/application/ApplicationFileLoader.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/application/ApplicationFileLoader.java
Wed Sep 16 10:08:18 2009
@@ -24,6 +24,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Enumeration;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
@@ -45,6 +47,7 @@
  */
 public class ApplicationFileLoader {
 
+    private static final String WINK_APPLICATION = "META-INF/wink-application";
     private static final Logger logger           =
                                                      LoggerFactory
                                                          .getLogger(ApplicationFileLoader.class);
@@ -54,10 +57,27 @@
     /**
      * Loads core application file.
      * 
+     * @param loadWinkApplication - indicates if classes from
+     *            "META-INF/wink-application" files should be loaded
      * @throws FileNotFoundException if file is not found (should never happen)
      */
-    public ApplicationFileLoader() throws FileNotFoundException {
+    public ApplicationFileLoader(boolean loadWinkApplication) throws FileNotFoundException
{
         this(CORE_APPLICATION);
+
+        // load wink-application
+        try {
+            if (loadWinkApplication) {
+                Enumeration<URL> applications =
+                    FileLoader.loadFileUsingClassLoaders(WINK_APPLICATION);
+                while (applications.hasMoreElements()) {
+                    URL url = applications.nextElement();
+                    logger.info(Messages.getMessage("loadingApplication"), url.toExternalForm());
+                    loadClasses(url.openStream());
+                }
+            }
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
     }
 
     /**
@@ -67,7 +87,8 @@
      * @throws FileNotFoundException - if file is not found
      */
     public ApplicationFileLoader(String appConfigFile) throws FileNotFoundException {
-        this(FileLoader.loadFileAsStream(appConfigFile));
+        logger.info(Messages.getMessage("loadingApplication"), appConfigFile);
+        loadClasses(FileLoader.loadFileAsStream(appConfigFile));
     }
 
     /**

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/FileLoader.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/FileLoader.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/FileLoader.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/FileLoader.java
Wed Sep 16 10:08:18 2009
@@ -28,6 +28,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Enumeration;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +49,17 @@
      * @throws FileNotFoundException
      */
     public static URL loadFile(String fileName) throws FileNotFoundException {
-        return loadFileUsingClassLoaders(fileName);
+        Enumeration<URL> resources;
+        try {
+            resources = loadFileUsingClassLoaders(fileName);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+            throw new FileNotFoundException(fileName);
+        }
+        if (!resources.hasMoreElements()) {
+            throw new FileNotFoundException(fileName);
+        }
+        return resources.nextElement();
     }
 
     /**
@@ -80,7 +91,17 @@
         }
 
         // file is not a normal file, try to find it using classloaders
-        URL url = loadFileUsingClassLoaders(fileName);
+        Enumeration<URL> resources;
+        try {
+            resources = loadFileUsingClassLoaders(fileName);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+            throw new FileNotFoundException(fileName);
+        }
+        if (!resources.hasMoreElements()) {
+            throw new FileNotFoundException(fileName);
+        }
+        URL url = resources.nextElement();
         try {
             // decode any escaped sequences such as <space> which is %20 in URL
             URI uri = url.toURI();
@@ -106,40 +127,33 @@
      * 
      * @param filename
      * @return
-     * @throws FileNotFoundException
+     * @throws IOException 
      */
-    public static URL loadFileUsingClassLoaders(String filename) throws FileNotFoundException
{
+    public static Enumeration<URL> loadFileUsingClassLoaders(String filename) throws
IOException {
         logger.debug("Searching for {} using thread context classloader.", filename);
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-        URL url = loadFileUsingClassLoader(classLoader, filename);
-        if (url != null) {
-            return url;
+        Enumeration<URL> resources = loadFileUsingClassLoader(classLoader, filename);
+        if (resources.hasMoreElements()) {
+            return resources;
         }
 
         logger.debug("Searching for {} using current classloader.", filename);
         classLoader = FileLoader.class.getClassLoader();
-        url = loadFileUsingClassLoader(classLoader, filename);
-        if (url != null) {
-            return url;
+        resources = loadFileUsingClassLoader(classLoader, filename);
+        if (resources.hasMoreElements()) {
+            return resources;
         }
 
         logger.debug("Searching for {} using system classloader.", filename);
-        url = ClassLoader.getSystemResource(filename);
-        if (url == null) {
-            // well, the last attempt has failed! throw FileNotFoundException
-            logger.error("Failed to find file using classloaders");
-            throw new FileNotFoundException(filename);
-        }
-
-        return url;
+        return ClassLoader.getSystemResources(filename);
     }
 
-    private static URL loadFileUsingClassLoader(ClassLoader classLoader, String filename)
{
-        URL url = null;
+    private static Enumeration<URL> loadFileUsingClassLoader(ClassLoader classLoader,
String filename) throws IOException {
+        Enumeration<URL> resources = null;
         if (classLoader != null) {
-            url = classLoader.getResource(filename);
+            resources = classLoader.getResources(filename);
         }
-        return url;
+        return resources;
     }
 
 }

Modified: incubator/wink/trunk/wink-common/src/main/resources/org/apache/wink/common/internal/i18n/resource.properties
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/resources/org/apache/wink/common/internal/i18n/resource.properties?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/resources/org/apache/wink/common/internal/i18n/resource.properties
(original)
+++ incubator/wink/trunk/wink-common/src/main/resources/org/apache/wink/common/internal/i18n/resource.properties
Wed Sep 16 10:08:18 2009
@@ -27,6 +27,9 @@
 classInstantiationException=Failed to instantiate class {}.
 classIllegalAccess=Illegal access to {}.
 
+loadingApplication=Loading application from {}.
+
+
 exceptionOccurredDuringClassProcessing=An exception occurred during processing of class {}.
Ignoring class.
 listExceptionDuringClassProcessing=The following exception occurred during processing of
class: 
 exceptionOccurredDuringSingletonProcessing=An exception occurred during processing of singleton
{}. Ignoring singleton.

Modified: incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/application/ApplicationFileLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/application/ApplicationFileLoaderTest.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/application/ApplicationFileLoaderTest.java
(original)
+++ incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/application/ApplicationFileLoaderTest.java
Wed Sep 16 10:08:18 2009
@@ -29,7 +29,7 @@
 public class ApplicationFileLoaderTest extends TestCase {
 
     public void testDefault() throws IOException {
-        ApplicationFileLoader applicationFileLoader = new ApplicationFileLoader();
+        ApplicationFileLoader applicationFileLoader = new ApplicationFileLoader(true);
         Set<Class<?>> classes = applicationFileLoader.getClasses();
         assertTrue(classes
             .contains(org.apache.wink.common.internal.providers.entity.FileProvider.class));

Modified: incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/atom/AtomTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/atom/AtomTest.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/atom/AtomTest.java
(original)
+++ incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/atom/AtomTest.java
Wed Sep 16 10:08:18 2009
@@ -298,7 +298,7 @@
         ProvidersRegistry providersRegistry =
             new ProvidersRegistry(ofFactoryRegistry, new ApplicationValidator());
 
-        Set<Class<?>> classes = new ApplicationFileLoader().getClasses();
+        Set<Class<?>> classes = new ApplicationFileLoader(true).getClasses();
         if (classes != null) {
             for (Class<?> cls : classes) {
                 if (ProviderMetadataCollector.isProvider(cls)) {

Modified: incubator/wink/trunk/wink-examples/apps/QADefect/src/main/webapp/WEB-INF/application
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/apps/QADefect/src/main/webapp/WEB-INF/application?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/apps/QADefect/src/main/webapp/WEB-INF/application (original)
+++ incubator/wink/trunk/wink-examples/apps/QADefect/src/main/webapp/WEB-INF/application Wed
Sep 16 10:08:18 2009
@@ -17,6 +17,3 @@
 org.apache.wink.example.qadefect.resources.TestsResource
 org.apache.wink.example.qadefect.resources.DefectTestsResource
 
-org.apache.wink.providers.json.internal.JsonJAXBProvider
-org.apache.wink.providers.json.internal.JsonProvider
-org.apache.wink.providers.json.internal.JsonArrayProvider
\ No newline at end of file

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonArrayProvider.java
(from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonArrayProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonArrayProvider.java&p1=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java&r1=815626&r2=815706&rev=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonArrayProvider.java
Wed Sep 16 10:08:18 2009
@@ -17,7 +17,7 @@
  *  under the License.
  *  
  *******************************************************************************/
-package org.apache.wink.providers.json.internal;
+package org.apache.wink.providers.json;
 
 import java.io.IOException;
 import java.io.InputStream;

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonJAXBProvider.java
(from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonJAXBProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonJAXBProvider.java&p1=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java&r1=815626&r2=815706&rev=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonJAXBProvider.java
Wed Sep 16 10:08:18 2009
@@ -18,7 +18,7 @@
  *  
  *******************************************************************************/
 
-package org.apache.wink.providers.json.internal;
+package org.apache.wink.providers.json;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -126,24 +126,6 @@
         }
     }
 
-    // private JSONObject jaxbToJson(Object jaxbObject, Class<?> type, MediaType
-    // mediaType) {
-    // try {
-    // if (type == JAXBElement.class) {
-    // type = ((JAXBElement<?>)jaxbObject).getDeclaredType();
-    // }
-    // Marshaller marshaller = super.getMarshaller(type, mediaType);
-    // JsonContentHandler handler = new JsonContentHandler();
-    // marshaller.setListener(handler);
-    // marshaller.marshal(jaxbObject, handler);
-    // return handler.getJsonResult();
-    // } catch (JAXBException e) {
-    // logger.error(Messages.getMessage("jsonFailConvertJAXBToJSON"),
-    // type.getName());
-    // throw new WebApplicationException(e);
-    // }
-    // }
-
     public boolean isReadable(Class<?> type,
                               Type genericType,
                               Annotation[] annotations,

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonProvider.java
(from r815626, incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonProvider.java&p1=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java&r1=815626&r2=815706&rev=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JsonProvider.java
Wed Sep 16 10:08:18 2009
@@ -18,7 +18,7 @@
  *  
  *******************************************************************************/
 
-package org.apache.wink.providers.json.internal;
+package org.apache.wink.providers.json;
 
 import java.io.IOException;
 import java.io.InputStream;

Added: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/wink-application
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/wink-application?rev=815706&view=auto
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/wink-application
(added)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/resources/META-INF/wink-application
Wed Sep 16 10:08:18 2009
@@ -0,0 +1,17 @@
+#	Licensed to the Apache Software Foundation (ASF) under one or more
+#	contributor license agreements. See the NOTICE file distributed with
+#	this work for additional information regarding copyright ownership.
+#	The ASF licenses this file to you under the Apache License, Version
+#	2.0 (the "License"); you may not use this file except in compliance
+#	with the License. You may obtain a copy of the License at
+#
+#	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+#	applicable law or agreed to in writing, software distributed under the
+#	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+#	CONDITIONS OF ANY KIND, either express or implied. See the License for
+#	the specific language governing permissions and limitations under the
+#	License.
+
+org.apache.wink.providers.json.JsonJAXBProvider
+org.apache.wink.providers.json.JsonProvider
+org.apache.wink.providers.json.JsonArrayProvider
\ No newline at end of file

Modified: incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/org/apache/wink/providers/json/internal/JsonProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/org/apache/wink/providers/json/internal/JsonProviderTest.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/org/apache/wink/providers/json/internal/JsonProviderTest.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/org/apache/wink/providers/json/internal/JsonProviderTest.java
Wed Sep 16 10:08:18 2009
@@ -45,6 +45,9 @@
 import org.apache.wink.common.model.synd.SyndFeed;
 import org.apache.wink.common.model.synd.SyndText;
 import org.apache.wink.providers.json.JSONUtils;
+import org.apache.wink.providers.json.JsonArrayProvider;
+import org.apache.wink.providers.json.JsonJAXBProvider;
+import org.apache.wink.providers.json.JsonProvider;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;
 import org.json.JSONArray;

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
Wed Sep 16 10:08:18 2009
@@ -56,10 +56,11 @@
     private static final String           PROPERTY_ROOT_RESOURCE_ATOM_HTML = "atom+html";
     private static final String           PROPERTY_ROOT_RESOURCE_DEFAULT   =
                                                                                PROPERTY_ROOT_RESOURCE_ATOM_HTML;
-    private static final String           PROPERTY_ROOT_RESOURCE           =
-                                                                               "wink.rootResource";
+    private static final String           PROPERTY_ROOT_RESOURCE           = "wink.rootResource";
     private static final String           PROPERTY_ROOT_RESOURCE_CSS       =
                                                                                "wink.serviceDocumentCssPath";
+    private static final String           PROPERTY_LOAD_WINK_APPLICATIONS  =
+                                                                               "wink.loadApplications";
 
     private final DeploymentConfiguration configuration;
 
@@ -71,7 +72,12 @@
 
     private void registerDefaultApplication() {
         try {
-            final Set<Class<?>> classes = new ServletApplicationFileLoader().getClasses();
+            String loadWinkApplicationsProperty =
+                configuration.getProperties().getProperty(PROPERTY_LOAD_WINK_APPLICATIONS,
+                                                          Boolean.toString(true));
+            final Set<Class<?>> classes =
+                new ServletApplicationFileLoader(Boolean.parseBoolean(loadWinkApplicationsProperty))
+                    .getClasses();
             configuration.addApplication(new RegistrationUtils.InnerApplication(classes));
         } catch (FileNotFoundException e) {
             throw new WebApplicationException(e);

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/application/ServletApplicationFileLoader.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/application/ServletApplicationFileLoader.java?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/application/ServletApplicationFileLoader.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/application/ServletApplicationFileLoader.java
Wed Sep 16 10:08:18 2009
@@ -30,8 +30,8 @@
 
     private static final String SERVER_CORE_APPLICATION = "META-INF/server/wink-providers";
 
-    public ServletApplicationFileLoader() throws FileNotFoundException {
-        super();
+    public ServletApplicationFileLoader(boolean loadWinkApplication) throws FileNotFoundException
{
+        super(loadWinkApplication);
         loadClasses(ServletFileLoader.loadFileAsStream(SERVER_CORE_APPLICATION));
     }
 

Modified: incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties?rev=815706&r1=815705&r2=815706&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties (original)
+++ incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties Wed
Sep 16 10:08:18 2009
@@ -40,4 +40,7 @@
 # Root Resources 
 # valid values are: none, atom, atom+html
 wink.rootResource=atom+html
-wink.serviceDocumentCssPath=
\ No newline at end of file
+wink.serviceDocumentCssPath=
+
+# Indicates if wink should load all META-INF/wink-application files found in classpath
+wink.loadApplications=true
\ No newline at end of file



Mime
View raw message