[jboss-cvs] jboss-seam/src/main/org/jboss/seam/init ...
Gavin King
gavin.king at jboss.com
Sun Oct 15 17:55:41 EDT 2006
User: gavin
Date: 06/10/15 17:55:41
Modified: src/main/org/jboss/seam/init Initialization.java
Log:
package import
Revision Changes Path
1.97 +31 -6 jboss-seam/src/main/org/jboss/seam/init/Initialization.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Initialization.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/init/Initialization.java,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- Initialization.java 13 Oct 2006 05:30:26 -0000 1.96
+++ Initialization.java 15 Oct 2006 21:55:41 -0000 1.97
@@ -61,6 +61,7 @@
import org.jboss.seam.core.PageContext;
import org.jboss.seam.core.Pageflow;
import org.jboss.seam.core.Pages;
+import org.jboss.seam.core.PersistenceContexts;
import org.jboss.seam.core.PojoCache;
import org.jboss.seam.core.PooledTask;
import org.jboss.seam.core.PooledTaskInstanceList;
@@ -74,7 +75,6 @@
import org.jboss.seam.core.TaskInstance;
import org.jboss.seam.core.TaskInstanceList;
import org.jboss.seam.core.TaskInstanceListForType;
-import org.jboss.seam.core.PersistenceContexts;
import org.jboss.seam.core.Transition;
import org.jboss.seam.core.UiComponent;
import org.jboss.seam.core.UserPrincipal;
@@ -104,7 +104,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.96 $
+ * @version $Revision: 1.97 $
*/
public class Initialization
{
@@ -118,6 +118,7 @@
private List<ComponentDescriptor> componentDescriptors = new ArrayList<ComponentDescriptor>();
private List<FactoryDescriptor> factoryDescriptors = new ArrayList<FactoryDescriptor>();
private Set<Class> installedComponents = new HashSet<Class>();
+ private Set<String> importedPackages = new HashSet<String>();
public Initialization(ServletContext servletContext)
{
@@ -148,6 +149,12 @@
saxReader.setMergeAdjacentText(true);
Document doc = saxReader.read(stream);
+ List<Element> importElements = doc.getRootElement().elements("import-java-package");
+ for (Element importElement: importElements)
+ {
+ importedPackages.add( importElement.getTextTrim() );
+ }
+
List<Element> componentElements = doc.getRootElement().elements("component");
for (Element component: componentElements)
{
@@ -204,7 +211,25 @@
ScopeType scope = scopeName==null ? null : ScopeType.valueOf(scopeName.toUpperCase());
if (className!=null)
{
- Class<?> clazz = Reflections.classForName(className);
+ Class<?> clazz = null;
+ try
+ {
+ clazz = Reflections.classForName(className);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ for (String pkg: importedPackages)
+ {
+ try
+ {
+ clazz = Reflections.classForName(pkg + '.' + className);
+ break;
+ }
+ catch (Exception e) {}
+ }
+ if (clazz==null) throw cnfe;
+ }
+
if (name==null)
{
name = clazz.getAnnotation(Name.class).value();
@@ -468,7 +493,7 @@
if (isScannerEnabled)
{
- for ( Class clazz: new Scanner().getClasses() )
+ for ( Class<Object> clazz: new Scanner().getClasses() )
{
addComponent(clazz, context);
addComponentRoles(context, clazz);
More information about the jboss-cvs-commits
mailing list