[jboss-cvs] JBossAS SVN: r112031 - in projects/jpa/tags: 1.0.2-alpha-4 and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 12 07:38:01 EDT 2011


Author: jaikiran
Date: 2011-08-12 07:38:00 -0400 (Fri, 12 Aug 2011)
New Revision: 112031

Added:
   projects/jpa/tags/1.0.2-alpha-4/
   projects/jpa/tags/1.0.2-alpha-4/pom.xml
   projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java
Removed:
   projects/jpa/tags/1.0.2-alpha-4/pom.xml
   projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java
Modified:
   projects/jpa/tags/1.0.2-alpha-4/.classpath
   projects/jpa/tags/1.0.2-alpha-4/.project
   projects/jpa/tags/1.0.2-alpha-4/.settings/org.eclipse.jdt.core.prefs
   projects/jpa/tags/1.0.2-alpha-4/.settings/org.maven.ide.eclipse.prefs
Log:
[maven-release-plugin]  copy for tag 1.0.2-alpha-4

Modified: projects/jpa/tags/1.0.2-alpha-4/.classpath
===================================================================
--- projects/jpa/trunk/deployers/.classpath	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/.classpath	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,8 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/test/java" output="eclipse-target/tests-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="eclipse-target/tests-classes" excluding="**/*.java"/>
-  <classpathentry kind="output" path="eclipse-target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/tests-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/tests-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/jpa/tags/1.0.2-alpha-4/.project
===================================================================
--- projects/jpa/trunk/deployers/.project	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/.project	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,20 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-  <name>jboss-jpa-deployers</name>
-  <comment>The JBoss Container Managed JPA Deployers for deploying persistence units.
+	<name>jboss-jpa-deployers</name>
+	<comment>The JBoss Container Managed JPA Deployers for deploying persistence units.
     See EJB 3 JPA chapter 6 and 7.</comment>
-  <projects/>
-  <buildSpec>
-    <buildCommand>
-      <name>org.eclipse.jdt.core.javabuilder</name>
-    </buildCommand>
-    <!-- 
-    <buildCommand>
-      <name>org.maven.ide.eclipse.maven2Builder</name>
-    </buildCommand>
-    -->
-  </buildSpec>
-  <natures>
-    <nature>org.eclipse.jdt.core.javanature</nature>
-    <nature>org.maven.ide.eclipse.maven2Nature</nature>
-  </natures>
-</projectDescription>
\ No newline at end of file
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Modified: projects/jpa/tags/1.0.2-alpha-4/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jpa/trunk/deployers/.settings/org.eclipse.jdt.core.prefs	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/.settings/org.eclipse.jdt.core.prefs	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,5 +1,3 @@
-#Fri Jun 27 12:12:33 CEST 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+#Wed Nov 24 21:47:06 IST 2010
 eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

Modified: projects/jpa/tags/1.0.2-alpha-4/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jpa/trunk/deployers/.settings/org.maven.ide.eclipse.prefs	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/.settings/org.maven.ide.eclipse.prefs	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,8 +1,9 @@
-#Thu Sep 11 10:13:35 CEST 2008
-activeProfiles=eclipse
+#Sat Sep 04 13:49:08 IST 2010
+activeProfiles=
 eclipse.preferences.version=1
 fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
 version=1

