You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/02/19 16:48:09 UTC
svn commit: r1569795 [7/35] - in
/tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/
java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/
java/org/apache/openejb/assembler/
java/org/apache/openejb/assembler/classic/ j...
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Wed Feb 19 15:47:58 2014
@@ -365,7 +365,7 @@ public class AnnotationDeployer implemen
// TODO Remove this section. It's called by some code in the assembler.
// The scanning portion should be completed prior to this point
- public void deploy(CdiBeanInfo beanInfo) throws OpenEJBException{
+ public void deploy(final CdiBeanInfo beanInfo) throws OpenEJBException{
this.processAnnotatedBeans.deploy(beanInfo);
}
@@ -389,7 +389,7 @@ public class AnnotationDeployer implemen
return currentModule.get();
}
- private static void setModule(DeploymentModule module) {
+ private static void setModule(final DeploymentModule module) {
currentModule.set(module);
}
@@ -401,8 +401,8 @@ public class AnnotationDeployer implemen
return getModule().getValidation();
}
- private static void mergeApplicationExceptionAnnotation(AssemblyDescriptor assemblyDescriptor, Class<?> exceptionClass, ApplicationException annotation) {
- org.apache.openejb.jee.ApplicationException applicationException = assemblyDescriptor.getApplicationException(exceptionClass);
+ private static void mergeApplicationExceptionAnnotation(final AssemblyDescriptor assemblyDescriptor, final Class<?> exceptionClass, final ApplicationException annotation) {
+ final org.apache.openejb.jee.ApplicationException applicationException = assemblyDescriptor.getApplicationException(exceptionClass);
if (applicationException.getRollback() == null) {
applicationException.setRollback(annotation.rollback());
}
@@ -411,11 +411,11 @@ public class AnnotationDeployer implemen
}
}
- public static boolean isKnownEnvironmentEntryType(Class type) {
+ public static boolean isKnownEnvironmentEntryType(final Class type) {
return knownEnvironmentEntries.contains(type.getName()) || type.isEnum();
}
- public static boolean isShareableJNDINamespace(String jndiName) {
+ public static boolean isShareableJNDINamespace(final String jndiName) {
return jndiName.startsWith("java:global/") || jndiName.startsWith("java:app/") || jndiName.startsWith("java:module/");
}
@@ -429,7 +429,7 @@ public class AnnotationDeployer implemen
}
}
- for (EjbModule ejbModule : appModule.getEjbModules()) {
+ for (final EjbModule ejbModule : appModule.getEjbModules()) {
ejbModule.initAppModule(appModule);
setModule(ejbModule);
try {
@@ -438,7 +438,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (ClientModule clientModule : appModule.getClientModules()) {
+ for (final ClientModule clientModule : appModule.getClientModules()) {
clientModule.initAppModule(appModule);
setModule(clientModule);
try {
@@ -447,7 +447,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (ConnectorModule connectorModule : appModule.getConnectorModules()) {
+ for (final ConnectorModule connectorModule : appModule.getConnectorModules()) {
connectorModule.initAppModule(appModule);
setModule(connectorModule);
try {
@@ -456,7 +456,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (WebModule webModule : appModule.getWebModules()) { // here we scan by inheritance so great to keep it last
+ for (final WebModule webModule : appModule.getWebModules()) { // here we scan by inheritance so great to keep it last
webModule.initAppModule(appModule);
setModule(webModule);
try {
@@ -472,7 +472,7 @@ public class AnnotationDeployer implemen
return appModule;
}
- public ClientModule deploy(ClientModule clientModule) throws OpenEJBException {
+ public ClientModule deploy(final ClientModule clientModule) throws OpenEJBException {
if (clientModule.getApplicationClient() == null){
clientModule.setApplicationClient(new ApplicationClient());
@@ -494,10 +494,10 @@ public class AnnotationDeployer implemen
if (finder == null) {
try {
finder = FinderFactory.createFinder(clientModule);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
startupLogger.warning("startup.scrapeFailedForClientModule.url", clientModule.getJarLocation());
return clientModule;
- } catch (Exception e) {
+ } catch (final Exception e) {
startupLogger.warning("startup.scrapeFailedForClientModule", e, clientModule.getJarLocation());
return clientModule;
}
@@ -505,11 +505,11 @@ public class AnnotationDeployer implemen
// This method is also called by the deploy(EjbModule) method to see if those
// modules have any @LocalClient or @RemoteClient classes
- for (Annotated<Class<?>> clazz : finder.findMetaAnnotatedClasses(LocalClient.class)) {
+ for (final Annotated<Class<?>> clazz : finder.findMetaAnnotatedClasses(LocalClient.class)) {
clientModule.getLocalClients().add(clazz.get().getName());
}
- for (Annotated<Class<?>> clazz : finder.findMetaAnnotatedClasses(RemoteClient.class)) {
+ for (final Annotated<Class<?>> clazz : finder.findMetaAnnotatedClasses(RemoteClient.class)) {
clientModule.getRemoteClients().add(clazz.get().getName());
}
@@ -522,7 +522,7 @@ public class AnnotationDeployer implemen
return clientModule;
}
- public ConnectorModule deploy(ConnectorModule connectorModule) throws OpenEJBException {
+ public ConnectorModule deploy(final ConnectorModule connectorModule) throws OpenEJBException {
org.apache.openejb.jee.Connector connector = connectorModule.getConnector();
if (connector == null) {
@@ -535,7 +535,7 @@ public class AnnotationDeployer implemen
float specVersion = 0;
try {
specVersion = Float.parseFloat(connector.getVersion());
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
@@ -549,13 +549,13 @@ public class AnnotationDeployer implemen
try {
finder = FinderFactory.createFinder(connectorModule);
connectorModule.setFinder(finder);
- } catch (Exception e) {
+ } catch (final Exception e) {
// TODO: some sort of error
return connectorModule;
}
}
- List<Class<?>> connectorClasses = finder.findAnnotatedClasses(Connector.class);
+ final List<Class<?>> connectorClasses = finder.findAnnotatedClasses(Connector.class);
// are we allowed to have more than one connector class? Not without a deployment descriptor
if (connector.getResourceAdapter() == null || connector.getResourceAdapter().getResourceAdapterClass() == null || connector.getResourceAdapter().getResourceAdapterClass().length() == 0) {
@@ -575,7 +575,7 @@ public class AnnotationDeployer implemen
}
if (connectorClasses.size() > 1) {
- for (Class<?> cls : connectorClasses) {
+ for (final Class<?> cls : connectorClasses) {
if (cls.getName().equals(connector.getResourceAdapter().getResourceAdapterClass())) {
connectorClass = cls;
break;
@@ -592,7 +592,7 @@ public class AnnotationDeployer implemen
connector.getResourceAdapter().setResourceAdapterClass(connectorClass.getName());
}
- Connector connectorAnnotation = connectorClass.getAnnotation(Connector.class);
+ final Connector connectorAnnotation = connectorClass.getAnnotation(Connector.class);
connector.setDisplayNames(getTexts(connector.getDisplayNames(), connectorAnnotation.displayName()));
connector.setDescriptions(getTexts(connector.getDescriptions(), connectorAnnotation.description()));
@@ -602,11 +602,11 @@ public class AnnotationDeployer implemen
connector.setResourceAdapterVersion(getString(connector.getResourceAdapterVersion(), connectorAnnotation.version()));
if (connector.getIcons().isEmpty()) {
- int smallIcons = connectorAnnotation.smallIcon().length;
- int largeIcons = connectorAnnotation.largeIcon().length;
+ final int smallIcons = connectorAnnotation.smallIcon().length;
+ final int largeIcons = connectorAnnotation.largeIcon().length;
for (int i = 0; i < smallIcons && i < largeIcons; i++) {
- Icon icon = new Icon();
+ final 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());
@@ -623,7 +623,7 @@ public class AnnotationDeployer implemen
}
if (connector.getLicense() == null) {
- License license = new License();
+ final License license = new License();
connector.setLicense(license);
license.setLicenseRequired(connectorAnnotation.licenseRequired());
}
@@ -631,21 +631,21 @@ public class AnnotationDeployer implemen
connector.getLicense().setDescriptions(getTexts(connector.getLicense().getDescriptions(), connectorAnnotation.licenseDescription()));
- SecurityPermission[] annotationSecurityPermissions = connectorAnnotation.securityPermissions();
- List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
+ final SecurityPermission[] annotationSecurityPermissions = connectorAnnotation.securityPermissions();
+ final List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
if (securityPermission == null || securityPermission.size() == 0) {
- for (SecurityPermission sp : annotationSecurityPermissions) {
- org.apache.openejb.jee.SecurityPermission permission = new org.apache.openejb.jee.SecurityPermission();
+ for (final SecurityPermission sp : annotationSecurityPermissions) {
+ final org.apache.openejb.jee.SecurityPermission permission = new org.apache.openejb.jee.SecurityPermission();
permission.setSecurityPermissionSpec(sp.permissionSpec());
permission.setDescriptions(stringsToTexts(sp.description()));
securityPermission.add(permission);
}
}
- Class<? extends WorkContext>[] annotationRequiredWorkContexts = connectorAnnotation.requiredWorkContexts();
- List<String> requiredWorkContext = connector.getRequiredWorkContext();
+ final Class<? extends WorkContext>[] annotationRequiredWorkContexts = connectorAnnotation.requiredWorkContexts();
+ final List<String> requiredWorkContext = connector.getRequiredWorkContext();
if (requiredWorkContext.size() == 0) {
- for (Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
+ for (final Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
requiredWorkContext.add(cls.getName());
}
}
@@ -656,11 +656,11 @@ public class AnnotationDeployer implemen
connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
}
- List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
- javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
+ final List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
+ final javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
if (authenticationMechanisms.size() == 0) {
- for (javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
- AuthenticationMechanism authMechanism = new AuthenticationMechanism();
+ for (final javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
+ final AuthenticationMechanism authMechanism = new AuthenticationMechanism();
authMechanism.setAuthenticationMechanismType(am.authMechanism());
authMechanism.setCredentialInterface(am.credentialInterface().toString());
authMechanism.setDescriptions(stringsToTexts(am.description()));
@@ -680,18 +680,18 @@ public class AnnotationDeployer implemen
// process @ConnectionDescription(s)
List<Class<?>> classes = finder.findAnnotatedClasses(ConnectionDefinitions.class);
- for (Class<?> cls : classes) {
- ConnectionDefinitions connectionDefinitionsAnnotation = cls.getAnnotation(ConnectionDefinitions.class);
- ConnectionDefinition[] definitions = connectionDefinitionsAnnotation.value();
+ for (final Class<?> cls : classes) {
+ final ConnectionDefinitions connectionDefinitionsAnnotation = cls.getAnnotation(ConnectionDefinitions.class);
+ final ConnectionDefinition[] definitions = connectionDefinitionsAnnotation.value();
- for (ConnectionDefinition definition : definitions) {
+ for (final ConnectionDefinition definition : definitions) {
processConnectionDescription(connector.getResourceAdapter(), definition, cls);
}
}
classes = finder.findAnnotatedClasses(ConnectionDefinition.class);
- for (Class<?> cls : classes) {
- ConnectionDefinition connectionDefinitionAnnotation = cls.getAnnotation(ConnectionDefinition.class);
+ for (final Class<?> cls : classes) {
+ final ConnectionDefinition connectionDefinitionAnnotation = cls.getAnnotation(ConnectionDefinition.class);
processConnectionDescription(connector.getResourceAdapter(), connectionDefinitionAnnotation, cls);
}
@@ -709,12 +709,12 @@ public class AnnotationDeployer implemen
}
classes = finder.findAnnotatedClasses(Activation.class);
- for (Class<?> cls : classes) {
+ for (final Class<?> cls : classes) {
MessageListener messageListener = null;
- Activation activationAnnotation = cls.getAnnotation(Activation.class);
+ final Activation activationAnnotation = cls.getAnnotation(Activation.class);
- List<MessageListener> messageListeners = messageAdapter.getMessageListener();
- for (MessageListener ml : messageListeners) {
+ final List<MessageListener> messageListeners = messageAdapter.getMessageListener();
+ for (final MessageListener ml : messageListeners) {
if (cls.getName().equals(ml.getActivationSpec().getActivationSpecClass())) {
messageListener = ml;
break;
@@ -722,29 +722,29 @@ public class AnnotationDeployer implemen
}
if (messageListener == null) {
- Class<?>[] listeners = activationAnnotation.messageListeners();
- for (Class<?> listener : listeners) {
+ final Class<?>[] listeners = activationAnnotation.messageListeners();
+ for (final Class<?> listener : listeners) {
messageAdapter.addMessageListener(new MessageListener(listener.getName(), cls.getName()));
}
}
}
classes = finder.findAnnotatedClasses(AdministeredObject.class);
- List<AdminObject> adminObjects = connector.getResourceAdapter().getAdminObject();
- for (Class<?> cls : classes) {
- AdministeredObject administeredObjectAnnotation = cls.getAnnotation(AdministeredObject.class);
- Class[] adminObjectInterfaces = administeredObjectAnnotation.adminObjectInterfaces();
+ final List<AdminObject> adminObjects = connector.getResourceAdapter().getAdminObject();
+ for (final Class<?> cls : classes) {
+ final AdministeredObject administeredObjectAnnotation = cls.getAnnotation(AdministeredObject.class);
+ final Class[] adminObjectInterfaces = administeredObjectAnnotation.adminObjectInterfaces();
AdminObject adminObject = null;
- for (AdminObject admObj : adminObjects) {
+ for (final AdminObject admObj : adminObjects) {
if (admObj.getAdminObjectClass().equals(cls.getName())) {
adminObject = admObj;
}
}
if (adminObject == null) {
- for (Class iface : adminObjectInterfaces) {
- AdminObject newAdminObject = new AdminObject();
+ for (final Class iface : adminObjectInterfaces) {
+ final AdminObject newAdminObject = new AdminObject();
newAdminObject.setAdminObjectClass(cls.getName());
newAdminObject.setAdminObjectInterface(iface.getName());
adminObjects.add(newAdminObject);
@@ -755,30 +755,30 @@ public class AnnotationDeployer implemen
// need to make a list of classes to process for config properties
// resource adapter
- String raCls = connector.getResourceAdapter().getResourceAdapterClass();
+ final String raCls = connector.getResourceAdapter().getResourceAdapterClass();
process(connectorModule.getClassLoader(), raCls, connector.getResourceAdapter());
// managedconnectionfactory
if (connector.getResourceAdapter() != null && connector.getResourceAdapter().getOutboundResourceAdapter() != null) {
- List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinitions = connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition();
- for (org.apache.openejb.jee.ConnectionDefinition connectionDefinition : connectionDefinitions) {
+ final List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinitions = connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition();
+ for (final org.apache.openejb.jee.ConnectionDefinition connectionDefinition : connectionDefinitions) {
process(connectorModule.getClassLoader(), connectionDefinition.getManagedConnectionFactoryClass(), connectionDefinition);
}
}
// administeredobject
if (connector.getResourceAdapter() != null) {
- List<AdminObject> raAdminObjects = connector.getResourceAdapter().getAdminObject();
- for (AdminObject raAdminObject : raAdminObjects) {
+ final List<AdminObject> raAdminObjects = connector.getResourceAdapter().getAdminObject();
+ for (final AdminObject raAdminObject : raAdminObjects) {
process(connectorModule.getClassLoader(), raAdminObject.getAdminObjectClass(), raAdminObject);
}
}
// activationspec
if (connector.getResourceAdapter() != null && connector.getResourceAdapter().getInboundResourceAdapter() != null && connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter() != null) {
- List<MessageListener> messageListeners = connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener();
- for (MessageListener messageListener : messageListeners) {
- ActivationSpec activationSpec = messageListener.getActivationSpec();
+ final List<MessageListener> messageListeners = connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener();
+ for (final MessageListener messageListener : messageListeners) {
+ final ActivationSpec activationSpec = messageListener.getActivationSpec();
process(connectorModule.getClassLoader(), activationSpec.getActivationSpecClass(), activationSpec);
}
}
@@ -786,13 +786,13 @@ public class AnnotationDeployer implemen
return connectorModule;
}
- void process(ClassLoader cl, String cls, Object object) {
+ void process(final ClassLoader cl, final String cls, final Object object) {
List<ConfigProperty> configProperties = null;
try {
// grab a list of ConfigProperty objects
configProperties = (List<ConfigProperty>) object.getClass().getDeclaredMethod("getConfigProperty").invoke(object);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
@@ -809,15 +809,15 @@ public class AnnotationDeployer implemen
final List<String> allowedTypes = Arrays.asList(new String[] { Boolean.class.getName(), String.class.getName(), Integer.class.getName(), Double.class.getName(), Byte.class.getName(), Short.class.getName(), Long.class.getName(), Float.class.getName(), Character.class.getName()});
try {
- Class<?> clazz = classLoader.loadClass(realClassName(cls));
- Object o = clazz.newInstance();
+ final Class<?> clazz = classLoader.loadClass(realClassName(cls));
+ final Object o = clazz.newInstance();
// add any introspected properties
- BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
- PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ final BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
+ final PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- String name = propertyDescriptor.getName();
+ for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ final String name = propertyDescriptor.getName();
Class<?> type = propertyDescriptor.getPropertyType();
if (type == null) {
continue;
@@ -832,13 +832,13 @@ public class AnnotationDeployer implemen
if (! containsConfigProperty(configProperties, name)) {
if (type != null) {
- ConfigProperty configProperty = new ConfigProperty();
+ final ConfigProperty configProperty = new ConfigProperty();
configProperties.add(configProperty);
Object value = null;
try {
value = propertyDescriptor.getReadMethod().invoke(o);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
@@ -847,7 +847,7 @@ public class AnnotationDeployer implemen
try {
// if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
- } catch (Exception ignored) {
+ } catch (final Exception ignored) {
// no-op : getDeclaredField() throws exceptions and does not return null
}
}
@@ -872,23 +872,23 @@ public class AnnotationDeployer implemen
}
// add any annotated fields we haven't already picked up
- Field[] declaredFields = clazz.getDeclaredFields();
- for (Field field : declaredFields) {
- javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);
+ final Field[] declaredFields = clazz.getDeclaredFields();
+ for (final Field field : declaredFields) {
+ final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);
- String name = field.getName();
+ final String name = field.getName();
Object value = null;
try {
value = field.get(o);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
if (! containsConfigProperty(configProperties, name)) {
- String type = getConfigPropertyType(annotation, field.getType());
+ final String type = getConfigPropertyType(annotation, field.getType());
if (type != null) {
- ConfigProperty configProperty = new ConfigProperty();
+ final ConfigProperty configProperty = new ConfigProperty();
configProperties.add(configProperty);
configProperty.setConfigPropertyName(name);
@@ -908,12 +908,12 @@ public class AnnotationDeployer implemen
}
}
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
- private String getConfigPropertyType(javax.resource.spi.ConfigProperty annotation, Class<?> type) {
+ private String getConfigPropertyType(final javax.resource.spi.ConfigProperty annotation, final Class<?> type) {
Class<?> t = annotation == null ? null : annotation.type();
if (t == null && type != null) {
return type.getName();
@@ -935,8 +935,8 @@ public class AnnotationDeployer implemen
return t.getName();
}
- private boolean containsConfigProperty(List<ConfigProperty> configProperties, String name) {
- for (ConfigProperty configProperty : configProperties) {
+ private boolean containsConfigProperty(final List<ConfigProperty> configProperties, final String name) {
+ for (final ConfigProperty configProperty : configProperties) {
if (configProperty.getConfigPropertyName().equals(name)) {
return true;
}
@@ -945,7 +945,7 @@ public class AnnotationDeployer implemen
return false;
}
- private Class<?> getWrapper(String primitiveType) {
+ private Class<?> getWrapper(final String primitiveType) {
final Map<String,Class<?>> builtInMap = new HashMap<String,Class<?>>();{
builtInMap.put("int", Integer.class);
builtInMap.put("long", Long.class);
@@ -961,7 +961,7 @@ public class AnnotationDeployer implemen
return builtInMap.get(primitiveType);
}
- private void processConnectionDescription(ResourceAdapter resourceAdapter, ConnectionDefinition connectionDefinitionAnnotation, Class<?> cls) {
+ private void processConnectionDescription(final ResourceAdapter resourceAdapter, final ConnectionDefinition connectionDefinitionAnnotation, final Class<?> cls) {
// try and find the managed connection factory
OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
@@ -970,10 +970,10 @@ public class AnnotationDeployer implemen
resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
}
- List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinition = outboundResourceAdapter.getConnectionDefinition();
+ final List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinition = outboundResourceAdapter.getConnectionDefinition();
org.apache.openejb.jee.ConnectionDefinition definition = null;
- for (org.apache.openejb.jee.ConnectionDefinition cd : connectionDefinition) {
+ for (final org.apache.openejb.jee.ConnectionDefinition cd : connectionDefinition) {
if (cd.getManagedConnectionFactoryClass().equals(cls.getName())) {
definition = cd;
break;
@@ -1006,12 +1006,12 @@ public class AnnotationDeployer implemen
}
}
- private Text[] stringsToTexts(String[] strings) {
+ private Text[] stringsToTexts(final String[] strings) {
if (strings == null) {
return null;
}
- Text[] result = new Text[strings.length];
+ final Text[] result = new Text[strings.length];
for (int i = 0; i < result.length; i++) {
result[i] = new Text();
result[i].setValue(strings[i]);
@@ -1020,7 +1020,7 @@ public class AnnotationDeployer implemen
return result;
}
- private String getString(String descriptorString, String annotationString) {
+ private String getString(final String descriptorString, final String annotationString) {
if (descriptorString != null && descriptorString.length() > 0) {
return descriptorString;
}
@@ -1032,9 +1032,9 @@ public class AnnotationDeployer implemen
return null;
}
- private Text[] getTexts(Text[] originalTexts, String[] newStrings) {
+ private Text[] getTexts(final Text[] originalTexts, final String[] newStrings) {
if (newStrings != null && newStrings.length > 0 && (originalTexts == null || originalTexts.length == 0)) {
- Text[] texts = new Text[newStrings.length];
+ final Text[] texts = new Text[newStrings.length];
for (int i = 0; i < newStrings.length; i++) {
texts[i] = new Text(null, newStrings[i]);
}
@@ -1045,7 +1045,7 @@ public class AnnotationDeployer implemen
}
}
- public WebModule deploy(WebModule webModule) throws OpenEJBException {
+ public WebModule deploy(final WebModule webModule) throws OpenEJBException {
WebApp webApp = webModule.getWebApp();
if (webApp != null && webApp.isMetadataComplete()) return webModule;
@@ -1053,7 +1053,7 @@ public class AnnotationDeployer implemen
if (webModule.getFinder() == null) {
webModule.setFinder(FinderFactory.createFinder(webModule));
}
- } catch (Exception e) {
+ } catch (final Exception e) {
startupLogger.warning("Unable to scrape for @WebService or @WebServiceProvider annotations. AnnotationFinder failed.", e);
return webModule;
}
@@ -1063,26 +1063,26 @@ public class AnnotationDeployer implemen
webModule.setWebApp(webApp);
}
- List<String> existingServlets = new ArrayList<String>();
- for (Servlet servlet : webApp.getServlet()) {
+ final List<String> existingServlets = new ArrayList<String>();
+ for (final Servlet servlet : webApp.getServlet()) {
if (servlet.getServletClass() != null) {
existingServlets.add(servlet.getServletClass());
}
}
- IAnnotationFinder finder = webModule.getFinder();
- List<Class> classes = new ArrayList<Class>();
+ final IAnnotationFinder finder = webModule.getFinder();
+ final List<Class> classes = new ArrayList<Class>();
classes.addAll(finder.findAnnotatedClasses(WebService.class));
classes.addAll(finder.findAnnotatedClasses(WebServiceProvider.class));
- for (Class<?> webServiceClass : classes) {
+ for (final Class<?> webServiceClass : classes) {
// If this class is also annotated @Stateless or @Singleton, we should skip it
if (webServiceClass.isAnnotationPresent(Singleton.class) || webServiceClass.isAnnotationPresent(Stateless.class)) {
webModule.getEjbWebServices().add(webServiceClass.getName());
continue;
}
- int modifiers = webServiceClass.getModifiers();
+ final int modifiers = webServiceClass.getModifiers();
if (!Modifier.isPublic(modifiers) || Modifier.isFinal(modifiers) || Modifier.isAbstract(modifiers)) {
continue;
}
@@ -1113,16 +1113,16 @@ public class AnnotationDeployer implemen
// findSubclasses will not work by default to gain a lot of time
// look FinderFactory for the flag to activate it or
// use @ApplicationPath("/")
- List<Class<? extends Application>> applications = finder.findSubclasses(Application.class);
- for (Class<? extends Application> app : applications) {
+ final List<Class<? extends Application>> applications = finder.findSubclasses(Application.class);
+ for (final Class<? extends Application> app : applications) {
addRestApplicationIfPossible(webModule, app);
}
// look for ApplicationPath, it will often return the same than the previous one
// but without finder.link() invocation it still works
// so it can save a lot of startup time
- List<Annotated<Class<?>>> applicationsByAnnotation = finder.findMetaAnnotatedClasses(ApplicationPath.class);
- for (Annotated<Class<?>> annotatedApp : applicationsByAnnotation) {
+ final List<Annotated<Class<?>>> applicationsByAnnotation = finder.findMetaAnnotatedClasses(ApplicationPath.class);
+ for (final Annotated<Class<?>> annotatedApp : applicationsByAnnotation) {
final Class<?> app = annotatedApp.get();
if (!Application.class.isAssignableFrom(app)) {
logger.error("class '" + app.getName() + "' is annotated with @ApplicationPath but doesn't implement " + Application.class.getName());
@@ -1144,11 +1144,11 @@ public class AnnotationDeployer implemen
}
final ClassLoader classLoader = webModule.getClassLoader();
- for (String jsfClass : JSF_CLASSES) {
+ for (final String jsfClass : JSF_CLASSES) {
final Class<? extends Annotation> clazz;
try {
clazz = (Class<? extends Annotation>) classLoader.loadClass(jsfClass);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
@@ -1189,11 +1189,11 @@ public class AnnotationDeployer implemen
*/
Map<String, String> urlByClasses = null;
- for (String apiClassName : WEB_CLASSES) {
+ for (final String apiClassName : WEB_CLASSES) {
final Class<? extends Annotation> clazz;
try {
clazz = (Class<? extends Annotation>) classLoader.loadClass(apiClassName);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
@@ -1205,9 +1205,9 @@ public class AnnotationDeployer implemen
if (archive instanceof WebappAggregatedArchive) {
final Map<URL, List<String>> index = ((WebappAggregatedArchive) archive).getClassesMap();
urlByClasses = new HashMap<String, String>();
- for (Map.Entry<URL, List<String>> entry : index.entrySet()) {
+ for (final Map.Entry<URL, List<String>> entry : index.entrySet()) {
final String url = entry.getKey().toExternalForm();
- for (String current : entry.getValue()) {
+ for (final String current : entry.getValue()) {
urlByClasses.put(current, url);
}
}
@@ -1228,7 +1228,7 @@ public class AnnotationDeployer implemen
}
private void addJaxRsProviders(final IAnnotationFinder finder, final Collection<String> set, final Class<? extends Annotation> annotation) {
- for (Annotated<Class<?>> provider : finder.findMetaAnnotatedClasses(annotation)) {
+ for (final Annotated<Class<?>> provider : finder.findMetaAnnotatedClasses(annotation)) {
set.add(provider.get().getName());
}
}
@@ -1241,7 +1241,7 @@ public class AnnotationDeployer implemen
if (app.getConstructors().length == 0) {
webModule.getRestApplications().add(app.getName());
} else {
- for (Constructor<?> ctr : app.getConstructors()) {
+ for (final Constructor<?> ctr : app.getConstructors()) {
if (ctr.getParameterTypes().length == 0) {
webModule.getRestApplications().add(app.getName());
break;
@@ -1250,7 +1250,7 @@ public class AnnotationDeployer implemen
}
}
- public EjbModule deploy(EjbModule ejbModule) throws OpenEJBException {
+ public EjbModule deploy(final EjbModule ejbModule) throws OpenEJBException {
if (ejbModule.getEjbJar() != null && ejbModule.getEjbJar().isMetadataComplete()) return ejbModule;
@@ -1258,15 +1258,15 @@ public class AnnotationDeployer implemen
if (ejbModule.getFinder() == null) {
ejbModule.setFinder(FinderFactory.createFinder(ejbModule));
}
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
startupLogger.warning("startup.scrapeFailedForModule", ejbModule.getJarLocation());
return ejbModule;
- } catch (Exception e) {
+ } catch (final Exception e) {
startupLogger.warning("Unable to scrape for @Stateful, @Stateless, @Singleton or @MessageDriven annotations. AnnotationFinder failed.", e);
return ejbModule;
}
- IAnnotationFinder finder = ejbModule.getFinder();
+ final IAnnotationFinder finder = ejbModule.getFinder();
final List<String> managedClasses;
@@ -1278,7 +1278,7 @@ public class AnnotationDeployer implemen
final List<String> classNames = getBeanClasses(finder);
final Set<String> notLoadedClasses = new TreeSet<String>();
- for (String rawClassName : classNames) {
+ for (final String rawClassName : classNames) {
final String className = realClassName(rawClassName);
try {
final ClassLoader loader = ejbModule.getClassLoader();
@@ -1328,23 +1328,23 @@ public class AnnotationDeployer implemen
// Fill in default sessionType for xml declared EJBs
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
if (!(bean instanceof SessionBean)) continue;
- SessionBean sessionBean = (SessionBean) bean;
+ final SessionBean sessionBean = (SessionBean) bean;
if (sessionBean.getSessionType() != null) continue;
try {
final Class<?> clazz = ejbModule.getClassLoader().loadClass(bean.getEjbClass());
sessionBean.setSessionType(getSessionType(clazz));
- } catch (Throwable handledInValidation) {
+ } catch (final Throwable handledInValidation) {
// no-op
}
}
// Fill in default ejbName for xml declared EJBs
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
if (bean.getEjbClass() == null) continue;
if (bean.getEjbName() == null || bean.getEjbName().startsWith("@NULL@")) {
ejbModule.getEjbJar().removeEnterpriseBean(bean.getEjbName());
@@ -1352,7 +1352,7 @@ public class AnnotationDeployer implemen
final Class<?> clazz = ejbModule.getClassLoader().loadClass(bean.getEjbClass());
final String ejbName = getEjbName(bean, clazz);
bean.setEjbName(ejbName);
- } catch (Throwable handledInValidation) {
+ } catch (final Throwable handledInValidation) {
// no-op
}
ejbModule.getEjbJar().addEnterpriseBean(bean);
@@ -1360,15 +1360,15 @@ public class AnnotationDeployer implemen
}
/* 19.2: ejb-name: Default is the unqualified name of the bean class */
- EjbJar ejbJar = ejbModule.getEjbJar();
- for (Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Singleton.class)) {
+ final EjbJar ejbJar = ejbModule.getEjbJar();
+ for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Singleton.class)) {
if (beanClass.isAnnotationPresent(Specializes.class)) {
specializingClasses.add(beanClass.get());
}
- Singleton singleton = beanClass.getAnnotation(Singleton.class);
- String ejbName = getEjbName(singleton, beanClass.get());
+ final Singleton singleton = beanClass.getAnnotation(Singleton.class);
+ final String ejbName = getEjbName(singleton, beanClass.get());
if (!isValidEjbAnnotationUsage(Singleton.class, beanClass, ejbName, ejbModule)) continue;
@@ -1381,7 +1381,7 @@ public class AnnotationDeployer implemen
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) enterpriseBean;
+ final SessionBean sessionBean = (SessionBean) enterpriseBean;
sessionBean.setSessionType(SessionType.SINGLETON);
if (singleton.mappedName() != null) {
@@ -1391,14 +1391,14 @@ public class AnnotationDeployer implemen
LegacyProcessor.process(beanClass.get(), enterpriseBean);
}
- for (Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Stateless.class)) {
+ for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Stateless.class)) {
if (beanClass.isAnnotationPresent(Specializes.class)) {
specializingClasses.add(beanClass.get());
}
- Stateless stateless = beanClass.getAnnotation(Stateless.class);
- String ejbName = getEjbName(stateless, beanClass.get());
+ final Stateless stateless = beanClass.getAnnotation(Stateless.class);
+ final String ejbName = getEjbName(stateless, beanClass.get());
if (!isValidEjbAnnotationUsage(Stateless.class, beanClass, ejbName, ejbModule)) continue;
@@ -1411,7 +1411,7 @@ public class AnnotationDeployer implemen
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) enterpriseBean;
+ final SessionBean sessionBean = (SessionBean) enterpriseBean;
sessionBean.setSessionType(SessionType.STATELESS);
if (stateless.mappedName() != null) {
@@ -1428,14 +1428,14 @@ public class AnnotationDeployer implemen
// Anyway.. the qualifiers aren't getting inherited, so we need to fix that
- for (Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Stateful.class)) {
+ for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Stateful.class)) {
if (beanClass.isAnnotationPresent(Specializes.class)) {
specializingClasses.add(beanClass.get());
}
- Stateful stateful = beanClass.getAnnotation(Stateful.class);
- String ejbName = getEjbName(stateful, beanClass.get());
+ final Stateful stateful = beanClass.getAnnotation(Stateful.class);
+ final String ejbName = getEjbName(stateful, beanClass.get());
if (!isValidEjbAnnotationUsage(Stateful.class, beanClass, ejbName, ejbModule)) continue;
@@ -1448,7 +1448,7 @@ public class AnnotationDeployer implemen
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) enterpriseBean;
+ final SessionBean sessionBean = (SessionBean) enterpriseBean;
// TODO: We might be stepping on an xml override here
sessionBean.setSessionType(SessionType.STATEFUL);
if (stateful.mappedName() != null) {
@@ -1458,14 +1458,14 @@ public class AnnotationDeployer implemen
LegacyProcessor.process(beanClass.get(), enterpriseBean);
}
- for (Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(ManagedBean.class)) {
+ for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(ManagedBean.class)) {
if (beanClass.isAnnotationPresent(Specializes.class)) {
specializingClasses.add(beanClass.get());
}
- ManagedBean managed = beanClass.getAnnotation(ManagedBean.class);
- String ejbName = getEjbName(managed, beanClass.get());
+ final ManagedBean managed = beanClass.getAnnotation(ManagedBean.class);
+ final String ejbName = getEjbName(managed, beanClass.get());
// TODO: this is actually against the spec, but the requirement is rather silly
// (allowing @Stateful and @ManagedBean on the same class)
@@ -1481,7 +1481,7 @@ public class AnnotationDeployer implemen
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) enterpriseBean;
+ final SessionBean sessionBean = (SessionBean) enterpriseBean;
sessionBean.setSessionType(SessionType.MANAGED);
final TransactionType transactionType = sessionBean.getTransactionType();
@@ -1489,14 +1489,14 @@ public class AnnotationDeployer implemen
}
}
- for (Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(MessageDriven.class)) {
+ for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(MessageDriven.class)) {
if (beanClass.isAnnotationPresent(Specializes.class)) {
specializingClasses.add(beanClass.get());
}
- MessageDriven mdb = beanClass.getAnnotation(MessageDriven.class);
- String ejbName = getEjbName(mdb, beanClass.get());
+ final MessageDriven mdb = beanClass.getAnnotation(MessageDriven.class);
+ final String ejbName = getEjbName(mdb, beanClass.get());
if (!isValidEjbAnnotationUsage(MessageDriven.class, beanClass, ejbName, ejbModule)) continue;
@@ -1545,10 +1545,10 @@ public class AnnotationDeployer implemen
}
startupLogger.debug("Searching for annotated application exceptions (see OPENEJB-980)");
- List<Class<?>> appExceptions = finder.findAnnotatedClasses(ApplicationException.class);
- for (Class<?> exceptionClass : appExceptions) {
+ final List<Class<?>> appExceptions = finder.findAnnotatedClasses(ApplicationException.class);
+ for (final Class<?> exceptionClass : appExceptions) {
startupLogger.debug("...handling " + exceptionClass);
- ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
+ final ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
if (assemblyDescriptor.getApplicationException(exceptionClass) == null) {
startupLogger.debug("...adding " + exceptionClass + " with rollback=" + annotation.rollback());
assemblyDescriptor.addApplicationException(exceptionClass, annotation.rollback(), annotation.inherited());
@@ -1564,8 +1564,8 @@ public class AnnotationDeployer implemen
}
if (ejbModule.getAppModule() != null) {
- for (PersistenceModule pm : ejbModule.getAppModule().getPersistenceModules()) {
- for (org.apache.openejb.jee.jpa.unit.PersistenceUnit pu : pm.getPersistence().getPersistenceUnit()) {
+ for (final PersistenceModule pm : ejbModule.getAppModule().getPersistenceModules()) {
+ for (final org.apache.openejb.jee.jpa.unit.PersistenceUnit pu : pm.getPersistence().getPersistenceUnit()) {
if ((pu.isExcludeUnlistedClasses() == null || !pu.isExcludeUnlistedClasses())
&& "true".equalsIgnoreCase(pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN))) {
final String packageName = pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN_PACKAGE);
@@ -1580,7 +1580,7 @@ public class AnnotationDeployer implemen
classes.addAll(finder.findAnnotatedClasses(Embeddable.class));
classes.addAll(finder.findAnnotatedClasses(MappedSuperclass.class));
final List<String> existingClasses = pu.getClazz();
- for (Class<?> clazz : classes) {
+ for (final Class<?> clazz : classes) {
final String name = clazz.getName();
if (existingClasses.contains(name)) {
continue;
@@ -1589,7 +1589,7 @@ public class AnnotationDeployer implemen
if (packageNames == null) {
pu.getClazz().add(name);
} else {
- for (String pack : packageNames) {
+ for (final String pack : packageNames) {
if (name.startsWith(pack)) {
pu.getClazz().add(name);
}
@@ -1605,7 +1605,7 @@ public class AnnotationDeployer implemen
return ejbModule;
}
- private SessionType getSessionType(Class<?> clazz) {
+ private SessionType getSessionType(final Class<?> clazz) {
if (clazz.isAnnotationPresent(Stateful.class)) return SessionType.STATEFUL;
if (clazz.isAnnotationPresent(Stateless.class)) return SessionType.STATELESS;
if (clazz.isAnnotationPresent(Singleton.class)) return SessionType.SINGLETON;
@@ -1613,10 +1613,10 @@ public class AnnotationDeployer implemen
return null;
}
- private String getEjbName(EnterpriseBean bean, Class<?> clazz) {
+ private String getEjbName(final EnterpriseBean bean, final Class<?> clazz) {
if (bean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) bean;
+ final SessionBean sessionBean = (SessionBean) bean;
switch (sessionBean.getSessionType()) {
case STATEFUL: {
final Stateful annotation = clazz.getAnnotation(Stateful.class);
@@ -1653,7 +1653,7 @@ public class AnnotationDeployer implemen
return name != null && name.length() != 0;
}
- private List<String> getBeanClasses(IAnnotationFinder finder) {
+ private List<String> getBeanClasses(final IAnnotationFinder finder) {
// What we're hoping in this method is to get lucky and find
// that our 'finder' instances is an AnnotationFinder that is
@@ -1679,7 +1679,7 @@ public class AnnotationDeployer implemen
final WebappAggregatedArchive aggregatedArchive = (WebappAggregatedArchive) archive;
final Map<URL, List<String>> map = aggregatedArchive.getClassesMap();
- for (Map.Entry<URL, List<String>> entry : map.entrySet()) {
+ for (final Map.Entry<URL, List<String>> entry : map.entrySet()) {
if (hasBeansXml(entry.getKey())) classes.addAll(entry.getValue());
}
@@ -1687,54 +1687,54 @@ public class AnnotationDeployer implemen
return classes;
}
- public static boolean hasBeansXml(URL url) {
+ public static boolean hasBeansXml(final URL url) {
if (url.getPath().endsWith("WEB-INF/classes/")) return true;
if (url.getPath().endsWith("!/META-INF/beans.xml")) return true;
try {
final URLClassLoader loader = new URLClassLoader(new URL[]{ url } , new EmptyResourcesClassLoader());
- String[] paths = {
+ final String[] paths = {
"META-INF/beans.xml",
"WEB-INF/beans.xml",
"/WEB-INF/beans.xml",
"/META-INF/beans.xml",
};
- for (String path : paths) {
+ for (final String path : paths) {
if (loader.findResource(path) != null) return true;
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
return false;
}
- private String getEjbName(MessageDriven mdb, Class<?> beanClass) {
+ private String getEjbName(final MessageDriven mdb, final Class<?> beanClass) {
return mdb.name().isEmpty() ? beanClass.getSimpleName() : mdb.name();
}
- private String getEjbName(Stateful stateful, Class<?> beanClass) {
+ private String getEjbName(final Stateful stateful, final Class<?> beanClass) {
return stateful.name().isEmpty() ? beanClass.getSimpleName() : stateful.name();
}
- private String getEjbName(Stateless stateless, Class<?> beanClass) {
+ private String getEjbName(final Stateless stateless, final Class<?> beanClass) {
return stateless.name().isEmpty() ? beanClass.getSimpleName() : stateless.name();
}
- private String getEjbName(Singleton singleton, Class<?> beanClass) {
+ private String getEjbName(final Singleton singleton, final Class<?> beanClass) {
return singleton.name().isEmpty() ? beanClass.getSimpleName() : singleton.name();
}
- private String getEjbName(ManagedBean managed, Class<?> beanClass) {
+ private String getEjbName(final ManagedBean managed, final Class<?> beanClass) {
return managed.value().isEmpty() ? beanClass.getSimpleName() : managed.value();
}
- private boolean isValidEjbAnnotationUsage(Class annotationClass, Annotated<Class<?>> beanClass, String ejbName, EjbModule ejbModule) {
- List<Class<? extends Annotation>> annotations = new ArrayList(Arrays.asList(Singleton.class, Stateless.class, Stateful.class, MessageDriven.class));
+ private boolean isValidEjbAnnotationUsage(final Class annotationClass, final Annotated<Class<?>> beanClass, final String ejbName, final EjbModule ejbModule) {
+ final List<Class<? extends Annotation>> annotations = new ArrayList(Arrays.asList(Singleton.class, Stateless.class, Stateful.class, MessageDriven.class));
annotations.remove(annotationClass);
- boolean b = true;
- for (Class<? extends Annotation> secondAnnotation : annotations) {
- Annotation annotation = beanClass.getAnnotation(secondAnnotation);
+ final boolean b = true;
+ for (final Class<? extends Annotation> secondAnnotation : annotations) {
+ final Annotation annotation = beanClass.getAnnotation(secondAnnotation);
if (annotation == null) continue;
@@ -1781,9 +1781,9 @@ public class AnnotationDeployer implemen
webserviceAsRemote = wsAsRemote;
}
- public void deploy(CdiBeanInfo beanInfo) throws OpenEJBException{
+ public void deploy(final CdiBeanInfo beanInfo) throws OpenEJBException{
- AnnotationFinder annotationFinder = createFinder(beanInfo.getBeanClass());
+ final AnnotationFinder annotationFinder = createFinder(beanInfo.getBeanClass());
/*
* @EJB
* @Resource
@@ -1797,8 +1797,8 @@ public class AnnotationDeployer implemen
}
- public AppModule deploy(AppModule appModule) throws OpenEJBException {
- for (EjbModule ejbModule : appModule.getEjbModules()) {
+ public AppModule deploy(final AppModule appModule) throws OpenEJBException {
+ for (final EjbModule ejbModule : appModule.getEjbModules()) {
setModule(ejbModule);
try {
deploy(ejbModule);
@@ -1806,7 +1806,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (ClientModule clientModule : appModule.getClientModules()) {
+ for (final ClientModule clientModule : appModule.getClientModules()) {
setModule(clientModule);
try {
deploy(clientModule);
@@ -1814,7 +1814,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (ConnectorModule connectorModule : appModule.getConnectorModules()) {
+ for (final ConnectorModule connectorModule : appModule.getConnectorModules()) {
setModule(connectorModule);
try {
deploy(connectorModule);
@@ -1822,7 +1822,7 @@ public class AnnotationDeployer implemen
removeModule();
}
}
- for (WebModule webModule : appModule.getWebModules()) {
+ for (final WebModule webModule : appModule.getWebModules()) {
setModule(webModule);
try {
deploy(webModule);
@@ -1833,20 +1833,20 @@ public class AnnotationDeployer implemen
return appModule;
}
- public ClientModule deploy(ClientModule clientModule) throws OpenEJBException {
+ public ClientModule deploy(final ClientModule clientModule) throws OpenEJBException {
if (clientModule.getApplicationClient() != null && clientModule.getApplicationClient().isMetadataComplete())
return clientModule;
- ClassLoader classLoader = clientModule.getClassLoader();
+ final ClassLoader classLoader = clientModule.getClassLoader();
ApplicationClient client = clientModule.getApplicationClient();
if (client == null) client = new ApplicationClient();
- Set<Class> remoteClients = new HashSet<Class>();
+ final Set<Class> remoteClients = new HashSet<Class>();
if (clientModule.getMainClass() != null){
- String className = realClassName(clientModule.getMainClass());
+ final String className = realClassName(clientModule.getMainClass());
// OPENEJB-1063: a Main-Class should use "." instead of "/"
// it wasn't check before jdk 1.5 so we can get old module with
@@ -1856,15 +1856,15 @@ public class AnnotationDeployer implemen
clientModule.setMainClass(className);
}
- Class clazz;
+ final Class clazz;
try {
clazz = classLoader.loadClass(className);
remoteClients.add(clazz);
- AnnotationFinder annotationFinder = createFinder(clazz);
+ final AnnotationFinder annotationFinder = createFinder(clazz);
buildAnnotatedRefs(client, annotationFinder, classLoader);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
/**
* Some ClientModule are discovered only because the jar uses a Main-Class
* entry in the MANIFEST.MF file. Lots of jars do this that are not used as
@@ -1880,31 +1880,31 @@ public class AnnotationDeployer implemen
}
}
- for (String rawClassName : clientModule.getRemoteClients()) {
+ for (final String rawClassName : clientModule.getRemoteClients()) {
final String className = realClassName(rawClassName);
- Class clazz;
+ final Class clazz;
try {
clazz = classLoader.loadClass(className);
remoteClients.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load RemoteClient class: " + className, e);
}
- AnnotationFinder annotationFinder = createFinder(clazz);
+ final AnnotationFinder annotationFinder = createFinder(clazz);
buildAnnotatedRefs(client, annotationFinder, classLoader);
}
- for (String rawClassName : clientModule.getLocalClients()) {
+ for (final String rawClassName : clientModule.getLocalClients()) {
final String className = realClassName(rawClassName);
- Class clazz;
+ final Class clazz;
try {
clazz = classLoader.loadClass(className);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load LocalClient class: " + className, e);
}
- AnnotationFinder annotationFinder = createFinder(clazz);
+ final AnnotationFinder annotationFinder = createFinder(clazz);
buildAnnotatedRefs(client, annotationFinder, classLoader);
}
@@ -1916,32 +1916,32 @@ public class AnnotationDeployer implemen
return clientModule;
}
- private void validateRemoteClientRefs(ClassLoader classLoader, ApplicationClient client, Set<Class> remoteClients) {
- for (EjbLocalRef ref : client.getEjbLocalRef()) {
- for (InjectionTarget target : ref.getInjectionTarget()) {
+ private void validateRemoteClientRefs(final ClassLoader classLoader, final ApplicationClient client, final Set<Class> remoteClients) {
+ for (final EjbLocalRef ref : client.getEjbLocalRef()) {
+ for (final InjectionTarget target : ref.getInjectionTarget()) {
try {
- Class<?> targetClass = classLoader.loadClass(realClassName(target.getInjectionTargetClass()));
- for (Class remoteClient : remoteClients) {
+ final Class<?> targetClass = classLoader.loadClass(realClassName(target.getInjectionTargetClass()));
+ for (final Class remoteClient : remoteClients) {
if (targetClass.isAssignableFrom(remoteClient)) {
fail(remoteClient.getName(), "remoteClient.ejbLocalRef", target.getInjectionTargetClass(), target.getInjectionTargetName());
}
}
- } catch (ClassNotFoundException ignore) {
+ } catch (final ClassNotFoundException ignore) {
// no-op
}
}
}
- for (PersistenceContextRef ref : client.getPersistenceContextRef()) {
- for (InjectionTarget target : ref.getInjectionTarget()) {
+ for (final PersistenceContextRef ref : client.getPersistenceContextRef()) {
+ for (final InjectionTarget target : ref.getInjectionTarget()) {
try {
- Class<?> targetClass = classLoader.loadClass(realClassName(target.getInjectionTargetClass()));
- for (Class remoteClient : remoteClients) {
+ final Class<?> targetClass = classLoader.loadClass(realClassName(target.getInjectionTargetClass()));
+ for (final Class remoteClient : remoteClients) {
if (targetClass.isAssignableFrom(remoteClient)) {
fail(remoteClient.getName(), "remoteClient.persistenceContextRef", target.getInjectionTargetClass(), target.getInjectionTargetName());
}
}
- } catch (ClassNotFoundException ignore) {
+ } catch (final ClassNotFoundException ignore) {
// no-op
}
}
@@ -1971,7 +1971,7 @@ public class AnnotationDeployer implemen
*/
}
- public ConnectorModule deploy(ConnectorModule connectorModule) throws OpenEJBException {
+ public ConnectorModule deploy(final ConnectorModule connectorModule) throws OpenEJBException {
// resource modules currently don't have any annotations
return connectorModule;
}
@@ -1985,17 +1985,17 @@ public class AnnotationDeployer implemen
* @return
* @throws OpenEJBException
*/
- public WebModule deploy(WebModule webModule) throws OpenEJBException {
- WebApp webApp = webModule.getWebApp();
+ public WebModule deploy(final WebModule webModule) throws OpenEJBException {
+ final WebApp webApp = webModule.getWebApp();
if (webApp != null && webApp.isMetadataComplete()) return webModule;
/*
* Classes added to this set will be scanned for annotations
*/
- Set<Class> classes = new HashSet<Class>();
+ final Set<Class> classes = new HashSet<Class>();
- ClassLoader classLoader = webModule.getClassLoader();
+ final ClassLoader classLoader = webModule.getClassLoader();
final String webXmlApplication = webApp.contextParamsAsMap().get("javax.ws.rs.Application");
if (webXmlApplication != null) {
@@ -2003,18 +2003,18 @@ public class AnnotationDeployer implemen
webModule.getRestApplications().add(webXmlApplication);
}
- Collection<String> restApp = webModule.getRestApplications();
+ final Collection<String> restApp = webModule.getRestApplications();
if (restApp.isEmpty()) {
addRestClassesToScannedClasses(webModule, classes, classLoader);
} else {
- for (String rawClassName : restApp) {
+ for (final String rawClassName : restApp) {
final String application = realClassName(rawClassName);
if (application != null) {
- Class<?> clazz;
+ final Class<?> clazz;
try {
clazz = classLoader.loadClass(application);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load Application class: " + application, e);
}
if (Modifier.isAbstract(clazz.getModifiers())) {
@@ -2022,14 +2022,14 @@ public class AnnotationDeployer implemen
}
try {
- Application app = Application.class.cast(clazz.newInstance());
+ final Application app = Application.class.cast(clazz.newInstance());
try {
if (!app.getClasses().isEmpty()) {
classes.addAll(app.getClasses());
} else {
addRestClassesToScannedClasses(webModule, classes, classLoader);
}
- } catch (RuntimeException npe) {
+ } catch (final RuntimeException npe) {
if (app == null) {
throw npe;
}
@@ -2048,7 +2048,7 @@ public class AnnotationDeployer implemen
/*
* Servlet classes are scanned
*/
- for (Servlet servlet : webApp.getServlet()) {
+ for (final Servlet servlet : webApp.getServlet()) {
String servletClass = realClassName(servlet.getServletClass());
if (servletClass == null) { // try with servlet name, @see org.apache.openejb.arquillian.tests.jaxrs.basicapp.BasicApplication
servletClass = realClassName(servlet.getServletName());
@@ -2057,12 +2057,12 @@ public class AnnotationDeployer implemen
if (servletClass != null && servlet.getJspFile() == null) { // jaxrs application doesn't have a jsp file
if (!"org.apache.openejb.server.rest.OpenEJBRestServlet".equals(servletClass)) {
try {
- Class clazz = classLoader.loadClass(servletClass);
+ final Class clazz = classLoader.loadClass(servletClass);
classes.add(clazz);
if (servlet.getServletClass() == null) {
servlet.setServletClass(servletClass);
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
if (servlet.getServletClass() != null) {
throw new OpenEJBException("Unable to load servlet class: " + servletClass, e);
} else {
@@ -2072,7 +2072,7 @@ public class AnnotationDeployer implemen
}
// if the servlet is a rest init servlet don't deploy rest classes automatically
- for (ParamValue param : servlet.getInitParam()) {
+ for (final ParamValue param : servlet.getInitParam()) {
if (param.getParamName().equals(Application.class.getName()) || param.getParamName().equals("javax.ws.rs.Application")) {
webModule.getRestApplications().clear();
webModule.getRestApplications().add(param.getParamValue());
@@ -2085,13 +2085,13 @@ public class AnnotationDeployer implemen
/*
* Filter classes are scanned
*/
- for (Filter filter : webApp.getFilter()) {
- String filterClass = realClassName(filter.getFilterClass());
+ for (final Filter filter : webApp.getFilter()) {
+ final String filterClass = realClassName(filter.getFilterClass());
if (filterClass != null) {
try {
- Class clazz = classLoader.loadClass(filterClass);
+ final Class clazz = classLoader.loadClass(filterClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load servlet filter class: " + filterClass, e);
}
}
@@ -2100,29 +2100,29 @@ public class AnnotationDeployer implemen
/*
* Listener classes are scanned
*/
- for (Listener listener : webApp.getListener()) {
- String listenerClass = realClassName(listener.getListenerClass());
+ for (final Listener listener : webApp.getListener()) {
+ final String listenerClass = realClassName(listener.getListenerClass());
if (listenerClass != null) {
try {
- Class clazz = classLoader.loadClass(listenerClass);
+ final Class clazz = classLoader.loadClass(listenerClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load servlet listener class: " + listenerClass, e);
}
}
}
- for (TldTaglib taglib : webModule.getTaglibs()) {
+ for (final TldTaglib taglib : webModule.getTaglibs()) {
/*
* TagLib Listener classes are scanned
*/
- for (Listener listener : taglib.getListener()) {
- String listenerClass = realClassName(listener.getListenerClass());
+ for (final Listener listener : taglib.getListener()) {
+ final String listenerClass = realClassName(listener.getListenerClass());
if (listenerClass != null) {
try {
- Class clazz = classLoader.loadClass(listenerClass);
+ final Class clazz = classLoader.loadClass(listenerClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
logger.error("Unable to load tag library servlet listener class: " + listenerClass);
}
}
@@ -2131,13 +2131,13 @@ public class AnnotationDeployer implemen
/*
* TagLib Tag classes are scanned
*/
- for (Tag tag : taglib.getTag()) {
- String tagClass = realClassName(tag.getTagClass());
+ for (final Tag tag : taglib.getTag()) {
+ final String tagClass = realClassName(tag.getTagClass());
if (tagClass != null) {
try {
- Class clazz = classLoader.loadClass(tagClass);
+ final Class clazz = classLoader.loadClass(tagClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
logger.error("Unable to load tag library tag class: " + tagClass);
}
}
@@ -2148,20 +2148,20 @@ public class AnnotationDeployer implemen
* WebService HandlerChain classes are scanned
*/
if (webModule.getWebservices() != null) {
- for (WebserviceDescription webservice : webModule.getWebservices().getWebserviceDescription()) {
- for (PortComponent port : webservice.getPortComponent()) {
+ for (final WebserviceDescription webservice : webModule.getWebservices().getWebserviceDescription()) {
+ for (final PortComponent port : webservice.getPortComponent()) {
// skip ejb port defs
if (port.getServiceImplBean().getEjbLink() != null) continue;
if (port.getHandlerChains() == null) continue;
- for (org.apache.openejb.jee.HandlerChain handlerChain : port.getHandlerChains().getHandlerChain()) {
- for (Handler handler : handlerChain.getHandler()) {
- String handlerClass = realClassName(handler.getHandlerClass());
+ for (final org.apache.openejb.jee.HandlerChain handlerChain : port.getHandlerChains().getHandlerChain()) {
+ for (final Handler handler : handlerChain.getHandler()) {
+ final String handlerClass = realClassName(handler.getHandlerClass());
if (handlerClass != null) {
try {
- Class clazz = classLoader.loadClass(handlerClass);
+ final Class clazz = classLoader.loadClass(handlerClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load webservice handler class: " + handlerClass, e);
}
}
@@ -2174,28 +2174,28 @@ public class AnnotationDeployer implemen
/*
* JSF ManagedBean classes are scanned
*/
- for (FacesConfig facesConfig : webModule.getFacesConfigs()) {
- for (FacesManagedBean bean : facesConfig.getManagedBean()) {
- String managedBeanClass = realClassName(bean.getManagedBeanClass().trim());
+ for (final FacesConfig facesConfig : webModule.getFacesConfigs()) {
+ for (final FacesManagedBean bean : facesConfig.getManagedBean()) {
+ final String managedBeanClass = realClassName(bean.getManagedBeanClass().trim());
if (managedBeanClass != null) {
try {
- Class clazz = classLoader.loadClass(managedBeanClass);
+ final Class clazz = classLoader.loadClass(managedBeanClass);
classes.add(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
logger.error("Unable to load JSF managed bean class: " + managedBeanClass);
}
}
}
}
- IAnnotationFinder finder = webModule.getFinder();
+ final IAnnotationFinder finder = webModule.getFinder();
if (finder != null) {
- for (String apiClassName : API_CLASSES) {
+ for (final String apiClassName : API_CLASSES) {
final Class<? extends Annotation> clazz;
try {
clazz = (Class<? extends Annotation>) classLoader.loadClass(apiClassName);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
if (clazz.isAnnotation()) {
@@ -2208,7 +2208,7 @@ public class AnnotationDeployer implemen
}
}
- AnnotationFinder annotationFinder = createFinder(classes.toArray(new Class<?>[classes.size()]));
+ final AnnotationFinder annotationFinder = createFinder(classes.toArray(new Class<?>[classes.size()]));
/*
* @EJB
@@ -2224,19 +2224,19 @@ public class AnnotationDeployer implemen
return webModule;
}
- public EjbModule deploy(EjbModule ejbModule) throws OpenEJBException {
+ public EjbModule deploy(final EjbModule ejbModule) throws OpenEJBException {
if (ejbModule.getEjbJar() != null && ejbModule.getEjbJar().isMetadataComplete()) return ejbModule;
// Map<String, EjbDeployment> deployments = ejbModule.getOpenejbJar().getDeploymentsByEjbName();
- ClassLoader classLoader = ejbModule.getClassLoader();
- EnterpriseBean[] enterpriseBeans = ejbModule.getEjbJar().getEnterpriseBeans();
- for (EnterpriseBean bean : enterpriseBeans) {
+ final ClassLoader classLoader = ejbModule.getClassLoader();
+ final EnterpriseBean[] enterpriseBeans = ejbModule.getEjbJar().getEnterpriseBeans();
+ for (final EnterpriseBean bean : enterpriseBeans) {
final String ejbName = bean.getEjbName();
final String ejbClassName = realClassName(bean.getEjbClass());
if (ejbClassName == null) {
- List<String> others = new ArrayList<String>();
- for (EnterpriseBean otherBean : enterpriseBeans) {
+ final List<String> others = new ArrayList<String>();
+ for (final EnterpriseBean otherBean : enterpriseBeans) {
others.add(otherBean.getEjbName());
}
fail(ejbName, "xml.noEjbClass", ejbName, Join.join(", ", others));
@@ -2245,12 +2245,12 @@ public class AnnotationDeployer implemen
final Class<?> clazz;
try {
clazz = classLoader.loadClass(ejbClassName);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// Handled in CheckClasses.java along with other missing classes
continue;
}
- boolean dynamicBean = DynamicProxyImplFactory.isKnownDynamicallyImplemented(clazz);
+ final boolean dynamicBean = DynamicProxyImplFactory.isKnownDynamicallyImplemented(clazz);
final MetaAnnotatedClass<?> metaClass = new MetaAnnotatedClass(clazz);
final AnnotationFinder finder;
@@ -2262,7 +2262,7 @@ public class AnnotationDeployer implemen
final List<Class<?>> ancestors = Classes.ancestors(clazz);
final String[] names = new String[ancestors.size()];
int i = 0;
- for (Class<?> ancestor : ancestors) {
+ for (final Class<?> ancestor : ancestors) {
names[i++] = ancestor.getName();
}
annotationFinder = af.select(names);
@@ -2304,7 +2304,7 @@ public class AnnotationDeployer implemen
* @TransactionManagement
*/
if (bean.getTransactionType() == null) {
- TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class);
+ final TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class);
TransactionManagementType transactionType = TransactionManagementType.CONTAINER;
if (tx != null) {
transactionType = tx.value();
@@ -2353,17 +2353,17 @@ public class AnnotationDeployer implemen
/*
* Add any interceptors they may have referenced in xml but did not declare
*/
- for (InterceptorBinding binding : assemblyDescriptor.getInterceptorBinding()) {
- EjbJar ejbJar = ejbModule.getEjbJar();
+ for (final InterceptorBinding binding : assemblyDescriptor.getInterceptorBinding()) {
+ final EjbJar ejbJar = ejbModule.getEjbJar();
- List<String> list = new ArrayList<String>(binding.getInterceptorClass());
+ final List<String> list = new ArrayList<String>(binding.getInterceptorClass());
if (binding.getInterceptorOrder() != null){
list.clear();
list.addAll(binding.getInterceptorOrder().getInterceptorClass());
}
- for (String interceptor : list) {
+ for (final String interceptor : list) {
if (ejbJar.getInterceptor(interceptor) == null) {
logger.debug("Adding '<ejb-jar><interceptors><interceptor>' entry for undeclared interceptor " + interceptor);
ejbJar.addInterceptor(new Interceptor(interceptor));
@@ -2375,38 +2375,38 @@ public class AnnotationDeployer implemen
* @Interceptors
*/
final List<Annotated<Class<?>>> annotatedClasses = sortClasses(annotationFinder.findMetaAnnotatedClasses(Interceptors.class));
- for (Annotated<Class<?>> interceptorsAnnotatedClass : annotatedClasses) {
- Interceptors interceptors = interceptorsAnnotatedClass.getAnnotation(Interceptors.class);
- EjbJar ejbJar = ejbModule.getEjbJar();
- for (Class interceptor : interceptors.value()) {
+ for (final Annotated<Class<?>> interceptorsAnnotatedClass : annotatedClasses) {
+ final Interceptors interceptors = interceptorsAnnotatedClass.getAnnotation(Interceptors.class);
+ final EjbJar ejbJar = ejbModule.getEjbJar();
+ for (final Class interceptor : interceptors.value()) {
if (ejbJar.getInterceptor(interceptor.getName()) == null) {
ejbJar.addInterceptor(new Interceptor(interceptor.getName()));
}
}
- InterceptorBinding binding = new InterceptorBinding(bean);
+ final InterceptorBinding binding = new InterceptorBinding(bean);
assemblyDescriptor.getInterceptorBinding().add(0, binding);
- for (Class interceptor : interceptors.value()) {
[... 2336 lines stripped ...]