Seam SVN: r8311 - in branches/Seam_2_0/src/main/org/jboss/seam: persistence and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-30 09:25:37 -0400 (Fri, 30 May 2008)
New Revision: 8311
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/Entity.java
branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
Log:
JBSEAM-3049
Modified: branches/Seam_2_0/src/main/org/jboss/seam/Entity.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/Entity.java 2008-05-30 00:11:57 UTC (rev 8310)
+++ branches/Seam_2_0/src/main/org/jboss/seam/Entity.java 2008-05-30 13:25:37 UTC (rev 8311)
@@ -158,11 +158,11 @@
{
throw new NotEntityException("Not an entity class: " + clazz.getName());
}
- String name = getModelName(clazz);
+ String name = getModelName(entityClass);
Model model = (Model) Contexts.getApplicationContext().get(name);
if (model == null || !(model instanceof Entity))
{
- Entity entity = new Entity(clazz);
+ Entity entity = new Entity(entityClass);
Contexts.getApplicationContext().set(name, entity);
return entity;
}
Modified: branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-05-30 00:11:57 UTC (rev 8310)
+++ branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-05-30 13:25:37 UTC (rev 8311)
@@ -20,6 +20,7 @@
import org.jboss.seam.Component;
import org.jboss.seam.Entity;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.Entity.NotEntityException;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -318,11 +319,20 @@
public static Class getEntityClass(Object bean)
{
- Class clazz = Hibernate.getClass(bean);
- if (clazz == null)
+ Class clazz = null;
+ try
{
clazz = Entity.forBean(bean).getBeanClass();
}
+ catch (NotEntityException e) {
+ // It's ok, try some other methods
+ }
+
+ if (clazz == null)
+ {
+ clazz = Hibernate.getClass(bean);
+ }
+
return clazz;
}
16 years, 6 months
Seam SVN: r8310 - trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-05-29 20:11:57 -0400 (Thu, 29 May 2008)
New Revision: 8310
Modified:
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
Log:
Minor bugfix
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2008-05-29 17:55:17 UTC (rev 8309)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2008-05-30 00:11:57 UTC (rev 8310)
@@ -148,7 +148,7 @@
List<BlogEntry> result = (List<BlogEntry>)query.list();
- if (countComments) {
+ if (countComments && result.size() > 0) {
// The risk here is that pager.getQueryMaxResults() is too large for the IN() operator of some DBs...
StringBuilder commentQueryString = new StringBuilder();
commentQueryString.append("select doc.NODE_ID as DOC_ID, count(c3.NODE_ID) as COMMENT_COUNT").append(" ");
16 years, 6 months
Seam SVN: r8309 - branches/Seam_2_0/src/main/org/jboss/seam/deployment.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-29 13:55:17 -0400 (Thu, 29 May 2008)
New Revision: 8309
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
Log:
oops
Modified: branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 16:24:12 UTC (rev 8308)
+++ branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 17:55:17 UTC (rev 8309)
@@ -96,12 +96,12 @@
if (isVFSAvailable() && !isEmbedded() && isJBoss5())
{
log.debug("Using VFS aware scanner on JBoss 5");
- this.scanner = new VFSScanner(this);
+ scanner = new VFSScanner(this);
}
else
{
log.debug("Using default URLScanner");
- this.scanner = new URLScanner(this);
+ scanner = new URLScanner(this);
}
}
return scanner;
16 years, 6 months
Seam SVN: r8308 - in branches/Seam_2_0: src/jbas5/META-INF and 2 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-29 12:24:12 -0400 (Thu, 29 May 2008)
New Revision: 8308
Added:
branches/Seam_2_0/src/main/org/jboss/seam/deployment/VFSScanner.java
Removed:
branches/Seam_2_0/src/jbas5/META-INF/seam-scanner.properties
branches/Seam_2_0/src/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java
Modified:
branches/Seam_2_0/build/core.pom.xml
branches/Seam_2_0/build/root.pom.xml
branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
Log:
JBSEAM-3050
Modified: branches/Seam_2_0/build/core.pom.xml
===================================================================
--- branches/Seam_2_0/build/core.pom.xml 2008-05-29 16:20:51 UTC (rev 8307)
+++ branches/Seam_2_0/build/core.pom.xml 2008-05-29 16:24:12 UTC (rev 8308)
@@ -300,6 +300,13 @@
<artifactId>hsqldb</artifactId>
<optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <optional>true</optional>
+ </dependency>
+
</dependencies>
Modified: branches/Seam_2_0/build/root.pom.xml
===================================================================
--- branches/Seam_2_0/build/root.pom.xml 2008-05-29 16:20:51 UTC (rev 8307)
+++ branches/Seam_2_0/build/root.pom.xml 2008-05-29 16:24:12 UTC (rev 8308)
@@ -712,7 +712,7 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
- <version>2.0.0.Beta7</version>
+ <version>2.0.0.Beta11</version>
</dependency>
<dependency>
Deleted: branches/Seam_2_0/src/jbas5/META-INF/seam-scanner.properties
===================================================================
--- branches/Seam_2_0/src/jbas5/META-INF/seam-scanner.properties 2008-05-29 16:20:51 UTC (rev 8307)
+++ branches/Seam_2_0/src/jbas5/META-INF/seam-scanner.properties 2008-05-29 16:24:12 UTC (rev 8308)
@@ -1 +0,0 @@
-org.jboss.seam.deployment.scanners=org.jboss.seam.as5.vfs.VFSScanner:org.jboss.seam.deployment.URLScanner
Deleted: branches/Seam_2_0/src/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java
===================================================================
--- branches/Seam_2_0/src/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java 2008-05-29 16:20:51 UTC (rev 8307)
+++ branches/Seam_2_0/src/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java 2008-05-29 16:24:12 UTC (rev 8308)
@@ -1,191 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.seam.as5.vfs;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.jboss.seam.deployment.AbstractScanner;
-import org.jboss.seam.deployment.DeploymentStrategy;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBoss VSF aware scanner.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public class VFSScanner extends AbstractScanner
-{
- private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
-
- public VFSScanner(DeploymentStrategy deploymentStrategy)
- {
- super(deploymentStrategy);
- }
-
- /**
- * Get the virtual file root.
- *
- * @param url the root URL
- * @param parentDepth level of parent depth
- * @return actual virtual file from url param
- * @throws IOException for any error
- */
- protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
- {
-
- log.trace("Root url: " + url);
-
- String urlString = url.toString();
- // TODO - this should go away once we figure out why -exp.war is part of CL resources
- if (urlString.startsWith("vfs") == false)
- return null;
-
- int p = urlString.indexOf(":");
- String file = urlString.substring(p + 1);
- URL vfsurl = null;
- String relative;
- File fp = new File(file);
-
- log.trace("File: " + fp);
-
- if (fp.exists())
- {
- vfsurl = fp.getParentFile().toURL();
- relative = fp.getName();
- }
- else
- {
- File curr = fp;
- relative = fp.getName();
- while ((curr = curr.getParentFile()) != null)
- {
- if (curr.exists())
- {
- vfsurl = curr.toURL();
- break;
- }
- else
- {
- relative = curr.getName() + "/" + relative;
- }
- }
- }
-
- log.trace("URL: " + vfsurl + ", relative: " + relative);
-
- VirtualFile top = VFS.getRoot(vfsurl);
- top = top.getChild(relative);
- while(parentDepth > 0)
- {
- if (top == null)
- throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
- top = top.getParent();
- parentDepth--;
- }
-
- log.trace("Top: " + top);
-
- return top;
- }
-
- public void scanDirectories(File[] directories)
- {
- for (File dir : directories)
- {
- try
- {
- VirtualFile root = getRoot(dir.toURL(), 0);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + dir);
- }
- catch (IOException e)
- {
- log.warn("Cannot scan directory " + dir, e);
- }
- }
- }
-
- public void scanResources(String[] resources)
- {
- for (String resourceName : resources)
- {
- try
- {
- Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
- while (urlEnum.hasMoreElements())
- {
- URL url = urlEnum.nextElement();
- VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + url);
- }
- }
- catch (IOException ioe)
- {
- log.warn("Cannot read resource: " + resourceName, ioe);
- }
- }
- }
-
- /**
- * Handle virtual file root.
- *
- * @param root the virtual file root
- * @throws IOException for any error
- */
- protected void handleRoot(VirtualFile root) throws IOException
- {
- if (root.isLeaf())
- {
- getDeploymentStrategy().handle(root.getPathName());
- }
- else
- {
- String rootPathName = root.getPathName();
- int rootPathNameLength = rootPathName.length();
- List<VirtualFile> children = root.getChildrenRecursively();
- for (VirtualFile child : children)
- {
- if (child.isLeaf())
- {
- String name = child.getPathName();
- // move past '/'
- int length = rootPathNameLength;
- if (name.charAt(length) == '/')
- length++;
- getDeploymentStrategy().handle(name.substring(length));
- }
- }
- }
- }
-}
Modified: branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 16:20:51 UTC (rev 8307)
+++ branches/Seam_2_0/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 16:24:12 UTC (rev 8308)
@@ -4,6 +4,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -91,8 +92,17 @@
}
if (scanner == null)
{
- log.debug("Using default URLScanner");
- scanner = new URLScanner(this);
+ // Use VFS Scanner if on JBoss 5 and not on Embedded
+ if (isVFSAvailable() && !isEmbedded() && isJBoss5())
+ {
+ log.debug("Using VFS aware scanner on JBoss 5");
+ this.scanner = new VFSScanner(this);
+ }
+ else
+ {
+ log.debug("Using default URLScanner");
+ this.scanner = new URLScanner(this);
+ }
}
return scanner;
}
@@ -196,4 +206,54 @@
return null;
}
+ private static boolean isVFSAvailable()
+ {
+ try
+ {
+ Class.forName("org.jboss.virtual.VFS");
+ log.trace("VFS detected");
+ return true;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
+ private static boolean isJBoss5()
+ {
+ try
+ {
+ Class versionClass = Class.forName("org.jboss.Version");
+ Method getVersionInstance = versionClass.getMethod("getInstance");
+ Object versionInstance = getVersionInstance.invoke(null);
+ Method getMajor = versionClass.getMethod("getMajor");
+ Object major = getMajor.invoke(versionInstance);
+ boolean isJBoss5 = major != null && major.equals(5);
+ if (isJBoss5)
+ {
+ log.trace("JBoss 5 detected");
+ }
+ return isJBoss5;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
+ private static boolean isEmbedded()
+ {
+ try
+ {
+ Class.forName("org.jboss.embedded.Bootstrap");
+ log.trace("JBoss Embedded detected");
+ return true;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
}
Added: branches/Seam_2_0/src/main/org/jboss/seam/deployment/VFSScanner.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/deployment/VFSScanner.java (rev 0)
+++ branches/Seam_2_0/src/main/org/jboss/seam/deployment/VFSScanner.java 2008-05-29 16:24:12 UTC (rev 8308)
@@ -0,0 +1,191 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.seam.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.jboss.seam.deployment.AbstractScanner;
+import org.jboss.seam.deployment.DeploymentStrategy;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss VSF aware scanner.
+ *
+ * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
+ */
+public class VFSScanner extends AbstractScanner
+{
+ private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
+
+ public VFSScanner(DeploymentStrategy deploymentStrategy)
+ {
+ super(deploymentStrategy);
+ }
+
+ /**
+ * Get the virtual file root.
+ *
+ * @param url the root URL
+ * @param parentDepth level of parent depth
+ * @return actual virtual file from url param
+ * @throws IOException for any error
+ */
+ protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
+ {
+
+ log.trace("Root url: " + url);
+
+ String urlString = url.toString();
+ // TODO - this should go away once we figure out why -exp.war is part of CL resources
+ if (urlString.startsWith("vfs") == false)
+ return null;
+
+ int p = urlString.indexOf(":");
+ String file = urlString.substring(p + 1);
+ URL vfsurl = null;
+ String relative;
+ File fp = new File(file);
+
+ log.trace("File: " + fp);
+
+ if (fp.exists())
+ {
+ vfsurl = fp.getParentFile().toURL();
+ relative = fp.getName();
+ }
+ else
+ {
+ File curr = fp;
+ relative = fp.getName();
+ while ((curr = curr.getParentFile()) != null)
+ {
+ if (curr.exists())
+ {
+ vfsurl = curr.toURL();
+ break;
+ }
+ else
+ {
+ relative = curr.getName() + "/" + relative;
+ }
+ }
+ }
+
+ log.trace("URL: " + vfsurl + ", relative: " + relative);
+
+ VirtualFile top = VFS.getRoot(vfsurl);
+ top = top.getChild(relative);
+ while(parentDepth > 0)
+ {
+ if (top == null)
+ throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
+ top = top.getParent();
+ parentDepth--;
+ }
+
+ log.trace("Top: " + top);
+
+ return top;
+ }
+
+ public void scanDirectories(File[] directories)
+ {
+ for (File dir : directories)
+ {
+ try
+ {
+ VirtualFile root = getRoot(dir.toURL(), 0);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + dir);
+ }
+ catch (IOException e)
+ {
+ log.warn("Cannot scan directory " + dir, e);
+ }
+ }
+ }
+
+ public void scanResources(String[] resources)
+ {
+ for (String resourceName : resources)
+ {
+ try
+ {
+ Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
+ while (urlEnum.hasMoreElements())
+ {
+ URL url = urlEnum.nextElement();
+ VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + url);
+ }
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot read resource: " + resourceName, ioe);
+ }
+ }
+ }
+
+ /**
+ * Handle virtual file root.
+ *
+ * @param root the virtual file root
+ * @throws IOException for any error
+ */
+ protected void handleRoot(VirtualFile root) throws IOException
+ {
+ if (root.isLeaf())
+ {
+ getDeploymentStrategy().handle(root.getPathName());
+ }
+ else
+ {
+ String rootPathName = root.getPathName();
+ int rootPathNameLength = rootPathName.length();
+ List<VirtualFile> children = root.getChildrenRecursively();
+ for (VirtualFile child : children)
+ {
+ if (child.isLeaf())
+ {
+ String name = child.getPathName();
+ // move past '/'
+ int length = rootPathNameLength;
+ if (name.charAt(length) == '/')
+ length++;
+ getDeploymentStrategy().handle(name.substring(length));
+ }
+ }
+ }
+ }
+}
Property changes on: branches/Seam_2_0/src/main/org/jboss/seam/deployment/VFSScanner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 6 months
Seam SVN: r8307 - trunk/build.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-29 12:20:51 -0400 (Thu, 29 May 2008)
New Revision: 8307
Modified:
trunk/build/core.pom.xml
Log:
minor
Modified: trunk/build/core.pom.xml
===================================================================
--- trunk/build/core.pom.xml 2008-05-29 16:14:32 UTC (rev 8306)
+++ trunk/build/core.pom.xml 2008-05-29 16:20:51 UTC (rev 8307)
@@ -304,6 +304,7 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
16 years, 6 months
Seam SVN: r8306 - in trunk: src/interop/jbas5/META-INF and 2 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-29 12:14:32 -0400 (Thu, 29 May 2008)
New Revision: 8306
Added:
trunk/src/main/org/jboss/seam/deployment/VFSScanner.java
Removed:
trunk/src/interop/jbas5/META-INF/seam-deployment.properties
trunk/src/interop/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java
Modified:
trunk/build/core.pom.xml
trunk/build/root.pom.xml
trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
Log:
JBSEAM-3050
Modified: trunk/build/core.pom.xml
===================================================================
--- trunk/build/core.pom.xml 2008-05-29 03:47:21 UTC (rev 8305)
+++ trunk/build/core.pom.xml 2008-05-29 16:14:32 UTC (rev 8306)
@@ -300,6 +300,11 @@
<artifactId>hsqldb</artifactId>
<optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </dependency>
</dependencies>
Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml 2008-05-29 03:47:21 UTC (rev 8305)
+++ trunk/build/root.pom.xml 2008-05-29 16:14:32 UTC (rev 8306)
@@ -782,7 +782,7 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
- <version>2.0.0.Beta7</version>
+ <version>2.0.0.Beta11</version>
</dependency>
<dependency>
Deleted: trunk/src/interop/jbas5/META-INF/seam-deployment.properties
===================================================================
--- trunk/src/interop/jbas5/META-INF/seam-deployment.properties 2008-05-29 03:47:21 UTC (rev 8305)
+++ trunk/src/interop/jbas5/META-INF/seam-deployment.properties 2008-05-29 16:14:32 UTC (rev 8306)
@@ -1 +0,0 @@
-org.jboss.seam.deployment.scanners=org.jboss.seam.as5.vfs.VFSScanner
Deleted: trunk/src/interop/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java
===================================================================
--- trunk/src/interop/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java 2008-05-29 03:47:21 UTC (rev 8305)
+++ trunk/src/interop/jbas5/org/jboss/seam/as5/vfs/VFSScanner.java 2008-05-29 16:14:32 UTC (rev 8306)
@@ -1,191 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.seam.as5.vfs;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.jboss.seam.deployment.AbstractScanner;
-import org.jboss.seam.deployment.DeploymentStrategy;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBoss VSF aware scanner.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public class VFSScanner extends AbstractScanner
-{
- private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
-
- public VFSScanner(DeploymentStrategy deploymentStrategy)
- {
- super(deploymentStrategy);
- }
-
- /**
- * Get the virtual file root.
- *
- * @param url the root URL
- * @param parentDepth level of parent depth
- * @return actual virtual file from url param
- * @throws IOException for any error
- */
- protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
- {
-
- log.trace("Root url: " + url);
-
- String urlString = url.toString();
- // TODO - this should go away once we figure out why -exp.war is part of CL resources
- if (urlString.startsWith("vfs") == false)
- return null;
-
- int p = urlString.indexOf(":");
- String file = urlString.substring(p + 1);
- URL vfsurl = null;
- String relative;
- File fp = new File(file);
-
- log.trace("File: " + fp);
-
- if (fp.exists())
- {
- vfsurl = fp.getParentFile().toURL();
- relative = fp.getName();
- }
- else
- {
- File curr = fp;
- relative = fp.getName();
- while ((curr = curr.getParentFile()) != null)
- {
- if (curr.exists())
- {
- vfsurl = curr.toURL();
- break;
- }
- else
- {
- relative = curr.getName() + "/" + relative;
- }
- }
- }
-
- log.trace("URL: " + vfsurl + ", relative: " + relative);
-
- VirtualFile top = VFS.getRoot(vfsurl);
- top = top.getChild(relative);
- while(parentDepth > 0)
- {
- if (top == null)
- throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
- top = top.getParent();
- parentDepth--;
- }
-
- log.trace("Top: " + top);
-
- return top;
- }
-
- public void scanDirectories(File[] directories)
- {
- for (File dir : directories)
- {
- try
- {
- VirtualFile root = getRoot(dir.toURL(), 0);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + dir);
- }
- catch (IOException e)
- {
- log.warn("Cannot scan directory " + dir, e);
- }
- }
- }
-
- public void scanResources(String[] resources)
- {
- for (String resourceName : resources)
- {
- try
- {
- Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
- while (urlEnum.hasMoreElements())
- {
- URL url = urlEnum.nextElement();
- VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + url);
- }
- }
- catch (IOException ioe)
- {
- log.warn("Cannot read resource: " + resourceName, ioe);
- }
- }
- }
-
- /**
- * Handle virtual file root.
- *
- * @param root the virtual file root
- * @throws IOException for any error
- */
- protected void handleRoot(VirtualFile root) throws IOException
- {
- if (root.isLeaf())
- {
- getDeploymentStrategy().handle(root.getPathName());
- }
- else
- {
- String rootPathName = root.getPathName();
- int rootPathNameLength = rootPathName.length();
- List<VirtualFile> children = root.getChildrenRecursively();
- for (VirtualFile child : children)
- {
- if (child.isLeaf())
- {
- String name = child.getPathName();
- // move past '/'
- int length = rootPathNameLength;
- if (name.charAt(length) == '/')
- length++;
- getDeploymentStrategy().handle(name.substring(length));
- }
- }
- }
- }
-}
Modified: trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 03:47:21 UTC (rev 8305)
+++ trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-05-29 16:14:32 UTC (rev 8306)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -188,8 +189,17 @@
return;
}
}
- log.debug("Using default URLScanner");
- this.scanner = new URLScanner(this);
+ // Use VFS Scanner if on JBoss 5 and not on Embedded
+ if (isVFSAvailable() && !isEmbedded() && isJBoss5())
+ {
+ log.debug("Using VFS aware scanner on JBoss 5");
+ this.scanner = new VFSScanner(this);
+ }
+ else
+ {
+ log.debug("Using default URLScanner");
+ this.scanner = new URLScanner(this);
+ }
}
private Scanner instantiateScanner(String className)
@@ -283,4 +293,54 @@
return null;
}
+ private static boolean isVFSAvailable()
+ {
+ try
+ {
+ Class.forName("org.jboss.virtual.VFS");
+ log.trace("VFS detected");
+ return true;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
+ private static boolean isJBoss5()
+ {
+ try
+ {
+ Class versionClass = Class.forName("org.jboss.Version");
+ Method getVersionInstance = versionClass.getMethod("getInstance");
+ Object versionInstance = getVersionInstance.invoke(null);
+ Method getMajor = versionClass.getMethod("getMajor");
+ Object major = getMajor.invoke(versionInstance);
+ boolean isJBoss5 = major != null && major.equals(5);
+ if (isJBoss5)
+ {
+ log.trace("JBoss 5 detected");
+ }
+ return isJBoss5;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
+ private static boolean isEmbedded()
+ {
+ try
+ {
+ Class.forName("org.jboss.embedded.Bootstrap");
+ log.trace("JBoss Embedded detected");
+ return true;
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
}
Added: trunk/src/main/org/jboss/seam/deployment/VFSScanner.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/VFSScanner.java (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/VFSScanner.java 2008-05-29 16:14:32 UTC (rev 8306)
@@ -0,0 +1,191 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.seam.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.jboss.seam.deployment.AbstractScanner;
+import org.jboss.seam.deployment.DeploymentStrategy;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss VSF aware scanner.
+ *
+ * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
+ */
+public class VFSScanner extends AbstractScanner
+{
+ private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
+
+ public VFSScanner(DeploymentStrategy deploymentStrategy)
+ {
+ super(deploymentStrategy);
+ }
+
+ /**
+ * Get the virtual file root.
+ *
+ * @param url the root URL
+ * @param parentDepth level of parent depth
+ * @return actual virtual file from url param
+ * @throws IOException for any error
+ */
+ protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
+ {
+
+ log.trace("Root url: " + url);
+
+ String urlString = url.toString();
+ // TODO - this should go away once we figure out why -exp.war is part of CL resources
+ if (urlString.startsWith("vfs") == false)
+ return null;
+
+ int p = urlString.indexOf(":");
+ String file = urlString.substring(p + 1);
+ URL vfsurl = null;
+ String relative;
+ File fp = new File(file);
+
+ log.trace("File: " + fp);
+
+ if (fp.exists())
+ {
+ vfsurl = fp.getParentFile().toURL();
+ relative = fp.getName();
+ }
+ else
+ {
+ File curr = fp;
+ relative = fp.getName();
+ while ((curr = curr.getParentFile()) != null)
+ {
+ if (curr.exists())
+ {
+ vfsurl = curr.toURL();
+ break;
+ }
+ else
+ {
+ relative = curr.getName() + "/" + relative;
+ }
+ }
+ }
+
+ log.trace("URL: " + vfsurl + ", relative: " + relative);
+
+ VirtualFile top = VFS.getRoot(vfsurl);
+ top = top.getChild(relative);
+ while(parentDepth > 0)
+ {
+ if (top == null)
+ throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
+ top = top.getParent();
+ parentDepth--;
+ }
+
+ log.trace("Top: " + top);
+
+ return top;
+ }
+
+ public void scanDirectories(File[] directories)
+ {
+ for (File dir : directories)
+ {
+ try
+ {
+ VirtualFile root = getRoot(dir.toURL(), 0);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + dir);
+ }
+ catch (IOException e)
+ {
+ log.warn("Cannot scan directory " + dir, e);
+ }
+ }
+ }
+
+ public void scanResources(String[] resources)
+ {
+ for (String resourceName : resources)
+ {
+ try
+ {
+ Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
+ while (urlEnum.hasMoreElements())
+ {
+ URL url = urlEnum.nextElement();
+ VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + url);
+ }
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot read resource: " + resourceName, ioe);
+ }
+ }
+ }
+
+ /**
+ * Handle virtual file root.
+ *
+ * @param root the virtual file root
+ * @throws IOException for any error
+ */
+ protected void handleRoot(VirtualFile root) throws IOException
+ {
+ if (root.isLeaf())
+ {
+ getDeploymentStrategy().handle(root.getPathName());
+ }
+ else
+ {
+ String rootPathName = root.getPathName();
+ int rootPathNameLength = rootPathName.length();
+ List<VirtualFile> children = root.getChildrenRecursively();
+ for (VirtualFile child : children)
+ {
+ if (child.isLeaf())
+ {
+ String name = child.getPathName();
+ // move past '/'
+ int length = rootPathNameLength;
+ if (name.charAt(length) == '/')
+ length++;
+ getDeploymentStrategy().handle(name.substring(length));
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/src/main/org/jboss/seam/deployment/VFSScanner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 6 months
Seam SVN: r8305 - in trunk/src/main/org/jboss/seam: security and 1 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 23:47:21 -0400 (Wed, 28 May 2008)
New Revision: 8305
Modified:
trunk/src/main/org/jboss/seam/security-2.1.xsd
trunk/src/main/org/jboss/seam/security/Identity.java
trunk/src/main/org/jboss/seam/security/management/IdentityStore.java
Log:
minor, cleanup
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 03:29:22 UTC (rev 8304)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 03:47:21 UTC (rev 8305)
@@ -46,6 +46,9 @@
@Startup
public class Identity implements Serializable
{
+ private static final long serialVersionUID = 3751659008033189259L;
+
+ // Event keys
public static final String EVENT_LOGIN_SUCCESSFUL = "org.jboss.seam.security.loginSuccessful";
public static final String EVENT_LOGIN_FAILED = "org.jboss.seam.security.loginFailed";
public static final String EVENT_NOT_LOGGED_IN = "org.jboss.seam.security.notLoggedIn";
@@ -60,11 +63,10 @@
public static final String ROLES_GROUP = "Roles";
+ // Context variables
private static final String LOGIN_TRIED = "org.jboss.seam.security.loginTried";
private static final String SILENT_LOGIN = "org.jboss.seam.security.silentLogin";
- private static final long serialVersionUID = 3751659008033189259L;
-
private static final LogProvider log = Logging.getLogProvider(Identity.class);
private Credentials credentials;
Modified: trunk/src/main/org/jboss/seam/security/management/IdentityStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/IdentityStore.java 2008-05-29 03:29:22 UTC (rev 8304)
+++ trunk/src/main/org/jboss/seam/security/management/IdentityStore.java 2008-05-29 03:47:21 UTC (rev 8305)
@@ -1,7 +1,5 @@
package org.jboss.seam.security.management;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Modified: trunk/src/main/org/jboss/seam/security-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/security-2.1.xsd 2008-05-29 03:29:22 UTC (rev 8304)
+++ trunk/src/main/org/jboss/seam/security-2.1.xsd 2008-05-29 03:47:21 UTC (rev 8305)
@@ -66,6 +66,7 @@
<xs:attribute name="entity-manager" type="components:string"/>
<xs:attribute name="user-class" type="components:string"/>
<xs:attribute name="role-class" type="components:string"/>
+ <xs:attribute name="features" type="components:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="attlist.ldap-identity-store">
16 years, 6 months
Seam SVN: r8304 - trunk/src/remoting/org/jboss/seam/remoting.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 23:29:22 -0400 (Wed, 28 May 2008)
New Revision: 8304
Modified:
trunk/src/remoting/org/jboss/seam/remoting/InterfaceGenerator.java
Log:
allow spaces between comma-separated component names
Modified: trunk/src/remoting/org/jboss/seam/remoting/InterfaceGenerator.java
===================================================================
--- trunk/src/remoting/org/jboss/seam/remoting/InterfaceGenerator.java 2008-05-29 03:15:12 UTC (rev 8303)
+++ trunk/src/remoting/org/jboss/seam/remoting/InterfaceGenerator.java 2008-05-29 03:29:22 UTC (rev 8304)
@@ -12,6 +12,7 @@
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -72,29 +73,35 @@
{
throw new ServletException("Invalid request - no component specified");
}
-
- String[] componentNames = request.getQueryString().split("&");
- Component[] components = new Component[componentNames.length];
+
+ Set<Component> components = new HashSet<Component>();
Set<Type> types = new HashSet<Type>();
response.setContentType("text/javascript");
- for (int i = 0; i < componentNames.length; i++)
+ Enumeration e = request.getParameterNames();
+ while (e.hasMoreElements())
{
- components[i] = Component.forName(componentNames[i]);
- if (components[i] == null)
- {
+ String componentName = ((String) e.nextElement()).trim();
+
+ Component component = Component.forName(componentName);
+ if (component == null)
+ {
try
{
- Class c = Reflections.classForName(componentNames[i]);
+ Class c = Reflections.classForName(componentName);
appendClassSource(response.getOutputStream(), c, types);
}
catch (ClassNotFoundException ex)
{
- log.error(String.format("Component not found: [%s]", componentNames[i]));
+ log.error(String.format("Component not found: [%s]", componentName));
throw new ServletException("Invalid request - component not found.");
}
}
+ else
+ {
+ components.add(component);
+ }
}
generateComponentInterface(components, response.getOutputStream(), types);
@@ -109,7 +116,7 @@
* @param out OutputStream The OutputStream to write the generated javascript to
* @throws IOException Thrown if there is an error writing to the OutputStream
*/
- public void generateComponentInterface(Component[] components, OutputStream out, Set<Type> types)
+ public void generateComponentInterface(Set<Component> components, OutputStream out, Set<Type> types)
throws IOException
{
for (Component c : components)
16 years, 6 months
Seam SVN: r8303 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 23:15:12 -0400 (Wed, 28 May 2008)
New Revision: 8303
Modified:
trunk/src/main/org/jboss/seam/security-2.1.xsd
Log:
added element definitions
Modified: trunk/src/main/org/jboss/seam/security-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/security-2.1.xsd 2008-05-29 02:47:23 UTC (rev 8302)
+++ trunk/src/main/org/jboss/seam/security-2.1.xsd 2008-05-29 03:15:12 UTC (rev 8303)
@@ -22,7 +22,6 @@
<xs:attributeGroup name="attlist.identity">
<xs:attribute name="authenticate-method" type="components:expressionType"/>
<xs:attribute name="remember-me" type="components:boolean"/>
- <xs:attribute name="authenticate-every-request" type="components:boolean"/>
<xs:attribute name="jaas-config-name" type="components:string"/>
</xs:attributeGroup>
@@ -30,6 +29,13 @@
<xs:attribute name="cookie-max-age" type="components:int"/>
</xs:attributeGroup>
+ <xs:element name="identity-manager">
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="security:attlist.identity-manager"/>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="jpa-identity-store">
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
@@ -37,8 +43,58 @@
</xs:complexType>
</xs:element>
+ <xs:element name="ldap-identity-store">
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="security:attlist.ldap-identity-store"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="jpa-permission-store">
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="security:attlist.jpa-permission-store"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:attributeGroup name="attlist.identity-manager">
+ <xs:attribute name="identity-store" type="components:expressionType"/>
+ <xs:attribute name="role-identity-store" type="components:expressionType"/>
+ </xs:attributeGroup>
+
<xs:attributeGroup name="attlist.jpa-identity-store">
- <xs:attribute name="account-class" type="components:string"/>
+ <xs:attribute name="entity-manager" type="components:string"/>
+ <xs:attribute name="user-class" type="components:string"/>
+ <xs:attribute name="role-class" type="components:string"/>
</xs:attributeGroup>
+ <xs:attributeGroup name="attlist.ldap-identity-store">
+ <xs:attribute name="server-address" type="components:string"/>
+ <xs:attribute name="bind-DN" type="components:string"/>
+ <xs:attribute name="bind-credentials" type="components:string"/>
+ <xs:attribute name="user-DN-prefix" type="components:string"/>
+ <xs:attribute name="user-DN-suffix" type="components:string"/>
+ <xs:attribute name="role-DN-prefix" type="components:string"/>
+ <xs:attribute name="role-DN-suffix" type="components:string"/>
+ <xs:attribute name="user-context-DN" type="components:string"/>
+ <xs:attribute name="role-context-DN" type="components:string"/>
+ <xs:attribute name="user-role-attribute" type="components:string"/>
+ <xs:attribute name="user-name-attribute" type="components:string"/>
+ <xs:attribute name="role-name-attribute" type="components:string"/>
+ <xs:attribute name="role-attribute-is-DN" type="components:boolean"/>
+ <xs:attribute name="user-object-classes" type="components:string"/>
+ <xs:attribute name="role-object-classes" type="components:string"/>
+ <xs:attribute name="enabled-attribute" type="components:string"/>
+ <xs:attribute name="search-scope" type="components:string"/>
+ <xs:attribute name="first-name-attribute" type="components:string"/>
+ <xs:attribute name="last-name-attribute" type="components:string"/>
+ <xs:attribute name="user-password-attribute" type="components:string"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="attlist.jpa-permission-store">
+ <xs:attribute name="entity-manager" type="components:string"/>
+ <xs:attribute name="user-permission-class" type="components:string"/>
+ <xs:attribute name="role-permission-class" type="components:string"/>
+ </xs:attributeGroup>
+
</xs:schema>
16 years, 6 months
Seam SVN: r8302 - in trunk/src/main/org/jboss/seam: security/management and 1 other directories.
by seam-commits@lists.jboss.org
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;
16 years, 6 months