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 [9/35] - in
/tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/
java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/
java/org/apache/openejb/assembler/
java/org/apache/openejb/assembler/classic/ j...
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/CompManagedBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/CompManagedBean.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/CompManagedBean.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/CompManagedBean.java Wed Feb 19 15:47:58 2014
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set;
public class CompManagedBean extends ManagedBean {
- public CompManagedBean(String name, Class<BeanContext.Comp> compClass) {
+ public CompManagedBean(final String name, final Class<BeanContext.Comp> compClass) {
super(name, compClass);
}
@@ -55,7 +55,7 @@ public class CompManagedBean extends Man
private static class NoExtendedKeyedCollection extends KeyedCollection<String, PersistenceContextRef> {
@Override
- public boolean add(PersistenceContextRef value) {
+ public boolean add(final PersistenceContextRef value) {
if (!PersistenceContextType.EXTENDED.equals(value.getPersistenceContextType())
&& !super.contains(value)) {
return super.add(value);
@@ -71,7 +71,7 @@ public class CompManagedBean extends Man
private static class NoExtendedMap implements Map<String, PersistenceContextRef> {
private Map<String, PersistenceContextRef> delegate;
- public NoExtendedMap(Map<String, PersistenceContextRef> map) {
+ public NoExtendedMap(final Map<String, PersistenceContextRef> map) {
delegate = map;
}
@@ -86,22 +86,22 @@ public class CompManagedBean extends Man
}
@Override
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
return delegate.containsKey(key);
}
@Override
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
return delegate.containsValue(value);
}
@Override
- public PersistenceContextRef get(Object key) {
+ public PersistenceContextRef get(final Object key) {
return delegate.get(key);
}
@Override
- public PersistenceContextRef put(String key, PersistenceContextRef value) {
+ public PersistenceContextRef put(final String key, final PersistenceContextRef value) {
if (!PersistenceContextType.EXTENDED.equals(value.getPersistenceContextType())
&& !delegate.containsValue(key)) {
return delegate.put(key, value);
@@ -110,13 +110,13 @@ public class CompManagedBean extends Man
}
@Override
- public PersistenceContextRef remove(Object key) {
+ public PersistenceContextRef remove(final Object key) {
return delegate.remove(key);
}
@Override
- public void putAll(Map<? extends String, ? extends PersistenceContextRef> m) {
- for (Map.Entry<? extends String, ? extends PersistenceContextRef> entry : m.entrySet()) {
+ public void putAll(final Map<? extends String, ? extends PersistenceContextRef> m) {
+ for (final Map.Entry<? extends String, ? extends PersistenceContextRef> entry : m.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigUtils.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigUtils.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigUtils.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigUtils.java Wed Feb 19 15:47:58 2014
@@ -42,7 +42,7 @@ public class ConfigUtils {
/**
* TODO: It should always be assumed that the path input param is a URL or URL-convertible
*/
- public static String searchForConfiguration(String rawPath) throws OpenEJBException {
+ public static String searchForConfiguration(final String rawPath) throws OpenEJBException {
File file;
if (rawPath != null) {
for (final String path : deducePaths(rawPath)) {
@@ -63,9 +63,9 @@ public class ConfigUtils {
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
- } catch (FileNotFoundException ignored) {
+ } catch (final FileNotFoundException ignored) {
// no-op
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
@@ -77,9 +77,9 @@ public class ConfigUtils {
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
- } catch (FileNotFoundException ignored) {
+ } catch (final FileNotFoundException ignored) {
// no-op
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
@@ -91,7 +91,7 @@ public class ConfigUtils {
new URL(path);
// it's so return it unchanged
return path;
- } catch (MalformedURLException ignored) {
+ } catch (final MalformedURLException ignored) {
// no-op
}
}
@@ -130,10 +130,10 @@ public class ConfigUtils {
* the openejb-x.x.x.jar
*/
- File confDir = SystemInstance.get().getConf(null);
+ final File confDir = SystemInstance.get().getConf(null);
if (confDir != null && confDir.exists()) {
- File config = new File(confDir, "openejb.xml");
+ final File config = new File(confDir, "openejb.xml");
logger.info("Cannot find the configuration file [conf/openejb.xml]. Creating one at "+config.getAbsolutePath());
file = createConfig(config);
} else {
@@ -141,7 +141,7 @@ public class ConfigUtils {
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
throw new OpenEJBException("Could not locate config file: ", e);
}
@@ -156,31 +156,31 @@ public class ConfigUtils {
return new String[] { path };
}
- public static File createConfig(File config) throws IOException {
- ResourceFinder finder = new ResourceFinder("");
- URL defaultConfig = finder.find("default.openejb.conf");
+ public static File createConfig(final File config) throws IOException {
+ final ResourceFinder finder = new ResourceFinder("");
+ final URL defaultConfig = finder.find("default.openejb.conf");
IO.copy(IO.read(defaultConfig), config);
return config;
}
- public static boolean addDeploymentEntryToConfig(String jarLocation, Openejb config) {
- File jar = new File(jarLocation);
+ public static boolean addDeploymentEntryToConfig(final String jarLocation, final Openejb config) {
+ final File jar = new File(jarLocation);
/* Check to see if the entry is already listed */
- for (Deployments d : config.getDeployments()) {
+ for (final Deployments d : config.getDeployments()) {
if (d.getFile() != null) {
try {
- File target = SystemInstance.get().getBase().getFile(d.getFile(), false);
+ final File target = SystemInstance.get().getBase().getFile(d.getFile(), false);
/*
* If the jar entry is already there, no need
* to add it to the config or go any futher.
*/
if (jar.equals(target)) return false;
- } catch (IOException e) {
+ } catch (final IOException e) {
/* No handling needed. If there is a problem
* resolving a config file path, it is better to
* just add this jars path explicitly.
@@ -188,8 +188,8 @@ public class ConfigUtils {
}
} else if (d.getDir() != null) {
try {
- File target = SystemInstance.get().getBase().getFile(d.getDir(), false);
- File jarDir = jar.getAbsoluteFile().getParentFile();
+ final File target = SystemInstance.get().getBase().getFile(d.getDir(), false);
+ final File jarDir = jar.getAbsoluteFile().getParentFile();
/*
* If a dir entry is already there, the jar
@@ -198,7 +198,7 @@ public class ConfigUtils {
* any futher.
*/
if (jarDir != null && jarDir.equals(target)) return false;
- } catch (IOException e) {
+ } catch (final IOException e) {
/* No handling needed. If there is a problem
* resolving a config file path, it is better to
* just add this jars path explicitly.
@@ -208,7 +208,7 @@ public class ConfigUtils {
}
/* Create a new Deployments entry */
- Deployments dep = JaxbOpenejb.createDeployments();
+ final Deployments dep = JaxbOpenejb.createDeployments();
dep.setFile(jarLocation);
config.getDeployments().add(dep);
return true;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java Wed Feb 19 15:47:58 2014
@@ -50,7 +50,7 @@ public class ConfigurableClasspathArchiv
this(loader, false, urls);
}
- public ConfigurableClasspathArchive(final ClassLoader loader, boolean forceDescriptor, final Iterable<URL> urls) {
+ public ConfigurableClasspathArchive(final ClassLoader loader, final boolean forceDescriptor, final Iterable<URL> urls) {
this(new FakeModule(loader), forceDescriptor, urls);
}
@@ -58,27 +58,27 @@ public class ConfigurableClasspathArchiv
this(new FakeModule(loader), Arrays.asList(url));
}
- public ConfigurableClasspathArchive(final Module module, boolean forceDescriptor, final Iterable<URL> urls) {
+ public ConfigurableClasspathArchive(final Module module, final boolean forceDescriptor, final Iterable<URL> urls) {
super(archive(module, urls, forceDescriptor));
}
- public static List<Archive> archive(final Module module, final Iterable<URL> urls, boolean forceDescriptor) {
+ public static List<Archive> archive(final Module module, final Iterable<URL> urls, final boolean forceDescriptor) {
final List<Archive> archives = new ArrayList<Archive>();
- for (URL location : urls) {
+ for (final URL location : urls) {
try {
archives.add(archive(module, location, forceDescriptor));
- } catch (Exception e) {
+ } catch (final Exception e) {
// ignored
}
}
return archives;
}
- public static Archive archive(final Module module, final URL location, boolean forceDescriptor) {
+ public static Archive archive(final Module module, final URL location, final boolean forceDescriptor) {
final ClassLoader loader = module.getClassLoader();
final String name = "META-INF/" + name();
try {
- URL scanXml = new URLClassLoader(new URL[] { location }, new EmptyResourcesClassLoader()).getResource(name);
+ final URL scanXml = new URLClassLoader(new URL[] { location }, new EmptyResourcesClassLoader()).getResource(name);
if (scanXml == null && !forceDescriptor) {
return ClasspathArchive.archive(loader, location);
} else if (scanXml == null) {
@@ -96,7 +96,7 @@ public class ConfigurableClasspathArchiv
return packageArchive;
}
return classesArchive;
- } catch (IOException e) {
+ } catch (final IOException e) {
if (forceDescriptor) {
return new ClassesArchive();
}
@@ -117,7 +117,7 @@ public class ConfigurableClasspathArchiv
private static Filter filters(final Set<String> packageNames) {
final List<Filter> filters = new ArrayList<Filter>();
- for (String packageName : packageNames) {
+ for (final String packageName : packageNames) {
filters.add(new PackageFilter(packageName));
}
return new FilterList(filters);
@@ -126,7 +126,7 @@ public class ConfigurableClasspathArchiv
public static Archive classesArchive(final Set<String> packages, final Set<String> classnames, final ClassLoader loader) {
Class<?>[] classes = new Class<?>[classnames.size()];
int i = 0;
- for (String clazz : classnames) {
+ for (final String clazz : classnames) {
// skip classes managed by package filtering
if (packages != null && clazzInPackage(packages, clazz)) {
continue;
@@ -134,7 +134,7 @@ public class ConfigurableClasspathArchiv
try {
classes[i++] = loader.loadClass(clazz);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// ignored
}
}
@@ -149,7 +149,7 @@ public class ConfigurableClasspathArchiv
}
private static boolean clazzInPackage(final Collection<String> packagename, final String clazz) {
- for (String str : packagename) {
+ for (final String str : packagename) {
if (clazz.startsWith(str)) {
return true;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java Wed Feb 19 15:47:58 2014
@@ -182,7 +182,7 @@ public class ConfigurationFactory implem
} else {
try {
SystemInstance.get().setComponent(DataSourceCreator.class, DataSourceFactory.creator(creator, false));
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("can't load " + creator + " will use the default creator", e);
SystemInstance.get().setComponent(DataSourceCreator.class, new DefaultDataSourceCreator());
}
@@ -351,7 +351,7 @@ public class ConfigurationFactory implem
final Class<?> ejbClass;
try {
ejbClass = module.getClassLoader().loadClass(bean.getEjbClass());
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
logger.warning("can't load " + bean.getEjbClass());
continue;
}
@@ -513,7 +513,7 @@ public class ConfigurationFactory implem
// 2) will let embedded containers (tomee-embedded mainly) not be noised by it in our singleton service
appInfo.properties.put("openejb.cdi.activated", "false");
sys.containerSystem.applications.add(appInfo);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to load the system applications.", e);
}
} else if (options.get(DEPLOYMENTS_CLASSPATH_PROPERTY, !embedded)) {
@@ -541,7 +541,7 @@ public class ConfigurationFactory implem
logger.warning("config.noModulesFoundToDeploy");
}
- } catch (OpenEJBException alreadyHandled) {
+ } catch (final OpenEJBException alreadyHandled) {
logger.debug("config.alreadyHandled");
}
}
@@ -592,13 +592,13 @@ public class ConfigurationFactory implem
fis = IO.read(additionalDeploymentFile);
final AdditionalDeployments additionalDeployments = JaxbOpenejb.unmarshal(AdditionalDeployments.class, fis);
additionalDeploymentsList = additionalDeployments.getDeployments();
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("can't read " + ADDITIONAL_DEPLOYMENTS, e);
} finally {
IO.close(fis);
}
}
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.info("No additional deployments found: " + e);
}
@@ -615,7 +615,7 @@ public class ConfigurationFactory implem
DeploymentsResolver.loadFrom(deployment, base, declaredAppsUrls);
if (deployment.isAutoDeploy())
autoDeploy.add(deployment);
- } catch (SecurityException se) {
+ } catch (final SecurityException se) {
logger.warning("Security check failed on deployment: " + deployment.getFile(), se);
}
}
@@ -686,9 +686,9 @@ public class ConfigurationFactory implem
final Object service = toConfigDeclaration(name, value);
openejb.add(service);
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
logger.error("Error declaring service '" + name + "'. Invalid Service URI '" + value + "'. java.net.URISyntaxException: " + e.getMessage());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error(e.getMessage());
}
}
@@ -711,14 +711,14 @@ public class ConfigurationFactory implem
final Object object;
try {
object = JaxbOpenejb.create(serviceType);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Invalid URI '" + uri + "'. " + e.getMessage());
}
final Map<String, String> map;
try {
map = URISupport.parseParamters(uri);
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new OpenEJBException("Unable to parse URI parameters '" + uri + "'. URISyntaxException: " + e.getMessage());
}
if (object instanceof AbstractService) {
@@ -754,7 +754,7 @@ public class ConfigurationFactory implem
}
return object;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Error declaring service '" + id + "'. Unable to create Service definition from URI '" + uri.toString() + "'", e);
}
}
@@ -770,10 +770,10 @@ public class ConfigurationFactory implem
appInfo.paths.add(appInfo.path);
appInfo.paths.add(jarFile.getAbsolutePath());
return appInfo;
- } catch (ValidationFailedException e) {
+ } catch (final ValidationFailedException e) {
logger.warning("configureApplication.loadFailed", jarFile.getAbsolutePath(), e.getMessage()); // DO not include the stacktrace in the message
throw e;
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
// DO NOT REMOVE THE EXCEPTION FROM THIS LOG MESSAGE
// removing this message causes NO messages to be printed when embedded
logger.warning("configureApplication.loadFailed", e, jarFile.getAbsolutePath(), e.getMessage());
@@ -796,10 +796,10 @@ public class ConfigurationFactory implem
final AppInfo appInfo;
try {
appInfo = configureApplication(collection);
- } catch (ValidationFailedException e) {
+ } catch (final ValidationFailedException e) {
logger.warning("configureApplication.loadFailed", collection.getModuleId(), e.getMessage()); // DO not include the stacktrace in the message
throw e;
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
// DO NOT REMOVE THE EXCEPTION FROM THIS LOG MESSAGE
// removing this message causes NO messages to be printed when embedded
logger.warning("configureApplication.loadFailed", e, collection.getModuleId(), e.getMessage());
@@ -853,10 +853,10 @@ public class ConfigurationFactory implem
}
}
- } catch (ValidationFailedException e) {
+ } catch (final ValidationFailedException e) {
logger.warning("configureApplication.loadFailed", jarFile.getAbsolutePath(), e.getMessage()); // DO not include the stacktrace in the message
throw e;
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
// DO NOT REMOVE THE EXCEPTION FROM THIS LOG MESSAGE
// removing this message causes NO messages to be printed when embedded
logger.warning("configureApplication.loadFailed", e, jarFile.getAbsolutePath(), e.getMessage());
@@ -912,11 +912,11 @@ public class ConfigurationFactory implem
notLoaded.addAll(finder.getResourcesNotLoaded());
}
}
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
logger.debug("can't look for server event listener for module " + ejb.getModuleUri(), iae);
- } catch (MalformedURLException mue) {
+ } catch (final MalformedURLException mue) {
logger.debug("can't look for server event listener for module " + ejb.getModuleUri(), mue);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("can't look for server event listener for module " + ejb.getJarLocation());
}
}
@@ -1008,7 +1008,7 @@ public class ConfigurationFactory implem
try {
service = JaxbOpenejb.create(defaultService.type);
service.setType(defaultService.id);
- } catch (Exception e) {
+ } catch (final Exception e) {
final String name = defaultService.type == null ? "null" : defaultService.type.getName();
throw new OpenEJBException("Cannot instantiate class " + name, e);
}
@@ -1120,7 +1120,7 @@ public class ConfigurationFactory implem
final T info;
try {
info = infoType.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException(messages.format("configureService.cannotInstantiateClass", infoType.getName()), e);
}
@@ -1141,10 +1141,10 @@ public class ConfigurationFactory implem
specialProcessing(info);
return info;
- } catch (NoSuchProviderException e) {
+ } catch (final NoSuchProviderException e) {
final String message = logger.fatal("configureService.failed", e, service.getId());
throw new OpenEJBException(message + ": " + e.getMessage());
- } catch (Throwable e) {
+ } catch (final Throwable e) {
final String message = logger.fatal("configureService.failed", e, service.getId());
throw new OpenEJBException(message, e);
}
@@ -1230,7 +1230,7 @@ public class ConfigurationFactory implem
if (service.getId() != null) {
try {
return ServiceUtils.getServiceProvider(service.getId());
- } catch (NoSuchProviderException e) {
+ } catch (final NoSuchProviderException e) {
logger.debug("resolveServiceProvider", e);
}
}
@@ -1277,7 +1277,7 @@ public class ConfigurationFactory implem
final org.apache.openejb.config.Service service;
try {
service = serviceClass.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException(messages.format("configureService.cannotInstantiateClass", serviceClass.getName()), e);
}
service.setId(serviceId);
@@ -1561,7 +1561,7 @@ public class ConfigurationFactory implem
}
public String getReference(final ResourceInfo info) {
- for (Object value : info.properties.values()) {
+ for (final Object value : info.properties.values()) {
if (String.class.isInstance(value)) {
final String string = String.class.cast(value).trim();
if (string.isEmpty()) {
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java Wed Feb 19 15:47:58 2014
@@ -41,15 +41,15 @@ public class ConnectorModule extends Mod
private IAnnotationFinder finder;
- public ConnectorModule(Connector connector) {
+ public ConnectorModule(final Connector connector) {
this(connector, Thread.currentThread().getContextClassLoader(), null, null);
}
- public ConnectorModule(Connector connector, ClassLoader classLoader, String jarLocation, String moduleId) {
+ public ConnectorModule(final Connector connector, final ClassLoader classLoader, final String jarLocation, final String moduleId) {
this.connector = connector;
setClassLoader(classLoader);
- File file = jarLocation == null ? null : new File(jarLocation);
+ final File file = jarLocation == null ? null : new File(jarLocation);
this.id = new ID(null, connector, moduleId, file, null, this);
this.validation = new ValidationContext(this);
}
@@ -78,7 +78,7 @@ public class ConnectorModule extends Mod
return connector;
}
- public void setConnector(Connector connector) {
+ public void setConnector(final Connector connector) {
this.connector = connector;
}
@@ -106,7 +106,7 @@ public class ConnectorModule extends Mod
return finder;
}
- public void setFinder(IAnnotationFinder finder) {
+ public void setFinder(final IAnnotationFinder finder) {
this.finder = finder;
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConvertDataSourceDefinitions.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConvertDataSourceDefinitions.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConvertDataSourceDefinitions.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/ConvertDataSourceDefinitions.java Wed Feb 19 15:47:58 2014
@@ -38,36 +38,36 @@ import java.util.Properties;
public class ConvertDataSourceDefinitions implements DynamicDeployer {
@Override
- public AppModule deploy(AppModule appModule) throws OpenEJBException {
+ public AppModule deploy(final AppModule appModule) throws OpenEJBException {
- List<JndiConsumer> jndiConsumers = collectConsumers(appModule);
+ final List<JndiConsumer> jndiConsumers = collectConsumers(appModule);
final KeyedCollection<String, DataSource> dataSources = new KeyedCollection<String, DataSource>();
- for (JndiConsumer consumer : jndiConsumers) {
+ for (final JndiConsumer consumer : jndiConsumers) {
if (consumer == null) continue;
dataSources.addAll(consumer.getDataSource());
}
- for (DataSource dataSource : dataSources) {
+ for (final DataSource dataSource : dataSources) {
appModule.getResources().add(toResource(dataSource));
}
return appModule;
}
- private Resource toResource(DataSource datasource) {
+ private Resource toResource(final DataSource datasource) {
String name = datasource.getName();
name = name.replaceFirst("java:comp/env/", "");
name = name.replaceFirst("java:", "");
- Resource def = new Resource(name, javax.sql.DataSource.class.getName());
+ final Resource def = new Resource(name, javax.sql.DataSource.class.getName());
def.setJndi(datasource.getName().replaceFirst("java:", ""));
def.setType("javax.sql.DataSource");
- Properties p = def.getProperties();
+ final Properties p = def.getProperties();
put(p, "JtaManaged", datasource.getTransactional());
put(p, "InitialSize", datasource.getInitialPoolSize());
put(p, "DefaultIsolationLevel", datasource.getIsolationLevel());
@@ -94,7 +94,7 @@ public class ConvertDataSourceDefinition
return def;
}
- private String rawDefinition(DataSource d) {
+ private String rawDefinition(final DataSource d) {
try {
final Properties p = new Properties();
@@ -118,13 +118,13 @@ public class ConvertDataSourceDefinition
final ByteArrayOutputStream out = new ByteArrayOutputStream();
p.store(out, "");
return new String(out.toByteArray());
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBRuntimeException(String.format("Cannot canonicalize the @DataSourceDefinition %s as a properties string", d.getName()));
}
}
- private void setProperties(DataSource d, Properties p) {
- for (Property property : d.getProperty()) {
+ private void setProperties(final DataSource d, final Properties p) {
+ for (final Property property : d.getProperty()) {
final String key = property.getName();
final String value = property.getValue();
@@ -133,30 +133,30 @@ public class ConvertDataSourceDefinition
}
}
- private static void put(Properties properties, String key, Object value) {
+ private static void put(final Properties properties, final String key, final Object value) {
if (key == null) return;
if (value == null) return;
properties.put(key, PropertyPlaceHolderHelper.value(value + ""));
}
- private List<JndiConsumer> collectConsumers(AppModule appModule) {
+ private List<JndiConsumer> collectConsumers(final AppModule appModule) {
final List<JndiConsumer> jndiConsumers = new ArrayList<JndiConsumer>();
- for (ClientModule module : appModule.getClientModules()) {
+ for (final ClientModule module : appModule.getClientModules()) {
final JndiConsumer consumer = module.getApplicationClient();
if (consumer == null) continue;
jndiConsumers.add(consumer);
}
- for (WebModule webModule : appModule.getWebModules()) {
+ for (final WebModule webModule : appModule.getWebModules()) {
final JndiConsumer consumer = webModule.getWebApp();
if (consumer == null) continue;
jndiConsumers.add(consumer);
}
- for (EjbModule ejbModule : appModule.getEjbModules()) {
+ for (final EjbModule ejbModule : appModule.getEjbModules()) {
Collections.addAll(jndiConsumers, ejbModule.getEjbJar().getEnterpriseBeans());
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DebuggableVmHackery.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DebuggableVmHackery.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DebuggableVmHackery.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DebuggableVmHackery.java Wed Feb 19 15:47:58 2014
@@ -45,21 +45,21 @@ import java.util.Map;
*/
class DebuggableVmHackery implements DynamicDeployer {
- public AppModule deploy(AppModule appModule) throws OpenEJBException {
+ public AppModule deploy(final AppModule appModule) throws OpenEJBException {
- for (EjbModule ejbModule : appModule.getEjbModules()) {
- EjbJar ejbJar = ejbModule.getEjbJar();
- OpenejbJar openejbJar = ejbModule.getOpenejbJar();
- Map<String, EjbDeployment> deployments = openejbJar.getDeploymentsByEjbName();
+ for (final EjbModule ejbModule : appModule.getEjbModules()) {
+ final EjbJar ejbJar = ejbModule.getEjbJar();
+ final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
+ final Map<String, EjbDeployment> deployments = openejbJar.getDeploymentsByEjbName();
ejbJar.setRelationships(null);
- List<String> removed = new ArrayList<String>();
+ final List<String> removed = new ArrayList<String>();
- for (EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
- String ejbName = bean.getEjbName();
- EjbDeployment ejbDeployment = deployments.get(ejbName);
+ final String ejbName = bean.getEjbName();
+ final EjbDeployment ejbDeployment = deployments.get(ejbName);
pruneRefs(bean, ejbDeployment);
@@ -76,10 +76,10 @@ class DebuggableVmHackery implements Dyn
openejbJar.removeEjbDeployment(ejbDeployment);
removed.add(ejbName);
- AssemblyDescriptor assemblyDescriptor = ejbJar.getAssemblyDescriptor();
+ final AssemblyDescriptor assemblyDescriptor = ejbJar.getAssemblyDescriptor();
if (assemblyDescriptor != null){
- for (MethodPermission permission : copy(assemblyDescriptor.getMethodPermission())) {
- for (Method method : copy(permission.getMethod())) {
+ for (final MethodPermission permission : copy(assemblyDescriptor.getMethodPermission())) {
+ for (final Method method : copy(permission.getMethod())) {
if (method.getEjbName().equals(ejbName)) {
permission.getMethod().remove(method);
}
@@ -89,8 +89,8 @@ class DebuggableVmHackery implements Dyn
}
}
- for (ContainerTransaction transaction : copy(assemblyDescriptor.getContainerTransaction())) {
- for (Method method : copy(transaction.getMethod())) {
+ for (final ContainerTransaction transaction : copy(assemblyDescriptor.getContainerTransaction())) {
+ for (final Method method : copy(transaction.getMethod())) {
if (method.getEjbName().equals(ejbName)) {
transaction.getMethod().remove(method);
}
@@ -100,7 +100,7 @@ class DebuggableVmHackery implements Dyn
}
}
- for (InterceptorBinding binding : copy(assemblyDescriptor.getInterceptorBinding())) {
+ for (final InterceptorBinding binding : copy(assemblyDescriptor.getInterceptorBinding())) {
if (binding.getEjbName().equals(ejbName)) {
assemblyDescriptor.getInterceptorBinding().remove(binding);
}
@@ -109,12 +109,12 @@ class DebuggableVmHackery implements Dyn
}
// Drop any ejb ref to with an ejb-link to a removed ejb
- for (EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
bean.getEjbLocalRefMap().keySet().removeAll(removed);
bean.getEjbRefMap().keySet().removeAll(removed);
}
- for (Interceptor interceptor : ejbJar.getInterceptors()) {
+ for (final Interceptor interceptor : ejbJar.getInterceptors()) {
pruneRefs(interceptor, new EjbDeployment());
}
@@ -122,23 +122,23 @@ class DebuggableVmHackery implements Dyn
return appModule;
}
- private void pruneRefs(JndiConsumer bean, EjbDeployment ejbDeployment) {
- for (ResourceRef ref : copy(bean.getResourceRef())) {
+ private void pruneRefs(final JndiConsumer bean, final EjbDeployment ejbDeployment) {
+ for (final ResourceRef ref : copy(bean.getResourceRef())) {
if (ref.getResType().startsWith("javax.jms.")){
- ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
+ final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
ejbDeployment.getResourceLink().remove(resourceLink);
bean.getResourceRef().remove(ref);
}
}
- for (ResourceEnvRef ref : bean.getResourceEnvRef()) {
- ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
+ for (final ResourceEnvRef ref : bean.getResourceEnvRef()) {
+ final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
ejbDeployment.getResourceLink().remove(resourceLink);
}
bean.getResourceEnvRef().clear();
- for (MessageDestinationRef ref : bean.getMessageDestinationRef()) {
- ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
+ for (final MessageDestinationRef ref : bean.getMessageDestinationRef()) {
+ final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
ejbDeployment.getResourceLink().remove(resourceLink);
}
bean.getMessageDestinationRef().clear();
@@ -147,7 +147,7 @@ class DebuggableVmHackery implements Dyn
bean.getPersistenceUnitRef().clear();
}
- public <T> List<T> copy(Collection<T> list) {
+ public <T> List<T> copy(final Collection<T> list) {
return new ArrayList<T>(list);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/Deploy.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/Deploy.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/Deploy.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/Deploy.java Wed Feb 19 15:47:58 2014
@@ -64,12 +64,12 @@ public class Deploy {
private static final String defaultServerUrl = "ejbd://localhost:4201";
- public static void main(String... args) throws SystemExitException {
+ public static void main(final String... args) throws SystemExitException {
- CommandLineParser parser = new PosixParser();
+ final CommandLineParser parser = new PosixParser();
// create the Options
- Options options = new Options();
+ final Options options = new Options();
options.addOption(option("v", "version", "cmd.deploy.opt.version"));
options.addOption(option("h", "help", "cmd.deploy.opt.help"));
options.addOption(option("o", "offline", "cmd.deploy.opt.offline"));
@@ -79,11 +79,11 @@ public class Deploy {
options.addOption(option("u", "undeploy", "cmd.deploy.opt.undeploy"));
options.addOption(option(null, "dir", "cmd.deploy.opt.dir"));
- CommandLine line;
+ final CommandLine line;
try {
// parse the command line arguments
line = parser.parse(options, args);
- } catch (ParseException exp) {
+ } catch (final ParseException exp) {
help(options);
throw new SystemExitException(-1);
}
@@ -103,26 +103,26 @@ public class Deploy {
}
// make sure that the modules given on the command line are accessible
- List<?> modules = line.getArgList();
- for (Object module : modules) {
- String path = (String) module;
- File file = new File(path);
+ final List<?> modules = line.getArgList();
+ for (final Object module : modules) {
+ final String path = (String) module;
+ final File file = new File(path);
try {
checkSource(file);
- } catch (DeploymentTerminatedException e) {
+ } catch (final DeploymentTerminatedException e) {
System.out.println(e.getMessage());
// TODO: What is it for?
throw new SystemExitException(-100);
}
}
- boolean offline = line.hasOption("offline");
+ final boolean offline = line.hasOption("offline");
- File apps;
+ final File apps;
try {
- String dir = line.getOptionValue("dir", "apps");
+ final String dir = line.getOptionValue("dir", "apps");
apps = SystemInstance.get().getBase().getDirectory(dir);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SystemExitException(-1);
}
@@ -132,40 +132,40 @@ public class Deploy {
Deployer deployer = null;
if (!offline) {
- Properties p = new Properties();
+ final Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
- String serverUrl = line.getOptionValue("server-url", defaultServerUrl);
+ final String serverUrl = line.getOptionValue("server-url", defaultServerUrl);
p.put(Context.PROVIDER_URL, serverUrl);
try {
- InitialContext ctx = new InitialContext(p);
+ final InitialContext ctx = new InitialContext(p);
deployer = (Deployer) ctx.lookup("openejb/DeployerBusinessRemote");
- } catch (ServiceUnavailableException e) {
+ } catch (final ServiceUnavailableException e) {
System.out.println(e.getCause().getMessage());
System.out.println(messages.format("cmd.deploy.serverOffline"));
throw new SystemExitException(-1);
- } catch (NamingException e) {
+ } catch (final NamingException e) {
System.out.println("openejb/DeployerBusinessRemote does not exist in server '" + serverUrl
+ "', check the server logs to ensure it exists and has not been removed.");
throw new SystemExitException(-2);
}
}
- boolean undeploy = line.hasOption("undeploy");
+ final boolean undeploy = line.hasOption("undeploy");
// We increment the exit code once for every failed deploy
int exitCode = 0;
- for (Object obj : line.getArgList()) {
- String path = (String) obj;
+ for (final Object obj : line.getArgList()) {
+ final String path = (String) obj;
- File file = new File(path);
+ final File file = new File(path);
File destFile = new File(apps, file.getName());
try {
if (shouldUnpack(file)) {
- File unpacked = unpackedLocation(file, apps);
+ final File unpacked = unpackedLocation(file, apps);
if (undeploy) {
undeploy(offline, unpacked, path, deployer);
}
@@ -183,13 +183,13 @@ public class Deploy {
continue;
}
- String location;
+ final String location;
try {
location = destFile.getCanonicalPath();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException(messages.format("cmd.deploy.fileNotFound", path));
}
- AppInfo appInfo = deployer.deploy(location);
+ final AppInfo appInfo = deployer.deploy(location);
System.out.println(messages.format("cmd.deploy.successful", path, appInfo.path));
@@ -199,26 +199,26 @@ public class Deploy {
print(appInfo);
- } catch (UndeployException e) {
+ } catch (final UndeployException e) {
System.out.println(messages.format("cmd.undeploy.failed", path));
e.printStackTrace(System.out);
exitCode++;
- } catch (DeploymentTerminatedException e) {
+ } catch (final DeploymentTerminatedException e) {
System.out.println(e.getMessage());
exitCode++;
- } catch (ValidationFailedException e) {
+ } catch (final ValidationFailedException e) {
System.out.println(messages.format("cmd.deploy.validationFailed", path));
int level = 2;
if (line.hasOption("debug")){
level = 3;
}
- AppValidator appValidator = new AppValidator(level, false, true, false);
+ final AppValidator appValidator = new AppValidator(level, false, true, false);
appValidator.printResults(e);
exitCode++;
if (!delete(destFile)){
System.out.println(messages.format("cmd.deploy.cantDelete.deploy", destFile.getAbsolutePath()));
}
- } catch (Throwable e) {
+ } catch (final Throwable e) {
System.out.println(messages.format("cmd.deploy.failed", path));
e.printStackTrace(System.out);
exitCode++;
@@ -233,7 +233,7 @@ public class Deploy {
}
}
- private static void undeploy(boolean offline, File dest, String path, Deployer deployer) throws UndeployException, DeploymentTerminatedException {
+ private static void undeploy(final boolean offline, final File dest, final String path, final Deployer deployer) throws UndeployException, DeploymentTerminatedException {
if (offline) {
if (dest.exists()){
if (!delete(dest)){
@@ -243,69 +243,69 @@ public class Deploy {
} else {
try {
Undeploy.undeploy(path, dest, deployer);
- } catch (NoSuchApplicationException nothingToUndeploy) {
+ } catch (final NoSuchApplicationException nothingToUndeploy) {
// no-op
}
}
}
- private static void print(AppInfo appInfo) {
+ private static void print(final AppInfo appInfo) {
System.out.println("App(id=" + appInfo.path + ")");
- for (EjbJarInfo info : appInfo.ejbJars) {
+ for (final EjbJarInfo info : appInfo.ejbJars) {
System.out.println(" EjbJar(id=" + info.moduleName + ", path=" + info.path + ")");
- for (EnterpriseBeanInfo beanInfo : info.enterpriseBeans) {
+ for (final EnterpriseBeanInfo beanInfo : info.enterpriseBeans) {
System.out.println(" Ejb(ejb-name=" + beanInfo.ejbName + ", id=" + beanInfo.ejbDeploymentId + ")");
- for (String name : beanInfo.jndiNames) {
+ for (final String name : beanInfo.jndiNames) {
System.out.println(" Jndi(name=" + name + ")");
}
System.out.println("");
}
- for (InterceptorInfo interceptorInfo : info.interceptors) {
+ for (final InterceptorInfo interceptorInfo : info.interceptors) {
System.out.println(" Interceptor(class=" + interceptorInfo.clazz + ")");
}
System.out.println("");
}
- for (ClientInfo clientInfo : appInfo.clients) {
+ for (final ClientInfo clientInfo : appInfo.clients) {
System.out.println(" Client(main-class=" + clientInfo.mainClass + ", id=" + clientInfo.moduleId + ", path=" + clientInfo.path + ")");
System.out.println("");
}
- for (ConnectorInfo connectorInfo : appInfo.connectors) {
+ for (final ConnectorInfo connectorInfo : appInfo.connectors) {
System.out.println(" Connector(id=" + connectorInfo.moduleId + ", path=" + connectorInfo.path + ")");
System.out.println("");
}
- for (WebAppInfo webAppInfo : appInfo.webApps) {
+ for (final WebAppInfo webAppInfo : appInfo.webApps) {
System.out.println(" WebApp(context-root=" + webAppInfo.contextRoot + ", id=" + webAppInfo.moduleId + ", path=" + webAppInfo.path + ")");
System.out.println("");
}
- for (PersistenceUnitInfo persistenceUnitInfo : appInfo.persistenceUnits) {
+ for (final PersistenceUnitInfo persistenceUnitInfo : appInfo.persistenceUnits) {
System.out.println(" PersistenceUnit(name=" + persistenceUnitInfo.name + ", provider=" + persistenceUnitInfo.provider+ ")");
System.out.println("");
}
}
- private static void checkSource(File file) throws DeploymentTerminatedException {
+ private static void checkSource(final File file) throws DeploymentTerminatedException {
if (!file.exists()) {
throw new DeploymentTerminatedException(messages.format("cmd.deploy.fileNotFound", file.getAbsolutePath()));
}
}
- private static void checkDest(File destFile, File file) throws DeploymentTerminatedException {
+ private static void checkDest(final File destFile, final File file) throws DeploymentTerminatedException {
if (destFile.exists()){
throw new DeploymentTerminatedException(messages.format("cmd.deploy.destExists", file.getAbsolutePath(), destFile.getAbsolutePath()));
}
}
- private static void copyFile(File file, File destFile) throws DeploymentTerminatedException {
+ private static void copyFile(final File file, final File destFile) throws DeploymentTerminatedException {
try {
IO.copy(file, destFile);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new DeploymentTerminatedException(messages.format("cmd.deploy.cantCopy", file.getAbsolutePath(), destFile.getAbsolutePath()));
}
}
- private static boolean shouldUnpack(File file) {
- String name = file.getName();
+ private static boolean shouldUnpack(final File file) {
+ final String name = file.getName();
if (name.endsWith(".ear") || name.endsWith(".rar") || name.endsWith(".rar")) {
return true;
}
@@ -323,13 +323,13 @@ public class Deploy {
if (jarFile.getEntry("WEB-INF/web.xml") != null) {
return true;
}
- } catch (IOException e) {
+ } catch (final IOException e) {
// no-op
} finally {
if (jarFile != null) {
try {
jarFile.close();
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
}
@@ -338,18 +338,18 @@ public class Deploy {
return false;
}
- private static File unpack(File jarFile, File destinationDir) throws OpenEJBException, DeploymentTerminatedException {
+ private static File unpack(final File jarFile, final File destinationDir) throws OpenEJBException, DeploymentTerminatedException {
try {
checkDest(destinationDir, jarFile);
JarExtractor.extract(jarFile, destinationDir);
return destinationDir;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Unable to extract jar. " + e.getMessage(), e);
}
}
- private static File unpackedLocation(File jarFile, File destDir) {
+ private static File unpackedLocation(final File jarFile, final File destDir) {
if (jarFile.isDirectory()) {
return jarFile;
}
@@ -361,33 +361,33 @@ public class Deploy {
name += ".unpacked";
}
- File destinationDir = new File(destDir, name);
+ final File destinationDir = new File(destDir, name);
return destinationDir;
}
- private static void help(Options options) {
- HelpFormatter formatter = new HelpFormatter();
+ private static void help(final Options options) {
+ final HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("deploy [options] <file> [<file>...]", "\n"+i18n("cmd.deploy.description"), options, "\n");
}
- private static Option option(String shortOpt, String longOpt, String description) {
+ private static Option option(final String shortOpt, final String longOpt, final String description) {
return OptionBuilder.withLongOpt(longOpt).withDescription(i18n(description)).create(shortOpt);
}
- private static Option option(String shortOpt, String longOpt, String argName, String description) {
+ private static Option option(final String shortOpt, final String longOpt, final String argName, final String description) {
return OptionBuilder.withLongOpt(longOpt).withArgName(argName).hasArg().withDescription(i18n(description)).create(shortOpt);
}
- private static String i18n(String key) {
+ private static String i18n(final String key) {
return messages.format(key);
}
public static class DeploymentTerminatedException extends Exception {
- public DeploymentTerminatedException(String message) {
+ public DeploymentTerminatedException(final String message) {
super(message);
}
- public DeploymentTerminatedException(String message, Throwable cause) {
+ public DeploymentTerminatedException(final String message, final Throwable cause) {
super(message, cause);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentException.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentException.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentException.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentException.java Wed Feb 19 15:47:58 2014
@@ -23,15 +23,15 @@ public class DeploymentException extends
public DeploymentException() {
}
- public DeploymentException(String message) {
+ public DeploymentException(final String message) {
super(message);
}
- public DeploymentException(String message, Throwable cause) {
+ public DeploymentException(final String message, final Throwable cause) {
super(message, cause);
}
- public DeploymentException(Throwable cause) {
+ public DeploymentException(final Throwable cause) {
super(cause);
}
}
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=1569795&r1=1569794&r2=1569795&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 Feb 19 15:47:58 2014
@@ -112,7 +112,7 @@ public class DeploymentLoader implements
final String jarPath;
try {
jarPath = jarFile.getCanonicalPath();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Invalid application file path " + jarFile, e);
}
@@ -130,7 +130,7 @@ public class DeploymentLoader implements
try {
doNotUseClassLoader = ClassLoaderUtil.createClassLoader(jarPath, new URL[]{baseUrl}, getOpenEJBClassLoader());
moduleClass = discoverModuleType(baseUrl, ClassLoaderUtil.createTempClassLoader(doNotUseClassLoader), true);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new UnknownModuleTypeException("Unable to determine module type for jar: " + baseUrl.toExternalForm(), e);
}
@@ -228,7 +228,7 @@ public class DeploymentLoader implements
}
otherDD.put("persistence.xml", persistenceXmls);
}
- } catch (IOException e) {
+ } catch (final IOException e) {
// ignored
}
@@ -287,7 +287,7 @@ public class DeploymentLoader implements
final ConnectorModule connectorModule = createConnectorModule(jarLocation, jarLocation, webModule.getClassLoader(), null);
appModule.getConnectorModules().add(connectorModule);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("error processing url " + url.toExternalForm(), e);
}
}
@@ -314,7 +314,7 @@ public class DeploymentLoader implements
final ConnectorModule connectorModule = createConnectorModule(jarLocation, jarLocation, webModule.getClassLoader(), null);
appModule.getConnectorModules().add(connectorModule);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("error processing url " + url.toExternalForm(), e);
}
}
@@ -353,7 +353,7 @@ public class DeploymentLoader implements
File appDir = unpack(jarFile);
try {
appDir = appDir.getCanonicalFile();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Invalid application directory " + appDir.getAbsolutePath());
}
@@ -401,7 +401,7 @@ public class DeploymentLoader implements
webModules.put(module.getWeb().getWebUri(), url);
webContextRoots.put(module.getWeb().getWebUri(), module.getWeb().getContextRoot());
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Invalid path to module " + e.getMessage(), e);
}
}
@@ -445,7 +445,7 @@ public class DeploymentLoader implements
try {
final Map<String, URL> libs = finder.getResourcesMap(application.getLibraryDirectory());
extraLibs.addAll(libs.values());
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("Cannot load libs from '" + application.getLibraryDirectory() + "' : " + e.getMessage(), e);
}
@@ -453,7 +453,7 @@ public class DeploymentLoader implements
try {
final Map<String, URL> libs = finder.getResourcesMap("APP-INF/lib/");
extraLibs.addAll(libs.values());
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("Cannot load libs from 'APP-INF/lib/' : " + e.getMessage(), e);
}
@@ -461,7 +461,7 @@ public class DeploymentLoader implements
try {
final Map<String, URL> libs = finder.getResourcesMap("META-INF/lib/");
extraLibs.addAll(libs.values());
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("Cannot load libs from 'META-INF/lib/' : " + e.getMessage(), e);
}
@@ -475,11 +475,11 @@ public class DeploymentLoader implements
entry.setValue(rarFile.toURI().toURL());
scanDir(appDir, rarLibs, "");
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
throw new OpenEJBException("Malformed URL to app. " + e.getMessage(), e);
}
}
- for (Iterator<Map.Entry<String, URL>> iterator = rarLibs.entrySet().iterator(); iterator.hasNext(); ) {
+ for (final Iterator<Map.Entry<String, URL>> iterator = rarLibs.entrySet().iterator(); iterator.hasNext(); ) {
// remove all non jars from the rarLibs
final Map.Entry<String, URL> fileEntry = iterator.next();
if (!fileEntry.getKey().endsWith(".jar")) continue;
@@ -519,7 +519,7 @@ public class DeploymentLoader implements
try {
ejbUrl = ClassLoaderUtil.getUrlCachedName(appModule.getJarLocation(), ejbUrl).toURI().toURL();
- } catch (MalformedURLException ignore) {
+ } catch (final MalformedURLException ignore) {
// no-op
}
}
@@ -528,7 +528,7 @@ public class DeploymentLoader implements
final EjbModule ejbModule = createEjbModule(ejbUrl, absolutePath, appClassLoader);
appModule.getEjbModules().add(ejbModule);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to load EJBs from EAR: " + appId + ", module: " + moduleName + ". Exception: " + e.getMessage(), e);
}
}
@@ -542,7 +542,7 @@ public class DeploymentLoader implements
try {
clientUrl = ClassLoaderUtil.getUrlCachedName(appModule.getJarLocation(), clientUrl).toURI().toURL();
- } catch (MalformedURLException ignore) {
+ } catch (final MalformedURLException ignore) {
// no-op
}
}
@@ -552,7 +552,7 @@ public class DeploymentLoader implements
final ClientModule clientModule = createClientModule(clientUrl, absolutePath, appClassLoader, null);
appModule.getClientModules().add(clientModule);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("Unable to load App Client from EAR: " + appId + ", module: " + moduleName + ". Exception: " + e.getMessage(), e);
}
}
@@ -566,14 +566,14 @@ public class DeploymentLoader implements
try {
rarUrl = ClassLoaderUtil.getUrlCachedName(appModule.getJarLocation(), rarUrl).toURI().toURL();
- } catch (MalformedURLException ignore) {
+ } catch (final MalformedURLException ignore) {
// no-op
}
}
final ConnectorModule connectorModule = createConnectorModule(appId, URLs.toFilePath(rarUrl), appClassLoader, moduleName);
appModule.getConnectorModules().add(connectorModule);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to load RAR: " + appId + ", module: " + moduleName + ". Exception: " + e.getMessage(), e);
}
}
@@ -583,7 +583,7 @@ public class DeploymentLoader implements
try {
final URL warUrl = webModules.get(moduleName);
addWebModule(appModule, warUrl, appClassLoader, webContextRoots.get(moduleName), null);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to load WAR: " + appId + ", module: " + moduleName + ". Exception: " + e.getMessage(), e);
}
}
@@ -639,32 +639,32 @@ public class DeploymentLoader implements
return appModule;
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to load EAR: " + jarPath, e);
throw e;
}
}
- private void createApplicationFromFiles(String appId, ClassLoader tmpClassLoader, Map<String, URL> ejbModules, Map<String, URL> clientModules, Map<String, URL> resouceModules, Map<String, URL> webModules, HashMap<String, URL> files) throws OpenEJBException {
+ private void createApplicationFromFiles(final String appId, final ClassLoader tmpClassLoader, final Map<String, URL> ejbModules, final Map<String, URL> clientModules, final Map<String, URL> resouceModules, final Map<String, URL> webModules, final HashMap<String, URL> files) throws OpenEJBException {
for (final Map.Entry<String, URL> entry : files.entrySet()) {
// if (entry.getKey().startsWith("lib/")) continue;// will not be scanned since we don't get folder anymore
if (!entry.getKey().matches(".*\\.(jar|war|rar|ear)")) continue;
try {
detectAndAddModuleToApplication(appId, tmpClassLoader, ejbModules, clientModules, resouceModules, webModules, entry);
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// Ignore it as per the javaee spec EE.8.4.2 section 1.d.iii
logger.info("Ignoring unknown module type: " + entry.getKey());
- } catch (UnknownModuleTypeException e) {
+ } catch (final UnknownModuleTypeException e) {
// Ignore it as per the javaee spec EE.8.4.2 section 1.d.iii
logger.info("Ignoring unknown module type: " + entry.getKey());
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Unable to determine the module type of " + entry.getKey() + ": Exception: " + e.getMessage(), e);
}
}
}
- private void detectAndAddModuleToApplication(String appId, ClassLoader tmpClassLoader, Map<String, URL> ejbModules, Map<String, URL> clientModules, Map<String, URL> resouceModules, Map<String, URL> webModules, Map.Entry<String, URL> entry) throws IOException, UnknownModuleTypeException {
+ private void detectAndAddModuleToApplication(final String appId, final ClassLoader tmpClassLoader, final Map<String, URL> ejbModules, final Map<String, URL> clientModules, final Map<String, URL> resouceModules, final Map<String, URL> webModules, final Map.Entry<String, URL> entry) throws IOException, UnknownModuleTypeException {
final ClassLoader moduleClassLoader = ClassLoaderUtil.createTempClassLoader(appId, new URL[]{entry.getValue()}, tmpClassLoader);
final Class<? extends DeploymentModule> moduleType = discoverModuleType(entry.getValue(), moduleClassLoader, true);
@@ -690,7 +690,7 @@ public class DeploymentLoader implements
URL manifestUrl = null;
try {
manifestUrl = clientFinder.find("META-INF/MANIFEST.MF");
- } catch (IOException e) {
+ } catch (final IOException e) {
//
}
@@ -700,7 +700,7 @@ public class DeploymentLoader implements
final InputStream is = IO.read(manifestUrl);
final Manifest manifest = new Manifest(is);
mainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Unable to determine Main-Class defined in META-INF/MANIFEST.MF file", e);
}
}
@@ -735,7 +735,7 @@ public class DeploymentLoader implements
} else {
try {
descriptors = getDescriptors(classLoader, null);
- } catch (IOException e) {
+ } catch (final IOException e) {
descriptors = new HashMap<String, URL>();
}
}
@@ -745,7 +745,7 @@ public class DeploymentLoader implements
if (ejbJarXmlUrl != null) {
try {
ejbJar = ReadDescriptors.readEjbJar(ejbJarXmlUrl.openStream());
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException(e);
}
}
@@ -832,7 +832,7 @@ public class DeploymentLoader implements
} else if (webEjbModule.getFinder() == null) {
webEjbModule.setFinder(webModule.getFinder());
}
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Unable to create annotation scanner for web module " + webModule.getModuleId(), e);
}
@@ -884,7 +884,7 @@ public class DeploymentLoader implements
final Map<String, URL> descriptors;
try {
descriptors = getWebDescriptors(warFile);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Unable to collect descriptors in web module: " + contextRoot, e);
}
@@ -911,7 +911,7 @@ public class DeploymentLoader implements
if (f.getName().endsWith(".jar")) {
try {
addedUrls.add(f.toURI().toURL());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("War path bad: " + f.getAbsolutePath(), e);
}
}
@@ -976,7 +976,7 @@ public class DeploymentLoader implements
try {
final String[] prefixes = NewLoaderLogic.readInputStreamList(exclusions.openStream());
excludeFilter = Filters.prefixes(prefixes);
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("can't read " + exclusions.toExternalForm());
}
}
@@ -984,7 +984,7 @@ public class DeploymentLoader implements
UrlSet urls = new UrlSet(webUrls);
try {
urls = NewLoaderLogic.applyBuiltinExcludes(urls, null, excludeFilter);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
return Arrays.asList(webUrls);
}
return urls.getUrls();
@@ -999,7 +999,7 @@ public class DeploymentLoader implements
try {
xmls = Collections.list(loader.getResources("META-INF/beans.xml"));
xmls.add((URL) webModule.getAltDDs().get("beans.xml"));
- } catch (IOException e) {
+ } catch (final IOException e) {
return;
}
@@ -1022,7 +1022,7 @@ public class DeploymentLoader implements
final Beans beans;
try {
beans = ReadDescriptors.readBeans(url.openStream());
- } catch (IOException e) {
+ } catch (final IOException e) {
return returnValue;
}
@@ -1036,7 +1036,7 @@ public class DeploymentLoader implements
}
// check is done here since later we lost the data of the origin
ReadDescriptors.checkDuplicatedByBeansXml(beans, returnValue);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
logger.error("Unable to read beans.xml from :" + url.toExternalForm());
}
return returnValue;
@@ -1049,7 +1049,7 @@ public class DeploymentLoader implements
final ArrayList<URL> xmls;
try {
xmls = Collections.list(loader.getResources("META-INF/beans.xml"));
- } catch (IOException e) {
+ } catch (final IOException e) {
return;
}
@@ -1066,7 +1066,7 @@ public class DeploymentLoader implements
IAnnotationFinder finder;
try {
finder = FinderFactory.createFinder(appModule);
- } catch (Exception e) {
+ } catch (final Exception e) {
finder = new FinderFactory.ModuleLimitedFinder(new org.apache.xbean.finder.AnnotationFinder(new WebappAggregatedArchive(appModule.getClassLoader(), appModule.getAltDDs(), xmls)));
}
appModule.setEarLibFinder(finder);
@@ -1093,7 +1093,7 @@ public class DeploymentLoader implements
final File webInfDir = new File(warFile, "WEB-INF");
try {
webClassPath.add(new File(webInfDir, "classes").toURI().toURL());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("War path bad: " + new File(webInfDir, "classes"), e);
}
@@ -1106,13 +1106,13 @@ public class DeploymentLoader implements
if (name.endsWith(".jar") || name.endsWith(".zip")) {
try {
webClassPath.add(file.toURI().toURL());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("War path bad: " + file, e);
}
} else if (name.endsWith(".rar")) {
try {
webRars.add(file.toURI().toURL());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("War path bad: " + file, e);
}
}
@@ -1159,7 +1159,7 @@ public class DeploymentLoader implements
if (jarFile.isFile()) {
moduleUrl = new URL("jar", "", -1, moduleUrl + "!/");
}
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("Invalid module location " + wsModule.getJarLocation());
return;
}
@@ -1188,7 +1188,7 @@ public class DeploymentLoader implements
if ("file".equals(jaxrpcMappingUrl.getProtocol())) {
wsModule.getWatchedResources().add(URLs.toFilePath(jaxrpcMappingUrl));
}
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("Invalid jaxrpc-mapping-file location " + jaxrpcMappingFile);
}
}
@@ -1213,7 +1213,7 @@ public class DeploymentLoader implements
try {
final File file = new File(warFile, location).getCanonicalFile().getAbsoluteFile();
tldLocations.addAll(TldScanner.scanForTagLibs(file));
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("JSP tag library location bad: " + location, e);
}
}
@@ -1279,7 +1279,7 @@ public class DeploymentLoader implements
final URL url = file.toURI().toURL();
facesConfigLocations.add(url);
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.error("Faces configuration file location bad: " + location, e);
}
}
@@ -1297,7 +1297,7 @@ public class DeploymentLoader implements
facesConfigFile = facesConfigFile.getCanonicalFile().getAbsoluteFile();
final URL url = facesConfigFile.toURI().toURL();
facesConfigLocations.add(url);
- } catch (IOException e) {
+ } catch (final IOException e) {
// TODO: kmalhi:: Remove the printStackTrace after testing
e.printStackTrace();
}
@@ -1341,7 +1341,7 @@ public class DeploymentLoader implements
// find the nested jar files
final HashMap<String, URL> rarLibs = new HashMap<String, URL>();
scanDir(rarFile, rarLibs, "");
- for (Iterator<Map.Entry<String, URL>> iterator = rarLibs.entrySet().iterator(); iterator.hasNext(); ) {
+ for (final Iterator<Map.Entry<String, URL>> iterator = rarLibs.entrySet().iterator(); iterator.hasNext(); ) {
// remove all non jars from the rarLibs
final Map.Entry<String, URL> fileEntry = iterator.next();
if (!fileEntry.getKey().endsWith(".jar")) {
@@ -1423,7 +1423,7 @@ public class DeploymentLoader implements
List<URL> persistenceUrls;
try {
persistenceUrls = (List<URL>) appModule.getAltDDs().get("persistence.xml");
- } catch (ClassCastException e) {
+ } catch (final ClassCastException e) {
//That happens when we are trying to deploy an ear file.
//lets try to get a single object instead
final Object value = appModule.getAltDDs().get("persistence.xml");
@@ -1514,7 +1514,7 @@ public class DeploymentLoader implements
return altDDSources(mapDescriptors(finder), log);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBException("Unable to determine descriptors in jar.", e);
}
}
@@ -1596,7 +1596,7 @@ public class DeploymentLoader implements
descriptors.put(entryName, new URL(jarURL, entry.getName()));
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
// most likely an invalid jar file
}
} else if (warFile.isDirectory()) {
@@ -1649,7 +1649,7 @@ public class DeploymentLoader implements
try {
pathname = URLDecoder.decode(pathname, "UTF-8");
- } catch (Exception e) {
+ } catch (final Exception e) {
//noinspection deprecation
pathname = URLDecoder.decode(pathname);
}
@@ -1658,7 +1658,7 @@ public class DeploymentLoader implements
final String pathname = warUrl.getPath();
try {
return new File(URLDecoder.decode(pathname, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
//noinspection deprecation
return new File(URLDecoder.decode(pathname));
}
@@ -1671,7 +1671,7 @@ public class DeploymentLoader implements
public static Application unmarshal(final URL url) throws OpenEJBException {
try {
return ApplicationXml.unmarshal(url);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new OpenEJBException("Encountered error parsing the application.xml file: " + url.toExternalForm(), e);
}
}
@@ -1696,7 +1696,7 @@ public class DeploymentLoader implements
final String name = file.getName();
try {
files.put(path + name, file.toURI().toURL());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
logger.warning("EAR path bad: " + path + name, e);
}
}
@@ -1876,7 +1876,7 @@ public class DeploymentLoader implements
logger.warning("you deployed " + urls.toExternalForm() + ", it seems it is a war with no extension, please rename it");
}
}
- } catch (Exception ignored) {
+ } catch (final Exception ignored) {
// no-op
}
}
@@ -1903,7 +1903,7 @@ public class DeploymentLoader implements
try {
return JarExtractor.extract(jarFile, name);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
throw new OpenEJBException("Unable to extract jar. " + e.getMessage(), e);
}
}
@@ -1912,7 +1912,7 @@ public class DeploymentLoader implements
final URL baseUrl;
try {
baseUrl = jarFile.toURI().toURL();
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
throw new OpenEJBException("Malformed URL to app. " + e.getMessage(), e);
}
return baseUrl;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java Wed Feb 19 15:47:58 2014
@@ -57,7 +57,7 @@ public class DeploymentsResolver impleme
static {
try {
lib = SystemInstance.get().getHome().getDirectory("lib", false);
- } catch (IOException e) {
+ } catch (final IOException e) {
//Ignore
}
}
@@ -97,10 +97,10 @@ public class DeploymentsResolver impleme
loadFromDir(dep, path, jarList);
- } catch (Files.FileDoesNotExistException e) {
+ } catch (final Files.FileDoesNotExistException e) {
logger.warning("File error: <Deployments dir=\"" + dep.getDir() + "\"> - " + e.getMessage());
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
final String message = "Runtime error: <Deployments dir=\"" + dep.getDir() + "\"> - " + e.getMessage();
logger.error(message);
@@ -113,7 +113,7 @@ public class DeploymentsResolver impleme
loadFromFile(dep, path, jarList);
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
final String message = "<Deployments file=\"" + dep.getFile() + "\"> - " + e.getMessage();
logger.error(message);
throw new DeploymentsConfigurationException(message);
@@ -354,7 +354,7 @@ public class DeploymentsResolver impleme
logger.info("Matched: " + url);
}
}
- } catch (IOException e1) {
+ } catch (final IOException e1) {
e1.printStackTrace();
logger.warning("Unable to search classpath for modules: Received Exception: " + e1.getClass().getName() + " " + e1.getMessage(), e1);
}
@@ -400,9 +400,9 @@ public class DeploymentsResolver impleme
logger.info("Found " + moduleType.getSimpleName() + " in classpath: " + file.getAbsolutePath());
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.warning("Unable to determine the module type of " + url.toExternalForm() + ": Exception: " + e.getMessage(), e);
- } catch (UnknownModuleTypeException ignore) {
+ } catch (final UnknownModuleTypeException ignore) {
// no-op
}
}