Deleted: projects/jpa/tags/1.0.2-alpha-4/pom.xml
===================================================================
--- projects/jpa/trunk/deployers/pom.xml	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/pom.xml	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,166 +0,0 @@
-<!--
-  vi:ts=2:sw=2:expandtab
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss.jpa</groupId>
-    <artifactId>jboss-jpa-build</artifactId>
-    <relativePath>../build/pom.xml</relativePath>
-    <version>1.0.1</version>
-  </parent>
-
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>jboss-jpa-deployers</artifactId>
-  <version>1.0.2-alpha-4-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>JBoss Container Managed JPA Deployers</name>
-  <description>
-    The JBoss Container Managed JPA Deployers for deploying persistence units.
-    See EJB 3 JPA chapter 6 and 7.
-  </description>
-  
-  <properties>
-    <version.org.jboss.deployers>2.0.5.GA</version.org.jboss.deployers>
-    <version.switchboard>1.0.0-alpha-14</version.switchboard>
-  </properties>
-
-  <dependencies>
-    <!-- For 'mocking' a TransactionManager we use JBossTS -->
-    <dependency>
-      <groupId>jboss.jbossts</groupId>
-      <artifactId>jbossjta</artifactId>
-      <version>4.4.0.GA</version>
-      <scope>test</scope>
-    </dependency>
-  	<dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.4</version>
-      <scope>test</scope>
-    </dependency>
-    <!-- For 'mocking' a DataSource we use Derby -->
-    <dependency>
-      <groupId>org.apache.derby</groupId>
-      <artifactId>derby</artifactId>
-      <version>10.4.1.3</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-entitymanager</artifactId>
-      <version>${version.org.hibernate.hibernate-entitymanager}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.integration</groupId>
-      <artifactId>jboss-transaction-spi</artifactId>
-      <version>5.0.3.GA</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-test</artifactId>
-      <version>1.0.5.GA</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-vfs</artifactId>
-      <version>${version.org.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-vfs-spi</artifactId>
-      <version>${version.org.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.jpa</groupId>
-      <artifactId>jboss-jpa-impl</artifactId>
-      <version>1.0.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.jpa</groupId>
-      <artifactId>jboss-jpa-spi</artifactId>
-      <version>1.0.0</version>
-      <!-- TODO: we should really use the right jpa-spi -->
-      <exclusions>
-        <exclusion>
-          <groupId>org.hibernate</groupId>
-          <artifactId>ejb3-persistence</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.metadata</groupId>
-      <artifactId>jboss-metadata</artifactId>
-      <version>1.0.0.CR17</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.hibernate</groupId>
-          <artifactId>ejb3-persistence</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <!-- For @JMX -->
-    <dependency>
-      <groupId>org.jboss.microcontainer</groupId>
-      <artifactId>jboss-aop-mc-int</artifactId>
-      <version>2.0.4.GA</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.naming</groupId>
-      <artifactId>jnpserver</artifactId>
-      <version>5.0.1.GA</version>
-      <scope>test</scope>
-    </dependency>
-    
-    <!-- For Arjuna / JBoss Transaction -->
-    <dependency>
-      <groupId>apache-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.1.0.jboss</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>oswego-concurrent</groupId>
-      <artifactId>concurrent</artifactId>
-      <version>1.3.4-jboss-update1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>jboss.jbossts</groupId>
-      <artifactId>jbossts-common</artifactId>
-      <version>4.4.0.GA</version>
-      <scope>test</scope>
-    </dependency>
-    
-    <!-- Hibernate core logging -->
-    <dependency>
-      <groupId>org.jboss.slf4j</groupId>
-      <artifactId>slf4j-jboss-logging</artifactId>
-      <version>1.0.0.GA</version>
-      <scope>test</scope>
-    </dependency>
-    
-    <!-- jboss-common-core (For JNDI Utils) -->
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-common-core</artifactId>
-      <version>2.2.11.GA</version>
-    </dependency>
-
-    <dependency>
-        <groupId>org.jboss.switchboard</groupId>
-        <artifactId>jboss-switchboard-mc-spi</artifactId>
-        <version>${version.switchboard}</version>
-    </dependency>
-
-    <!-- switchboard -->
-    <dependency>
-        <groupId>org.jboss.switchboard</groupId>
-        <artifactId>jboss-switchboard-javaee</artifactId>
-        <version>${version.switchboard}</version>
-    </dependency>
-    
-
-  </dependencies>
-</project>

Copied: projects/jpa/tags/1.0.2-alpha-4/pom.xml (from rev 112029, projects/jpa/trunk/deployers/pom.xml)
===================================================================
--- projects/jpa/tags/1.0.2-alpha-4/pom.xml	                        (rev 0)
+++ projects/jpa/tags/1.0.2-alpha-4/pom.xml	2011-08-12 11:38:00 UTC (rev 112031)
@@ -0,0 +1,172 @@
+<!--
+  vi:ts=2:sw=2:expandtab
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.jpa</groupId>
+    <artifactId>jboss-jpa-build</artifactId>
+    <relativePath>../build/pom.xml</relativePath>
+    <version>1.0.1</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>jboss-jpa-deployers</artifactId>
+  <version>1.0.2-alpha-4</version>
+  <packaging>jar</packaging>
+  <name>JBoss Container Managed JPA Deployers</name>
+  <description>
+    The JBoss Container Managed JPA Deployers for deploying persistence units.
+    See EJB 3 JPA chapter 6 and 7.
+  </description>
+  
+  <properties>
+    <version.org.jboss.deployers>2.0.5.GA</version.org.jboss.deployers>
+    <version.switchboard>1.0.0-alpha-14</version.switchboard>
+  </properties>
+
+  <dependencies>
+    <!-- For 'mocking' a TransactionManager we use JBossTS -->
+    <dependency>
+      <groupId>jboss.jbossts</groupId>
+      <artifactId>jbossjta</artifactId>
+      <version>4.4.0.GA</version>
+      <scope>test</scope>
+    </dependency>
+  	<dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.4</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- For 'mocking' a DataSource we use Derby -->
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>10.4.1.3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-entitymanager</artifactId>
+      <version>${version.org.hibernate.hibernate-entitymanager}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.integration</groupId>
+      <artifactId>jboss-transaction-spi</artifactId>
+      <version>5.0.3.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.0.5.GA</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+      <version>${version.org.jboss.deployers}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs-spi</artifactId>
+      <version>${version.org.jboss.deployers}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.jpa</groupId>
+      <artifactId>jboss-jpa-impl</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.jpa</groupId>
+      <artifactId>jboss-jpa-spi</artifactId>
+      <version>1.0.0</version>
+      <!-- TODO: we should really use the right jpa-spi -->
+      <exclusions>
+        <exclusion>
+          <groupId>org.hibernate</groupId>
+          <artifactId>ejb3-persistence</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata</artifactId>
+      <version>1.0.0.CR17</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.hibernate</groupId>
+          <artifactId>ejb3-persistence</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- For @JMX -->
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-aop-mc-int</artifactId>
+      <version>2.0.4.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.naming</groupId>
+      <artifactId>jnpserver</artifactId>
+      <version>5.0.1.GA</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <!-- For Arjuna / JBoss Transaction -->
+    <dependency>
+      <groupId>apache-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1.0.jboss</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>oswego-concurrent</groupId>
+      <artifactId>concurrent</artifactId>
+      <version>1.3.4-jboss-update1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jboss.jbossts</groupId>
+      <artifactId>jbossts-common</artifactId>
+      <version>4.4.0.GA</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <!-- Hibernate core logging -->
+    <dependency>
+      <groupId>org.jboss.slf4j</groupId>
+      <artifactId>slf4j-jboss-logging</artifactId>
+      <version>1.0.0.GA</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <!-- jboss-common-core (For JNDI Utils) -->
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <version>2.2.11.GA</version>
+    </dependency>
+
+    <dependency>
+        <groupId>org.jboss.switchboard</groupId>
+        <artifactId>jboss-switchboard-mc-spi</artifactId>
+        <version>${version.switchboard}</version>
+    </dependency>
+
+    <!-- switchboard -->
+    <dependency>
+        <groupId>org.jboss.switchboard</groupId>
+        <artifactId>jboss-switchboard-javaee</artifactId>
+        <version>${version.switchboard}</version>
+    </dependency>
+    
+
+  </dependencies>
+
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jpa/tags/1.0.2-alpha-4</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jpa/tags/1.0.2-alpha-4</developerConnection>
+    <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jpa/tags/1.0.2-alpha-4</url>
+  </scm>
+</project>

Deleted: projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java	2011-08-12 11:07:10 UTC (rev 112027)
+++ projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java	2011-08-12 11:38:00 UTC (rev 112031)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.jpa.resolvers.strategy;
-
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.jpa.javaee.JavaEEModuleInformer;
-import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
-import org.jboss.metadata.jpa.spec.PersistenceMetaData;
-import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
-
-/**
- * The spec compliant persistence unit search stragegy.
- * 
- * To allow injection by class it has a base name.
- * 
- * See EJB 3.0 6.2.2.
- * 
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public abstract class BaseSearchStrategy implements SearchStrategy
-{
-   private JavaEEModuleInformer javaEEModuleInformer;
-   
-   public String findPersistenceUnitSupplier(PersistenceUnitDependencyResolver resolver, DeploymentUnit deploymentUnit, String persistenceUnitName)
-   {
-      String name = findWithinModule(resolver, deploymentUnit, persistenceUnitName, true);
-      if(name == null)
-         name = findWithinApplication(resolver, deploymentUnit.getTopLevel(), persistenceUnitName);
-      return name;
-   }
-   
-   protected String findWithinApplication(PersistenceUnitDependencyResolver resolver, DeploymentUnit unit, String persistenceUnitName)
-   {
-      String name = findWithinModule(resolver, unit, persistenceUnitName, false);
-      if(name != null)
-         return name;
-      
-      for(DeploymentUnit child : unit.getChildren())
-      {
-         name = findWithinApplication(resolver, child, persistenceUnitName);
-         if(name != null)
-            return name;
-      }
-      return null;
-   }
-   
-   /*
-    * When finding the default persistence unit, the first persistence unit encountered is returned.
-    * TODO: Maybe the name of unscoped persistence units should be changed, so only one can be deployed anyway.
-    */
-   protected String findWithinModule(PersistenceUnitDependencyResolver resolver, DeploymentUnit unit, String persistenceUnitName, boolean allowScoped)
-   {
-      if(!allowScoped && isScoped(unit))
-         return null;
-      
-      PersistenceMetaData persistenceMetaData = unit.getAttachment(PersistenceMetaData.class);
-      if(persistenceMetaData == null)
-         return null;
-      for(PersistenceUnitMetaData persistenceUnit : persistenceMetaData.getPersistenceUnits())
-      {
-         if(persistenceUnitName == null || persistenceUnitName.length() == 0 || persistenceUnit.getName().equals(persistenceUnitName))
-            return resolver.createBeanName(unit, persistenceUnit.getName());
-      }
-      return null;
-   }
-   
-   protected static DeploymentUnit getDeploymentUnit(DeploymentUnit current, String path)
-   {
-      if(path.startsWith("/"))
-         return getDeploymentUnit(current.getTopLevel(), path.substring(1));
-      if(path.startsWith("./"))
-         return getDeploymentUnit(current, path.substring(2));
-      if(path.startsWith("../"))
-         return getDeploymentUnit(current.getParent(), path.substring(3));
-      int i = path.indexOf('/');
-      String name;
-      if(i == -1)
-         name = path;
-      else
-         name = path.substring(0, i);
-      for(DeploymentUnit child : current.getChildren())
-      {
-         if(child.getSimpleName().equals(name))
-            return child;
-      }
-      throw new IllegalArgumentException("Can't find a deployment unit named " + name + " at " + current);
-   }
-   
-   /*
-    * EJB3 JPA 6.2.2: Persistence Unit Scope
-    */
-   private boolean isScoped(DeploymentUnit unit)
-   {
-      JavaEEModuleInformer.ModuleType type = javaEEModuleInformer.getModuleType(unit);
-      if(type == JavaEEModuleInformer.ModuleType.APP_CLIENT)
-         return true;
-      if(type == JavaEEModuleInformer.ModuleType.EJB)
-         return true;
-      if(type == JavaEEModuleInformer.ModuleType.WEB)
-         return true;
-      return false;
-   }
-   
-   @Inject
-   public void setJavaEEModuleInformer(JavaEEModuleInformer informer)
-   {
-      this.javaEEModuleInformer = informer;
-   }
-}

Copied: projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java (from rev 112028, projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java)
===================================================================
--- projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java	                        (rev 0)
+++ projects/jpa/tags/1.0.2-alpha-4/src/main/java/org/jboss/jpa/resolvers/strategy/BaseSearchStrategy.java	2011-08-12 11:38:00 UTC (rev 112031)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jpa.resolvers.strategy;
+
+import java.util.Set;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.jpa.javaee.JavaEEModuleInformer;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
+import org.jboss.metadata.jpa.spec.PersistenceMetaData;
+import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
+
+/**
+ * The spec compliant persistence unit search stragegy.
+ *
+ * To allow injection by class it has a base name.
+ *
+ * See EJB 3.0 6.2.2.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class BaseSearchStrategy implements SearchStrategy
+{
+   private JavaEEModuleInformer javaEEModuleInformer;
+
+   public String findPersistenceUnitSupplier(PersistenceUnitDependencyResolver resolver, DeploymentUnit deploymentUnit, String persistenceUnitName)
+   {
+      String name = findWithinModule(resolver, deploymentUnit, persistenceUnitName, true);
+      if(name == null)
+         name = findWithinApplication(resolver, deploymentUnit.getTopLevel(), persistenceUnitName);
+      return name;
+   }
+
+   protected String findWithinApplication(PersistenceUnitDependencyResolver resolver, DeploymentUnit unit, String persistenceUnitName)
+   {
+      String name = findWithinModule(resolver, unit, persistenceUnitName, false);
+      if(name != null)
+         return name;
+
+      for(DeploymentUnit child : unit.getChildren())
+      {
+         name = findWithinApplication(resolver, child, persistenceUnitName);
+         if(name != null)
+            return name;
+      }
+      return null;
+   }
+
+   /*
+    * When finding the default persistence unit, the first persistence unit encountered is returned.
+    * TODO: Maybe the name of unscoped persistence units should be changed, so only one can be deployed anyway.
+    */
+   protected String findWithinModule(PersistenceUnitDependencyResolver resolver, DeploymentUnit unit, String persistenceUnitName, boolean allowScoped)
+   {
+      if(!allowScoped && isScoped(unit))
+         return null;
+
+      Set<? extends PersistenceMetaData> set = unit.getAllMetaData(PersistenceMetaData.class);
+      if(set == null || set.isEmpty())
+         return null;
+
+      for (PersistenceMetaData persistenceMetaData : set)
+      {
+         for(PersistenceUnitMetaData persistenceUnit : persistenceMetaData.getPersistenceUnits())
+         {
+            if(persistenceUnitName == null || persistenceUnitName.length() == 0 || persistenceUnit.getName().equals(persistenceUnitName))
+               return resolver.createBeanName(unit, persistenceUnit.getName());
+         }
+      }
+      return null;
+   }
+   
+   protected static DeploymentUnit getDeploymentUnit(DeploymentUnit current, String path)
+   {
+      if(path.startsWith("/"))
+         return getDeploymentUnit(current.getTopLevel(), path.substring(1));
+      if(path.startsWith("./"))
+         return getDeploymentUnit(current, path.substring(2));
+      if(path.startsWith("../"))
+         return getDeploymentUnit(current.getParent(), path.substring(3));
+      int i = path.indexOf('/');
+      String name;
+      if(i == -1)
+         name = path;
+      else
+         name = path.substring(0, i);
+      for(DeploymentUnit child : current.getChildren())
+      {
+         if(child.getSimpleName().equals(name))
+            return child;
+      }
+      throw new IllegalArgumentException("Can't find a deployment unit named " + name + " at " + current);
+   }
+   
+   /*
+    * EJB3 JPA 6.2.2: Persistence Unit Scope
+    */
+   private boolean isScoped(DeploymentUnit unit)
+   {
+      JavaEEModuleInformer.ModuleType type = javaEEModuleInformer.getModuleType(unit);
+      if(type == JavaEEModuleInformer.ModuleType.APP_CLIENT)
+         return true;
+      if(type == JavaEEModuleInformer.ModuleType.EJB)
+         return true;
+      if(type == JavaEEModuleInformer.ModuleType.WEB)
+         return true;
+      return false;
+   }
+   
+   @Inject
+   public void setJavaEEModuleInformer(JavaEEModuleInformer informer)
+   {
+      this.javaEEModuleInformer = informer;
+   }
+}



More information about the jboss-cvs-commits mailing list