Author: pete.muir(a)jboss.org
Date: 2009-03-15 14:47:48 -0400 (Sun, 15 Mar 2009)
New Revision: 2010
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/Parameters.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractClassDeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractDeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDescriptor.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/FileDescriptor.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/Scanner.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/SimpleWebBeansDeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/URLScanner.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansXmlDeploymentHandler.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryException.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryImpl.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Shutdown.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/Reflections.java
Log:
whitespace
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -35,81 +35,85 @@
import org.jboss.webbeans.resources.spi.NamingContext;
/**
- * This is the main class that should always be called from the command
- * line for a WebBEans SE app. Something like:
- * <code>
+ * This is the main class that should always be called from the command line for
+ * a WebBEans SE app. Something like: <code>
* java -jar MyApp.jar org.jboss.webbeans.environment.se.StarMain arguments
* </code>
+ *
* @author Peter Royle
* @author Pete Muir
*/
public class StartMain
{
-
- private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
- private final Bootstrap bootstrap;
- private final BeanStore applicationBeanStore;
- private String[] args;
- private boolean hasShutdownBeenCalled = false;
- Log log = Logging.getLog( StartMain.class );
-
- public StartMain( String[] commandLineArgs )
- {
- this.args = commandLineArgs;
- try
- {
- bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME,
Bootstrap.class);
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Error loading Web Beans bootstrap,
check that Web Beans is on the classpath", e);
- }
- this.applicationBeanStore = new ConcurrentHashMapBeanStore();
- }
-
- private void go()
- {
- bootstrap.setEnvironment(Environments.SE);
- bootstrap.getServices().add(WebBeanDiscovery.class, new WebBeanDiscoveryImpl());
- bootstrap.getServices().add(NamingContext.class, new NoNamingContext());
- bootstrap.setApplicationContext(applicationBeanStore);
- bootstrap.initialize();
- bootstrap.boot();
- bootstrap.getManager().getInstanceByType(ParametersFactory.class).setArgs(args);
- DependentContext.INSTANCE.setActive(true);
- }
-
- /**
- * The main method called from the command line. This little puppy
- * will get the ball rolling.
- * @param args the command line arguments
- */
- public static void main( String[] args )
- {
- new StartMain( args ).go();
- }
-
- /**
- * The observer of the optional shutdown request which will in turn fire the
- * Shutdown event.
- * @param shutdownRequest
- */
- public void shutdown( @Observes @Shutdown Manager shutdownRequest )
- {
- synchronized (this)
- {
-
- if (!hasShutdownBeenCalled)
- {
- hasShutdownBeenCalled = true;
- bootstrap.shutdown();
- } else
- {
- log.debug( "Skipping spurious call to shutdown");
- log.trace( Thread.currentThread().getStackTrace() );
- }
- }
- }
-
+ private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
+
+ private final Bootstrap bootstrap;
+ private final BeanStore applicationBeanStore;
+ private String[] args;
+ private boolean hasShutdownBeenCalled = false;
+ Log log = Logging.getLog(StartMain.class);
+
+ public StartMain(String[] commandLineArgs)
+ {
+ this.args = commandLineArgs;
+ try
+ {
+ bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME,
Bootstrap.class);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Error loading Web Beans bootstrap, check
that Web Beans is on the classpath", e);
+ }
+ this.applicationBeanStore = new ConcurrentHashMapBeanStore();
+ }
+
+ private void go()
+ {
+ bootstrap.setEnvironment(Environments.SE);
+ bootstrap.getServices().add(WebBeanDiscovery.class, new WebBeanDiscoveryImpl());
+ bootstrap.getServices().add(NamingContext.class, new NoNamingContext());
+ bootstrap.setApplicationContext(applicationBeanStore);
+ bootstrap.initialize();
+ bootstrap.boot();
+ bootstrap.getManager().getInstanceByType(ParametersFactory.class).setArgs(args);
+ DependentContext.INSTANCE.setActive(true);
+ }
+
+ /**
+ * The main method called from the command line. This little puppy will get
+ * the ball rolling.
+ *
+ * @param args
+ * the command line arguments
+ */
+ public static void main(String[] args)
+ {
+ new StartMain(args).go();
+ }
+
+ /**
+ * The observer of the optional shutdown request which will in turn fire the
+ * Shutdown event.
+ *
+ * @param shutdownRequest
+ */
+ public void shutdown(@Observes @Shutdown Manager shutdownRequest)
+ {
+ synchronized (this)
+ {
+
+ if (!hasShutdownBeenCalled)
+ {
+ hasShutdownBeenCalled = true;
+ bootstrap.shutdown();
+ }
+ else
+ {
+ log.debug("Skipping spurious call to shutdown");
+ log.trace(Thread.currentThread().getStackTrace());
+ }
+ }
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -27,35 +27,38 @@
import org.jboss.webbeans.environment.se.bindings.Parameters;
/**
- * The simple bean that will hold the command line arguments
- * and make them available by injection (using the @Parameters binding).
- * It's initialised by the StartMain class before your main app is
- * initialised.
+ * The simple bean that will hold the command line arguments and make them
+ * available by injection (using the @Parameters binding). It's initialised by
+ * the StartMain class before your main app is initialised.
+ *
* @author Peter Royle
*/
@ApplicationScoped
public class ParametersFactory
{
- private String[] args;
-
- /**
- * Producer method for the injectible command line args.
- * @return The command line arguments.
- */
- @Produces
- @Parameters
- // TODO Give generic type - WBRI-186
- public List getArgs( )
- {
- return Collections.unmodifiableList(new ArrayList<String>( Arrays.asList(
this.args ) ));
- }
-
- /**
- * StartMain passes in the command line args here.
- * @param args The command line arguments.
- */
- public void setArgs( String[] args )
- {
- this.args = args;
- }
+ private String[] args;
+
+ /**
+ * Producer method for the injectible command line args.
+ *
+ * @return The command line arguments.
+ */
+ @Produces
+ @Parameters
+ // TODO Give generic type - WBRI-186
+ public List getArgs()
+ {
+ return Collections.unmodifiableList(new
ArrayList<String>(Arrays.asList(this.args)));
+ }
+
+ /**
+ * StartMain passes in the command line args here.
+ *
+ * @param args
+ * The command line arguments.
+ */
+ public void setArgs(String[] args)
+ {
+ this.args = args;
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/Parameters.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/Parameters.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/Parameters.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -24,15 +24,10 @@
import javax.inject.BindingType;
/**
- *
+ *
* @author Peter Royle
*/
@BindingType
-@Retention( RetentionPolicy.RUNTIME )
-@Target( {ElementType.PARAMETER,
- ElementType.METHOD,
- ElementType.FIELD
-} )
-public @interface Parameters
-{
-}
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD })
+public @interface Parameters {}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractClassDeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractClassDeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractClassDeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -19,24 +19,22 @@
import java.util.HashSet;
import java.util.Set;
-public abstract class AbstractClassDeploymentHandler
- extends AbstractDeploymentHandler
- implements ClassDeploymentHandler
+public abstract class AbstractClassDeploymentHandler extends AbstractDeploymentHandler
implements ClassDeploymentHandler
{
- private Set<ClassDescriptor> classes;
-
- public AbstractClassDeploymentHandler( )
- {
- classes = new HashSet<ClassDescriptor>( );
- }
-
- public Set<ClassDescriptor> getClasses( )
- {
- return classes;
- }
-
- public void setClasses( Set<ClassDescriptor> classes )
- {
- this.classes = classes;
- }
+ private Set<ClassDescriptor> classes;
+
+ public AbstractClassDeploymentHandler()
+ {
+ classes = new HashSet<ClassDescriptor>();
+ }
+
+ public Set<ClassDescriptor> getClasses()
+ {
+ return classes;
+ }
+
+ public void setClasses(Set<ClassDescriptor> classes)
+ {
+ this.classes = classes;
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractDeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractDeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractDeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -20,29 +20,29 @@
import java.util.Set;
/**
- * Abstract base class for {@link DeploymentHandler} providing common functionality
- *
+ * Abstract base class for {@link DeploymentHandler} providing common
+ * functionality
+ *
* @author Pete Muir
- *
+ *
*/
-public abstract class AbstractDeploymentHandler
- implements DeploymentHandler
+public abstract class AbstractDeploymentHandler implements DeploymentHandler
{
- private Set<FileDescriptor> resources;
-
- public AbstractDeploymentHandler( )
- {
- resources = new HashSet<FileDescriptor>( );
- }
-
- public void setResources( Set<FileDescriptor> resources )
- {
- this.resources = resources;
- }
-
- public Set<FileDescriptor> getResources( )
- {
- return resources;
- }
-
+ private Set<FileDescriptor> resources;
+
+ public AbstractDeploymentHandler()
+ {
+ resources = new HashSet<FileDescriptor>();
+ }
+
+ public void setResources(Set<FileDescriptor> resources)
+ {
+ this.resources = resources;
+ }
+
+ public Set<FileDescriptor> getResources()
+ {
+ return resources;
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -30,144 +30,140 @@
/**
* Abstract base class for {@link Scanner} providing common functionality
- *
+ *
* This class provides file-system orientated scanning
- *
+ *
* @author Pete Muir
- *
+ *
*/
-public abstract class AbstractScanner
- implements Scanner
+public abstract class AbstractScanner implements Scanner
{
- private static class Handler
- {
- public static final String BEANS_XML = "beans.xml";
- private ClassDescriptor classDescriptor;
- private Set<FileDescriptor> fileDescriptors;
- private Set<DeploymentHandler> deploymentHandlers;
- private ClassLoader classLoader;
- private String name;
-
- public Handler( String name, Set<DeploymentHandler> deploymentHandlers,
ClassLoader classLoader )
- {
- this.deploymentHandlers = deploymentHandlers;
- this.name = name;
- this.classLoader = classLoader;
- }
-
- /**
- * Return true if the file was handled (false if it was ignored)
- */
- protected boolean handle( DeploymentHandler deploymentHandler )
- {
- boolean handled = false;
-
- if ( deploymentHandler instanceof ClassDeploymentHandler )
+ private static class Handler
+ {
+ public static final String BEANS_XML = "beans.xml";
+ private ClassDescriptor classDescriptor;
+ private Set<FileDescriptor> fileDescriptors;
+ private Set<DeploymentHandler> deploymentHandlers;
+ private ClassLoader classLoader;
+ private String name;
+
+ public Handler(String name, Set<DeploymentHandler> deploymentHandlers,
ClassLoader classLoader)
+ {
+ this.deploymentHandlers = deploymentHandlers;
+ this.name = name;
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * Return true if the file was handled (false if it was ignored)
+ */
+ protected boolean handle(DeploymentHandler deploymentHandler)
+ {
+ boolean handled = false;
+
+ if (deploymentHandler instanceof ClassDeploymentHandler)
+ {
+ if (name.endsWith(".class"))
{
- if ( name.endsWith( ".class" ) )
- {
- ClassDeploymentHandler classDeploymentHandler =
(ClassDeploymentHandler) deploymentHandler;
-
- if ( getClassDescriptor( ).getClazz( ) != null )
- {
- log.trace( "adding class to deployable list " + name +
" for deployment handler " +
- deploymentHandler.toString() );
- classDeploymentHandler.getClasses( ).add( getClassDescriptor( )
);
- handled = true;
- } else
- {
- log.info( "skipping class " + name +
- " because it cannot be loaded (may reference a
type which is not available on the classpath)" );
- }
- }
- } else
+ ClassDeploymentHandler classDeploymentHandler = (ClassDeploymentHandler)
deploymentHandler;
+
+ if (getClassDescriptor().getClazz() != null)
+ {
+ log.trace("adding class to deployable list " + name + "
for deployment handler " + deploymentHandler.toString());
+ classDeploymentHandler.getClasses().add(getClassDescriptor());
+ handled = true;
+ }
+ else
+ {
+ log.info("skipping class " + name + " because it cannot
be loaded (may reference a type which is not available on the classpath)");
+ }
+ }
+ }
+ else
+ {
+ if (name.equals(BEANS_XML))
{
- if ( name.equals (BEANS_XML) )
- {
- deploymentHandler.getResources( ).addAll( getAllFileDescriptors( )
);
- handled = true;
- }
+ deploymentHandler.getResources().addAll(getAllFileDescriptors());
+ handled = true;
}
-
- return handled;
- }
-
- protected boolean handle( )
- {
- log.trace( "found " + name );
-
- boolean handled = false;
-
- for ( DeploymentHandler entry : deploymentHandlers )
+ }
+
+ return handled;
+ }
+
+ protected boolean handle()
+ {
+ log.trace("found " + name);
+
+ boolean handled = false;
+
+ for (DeploymentHandler entry : deploymentHandlers)
+ {
+ if (handle(entry))
{
- if ( handle( entry ) )
- {
- handled = true;
- }
+ handled = true;
}
-
- return handled;
- }
-
- private ClassDescriptor getClassDescriptor( )
- {
- if ( classDescriptor == null )
+ }
+
+ return handled;
+ }
+
+ private ClassDescriptor getClassDescriptor()
+ {
+ if (classDescriptor == null)
+ {
+ classDescriptor = new ClassDescriptor(name, classLoader);
+ }
+
+ return classDescriptor;
+ }
+
+ private Set<FileDescriptor> getAllFileDescriptors()
+ {
+ if (fileDescriptors == null)
+ {
+ try
{
- classDescriptor = new ClassDescriptor( name, classLoader );
+ Enumeration<URL> allUrls = classLoader.getResources(name);
+ Set<FileDescriptor> fileDescSet = new
HashSet<FileDescriptor>();
+
+ while (allUrls.hasMoreElements())
+ {
+ fileDescSet.add(new FileDescriptor(name, allUrls.nextElement()));
+ }
+
+ this.fileDescriptors = fileDescSet;
}
-
- return classDescriptor;
- }
-
- private Set<FileDescriptor> getAllFileDescriptors( )
- {
- if ( fileDescriptors == null )
+ catch (IOException ex)
{
- try
- {
- Enumeration<URL> allUrls = classLoader.getResources( name );
- Set<FileDescriptor> fileDescSet = new
HashSet<FileDescriptor>( );
-
- while ( allUrls.hasMoreElements( ) )
- {
- fileDescSet.add( new FileDescriptor(
- name,
- allUrls.nextElement( ) )
);
- }
-
- this.fileDescriptors = fileDescSet;
- } catch ( IOException ex )
- {
- throw new WebBeanDiscoveryException( "Error loading all
classpath urls for file " + name, ex );
- }
+ throw new WebBeanDiscoveryException("Error loading all classpath urls
for file " + name, ex);
}
-
- return fileDescriptors;
- }
- }
-
- private static final LogProvider log = Logging.getLogProvider( Scanner.class );
- private Set<DeploymentHandler> deploymentHandlers;
- private ClassLoader classLoader;
-
-
- public AbstractScanner( Set<DeploymentHandler> deploymentHandlers, ClassLoader
classLoader )
- {
- this.deploymentHandlers = deploymentHandlers;
- this.classLoader = classLoader;
- ClassFile.class.getPackage( ); //to force loading of javassist, throwing an
exception if it is missing
- }
-
- protected boolean handle( String name )
- {
- return new Handler( name,
- deploymentHandlers,
- classLoader ).handle( );
- }
-
- public ClassLoader getClassLoader()
- {
- return classLoader;
- }
-
+ }
+
+ return fileDescriptors;
+ }
+ }
+
+ private static final LogProvider log = Logging.getLogProvider(Scanner.class);
+ private Set<DeploymentHandler> deploymentHandlers;
+ private ClassLoader classLoader;
+
+ public AbstractScanner(Set<DeploymentHandler> deploymentHandlers, ClassLoader
classLoader)
+ {
+ this.deploymentHandlers = deploymentHandlers;
+ this.classLoader = classLoader;
+ ClassFile.class.getPackage(); // to force loading of javassist, throwing
+ // an exception if it is missing
+ }
+
+ protected boolean handle(String name)
+ {
+ return new Handler(name, deploymentHandlers, classLoader).handle();
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -18,10 +18,9 @@
import java.util.Set;
-public interface ClassDeploymentHandler
- extends DeploymentHandler
+public interface ClassDeploymentHandler extends DeploymentHandler
{
- public Set<ClassDescriptor> getClasses( );
-
- public void setClasses( Set<ClassDescriptor> classes );
+ public Set<ClassDescriptor> getClasses();
+
+ public void setClasses(Set<ClassDescriptor> classes);
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDescriptor.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDescriptor.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDescriptor.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -21,81 +21,85 @@
import java.net.URL;
-public class ClassDescriptor
- extends FileDescriptor
+public class ClassDescriptor extends FileDescriptor
{
- private static LogProvider log = Logging.getLogProvider( ClassDescriptor.class );
- private Class<?> clazz;
-
- public ClassDescriptor( String name, URL url, Class<?> clazz )
- {
- super( name, url );
- this.clazz = clazz;
- }
-
- public ClassDescriptor( String name, ClassLoader classLoader )
- {
- super( name, classLoader );
-
- String classname = filenameToClassname( name );
- log.trace( "Trying to load class " + classname );
-
- try
- {
- clazz = classLoader.loadClass( classname );
- // IBM JVM will throw a TypeNotPresentException if any annotation on the
class is not on
- // the classpath, rendering the class virtually unusable (given Seam's
heavy use of annotations)
- clazz.getAnnotations( );
- } catch ( ClassNotFoundException cnfe )
- {
- log.info( "could not load class: " + classname, cnfe );
- } catch ( NoClassDefFoundError ncdfe )
- {
- log.debug( "could not load class (missing dependency): " +
classname, ncdfe );
- } catch ( TypeNotPresentException tnpe )
- {
- clazz = null;
- log.debug( "could not load class (annotation missing dependency): "
+ classname, tnpe );
- }
- }
-
- public Class<?> getClazz( )
- {
- return clazz;
- }
-
- @Override
- public String toString( )
- {
- return clazz.getName( );
- }
-
- /**
- * Convert a path to a class file to a class name
- */
- public static String filenameToClassname( String filename )
- {
- return filename.substring( 0,
- filename.lastIndexOf( ".class" ) ).replace(
'/', '.' ).replace( '\\', '.' );
- }
-
- @Override
- public boolean equals( Object other )
- {
- if ( other instanceof ClassDescriptor )
- {
- ClassDescriptor that = (ClassDescriptor) other;
-
- return this.getClazz( ).equals( that.getClazz( ) );
- } else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode( )
- {
- return getClazz( ).hashCode( );
- }
+ private static LogProvider log = Logging.getLogProvider(ClassDescriptor.class);
+ private Class<?> clazz;
+
+ public ClassDescriptor(String name, URL url, Class<?> clazz)
+ {
+ super(name, url);
+ this.clazz = clazz;
+ }
+
+ public ClassDescriptor(String name, ClassLoader classLoader)
+ {
+ super(name, classLoader);
+
+ String classname = filenameToClassname(name);
+ log.trace("Trying to load class " + classname);
+
+ try
+ {
+ clazz = classLoader.loadClass(classname);
+ // IBM JVM will throw a TypeNotPresentException if any annotation on
+ // the class is not on
+ // the classpath, rendering the class virtually unusable (given Seam's
+ // heavy use of annotations)
+ clazz.getAnnotations();
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ log.info("could not load class: " + classname, cnfe);
+ }
+ catch (NoClassDefFoundError ncdfe)
+ {
+ log.debug("could not load class (missing dependency): " + classname,
ncdfe);
+ }
+ catch (TypeNotPresentException tnpe)
+ {
+ clazz = null;
+ log.debug("could not load class (annotation missing dependency): " +
classname, tnpe);
+ }
+ }
+
+ public Class<?> getClazz()
+ {
+ return clazz;
+ }
+
+ @Override
+ public String toString()
+ {
+ return clazz.getName();
+ }
+
+ /**
+ * Convert a path to a class file to a class name
+ */
+ public static String filenameToClassname(String filename)
+ {
+ return filename.substring(0,
filename.lastIndexOf(".class")).replace('/',
'.').replace('\\', '.');
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof ClassDescriptor)
+ {
+ ClassDescriptor that = (ClassDescriptor) other;
+
+ return this.getClazz().equals(that.getClazz());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClazz().hashCode();
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -20,17 +20,17 @@
/**
* A deployment handler is responsible for processing found resources
- *
- * All deployment handlers should specify a unique name under which they
- * will be registered with the {@link DeploymentStrategy}
- *
+ *
+ * All deployment handlers should specify a unique name under which they will be
+ * registered with the {@link DeploymentStrategy}
+ *
* @author Pete Muir
- *
+ *
*/
public interface DeploymentHandler
{
-
- public Set<FileDescriptor> getResources( );
-
- public void setResources( Set<FileDescriptor> resources );
+
+ public Set<FileDescriptor> getResources();
+
+ public void setResources(Set<FileDescriptor> resources);
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/FileDescriptor.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/FileDescriptor.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/FileDescriptor.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -20,66 +20,66 @@
public class FileDescriptor
{
- private String name;
- private URL url;
-
- public FileDescriptor( String name, URL url )
- {
- this.name = name;
- this.url = url;
- }
-
- public FileDescriptor( String name, ClassLoader classLoader )
- {
- this.name = name;
-
- if ( name == null )
- {
- throw new NullPointerException( "Name cannot be null, loading from
" + classLoader );
- }
-
- this.url = classLoader.getResource( name );
-
- if ( this.url == null )
- {
- throw new NullPointerException( "Cannot find URL from classLoader for
" + name + ", loading from " +
- classLoader );
- }
- }
-
- public String getName( )
- {
- return name;
- }
-
- public URL getUrl( )
- {
- return url;
- }
-
- @Override
- public String toString( )
- {
- return url.getPath( );
- }
-
- @Override
- public boolean equals( Object other )
- {
- if ( other instanceof FileDescriptor )
- {
- FileDescriptor that = (FileDescriptor) other;
-
- return this.getUrl( ).equals( that.getUrl( ) );
- } else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode( )
- {
- return getUrl( ).hashCode( );
- }
+ private String name;
+ private URL url;
+
+ public FileDescriptor(String name, URL url)
+ {
+ this.name = name;
+ this.url = url;
+ }
+
+ public FileDescriptor(String name, ClassLoader classLoader)
+ {
+ this.name = name;
+
+ if (name == null)
+ {
+ throw new NullPointerException("Name cannot be null, loading from " +
classLoader);
+ }
+
+ this.url = classLoader.getResource(name);
+
+ if (this.url == null)
+ {
+ throw new NullPointerException("Cannot find URL from classLoader for "
+ name + ", loading from " + classLoader);
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public URL getUrl()
+ {
+ return url;
+ }
+
+ @Override
+ public String toString()
+ {
+ return url.getPath();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof FileDescriptor)
+ {
+ FileDescriptor that = (FileDescriptor) other;
+
+ return this.getUrl().equals(that.getUrl());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getUrl().hashCode();
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/Scanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/Scanner.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/Scanner.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -20,26 +20,28 @@
/**
* The Scanner is used to find resources to be processed by Seam
- *
+ *
* The processing is done by {@link DeploymentHandler}s
- *
+ *
* @author Pete Muir
- *
+ *
*/
public interface Scanner
{
- /**
- * Recursively scan directories.
- *
- * @param directories An array of the roots of the directory trees to scan
- */
- public void scanDirectories( File[] directories );
-
- /**
- * Scan for structures which contain any of the given resources in their root
- *
- * @param resources The resources to scan for
- */
- public void scanResources( String[] resources );
-
+ /**
+ * Recursively scan directories.
+ *
+ * @param directories
+ * An array of the roots of the directory trees to scan
+ */
+ public void scanDirectories(File[] directories);
+
+ /**
+ * Scan for structures which contain any of the given resources in their root
+ *
+ * @param resources
+ * The resources to scan for
+ */
+ public void scanResources(String[] resources);
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/SimpleWebBeansDeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/SimpleWebBeansDeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/SimpleWebBeansDeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -19,12 +19,11 @@
/**
* The {@link SimpleWebBeansDeploymentHandler} processes all classes found in a
* Web Beans archive/folder.
- *
+ *
* @author Pete Muir
* @author Peter Royle
- *
+ *
*/
-public class SimpleWebBeansDeploymentHandler
- extends AbstractClassDeploymentHandler
+public class SimpleWebBeansDeploymentHandler extends AbstractClassDeploymentHandler
{
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/URLScanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/URLScanner.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/URLScanner.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -33,160 +33,159 @@
/**
* Implementation of {@link Scanner} which can scan a {@link URLClassLoader}
- *
+ *
* @author Thomas Heute
* @author Gavin King
* @author Norman Richards
* @author Pete Muir
- *
+ *
*/
-public class URLScanner
- extends AbstractScanner
+public class URLScanner extends AbstractScanner
{
- private static final LogProvider log = Logging.getLogProvider( URLScanner.class );
-
- public URLScanner( Set<DeploymentHandler> deploymentHandlers, ClassLoader
classLoader )
- {
- super( deploymentHandlers, classLoader );
- }
-
- public void scanDirectories( File[] directories )
- {
- for ( File directory : directories )
- {
- handleDirectory( directory, null );
- }
- }
-
- public void scanResources( String[] resources )
- {
- Set<String> paths = new HashSet<String>( );
-
- for ( String resourceName : resources )
- {
- try
+ private static final LogProvider log = Logging.getLogProvider(URLScanner.class);
+
+ public URLScanner(Set<DeploymentHandler> deploymentHandlers, ClassLoader
classLoader)
+ {
+ super(deploymentHandlers, classLoader);
+ }
+
+ public void scanDirectories(File[] directories)
+ {
+ for (File directory : directories)
+ {
+ handleDirectory(directory, null);
+ }
+ }
+
+ public void scanResources(String[] resources)
+ {
+ Set<String> paths = new HashSet<String>();
+
+ for (String resourceName : resources)
+ {
+ try
+ {
+ Enumeration<URL> urlEnum =
getClassLoader().getResources(resourceName);
+
+ while (urlEnum.hasMoreElements())
{
- Enumeration<URL> urlEnum = getClassLoader( ).getResources(
resourceName );
-
- while ( urlEnum.hasMoreElements( ) )
- {
- String urlPath = urlEnum.nextElement( ).getFile( );
- urlPath = URLDecoder.decode( urlPath, "UTF-8" );
-
- if ( urlPath.startsWith( "file:" ) )
- {
- urlPath = urlPath.substring( 5 );
- }
-
- if ( urlPath.indexOf( '!' ) > 0 )
- {
- urlPath =
- urlPath.substring( 0,
- urlPath.indexOf( '!' ) );
- } else
- {
- File dirOrArchive = new File( urlPath );
-
- if ( ( resourceName != null ) && (
resourceName.lastIndexOf( '/' ) > 0 ) )
- {
- //for META-INF/components.xml
- dirOrArchive = dirOrArchive.getParentFile( );
- }
-
- urlPath = dirOrArchive.getParent( );
- }
-
- paths.add( urlPath );
- }
- } catch ( IOException ioe )
- {
- log.warn( "could not read: " + resourceName, ioe );
+ String urlPath = urlEnum.nextElement().getFile();
+ urlPath = URLDecoder.decode(urlPath, "UTF-8");
+
+ if (urlPath.startsWith("file:"))
+ {
+ urlPath = urlPath.substring(5);
+ }
+
+ if (urlPath.indexOf('!') > 0)
+ {
+ urlPath = urlPath.substring(0, urlPath.indexOf('!'));
+ }
+ else
+ {
+ File dirOrArchive = new File(urlPath);
+
+ if ((resourceName != null) &&
(resourceName.lastIndexOf('/') > 0))
+ {
+ // for META-INF/components.xml
+ dirOrArchive = dirOrArchive.getParentFile();
+ }
+
+ urlPath = dirOrArchive.getParent();
+ }
+
+ paths.add(urlPath);
}
- }
-
- handle( paths );
- }
-
- protected void handle( Set<String> paths )
- {
- for ( String urlPath : paths )
- {
- try
+ }
+ catch (IOException ioe)
+ {
+ log.warn("could not read: " + resourceName, ioe);
+ }
+ }
+
+ handle(paths);
+ }
+
+ protected void handle(Set<String> paths)
+ {
+ for (String urlPath : paths)
+ {
+ try
+ {
+ log.trace("scanning: " + urlPath);
+
+ File file = new File(urlPath);
+
+ if (file.isDirectory())
{
- log.trace( "scanning: " + urlPath );
-
- File file = new File( urlPath );
-
- if ( file.isDirectory( ) )
- {
- handleDirectory( file, null );
- } else
- {
- handleArchiveByFile( file );
- }
- } catch ( IOException ioe )
- {
- log.warn( "could not read entries", ioe );
+ handleDirectory(file, null);
}
- }
- }
-
- private void handleArchiveByFile( File file )
- throws IOException
- {
- try
- {
- log.trace( "archive: " + file );
-
- ZipFile zip = new ZipFile( file );
- Enumeration<?extends ZipEntry> entries = zip.entries( );
-
- while ( entries.hasMoreElements( ) )
+ else
{
- ZipEntry entry = entries.nextElement( );
- String name = entry.getName( );
- handle( name );
+ handleArchiveByFile(file);
}
- } catch ( ZipException e )
- {
- throw new RuntimeException( "Error handling file " + file, e );
- }
- }
-
- private void handleDirectory( File file, String path )
- {
- handleDirectory( file,
- path,
- new File[0] );
- }
-
- private void handleDirectory( File file, String path, File[] excludedDirectories )
- {
- for ( File excludedDirectory : excludedDirectories )
- {
- if ( file.equals( excludedDirectory ) )
- {
- log.trace( "skipping excluded directory: " + file );
-
- return;
- }
- }
-
- log.trace( "handling directory: " + file );
-
- for ( File child : file.listFiles( ) )
- {
- String newPath = ( path == null ) ? child.getName( ) : ( path + '/'
+ child.getName( ) );
-
- if ( child.isDirectory( ) )
- {
- handleDirectory( child, newPath, excludedDirectories );
- } else
- {
- handle( newPath );
- }
- }
- }
-
-
+ }
+ catch (IOException ioe)
+ {
+ log.warn("could not read entries", ioe);
+ }
+ }
+ }
+
+ private void handleArchiveByFile(File file) throws IOException
+ {
+ try
+ {
+ log.trace("archive: " + file);
+
+ ZipFile zip = new ZipFile(file);
+ Enumeration<? extends ZipEntry> entries = zip.entries();
+
+ while (entries.hasMoreElements())
+ {
+ ZipEntry entry = entries.nextElement();
+ String name = entry.getName();
+ handle(name);
+ }
+ }
+ catch (ZipException e)
+ {
+ throw new RuntimeException("Error handling file " + file, e);
+ }
+ }
+
+ private void handleDirectory(File file, String path)
+ {
+ handleDirectory(file, path, new File[0]);
+ }
+
+ private void handleDirectory(File file, String path, File[] excludedDirectories)
+ {
+ for (File excludedDirectory : excludedDirectories)
+ {
+ if (file.equals(excludedDirectory))
+ {
+ log.trace("skipping excluded directory: " + file);
+
+ return;
+ }
+ }
+
+ log.trace("handling directory: " + file);
+
+ for (File child : file.listFiles())
+ {
+ String newPath = (path == null) ? child.getName() : (path + '/' +
child.getName());
+
+ if (child.isDirectory())
+ {
+ handleDirectory(child, newPath, excludedDirectories);
+ }
+ else
+ {
+ handle(newPath);
+ }
+ }
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansXmlDeploymentHandler.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansXmlDeploymentHandler.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansXmlDeploymentHandler.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -16,15 +16,13 @@
*/
package org.jboss.webbeans.environment.se.deployment;
-
/**
* The {@link WebBeansXmlDeploymentHandler} beans.xml files
- *
+ *
* @author Pete Muir
- *
+ *
*/
-public class WebBeansXmlDeploymentHandler
- extends AbstractDeploymentHandler
+public class WebBeansXmlDeploymentHandler extends AbstractDeploymentHandler
{
-
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryException.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryException.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryException.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -16,27 +16,26 @@
*/
package org.jboss.webbeans.environment.se.discovery;
-
/**
* Thrown if there's an error during Web Bean discoery that will stop the
* manager from starting up.
+ *
* @author Peter Royle
*/
-public class WebBeanDiscoveryException
- extends RuntimeException
+public class WebBeanDiscoveryException extends RuntimeException
{
- public WebBeanDiscoveryException( Throwable cause )
- {
- super( cause );
- }
-
- public WebBeanDiscoveryException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public WebBeanDiscoveryException( String message )
- {
- super( message );
- }
+ public WebBeanDiscoveryException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public WebBeanDiscoveryException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public WebBeanDiscoveryException(String message)
+ {
+ super(message);
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryImpl.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryImpl.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/WebBeanDiscoveryImpl.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -17,17 +17,16 @@
package org.jboss.webbeans.environment.se.discovery;
import java.io.File;
-import org.apache.log4j.Logger;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.log4j.Logger;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.environment.se.deployment.ClassDescriptor;
-import org.jboss.webbeans.environment.se.deployment.FileDescriptor;
-
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
import org.jboss.webbeans.environment.se.deployment.DeploymentHandler;
+import org.jboss.webbeans.environment.se.deployment.FileDescriptor;
import org.jboss.webbeans.environment.se.deployment.SimpleWebBeansDeploymentHandler;
import org.jboss.webbeans.environment.se.deployment.URLScanner;
import org.jboss.webbeans.environment.se.deployment.WebBeansXmlDeploymentHandler;
@@ -35,68 +34,68 @@
/**
* The means by which Web Beans are discovered on the classpath. This will only
* discover simple web beans - there is no EJB/Servlet/JPA integration.
- * @author Peter Royle.
- * Adapted from org.jboss.webbeans.integration.jbossas.WebBeansDiscoveryImpl (author
unknown)
+ *
+ * @author Peter Royle. Adapted from
+ * org.jboss.webbeans.integration.jbossas.WebBeansDiscoveryImpl (author
+ * unknown)
*/
-public class WebBeanDiscoveryImpl
- implements WebBeanDiscovery
+public class WebBeanDiscoveryImpl implements WebBeanDiscovery
{
- private Set<Class<?>> wbClasses = new HashSet<Class<?>>( );
- private Set<URL> wbUrls = new HashSet<URL>( );
-// private StandardDeploymentStrategy deploymentStrategy;
- private SimpleWebBeansDeploymentHandler simpleWebBeansDeploymentHandler = new
SimpleWebBeansDeploymentHandler();
- private WebBeansXmlDeploymentHandler webBeansXmlDeploymentHandler = new
WebBeansXmlDeploymentHandler();
- URLScanner urlScanner;
-
-
- // The log provider
- private static Logger log = Logger.getLogger( WebBeanDiscoveryImpl.class.getName( )
);
-
- public WebBeanDiscoveryImpl( )
- {
- final ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
- Set<DeploymentHandler> deploymentHandlers = new
HashSet<DeploymentHandler>();
- deploymentHandlers.add( simpleWebBeansDeploymentHandler );
- deploymentHandlers.add( webBeansXmlDeploymentHandler );
-
- urlScanner = new URLScanner( deploymentHandlers, contextClassLoader );
- urlScanner.scanResources( new String[] { "beans.xml"} );
- urlScanner.scanDirectories( new File[]{} );
-
- findWebBeansXmlUrls( );
- findWebBeansAnnotatedClasses( );
- }
-
- public Iterable<EjbDescriptor<?>> discoverEjbs( )
- {
- return new HashSet<EjbDescriptor<?>>( );
- }
-
- public Iterable<Class<?>> discoverWebBeanClasses( )
- {
- return wbClasses;
- }
-
- public Iterable<URL> discoverWebBeansXml( )
- {
- return wbUrls;
- }
-
- private void findWebBeansAnnotatedClasses( )
- throws WebBeanDiscoveryException
- {
- for ( ClassDescriptor classDesc : simpleWebBeansDeploymentHandler.getClasses() )
- {
- final Class<?> clazz = classDesc.getClazz( );
- wbClasses.add( clazz );
- }
- }
-
- private void findWebBeansXmlUrls( )
- {
- for ( FileDescriptor fileDesc : webBeansXmlDeploymentHandler.getResources() )
- {
- wbUrls.add( fileDesc.getUrl( ) );
- }
- }
+
+ private Set<Class<?>> wbClasses = new HashSet<Class<?>>();
+ private Set<URL> wbUrls = new HashSet<URL>();
+ // private StandardDeploymentStrategy deploymentStrategy;
+ private SimpleWebBeansDeploymentHandler simpleWebBeansDeploymentHandler = new
SimpleWebBeansDeploymentHandler();
+ private WebBeansXmlDeploymentHandler webBeansXmlDeploymentHandler = new
WebBeansXmlDeploymentHandler();
+ URLScanner urlScanner;
+
+ // The log provider
+ private static Logger log = Logger.getLogger(WebBeanDiscoveryImpl.class.getName());
+
+ public WebBeanDiscoveryImpl()
+ {
+ final ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
+ Set<DeploymentHandler> deploymentHandlers = new
HashSet<DeploymentHandler>();
+ deploymentHandlers.add(simpleWebBeansDeploymentHandler);
+ deploymentHandlers.add(webBeansXmlDeploymentHandler);
+
+ urlScanner = new URLScanner(deploymentHandlers, contextClassLoader);
+ urlScanner.scanResources(new String[] { "beans.xml" });
+ urlScanner.scanDirectories(new File[] {});
+
+ findWebBeansXmlUrls();
+ findWebBeansAnnotatedClasses();
+ }
+
+ public Iterable<EjbDescriptor<?>> discoverEjbs()
+ {
+ return new HashSet<EjbDescriptor<?>>();
+ }
+
+ public Iterable<Class<?>> discoverWebBeanClasses()
+ {
+ return wbClasses;
+ }
+
+ public Iterable<URL> discoverWebBeansXml()
+ {
+ return wbUrls;
+ }
+
+ private void findWebBeansAnnotatedClasses() throws WebBeanDiscoveryException
+ {
+ for (ClassDescriptor classDesc : simpleWebBeansDeploymentHandler.getClasses())
+ {
+ final Class<?> clazz = classDesc.getClazz();
+ wbClasses.add(clazz);
+ }
+ }
+
+ private void findWebBeansXmlUrls()
+ {
+ for (FileDescriptor fileDesc : webBeansXmlDeploymentHandler.getResources())
+ {
+ wbUrls.add(fileDesc.getUrl());
+ }
+ }
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Shutdown.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Shutdown.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Shutdown.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -26,15 +26,10 @@
/**
* Fired by webbeans SE before shutting down. Applications and modules should
* release resources cleanly in response to this event.
+ *
* @author Peter Royle
*/
@BindingType
-@Retention( RetentionPolicy.RUNTIME )
-@Target( {ElementType.PARAMETER,
- ElementType.METHOD,
- ElementType.FIELD
-} )
-public @interface Shutdown
-{
-
-}
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD })
+public @interface Shutdown{}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -19,23 +19,24 @@
import org.jboss.webbeans.resources.spi.NamingContext;
/**
- *
+ *
* @author Peter Royle
*/
-public class NoNamingContext
- implements NamingContext
+public class NoNamingContext implements NamingContext
{
-
- public NoNamingContext() {}
- public void bind( String name, Object value )
- {
- // No-op
- }
-
- public <T> T lookup( String name, Class<? extends T> expectedType )
- {
- return null;
- }
-
+ public NoNamingContext()
+ {
+ }
+
+ public void bind(String name, Object value)
+ {
+ // No-op
+ }
+
+ public <T> T lookup(String name, Class<? extends T> expectedType)
+ {
+ return null;
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/Reflections.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/Reflections.java 2009-03-15
18:44:17 UTC (rev 2009)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/Reflections.java 2009-03-15
18:47:48 UTC (rev 2010)
@@ -20,12 +20,14 @@
* Reflection utilities
*
* @author Pete Muir
- *
+ *
*/
public class Reflections
{
- private Reflections(String name) {}
+ private Reflections(String name)
+ {
+ }
public static <T> T newInstance(String className, Class<T> expectedType)
throws InstantiationException, IllegalAccessException, ClassNotFoundException
{