You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/12/10 09:08:18 UTC

svn commit: r602803 [2/2] - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/assembler/classic/ main/java/org/apache/openejb/config/ main/java/org/apache/openejb/util/ main/resources/org/apache/openejb/config/rules/ t...

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java?rev=602803&r1=602802&r2=602803&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java Mon Dec 10 00:07:48 2007
@@ -27,11 +27,68 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
 
 /**
  * Swiped verbatim from ActiveMQ... the URI kings.
+ *
+ * URI relativize(URI, URI) added afterwards to deal with the
+ * non-functional URI.relativize(URI) method
  */
 public class URISupport {
+
+    /**
+     * URI absoluteA = new URI("/Users/dblevins/work/openejb3/container/openejb-jee/apple/");
+     * URI absoluteB = new URI("/Users/dblevins/work/openejb3/container/openejb-core/foo.jar");
+     *
+     * URI relativeB = URISupport.relativize(absoluteA, absoluteB);
+     *
+     * assertEquals("../../openejb-core/foo.jar", relativeB.toString());
+     *
+     * URI resolvedB = absoluteA.resolve(relativeB);
+     * assertTrue(resolvedB.equals(absoluteB));
+     *
+     * @param a
+     * @param b
+     * @return relative b
+     */
+    public static URI relativize(URI a, URI b) {
+        if (a == null || b == null) return b;
+
+        if (!a.isAbsolute() && b.isAbsolute()) return b;
+
+        if (!b.isAbsolute()) b = a.resolve(b);
+
+        List<String> pathA = Arrays.asList(a.getPath().split("/"));
+        List<String> pathB = Arrays.asList(b.getPath().split("/"));
+
+        int limit = Math.min(pathA.size(), pathB.size());
+
+
+        int lastMatch = 0;
+        while (lastMatch < limit) {
+            String aa = pathA.get(lastMatch);
+            String bb = pathB.get(lastMatch);
+            if (aa.equals(bb)) lastMatch++;
+            else break;
+        }
+
+        List<String> path = new ArrayList<String>();
+        for (int x = pathA.size() - lastMatch; x > 0; x--) {
+            path.add("..");
+        }
+
+        List<String> remaining = pathB.subList(lastMatch, pathB.size());
+        path.addAll(remaining);
+
+        try {
+            return new URI(null, null, Join.join("/", path), b.getQuery(), b.getFragment());
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
     public static class CompositeData {
         String scheme;
         String path;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties?rev=602803&r1=602802&r2=602803&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties Mon Dec 10 00:07:48 2007
@@ -125,106 +125,106 @@
 
 # fail("InterceptorBinding", "interceptorBinding.ejbNameRequiredWithMethod", binding.getMethod().getMethodName(), join(interceptorClasses, ","));
 1.interceptorBinding.ejbNameRequiredWithMethod = ejb-name required with method binding
-2.interceptorBinding.ejbNameRequiredWithMethod = ejb-name required with binding on method '{0}'.
-3.interceptorBinding.ejbNameRequiredWithMethod = Binding an interceptor to a specific method requires the ejb-name of the bean to also be specified.  Fix binding on method '{0}' for interceptors {1}.
+2.interceptorBinding.ejbNameRequiredWithMethod = ejb-name required with binding on method "{0}".
+3.interceptorBinding.ejbNameRequiredWithMethod = Binding an interceptor to a specific method requires the ejb-name of the bean to also be specified.  Fix binding on method "{0}" for interceptors {1}.
 
 # fail("MethodPermission", "methodPermission.ejbNameRequired", method.getMethodName(), join(permission.getRoleName(), ","));
 1.methodPermission.ejbNameRequired =  ejb-name required for method-permission
 2.methodPermission.ejbNameRequired =  ejb-name required for method-permission: {0}
-3.methodPermission.ejbNameRequired =  Assinging a method-permission requires the ejb-name of the bean to also be specified.  Fix method-permission on method '{0}' for security roles {1}.
+3.methodPermission.ejbNameRequired =  Assinging a method-permission requires the ejb-name of the bean to also be specified.  Fix method-permission on method "{0}" for security roles {1}.
 
 # fail("MethodPermission", "methodPermission.noSuchEjbName", method.getEjbName(), method.getMethodName(), join(permission.getRoleName(), ","));
 1.methodPermission.noSuchEjbName = Referenced EJB does not exist
-2.methodPermission.noSuchEjbName = Referenced EJB does not exist: {0} on method '{1}'.
-3.methodPermission.noSuchEjbName = Method-permission refers to an EJB, {0}, that does not exist.  Fix method-permission on method '{0}' for security roles {1}.
+2.methodPermission.noSuchEjbName = Referenced EJB does not exist: {0} on method "{1}".
+3.methodPermission.noSuchEjbName = Method-permission refers to an EJB, {0}, that does not exist.  Fix method-permission on method "{0}" for security roles {1}.
 
 # fail("ContainerTransaction", "containerTransaction.ejbNameRequired", method.getMethodName(), transaction.getTransAttribute());
 1.containerTransaction.ejbNameRequired = ejb-name required for container-transaction
 2.containerTransaction.ejbNameRequired = ejb-name required for container-transaction: {0}
-3.containerTransaction.ejbNameRequired = Assinging a container-transaction requires the ejb-name of the bean to also be specified.  Fix container-transaction on method '{0}' with transaction attribute {1}.
+3.containerTransaction.ejbNameRequired = Assinging a container-transaction requires the ejb-name of the bean to also be specified.  Fix container-transaction on method "{0}" with transaction attribute {1}.
 
 # fail("ContainerTransaction", "containerTransaction.noSuchEjbName", method.getMethodName(), method.getEjbName(), transaction.getTransAttribute());
 1.containerTransaction.noSuchEjbName = Referenced EJB does not exist
-2.containerTransaction.noSuchEjbName = Referenced EJB does not exist: {0} on method '{1}'.
-3.containerTransaction.noSuchEjbName = Container-transaction refers to an EJB, {0}, that does not exist.  Fix container-transaction on method '{0}' with transaction attribute {1}.
+2.containerTransaction.noSuchEjbName = Referenced EJB does not exist: {0} on method "{1}".
+3.containerTransaction.noSuchEjbName = Container-transaction refers to an EJB, {0}, that does not exist.  Fix container-transaction on method "{0}" with transaction attribute {1}.
 
 # CheckCallbacks.java
 # fail(componentName, "aroundInvoke.badReturnType", aroundInvoke.getMethodName(), returnType.getName(), aroundInvoke.getClassName());
 1.aroundInvoke.badReturnType = AroundInvoke method must return java.lang.Object
-2.aroundInvoke.badReturnType = AroundInvoke method must return java.lang.Object: method '{0}' returns '{1}'
-3.aroundInvoke.badReturnType = AroundInvoke method '{0}' in class {2} illegally returns {1} instead of java.lang.Object.  Change the method signature to 'java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception'
+2.aroundInvoke.badReturnType = AroundInvoke method must return java.lang.Object: method "{0}" returns "{1}"
+3.aroundInvoke.badReturnType = AroundInvoke method "{0}" in class {2} illegally returns {1} instead of java.lang.Object.  Change the method signature to "java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception"
 
 # fail(componentName, "aroundInvoke.mustThrowException", aroundInvoke.getMethodName(), aroundInvoke.getClassName());
 1.aroundInvoke.mustThrowException = AroundInvoke method must declare 'throws Exception'
-2.aroundInvoke.mustThrowException = AroundInvoke method must declare 'throws Exception': method '{0}'
-3.aroundInvoke.mustThrowException = AroundInvoke method '{0}' must declare java.lang.Exception in the throws clause.  Change the method signature to 'java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception'
+2.aroundInvoke.mustThrowException = AroundInvoke method must declare 'throws Exception': method "{0}"
+3.aroundInvoke.mustThrowException = AroundInvoke method "{0}" must declare java.lang.Exception in the throws clause.  Change the method signature to "java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception"
 
 # fail(componentName, "aroundInvoke.missing", aroundInvoke.getMethodName(), aroundInvoke.getClassName());
 1.aroundInvoke.missing = AroundInvoke method missing
-2.aroundInvoke.missing = AroundInvoke method missing: '{0}' in class {1}
-3.aroundInvoke.missing = AroundInvoke method '{0}' not found in class {1}.  The required method signature is 'java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception'
+2.aroundInvoke.missing = AroundInvoke method missing: "{0}" in class {1}
+3.aroundInvoke.missing = AroundInvoke method "{0}" not found in class {1}.  The required method signature is "java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception"
 
 # fail(componentName, "aroundInvoke.invalidArguments", aroundInvoke.getMethodName(), getParameters(possibleMethods.get(0)), aroundInvoke.getClassName());
 1.aroundInvoke.invalidArguments = Invalid AroundInvoke arguments
 2.aroundInvoke.invalidArguments = Invalid AroundInvoke arguments: {0}({1})
-3.aroundInvoke.invalidArguments = AroundInvoke method signature '{0}({1})' in class {2} has invalid arguments.  The required method signature is 'java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception'
+3.aroundInvoke.invalidArguments = AroundInvoke method signature "{0}({1})" in class {2} has invalid arguments.  The required method signature is "java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception"
 
 # fail(componentName, "aroundInvoke.missing.possibleTypo", aroundInvoke.getMethodName(), possibleMethods.size(), aroundInvoke.getClassName());
 1.aroundInvoke.missing.possibleTypo = AroundInvoke method missing or invalid
-2.aroundInvoke.missing.possibleTypo = AroundInvoke method missing or invalid: looked for '{0}(javax.ejb.InvocationContext)' in class {2}
-3.aroundInvoke.missing.possibleTypo = AroundInvoke method missing or invalid.  There are {1} methods with the name '{0}' visible in class {2}, none have the required signature of 'java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception'
+2.aroundInvoke.missing.possibleTypo = AroundInvoke method missing or invalid: looked for "{0}(javax.ejb.InvocationContext)" in class {2}
+3.aroundInvoke.missing.possibleTypo = AroundInvoke method missing or invalid.  There are {1} methods with the name "{0}" visible in class {2}, none have the required signature of "java.lang.Object {0}(javax.ejb.InvocationContext) throws java.lang.Exception"
 
 # fail(bean, "callback.badReturnType", type, callback.getMethodName(), returnType.getName(), callback.getClassName());
 1.callback.badReturnType = {0} method must return 'void'
 2.callback.badReturnType = {0} method must return 'void': method {1} returns {2}
-3.callback.badReturnType = {0} method '{1}' in class {3} illegally returns {2} instead of void.  Change the method signature to 'void {1}()'
+3.callback.badReturnType = {0} method "{1}" in class {3} illegally returns {2} instead of void.  Change the method signature to "void {1}()"
 
 # fail(bean, "callback.missing", type, callback.getMethodName(), callback.getClassName());
 1.callback.missing = {0} method missing
-2.callback.missing = {0} method missing: '{1}' in class {2}
-3.callback.missing = {0} method '{1}' not found in class {2}.  The required method signature is 'void {1}()'
+2.callback.missing = {0} method missing: "{1}" in class {2}
+3.callback.missing = {0} method "{1}" not found in class {2}.  The required method signature is "void {1}()"
 
 # fail(bean, "callback.invalidArguments", type, callback.getMethodName(), getParameters(possibleMethods.get(0)), callback.getClassName());
 1.callback.invalidArguments = Invalid {0} arguments
 2.callback.invalidArguments = Invalid {0} arguments: {1}({2})
-3.callback.invalidArguments = {0} method signature '{1}({2})' in class {3} has invalid arguments.  The required method signature is 'void {1}()'
+3.callback.invalidArguments = {0} method signature "{1}({2})" in class {3} has invalid arguments.  The required method signature is "void {1}()"
 
 # fail(bean, "callback.missing.possibleTypo", type, callback.getMethodName(), possibleMethods.size(), callback.getClassName());
 1.callback.missing.possibleTypo = {0} method missing or invalid
-2.callback.missing.possibleTypo = {0} method missing or invalid: looked for 'void {1}()' in class {3}
-3.callback.missing.possibleTypo = {0} method missing or invalid.  There are {2} methods with the name '{1}' visible in class {3}, none have the required signature of 'void {0}()'
+2.callback.missing.possibleTypo = {0} method missing or invalid: looked for "void {1}()" in class {3}
+3.callback.missing.possibleTypo = {0} method missing or invalid.  There are {2} methods with the name "{1}" visible in class {3}, none have the required signature of "void {0}()"
 
 # fail("Interceptor", "interceptor.callback.badReturnType", type, callback.getMethodName(), returnType.getName(), interceptorClass.getName());
-1.interceptor.callback.badReturnType = {0} method must return 'void'
-2.interceptor.callback.badReturnType = {0} method must return 'void': method {1} returns {2} in class {}
-3.interceptor.callback.badReturnType = {0} method '{1}' in class {3} illegally returns {2} instead of void.  Change the method signature to 'void {1}(javax.ejb.InvocationContext)'
+1.interceptor.callback.badReturnType = {0} method must return "void"
+2.interceptor.callback.badReturnType = {0} method must return "void": method {1} returns {2} in class {}
+3.interceptor.callback.badReturnType = {0} method "{1}" in class {3} illegally returns {2} instead of void.  Change the method signature to "void {1}(javax.ejb.InvocationContext)"
 
 # fail("Interceptor", "interceptor.callback.missing", type, callback.getMethodName(), interceptorClass.getName());
 1.interceptor.callback.missing = {0} method missing
-2.interceptor.callback.missing = {0} method missing: '{1}' in class {2}
-3.interceptor.callback.missing = {0} method '{1}' not found in class {2}.  The required method signature is 'void {1}(javax.ejb.InvocationContext)'
+2.interceptor.callback.missing = {0} method missing: "{1}" in class {2}
+3.interceptor.callback.missing = {0} method "{1}" not found in class {2}.  The required method signature is "void {1}(javax.ejb.InvocationContext)"
 
 # fail("Interceptor", "interceptor.callback.invalidArguments", type, callback.getMethodName(), getParameters(possibleMethods.get(0)), interceptorClass.getName());
 1.interceptor.callback.invalidArguments = Invalid {0} arguments
 2.interceptor.callback.invalidArguments = Invalid {0} arguments: {1}({2}) in class {3}
-3.interceptor.callback.invalidArguments = {0} method signature '{1}({2})' in class {3} has invalid arguments.  The required method signature is 'void {1}(javax.ejb.InvocationContext)'
+3.interceptor.callback.invalidArguments = {0} method signature "{1}({2})" in class {3} has invalid arguments.  The required method signature is "void {1}(javax.ejb.InvocationContext)"
 
 # fail("Interceptor", "interceptor.callback.missing.possibleTypo", type, callback.getMethodName(), possibleMethods.size(), interceptorClass.getName());
 1.interceptor.callback.missing.possibleTypo = {0} method missing or invalid
-2.interceptor.callback.missing.possibleTypo = {0} method missing or invalid: looked for 'void {1}(javax.ejb.InvocationContext)' in class {3}
-3.interceptor.callback.missing.possibleTypo = {0} method missing or invalid.  There are {2} methods with the name '{1}' visible in class {3}, none have the required signature of 'void {0}()'
+2.interceptor.callback.missing.possibleTypo = {0} method missing or invalid: looked for "void {1}(javax.ejb.InvocationContext)" in class {3}
+3.interceptor.callback.missing.possibleTypo = {0} method missing or invalid.  There are {2} methods with the name "{1}" visible in class {3}, none have the required signature of "void {0}()"
 
 # CheckInjectionTargets.java
 # warn(bean, "injectionTarget.nameContainsSet", target.getInjectionTargetName(), shortNameInvalid, shortNameCorrect, correctName, reference.getName(), reference.getClass().getSimpleName());
 1.injectionTarget.nameContainsSet = Corrected invalid injection-target-name
 2.injectionTarget.nameContainsSet = Corrected invalid injection-target-name: {0}
-3.injectionTarget.nameContainsSet = The injection-target-name '{0}' for setter methods should not begin with 'set'.  The last portion of the name '{1}' has been automatically corrected to '{2}'.  Update the descriptor with the correct injection-target-name of '{3}' to avoid receiving this warning.  Resource to be injected is '{4}'.
+3.injectionTarget.nameContainsSet = The injection-target-name "{0}" for setter methods should not begin with "set".  The last portion of the name "{1}" has been automatically corrected to "{2}".  Update the descriptor with the correct injection-target-name of "{3}" to avoid receiving this warning.  Resource to be injected is "{4}".
 
 # CheckServiceRefs.java
 # warn(bean, "serviceRef.unsupported", ref.getName());
 1.serviceRef.unsupported = Web service refs are not yet supported
 2.serviceRef.unsupported = Web service refs are not yet supported: service-ref {0}
-3.serviceRef.unsupported = The web service ref '{0}' will be ignored as this feature is not yet implemented.  The entry 'java:comp/env/{0}' will not be available in JNDI and any associated injects will not be performed.
+3.serviceRef.unsupported = The web service ref "{0}" will be ignored as this feature is not yet implemented.  The entry "java:comp/env/{0}" will not be available in JNDI and any associated injects will not be performed.
 
 # AnnotationDeployer.java
 # fail(ejbName, "ann.remote.noAttributes", join(", ", interfaces));
@@ -239,8 +239,8 @@
 
 # fail(ejbName, "ann.remoteLocal.conflict", join(", ", interfaces));
 1.ann.remoteLocal.conflict = @Remote annotation in bean class conflicts with @Local in interface.
-2.ann.remoteLocal.conflict = @Remote annotation in bean class conflicts with @Local in interface '{0}'.
-3.ann.remoteLocal.conflict = When annotating a bean class as @Remote, the corresponding business interfaces cannot be annotated with @Local.  Revise the business interface '{0}'.
+2.ann.remoteLocal.conflict = @Remote annotation in bean class conflicts with @Local in interface "{0}".
+3.ann.remoteLocal.conflict = When annotating a bean class as @Remote, the corresponding business interfaces cannot be annotated with @Local.  Revise the business interface "{0}".
 
 # fail(ejbName, "ann.local.noAttributes", join(", ", interfaces));
 1.ann.local.noAttributes = Ambiguous @Local() usage on bean class
@@ -254,8 +254,8 @@
 
 # fail(ejbName, "ann.localRemote.conflict", join(", ", interfaces));
 1.ann.localRemote.conflict = @Local annotation in bean class conflicts with @Remote in interface.
-2.ann.localRemote.conflict = @Local annotation in bean class conflicts with @Remote in interface '{0}'.
-3.ann.localRemote.conflict = When annotating a bean class as @Local, the corresponding business interfaces cannot be annotated with @Remote.  Revise the business interface '{0}'.
+2.ann.localRemote.conflict = @Local annotation in bean class conflicts with @Remote in interface "{0}".
+3.ann.localRemote.conflict = When annotating a bean class as @Local, the corresponding business interfaces cannot be annotated with @Remote.  Revise the business interface "{0}".
 
 # fail(ejbName, "ann.remoteOrLocal.ejbHome", annotationName, interfce.getName());
 1.ann.remoteOrLocal.ejbHome = @{0} used in bean class lists a javax.ejb.EJBHome interface.
@@ -269,15 +269,165 @@
 
 # fail(ejbName, "ann.remoteOrLocal.ejbObject", annotationName, interfce.getName());
 1.ann.remoteOrLocal.ejbObject = @{0} used in bean class lists a javax.ejb.EJBObject interface.
-2.ann.remoteOrLocal.ejbObject = @{0} used in bean class lists a javax.ejb.EJBObject interface. Use @RemoteHome with home interface of '{1}'.
-3.ann.remoteOrLocal.ejbObject = When applied to a bean class, the @{0} annotation must only list business interfaces and cannot list legacy EJBObject interfaces.  The EJBHome of interface for '{1}' can be annotated on the bean class with @RemoteHome
+2.ann.remoteOrLocal.ejbObject = @{0} used in bean class lists a javax.ejb.EJBObject interface. Use @RemoteHome with home interface of "{1}".
+3.ann.remoteOrLocal.ejbObject = When applied to a bean class, the @{0} annotation must only list business interfaces and cannot list legacy EJBObject interfaces.  The EJBHome of interface for "{1}" can be annotated on the bean class with @RemoteHome
 
 # fail(ejbName, "ann.remoteOrLocal.ejbLocalObject", annotationName, interfce.getName());
 1.ann.remoteOrLocal.ejbLocalObject = @{0} used in bean class lists a javax.ejb.EJBLocalObject interface.
-2.ann.remoteOrLocal.ejbLocalObject = @{0} used in bean class lists a javax.ejb.EJBLocalObject interface. Use @LocalHome with home interface of '{1}'.
-3.ann.remoteOrLocal.ejbLocalObject = When applied to a bean class, the @{0} annotation must only list business interfaces and cannot list legacy EJBLocalObject interfaces.  The EJBLocalHome of interface for '{1}' can be annotated on the bean class with @LocalHome
+2.ann.remoteOrLocal.ejbLocalObject = @{0} used in bean class lists a javax.ejb.EJBLocalObject interface. Use @LocalHome with home interface of "{1}".
+3.ann.remoteOrLocal.ejbLocalObject = When applied to a bean class, the @{0} annotation must only list business interfaces and cannot list legacy EJBLocalObject interfaces.  The EJBLocalHome of interface for "{1}" can be annotated on the bean class with @LocalHome
 
 # fail(bean, "persistenceContextExtented.nonStateful", refName, beanType);
 1.persistenceContextExtented.nonStateful = Non-Stateful use of PersistenceContextType.EXTENDED
 2.persistenceContextExtented.nonStateful = Non-Stateful use of PersistenceContextType.EXTENDED in ref {0}
-3.persistenceContextExtented.nonStateful = {1} ejbs are not capable of using EntityManagers with EXTENTED persistence.  Convert your bean to a Stateful ejb or update the '{0}' PersistenceContext reference to PersistenceContextType.TRANSACTION.  
\ No newline at end of file
+3.persistenceContextExtented.nonStateful = {1} ejbs are not capable of using EntityManagers with EXTENTED persistence.  Convert your bean to a Stateful ejb or update the "{0}" PersistenceContext reference to PersistenceContextType.TRANSACTION.
+
+# fail(consumer.getJndiConsumerName(), "resourceRef.onEntityManager", refName);
+1.resourceRef.onEntityManager = Mistaken use of @Resource on an EntityManager reference.  Use @PersistenceContext.
+2.resourceRef.onEntityManager = Mistaken use of @Resource on an EntityManager reference.  Use @PersistenceContext for ref "{0}"
+3.resourceRef.onEntityManager = The @Resource annotation cannot be used on references to javax.persistence.EntityManager.  Change the annotation to @PersistenceContext for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "resourceRef.onEntityManagerFactory", refName);
+1.resourceRef.onEntityManagerFactory = Mistaken use of @Resource on an EntityManagerFactory reference.  Use @PersistenceUnit.
+2.resourceRef.onEntityManagerFactory = Mistaken use of @Resource on an EntityManagerFactory reference.  Use @PersistenceUnit for ref "{0}"
+3.resourceRef.onEntityManagerFactory = The @Resource annotation cannot be used on references to javax.persistence.EntityManagerFactory.  Change the annotation to @PersistenceUnit for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "ejbAnnotation.onClassWithNoBeanInterface");
+1.ejbAnnotation.onClassWithNoBeanInterface = Missing required "beanInterface" attribute on class-level @EJB usage
+2.ejbAnnotation.onClassWithNoBeanInterface = Missing required "beanInterface" attribute on class-level @EJB usage
+3.ejbAnnotation.onClassWithNoBeanInterface = The "beanInterface" attribute was not specified for the class level annotation @EJB. It is mandatory for all class level @EJB annotations.
+
+# fail(consumer.getJndiConsumerName(), "ejbAnnotation.onClassWithNoName");
+1.ejbAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @EJB usage
+2.ejbAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @EJB usage
+3.ejbAnnotation.onClassWithNoName = The "name" attribute was not specified for the class level annotation @EJB. It is mandatory for all class level @EJB annotations.
+
+# fail(consumer.getJndiConsumerName(), "presistenceContextAnnotation.onEntityManagerFactory", persistenceContextRef.getName());
+1.presistenceContextAnnotation.onEntityManagerFactory = Mistaken use of @PersistenceContext on an EntityManagerFactory reference.  Use @PersistenceUnit.
+2.presistenceContextAnnotation.onEntityManagerFactory = Mistaken use of @PersistenceContext on an EntityManagerFactory reference.  Use @PersistenceUnit for ref "{0}"
+3.presistenceContextAnnotation.onEntityManagerFactory =  The @PersistenceContext annotation only applies to javax.persistence.EntityManager and cannot be used on references to javax.persistence.EntityManagerFactory.  Change the annotation to @PersistenceUnit for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "presistenceContextAnnotation.onNonEntityManager", persistenceContextRef.getName());
+1.presistenceContextAnnotation.onNonEntityManager = Use of @PersistenceContext only applies to EntityManager references
+2.presistenceContextAnnotation.onNonEntityManager = Use of @PersistenceContext only applies to EntityManager references.  Fix ref "{0}"
+3.presistenceContextAnnotation.onNonEntityManager = The @PersistenceContext annotation only applies to javax.persistence.EntityManager and cannot be used on references of other types.  Change the annotation for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "presistenceUnitAnnotation.onEntityManager", persistenceUnitRef.getName());
+1.presistenceUnitAnnotation.onEntityManager = Mistaken use of @PersistenceUnit on an EntityManager reference.  Use @PersistenceContext
+2.presistenceUnitAnnotation.onEntityManager = Mistaken use of @PersistenceUnit on an EntityManager reference.  Use @PersistenceContext for ref "{0}"
+3.presistenceUnitAnnotation.onEntityManager = The @PersistenceUnit annotation only applies to javax.persistence.EntityManagerFactory and cannot be used on references to javax.persistence.EntityManager.  Change the annotation to @PersistenceContext for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "presistenceUnitAnnotation.onNonEntityManagerFactory", persistenceUnitRef.getName());
+1.presistenceUnitAnnotation.onNonEntityManagerFactory = Use of @PersistenceUnit only applies to EntityManager references
+2.presistenceUnitAnnotation.onNonEntityManagerFactory = Use of @PersistenceUnit only applies to EntityManager references.  Fix ref "{0}"
+3.presistenceUnitAnnotation.onNonEntityManagerFactory = The @PersistenceUnit annotation only applies to javax.persistence.EntityManagerFactory and cannot be used on references of other types.  Change the annotation for ref "{0}"
+
+# fail(consumer.getJndiConsumerName(), "resourceAnnotation.onClassWithNoName");
+1.resourceAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @Resource usage
+2.resourceAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @Resource usage
+3.resourceAnnotation.onClassWithNoName = The "name" attribute was not specified for the class level annotation @Resource. It is mandatory for all class level @Resource annotations.
+
+# fail(consumer.getJndiConsumerName(), "resourceAnnotation.onClassWithNoType");
+1.resourceAnnotation.onClassWithNoType = Missing required "type" attribute on class-level @Resource usage
+2.resourceAnnotation.onClassWithNoType = Missing required "type" attribute on class-level @Resource usage
+3.resourceAnnotation.onClassWithNoType = The "type" attribute was not specified for the class level annotation @Resource. It is mandatory for all class level @Resource annotations.
+
+# fail(consumer.getJndiConsumerName(), "presistenceContextAnnotation.onClassWithNoName", persistenceContext.unitName());
+1.presistenceContextAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @PersistenceContext usage
+2.presistenceContextAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @PersistenceContext usage.
+3.presistenceContextAnnotation.onClassWithNoName = The "name" attribute was not specified for the class level annotation @PersistenceContext with unitName="{0}". It is mandatory for all class level @PersistenceContext annotations.
+
+# fail(consumer.getJndiConsumerName(), "presistenceUnitAnnotation.onClassWithNoName", persistenceUnit.unitName());
+1.presistenceUnitAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @PersistenceUnit usage
+2.presistenceUnitAnnotation.onClassWithNoName = Missing required "name" attribute on class-level @PersistenceUnit usage.
+3.presistenceUnitAnnotation.onClassWithNoName = The "name" attribute was not specified for the class level annotation @PersistenceUnit with unitName="{0}". It is mandatory for all class level @PersistenceUnit annotations.
+
+
+# AutoConfig.java
+# fail(componentName, "persistenceContextRef.noPersistenceUnits", refShortName, unitName);
+1.persistenceContextRef.noPersistenceUnits = Missing required persistence.xml for @PersistenceContext ref
+2.persistenceContextRef.noPersistenceUnits = Missing required persistence.xml for @PersistenceContext ref "{0}" to unit "{1}"
+3.persistenceContextRef.noPersistenceUnits = A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "{0}" to unit "{1}".  An example of a suitable persistence.xml might be:\
+  <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">\
+    <persistence-unit name="{1}">\
+      <jta-data-source>java:openejb/Resource/myDataSource</jta-data-source>\
+      <non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source>\
+\
+        <properties>\
+        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>\
+      </properties>\
+    </persistence-unit>\
+  </persistence>\
+
+
+# fail(componentName, "persistenceContextRef.noUnitName", refShortName, join(", ", availableUnits), sampleUnitName );
+1.persistenceContextRef.noUnitName = @PersistenceContext unitName required, multiple units available.
+2.persistenceContextRef.noUnitName = @PersistenceContext unitName required, multiple units available: ref "{0}", available units [{1}]
+3.persistenceContextRef.noUnitName = Use of @PersistenceContext witout a unitName is only allowed when there is only a single persistence.xml in the entire application defining exactly one persistence-unit.  Available units for ref {0} are [{1}].  Add the unitName to your declaration, for example:\
+    @PersistenceContext(name="{0}", unitName = "{2}")
+
+# fail(componentName, "persistenceContextRef.vagueMatches", refShortName, unitName, possibleUnits.size(), join(", ", possibleUnits));
+1.persistenceContextRef.vagueMatches = @PersistenceContext unitName has multiple matches.
+2.persistenceContextRef.vagueMatches = @PersistenceContext unitName has multiple matches: unitName "{1}" has {2} possible matches.
+3.persistenceContextRef.vagueMatches = The reference @PersistenceContext(name="{0}", unitName="{1}") cannot be resolved as there are {2} units with the same name.  Update your unitName to one of the following:\
+{3}
+
+# fail(componentName, "persistenceContextRef.noMatches", refShortName, unitName, join(", ", availableUnits));
+1.persistenceContextRef.noMatches = Persistence unit not found
+2.persistenceContextRef.noMatches = Persistence unit not found: @PersistenceContext(name="{0}", unitName="{1}").  Available units [{1}]
+3.persistenceContextRef.noMatches = The persistence unit "{1}" does not exist.  Update the "{0}" PersistenceContext ref to one of the available units [{1}] or declare the unit in a persistence.xml like the following:\
+  <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">\
+    <persistence-unit name="{1}">\
+      <jta-data-source>java:openejb/Resource/myDataSource</jta-data-source>\
+      <non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source>\
+\
+        <properties>\
+        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>\
+      </properties>\
+    </persistence-unit>\
+  </persistence>\
+
+
+# fail(componentName, "persistenceUnitRef.noPersistenceUnits", refShortName, unitName);
+1.persistenceUnitRef.noPersistenceUnits = Missing required persistence.xml for @PersistenceUnit ref
+2.persistenceUnitRef.noPersistenceUnits = Missing required persistence.xml for @PersistenceUnit ref "{0}" to unit "{1}"
+3.persistenceUnitRef.noPersistenceUnits = A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceUnit ref "{0}" to unit "{1}".  An example of a suitable persistence.xml might be:\
+  <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">\
+    <persistence-unit name="{1}">\
+      <jta-data-source>java:openejb/Resource/myDataSource</jta-data-source>\
+      <non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source>\
+\
+        <properties>\
+        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>\
+      </properties>\
+    </persistence-unit>\
+  </persistence>\
+
+
+# fail(componentName, "persistenceUnitRef.noUnitName", refShortName, join(", ", availableUnits), sampleUnitName );
+1.persistenceUnitRef.noUnitName = @PersistenceUnit unitName required, multiple units available.
+2.persistenceUnitRef.noUnitName = @PersistenceUnit unitName required, multiple units available: ref "{0}", available units [{1}]
+3.persistenceUnitRef.noUnitName = Use of @PersistenceUnit witout a unitName is only allowed when there is only a single persistence.xml in the entire application defining exactly one persistence-unit.  Available units for ref {0} are [{1}].  Add the unitName to your declaration, for example:\
+    @PersistenceUnit(name="{0}", unitName = "{2}")
+
+# fail(componentName, "persistenceUnitRef.vagueMatches", refShortName, unitName, possibleUnits.size(), join(", ", possibleUnits));
+1.persistenceUnitRef.vagueMatches = @PersistenceUnit unitName has multiple matches.
+2.persistenceUnitRef.vagueMatches = @PersistenceUnit unitName has multiple matches: unitName "{1}" has {2} possible matches.
+3.persistenceUnitRef.vagueMatches = The reference @PersistenceUnit(name="{0}", unitName="{1}") cannot be resolved as there are {2} units with the same name.  Update your unitName to one of the following:\
+{3}
+
+# fail(componentName, "persistenceUnitRef.noMatches", refShortName, unitName, join(", ", availableUnits));
+1.persistenceUnitRef.noMatches = Persistence unit not found
+2.persistenceUnitRef.noMatches = Persistence unit not found: @PersistenceUnit(name="{0}", unitName="{1}").  Available units [{1}]
+3.persistenceUnitRef.noMatches = The persistence unit "{1}" does not exist.  Update the "{0}" PersistenceUnit ref to one of the available units [{1}] or declare the unit in a persistence.xml like the following:\
+  <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">\
+    <persistence-unit name="{1}">\
+      <jta-data-source>java:openejb/Resource/myDataSource</jta-data-source>\
+      <non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source>\
+\
+        <properties>\
+        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>\
+      </properties>\
+    </persistence-unit>\
+  </persistence>\
+

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java?rev=602803&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java Mon Dec 10 00:07:48 2007
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.util;
+
+import junit.framework.TestCase;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URISupportTest extends TestCase {
+    public void test() throws Exception {
+        URI absoluteA = new URI("/Users/dblevins/work/openejb3/container/openejb-jee/apple/");
+        URI absoluteB = new URI("/Users/dblevins/work/openejb3/container/openejb-core/foo.jar");
+
+        URI relativeB = URISupport.relativize(absoluteA, absoluteB);
+
+        assertEquals("../../openejb-core/foo.jar", relativeB.toString());
+
+        URI resolvedB = absoluteA.resolve(relativeB);
+        assertTrue(resolvedB.equals(absoluteB));
+    }
+
+    public void testFragment() throws Exception {
+        URI absoluteA = new URI("/Users/dblevins/work/openejb3/container/openejb-jee/apple/");
+        URI absoluteB = new URI("/Users/dblevins/work/openejb3/container/openejb-core/foo.jar#foo");
+
+        URI relativeB = URISupport.relativize(absoluteA, absoluteB);
+
+        assertEquals("../../openejb-core/foo.jar#foo", relativeB.toString());
+
+        URI resolvedB = absoluteA.resolve(relativeB);
+        assertTrue(resolvedB.equals(absoluteB));
+    }
+
+}