[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Thu Jul 19 07:58:22 EDT 2007
User: gavin
Date: 07/07/19 07:58:22
Modified: src/main/org/jboss/seam Component.java
Log:
look in own namespace
javadoc
delete obsolete file
Revision Changes Path
1.273 +41 -19 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.272
retrieving revision 1.273
diff -u -b -r1.272 -r1.273
--- Component.java 19 Jul 2007 07:32:27 -0000 1.272
+++ Component.java 19 Jul 2007 11:58:22 -0000 1.273
@@ -184,6 +184,7 @@
private List<org.jboss.seam.log.Log> logInstances = new ArrayList<org.jboss.seam.log.Log>();
private Collection<Namespace> imports = new ArrayList<Namespace>();
+ private Namespace namespace;
private Class<ProxyObject> factory;
@@ -223,7 +224,7 @@
checkName();
checkNonabstract();
- initNamespaces(componentName, applicationContext);
+ initNamespace(componentName, applicationContext);
initImports(applicationContext);
initSynchronize();
initStartup();
@@ -334,7 +335,7 @@
}
}
- private void initNamespaces(String componentName, Context applicationContext)
+ private void initNamespace(String componentName, Context applicationContext)
{
if (applicationContext!=null) //for unit tests!
{
@@ -351,6 +352,7 @@
namespace = namespace.getOrCreateChild(token);
}
}
+ this.namespace = namespace;
}
}
}
@@ -2058,23 +2060,7 @@
log.debug("trying to inject with hierarchical context search: " + name);
}
boolean create = in.create() && !org.jboss.seam.contexts.Lifecycle.isDestroying();
- result = getInstance(name, create);
- if (result==null)
- {
- for ( Namespace namespace: getImports() )
- {
- result = namespace.getComponentInstance(name, create);
- if (result!=null) break;
- }
- }
- if (result==null)
- {
- for ( Namespace namespace: Init.instance().getGlobalImports() )
- {
- result = namespace.getComponentInstance(name, create);
- if (result!=null) break;
- }
- }
+ result = getInstanceInAllNamespaces(name, create);
}
else
{
@@ -2119,6 +2105,37 @@
}
}
+ private Object getInstanceInAllNamespaces(String name, boolean create)
+ {
+ Object result;
+ result = getInstance(name, create);
+ if (result==null)
+ {
+ for ( Namespace namespace: getImports() )
+ {
+ result = namespace.getComponentInstance(name, create);
+ if (result!=null) break;
+ }
+ }
+ if (result==null)
+ {
+ for ( Namespace namespace: Init.instance().getGlobalImports() )
+ {
+ result = namespace.getComponentInstance(name, create);
+ if (result!=null) break;
+ }
+ }
+ if (result==null)
+ {
+ Namespace namespace = getNamespace();
+ if (namespace!=null)
+ {
+ result = namespace.getComponentInstance(name, create);
+ }
+ }
+ return result;
+ }
+
private String getAttributeMessage(String attributeName)
{
return getName() + '.' + attributeName;
@@ -2497,4 +2514,9 @@
return imports;
}
+ public Namespace getNamespace()
+ {
+ return namespace;
+ }
+
}
More information about the jboss-cvs-commits
mailing list