[webbeans-commits] Webbeans SVN: r1749 - in extensions/trunk/se/src/main/java/org/jboss/webbeans: environment/se/boot and 3 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sun Mar 1 17:13:30 EST 2009
Author: peteroyle
Date: 2009-03-01 17:13:29 -0500 (Sun, 01 Mar 2009)
New Revision: 1749
Added:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/ApplicationLifecycle.java
Removed:
extensions/trunk/se/src/main/java/org/jboss/webbeans/lifecycle/ApplicationLifecycle.java
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.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/ClassDeploymentMetadata.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/DeploymentStrategy.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/StandardDeploymentStrategy.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
Log:
Moved lifecyle package to environment.se. Removed unnecessary functionality from deplyment (imported from Seam) to simplify.
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java 2009-03-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -33,7 +33,7 @@
import org.jboss.webbeans.environment.se.beans.ParametersFactory;
import org.jboss.webbeans.environment.se.discovery.WebBeanDiscoveryImpl;
import org.jboss.webbeans.environment.se.resources.DefaultResourceLoader;
-import org.jboss.webbeans.lifecycle.ApplicationLifecycle;
+import org.jboss.webbeans.environment.se.lifecycle.ApplicationLifecycle;
import org.jboss.webbeans.literal.DeployedLiteral;
import org.jboss.webbeans.literal.InitializedLiteral;
import org.jboss.webbeans.log.Log;
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractDeploymentHandler.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -35,12 +35,6 @@
resources = new HashSet<FileDescriptor>( );
}
- @Override
- public String toString( )
- {
- return getName( );
- }
-
public void setResources( Set<FileDescriptor> resources )
{
this.resources = 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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -20,18 +20,12 @@
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import java.io.DataInputStream;
-import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashSet;
-import java.util.Map.Entry;
import java.util.Set;
-import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
/**
@@ -47,16 +41,13 @@
{
private static class Handler
{
- // Cache descriptors for performance
- private ClassFile classFile;
private ClassDescriptor classDescriptor;
- private FileDescriptor fileDescriptor;
private Set<FileDescriptor> fileDescriptors;
- private Set<Entry<String, DeploymentHandler>> deploymentHandlers;
+ private Set<DeploymentHandler> deploymentHandlers;
private ClassLoader classLoader;
private String name;
- public Handler( String name, Set<Entry<String, DeploymentHandler>> deploymentHandlers, ClassLoader classLoader )
+ public Handler( String name, Set<DeploymentHandler> deploymentHandlers, ClassLoader classLoader )
{
this.deploymentHandlers = deploymentHandlers;
this.name = name;
@@ -76,25 +67,21 @@
{
ClassDeploymentHandler classDeploymentHandler = (ClassDeploymentHandler) deploymentHandler;
- if ( hasAnnotations( getClassFile( ),
- classDeploymentHandler.getMetadata( ).getClassAnnotatedWith( ) ) )
+ if ( getClassDescriptor( ).getClazz( ) != null )
{
- if ( getClassDescriptor( ).getClazz( ) != null )
- {
- log.trace( "adding class to deployable list " + name + " for deployment handler " +
- deploymentHandler.getName( ) );
- 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)" );
- }
+ 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.endsWith( deploymentHandler.getMetadata( ).getFileNameSuffix( ) ) )
+ if ( name.equals ("beans.xml" ) )
{
deploymentHandler.getResources( ).addAll( getAllFileDescriptors( ) );
handled = true;
@@ -110,9 +97,9 @@
boolean handled = false;
- for ( Entry<String, DeploymentHandler> entry : deploymentHandlers )
+ for ( DeploymentHandler entry : deploymentHandlers )
{
- if ( handle( entry.getValue( ) ) )
+ if ( handle( entry ) )
{
handled = true;
}
@@ -121,22 +108,6 @@
return handled;
}
- private ClassFile getClassFile( )
- {
- if ( classFile == null )
- {
- try
- {
- classFile = loadClassFile( name, classLoader );
- } catch ( IOException e )
- {
- throw new RuntimeException( "Error loading class file " + name, e );
- }
- }
-
- return classFile;
- }
-
private ClassDescriptor getClassDescriptor( )
{
if ( classDescriptor == null )
@@ -147,16 +118,6 @@
return classDescriptor;
}
- private FileDescriptor getFileDescriptor( )
- {
- if ( fileDescriptor == null )
- {
- fileDescriptor = new FileDescriptor( name, classLoader );
- }
-
- return fileDescriptor;
- }
-
private Set<FileDescriptor> getAllFileDescriptors( )
{
if ( fileDescriptors == null )
@@ -193,92 +154,16 @@
ClassFile.class.getPackage( ); //to force loading of javassist, throwing an exception if it is missing
}
- protected AbstractScanner( )
- {
- }
-
- protected static boolean hasAnnotations( ClassFile classFile, Set<Class<?extends Annotation>> annotationTypes )
- {
- if ( annotationTypes.size( ) > 0 )
- {
- AnnotationsAttribute visible =
- (AnnotationsAttribute) classFile.getAttribute( AnnotationsAttribute.visibleTag );
-
- if ( visible != null )
- {
- for ( Class<?extends Annotation> annotationType : annotationTypes )
- {
- if ( visible.getAnnotation( annotationType.getName( ) ) != null )
- {
- return true;
- }
- }
- }
- } else
- {
- // If no annotations were specified, don't filter on annotations
- // (note that this differs to the semantics used in Seam, where nothing would be matched)
- return true;
- }
-
- return false;
- }
-
- /**
- * Get a Javassist {@link ClassFile} for a given class name from the classLoader
- */
- protected static ClassFile loadClassFile( String name, ClassLoader classLoader )
- throws IOException
- {
- if ( name == null )
- {
- throw new NullPointerException( "name cannot be null" );
- }
-
- InputStream stream = classLoader.getResourceAsStream( name );
-
- if ( stream == null )
- {
- throw new IllegalStateException( "Cannot load " + name + " from " + classLoader +
- " (using getResourceAsStream() returned null)" );
- }
-
- DataInputStream dstream = new DataInputStream( stream );
-
- try
- {
- return new ClassFile( dstream );
- } finally
- {
- dstream.close( );
- stream.close( );
- }
- }
-
public DeploymentStrategy getDeploymentStrategy( )
{
return deploymentStrategy;
}
- public long getTimestamp( )
- {
- return Long.MAX_VALUE;
- }
-
- protected void handleItem( String name )
- {
- handle( name );
- }
-
protected boolean handle( String name )
{
return new Handler( name,
- deploymentStrategy.getDeploymentHandlers( ).entrySet( ),
+ deploymentStrategy.getDeploymentHandlers( ),
deploymentStrategy.getClassLoader( ) ).handle( );
}
- public void scanDirectories( File[] directories, File[] excludedDirectories )
- {
- scanDirectories( directories );
- }
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentHandler.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -21,8 +21,6 @@
public interface ClassDeploymentHandler
extends DeploymentHandler
{
- public ClassDeploymentMetadata getMetadata( );
-
public Set<ClassDescriptor> getClasses( );
public void setClasses( Set<ClassDescriptor> classes );
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java 2009-03-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -22,14 +22,5 @@
public interface ClassDeploymentMetadata
extends DeploymentMetadata
{
- /**
- * An array of class annotations this deployment handler is interested in
- *
- * All classes with any of these annotations should be considered part of the
- * match
- *
- * If this set is empty then all classes will be matched, whether they
- * have annotations or not.
- */
- public Set<Class<?extends Annotation>> getClassAnnotatedWith( );
+
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentHandler.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -29,20 +29,7 @@
*/
public interface DeploymentHandler
{
- /**
- * A key used to identify the deployment handler
- */
- public String getName( );
- /**
- * Get DeploymentHandlerMetadata for resources this deployment handler is
- * interested in processing.
- *
- * If a deployment handler is interested in a number of files it should
- * define multiple pieces of metadata
- */
- public DeploymentMetadata getMetadata( );
-
public Set<FileDescriptor> getResources( );
public void setResources( Set<FileDescriptor> resources );
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java 2009-03-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -23,10 +23,9 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Set;
/**
* A {@link DeploymentStrategy} coordinates the deployment of resources for a
@@ -40,7 +39,7 @@
private static final LogProvider log = Logging.getLogProvider( DeploymentStrategy.class );
private Scanner scanner;
private List<File> files = new ArrayList<File>( );
- private Map<String, DeploymentHandler> deploymentHandlers;
+ private Set<DeploymentHandler> deploymentHandlers;
/**
* The key under which to list possible scanners. System properties take
@@ -85,7 +84,7 @@
* Implementations of {@link DeploymentStrategy} may add default
* {@link DeploymentHandler}s
*/
- public Map<String, DeploymentHandler> getDeploymentHandlers( )
+ public Set<DeploymentHandler> getDeploymentHandlers( )
{
if ( deploymentHandlers == null )
{
@@ -97,15 +96,10 @@
private void initDeploymentHandlers( )
{
- this.deploymentHandlers = new HashMap<String, DeploymentHandler>( );
+ this.deploymentHandlers = new HashSet<DeploymentHandler>( );
- List<String> deploymentHandlersClassNames =
- new WebBeansDeploymentProperties( getClassLoader( ) ).getPropertyValues( getDeploymentHandlersKey( ) );
- addHandlers( deploymentHandlersClassNames );
}
- protected abstract String getDeploymentHandlersKey( );
-
protected void initScanner( )
{
List<String> scanners =
@@ -173,50 +167,6 @@
return null;
}
- private void addHandlers( List<String> handlers )
- {
- for ( String handler : handlers )
- {
- addHandler( handler );
- }
- }
-
- private void addHandler( String className )
- {
- DeploymentHandler deploymentHandler = instantiateDeploymentHandler( className );
-
- if ( deploymentHandler != null )
- {
- log.debug( "Adding " + deploymentHandler + " as a deployment handler" );
- deploymentHandlers.put( deploymentHandler.getName( ),
- deploymentHandler );
- }
- }
-
- private DeploymentHandler instantiateDeploymentHandler( String className )
- {
- try
- {
- Class<DeploymentHandler> clazz = (Class<DeploymentHandler>) getClassLoader( ).loadClass( className );
-
- return clazz.newInstance( );
- } catch ( ClassNotFoundException e )
- {
- log.trace( "Unable to use " + className + " as a deployment handler (class not found)", e );
- } catch ( NoClassDefFoundError e )
- {
- log.trace( "Unable to use " + className + " as a deployment handler (dependency not found)", e );
- } catch ( InstantiationException e )
- {
- log.trace( "Unable to instantiate deployment handler " + className, e );
- } catch ( IllegalAccessException e )
- {
- log.trace( "Unable to instantiate deployment handler " + className, e );
- }
-
- return null;
- }
-
public List<File> getFiles( )
{
return files;
@@ -227,9 +177,4 @@
this.files = files;
}
- public long getTimestamp( )
- {
- return getScanner( ).getTimestamp( );
- }
-
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/Scanner.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -29,21 +29,13 @@
public interface Scanner
{
/**
- * Recursively scan directories, skipping directories in the exclusion list.
+ * Recursively scan directories.
*
* @param directories An array of the roots of the directory trees to scan
*/
public void scanDirectories( File[] directories );
/**
- * Recursively scan directories, skipping directories in the exclusion list.
- *
- * @param directories An array of the roots of the directory trees to scan
- * @param excludedDirectories Directories to skip over during the recursive scan
- */
- public void scanDirectories( File[] directories, File[] excludedDirectories );
-
- /**
* Scan for structures which contain any of the given resources in their root
*
* @param resources The resources to scan for
@@ -55,5 +47,4 @@
*/
public DeploymentStrategy getDeploymentStrategy( );
- public long getTimestamp( );
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/SimpleWebBeansDeploymentHandler.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -16,10 +16,6 @@
*/
package org.jboss.webbeans.environment.se.deployment;
-import java.lang.annotation.Annotation;
-import java.util.Collections;
-import java.util.Set;
-
/**
* The {@link SimpleWebBeansDeploymentHandler} processes all classes found in a
* Web Beans archive/folder.
@@ -31,32 +27,4 @@
public class SimpleWebBeansDeploymentHandler
extends AbstractClassDeploymentHandler
{
- public static ClassDeploymentMetadata NAME_ANNOTATED_CLASS_METADATA =
- new ClassDeploymentMetadata( )
- {
- public Set<Class<?extends Annotation>> getClassAnnotatedWith( )
- {
- return Collections.EMPTY_SET;
- }
-
- public String getFileNameSuffix( )
- {
- return null;
- }
- };
-
- /**
- * Name under which this {@link DeploymentHandler} is registered
- */
- public static final String NAME = "org.jboss.webbeans.environment.se.deployment.SimpleWebBeansDeploymentHandler";
-
- public String getName( )
- {
- return NAME;
- }
-
- public ClassDeploymentMetadata getMetadata( )
- {
- return NAME_ANNOTATED_CLASS_METADATA;
- }
}
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java 2009-03-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -38,19 +38,6 @@
*/
public static final String[] RESOURCE_NAMES = { "beans.xml" };
- /**
- * The contextual variable name this deployment strategy is made available at
- * during Seam startup.
- */
- public static final String NAME = "deploymentStrategy";
-
- /**
- * The key under which to list extra deployment handlers.
- *
- * This can be specified as a System property or in
- * /META-INF/seam-deployment.properties
- */
- public static final String HANDLERS_KEY = "org.jboss.webbeans.environment.se.deployment.deploymentHandlers";
private SimpleWebBeansDeploymentHandler simpleWebBeansDeploymentHandler;
private WebBeansXmlDeploymentHandler webBeansXmlDeploymentHandler;
@@ -61,9 +48,9 @@
{
this.classLoader = Thread.currentThread( ).getContextClassLoader( );
simpleWebBeansDeploymentHandler = new SimpleWebBeansDeploymentHandler( );
- getDeploymentHandlers( ).put( SimpleWebBeansDeploymentHandler.NAME, simpleWebBeansDeploymentHandler );
+ getDeploymentHandlers( ).add( simpleWebBeansDeploymentHandler );
webBeansXmlDeploymentHandler = new WebBeansXmlDeploymentHandler( );
- getDeploymentHandlers( ).put( WebBeansXmlDeploymentHandler.NAME, webBeansXmlDeploymentHandler );
+ getDeploymentHandlers( ).add( webBeansXmlDeploymentHandler );
}
@Override
@@ -72,12 +59,6 @@
return classLoader;
}
- @Override
- protected String getDeploymentHandlersKey( )
- {
- return HANDLERS_KEY;
- }
-
/**
* Get all annotated components known to this strategy
*/
@@ -104,13 +85,4 @@
getScanner( ).scanDirectories( getFiles( ).toArray( new File[0] ) );
}
- // TODO (PR): what's the equivalent for Web Beans?
-// public static StandardDeploymentStrategy instance()
-// {
-// if (Contexts.getEventContext().isSet(NAME))
-// {
-// return (StandardDeploymentStrategy) Contexts.getEventContext().get(NAME);
-// }
-// return null;
-// }
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/URLScanner.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -44,25 +44,18 @@
extends AbstractScanner
{
private static final LogProvider log = Logging.getLogProvider( URLScanner.class );
- private long timestamp;
public URLScanner( DeploymentStrategy deploymentStrategy )
{
super( deploymentStrategy );
}
+ @Override
public void scanDirectories( File[] directories )
{
- scanDirectories( directories,
- new File[0] );
- }
-
- @Override
- public void scanDirectories( File[] directories, File[] excludedDirectories )
- {
for ( File directory : directories )
{
- handleDirectory( directory, null, excludedDirectories );
+ handleDirectory( directory, null );
}
}
@@ -145,7 +138,6 @@
try
{
log.trace( "archive: " + file );
- touchTimestamp( file );
ZipFile zip = new ZipFile( file );
Enumeration<?extends ZipEntry> entries = zip.entries( );
@@ -192,26 +184,10 @@
handleDirectory( child, newPath, excludedDirectories );
} else
{
- if ( handle( newPath ) )
- {
- // only try to update the timestamp on this scanner if the file was actually handled
- touchTimestamp( child );
- }
+ handle( newPath );
}
}
}
- private void touchTimestamp( File file )
- {
- if ( file.lastModified( ) > timestamp )
- {
- timestamp = file.lastModified( );
- }
- }
- @Override
- public long getTimestamp( )
- {
- return timestamp;
- }
}
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-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansXmlDeploymentHandler.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -26,27 +26,5 @@
public class WebBeansXmlDeploymentHandler
extends AbstractDeploymentHandler
{
- private static DeploymentMetadata WEBBEANSXML_SUFFIX_FILE_METADATA =
- new DeploymentMetadata( )
- {
- public String getFileNameSuffix( )
- {
- return "beans.xml";
- }
- };
- /**
- * Name under which this {@link DeploymentHandler} is registered
- */
- public static final String NAME = "org.jboss.webbeans.environment.se.deployment.WebBeansXmlDeploymentHandler";
-
- public String getName( )
- {
- return NAME;
- }
-
- public DeploymentMetadata getMetadata( )
- {
- return WEBBEANSXML_SUFFIX_FILE_METADATA;
- }
}
Copied: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/ApplicationLifecycle.java (from rev 1747, extensions/trunk/se/src/main/java/org/jboss/webbeans/lifecycle/ApplicationLifecycle.java)
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/ApplicationLifecycle.java (rev 0)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/ApplicationLifecycle.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -0,0 +1,86 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.environment.se.lifecycle;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.environment.se.events.Shutdown;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * Implements the lifecycle methods for a WebBeans SE application.
+ * @author Peter Royle
+ */
+public class ApplicationLifecycle
+{
+
+ private static ApplicationLifecycle instance;
+ Log log = Logging.getLog( ApplicationLifecycle.class );
+
+
+ static
+ {
+ instance = new ApplicationLifecycle();
+ }
+
+ public static ApplicationLifecycle instance()
+ {
+ return instance;
+ }
+
+ public void initialize()
+ {
+ ManagerImpl manager = CurrentManager.rootManager();
+ if (manager == null)
+ {
+ throw new IllegalStateException( "Manager has not been initialized, " +
+ "check that Bootstrap.initialize() has run" );
+ }
+ manager.addContext( DependentContext.create() );
+ manager.addContext( ApplicationContext.create() );
+ }
+
+ public void beginApplication( String id, BeanStore applicationBeanStore )
+ {
+ log.trace( "Starting application " + id );
+ ApplicationContext.INSTANCE.setBeanStore( applicationBeanStore );
+ ApplicationContext.INSTANCE.setActive( true );
+ // TODO (PR): I have no idea if this is OK??? The WB spec says that the
+ // dependant scoe is only active when the manager is doing its work.
+ // This leaves it open for the whole duration. I guess that's about
+ // right since the main bean is in the dependant scope?
+ DependentContext.INSTANCE.setActive( true );
+ }
+
+ public void endApplication( String id, BeanStore applicationBeanStore )
+ {
+ log.trace( "Ending application " + id );
+
+ // Give apps and modules a chance to shutdown cleanly
+ CurrentManager.rootManager().fireEvent( new Shutdown() );
+
+ ApplicationContext.INSTANCE.destroy();
+ ApplicationContext.INSTANCE.setActive( false );
+ ApplicationContext.INSTANCE.setBeanStore( null );
+
+ }
+
+}
Property changes on: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/lifecycle/ApplicationLifecycle.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/lifecycle/ApplicationLifecycle.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/lifecycle/ApplicationLifecycle.java 2009-03-01 20:31:32 UTC (rev 1748)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/lifecycle/ApplicationLifecycle.java 2009-03-01 22:13:29 UTC (rev 1749)
@@ -1,86 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.lifecycle;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.context.ApplicationContext;
-import org.jboss.webbeans.context.DependentContext;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.environment.se.events.Shutdown;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * Implements the lifecycle methods for a WebBeans SE application.
- * @author Peter Royle
- */
-public class ApplicationLifecycle
-{
-
- private static ApplicationLifecycle instance;
- Log log = Logging.getLog( ApplicationLifecycle.class );
-
-
- static
- {
- instance = new ApplicationLifecycle();
- }
-
- public static ApplicationLifecycle instance()
- {
- return instance;
- }
-
- public void initialize()
- {
- ManagerImpl manager = CurrentManager.rootManager();
- if (manager == null)
- {
- throw new IllegalStateException( "Manager has not been initialized, " +
- "check that Bootstrap.initialize() has run" );
- }
- manager.addContext( DependentContext.create() );
- manager.addContext( ApplicationContext.create() );
- }
-
- public void beginApplication( String id, BeanStore applicationBeanStore )
- {
- log.trace( "Starting application " + id );
- ApplicationContext.INSTANCE.setBeanStore( applicationBeanStore );
- ApplicationContext.INSTANCE.setActive( true );
- // TODO (PR): I have no idea if this is OK??? The WB spec says that the
- // dependant scoe is only active when the manager is doing its work.
- // This leaves it open for the whole duration. I guess that's about
- // right since the main bean is in the dependant scope?
- DependentContext.INSTANCE.setActive( true );
- }
-
- public void endApplication( String id, BeanStore applicationBeanStore )
- {
- log.trace( "Ending application " + id );
-
- // Give apps and modules a chance to shutdown cleanly
- CurrentManager.rootManager().fireEvent( new Shutdown() );
-
- ApplicationContext.INSTANCE.destroy();
- ApplicationContext.INSTANCE.setActive( false );
- ApplicationContext.INSTANCE.setBeanStore( null );
-
- }
-
-}
More information about the weld-commits
mailing list