Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 22:47:23 -0400 (Wed, 28 May 2008)
New Revision: 8302
Modified:
trunk/src/main/org/jboss/seam/init/Initialization.java
trunk/src/main/org/jboss/seam/init/NamespaceDescriptor.java
trunk/src/main/org/jboss/seam/security/management/package-info.java
trunk/src/main/org/jboss/seam/security/permission/package-info.java
Log:
JBSEAM-2779
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-05-29 02:46:50 UTC (rev
8301)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-05-29 02:47:23 UTC (rev
8302)
@@ -222,8 +222,22 @@
String elemName = toCamelCase(elem.getName(), true);
String className = elem.attributeValue("class");
- if (className == null) {
- className = nsInfo.getPackageName() + '.' + elemName;
+ if (className == null)
+ {
+ for (String packageName : nsInfo.getPackageNames())
+ {
+ try
+ {
+ // Try each of the packages in the namespace descriptor for a matching
class
+ className = packageName + '.' + elemName;
+ Reflections.classForName(className);
+ break;
+ }
+ catch (ClassNotFoundException ex)
+ {
+ className = null;
+ }
+ }
}
try {
@@ -805,11 +819,15 @@
log.info("Namespace: " + ns.value() + ", package: " +
pkg.getName() +
", prefix: " + ns.prefix());
- NamespaceDescriptor old = namespaceMap.put(ns.value(),
- new NamespaceDescriptor(ns, pkg));
- if (old!=null && !old.getPackageName().equals(pkg.getName())) {
- throw new IllegalStateException("two packages with the same @Namespace:
" + ns.value());
+ NamespaceDescriptor descriptor = namespaceMap.get(ns.value());
+ if (descriptor != null)
+ {
+ descriptor.addPackageName(pkg.getName());
}
+ else
+ {
+ namespaceMap.put(ns.value(), new NamespaceDescriptor(ns, pkg));
+ }
}
}
}
Modified: trunk/src/main/org/jboss/seam/init/NamespaceDescriptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/NamespaceDescriptor.java 2008-05-29 02:46:50 UTC
(rev 8301)
+++ trunk/src/main/org/jboss/seam/init/NamespaceDescriptor.java 2008-05-29 02:47:23 UTC
(rev 8302)
@@ -1,23 +1,26 @@
package org.jboss.seam.init;
+import java.util.HashSet;
+import java.util.Set;
+
import org.jboss.seam.annotations.Namespace;
class NamespaceDescriptor
{
private String namespace;
- private String packageName;
+ private Set<String> packageNames = new HashSet<String>();
private String componentPrefix;
NamespaceDescriptor(Namespace namespaceAnnotation, Package pkg)
{
this.namespace = namespaceAnnotation.value();
this.componentPrefix = namespaceAnnotation.prefix();
- this.packageName = pkg.getName();
+ packageNames.add(pkg.getName());
}
NamespaceDescriptor(String namespace, String packageName) {
this.namespace = namespace;
- this.packageName = packageName;
+ packageNames.add(packageName);
this.componentPrefix = "";
}
@@ -28,9 +31,14 @@
public String getComponentPrefix() {
return componentPrefix;
}
+
+ public void addPackageName(String packageName)
+ {
+ packageNames.add(packageName);
+ }
- public String getPackageName() {
- return packageName;
+ public Set<String> getPackageNames() {
+ return packageNames;
}
@Override
Modified: trunk/src/main/org/jboss/seam/security/management/package-info.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/package-info.java 2008-05-29
02:46:50 UTC (rev 8301)
+++ trunk/src/main/org/jboss/seam/security/management/package-info.java 2008-05-29
02:47:23 UTC (rev 8302)
@@ -3,7 +3,7 @@
*
* @see org.jboss.seam.security.management.IdentityManager
*/
-@Namespace(value="http://jboss.com/products/seam/security/management",
prefix="org.jboss.seam.security.management")
+@Namespace(value="http://jboss.com/products/seam/security",
prefix="org.jboss.seam.security")
@AutoCreate
package org.jboss.seam.security.management;
Modified: trunk/src/main/org/jboss/seam/security/permission/package-info.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/package-info.java 2008-05-29
02:46:50 UTC (rev 8301)
+++ trunk/src/main/org/jboss/seam/security/permission/package-info.java 2008-05-29
02:47:23 UTC (rev 8302)
@@ -3,7 +3,7 @@
*
* @see org.jboss.seam.security.permission.PermissionManager
*/
-@Namespace(value="http://jboss.com/products/seam/security/permission",
prefix="org.jboss.seam.security.permission")
+@Namespace(value="http://jboss.com/products/seam/security",
prefix="org.jboss.seam.security")
@AutoCreate
package org.jboss.seam.security.permission;
Show replies by date