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 [4/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/assembler/classic/JndiEncBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java Wed Feb 19 15:47:58 2014
@@ -114,11 +114,11 @@ public class JndiEncBuilder {
private boolean useCrossClassLoaderRef = true;
private boolean client = false;
- public JndiEncBuilder(JndiEncInfo jndiEnc, Collection<Injection> injections, String moduleId, URI moduleUri, String uniqueId, ClassLoader classLoader) throws OpenEJBException {
+ public JndiEncBuilder(final JndiEncInfo jndiEnc, final Collection<Injection> injections, final String moduleId, final URI moduleUri, final String uniqueId, final ClassLoader classLoader) throws OpenEJBException {
this(jndiEnc, injections, null, moduleId, moduleUri, uniqueId, classLoader);
}
- public JndiEncBuilder(JndiEncInfo jndiEnc, Collection<Injection> injections, String transactionType, String moduleId, URI moduleUri, String uniqueId, ClassLoader classLoader) throws OpenEJBException {
+ public JndiEncBuilder(final JndiEncInfo jndiEnc, final Collection<Injection> injections, final String transactionType, final String moduleId, final URI moduleUri, final String uniqueId, final ClassLoader classLoader) throws OpenEJBException {
this.jndiEnc = jndiEnc;
this.injections = injections;
beanManagedTransactions = transactionType != null && transactionType.equalsIgnoreCase("Bean");
@@ -134,7 +134,7 @@ public class JndiEncBuilder {
return useCrossClassLoaderRef;
}
- public void setUseCrossClassLoaderRef(boolean useCrossClassLoaderRef) {
+ public void setUseCrossClassLoaderRef(final boolean useCrossClassLoaderRef) {
this.useCrossClassLoaderRef = useCrossClassLoaderRef;
}
@@ -142,18 +142,18 @@ public class JndiEncBuilder {
return client;
}
- public void setClient(boolean client) {
+ public void setClient(final boolean client) {
this.client = client;
}
- public Context build(JndiScope type) throws OpenEJBException {
- Map<String, Object> bindings = buildBindings(type);
+ public Context build(final JndiScope type) throws OpenEJBException {
+ final Map<String, Object> bindings = buildBindings(type);
return build(bindings);
}
- public Context build(Map<String, Object> bindings) throws SystemException {
- JndiFactory jndiFactory = SystemInstance.get().getComponent(JndiFactory.class);
+ public Context build(final Map<String, Object> bindings) throws SystemException {
+ final JndiFactory jndiFactory = SystemInstance.get().getComponent(JndiFactory.class);
if (SystemInstance.get().hasProperty("openejb.geronimo")) {
return jndiFactory.createComponentContext(new HashMap());
@@ -162,8 +162,8 @@ public class JndiEncBuilder {
return jndiFactory.createComponentContext(bindings);
}
- public Map<String, Object> buildBindings(JndiScope type) throws OpenEJBException {
- Map<String, Object> bindings = buildMap(type);
+ public Map<String, Object> buildBindings(final JndiScope type) throws OpenEJBException {
+ final Map<String, Object> bindings = buildMap(type);
switch (type) {
case comp:
addSpecialCompBindings(bindings);
@@ -182,21 +182,21 @@ public class JndiEncBuilder {
}
public Map<String, Object> buildMap(final JndiScope scope) throws OpenEJBException {
- Map<String, Object> bindings = new TreeMap<String, Object>(); // let it be sorted for real binding
+ final Map<String, Object> bindings = new TreeMap<String, Object>(); // let it be sorted for real binding
// get JtaEntityManagerRegistry
- JtaEntityManagerRegistry jtaEntityManagerRegistry = SystemInstance.get().getComponent(JtaEntityManagerRegistry.class);
+ final JtaEntityManagerRegistry jtaEntityManagerRegistry = SystemInstance.get().getComponent(JtaEntityManagerRegistry.class);
- for (EjbReferenceInfo referenceInfo : jndiEnc.ejbReferences) {
+ for (final EjbReferenceInfo referenceInfo : jndiEnc.ejbReferences) {
- Reference reference;
+ final Reference reference;
if (referenceInfo.location != null) {
reference = buildReferenceLocation(referenceInfo.location);
} else if (referenceInfo.ejbDeploymentId == null) {
reference = new LazyEjbReference(new Ref(referenceInfo), moduleUri, useCrossClassLoaderRef);
} else {
- String jndiName = "openejb/Deployment/" + JndiBuilder.format(referenceInfo.ejbDeploymentId, referenceInfo.interfaceClassName, referenceInfo.localbean ? InterfaceType.LOCALBEAN : InterfaceType.BUSINESS_REMOTE);
+ final String jndiName = "openejb/Deployment/" + JndiBuilder.format(referenceInfo.ejbDeploymentId, referenceInfo.interfaceClassName, referenceInfo.localbean ? InterfaceType.LOCALBEAN : InterfaceType.BUSINESS_REMOTE);
if (useCrossClassLoaderRef && referenceInfo.externalReference) {
reference = new CrossClassLoaderJndiReference(jndiName);
} else {
@@ -206,24 +206,24 @@ public class JndiEncBuilder {
bindings.put(normalize(referenceInfo.referenceName), reference);
}
- for (EjbReferenceInfo referenceInfo : jndiEnc.ejbLocalReferences) {
- Reference reference;
+ for (final EjbReferenceInfo referenceInfo : jndiEnc.ejbLocalReferences) {
+ final Reference reference;
if (referenceInfo.location != null) {
reference = buildReferenceLocation(referenceInfo.location);
} else if (referenceInfo.ejbDeploymentId == null) {
reference = new LazyEjbReference(new Ref(referenceInfo), moduleUri, false);
} else {
- String jndiName = "openejb/Deployment/" + JndiBuilder.format(referenceInfo.ejbDeploymentId, referenceInfo.interfaceClassName, referenceInfo.localbean ? InterfaceType.LOCALBEAN : InterfaceType.BUSINESS_LOCAL);
+ final String jndiName = "openejb/Deployment/" + JndiBuilder.format(referenceInfo.ejbDeploymentId, referenceInfo.interfaceClassName, referenceInfo.localbean ? InterfaceType.LOCALBEAN : InterfaceType.BUSINESS_LOCAL);
reference = new IntraVmJndiReference(jndiName);
}
bindings.put(normalize(referenceInfo.referenceName), reference);
}
- for (EnvEntryInfo entry : jndiEnc.envEntries) {
+ for (final EnvEntryInfo entry : jndiEnc.envEntries) {
if (entry.location != null) {
- Reference reference = buildReferenceLocation(entry.location);
+ final Reference reference = buildReferenceLocation(entry.location);
bindings.put(normalize(entry.referenceName), reference);
continue;
}
@@ -234,8 +234,8 @@ public class JndiEncBuilder {
}
try {
- Class type = Classes.deprimitivize(getType(entry.type, entry));
- Object obj;
+ final Class type = Classes.deprimitivize(getType(entry.type, entry));
+ final Object obj;
if (type == String.class)
obj = new String(entry.value);
else if (type == Double.class) {
@@ -253,7 +253,7 @@ public class JndiEncBuilder {
} else if (type == Byte.class) {
obj = new Byte(entry.value);
} else if (type == Character.class) {
- StringBuilder sb = new StringBuilder(entry.value + " ");
+ final StringBuilder sb = new StringBuilder(entry.value + " ");
obj = new Character(sb.charAt(0));
} else if (type == URL.class) {
obj = new URL(entry.value);
@@ -266,42 +266,42 @@ public class JndiEncBuilder {
}
bindings.put(normalize(entry.referenceName), obj);
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
throw new IllegalArgumentException("The env-entry-value for entry " + entry.referenceName + " was not recognizable as type " + entry.type + ". Received Message: " + e.getLocalizedMessage(), e);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
throw new IllegalArgumentException("URL for reference " + entry.referenceName + " was not a valid URL: " + entry.value, e);
}
}
- for (ResourceReferenceInfo referenceInfo : jndiEnc.resourceRefs) {
+ for (final ResourceReferenceInfo referenceInfo : jndiEnc.resourceRefs) {
if (!(referenceInfo instanceof ContextReferenceInfo)) {
if (referenceInfo.location != null) {
- Reference reference = buildReferenceLocation(referenceInfo.location);
+ final Reference reference = buildReferenceLocation(referenceInfo.location);
bindings.put(normalize(referenceInfo.referenceName), reference);
continue;
}
- Class<?> type = getType(referenceInfo.referenceType, referenceInfo);
+ final Class<?> type = getType(referenceInfo.referenceType, referenceInfo);
- Object reference;
+ final Object reference;
if (URL.class.equals(type)) {
reference = new URLReference(referenceInfo.resourceID);
} else if (type.isAnnotationPresent(ManagedBean.class)) {
- ManagedBean managed = type.getAnnotation(ManagedBean.class);
- String name = managed.value().length() == 0 ? type.getSimpleName() : managed.value();
+ final ManagedBean managed = type.getAnnotation(ManagedBean.class);
+ final String name = managed.value().length() == 0 ? type.getSimpleName() : managed.value();
reference = new LinkRef("module/" + name);
} else if (referenceInfo.resourceID != null) {
- String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
+ final String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
reference = new IntraVmJndiReference(jndiName);
} else {
- String jndiName = "openejb/Resource/" + referenceInfo.referenceName;
+ final String jndiName = "openejb/Resource/" + referenceInfo.referenceName;
reference = new IntraVmJndiReference(jndiName);
}
bindings.put(normalize(referenceInfo.referenceName), reference);
} else {
final Class<?> type = getType(referenceInfo.referenceType, referenceInfo);
- Object reference;
+ final Object reference;
if (Request.class.equals(type)) {
reference = new ObjectReference(ThreadLocalContextManager.REQUEST);
@@ -331,10 +331,10 @@ public class JndiEncBuilder {
}
}
- for (ResourceEnvReferenceInfo referenceInfo : jndiEnc.resourceEnvRefs) {
+ for (final ResourceEnvReferenceInfo referenceInfo : jndiEnc.resourceEnvRefs) {
if (referenceInfo.location != null) {
- Reference reference = buildReferenceLocation(referenceInfo.location);
+ final Reference reference = buildReferenceLocation(referenceInfo.location);
bindings.put(normalize(referenceInfo.referenceName), reference);
continue;
}
@@ -343,22 +343,22 @@ public class JndiEncBuilder {
final Object reference;
if (EJBContext.class.isAssignableFrom(type)) {
- String jndiName = "comp/EJBContext";
+ final String jndiName = "comp/EJBContext";
reference = new LinkRef(jndiName);
// Let the container bind this into JNDI
if (jndiName.equals(referenceInfo.referenceName)) continue;
} else if (Validator.class.equals(type)) {
- String jndiName = "comp/Validator";
+ final String jndiName = "comp/Validator";
reference = new LinkRef(jndiName);
} else if (ValidatorFactory.class.equals(type)) {
- String jndiName = "comp/ValidatorFactory";
+ final String jndiName = "comp/ValidatorFactory";
reference = new LinkRef(jndiName);
} else if (WebServiceContext.class.equals(type)) {
- String jndiName = "comp/WebServiceContext";
+ final String jndiName = "comp/WebServiceContext";
reference = new LinkRef(jndiName);
} else if (TimerService.class.equals(type)) {
- String jndiName = "comp/TimerService";
+ final String jndiName = "comp/TimerService";
reference = new LinkRef(jndiName);
// TODO Bind the BeanManager
@@ -373,51 +373,51 @@ public class JndiEncBuilder {
} else if (UserTransaction.class.equals(type)) {
reference = new IntraVmJndiReference("comp/UserTransaction");
} else if (referenceInfo.resourceID != null) {
- String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
+ final String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
reference = new IntraVmJndiReference(jndiName);
} else {
- String jndiName = "openejb/Resource/" + referenceInfo.referenceName;
+ final String jndiName = "openejb/Resource/" + referenceInfo.referenceName;
reference = new IntraVmJndiReference(jndiName);
}
bindings.put(normalize(referenceInfo.referenceName), reference);
}
- for (PersistenceUnitReferenceInfo referenceInfo : jndiEnc.persistenceUnitRefs) {
+ for (final PersistenceUnitReferenceInfo referenceInfo : jndiEnc.persistenceUnitRefs) {
if (referenceInfo.location != null) {
- Reference reference = buildReferenceLocation(referenceInfo.location);
+ final Reference reference = buildReferenceLocation(referenceInfo.location);
bindings.put(normalize(referenceInfo.referenceName), reference);
continue;
}
- String jndiName = PersistenceBuilder.getOpenEJBJndiName(referenceInfo.unitId);
- Reference reference = new IntraVmJndiReference(jndiName);
+ final String jndiName = PersistenceBuilder.getOpenEJBJndiName(referenceInfo.unitId);
+ final Reference reference = new IntraVmJndiReference(jndiName);
bindings.put(normalize(referenceInfo.referenceName), reference);
}
- for (PersistenceContextReferenceInfo contextInfo : jndiEnc.persistenceContextRefs) {
+ for (final PersistenceContextReferenceInfo contextInfo : jndiEnc.persistenceContextRefs) {
if (contextInfo.location != null) {
- Reference reference = buildReferenceLocation(contextInfo.location);
+ final Reference reference = buildReferenceLocation(contextInfo.location);
bindings.put(normalize(contextInfo.referenceName), reference);
continue;
}
- Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
- EntityManagerFactory factory;
+ final Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
+ final EntityManagerFactory factory;
try {
- String jndiName = PersistenceBuilder.getOpenEJBJndiName(contextInfo.unitId);
+ final String jndiName = PersistenceBuilder.getOpenEJBJndiName(contextInfo.unitId);
factory = (EntityManagerFactory) context.lookup(jndiName);
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new OpenEJBException("PersistenceUnit '" + contextInfo.unitId + "' not found for EXTENDED ref '" + contextInfo.referenceName + "'");
}
- JtaEntityManager jtaEntityManager = new JtaEntityManager(contextInfo.persistenceUnitName, jtaEntityManagerRegistry, factory, contextInfo.properties, contextInfo.extended);
- Reference reference = new PersistenceContextReference(jtaEntityManager);
+ final JtaEntityManager jtaEntityManager = new JtaEntityManager(contextInfo.persistenceUnitName, jtaEntityManagerRegistry, factory, contextInfo.properties, contextInfo.extended);
+ final Reference reference = new PersistenceContextReference(jtaEntityManager);
bindings.put(normalize(contextInfo.referenceName), reference);
}
- for (ServiceReferenceInfo referenceInfo : jndiEnc.serviceRefs) {
+ for (final ServiceReferenceInfo referenceInfo : jndiEnc.serviceRefs) {
if (referenceInfo.location != null) {
- Reference reference = buildReferenceLocation(referenceInfo.location);
+ final Reference reference = buildReferenceLocation(referenceInfo.location);
bindings.put(normalize(referenceInfo.referenceName), reference);
continue;
}
@@ -427,7 +427,7 @@ public class JndiEncBuilder {
if (referenceInfo.serviceType != null) {
try {
serviceClass = classLoader.loadClass(referenceInfo.serviceType).asSubclass(Service.class);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Could not load service type class " + referenceInfo.serviceType, e);
}
}
@@ -437,7 +437,7 @@ public class JndiEncBuilder {
if (referenceInfo.referenceType != null) {
try {
referenceClass = classLoader.loadClass(referenceInfo.referenceType);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Could not load reference type class " + referenceInfo.referenceType, e);
}
}
@@ -452,7 +452,7 @@ public class JndiEncBuilder {
if (referenceInfo.wsdlFile != null) {
try {
wsdlUrl = new URL(referenceInfo.wsdlFile);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
wsdlUrl = classLoader.getResource(referenceInfo.wsdlFile);
if (wsdlUrl == null) {
logger.warning("Error obtaining WSDL: " + referenceInfo.wsdlFile, e);
@@ -462,9 +462,9 @@ public class JndiEncBuilder {
}
// port refs
- List<PortRefData> portRefs = new ArrayList<PortRefData>(referenceInfo.portRefs.size());
- for (PortRefInfo portRefInfo : referenceInfo.portRefs) {
- PortRefData portRef = new PortRefData();
+ final List<PortRefData> portRefs = new ArrayList<PortRefData>(referenceInfo.portRefs.size());
+ for (final PortRefInfo portRefInfo : referenceInfo.portRefs) {
+ final PortRefData portRef = new PortRefData();
portRef.setQName(portRefInfo.qname);
portRef.setServiceEndpointInterface(portRefInfo.serviceEndpointInterface);
portRef.setEnableMtom(portRefInfo.enableMtom);
@@ -479,7 +479,7 @@ public class JndiEncBuilder {
}
if (!client) {
- Reference reference = new JaxWsServiceReference(referenceInfo.id,
+ final Reference reference = new JaxWsServiceReference(referenceInfo.id,
referenceInfo.serviceQName,
serviceClass, referenceInfo.portQName,
referenceClass,
@@ -489,7 +489,7 @@ public class JndiEncBuilder {
injections);
bindings.put(normalize(referenceInfo.referenceName), reference);
} else {
- ServiceRefData serviceRefData = new ServiceRefData(referenceInfo.id,
+ final ServiceRefData serviceRefData = new ServiceRefData(referenceInfo.id,
referenceInfo.serviceQName,
serviceClass, referenceInfo.portQName,
referenceClass,
@@ -500,16 +500,16 @@ public class JndiEncBuilder {
}
}
- OpenEjbConfiguration config = SystemInstance.get().getComponent(OpenEjbConfiguration.class);
+ final OpenEjbConfiguration config = SystemInstance.get().getComponent(OpenEjbConfiguration.class);
if (config != null) {
- for (ResourceInfo resource : config.facilities.resources) {
- String jndiName = resource.jndiName;
+ for (final ResourceInfo resource : config.facilities.resources) {
+ final String jndiName = resource.jndiName;
if (jndiName != null && !jndiName.isEmpty() && isNotGobalOrIsHoldByThisApp(resource, scope)) {
- String refName = "openejb/Resource/" + resource.id;
- Object reference = new IntraVmJndiReference(refName);
- String boundName = normalize(jndiName);
+ final String refName = "openejb/Resource/" + resource.id;
+ final Object reference = new IntraVmJndiReference(refName);
+ final String boundName = normalize(jndiName);
bindings.put(boundName, reference);
}
}
@@ -525,9 +525,9 @@ public class JndiEncBuilder {
|| info.originAppName != null && info.originAppName.equals(moduleId) && JndiScope.global.equals(scope);
}
- private void addSpecialCompBindings(Map<String, Object> bindings) {
+ private void addSpecialCompBindings(final Map<String, Object> bindings) {
// bind TransactionManager
- TransactionManager transactionManager = SystemInstance.get().getComponent(TransactionManager.class);
+ final TransactionManager transactionManager = SystemInstance.get().getComponent(TransactionManager.class);
bindings.put("comp/TransactionManager", transactionManager);
// bind TransactionSynchronizationRegistry
@@ -542,12 +542,12 @@ public class JndiEncBuilder {
// bind UserTransaction if bean managed transactions
if (beanManagedTransactions) {
- UserTransaction userTransaction = new CoreUserTransaction(transactionManager);
+ final UserTransaction userTransaction = new CoreUserTransaction(transactionManager);
bindings.put("comp/UserTransaction", userTransaction);
}
}
- private void addSpecialModuleBindings(Map<String, Object> bindings) {
+ private void addSpecialModuleBindings(final Map<String, Object> bindings) {
if (moduleId != null) {
bindings.put("module/ModuleName", moduleId);
}
@@ -557,7 +557,7 @@ public class JndiEncBuilder {
}
}
- private void addSpecialAppBindings(Map<String, Object> bindings) {
+ private void addSpecialAppBindings(final Map<String, Object> bindings) {
if (moduleId != null) {
bindings.put("app/AppName", moduleId);
}
@@ -567,55 +567,55 @@ public class JndiEncBuilder {
}
}
- private void addSpecialGlobalBindings(Map<String, Object> bindings) {
+ private void addSpecialGlobalBindings(final Map<String, Object> bindings) {
// ensure the bindings will be non-empty
if (bindings.isEmpty()) {
bindings.put("global/dummy", "dummy");
}
}
- public static boolean bindingExists(Context context, Name contextName) {
+ public static boolean bindingExists(final Context context, final Name contextName) {
try {
return context.lookup(contextName) != null;
- } catch (NamingException e) {
+ } catch (final NamingException e) {
// no-op
}
return false;
}
- private Reference buildReferenceLocation(ReferenceLocationInfo location) {
+ private Reference buildReferenceLocation(final ReferenceLocationInfo location) {
if (location.jndiProviderId != null) {
- String subContextName = "openejb/remote_jndi_contexts/" + location.jndiProviderId;
+ final String subContextName = "openejb/remote_jndi_contexts/" + location.jndiProviderId;
return new JndiReference(subContextName, location.jndiName);
} else {
return new JndiUrlReference(location.jndiName);
}
}
- private String normalize(String name) {
+ private String normalize(final String name) {
//currently all names seem to be normalized properly
return name;
}
- private Class getType(String type, InjectableInfo injectable) throws OpenEJBException {
+ private Class getType(final String type, final InjectableInfo injectable) throws OpenEJBException {
if (type != null) {
try {
return classLoader.loadClass(type.trim());
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new OpenEJBException("Unable to load type '" + type + "' for " + injectable.referenceName);
}
}
return inferType(injectable);
}
- private Class inferType(InjectableInfo injectable) throws OpenEJBException {
- for (InjectionInfo injection : injectable.targets) {
+ private Class inferType(final InjectableInfo injectable) throws OpenEJBException {
+ for (final InjectionInfo injection : injectable.targets) {
try {
- Class<?> target = classLoader.loadClass(injection.className.trim());
+ final Class<?> target = classLoader.loadClass(injection.className.trim());
return IntrospectionSupport.getPropertyType(target, injection.propertyName.trim());
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// ignore
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
// ignore
}
}
@@ -625,7 +625,7 @@ public class JndiEncBuilder {
private static class Ref implements EjbResolver.Reference, Serializable {
private final EjbReferenceInfo info;
- public Ref(EjbReferenceInfo info) {
+ public Ref(final EjbReferenceInfo info) {
this.info = info;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyEjbReference.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyEjbReference.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyEjbReference.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyEjbReference.java Wed Feb 19 15:47:58 2014
@@ -42,7 +42,7 @@ public class LazyEjbReference extends Re
private final URI moduleUri;
private final boolean useCrossClassLoaderRef;
- public LazyEjbReference(EjbResolver.Reference info, URI moduleUri, boolean useCrossClassLoaderRef) {
+ public LazyEjbReference(final EjbResolver.Reference info, final URI moduleUri, final boolean useCrossClassLoaderRef) {
super();
this.info = info;
this.moduleUri = moduleUri;
@@ -54,28 +54,28 @@ public class LazyEjbReference extends Re
return reference.getObject();
}
- SystemInstance systemInstance = SystemInstance.get();
+ final SystemInstance systemInstance = SystemInstance.get();
- EjbResolver resolver = systemInstance.getComponent(EjbResolver.class);
+ final EjbResolver resolver = systemInstance.getComponent(EjbResolver.class);
- String deploymentId = resolver.resolve(info, moduleUri);
+ final String deploymentId = resolver.resolve(info, moduleUri);
if (deploymentId == null) {
String key = "lazyEjbRefNotResolved";
if (info.getHome() != null){
key += ".home";
}
- String message = messages.format(key, info.getName(), info.getEjbLink(), info.getHome(), info.getInterface());
+ final String message = messages.format(key, info.getName(), info.getEjbLink(), info.getHome(), info.getInterface());
throw new NameNotFoundException(message);
}
- ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
+ final ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
- BeanContext beanContext = containerSystem.getBeanContext(deploymentId);
+ final BeanContext beanContext = containerSystem.getBeanContext(deploymentId);
if (beanContext == null) {
- String message = messages.format("deploymentNotFound", info.getName(), deploymentId);
+ final String message = messages.format("deploymentNotFound", info.getName(), deploymentId);
throw new NameNotFoundException(message);
}
@@ -85,7 +85,7 @@ public class LazyEjbReference extends Re
case REMOTE: type = InterfaceType.BUSINESS_REMOTE; break;
}
- String jndiName = "openejb/Deployment/" + JndiBuilder.format(deploymentId, info.getInterface(), type);
+ final String jndiName = "openejb/Deployment/" + JndiBuilder.format(deploymentId, info.getInterface(), type);
if (useCrossClassLoaderRef && isRemote(beanContext)) {
reference = new CrossClassLoaderJndiReference(jndiName);
@@ -96,12 +96,12 @@ public class LazyEjbReference extends Re
return reference.getObject();
}
- private boolean isRemote(BeanContext beanContext) {
+ private boolean isRemote(final BeanContext beanContext) {
switch(info.getRefType()){
case REMOTE: return true;
case LOCAL: return false;
case UNKNOWN:{
- for (Class clazz : beanContext.getInterfaces(InterfaceType.BUSINESS_REMOTE)) {
+ for (final Class clazz : beanContext.getInterfaces(InterfaceType.BUSINESS_REMOTE)) {
if (clazz.getName().equals(info.getInterface())) return true;
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodConcurrencyBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodConcurrencyBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodConcurrencyBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodConcurrencyBuilder.java Wed Feb 19 15:47:58 2014
@@ -39,20 +39,20 @@ public class MethodConcurrencyBuilder {
public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, MethodConcurrencyBuilder.class);
- public void build(HashMap<String, BeanContext> deployments, List<MethodConcurrencyInfo> methodConcurrencys) throws OpenEJBException {
- for (BeanContext beanContext : deployments.values()) {
+ public void build(final HashMap<String, BeanContext> deployments, final List<MethodConcurrencyInfo> methodConcurrencys) throws OpenEJBException {
+ for (final BeanContext beanContext : deployments.values()) {
MethodConcurrencyBuilder.applyConcurrencyAttributes(beanContext, methodConcurrencys);
}
}
- public static void applyConcurrencyAttributes(BeanContext beanContext, List<MethodConcurrencyInfo> methodConcurrencyInfos) throws OpenEJBException {
+ public static void applyConcurrencyAttributes(final BeanContext beanContext, final List<MethodConcurrencyInfo> methodConcurrencyInfos) throws OpenEJBException {
if (beanContext.isBeanManagedConcurrency()) return;
- Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodConcurrencyBuilder.class);
+ final Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodConcurrencyBuilder.class);
- List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
- List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
+ final List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
+ final List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
MethodConcurrencyBuilder.normalize(methodConcurrencyInfos, lockInfos, accessTimeoutInfos);
@@ -62,18 +62,18 @@ public class MethodConcurrencyBuilder {
attributes = MethodInfoUtil.resolveAttributes(lockInfos, beanContext);
if (log.isDebugEnabled()) {
- for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
- Method method = entry.getKey();
- MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
+ for (final Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
+ final Method method = entry.getKey();
+ final MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
log.debug("Lock: " + method + " -- " + MethodInfoUtil.toString(value.methods.get(0)) +
" " + value.concurrencyAttribute);
}
}
- for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
- MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
- MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
- String s = value.concurrencyAttribute.toUpperCase();
+ for (final Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
+ final MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
+ final MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
+ final String s = value.concurrencyAttribute.toUpperCase();
methodContext.setLockType(LockType.valueOf(s));
}
@@ -81,18 +81,18 @@ public class MethodConcurrencyBuilder {
attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
if (log.isDebugEnabled()) {
- for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
- Method method = entry.getKey();
- MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
+ for (final Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
+ final Method method = entry.getKey();
+ final MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
log.debug("AccessTimeout: " + method + " -- " + MethodInfoUtil.toString(value.methods.get(0)) + " " +
" " + value.accessTimeout.time + " " + value.accessTimeout.unit);
}
}
- for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
- MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
- MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
- Duration accessTimeout = new Duration(value.accessTimeout.time, TimeUnit.valueOf(value.accessTimeout.unit));
+ for (final Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
+ final MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
+ final MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
+ final Duration accessTimeout = new Duration(value.accessTimeout.time, TimeUnit.valueOf(value.accessTimeout.unit));
methodContext.setAccessTimeout(accessTimeout);
}
}
@@ -108,12 +108,12 @@ public class MethodConcurrencyBuilder {
* @param infos
* @return a normalized list of new MethodConcurrencyInfo objects
*/
- public static void normalize(List<MethodConcurrencyInfo> infos,
- List<MethodConcurrencyInfo> lockInfos,
- List<MethodConcurrencyInfo> accessTimeoutInfos) {
- for (MethodConcurrencyInfo oldInfo : infos) {
- for (MethodInfo methodInfo : oldInfo.methods) {
- MethodConcurrencyInfo newInfo = new MethodConcurrencyInfo();
+ public static void normalize(final List<MethodConcurrencyInfo> infos,
+ final List<MethodConcurrencyInfo> lockInfos,
+ final List<MethodConcurrencyInfo> accessTimeoutInfos) {
+ for (final MethodConcurrencyInfo oldInfo : infos) {
+ for (final MethodInfo methodInfo : oldInfo.methods) {
+ final MethodConcurrencyInfo newInfo = new MethodConcurrencyInfo();
newInfo.description = oldInfo.description;
newInfo.methods.add(methodInfo);
newInfo.concurrencyAttribute = oldInfo.concurrencyAttribute;
@@ -136,7 +136,7 @@ public class MethodConcurrencyBuilder {
}
public static class MethodConcurrencyComparator extends MethodInfoUtil.BaseComparator<MethodConcurrencyInfo> {
- public int compare(MethodConcurrencyInfo a, MethodConcurrencyInfo b) {
+ public int compare(final MethodConcurrencyInfo a, final MethodConcurrencyInfo b) {
return compare(a.methods.get(0), b.methods.get(0));
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java Wed Feb 19 15:47:58 2014
@@ -55,27 +55,27 @@ public class MethodInfoUtil {
* @return
* @throws IllegalStateException if the method is not found in this class or any of its parent classes
*/
- public static Method toMethod(Class clazz, NamedMethodInfo info) {
- List<Class> parameterTypes = new ArrayList<Class>();
+ public static Method toMethod(Class clazz, final NamedMethodInfo info) {
+ final List<Class> parameterTypes = new ArrayList<Class>();
if (info.methodParams != null){
- for (String paramType : info.methodParams) {
+ for (final String paramType : info.methodParams) {
try {
parameterTypes.add(Classes.forName(paramType, clazz.getClassLoader()));
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
throw new IllegalStateException("Parameter class could not be loaded for type " + paramType, cnfe);
}
}
}
- Class[] parameters = parameterTypes.toArray(new Class[parameterTypes.size()]);
+ final Class[] parameters = parameterTypes.toArray(new Class[parameterTypes.size()]);
IllegalStateException noSuchMethod = null;
while (clazz != null) {
try {
- Method method = clazz.getDeclaredMethod(info.methodName, parameters);
+ final Method method = clazz.getDeclaredMethod(info.methodName, parameters);
return SetAccessible.on(method);
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
if (noSuchMethod == null) {
noSuchMethod = new IllegalStateException("Callback method does not exist: " + clazz.getName() + "." + info.methodName, e);
}
@@ -86,13 +86,13 @@ public class MethodInfoUtil {
throw noSuchMethod;
}
- public static List<Method> matchingMethods(Method signature, Class clazz) {
- List<Method> list = new ArrayList<Method>();
- METHOD: for (Method method : clazz.getMethods()) {
+ public static List<Method> matchingMethods(final Method signature, final Class clazz) {
+ final List<Method> list = new ArrayList<Method>();
+ METHOD: for (final Method method : clazz.getMethods()) {
if (!method.getName().equals(signature.getName())) continue;
- Class<?>[] methodTypes = method.getParameterTypes();
- Class<?>[] signatureTypes = signature.getParameterTypes();
+ final Class<?>[] methodTypes = method.getParameterTypes();
+ final Class<?>[] signatureTypes = signature.getParameterTypes();
if (methodTypes.length != signatureTypes.length) continue;
@@ -104,13 +104,13 @@ public class MethodInfoUtil {
return list;
}
- public static List<Method> matchingMethods(MethodInfo mi, Class clazz) {
- Method[] methods = clazz.getMethods();
+ public static List<Method> matchingMethods(final MethodInfo mi, final Class clazz) {
+ final Method[] methods = clazz.getMethods();
return matchingMethods(mi, methods);
}
- public static List<Method> matchingMethods(MethodInfo mi, Method[] methods) {
+ public static List<Method> matchingMethods(final MethodInfo mi, final Method[] methods) {
List<Method> filtered = filterByLevel(mi, methods);
@@ -119,8 +119,8 @@ public class MethodInfoUtil {
return filtered;
}
- private static List<Method> filterByView(MethodInfo mi, List<Method> filtered) {
- View view = view(mi);
+ private static List<Method> filterByView(final MethodInfo mi, final List<Method> filtered) {
+ final View view = view(mi);
switch(view){
case CLASS:{
return filterByClass(mi, filtered);
@@ -130,10 +130,10 @@ public class MethodInfoUtil {
return filtered;
}
- private static List<Method> filterByClass(MethodInfo mi, List<Method> methods) {
- ArrayList<Method> list = new ArrayList<Method>();
- for (Method method : methods) {
- String className = method.getDeclaringClass().getName();
+ private static List<Method> filterByClass(final MethodInfo mi, final List<Method> methods) {
+ final ArrayList<Method> list = new ArrayList<Method>();
+ for (final Method method : methods) {
+ final String className = method.getDeclaringClass().getName();
if (mi.className.equals(className)){
list.add(method);
}
@@ -141,8 +141,8 @@ public class MethodInfoUtil {
return list;
}
- private static List<Method> filterByLevel(MethodInfo mi, Method[] methods) {
- Level level = level(mi);
+ private static List<Method> filterByLevel(final MethodInfo mi, final Method[] methods) {
+ final Level level = level(mi);
switch(level){
case BEAN:
@@ -160,21 +160,21 @@ public class MethodInfoUtil {
return Collections.EMPTY_LIST;
}
- public static Method getMethod(Class clazz, MethodInfo info) {
- ClassLoader cl = clazz.getClassLoader();
+ public static Method getMethod(final Class clazz, final MethodInfo info) {
+ final ClassLoader cl = clazz.getClassLoader();
- List<Class> params = new ArrayList<Class>();
- for (String methodParam : info.methodParams) {
+ final List<Class> params = new ArrayList<Class>();
+ for (final String methodParam : info.methodParams) {
try {
params.add(getClassForParam(methodParam, cl));
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
// no-op
}
}
Method method = null;
try {
method = clazz.getMethod(info.methodName, params.toArray(new Class[params.size()]));
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
return null;
}
@@ -185,9 +185,9 @@ public class MethodInfoUtil {
return method;
}
- private static List<Method> filterByName(Method[] methods, String methodName) {
- List<Method> list = new ArrayList<Method>();
- for (Method method : methods) {
+ private static List<Method> filterByName(final Method[] methods, final String methodName) {
+ final List<Method> list = new ArrayList<Method>();
+ for (final Method method : methods) {
if (method.getName().equals(methodName)){
list.add(method);
}
@@ -195,9 +195,9 @@ public class MethodInfoUtil {
return list;
}
- private static List<Method> filterByNameAndParams(Method[] methods, MethodInfo mi) {
- List<Method> list = new ArrayList<Method>();
- for (Method method : methods) {
+ private static List<Method> filterByNameAndParams(final Method[] methods, final MethodInfo mi) {
+ final List<Method> list = new ArrayList<Method>();
+ for (final Method method : methods) {
if (matches(method, mi)){
list.add(method);
}
@@ -216,11 +216,11 @@ public class MethodInfoUtil {
* @param infos
* @return a normalized list of new MethodPermissionInfo objects
*/
- public static List<MethodPermissionInfo> normalizeMethodPermissionInfos(List<MethodPermissionInfo> infos){
- List<MethodPermissionInfo> normalized = new ArrayList<MethodPermissionInfo>();
- for (MethodPermissionInfo oldInfo : infos) {
- for (MethodInfo methodInfo : oldInfo.methods) {
- MethodPermissionInfo newInfo = new MethodPermissionInfo();
+ public static List<MethodPermissionInfo> normalizeMethodPermissionInfos(final List<MethodPermissionInfo> infos){
+ final List<MethodPermissionInfo> normalized = new ArrayList<MethodPermissionInfo>();
+ for (final MethodPermissionInfo oldInfo : infos) {
+ for (final MethodInfo methodInfo : oldInfo.methods) {
+ final MethodPermissionInfo newInfo = new MethodPermissionInfo();
newInfo.description = oldInfo.description;
newInfo.methods.add(methodInfo);
newInfo.roleNames.addAll(oldInfo.roleNames);
@@ -236,7 +236,7 @@ public class MethodInfoUtil {
return normalized;
}
- private static Class getClassForParam(String className, ClassLoader cl) throws ClassNotFoundException {
+ private static Class getClassForParam(final String className, final ClassLoader cl) throws ClassNotFoundException {
if (className.equals("int")) {
return Integer.TYPE;
@@ -259,17 +259,17 @@ public class MethodInfoUtil {
}
- public static Map<Method, MethodAttributeInfo> resolveAttributes(List<? extends MethodAttributeInfo> infos, BeanContext beanContext) {
- Map<Method, MethodAttributeInfo> attributes = new LinkedHashMap<Method, MethodAttributeInfo>();
+ public static Map<Method, MethodAttributeInfo> resolveAttributes(final List<? extends MethodAttributeInfo> infos, final BeanContext beanContext) {
+ final Map<Method, MethodAttributeInfo> attributes = new LinkedHashMap<Method, MethodAttributeInfo>();
- Method[] wildCardView = getWildCardView(beanContext).toArray(new Method[]{});
+ final Method[] wildCardView = getWildCardView(beanContext).toArray(new Method[]{});
- for (MethodAttributeInfo attributeInfo : infos) {
- for (MethodInfo methodInfo : attributeInfo.methods) {
+ for (final MethodAttributeInfo attributeInfo : infos) {
+ for (final MethodInfo methodInfo : attributeInfo.methods) {
if (methodInfo.ejbName == null || methodInfo.ejbName.equals("*") || methodInfo.ejbName.equals(beanContext.getEjbName())) {
- List<Method> methods = new ArrayList<Method>();
+ final List<Method> methods = new ArrayList<Method>();
if (methodInfo.methodIntf == null) {
methods.addAll(matchingMethods(methodInfo, wildCardView));
@@ -279,7 +279,7 @@ public class MethodInfoUtil {
if (beanContext.getRemoteInterface() != null) {
methods.addAll(matchingMethods(methodInfo, beanContext.getRemoteInterface()));
}
- for (Class intf : beanContext.getBusinessRemoteInterfaces()) {
+ for (final Class intf : beanContext.getBusinessRemoteInterfaces()) {
methods.addAll(matchingMethods(methodInfo, intf));
}
} else if (methodInfo.methodIntf.equals("LocalHome")) {
@@ -288,14 +288,14 @@ public class MethodInfoUtil {
if (beanContext.getLocalInterface() != null) {
methods.addAll(matchingMethods(methodInfo, beanContext.getLocalInterface()));
}
- for (Class intf : beanContext.getBusinessRemoteInterfaces()) {
+ for (final Class intf : beanContext.getBusinessRemoteInterfaces()) {
methods.addAll(matchingMethods(methodInfo, intf));
}
} else if (methodInfo.methodIntf.equals("ServiceEndpoint")) {
methods.addAll(matchingMethods(methodInfo, beanContext.getServiceEndpointInterface()));
}
- for (Method method : methods) {
+ for (final Method method : methods) {
if (containerMethod(method)) {
continue;
}
@@ -308,17 +308,17 @@ public class MethodInfoUtil {
return attributes;
}
- public static Map<ViewMethod, MethodAttributeInfo> resolveViewAttributes(List<? extends MethodAttributeInfo> infos, BeanContext beanContext) {
- Map<ViewMethod, MethodAttributeInfo> attributes = new LinkedHashMap<ViewMethod, MethodAttributeInfo>();
+ public static Map<ViewMethod, MethodAttributeInfo> resolveViewAttributes(final List<? extends MethodAttributeInfo> infos, final BeanContext beanContext) {
+ final Map<ViewMethod, MethodAttributeInfo> attributes = new LinkedHashMap<ViewMethod, MethodAttributeInfo>();
- Method[] wildCardView = getWildCardView(beanContext).toArray(new Method[]{});
+ final Method[] wildCardView = getWildCardView(beanContext).toArray(new Method[]{});
- for (MethodAttributeInfo attributeInfo : infos) {
- for (MethodInfo methodInfo : attributeInfo.methods) {
+ for (final MethodAttributeInfo attributeInfo : infos) {
+ for (final MethodInfo methodInfo : attributeInfo.methods) {
if (methodInfo.ejbName == null || methodInfo.ejbName.equals("*") || methodInfo.ejbName.equals(beanContext.getEjbName())) {
- List<Method> methods = new ArrayList<Method>();
+ final List<Method> methods = new ArrayList<Method>();
if (methodInfo.methodIntf == null) {
methods.addAll(matchingMethods(methodInfo, wildCardView));
@@ -328,7 +328,7 @@ public class MethodInfoUtil {
if (beanContext.getRemoteInterface() != null) {
methods.addAll(matchingMethods(methodInfo, beanContext.getRemoteInterface()));
}
- for (Class intf : beanContext.getBusinessRemoteInterfaces()) {
+ for (final Class intf : beanContext.getBusinessRemoteInterfaces()) {
methods.addAll(matchingMethods(methodInfo, intf));
}
} else if (methodInfo.methodIntf.equals("LocalHome")) {
@@ -337,14 +337,14 @@ public class MethodInfoUtil {
if (beanContext.getLocalInterface() != null) {
methods.addAll(matchingMethods(methodInfo, beanContext.getLocalInterface()));
}
- for (Class intf : beanContext.getBusinessRemoteInterfaces()) {
+ for (final Class intf : beanContext.getBusinessRemoteInterfaces()) {
methods.addAll(matchingMethods(methodInfo, intf));
}
} else if (methodInfo.methodIntf.equals("ServiceEndpoint")) {
methods.addAll(matchingMethods(methodInfo, beanContext.getServiceEndpointInterface()));
}
- for (Method method : methods) {
+ for (final Method method : methods) {
if (containerMethod(method)) {
continue;
}
@@ -368,7 +368,7 @@ public class MethodInfoUtil {
private final String view;
private final Method method;
- public ViewMethod(String view, Method method) {
+ public ViewMethod(final String view, final Method method) {
this.view = view;
this.method = method;
}
@@ -382,11 +382,11 @@ public class MethodInfoUtil {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- ViewMethod that = (ViewMethod) o;
+ final ViewMethod that = (ViewMethod) o;
if (!method.equals(that.method)) return false;
if (view != null ? !view.equals(that.view) : that.view != null) return false;
@@ -407,7 +407,7 @@ public class MethodInfoUtil {
}
}
- private static boolean containerMethod(Method method) {
+ private static boolean containerMethod(final Method method) {
return (method.getDeclaringClass() == EJBObject.class ||
method.getDeclaringClass() == EJBHome.class ||
method.getDeclaringClass() == EJBLocalObject.class ||
@@ -415,10 +415,10 @@ public class MethodInfoUtil {
!method.getName().equals("remove");
}
- private static List<Method> getWildCardView(BeanContext info) {
- List<Method> methods = new ArrayList<Method>();
+ private static List<Method> getWildCardView(final BeanContext info) {
+ final List<Method> methods = new ArrayList<Method>();
- List<Method> beanMethods = asList(info.getBeanClass().getMethods());
+ final List<Method> beanMethods = asList(info.getBeanClass().getMethods());
methods.addAll(beanMethods);
if (info.getRemoteInterface() != null) {
@@ -444,28 +444,28 @@ public class MethodInfoUtil {
methods.addAll(exclude(beanMethods, info.getServiceEndpointInterface().getMethods()));
}
- for (Class intf : info.getBusinessRemoteInterfaces()) {
+ for (final Class intf : info.getBusinessRemoteInterfaces()) {
methods.addAll(exclude(beanMethods, intf.getMethods()));
}
- for (Class intf : info.getBusinessLocalInterfaces()) {
+ for (final Class intf : info.getBusinessLocalInterfaces()) {
methods.addAll(exclude(beanMethods, intf.getMethods()));
}
// Remove methods that cannot be controlled by the user
- Iterator<Method> iterator = methods.iterator();
+ final Iterator<Method> iterator = methods.iterator();
while (iterator.hasNext()) {
- Method method = iterator.next();
+ final Method method = iterator.next();
if (containerMethod(method)) iterator.remove();
}
return methods;
}
- private static List<Method> exclude(List<Method> excludes, Method[] methods) {
- ArrayList<Method> list = new ArrayList<Method>();
+ private static List<Method> exclude(final List<Method> excludes, final Method[] methods) {
+ final ArrayList<Method> list = new ArrayList<Method>();
- for (Method method : methods) {
+ for (final Method method : methods) {
if (!matches(excludes, method)){
list.add(method);
}
@@ -473,9 +473,9 @@ public class MethodInfoUtil {
return list;
}
- private static boolean matches(List<Method> excludes, Method method) {
- for (Method excluded : excludes) {
- boolean match = match(method, excluded);
+ private static boolean matches(final List<Method> excludes, final Method method) {
+ for (final Method excluded : excludes) {
+ final boolean match = match(method, excluded);
if (match){
return true;
}
@@ -483,7 +483,7 @@ public class MethodInfoUtil {
return false;
}
- public static boolean match(Method methodA, Method methodB) {
+ public static boolean match(final Method methodA, final Method methodB) {
if (!methodA.getName().equals(methodB.getName())) return false;
if (methodA.getParameterTypes().length != methodB.getParameterTypes().length){
@@ -491,22 +491,22 @@ public class MethodInfoUtil {
}
for (int i = 0; i < methodA.getParameterTypes().length; i++) {
- Class<?> a = methodA.getParameterTypes()[i];
- Class<?> b = methodB.getParameterTypes()[i];
+ final Class<?> a = methodA.getParameterTypes()[i];
+ final Class<?> b = methodB.getParameterTypes()[i];
if (!a.equals(b)) return false;
}
return true;
}
- public static boolean matches(Method method, MethodInfo methodInfo) {
+ public static boolean matches(final Method method, final MethodInfo methodInfo) {
return matches(method, methodInfo.methodName, methodInfo.methodParams);
}
- public static boolean matches(Method method, NamedMethodInfo methodInfo) {
+ public static boolean matches(final Method method, final NamedMethodInfo methodInfo) {
return matches(method, methodInfo.methodName, methodInfo.methodParams);
}
- public static boolean matches(Method method, String methodName, List<String> methodParams) {
+ public static boolean matches(final Method method, final String methodName, final List<String> methodParams) {
if (!methodName.equals(method.getName())) {
return false;
@@ -523,10 +523,10 @@ public class MethodInfoUtil {
}
// match parameters names
- Class<?>[] parameterTypes = method.getParameterTypes();
+ final Class<?>[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
- Class<?> parameterType = parameterTypes[i];
- String methodParam = methodParams.get(i);
+ final Class<?> parameterType = parameterTypes[i];
+ final String methodParam = methodParams.get(i);
if (!methodParam.equals(getName(parameterType)) && !methodParam.equals(parameterType.getName())) {
return false;
}
@@ -535,7 +535,7 @@ public class MethodInfoUtil {
return true;
}
- private static String getName(Class<?> type) {
+ private static String getName(final Class<?> type) {
if (type.isArray()) {
return getName(type.getComponentType()) + "[]"; // depend on JVM? type.getName() seems to work on Oracle one
} else {
@@ -552,13 +552,13 @@ public class MethodInfoUtil {
CLASS, ANY, INTERFACE;
}
- public static View view(MethodInfo methodInfo) {
+ public static View view(final MethodInfo methodInfo) {
if (methodInfo.className != null && !methodInfo.className.equals("*")) return View.CLASS;
if (methodInfo.methodIntf != null && !methodInfo.methodIntf.equals("*")) return View.INTERFACE;
else return View.ANY;
}
- public static Level level(MethodInfo methodInfo) {
+ public static Level level(final MethodInfo methodInfo) {
if (methodInfo.ejbName != null && methodInfo.ejbName.equals("*")) return Level.PACKAGE;
if (methodInfo.methodName.equals("*")) return Level.BEAN;
if (methodInfo.methodParams == null) return Level.OVERLOADED_METHOD;
@@ -567,15 +567,15 @@ public class MethodInfoUtil {
public static class MethodPermissionComparator extends BaseComparator<MethodPermissionInfo> {
- public int compare(MethodPermissionInfo a, MethodPermissionInfo b) {
+ public int compare(final MethodPermissionInfo a, final MethodPermissionInfo b) {
return compare(a.methods.get(0), b.methods.get(0));
}
}
public abstract static class BaseComparator<T> implements Comparator<T>{
- public int compare(MethodInfo am, MethodInfo bm) {
- Level levelA = level(am);
- Level levelB = level(bm);
+ public int compare(final MethodInfo am, final MethodInfo bm) {
+ final Level levelA = level(am);
+ final Level levelB = level(bm);
// Primary sort
if (levelA != levelB) return levelA.ordinal() - levelB.ordinal();
@@ -586,7 +586,7 @@ public class MethodInfoUtil {
}
- public static String toString(MethodInfo i) {
+ public static String toString(final MethodInfo i) {
String s = i.ejbName;
s += " : ";
s += i.methodIntf == null ? "*" : i.methodIntf;
@@ -604,7 +604,7 @@ public class MethodInfoUtil {
return s;
}
- public static String toString(MethodPermissionInfo i) {
+ public static String toString(final MethodPermissionInfo i) {
String s = toString(i.methods.get(0));
if (i.unchecked){
s += " Unchecked";
@@ -616,13 +616,13 @@ public class MethodInfoUtil {
return s;
}
- public static String toString(MethodTransactionInfo i) {
+ public static String toString(final MethodTransactionInfo i) {
String s = toString(i.methods.get(0));
s += " " + i.transAttribute;
return s;
}
- public static String toString(MethodConcurrencyInfo i) {
+ public static String toString(final MethodConcurrencyInfo i) {
String s = toString(i.methods.get(0));
s += " " + i.concurrencyAttribute;
return s;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodScheduleBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodScheduleBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodScheduleBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodScheduleBuilder.java Wed Feb 19 15:47:58 2014
@@ -30,11 +30,11 @@ public class MethodScheduleBuilder {
public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, MethodScheduleBuilder.class.getPackage().getName());
- public void build(BeanContext beanContext, EnterpriseBeanInfo beanInfo) {
+ public void build(final BeanContext beanContext, final EnterpriseBeanInfo beanInfo) {
- Class<?> clazz = beanContext.getBeanClass();
+ final Class<?> clazz = beanContext.getBeanClass();
- for (MethodScheduleInfo info : beanInfo.methodScheduleInfos) {
+ for (final MethodScheduleInfo info : beanInfo.methodScheduleInfos) {
Method timeoutMethodOfSchedule = null;
@@ -46,7 +46,7 @@ public class MethodScheduleBuilder {
try {
timeoutMethodOfSchedule = MethodInfoUtil.toMethod(clazz, info.method);
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
// method doesn't exist
logger.warning("Schedule method does not exist: " + info.method.methodName, e);
continue;
@@ -69,15 +69,15 @@ public class MethodScheduleBuilder {
}
}
- private void addSchedulesToMethod(MethodContext methodContext, MethodScheduleInfo info){
+ private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info){
if (methodContext == null) {
return;
}
- for (ScheduleInfo scheduleInfo : info.schedules) {
+ for (final ScheduleInfo scheduleInfo : info.schedules) {
- ScheduleExpression expr = new ScheduleExpression();
+ final ScheduleExpression expr = new ScheduleExpression();
expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second);
expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute);
expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour);
@@ -89,7 +89,7 @@ public class MethodScheduleBuilder {
expr.start(scheduleInfo.start);
expr.end(scheduleInfo.end);
- TimerConfig config = new TimerConfig();
+ final TimerConfig config = new TimerConfig();
config.setInfo(scheduleInfo.info);
config.setPersistent(scheduleInfo.persistent);
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java Wed Feb 19 15:47:58 2014
@@ -38,13 +38,13 @@ public class MethodTransactionBuilder {
public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, MethodTransactionBuilder.class);
- public void build(HashMap<String, BeanContext> deployments, List<MethodTransactionInfo> methodTransactions) throws OpenEJBException {
- for (BeanContext beanContext : deployments.values()) {
+ public void build(final HashMap<String, BeanContext> deployments, final List<MethodTransactionInfo> methodTransactions) throws OpenEJBException {
+ for (final BeanContext beanContext : deployments.values()) {
applyTransactionAttributes(beanContext, methodTransactions);
}
}
- public static void applyTransactionAttributes(BeanContext beanContext, List<MethodTransactionInfo> methodTransactionInfos) throws OpenEJBException {
+ public static void applyTransactionAttributes(final BeanContext beanContext, List<MethodTransactionInfo> methodTransactionInfos) throws OpenEJBException {
if (beanContext.isBeanManagedTransaction()) return;
@@ -52,15 +52,15 @@ public class MethodTransactionBuilder {
final Map<MethodInfoUtil.ViewMethod, MethodAttributeInfo> attributes = resolveViewAttributes(methodTransactionInfos, beanContext);
- Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodTransactionBuilder.class);
+ final Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodTransactionBuilder.class);
final boolean debug = log.isDebugEnabled();
- for (Map.Entry<MethodInfoUtil.ViewMethod, MethodAttributeInfo> entry : attributes.entrySet()) {
+ for (final Map.Entry<MethodInfoUtil.ViewMethod, MethodAttributeInfo> entry : attributes.entrySet()) {
final MethodInfoUtil.ViewMethod viewMethod = entry.getKey();
final Method method = viewMethod.getMethod();
final String view = viewMethod.getView();
- MethodTransactionInfo transactionInfo = (MethodTransactionInfo) entry.getValue();
+ final MethodTransactionInfo transactionInfo = (MethodTransactionInfo) entry.getValue();
if (debug) log.debug("Transaction Attribute: " + method + " -- " + MethodInfoUtil.toString(transactionInfo));
@@ -78,11 +78,11 @@ public class MethodTransactionBuilder {
*
* @return a normalized list of new MethodTransactionInfo objects
*/
- public static List<MethodTransactionInfo> normalize(List<MethodTransactionInfo> infos){
- List<MethodTransactionInfo> normalized = new ArrayList<MethodTransactionInfo>();
- for (MethodTransactionInfo oldInfo : infos) {
- for (MethodInfo methodInfo : oldInfo.methods) {
- MethodTransactionInfo newInfo = new MethodTransactionInfo();
+ public static List<MethodTransactionInfo> normalize(final List<MethodTransactionInfo> infos){
+ final List<MethodTransactionInfo> normalized = new ArrayList<MethodTransactionInfo>();
+ for (final MethodTransactionInfo oldInfo : infos) {
+ for (final MethodInfo methodInfo : oldInfo.methods) {
+ final MethodTransactionInfo newInfo = new MethodTransactionInfo();
newInfo.description = oldInfo.description;
newInfo.methods.add(methodInfo);
newInfo.transAttribute = oldInfo.transAttribute;
@@ -98,7 +98,7 @@ public class MethodTransactionBuilder {
}
public static class MethodTransactionComparator extends MethodInfoUtil.BaseComparator<MethodTransactionInfo> {
- public int compare(MethodTransactionInfo a, MethodTransactionInfo b) {
+ public int compare(final MethodTransactionInfo a, final MethodTransactionInfo b) {
return compare(a.methods.get(0), b.methods.get(0));
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java Wed Feb 19 15:47:58 2014
@@ -82,10 +82,10 @@ public class PersistenceBuilder {
final DataSource jtaDataSource = (DataSource) context.lookup(jtaDataSourceId);
unitInfo.setJtaDataSource(jtaDataSource);
- } catch (NamingException e) {
+ } catch (final NamingException e) {
try {
unitInfo.setJtaDataSource((DataSource) new InitialContext().lookup(initialJndiName));
- } catch (NamingException ne) {
+ } catch (final NamingException ne) {
throw new OpenEJBException("Could not lookup <jta-data-source> '" + jtaDataSourceId + "' for unit '" + unitInfo.getPersistenceUnitName() + "'", e);
}
}
@@ -129,10 +129,10 @@ public class PersistenceBuilder {
final DataSource nonJtaDataSource = (DataSource) context.lookup(nonJtaDataSourceId);
unitInfo.setNonJtaDataSource(nonJtaDataSource);
- } catch (NamingException e) {
+ } catch (final NamingException e) {
try {
unitInfo.setNonJtaDataSource((DataSource) new InitialContext().lookup(initialJndiName));
- } catch (NamingException ne) {
+ } catch (final NamingException ne) {
throw new OpenEJBException("Could not lookup <non-jta-data-source> '" + nonJtaDataSourceId + "' for unit '" + unitInfo.getPersistenceUnitName() + "'", e);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PolicyContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PolicyContext.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PolicyContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PolicyContext.java Wed Feb 19 15:47:58 2014
@@ -30,7 +30,7 @@ public class PolicyContext {
private final Map<String,PermissionCollection> rolePermissions = new HashMap<String,PermissionCollection>();
private final String contextId;
- public PolicyContext(String contextId) {
+ public PolicyContext(final String contextId) {
this.contextId = contextId;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ProxyInterfaceResolver.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ProxyInterfaceResolver.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ProxyInterfaceResolver.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ProxyInterfaceResolver.java Wed Feb 19 15:47:58 2014
@@ -26,15 +26,15 @@ import java.util.List;
*/
public class ProxyInterfaceResolver {
- public static List<Class> getInterfaces(Class implementation, Class mainInterface, List<Class> interfaces){
- List<Class> valid = new ArrayList<Class>();
+ public static List<Class> getInterfaces(final Class implementation, final Class mainInterface, final List<Class> interfaces){
+ final List<Class> valid = new ArrayList<Class>();
// The intended interface is safe to add
if (mainInterface != null) {
valid.add(mainInterface);
}
// Any interface the bean implements is safe (potentially)
- for (Class interfce : interfaces) {
+ for (final Class interfce : interfaces) {
if (interfce.isAssignableFrom(implementation)){
valid.add(interfce);
}
@@ -69,9 +69,9 @@ public class ProxyInterfaceResolver {
// a runtime exception and must be throwable via the proxy.
- List<Class> remotes = new ArrayList<Class>();
- List<Class> nonremotes = new ArrayList<Class>();
- for (Class interfce : valid) {
+ final List<Class> remotes = new ArrayList<Class>();
+ final List<Class> nonremotes = new ArrayList<Class>();
+ for (final Class interfce : valid) {
if (Remote.class.isAssignableFrom(interfce)){
remotes.add(interfce);
} else {
@@ -96,23 +96,23 @@ public class ProxyInterfaceResolver {
valid.add(mainInterface);
// Track the method signatures of the interfaces we add
- List<Signature> proxySignatures = getSignatures(mainInterface);
+ final List<Signature> proxySignatures = getSignatures(mainInterface);
// Show affinity for the remote interfaces if the main
// interface is a java.rmi.Remote
if (Remote.class.isAssignableFrom(mainInterface)){
- for (Class interfce : remotes) {
+ for (final Class interfce : remotes) {
addIfNotConflicting(interfce, valid, proxySignatures);
}
- for (Class interfce : nonremotes) {
+ for (final Class interfce : nonremotes) {
addIfNotConflicting(interfce, valid, proxySignatures);
}
} else {
- for (Class interfce : nonremotes) {
+ for (final Class interfce : nonremotes) {
addIfNotConflicting(interfce, valid, proxySignatures);
}
- for (Class interfce : remotes) {
+ for (final Class interfce : remotes) {
addIfNotConflicting(interfce, valid, proxySignatures);
}
}
@@ -129,12 +129,12 @@ public class ProxyInterfaceResolver {
* @param valid
* @param proxySignatures
*/
- private static void addIfNotConflicting(Class interfce, List<Class> valid, List<Signature> proxySignatures) {
+ private static void addIfNotConflicting(final Class interfce, final List<Class> valid, final List<Signature> proxySignatures) {
- List<Signature> interfaceSigs = getSignatures(interfce);
+ final List<Signature> interfaceSigs = getSignatures(interfce);
- for (Signature sig : interfaceSigs) {
+ for (final Signature sig : interfaceSigs) {
// Contains will return true if the
// method signature exits *and* has
// a different throws clause
@@ -149,9 +149,9 @@ public class ProxyInterfaceResolver {
proxySignatures.addAll(interfaceSigs);
}
- private static List<Signature> getSignatures(Class mainInterface) {
- List<Signature> sigs = new ArrayList<Signature>();
- for (Method method : mainInterface.getMethods()) {
+ private static List<Signature> getSignatures(final Class mainInterface) {
+ final List<Signature> sigs = new ArrayList<Signature>();
+ for (final Method method : mainInterface.getMethods()) {
sigs.add(new Signature(mainInterface, method));
}
return sigs;
@@ -162,13 +162,13 @@ public class ProxyInterfaceResolver {
private final Method method;
private final String sig;
- public Signature(Class clazz, Method method) {
+ public Signature(final Class clazz, final Method method) {
this.clazz = clazz;
this.method = method;
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(method.getName());
sb.append('(');
- for (Class<?> type : method.getParameterTypes()) {
+ for (final Class<?> type : method.getParameterTypes()) {
sb.append(type.getName());
sb.append(',');
}
@@ -182,7 +182,7 @@ public class ProxyInterfaceResolver {
// This equals returns true only if the method signatures
// are the same *and* one is remote and one is not
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
@@ -190,8 +190,8 @@ public class ProxyInterfaceResolver {
if (!sig.equals(signature.sig)) return false;
- boolean aIsRemote = Remote.class.isAssignableFrom(clazz);
- boolean bIsRemote = Remote.class.isAssignableFrom(signature.clazz);
+ final boolean aIsRemote = Remote.class.isAssignableFrom(clazz);
+ final boolean bIsRemote = Remote.class.isAssignableFrom(signature.clazz);
return !(aIsRemote == bIsRemote);
}