You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/06/18 20:51:50 UTC
svn commit: r1137225 - in /openejb/trunk/openejb3/container/openejb-core/src:
main/java/org/apache/openejb/config/AnnotationDeployer.java
test/java/org/apache/openejb/config/AnnotationDeployerTest.java
Author: rmannibucau
Date: Sat Jun 18 18:51:49 2011
New Revision: 1137225
URL: http://svn.apache.org/viewvc?rev=1137225&view=rev
Log:
forcing locale to be the default one for connector Icon when no locale is set
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1137225&r1=1137224&r2=1137225&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Sat Jun 18 18:51:49 2011
@@ -39,6 +39,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -107,6 +108,12 @@ import javax.resource.spi.ConnectionDefi
import javax.resource.spi.Connector;
import javax.resource.spi.SecurityPermission;
import javax.resource.spi.work.WorkContext;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.WebServiceRef;
@@ -494,6 +501,9 @@ public class AnnotationDeployer implemen
for (int i = 0; i < smallIcons && i < largeIcons; i++) {
Icon icon = new Icon();
+ // locale can't be specified in the annotation and it is en by default
+ // so on other systems it doesn't work because Icon return the default locale
+ icon.setLang(Locale.getDefault().getLanguage());
if (i < smallIcons) {
icon.setSmallIcon(connectorAnnotation.smallIcon()[i]);
}
@@ -963,6 +973,8 @@ public class AnnotationDeployer implemen
webApp.getServlet().add(servlet);
}
+ webModule.getRestClasses().addAll(findRestClasses(finder));
+
return webModule;
}
@@ -4354,5 +4366,28 @@ public class AnnotationDeployer implemen
return 0;
}
-
+
+ private static Collection<String> findRestClasses(IAnnotationFinder finder) {
+ Collection<String> classes = new HashSet<String>();
+
+ // annotations on classes
+ List<Class<?>> annotatedClasses = finder.findAnnotatedClasses(Path.class);
+ for (Class<?> clazz : annotatedClasses) {
+ classes.add(clazz.getName());
+ }
+
+ // methods annotations
+ List<Method> methods = new ArrayList<Method>();
+ methods.addAll(finder.findAnnotatedMethods(Path.class));
+ methods.addAll(finder.findAnnotatedMethods(HEAD.class));
+ methods.addAll(finder.findAnnotatedMethods(PUT.class));
+ methods.addAll(finder.findAnnotatedMethods(POST.class));
+ methods.addAll(finder.findAnnotatedMethods(DELETE.class));
+ methods.addAll(finder.findAnnotatedMethods(GET.class));
+ for (Method method : methods) {
+ classes.add(method.getDeclaringClass().getName());
+ }
+
+ return classes;
+ }
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java?rev=1137225&r1=1137224&r2=1137225&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java Sat Jun 18 18:51:49 2011
@@ -226,8 +226,6 @@ public class AnnotationDeployerTest {
AnnotationDeployer.DiscoverAnnotatedBeans discvrAnnBeans = new AnnotationDeployer.DiscoverAnnotatedBeans();
discvrAnnBeans.deploy(connectorModule);
- Locale.setDefault(Locale.ENGLISH); // otherwise icons will not be found, cf Connector class
-
Connector connector = connectorModule.getConnector();
Assert.assertEquals("displayName", connector.getDisplayName());
Assert.assertEquals("description", connector.getDescription());