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 2013/11/27 16:21:54 UTC
svn commit: r1546069 - in /tomee/tomee/trunk/container/openejb-core: ./
src/main/java/org/apache/openejb/ src/main/java/org/apache/openejb/config/
src/main/java/org/apache/openejb/core/managed/
src/main/java/org/apache/openejb/core/stateful/ src/main/j...
Author: tveronezi
Date: Wed Nov 27 15:21:54 2013
New Revision: 1546069
URL: http://svn.apache.org/r1546069
Log:
https://issues.apache.org/jira/browse/OPENEJB-2053
PMD finalizers.xml and imports.xml rules.
Modified:
tomee/tomee/trunk/container/openejb-core/pom.xml
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/SimpleWorkManager.java
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/doc/Revisit.java
Modified: tomee/tomee/trunk/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/pom.xml?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/pom.xml (original)
+++ tomee/tomee/trunk/container/openejb-core/pom.xml Wed Nov 27 15:21:54 2013
@@ -256,6 +256,8 @@
<targetJdk>1.6</targetJdk>
<rulesets>
<ruleset>${project.basedir}/src/main/config/pmd/openejb-empty.xml</ruleset>
+ <ruleset>rulesets/java/finalizers.xml</ruleset>
+ <ruleset>rulesets/java/imports.xml</ruleset>
</rulesets>
</configuration>
<executions>
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java Wed Nov 27 15:21:54 2013
@@ -200,7 +200,7 @@ public class ClassLoaderUtil {
return files;
}
- @SuppressWarnings("UseOfObsoleteCollectionType")
+ @SuppressWarnings({"UseOfObsoleteCollectionType", "PMD.AvoidCallingFinalize"})
public boolean finalizeNativeLibs(final ClassLoader cl) {
boolean res = false;
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=1546069&r1=1546068&r2=1546069&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 Nov 27 15:21:54 2013
@@ -243,10 +243,6 @@ import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
-import static java.lang.reflect.Modifier.isAbstract;
-import static java.util.Arrays.asList;
-import static org.apache.openejb.util.Join.join;
-
/**
* @version $Rev$ $Date$
*/
@@ -303,7 +299,7 @@ public class AnnotationDeployer implemen
API_CLASSES.addAll(Arrays.asList(WEB_CLASSES));
}
- public static final Set<String> knownResourceEnvTypes = new TreeSet<String>(asList(
+ public static final Set<String> knownResourceEnvTypes = new TreeSet<String>(Arrays.asList(
"javax.ejb.EJBContext",
"javax.ejb.SessionContext",
"javax.ejb.EntityContext",
@@ -318,7 +314,7 @@ public class AnnotationDeployer implemen
"javax.validation.ValidatorFactory"
));
- public static final Set<String> knownEnvironmentEntries = new TreeSet<String>(asList(
+ public static final Set<String> knownEnvironmentEntries = new TreeSet<String>(Arrays.asList(
"boolean", "java.lang.Boolean",
"char", "java.lang.Character",
"byte", "java.lang.Byte",
@@ -1087,7 +1083,7 @@ public class AnnotationDeployer implemen
}
int modifiers = webServiceClass.getModifiers();
- if (!Modifier.isPublic(modifiers) || Modifier.isFinal(modifiers) || isAbstract(modifiers)) {
+ if (!Modifier.isPublic(modifiers) || Modifier.isFinal(modifiers) || Modifier.isAbstract(modifiers)) {
continue;
}
@@ -1733,7 +1729,7 @@ public class AnnotationDeployer implemen
}
private boolean isValidEjbAnnotationUsage(Class annotationClass, Annotated<Class<?>> beanClass, String ejbName, EjbModule ejbModule) {
- List<Class<? extends Annotation>> annotations = new ArrayList(asList(Singleton.class, Stateless.class, Stateful.class, MessageDriven.class));
+ List<Class<? extends Annotation>> annotations = new ArrayList(Arrays.asList(Singleton.class, Stateless.class, Stateful.class, MessageDriven.class));
annotations.remove(annotationClass);
boolean b = true;
@@ -1763,7 +1759,7 @@ public class AnnotationDeployer implemen
ejbModule.getValidation().fail(ejbName, "interfaceAnnotatedAsBean", annotationClass.getSimpleName(), beanClass.get().getName());
return false;
}
- } else if (isAbstract(beanClass.get().getModifiers())) {
+ } else if (Modifier.isAbstract(beanClass.get().getModifiers())) {
if (!CheckClasses.isAbstractAllowed(beanClass.get())) {
ejbModule.getValidation().fail(ejbName, "abstractAnnotatedAsBean", annotationClass.getSimpleName(), beanClass.get().getName());
return false;
@@ -2246,7 +2242,7 @@ public class AnnotationDeployer implemen
for (EnterpriseBean otherBean : enterpriseBeans) {
others.add(otherBean.getEjbName());
}
- fail(ejbName, "xml.noEjbClass", ejbName, join(", ", others));
+ fail(ejbName, "xml.noEjbClass", ejbName, Join.join(", ", others));
}
final Class<?> clazz;
@@ -2873,7 +2869,7 @@ public class AnnotationDeployer implemen
all.local.addAll(xml.local);
all.remote.addAll(xml.remote);
- final List<Class<?>> classes = strict ? new ArrayList(asList(beanClass)) : Classes.ancestors(beanClass);
+ final List<Class<?>> classes = strict ? new ArrayList(Arrays.asList(beanClass)) : Classes.ancestors(beanClass);
for (Class<?> clazz : classes) {
@@ -2959,8 +2955,8 @@ public class AnnotationDeployer implemen
* on the interface.
*/
BusinessInterfaces bean = new BusinessInterfaces();
- if (local != null) bean.local.addAll(asList(local.value()));
- if (remote != null) bean.remote.addAll(asList(remote.value()));
+ if (local != null) bean.local.addAll(Arrays.asList(local.value()));
+ if (remote != null) bean.remote.addAll(Arrays.asList(remote.value()));
if (strict) for (Class interfce : bean.local) {
if (bean.remote.contains(interfce)) {
@@ -2990,17 +2986,17 @@ public class AnnotationDeployer implemen
// just warn for @Local since Glassfish supports it even if it is weird
// still fail for @Remote!
if (impliedLocal && local.value().length == 0 && interfaces.size() == 0 && !strict) {
- validation.warn(ejbName, "ann.local.forLocalBean", join(", ", interfaceNames));
+ validation.warn(ejbName, "ann.local.forLocalBean", Join.join(", ", interfaceNames));
// we don't go out to let be deployed
} else if (impliedLocal) {
- validation.fail(ejbName, "ann.local.noAttributes", join(", ", interfaceNames));
+ validation.fail(ejbName, "ann.local.noAttributes", Join.join(", ", interfaceNames));
/**
* This bean is invalid, so do not bother looking at the other interfaces or the superclass
*/
return;
}
if (impliedRemote) {
- validation.fail(ejbName, "ann.remote.noAttributes", join(", ", interfaceNames));
+ validation.fail(ejbName, "ann.remote.noAttributes", Join.join(", ", interfaceNames));
/**
* This bean is invalid, so do not bother looking at the other interfaces or the superclass
*/
@@ -3252,7 +3248,7 @@ public class AnnotationDeployer implemen
if (rolesAllowed != null) {
MethodPermission methodPermission = new MethodPermission();
- methodPermission.getRoleName().addAll(asList(rolesAllowed.value()));
+ methodPermission.getRoleName().addAll(Arrays.asList(rolesAllowed.value()));
methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*"));
assemblyDescriptor.getMethodPermission().add(methodPermission);
@@ -3310,7 +3306,7 @@ public class AnnotationDeployer implemen
checkConflictingSecurityAnnotations(method, ejbName, ejbModule, seen);
RolesAllowed rolesAllowed = method.getAnnotation(RolesAllowed.class);
MethodPermission methodPermission = new MethodPermission();
- methodPermission.getRoleName().addAll(asList(rolesAllowed.value()));
+ methodPermission.getRoleName().addAll(Arrays.asList(rolesAllowed.value()));
methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, method.get()));
assemblyDescriptor.getMethodPermission().add(methodPermission);
@@ -3362,14 +3358,14 @@ public class AnnotationDeployer implemen
}
List<String> annotations = new ArrayList<String>();
- for (Class<? extends Annotation> annotation : asList(RolesAllowed.class, PermitAll.class, DenyAll.class)) {
+ for (Class<? extends Annotation> annotation : Arrays.asList(RolesAllowed.class, PermitAll.class, DenyAll.class)) {
if (method.getAnnotation(annotation) != null) {
annotations.add("@" + annotation.getSimpleName());
}
}
if (annotations.size() > 1) {
- ejbModule.getValidation().fail(ejbName, "conflictingSecurityAnnotations", method.get().getName(), join(" and ", annotations), method.get().getDeclaringClass());
+ ejbModule.getValidation().fail(ejbName, "conflictingSecurityAnnotations", method.get().getName(), Join.join(" and ", annotations), method.get().getDeclaringClass());
}
}
@@ -3403,7 +3399,7 @@ public class AnnotationDeployer implemen
Schedules schedulesAnnotation = method.getAnnotation(Schedules.class);
if (schedulesAnnotation != null) {
- scheduleAnnotationList.addAll(asList(schedulesAnnotation.value()));
+ scheduleAnnotationList.addAll(Arrays.asList(schedulesAnnotation.value()));
}
Schedule scheduleAnnotation = method.getAnnotation(Schedule.class);
@@ -3604,7 +3600,7 @@ public class AnnotationDeployer implemen
List<EJB> ejbList = new ArrayList<EJB>();
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(EJBs.class)) {
EJBs ejbs = clazz.getAnnotation(EJBs.class);
- ejbList.addAll(asList(ejbs.value()));
+ ejbList.addAll(Arrays.asList(ejbs.value()));
}
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(EJB.class)) {
EJB e = clazz.getAnnotation(EJB.class);
@@ -3638,7 +3634,7 @@ public class AnnotationDeployer implemen
List<Resource> resourceList = new ArrayList<Resource>();
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(Resources.class)) {
Resources resources = clazz.getAnnotation(Resources.class);
- resourceList.addAll(asList(resources.value()));
+ resourceList.addAll(Arrays.asList(resources.value()));
}
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(Resource.class)) {
Resource resource = clazz.getAnnotation(Resource.class);
@@ -3680,7 +3676,7 @@ public class AnnotationDeployer implemen
List<WebServiceRef> webservicerefList = new ArrayList<WebServiceRef>();
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(WebServiceRefs.class)) {
WebServiceRefs webServiceRefs = clazz.getAnnotation(WebServiceRefs.class);
- webservicerefList.addAll(asList(webServiceRefs.value()));
+ webservicerefList.addAll(Arrays.asList(webServiceRefs.value()));
}
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(WebServiceRef.class)) {
WebServiceRef webServiceRef = clazz.getAnnotation(WebServiceRef.class);
@@ -3717,7 +3713,7 @@ public class AnnotationDeployer implemen
List<PersistenceUnit> persistenceUnitList = new ArrayList<PersistenceUnit>();
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(PersistenceUnits.class)) {
PersistenceUnits persistenceUnits = clazz.getAnnotation(PersistenceUnits.class);
- persistenceUnitList.addAll(asList(persistenceUnits.value()));
+ persistenceUnitList.addAll(Arrays.asList(persistenceUnits.value()));
}
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(PersistenceUnit.class)) {
PersistenceUnit persistenceUnit = clazz.getAnnotation(PersistenceUnit.class);
@@ -3745,7 +3741,7 @@ public class AnnotationDeployer implemen
List<PersistenceContext> persistenceContextList = new ArrayList<PersistenceContext>();
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(PersistenceContexts.class)) {
PersistenceContexts persistenceContexts = clazz.getAnnotation(PersistenceContexts.class);
- persistenceContextList.addAll(asList(persistenceContexts.value()));
+ persistenceContextList.addAll(Arrays.asList(persistenceContexts.value()));
pcFactory.addAnnotations(clazz.get());
}
for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(PersistenceContext.class)) {
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java Wed Nov 27 15:21:54 2013
@@ -52,10 +52,13 @@ import org.apache.openejb.jee.oejb3.EjbD
import org.apache.openejb.jee.oejb3.OpenejbJar;
import org.apache.openejb.jee.oejb3.ResourceLink;
import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.resource.jdbc.DataSourceFactory;
import org.apache.openejb.util.IntrospectionSupport;
+import org.apache.openejb.util.Join;
import org.apache.openejb.util.LinkResolver;
import org.apache.openejb.util.LogCategory;
import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.PropertyPlaceHolderHelper;
import org.apache.openejb.util.SuperProperties;
import org.apache.openejb.util.URISupport;
import org.apache.openejb.util.URLs;
@@ -84,6 +87,7 @@ import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Providers;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -96,15 +100,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import static java.util.Arrays.asList;
-import static org.apache.openejb.config.ServiceUtils.ANY;
-import static org.apache.openejb.config.ServiceUtils.NONE;
-import static org.apache.openejb.config.ServiceUtils.hasServiceProvider;
-import static org.apache.openejb.resource.jdbc.DataSourceFactory.trimNotSupportedDataSourceProperties;
-import static org.apache.openejb.util.Join.join;
-import static org.apache.openejb.util.PropertyPlaceHolderHelper.holds;
-import static org.apache.openejb.util.PropertyPlaceHolderHelper.value;
-
public class AutoConfig implements DynamicDeployer, JndiConstants {
public static final String ORIGIN_ANNOTATION = "Annotation";
@@ -336,7 +331,7 @@ public class AutoConfig implements Dynam
// Print a correct example of unitName in a ref
// DMB: Idea, the ability to set a default unit-name in openejb-jar.xml via a property
final String sampleUnitName = availableUnits.get(0);
- validation.fail(componentName, refType + ".noUnitName", refShortName, join(", ", availableUnits), sampleUnitName);
+ validation.fail(componentName, refType + ".noUnitName", refShortName, Join.join(", ", availableUnits), sampleUnitName);
} else {
final Collection<PersistenceUnit> vagueMatches = persistenceUnits.values(ref.getPersistenceUnitName());
if (vagueMatches.size() != 0) {
@@ -356,9 +351,9 @@ public class AutoConfig implements Dynam
Collections.sort(possibleUnits);
- validation.fail(componentName, refType + ".vagueMatches", refShortName, unitName, possibleUnits.size(), join("\n", possibleUnits));
+ validation.fail(componentName, refType + ".vagueMatches", refShortName, unitName, possibleUnits.size(), Join.join("\n", possibleUnits));
} else {
- validation.fail(componentName, refType + ".noMatches", refShortName, unitName, join(", ", availableUnits));
+ validation.fail(componentName, refType + ".noMatches", refShortName, unitName, Join.join(", ", availableUnits));
}
}
}
@@ -909,7 +904,7 @@ public class AutoConfig implements Dynam
final List<ResourceInfo> resourceInfos = new ArrayList<ResourceInfo>();
final Map<ResourceInfo, Resource> resourcesMap = new HashMap<ResourceInfo, Resource>(resources.size());
for (final Resource resource : resources) {
- final String originalId = value(resource.getId());
+ final String originalId = PropertyPlaceHolderHelper.value(resource.getId());
final String modulePrefix = module.getModuleId() + "/";
if ("/".equals(modulePrefix) || originalId.startsWith("global") || originalId.startsWith("/global")) {
@@ -918,8 +913,8 @@ public class AutoConfig implements Dynam
resource.getProperties().setProperty(ORIGINAL_ID, originalId);
resource.setId(modulePrefix + replaceJavaAndSlash(originalId));
}
- resource.setJndi(value(resource.getJndi()));
- resource.getProperties().putAll(holds(resource.getProperties()));
+ resource.setJndi(PropertyPlaceHolderHelper.value(resource.getJndi()));
+ resource.getProperties().putAll(PropertyPlaceHolderHelper.holds(resource.getProperties()));
final Collection<String> aliases = resource.getAliases();
if (!aliases.isEmpty()) {
@@ -935,7 +930,7 @@ public class AutoConfig implements Dynam
if (DataSource.class.getName().equals(resource.getType())
|| DataSource.class.getSimpleName().equals(resource.getType())) {
- trimNotSupportedDataSourceProperties(properties);
+ DataSourceFactory.trimNotSupportedDataSourceProperties(properties);
}
final boolean shouldGenerateJdbcUrl = DataSource.class.getName().equals(resource.getType())
@@ -1399,7 +1394,7 @@ public class AutoConfig implements Dynam
// for them. We give them what they asked for and move on.
//
if (jtaDataSourceId == null && nonJtaDataSourceId == null) {
- required.put("JtaManaged", NONE);
+ required.put("JtaManaged", ServiceUtils.NONE);
if (!resourceLocal) {
jtaDataSourceId = findResourceId(unit.getJtaDataSource(), "DataSource", required, null);
@@ -1435,7 +1430,7 @@ public class AutoConfig implements Dynam
// possibly fill in a good value.
//
- required.put("JtaManaged", ANY);
+ required.put("JtaManaged", ServiceUtils.ANY);
final String possibleJta = findResourceId(replaceJavaAndSlash(unit.getJtaDataSource()), "DataSource", required, null);
final String possibleNonJta = findResourceId(replaceJavaAndSlash(unit.getNonJtaDataSource()), "DataSource", required, null);
if (possibleJta != null && possibleJta.equals(possibleNonJta)) {
@@ -1540,7 +1535,7 @@ public class AutoConfig implements Dynam
if (jtaDataSourceId == null && nonJtaDataSourceId == null) {
// Neither jta nor non-jta managed data sources were found. try to find one with it unset
required.clear();
- required.put("JtaManaged", NONE);
+ required.put("JtaManaged", ServiceUtils.NONE);
jtaDataSourceId = findResourceId(id, "DataSource", required, null);
}
@@ -1599,7 +1594,7 @@ public class AutoConfig implements Dynam
required.clear();
required.put("JtaManaged", "false");
- for (final String key : asList("JdbcDriver", "JdbcUrl")) {
+ for (final String key : Arrays.asList("JdbcDriver", "JdbcUrl")) {
if (jtaProperties.containsKey(key)) {
required.put(key, jtaProperties.get(key));
}
@@ -1661,7 +1656,7 @@ public class AutoConfig implements Dynam
required.clear();
required.put("JtaManaged", "true");
- for (final String key : asList("JdbcDriver", "JdbcUrl")) {
+ for (final String key : Arrays.asList("JdbcDriver", "JdbcUrl")) {
if (nonJtaProperties.containsKey(key)) {
required.put(key, nonJtaProperties.get(key));
}
@@ -1848,19 +1843,19 @@ public class AutoConfig implements Dynam
return null;
}
- if (hasServiceProvider(resourceId)) {
+ if (ServiceUtils.hasServiceProvider(resourceId)) {
return resourceId;
}
if (resourceId.startsWith("java:")) { // can be an absolute path
final String jndi = resourceId.substring("java:".length());
- if (hasServiceProvider(jndi)) {
+ if (ServiceUtils.hasServiceProvider(jndi)) {
return jndi;
}
}
resourceId = toShortName(resourceId);
- if (hasServiceProvider(resourceId)) {
+ if (ServiceUtils.hasServiceProvider(resourceId)) {
return resourceId;
}
@@ -1923,10 +1918,10 @@ public class AutoConfig implements Dynam
logger.debug(message);
// if there is a provider with the specified name. use it
- if (hasServiceProvider(resourceId)) {
+ if (ServiceUtils.hasServiceProvider(resourceId)) {
final ResourceInfo resourceInfo = configFactory.configureService(resourceId, ResourceInfo.class);
return installResource(beanName, resourceInfo);
- } else if (hasServiceProvider(shortName)) {
+ } else if (ServiceUtils.hasServiceProvider(shortName)) {
final ResourceInfo resourceInfo = configFactory.configureService(shortName, ResourceInfo.class);
return installResource(beanName, resourceInfo);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java Wed Nov 27 15:21:54 2013
@@ -86,11 +86,6 @@ import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
-import static org.apache.openejb.config.NewLoaderLogic.applyBuiltinExcludes;
-import static org.apache.openejb.config.TldScanner.scanForTagLibs;
-import static org.apache.openejb.config.TldScanner.scanWarForTagLibs;
-import static org.apache.openejb.util.URLs.toFile;
-
/**
* @version $Revision$ $Date$
*/
@@ -210,7 +205,7 @@ public class DeploymentLoader implements
}
if (WebModule.class.equals(moduleClass)) {
- final File file = toFile(baseUrl);
+ final File file = URLs.toFile(baseUrl);
// Standalone Web Module
final WebModule webModule = createWebModule(file.getAbsolutePath(), baseUrl, getOpenEJBClassLoader(), getContextRoot(), getModuleName());
@@ -475,7 +470,7 @@ public class DeploymentLoader implements
for (final Map.Entry<String, URL> entry : resouceModules.entrySet()) {
try {
// unpack the resource adapter archive
- File rarFile = toFile(entry.getValue());
+ File rarFile = URLs.toFile(entry.getValue());
rarFile = unpack(rarFile);
entry.setValue(rarFile.toURI().toURL());
@@ -528,7 +523,7 @@ public class DeploymentLoader implements
// no-op
}
}
- final File ejbFile = toFile(ejbUrl);
+ final File ejbFile = URLs.toFile(ejbUrl);
final String absolutePath = ejbFile.getAbsolutePath();
final EjbModule ejbModule = createEjbModule(ejbUrl, absolutePath, appClassLoader);
@@ -551,7 +546,7 @@ public class DeploymentLoader implements
// no-op
}
}
- final File clientFile = toFile(clientUrl);
+ final File clientFile = URLs.toFile(clientUrl);
final String absolutePath = clientFile.getAbsolutePath();
final ClientModule clientModule = createClientModule(clientUrl, absolutePath, appClassLoader, null);
@@ -988,7 +983,7 @@ public class DeploymentLoader implements
UrlSet urls = new UrlSet(webUrls);
try {
- urls = applyBuiltinExcludes(urls, null, excludeFilter);
+ urls = NewLoaderLogic.applyBuiltinExcludes(urls, null, excludeFilter);
} catch (MalformedURLException e) {
return Arrays.asList(webUrls);
}
@@ -1217,7 +1212,7 @@ public class DeploymentLoader implements
}
try {
final File file = new File(warFile, location).getCanonicalFile().getAbsoluteFile();
- tldLocations.addAll(scanForTagLibs(file));
+ tldLocations.addAll(TldScanner.scanForTagLibs(file));
} catch (IOException e) {
logger.warning("JSP tag library location bad: " + location, e);
}
@@ -1226,7 +1221,7 @@ public class DeploymentLoader implements
}
// WEB-INF/**/*.tld except in WEB-INF/classes and WEB-INF/lib
- Set<URL> urls = scanWarForTagLibs(warFile);
+ Set<URL> urls = TldScanner.scanWarForTagLibs(warFile);
tldLocations.addAll(urls);
// Search all libs
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java Wed Nov 27 15:21:54 2013
@@ -79,12 +79,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import static org.apache.openejb.core.ExceptionType.APPLICATION_ROLLBACK;
-import static org.apache.openejb.core.ExceptionType.SYSTEM;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.handleApplicationException;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException;
-
@SuppressWarnings("unchecked")
public class ManagedContainer implements RpcContainer {
@@ -383,7 +377,7 @@ public class ManagedContainer implements
createContext.setCurrentAllowedStates(null);
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(createContext.getBeanContext().getTransactionType(callMethod, interfaceType), createContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(createContext.getBeanContext().getTransactionType(callMethod, interfaceType), createContext);
Instance instance = null;
try {
@@ -397,7 +391,7 @@ public class ManagedContainer implements
} catch (Throwable throwable) {
final ThreadContext callContext = ThreadContext.getThreadContext();
- handleSystemException(callContext.getTransactionPolicy(), throwable, callContext);
+ EjbTransactionUtil.handleSystemException(callContext.getTransactionPolicy(), throwable, callContext);
throw new IllegalStateException(throwable); // should never be reached
}
@@ -478,7 +472,7 @@ public class ManagedContainer implements
}
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
Object returnValue = null;
boolean retain = false;
@@ -582,7 +576,7 @@ public class ManagedContainer implements
checkAuthorization(callMethod, interfaceType);
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
Object returnValue = null;
Instance instance = null;
@@ -744,11 +738,11 @@ public class ManagedContainer implements
}
final ExceptionType type = callContext.getBeanContext().getExceptionType(e);
- if (type == SYSTEM) {
+ if (type == ExceptionType.SYSTEM) {
discardInstance(callContext);
- handleSystemException(txPolicy, e, callContext);
+ EjbTransactionUtil.handleSystemException(txPolicy, e, callContext);
} else {
- handleApplicationException(txPolicy, e, type == APPLICATION_ROLLBACK);
+ EjbTransactionUtil.handleApplicationException(txPolicy, e, type == ExceptionType.APPLICATION_ROLLBACK);
}
}
@@ -762,7 +756,7 @@ public class ManagedContainer implements
final BeanTransactionPolicy beanTxEnv = (BeanTransactionPolicy) txPolicy;
suspendedTransaction = beanTxEnv.suspendUserTransaction();
} catch (SystemException e) {
- handleSystemException(txPolicy, e, callContext);
+ EjbTransactionUtil.handleSystemException(txPolicy, e, callContext);
} finally {
instance.setBeanTransaction(suspendedTransaction);
}
@@ -1051,7 +1045,7 @@ public class ManagedContainer implements
interceptorStack.invoke();
} catch (Throwable callbackException) {
discardInstance(threadContext);
- handleSystemException(threadContext.getTransactionPolicy(), callbackException, threadContext);
+ EjbTransactionUtil.handleSystemException(threadContext.getTransactionPolicy(), callbackException, threadContext);
} finally {
ThreadContext.exit(oldContext);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java Wed Nov 27 15:21:54 2013
@@ -85,12 +85,6 @@ import java.util.concurrent.ConcurrentHa
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
-import static org.apache.openejb.core.ExceptionType.APPLICATION_ROLLBACK;
-import static org.apache.openejb.core.ExceptionType.SYSTEM;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.handleApplicationException;
-import static org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException;
-
@SuppressWarnings("unchecked")
public class StatefulContainer implements RpcContainer {
@@ -400,7 +394,7 @@ public class StatefulContainer implement
createContext.setCurrentAllowedStates(null);
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(createContext.getBeanContext().getTransactionType(callMethod, interfaceType), createContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(createContext.getBeanContext().getTransactionType(callMethod, interfaceType), createContext);
Instance instance = null;
try {
@@ -414,7 +408,7 @@ public class StatefulContainer implement
} catch (Throwable throwable) {
final ThreadContext callContext = ThreadContext.getThreadContext();
- handleSystemException(callContext.getTransactionPolicy(), throwable, callContext);
+ EjbTransactionUtil.handleSystemException(callContext.getTransactionPolicy(), throwable, callContext);
throw new IllegalStateException(throwable); // should never be reached
}
@@ -507,7 +501,7 @@ public class StatefulContainer implement
}
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
Object returnValue = null;
boolean retain = false;
@@ -633,7 +627,7 @@ public class StatefulContainer implement
checkAuthorization(callMethod, interfaceType);
// Start transaction
- final TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
+ final TransactionPolicy txPolicy = EjbTransactionUtil.createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod, interfaceType), callContext);
Object returnValue = null;
Instance instance = null;
@@ -834,11 +828,11 @@ public class StatefulContainer implement
}
final ExceptionType type = callContext.getBeanContext().getExceptionType(e);
- if (type == SYSTEM) {
+ if (type == ExceptionType.SYSTEM) {
discardInstance(callContext);
- handleSystemException(txPolicy, e, callContext);
+ EjbTransactionUtil.handleSystemException(txPolicy, e, callContext);
} else {
- handleApplicationException(txPolicy, e, type == APPLICATION_ROLLBACK);
+ EjbTransactionUtil.handleApplicationException(txPolicy, e, type == ExceptionType.APPLICATION_ROLLBACK);
}
}
@@ -851,7 +845,7 @@ public class StatefulContainer implement
final BeanTransactionPolicy beanTxEnv = (BeanTransactionPolicy) txPolicy;
suspendedTransaction = beanTxEnv.suspendUserTransaction();
} catch (SystemException e) {
- handleSystemException(txPolicy, e, callContext);
+ EjbTransactionUtil.handleSystemException(txPolicy, e, callContext);
} finally {
instance.setBeanTransaction(suspendedTransaction);
}
@@ -1155,7 +1149,7 @@ public class StatefulContainer implement
interceptorStack.invoke();
} catch (Throwable callbackException) {
discardInstance(threadContext);
- handleSystemException(threadContext.getTransactionPolicy(), callbackException, threadContext);
+ EjbTransactionUtil.handleSystemException(threadContext.getTransactionPolicy(), callbackException, threadContext);
} finally {
ThreadContext.exit(oldContext);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/SimpleWorkManager.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/SimpleWorkManager.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/SimpleWorkManager.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/SimpleWorkManager.java Wed Nov 27 15:21:54 2013
@@ -31,16 +31,6 @@ import javax.resource.spi.work.WorkRejec
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
-import static javax.resource.spi.work.WorkEvent.WORK_ACCEPTED;
-import static javax.resource.spi.work.WorkEvent.WORK_COMPLETED;
-import static javax.resource.spi.work.WorkEvent.WORK_REJECTED;
-import static javax.resource.spi.work.WorkEvent.WORK_STARTED;
-import static javax.resource.spi.work.WorkException.INTERNAL;
-import static javax.resource.spi.work.WorkException.START_TIMED_OUT;
-import static org.apache.openejb.core.transaction.SimpleWorkManager.WorkType.DO;
-import static org.apache.openejb.core.transaction.SimpleWorkManager.WorkType.SCHEDULE;
-import static org.apache.openejb.core.transaction.SimpleWorkManager.WorkType.START;
-
public class SimpleWorkManager implements WorkManager {
public enum WorkType {
DO, START, SCHEDULE
@@ -65,7 +55,7 @@ public class SimpleWorkManager implement
public void doWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener) throws WorkException {
if (work == null) throw new NullPointerException("work is null");
- executeWork(DO, work, startTimeout, executionContext, workListener);
+ executeWork(WorkType.DO, work, startTimeout, executionContext, workListener);
}
public long startWork(Work work) throws WorkException {
@@ -75,7 +65,7 @@ public class SimpleWorkManager implement
public long startWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener) throws WorkException {
if (work == null) throw new NullPointerException("work is null");
- return executeWork(START, work, startTimeout, executionContext, workListener);
+ return executeWork(WorkType.START, work, startTimeout, executionContext, workListener);
}
public void scheduleWork(Work work) throws WorkException {
@@ -85,7 +75,7 @@ public class SimpleWorkManager implement
public void scheduleWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener) throws WorkException {
if (work == null) throw new NullPointerException("work is null");
- executeWork(SCHEDULE, work, startTimeout, executionContext, workListener);
+ executeWork(WorkType.SCHEDULE, work, startTimeout, executionContext, workListener);
}
private long executeWork(WorkType workType, Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener) throws WorkException {
@@ -95,24 +85,24 @@ public class SimpleWorkManager implement
// reject work with an XID
if (executionContext != null && executionContext.getXid() != null) {
WorkRejectedException workRejectedException = new WorkRejectedException("SimpleWorkManager can not import an XID", WorkException.TX_RECREATE_FAILED);
- workListener.workRejected(new WorkEvent(this, WORK_REJECTED, work, workRejectedException));
+ workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workRejectedException));
throw workRejectedException;
}
// accecpt all other work
- workListener.workAccepted(new WorkEvent(this, WORK_ACCEPTED, work, null));
+ workListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
// execute work
Worker worker = new Worker(work, workListener, startTimeout);
executor.execute(worker);
- if (workType == DO) {
+ if (workType == WorkType.DO) {
// wait for completion
try {
worker.waitForCompletion();
} catch (InterruptedException e) {
WorkException workException = new WorkException("Work submission thread was interrupted", e);
- workException.setErrorCode(INTERNAL);
+ workException.setErrorCode(WorkException.INTERNAL);
throw workException;
}
@@ -121,13 +111,13 @@ public class SimpleWorkManager implement
if (workCompletedException != null) {
throw workCompletedException;
}
- } else if (workType == START) {
+ } else if (workType == WorkType.START) {
// wait for work to start
try {
worker.waitForStart();
} catch (InterruptedException e) {
WorkException workException = new WorkException("Work submission thread was interrupted", e);
- workException.setErrorCode(INTERNAL);
+ workException.setErrorCode(WorkException.INTERNAL);
throw workException;
}
@@ -166,13 +156,13 @@ public class SimpleWorkManager implement
// check if we have started within the specified limit
startDelay = System.currentTimeMillis() - created;
if (startDelay > startTimeout) {
- workException = new WorkRejectedException("Work not started within specified timeout " + startTimeout + "ms", START_TIMED_OUT);
- workListener.workRejected(new WorkEvent(this, WORK_REJECTED, work, workException, startTimeout));
+ workException = new WorkRejectedException("Work not started within specified timeout " + startTimeout + "ms", WorkException.START_TIMED_OUT);
+ workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workException, startTimeout));
return;
}
// notify listener that work has been started
- workListener.workStarted(new WorkEvent(SimpleWorkManager.this, WORK_STARTED, work, null));
+ workListener.workStarted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_STARTED, work, null));
// officially started
started.countDown();
@@ -185,7 +175,7 @@ public class SimpleWorkManager implement
workException = new WorkCompletedException(e);
} finally {
// notify listener that work completed (with an optional exception)
- workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WORK_COMPLETED, work, workException));
+ workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_COMPLETED, work, workException));
}
} finally {
// assure that threads waiting for start are released
@@ -222,7 +212,7 @@ public class SimpleWorkManager implement
public void workRejected(WorkEvent event) {
// Don't log doWork or startWork since exception is propagated to caller
- if (workType == DO || workType == START) {
+ if (workType == WorkType.DO || workType == WorkType.START) {
return;
}
WorkException exception = event.getException();
@@ -235,7 +225,7 @@ public class SimpleWorkManager implement
public void workCompleted(WorkEvent event) {
// Don't log doWork since exception is propagated to caller
- if (workType == DO) {
+ if (workType == WorkType.DO) {
return;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/doc/Revisit.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/doc/Revisit.java?rev=1546069&r1=1546068&r2=1546069&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/doc/Revisit.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/doc/Revisit.java Wed Nov 27 15:21:54 2013
@@ -17,24 +17,17 @@
*/
package org.apache.openejb.util.doc;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
/**
* @version $Rev$ $Date$
*/
@Retention(RetentionPolicy.SOURCE)
-@Target({CONSTRUCTOR, FIELD, METHOD, TYPE, ANNOTATION_TYPE, LOCAL_VARIABLE, PACKAGE, PARAMETER})
+@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE,
+ ElementType.LOCAL_VARIABLE, ElementType.PACKAGE, ElementType.PARAMETER})
public @interface Revisit {
String value();
}