commons-attributes-2.2/ 40755 0 0 0 10464315317 12252 5ustar 0 0 commons-attributes-2.2/unittest/ 40755 0 0 0 10464315317 14131 5ustar 0 0 commons-attributes-2.2/unittest/src/ 40755 0 0 0 10464315317 14720 5ustar 0 0 commons-attributes-2.2/unittest/src/cl2/ 40755 0 0 0 10464315317 15400 5ustar 0 0 commons-attributes-2.2/unittest/src/test/ 40755 0 0 0 10464315316 15676 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/ 40755 0 0 0 10464315316 16465 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/ 40755 0 0 0 10464315316 17706 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/ 40755 0 0 0 10464315316 21361 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/ 40755 0 0 0 10464315316 23547 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/ 40755 0 0 0 10464315317 24527 5ustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/ 40755 0 0 0 10464315317 26173 5ustar 0 0 commons-attributes-2.2/unittest/src/cl1/ 40755 0 0 0 10464315317 15377 5ustar 0 0 commons-attributes-2.2/unittest/src/java/ 40755 0 0 0 10464315317 15641 5ustar 0 0 commons-attributes-2.2/compiler/ 40755 0 0 0 10464315317 14064 5ustar 0 0 commons-attributes-2.2/compiler/src/ 40755 0 0 0 10464315316 14652 5ustar 0 0 commons-attributes-2.2/compiler/src/java/ 40755 0 0 0 10464315316 15573 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/ 40755 0 0 0 10464315316 16362 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/ 40755 0 0 0 10464315316 17603 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/ 40755 0 0 0 10464315316 21256 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/ 40755 0 0 0 10464315317 23445 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/ 40755 0 0 0 10464315317 25257 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/ 40755 0 0 0 10464315317 25577 5ustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/javadoc/ 40755 0 0 0 10464315317 25054 5ustar 0 0 commons-attributes-2.2/compiler/src/test/ 40755 0 0 0 10464315316 15631 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/ 40755 0 0 0 10464315316 16420 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/ 40755 0 0 0 10464315316 17641 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/commons/ 40755 0 0 0 10464315316 21314 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/commons/attributes/ 40755 0 0 0 10464315316 23502 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/commons/attributes/compiler/ 40755 0 0 0 10464315316 25314 5ustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/commons/attributes/compiler/test/ 40755 0 0 0 10464315316 26273 5ustar 0 0 commons-attributes-2.2/compiler/target/ 40755 0 0 0 10464315317 15352 5ustar 0 0 commons-attributes-2.2/site/ 40755 0 0 0 10464315316 13215 5ustar 0 0 commons-attributes-2.2/site/xdocs/ 40755 0 0 0 10464315317 14336 5ustar 0 0 commons-attributes-2.2/site/xdocs/images/ 40755 0 0 0 10464315317 15603 5ustar 0 0 commons-attributes-2.2/site/xdocs/style/ 40755 0 0 0 10464315317 15476 5ustar 0 0 commons-attributes-2.2/site/etc/ 40755 0 0 0 10464315317 13771 5ustar 0 0 commons-attributes-2.2/site/etc/ant_demo/ 40755 0 0 0 10464315316 15556 5ustar 0 0 commons-attributes-2.2/site/etc/maven_demo/ 40755 0 0 0 10464315317 16103 5ustar 0 0 commons-attributes-2.2/site/etc/maven_demo/src/ 40755 0 0 0 10464315317 16672 5ustar 0 0 commons-attributes-2.2/api/ 40755 0 0 0 10464315317 13023 5ustar 0 0 commons-attributes-2.2/api/src/ 40755 0 0 0 10464315316 13611 5ustar 0 0 commons-attributes-2.2/api/src/java/ 40755 0 0 0 10464315317 14533 5ustar 0 0 commons-attributes-2.2/api/src/java/org/ 40755 0 0 0 10464315316 15321 5ustar 0 0 commons-attributes-2.2/api/src/java/org/apache/ 40755 0 0 0 10464315316 16542 5ustar 0 0 commons-attributes-2.2/api/src/java/org/apache/commons/ 40755 0 0 0 10464315316 20215 5ustar 0 0 commons-attributes-2.2/api/src/java/org/apache/commons/attributes/ 40755 0 0 0 10464315317 22404 5ustar 0 0 commons-attributes-2.2/plugin/ 40755 0 0 0 10464315317 13550 5ustar 0 0 commons-attributes-2.2/plugin/target/ 40755 0 0 0 10464315317 15036 5ustar 0 0 commons-attributes-2.2/NOTICE.txt100644 0 0 145 10464315316 14050 0ustar 0 0 This product includes software developed by The Apache Software Foundation (http://www.apache.org/). commons-attributes-2.2/unittest/src/cl2/TestClass.java100644 0 0 2441 10464315316 20245 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. */ /** * @@TestAttribute ("TestClass") */ public class TestClass { /** * @@TestAttribute ("TestClass.ctor") * @@.parameter TestAttribute ("TestClass.ctor.parameter") */ public TestClass (int parameter) { } /** * @@TestAttribute ("TestClass.Inner") */ public static class Inner {} /** * @@TestAttribute ("TestClass.field") */ public Object field = null; /** * @@TestAttribute ("TestClass.method") * @@.parameter TestAttribute ("TestClass.method.parameter") * @@.return TestAttribute ("TestClass.method.return") */ public Object method (int parameter) { return null; } }commons-attributes-2.2/unittest/src/cl2/TestAttribute.java100644 0 0 1707 10464315317 21150 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. */ /** * @@org.apache.commons.attributes.Indexed () */ public class TestAttribute { private final String key; public TestAttribute (String key) { this.key = key; } public String getKey () { return key; } public String toString () { return "[TestAttribute " + key + "]"; } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/SealableTestCase.java100644 0 0 5361 10464315316 30637 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeIndex; import org.apache.commons.attributes.DefaultSealable; import org.apache.commons.attributes.SealedAttributeException; import junit.framework.TestCase; public class SealableTestCase extends TestCase { /** * A sample attribute with bean-like properties. Used to test the * named parameter syntax. */ public static class SampleSealableAttribute extends DefaultSealable { private int number; public SampleSealableAttribute () { } public int getNumber () { return number; } public void setNumber (int number) { checkSealed (); this.number = number; } } /** @@SealableTestCase.SampleSealableAttribute (number=1) */ public static class ClassWithSealable {} public void testSealable () throws Exception { SampleSealableAttribute attribute = (SampleSealableAttribute) Attributes.getAttribute (ClassWithSealable.class, SampleSealableAttribute.class); try { attribute.setNumber (11); fail ("Attribute should be sealed!"); } catch (IllegalStateException ise) { // -- OK, attribute should be sealed. } assertEquals (1, attribute.getNumber ()); } public void testSealableExceptionType () throws Exception { SampleSealableAttribute attribute = (SampleSealableAttribute) Attributes.getAttribute (ClassWithSealable.class, SampleSealableAttribute.class); try { attribute.setNumber (11); fail ("Attribute should be sealed!"); } catch (SealedAttributeException ise) { // -- OK, attribute should be sealed and throw a SealedAttributeException. } } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/OverrideTestCase.java100644 0 0 3773 10464315316 30713 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import junit.framework.TestCase; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.Inheritable; public class OverrideTestCase extends TestCase { /** * @@OverrideTestCase.OverrideAttribute(1) */ public static class OverrideSuper { } /** * @@Inheritable() */ public static class OverrideAttribute { private final int value; public OverrideAttribute (int value) { this.value = value; } public int getValue () { return value; } public int hashCode () { return 1; } public boolean equals (Object o) { return o instanceof OverrideAttribute; } public String toString () { return "OverrideAttribute: " + value; } } /** * @@OverrideTestCase.OverrideAttribute(2) */ public static class OverrideDerived extends OverrideSuper { } public void testOverride () throws Exception { System.out.println (Attributes.getAttributes (OverrideDerived.class)); OverrideAttribute attr = (OverrideAttribute) Attributes.getAttribute (OverrideDerived.class, OverrideAttribute.class); assertEquals (2, attr.getValue ()); } } commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/TargetTestCase.java100644 0 0 33730 10464315316 30376 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import junit.framework.TestCase; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.Target; import org.apache.commons.attributes.InvalidAttributeTargetError; public class TargetTestCase extends TestCase { /** * @@Target(Target.METHOD) */ public static class AttributeWithTargetMethod {} /** * @@Target(Target.CLASS) */ public static class AttributeWithTargetClass {} /** * @@Target(Target.FIELD) */ public static class AttributeWithTargetField {} /** * @@Target(Target.CONSTRUCTOR) */ public static class AttributeWithTargetConstructor {} /** * @@Target(Target.METHOD_PARAMETER) */ public static class AttributeWithTargetMethodParameter {} /** * @@Target(Target.CONSTRUCTOR_PARAMETER) */ public static class AttributeWithTargetConstructorParameter {} /** * @@Target(Target.RETURN) */ public static class AttributeWithTargetReturn {} /* * ------------------------------------------------------------------- * */ private void expectSuccess (Class[] classes) { for (int i = 0; i < classes.length; i++) { Attributes.getAttributes (classes[i]); } } private void expectFail (Class[] classes) { for (int i = 0; i < classes.length; i++) { try { Attributes.getAttributes (classes[i]); fail (classes[i].getName () + " should throw an InvalidAttributeTargetError"); } catch (InvalidAttributeTargetError iate) { // OK. } } } /* * ------------------------------------------------------------------- * */ /** * @@TargetTestCase.AttributeWithTargetMethod() */ public static class ClassWithInvalidDeclarations {} public void testErrorMessage () throws Exception { Class clazz1 = ClassWithInvalidDeclarations.class; try { Attributes.getAttributes (clazz1); fail (); } catch (InvalidAttributeTargetError iate) { assertEquals ("Attributes of type org.apache.commons.attributes.test.TargetTestCase$AttributeWithTargetMethod " + "can't be applied to org.apache.commons.attributes.test.TargetTestCase$ClassWithInvalidDeclarations. " + "They can only be applied to: METHOD", iate.getMessage ()); // OK. } } /** @@TargetTestCase.AttributeWithTargetClass() */ public static class ClassAttributes0 {} /** @@TargetTestCase.AttributeWithTargetMethod() */ public static class ClassAttributes1 {} /** @@TargetTestCase.AttributeWithTargetField() */ public static class ClassAttributes2 {} /** @@TargetTestCase.AttributeWithTargetMethodParameter() */ public static class ClassAttributes3 {} /** @@TargetTestCase.AttributeWithTargetConstructorParameter() */ public static class ClassAttributes4 {} /** @@TargetTestCase.AttributeWithTargetReturn() */ public static class ClassAttributes5 {} /** @@TargetTestCase.AttributeWithTargetConstructor() */ public static class ClassAttributes6 {} public void testClassAttributes () throws Exception { expectSuccess (new Class[]{ ClassAttributes0.class }); expectFail (new Class[]{ ClassAttributes1.class, ClassAttributes2.class, ClassAttributes3.class, ClassAttributes4.class, ClassAttributes5.class, ClassAttributes6.class }); } public static class FieldAttributes0 { /** @@TargetTestCase.AttributeWithTargetClass() */ private Object o; } public static class FieldAttributes1 { /** @@TargetTestCase.AttributeWithTargetMethod() */ private Object o; } public static class FieldAttributes2 { /** @@TargetTestCase.AttributeWithTargetField() */ private Object o; } public static class FieldAttributes3 { /** @@TargetTestCase.AttributeWithTargetMethodParameter() */ private Object o; } public static class FieldAttributes4 { /** @@TargetTestCase.AttributeWithTargetConstructorParameter() */ private Object o; } public static class FieldAttributes5 { /** @@TargetTestCase.AttributeWithTargetReturn() */ private Object o; } public static class FieldAttributes6 { /** @@TargetTestCase.AttributeWithTargetConstructor() */ private Object o; } public void testFieldAttributes () throws Exception { expectSuccess (new Class[]{ FieldAttributes2.class }); expectFail (new Class[]{ FieldAttributes0.class, FieldAttributes1.class, FieldAttributes3.class, FieldAttributes4.class, FieldAttributes5.class, FieldAttributes6.class }); } public static class MethodAttributes0 { /** @@TargetTestCase.AttributeWithTargetClass() */ private void method () {}; } public static class MethodAttributes1 { /** @@TargetTestCase.AttributeWithTargetMethod() */ private void method () {}; } public static class MethodAttributes2 { /** @@TargetTestCase.AttributeWithTargetField() */ private void method () {}; } public static class MethodAttributes3 { /** @@TargetTestCase.AttributeWithTargetMethodParameter() */ private void method () {}; } public static class MethodAttributes4 { /** @@TargetTestCase.AttributeWithTargetConstructorParameter() */ private void method () {}; } public static class MethodAttributes5 { /** @@TargetTestCase.AttributeWithTargetReturn() */ private void method () {}; } public static class MethodAttributes6 { /** @@TargetTestCase.AttributeWithTargetConstructor() */ private void method () {}; } public void testMethodAttributes () throws Exception { expectSuccess (new Class[]{ MethodAttributes1.class }); expectFail (new Class[]{ MethodAttributes0.class, MethodAttributes2.class, MethodAttributes3.class, MethodAttributes4.class, MethodAttributes5.class, MethodAttributes6.class }); } public static class ConstructorAttributes0 { /** @@TargetTestCase.AttributeWithTargetClass() */ public ConstructorAttributes0 () {}; } public static class ConstructorAttributes1 { /** @@TargetTestCase.AttributeWithTargetMethod() */ public ConstructorAttributes1 () {}; } public static class ConstructorAttributes2 { /** @@TargetTestCase.AttributeWithTargetField() */ public ConstructorAttributes2 () {}; } public static class ConstructorAttributes3 { /** @@TargetTestCase.AttributeWithTargetMethodParameter() */ public ConstructorAttributes3 () {}; } public static class ConstructorAttributes4 { /** @@TargetTestCase.AttributeWithTargetConstructorParameter() */ public ConstructorAttributes4 () {}; } public static class ConstructorAttributes5 { /** @@TargetTestCase.AttributeWithTargetReturn() */ public ConstructorAttributes5 () {}; } public static class ConstructorAttributes6 { /** @@TargetTestCase.AttributeWithTargetConstructor() */ public ConstructorAttributes6 () {}; } public void testConstructorAttributes () throws Exception { expectSuccess (new Class[]{ ConstructorAttributes6.class }); expectFail (new Class[]{ ConstructorAttributes0.class, ConstructorAttributes1.class, ConstructorAttributes2.class, ConstructorAttributes3.class, ConstructorAttributes4.class, ConstructorAttributes5.class }); } public static class ConstructorParameterAttributes0 { /** @@.param TargetTestCase.AttributeWithTargetClass() */ public ConstructorParameterAttributes0 (int param) {}; } public static class ConstructorParameterAttributes1 { /** @@.param TargetTestCase.AttributeWithTargetMethod() */ public ConstructorParameterAttributes1 (int param) {}; } public static class ConstructorParameterAttributes2 { /** @@.param TargetTestCase.AttributeWithTargetField() */ public ConstructorParameterAttributes2 (int param) {}; } public static class ConstructorParameterAttributes3 { /** @@.param TargetTestCase.AttributeWithTargetMethodParameter() */ public ConstructorParameterAttributes3 (int param) {}; } public static class ConstructorParameterAttributes4 { /** @@.param TargetTestCase.AttributeWithTargetConstructorParameter() */ public ConstructorParameterAttributes4 (int param) {}; } public static class ConstructorParameterAttributes5 { /** @@.param TargetTestCase.AttributeWithTargetReturn() */ public ConstructorParameterAttributes5 (int param) {}; } public static class ConstructorParameterAttributes6 { /** @@.param TargetTestCase.AttributeWithTargetConstructor() */ public ConstructorParameterAttributes6 (int param) {}; } public void testConstructorParameterAttributes () throws Exception { expectSuccess (new Class[]{ ConstructorParameterAttributes4.class }); expectFail (new Class[]{ ConstructorParameterAttributes0.class, ConstructorParameterAttributes1.class, ConstructorParameterAttributes2.class, ConstructorParameterAttributes3.class, ConstructorParameterAttributes5.class, ConstructorParameterAttributes6.class }); } public static class MethodParameterAttributes0 { /** @@.param TargetTestCase.AttributeWithTargetClass() */ private void method (int param) {}; } public static class MethodParameterAttributes1 { /** @@.param TargetTestCase.AttributeWithTargetMethod() */ private void method (int param) {}; } public static class MethodParameterAttributes2 { /** @@.param TargetTestCase.AttributeWithTargetField() */ private void method (int param) {}; } public static class MethodParameterAttributes3 { /** @@.param TargetTestCase.AttributeWithTargetMethodParameter() */ private void method (int param) {}; } public static class MethodParameterAttributes4 { /** @@.param TargetTestCase.AttributeWithTargetConstructorParameter() */ private void method (int param) {}; } public static class MethodParameterAttributes5 { /** @@.param TargetTestCase.AttributeWithTargetReturn() */ private void method (int param) {}; } public static class MethodParameterAttributes6 { /** @@.param TargetTestCase.AttributeWithTargetConstructor() */ private void method (int param) {}; } public void testMethodParameterAttributes () throws Exception { expectSuccess (new Class[]{ MethodParameterAttributes3.class }); expectFail (new Class[]{ MethodParameterAttributes0.class, MethodParameterAttributes1.class, MethodParameterAttributes2.class, MethodParameterAttributes4.class, MethodParameterAttributes5.class, MethodParameterAttributes6.class }); } public static class ReturnAttributes0 { /** @@.return TargetTestCase.AttributeWithTargetClass() */ private int method (int param) { return 0; }; } public static class ReturnAttributes1 { /** @@.return TargetTestCase.AttributeWithTargetMethod() */ private int method (int param) { return 0; }; } public static class ReturnAttributes2 { /** @@.return TargetTestCase.AttributeWithTargetField() */ private int method (int param) { return 0; }; } public static class ReturnAttributes3 { /** @@.return TargetTestCase.AttributeWithTargetMethodParameter() */ private int method (int param) { return 0; }; } public static class ReturnAttributes4 { /** @@.return TargetTestCase.AttributeWithTargetConstructorParameter() */ private int method (int param) { return 0; }; } public static class ReturnAttributes5 { /** @@.return TargetTestCase.AttributeWithTargetReturn() */ private int method (int param) { return 0; }; } public static class ReturnAttributes6 { /** @@.return TargetTestCase.AttributeWithTargetConstructor() */ private int method (int param) { return 0; }; } public void testReturnAttributes () throws Exception { expectSuccess (new Class[]{ ReturnAttributes5.class }); expectFail (new Class[]{ ReturnAttributes0.class, ReturnAttributes1.class, ReturnAttributes2.class, ReturnAttributes3.class, ReturnAttributes4.class, ReturnAttributes6.class }); } }././@LongLink100644 0 0 153 10464315317 10256 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/RuntimeAttributesTestCase.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/RuntimeAttributesTestCas100644 0 0 7326 10464315316 31537 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeIndex; import org.apache.commons.attributes.test.samples.RuntimeSample; import org.apache.commons.attributes.test.samples.Sample; import junit.framework.TestCase; public class RuntimeAttributesTestCase extends TestCase { protected void collectionsEquals (Collection a, Collection b) { if (a.size () != b.size ()) { fail ("A=" + a + " B=" + b); } Iterator iter = a.iterator (); while (iter.hasNext ()) { Object o = iter.next (); if (!b.contains (o)) { fail ("B does not contain " + o); } } iter = b.iterator (); while (iter.hasNext ()) { Object o = iter.next (); if (!a.contains (o)) { fail ("A does not contain " + o); } } } public void testRuntimeAttributesEqual () throws Exception { Class clazz1 = Sample.class; Class clazz2 = RuntimeSample.class; collectionsEquals (Attributes.getAttributes (clazz1), Attributes.getAttributes (clazz2)); Method[] methods1 = clazz1.getDeclaredMethods (); for (int i = 0; i < methods1.length; i++) { Method m1 = methods1[i]; Method m2 = clazz2.getDeclaredMethod (m1.getName (), m1.getParameterTypes ()); collectionsEquals (Attributes.getAttributes (m1), Attributes.getAttributes (m2)); int numParameters = m1.getParameterTypes().length; for (int j = 0; j < numParameters; j++) { collectionsEquals (Attributes.getParameterAttributes (m1, j), Attributes.getParameterAttributes (m2, j)); } collectionsEquals (Attributes.getReturnAttributes (m1), Attributes.getReturnAttributes (m2)); } Constructor[] ctors1 = clazz1.getDeclaredConstructors (); for (int i = 0; i < ctors1.length; i++) { Constructor c1 = ctors1[i]; Constructor c2 = clazz2.getDeclaredConstructor (c1.getParameterTypes ()); collectionsEquals (Attributes.getAttributes (c1), Attributes.getAttributes (c2)); int numParameters = c1.getParameterTypes().length; for (int j = 0; j < numParameters; j++) { collectionsEquals (Attributes.getParameterAttributes (c1, j), Attributes.getParameterAttributes (c2, j)); } } Field[] fields1 = clazz1.getDeclaredFields (); for (int i = 0; i < fields1.length; i++) { Field f1 = fields1[i]; Field f2 = clazz2.getField (f1.getName ()); collectionsEquals (Attributes.getAttributes (f1), Attributes.getAttributes (f2)); } } }././@LongLink100644 0 0 150 10464315317 10253 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/AttributeIndexTestCase.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/AttributeIndexTestCase.j100644 0 0 10107 10464315316 31404 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeIndex; import junit.framework.TestCase; public class AttributeIndexTestCase extends TestCase { private URLClassLoader cl = null; private AttributeIndex index = null; private Class TESTCLASS = null; private Class TESTCLASS_INNER = null; private Class TESTATTRIBUTE = null; public void setUp () throws Exception { cl = new URLClassLoader (new URL[]{new File ("target/cl2/cl2.jar").toURL ()}, getClass().getClassLoader ()); index = new AttributeIndex (cl); TESTCLASS = cl.loadClass ("TestClass"); TESTCLASS_INNER = cl.loadClass ("TestClass$Inner"); TESTATTRIBUTE = cl.loadClass ("TestAttribute"); } public void testAttributeIndexCompatible () throws Exception { Collection classes = index.getClassesWithAttribute ("TestAttribute"); System.out.println (classes); assertEquals (2, classes.size ()); assertTrue (classes.contains ("TestClass")); assertTrue (classes.contains ("TestClass.Inner")); } public void testClasses () throws Exception { Collection classes = index.getClasses (TESTATTRIBUTE); System.out.println (classes); assertEquals (2, classes.size ()); assertTrue (classes.contains (TESTCLASS)); assertTrue (classes.contains (TESTCLASS_INNER)); } public void testMethods () throws Exception { Collection methods = index.getMethods (TESTATTRIBUTE); System.out.println (methods); assertEquals (1, methods.size ()); assertTrue (methods.contains (TESTCLASS.getDeclaredMethods()[0])); } public void testConstructors () throws Exception { Collection ctors = index.getConstructors (TESTATTRIBUTE); System.out.println (ctors); assertEquals (1, ctors.size ()); assertTrue (ctors.contains (TESTCLASS.getDeclaredConstructors()[0])); } public void testConstructorParameters () throws Exception { Collection ctors = index.getConstructorParameters (TESTATTRIBUTE); System.out.println (ctors); assertEquals (1, ctors.size ()); assertTrue (ctors.contains (new AttributeIndex.ConstructorParameter (TESTCLASS.getDeclaredConstructors()[0], 0))); } public void testMethodParameters () throws Exception { Collection methods = index.getMethodParameters (TESTATTRIBUTE); System.out.println (methods); assertEquals (1, methods.size ()); assertTrue (methods.contains (new AttributeIndex.MethodParameter (TESTCLASS.getDeclaredMethods()[0], 0))); } public void testMethodsReturning () throws Exception { Collection methods = index.getMethodsReturning (TESTATTRIBUTE); System.out.println (methods); assertEquals (1, methods.size ()); assertTrue (methods.contains (TESTCLASS.getDeclaredMethods()[0])); } public void testFields () throws Exception { Collection fields = index.getFields (TESTATTRIBUTE); System.out.println (fields); assertEquals (1, fields.size ()); assertTrue (fields.contains (TESTCLASS.getDeclaredFields()[0])); } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleIF1.java100644 0 0 2175 10464315316 30660 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; /** * @@Dependency ( SampleService.class, "sample-if-1-c" ) */ public interface SampleIF1 { /** * @@Dependency ( SampleService.class, "sample-if-1" ) * @@ThreadSafe () */ public void someMethod (int parameter); /** * @@.return Dependency ( SampleService.class, "sample-if-return" ) * @@.param2 Dependency ( SampleService.class, "sample-if-param-2" ) */ public Integer methodWithAttributes (int param1, int param2); }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/Dependency.java100644 0 0 2770 10464315317 31217 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; /** * Declares a dependency. * * @@org.apache.commons.attributes.Inheritable() */ public class Dependency { private final Class clazz; private final String name; public Dependency (Class clazz, String name) { this.clazz = clazz; this.name = name; } public Class getDependencyClass () { return clazz; } public String getDependencyName () { return name; } public boolean equals (Object o) { return o instanceof Dependency && ((Dependency) o).clazz == clazz && ((Dependency) o).name.equals (name); } public int hashCode () { return clazz.hashCode () ^ name.hashCode (); } public String toString () { return "[Dependency on " + clazz.getName () + " via name \"" + name + "\"]"; } }././@LongLink100644 0 0 145 10464315317 10257 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SuperSample.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SuperSample.java100644 0 0 3156 10464315317 31400 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; /** * @@Dependency ( SampleService.class, "super-sample" ) */ public class SuperSample { /** * @@ThreadSafe () * @@Dependency ( SampleService.class, "super-field" ) */ public Object field; /** * @@Dependency ( SampleService.class, "super-noattrs" ) */ public Object noAttributesInSubClass; /** * @@Dependency ( SampleService.class, "sample-ctor1" ) */ public SuperSample () { } /** * @@Dependency ( SampleService.class, "sample-ctor2" ) * @@.array ThreadSafe() */ public SuperSample (String input, String[][] array) { } /** * @@Dependency ( SampleService.class, "super-some-method-sample" ) * @@ThreadSafe () */ public void someMethod (int parameter) { } /** * @@Dependency ( SampleService.class, "super-privateMethod" ) */ private void privateMethod () { } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleIF2.java100644 0 0 1625 10464315317 30661 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; /** * @@Dependency ( SampleService.class, "sample-if-2-c" ) */ public interface SampleIF2 { /** * @@Dependency ( SampleService.class, "sample-if-2" ) * @@ThreadSafe () */ public void someMethod (int parameter); }././@LongLink100644 0 0 146 10464315317 10260 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleIFJoin.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleIFJoin.jav100644 0 0 1341 10464315317 31251 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; public interface SampleIFJoin extends SampleIF1, SampleIF2 { }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/ThreadSafe.java100644 0 0 1702 10464315317 31141 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; public class ThreadSafe { public ThreadSafe () { } public boolean equals (Object o) { return o instanceof ThreadSafe; } public int hashCode () { return 0; } public String toString () { return "[ThreadSafe]"; } }././@LongLink100644 0 0 147 10464315317 10261 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleService.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/SampleService.ja100644 0 0 1304 10464315317 31344 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; public interface SampleService {}././@LongLink100644 0 0 147 10464315317 10261 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/BeanAttribute.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/BeanAttribute.ja100644 0 0 4273 10464315317 31343 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; import org.apache.commons.attributes.DefaultSealable; import org.apache.commons.attributes.Sealable; /** * A sample attribute with bean-like properties. Used to test the * named parameter syntax. */ public class BeanAttribute extends DefaultSealable { private final int number; private final String string; private String name; private int anotherNumber; public BeanAttribute (int number, String string) { this.number = number; this.string = string; } public int getNumber () { return number; } public String getString () { return string; } public String getName () { return name; } public int getAnotherNumber () { return anotherNumber; } public void setAnotherNumber (int anotherNumber) { checkSealed (); this.anotherNumber = anotherNumber; } public void setName (String name) { checkSealed (); this.name = name; } public boolean equals (Object o) { return o instanceof BeanAttribute && ((BeanAttribute) o).string.equals (string) && ((BeanAttribute) o).anotherNumber == anotherNumber && ((BeanAttribute) o).number == number && ((BeanAttribute) o).name.equals (name); } public int hashCode () { return string.hashCode (); } public String toString () { return "[BeanAttribute " + number + ", " + string + "; " + name + ", " + anotherNumber + "\"]"; } }././@LongLink100644 0 0 147 10464315317 10261 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/RuntimeSample.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/RuntimeSample.ja100644 0 0 6432 10464315317 31376 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.RuntimeAttributeRepository; public class RuntimeSample extends SuperSample implements SampleIFJoin { static { try { RuntimeAttributeRepository rar = new RuntimeAttributeRepository (RuntimeSample.class); rar.addClassAttribute (new ThreadSafe ()); rar.addClassAttribute (new Dependency ( SampleService.class, "sample" )); rar.addFieldAttribute ("field", new ThreadSafe ()); rar.addMethodAttribute ("someMethod", new Class[]{}, new Dependency ( SampleService.class, "sample-some-method1" )); rar.addParameterAttribute ("methodWithAttributes", new Class[]{ Integer.TYPE, Integer.TYPE }, 1, new ThreadSafe ()); rar.addReturnAttribute ("methodWithAttributes", new Class[]{ Integer.TYPE, Integer.TYPE }, new Dependency ( SampleService.class, "sample-return" )); rar.addMethodAttribute ("someMethod", new Class[]{ Integer.TYPE }, new Dependency ( SampleService.class, "sample-some-method2" )); BeanAttribute ba = new BeanAttribute (1, "a"); ba.setAnotherNumber (56 - 14); ba.setName ("Smith, John \"Agent\""); rar.addMethodAttribute ("methodWithNamedParameters", new Class[]{}, ba); rar.addMethodAttribute ("privateMethod", new Class[]{}, new Dependency ( SampleService.class, "sample-privateMethod" )); Attributes.setAttributes (rar); } catch (Exception e) { throw new Error ("Unable to set attribute information: " + e.toString ()); } } public Object field; public Object noAttributesInSubClass; public void someMethod () { } public Integer methodWithAttributes (int param1, int param2) { return null; } public void someMethod (int parameter) { } public void methodWithNamedParameters () { } public void methodWithNoAttributes () { } private void privateMethod () { } public static class InnerSample { static { try { RuntimeAttributeRepository rar = new RuntimeAttributeRepository (RuntimeSample.InnerSample.class); rar.addClassAttribute (new Dependency ( SampleService.class, "inner-sample" )); Attributes.setAttributes (rar); } catch (Exception e) { throw new Error ("Unable to set attribute information: " + e.toString ()); } } } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/Sample.java100644 0 0 3605 10464315317 30360 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; /** * @@ThreadSafe () * @@Dependency ( SampleService.class, "sample" ) */ public class Sample extends SuperSample implements SampleIFJoin { /** * @@ThreadSafe () */ public Object field; public Object noAttributesInSubClass; /** * @@Dependency ( SampleService.class, "sample-some-method1" ) */ public void someMethod () { } /** * @@.param2 ThreadSafe () * @@.return Dependency ( SampleService.class, "sample-return" ) */ public Integer methodWithAttributes (int param1, int param2) { return null; } /** * @@Dependency ( SampleService.class, "sample-some-method2" ) */ public void someMethod (int parameter) { } /** * @@BeanAttribute ( 1, "a", anotherNumber = (56 - 14), name = "Smith, John \"Agent\"" ) */ public void methodWithNamedParameters () { } public void methodWithNoAttributes () { } /** * @@Dependency ( SampleService.class, "inner-sample" ) */ public static class InnerSample { } /** * @@Dependency ( SampleService.class, "sample-privateMethod" ) */ private void privateMethod () { } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/samples/Sample2.java100644 0 0 1656 10464315317 30446 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test.samples; public class Sample2 { public Object aaaa; public Sample2 () { } public Sample2 (String input) { } public void someMethod () { } public void someMethod (int parameter) { } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/AttributesTestCase.java100644 0 0 17146 10464315317 31302 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeIndex; import org.apache.commons.attributes.test.samples.*; import junit.framework.TestCase; public class AttributesTestCase extends TestCase { public void testClassAttributes () throws Exception { /** * @Dependency ( SampleService.class, "super-sample" ) */ Class c = SuperSample.class; assertEquals (1, Attributes.getAttributes (c).size ()); assertEquals (1, Attributes.getAttributes (c, Dependency.class).size ()); assertTrue (Attributes.hasAttributeType (c, Dependency.class)); assertTrue (Attributes.hasAttribute (c, new Dependency ( SampleService.class, "super-sample" ))); } public void testMethodAttributes () throws Exception { /** * @Dependency ( SampleService.class, "super-some-method-sample" ) * @ThreadSafe () */ Method m = SuperSample.class.getMethod ("someMethod", new Class[]{ Integer.TYPE }); assertEquals (2, Attributes.getAttributes (m).size ()); assertEquals (1, Attributes.getAttributes (m, Dependency.class).size ()); assertEquals (1, Attributes.getAttributes (m, ThreadSafe.class).size ()); assertTrue (Attributes.hasAttributeType (m, Dependency.class)); assertTrue (Attributes.hasAttributeType (m, ThreadSafe.class)); assertTrue (Attributes.hasAttribute (m, new Dependency ( SampleService.class, "super-some-method-sample" ))); assertTrue (Attributes.hasAttribute (m, new ThreadSafe ())); } public void testFieldAttributes () throws Exception { /** * @ThreadSafe () * @Dependency ( SampleService.class, "super-field" ) */ Field f = SuperSample.class.getField ("field"); assertEquals (2, Attributes.getAttributes (f).size ()); assertEquals (1, Attributes.getAttributes (f, ThreadSafe.class).size ()); assertEquals (1, Attributes.getAttributes (f, Dependency.class).size ()); assertTrue (Attributes.hasAttribute (f, new ThreadSafe ())); assertTrue (Attributes.hasAttribute (f, new Dependency ( SampleService.class, "super-field" ) )); assertTrue (Attributes.hasAttributeType (f, ThreadSafe.class)); assertTrue (Attributes.hasAttributeType (f, Dependency.class)); } public void testDefaultConstructorAttributes () throws Exception { /** * @Dependency ( SampleService.class, "sample-ctor1" ) */ Constructor c = SuperSample.class.getDeclaredConstructor (new Class[0]); assertEquals (1, Attributes.getAttributes (c).size ()); assertEquals (1, Attributes.getAttributes (c, Dependency.class).size ()); assertTrue (Attributes.hasAttributeType (c, Dependency.class)); assertTrue (Attributes.hasAttribute (c, new Dependency ( SampleService.class, "sample-ctor1" ))); } public void testConstructorAttributes () throws Exception { /** * @Dependency ( SampleService.class, "sample-ctor2" ) */ Constructor c = SuperSample.class.getDeclaredConstructor (new Class[]{ String.class, (new String[0][0]).getClass () } ); assertEquals (1, Attributes.getAttributes (c).size ()); assertEquals (1, Attributes.getAttributes (c, Dependency.class).size ()); assertTrue (Attributes.hasAttributeType (c, Dependency.class)); assertTrue (Attributes.hasAttribute (c, new Dependency ( SampleService.class, "sample-ctor2" ))); assertEquals (1, Attributes.getParameterAttributes (c, 1).size ()); assertEquals (1, Attributes.getParameterAttributes (c, 1, ThreadSafe.class).size ()); assertTrue (Attributes.hasParameterAttributeType (c, 1, ThreadSafe.class)); assertTrue (Attributes.hasParameterAttribute (c, 1, new ThreadSafe ())); } public void testParameterAndReturnAttributes () throws Exception { Method m = Sample.class.getMethod ("methodWithAttributes", new Class[]{ Integer.TYPE, Integer.TYPE }); assertEquals (0, Attributes.getAttributes (m).size ()); assertEquals (2, Attributes.getReturnAttributes (m).size ()); assertTrue (Attributes.hasReturnAttribute (m, new Dependency ( SampleService.class, "sample-return" ) )); assertTrue (Attributes.hasReturnAttribute (m, new Dependency ( SampleService.class, "sample-if-return" ) )); assertEquals (0, Attributes.getParameterAttributes (m, 0).size ()); assertEquals (2, Attributes.getParameterAttributes (m, 1).size ()); assertTrue (Attributes.hasParameterAttribute (m, 1, new Dependency ( SampleService.class, "sample-if-param-2" ) )); assertTrue (Attributes.hasParameterAttribute (m, 1, new ThreadSafe () )); } public void testNoAttributes () throws Exception { Method m = Sample.class.getMethod ("methodWithNoAttributes", new Class[0]); assertEquals (0, Attributes.getAttributes (m).size ()); } /** * Ensure that loading a class with the same name from two different class loaders * won't mess up the attribute cache. */ public void testClassLoaderKeying () throws Exception { URLClassLoader cl1 = new URLClassLoader (new URL[]{new File ("target/cl1/").toURL ()}, getClass().getClassLoader ()); URLClassLoader cl2 = new URLClassLoader (new URL[]{new File ("target/cl2/").toURL ()}, getClass().getClassLoader ()); Class cl1Class = cl1.loadClass ("TestClass"); Class cl2Class = cl2.loadClass ("TestClass"); assertEquals ("[[TestAttribute 1]]", Attributes.getAttributes (cl1Class).toString ()); assertEquals ("[[TestAttribute TestClass]]", Attributes.getAttributes (cl2Class).toString ()); } public void testInnerClasses () throws Exception { Class c = Sample.InnerSample.class; assertEquals (1, Attributes.getAttributes (c).size ()); assertEquals (1, Attributes.getAttributes (c, Dependency.class).size ()); assertTrue (Attributes.hasAttributeType (c, Dependency.class)); assertTrue (Attributes.hasAttribute (c, new Dependency ( SampleService.class, "inner-sample" ))); } public void testNamedParameters () throws Exception { Method m = Sample.class.getMethod ("methodWithNamedParameters", new Class[]{ }); assertEquals (1, Attributes.getAttributes (m).size ()); assertEquals (1, Attributes.getAttributes (m, BeanAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (m, BeanAttribute.class)); BeanAttribute ba = new BeanAttribute (1, "a"); ba.setName ("Smith, John \"Agent\""); ba.setAnotherNumber (42); assertTrue (Attributes.hasAttribute (m, ba)); } }././@LongLink100644 0 0 163 10464315317 10257 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/ParameterIndexOutOfBoundsTestCase.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/ParameterIndexOutOfBound100644 0 0 5734 10464315317 31435 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import junit.framework.TestCase; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.ParameterIndexOutOfBoundsException; public class ParameterIndexOutOfBoundsTestCase extends TestCase { public static class Attr {} public static class Inner { /** * @@ParameterIndexOutOfBoundsTestCase.Attr() */ public Inner (int arg1) {} public void method (int arg1, int arg2) {} } private Method m; private Constructor c; public void setUp () throws Exception { m = Inner.class.getMethod ("method", new Class[]{ Integer.TYPE, Integer.TYPE }); c = Inner.class.getConstructor (new Class[]{ Integer.TYPE }); } public void testMethodInRange () throws Exception { Attributes.getParameterAttributes (m, 0); Attributes.getParameterAttributes (m, 1); } public void testConstructorInRange () throws Exception { Attributes.getParameterAttributes (c, 0); } public void testMethodOutOfRange () throws Exception { try { Attributes.getParameterAttributes (m, -1); fail (); } catch (ParameterIndexOutOfBoundsException e) { assertEquals ("-1", e.getMessage ()); } try { Attributes.getParameterAttributes (m, 2); fail (); } catch (ParameterIndexOutOfBoundsException e) { assertEquals ("2. public void org.apache.commons.attributes.test.ParameterIndexOutOfBoundsTestCase$Inner.method(int,int) has 2 parameters.", e.getMessage ()); } } public void testConstructorOutOfRange () throws Exception { try { Attributes.getParameterAttributes (c, -1); fail (); } catch (ParameterIndexOutOfBoundsException e) { assertEquals ("-1", e.getMessage ()); } try { Attributes.getParameterAttributes (c, 1); fail (); } catch (ParameterIndexOutOfBoundsException e) { assertEquals ("1. public org.apache.commons.attributes.test.ParameterIndexOutOfBoundsTestCase$Inner(int) has 1 parameters.", e.getMessage ()); } } }././@LongLink100644 0 0 154 10464315317 10257 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/CircularDependencyTestCase.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/CircularDependencyTestCa100644 0 0 3730 10464315317 31421 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import junit.framework.TestCase; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.CircularDependencyError; public class CircularDependencyTestCase extends TestCase { /** * @@CircularDependencyTestCase.AttributeTwo() */ public static class AttributeOne {} public static class AttributeTwo extends AttributeOne {} public void testCircularDependencies () throws Exception { try { // This should fail, because when loading attributes for Two, // the runtime has to get inheritable attributes from One. // This means it has to check if Two is Inheritable. But it // is already loading Two -> Circular dependency. Attributes.getAttributes (AttributeTwo.class); fail (); } catch (CircularDependencyError cde) { // OK. assertEquals ("org.apache.commons.attributes.test.CircularDependencyTestCase$AttributeTwo:" + "org.apache.commons.attributes.test.CircularDependencyTestCase$AttributeTwo -> " + "org.apache.commons.attributes.test.CircularDependencyTestCase$AttributeOne -> " + "org.apache.commons.attributes.test.CircularDependencyTestCase$AttributeTwo", cde.getMessage ()); } } }././@LongLink100644 0 0 145 10464315317 10257 Lustar 0 0 commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/InheritableTestCase.javacommons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/InheritableTestCase.java100644 0 0 23667 10464315317 31407 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeIndex; import junit.framework.TestCase; public class InheritableTestCase extends TestCase { public static interface SampleService {} /** * @@InheritableTestCase.InheritableAttribute ("super-sample") */ public static class SuperClass { /** * @@InheritableTestCase.NonInheritableAttribute () * @@InheritableTestCase.InheritableAttribute ( "super-field" ) */ public Object field; /** * @@InheritableTestCase.InheritableAttribute ( "super-noattrs" ) */ public Object noAttributesInSubClass; /** * @@InheritableTestCase.InheritableAttribute ( "sample-ctor1" ) */ public SuperClass () { } /** * @@InheritableTestCase.InheritableAttribute( "sample-ctor2" ) * @@.array InheritableTestCase.NonInheritableAttribute() */ public SuperClass (String input, String[][] array) { } /** * @@InheritableTestCase.InheritableAttribute( "super-some-method-sample" ) * @@InheritableTestCase.NonInheritableAttribute() */ public void someMethod (int parameter) { } /** * @@InheritableTestCase.InheritableAttribute( "super-privateMethod" ) */ private void privateMethod () { } } public static interface JoinedInterface extends InterfaceOne, InterfaceTwo { } /** * @@InheritableTestCase.InheritableAttribute( "sample-if-2-c" ) */ public static interface InterfaceTwo { /** * @@InheritableTestCase.InheritableAttribute( "sample-if-2" ) * @@InheritableTestCase.NonInheritableAttribute() */ public void someMethod (int parameter); } /** * @@InheritableTestCase.InheritableAttribute( "sample-if-1-c" ) */ public static interface InterfaceOne { /** * @@InheritableTestCase.InheritableAttribute( "sample-if-1" ) * @@InheritableTestCase.NonInheritableAttribute() */ public void someMethod (int parameter); /** * @@.return InheritableTestCase.InheritableAttribute("sample-if-return" ) * @@.param2 InheritableTestCase.InheritableAttribute("sample-if-param-2" ) */ public Integer methodWithAttributes (int param1, int param2); } /** * @@org.apache.commons.attributes.Inheritable() */ public static class InheritableAttribute { private final String name; public InheritableAttribute(String name) { this.name = name; } public String getInheritableAttributeName () { return name; } public boolean equals (Object o) { return o instanceof InheritableAttribute && ((InheritableAttribute) o).name.equals (name); } public int hashCode () { return name.hashCode (); } public String toString () { return "[InheritableAttribute \"" + name + "\"]"; } } public static class NonInheritableAttribute { public NonInheritableAttribute() {} public boolean equals (Object o) { return o instanceof NonInheritableAttribute; } public int hashCode () { return 0; } public String toString () { return "[NonInheritableAttribute]"; } } /** @@InheritableTestCase.NonInheritableAttribute() * @@InheritableTestCase.InheritableAttribute( "sample" ) */ public static class Sample extends InheritableTestCase.SuperClass implements JoinedInterface { /** @@InheritableTestCase.NonInheritableAttribute() */ public Object field; public Object noAttributesInSubClass; /** @@InheritableTestCase.InheritableAttribute( "sample-some-method1" ) */ public void someMethod () {} /** @@InheritableTestCase.InheritableAttribute( "sample-some-method2" ) */ public void someMethod (int parameter) {} /** @@.param2 InheritableTestCase.NonInheritableAttribute () * @@.return InheritableTestCase.InheritableAttribute("sample-return") */ public Integer methodWithAttributes (int param1, int param2) { return null; } public void methodWithNoAttributes () {} /** @@InheritableTestCase.InheritableAttribute( "inner-sample" ) */ public static class InnerSample {} /** @@InheritableTestCase.InheritableAttribute( "sample-privateMethod" ) */ private void privateMethod () {} } public void testClassInheritance () throws Exception { Class c = Sample.class; assertEquals (5, Attributes.getAttributes (c).size ()); assertEquals (4, Attributes.getAttributes (c, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (c, InheritableAttribute.class)); assertTrue (Attributes.hasAttributeType (c, NonInheritableAttribute.class)); assertTrue (Attributes.hasAttribute (c, new InheritableAttribute( "sample" ))); assertTrue (Attributes.hasAttribute (c, new InheritableAttribute( "super-sample" ))); assertTrue (Attributes.hasAttribute (c, new InheritableAttribute( "sample-if-1-c" ))); assertTrue (Attributes.hasAttribute (c, new InheritableAttribute( "sample-if-2-c" ))); assertTrue (Attributes.hasAttribute (c, new NonInheritableAttribute())); } public void testMethodInheritance () throws Exception { Method m = Sample.class.getMethod ("someMethod", new Class[]{ Integer.TYPE }); assertEquals (4, Attributes.getAttributes (m).size ()); assertEquals (4, Attributes.getAttributes (m, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (m, InheritableAttribute.class)); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "super-some-method-sample" ))); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "sample-some-method2" ) )); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "sample-if-1" ) )); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "sample-if-2" ) )); } public void testPrivateMethodNonInheritance () throws Exception { Method m = Sample.class.getDeclaredMethod ("privateMethod", new Class[]{}); assertEquals (1, Attributes.getAttributes (m).size ()); assertEquals (1, Attributes.getAttributes (m, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (m, InheritableAttribute.class)); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "sample-privateMethod" ) )); m = SuperClass.class.getDeclaredMethod ("privateMethod", new Class[]{}); assertEquals (1, Attributes.getAttributes (m).size ()); assertEquals (1, Attributes.getAttributes (m, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (m, InheritableAttribute.class)); assertTrue (Attributes.hasAttribute (m, new InheritableAttribute( "super-privateMethod" ) )); } public void testFieldNonInheritance () throws Exception { Field f = SuperClass.class.getField ("field"); assertEquals (2, Attributes.getAttributes (f).size ()); assertEquals (1, Attributes.getAttributes (f, NonInheritableAttribute.class).size ()); assertEquals (1, Attributes.getAttributes (f, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (f, NonInheritableAttribute.class)); assertTrue (Attributes.hasAttributeType (f, InheritableAttribute.class)); assertTrue (Attributes.hasAttribute (f, new NonInheritableAttribute())); assertTrue (Attributes.hasAttribute (f, new InheritableAttribute( "super-field" ))); f = Sample.class.getField ("field"); assertEquals (1, Attributes.getAttributes (f).size ()); assertEquals (1, Attributes.getAttributes (f, NonInheritableAttribute.class).size ()); assertTrue (Attributes.hasAttributeType (f, NonInheritableAttribute.class)); assertTrue (Attributes.hasAttribute (f, new NonInheritableAttribute())); f = SuperClass.class.getField ("noAttributesInSubClass"); assertEquals (1, Attributes.getAttributes (f).size ()); assertEquals (1, Attributes.getAttributes (f, InheritableAttribute.class).size ()); assertTrue (Attributes.hasAttribute (f, new InheritableAttribute( "super-noattrs" ))); assertTrue (Attributes.hasAttributeType (f, InheritableAttribute.class)); f = Sample.class.getField ("noAttributesInSubClass"); assertEquals (0, Attributes.getAttributes (f).size ()); assertEquals (0, Attributes.getAttributes (f, InheritableAttribute.class).size ()); assertTrue (!Attributes.hasAttribute (f, new InheritableAttribute( "super-noattrs" ))); assertTrue (!Attributes.hasAttributeType (f, InheritableAttribute.class)); } }commons-attributes-2.2/unittest/src/test/org/apache/commons/attributes/test/InnerClassTestCase.java100644 0 0 5407 10464315317 31172 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import junit.framework.TestCase; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.InvalidAttributeTargetError; public class InnerClassTestCase extends TestCase { public static class AnAttribute {} public static class Internal { } public static class InnerClassSample { public static class InternalOfSample { } /** * @@InnerClassTestCase.AnAttribute() */ public void method (Internal i) { } /** * @@InnerClassTestCase.AnAttribute() */ public void method2 (InternalOfSample i) { } /** * @@InnerClassTestCase.AnAttribute() */ public Internal field; /** * @@InnerClassTestCase.AnAttribute() */ public InternalOfSample field2; } public void testInnerClassAttributesOnMethod () throws Exception { Class sample = InnerClassSample.class; Method method = sample.getMethod ("method", new Class[]{ Internal.class }); assertTrue (Attributes.getAttributes (method, AnAttribute.class).size () > 0); } public void testInnerClassAttributesOnMethod2 () throws Exception { Class sample = InnerClassSample.class; Method method2 = sample.getMethod ("method2", new Class[]{ InnerClassSample.InternalOfSample.class }); assertTrue (Attributes.getAttributes (method2, AnAttribute.class).size () > 0); } public void testInnerClassAttributesOnField () throws Exception { Class sample = InnerClassSample.class; Field field = sample.getField ("field"); assertTrue (Attributes.getAttributes (field, AnAttribute.class).size () > 0); } public void testInnerClassAttributesOnField2 () throws Exception { Class sample = InnerClassSample.class; Field field2 = sample.getField ("field2"); assertTrue (Attributes.getAttributes (field2, AnAttribute.class).size () > 0); } }commons-attributes-2.2/unittest/src/cl1/TestClass.java100644 0 0 1257 10464315316 20250 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. */ /** * @@TestAttribute ("1") */ public class TestClass { }commons-attributes-2.2/unittest/src/cl1/TestAttribute.java100644 0 0 1621 10464315317 21142 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. */ public class TestAttribute { private final String key; public TestAttribute (String key) { this.key = key; } public String getKey () { return key; } public String toString () { return "[TestAttribute " + key + "]"; } }commons-attributes-2.2/unittest/src/java/dummy.txt100644 0 0 224 10464315317 17610 0ustar 0 0 Maven requires a src/java/ directory, and CVS keeps deleting empty directories. So this file is here just to keep this directory from being pruned.commons-attributes-2.2/unittest/project.properties100644 0 0 1560 10464315316 20013 0ustar 0 0 # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. ###################################################################### # Commons-Attributes ###################################################################### org.apache.commons.attributes.enable=true org.apache.commons.attributes.index.enable=true commons-attributes-2.2/unittest/maven.xml100644 0 0 5777 10464315317 16076 0ustar 0 0 commons-attributes-2.2/unittest/project.xml100644 0 0 4114 10464315317 16416 0ustar 0 0 ${basedir}/../project.xml commons-attributes commons-attributes-unittest Jakarta Commons Attribute Compiler Unit Tests org.apache.commons.attributes 2003 Compiler for Jakarta Commons Attributes in Java. A precompiler for java that enables the use of attributes as seen in C#. ${basedir}/src/test ant ant 1.5 qdox qdox 1.5 commons-attributes commons-attributes-compiler 2.2 commons-attributes commons-attributes-api 2.2 ././@LongLink100644 0 0 147 10464315317 10261 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeCompiler.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeCompiler.ja100644 0 0 53335 10464315316 31356 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.compiler; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import com.thoughtworks.qdox.JavaDocBuilder; import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaField; import com.thoughtworks.qdox.model.JavaMethod; import com.thoughtworks.qdox.model.DocletTag; import com.thoughtworks.qdox.model.JavaParameter; /** * Ant task to compile attributes. Usage: * *

 *     <taskdef resource="org/apache/commons/attributes/anttasks.properties"/>
 *     
 *     <attribute-compiler destDir="temp/"> attributepackages="my.attributes;my.otherattributes"
 *         <fileset dir="src/" includes="*.java"/>
 *     </attribute-compiler>
 * 
* * * * The task should be run before compiling the Java sources, and will produce some * additional Java source files in the destination directory that should be compiled * along with the input source files. (See the overview for a diagram.) */ public class AttributeCompiler extends Task { private final ArrayList fileSets = new ArrayList (); private Path src; private File destDir; private int numGenerated; private int numIgnored; private String attributePackages = ""; public AttributeCompiler () { } public void setAttributePackages (String attributePackages) { this.attributePackages = attributePackages; } public void addFileset (FileSet set) { fileSets.add (set); } public void setDestdir (File destDir) { this.destDir = destDir; } public void setSourcepathref (String pathref) { String sourcePaths = project.getReference (pathref).toString (); StringTokenizer tok = new StringTokenizer (sourcePaths, File.pathSeparator); while (tok.hasMoreTokens ()) { FileSet fs = new FileSet (); fs.setDir (new File (tok.nextToken ())); fs.setIncludes ("**/*.java"); fs.setProject (project); addFileset (fs); } } protected void copyImports (File source, PrintWriter dest) throws Exception { BufferedReader br = new BufferedReader (new FileReader (source)); try { String line = null; while ((line = br.readLine ()) != null) { if (line.startsWith ("import ")) { dest.println (line); } } } finally { br.close (); } } protected void addExpressions (DocletTag[] tags, PrintWriter pw, String collectionName, File sourceFile) { addExpressions (tags, null, pw, collectionName, sourceFile); } protected void addExpressions (DocletTag[] tags, String selector, PrintWriter pw, String collectionName, File sourceFile) { String fileName = sourceFile != null ? sourceFile.getPath ().replace ('\\', '/') : ""; for (int i = 0; i < tags.length; i++) { DocletTag tag = tags[i]; if (isAttribute (tag)) { String tagName = tag.getName (); String tagValue = tag.getValue (); String expression = tagName + " " + tagValue; expression = expression.trim (); // Remove the second @-sign. expression = expression.substring (1); if (selector != null) { if (expression.startsWith (".")) { // We have selector, tag does... String tagSelector = expression.substring (1, expression.indexOf (" ")); expression = expression.substring (expression.indexOf (" ")).trim (); if (!selector.equals (tagSelector)) { // ...but they didn't match. continue; } } else { // We have selector, but tag doesn't continue; } } else { // No selector, but tag has selector. if (expression.startsWith (".")) { continue; } } pw.println (" {"); outputAttributeExpression (pw, expression, fileName, tag.getLineNumber (), "_attr"); pw.println (" Object _oattr = _attr; // Need to erase type information"); pw.println (" if (_oattr instanceof org.apache.commons.attributes.Sealable) {"); pw.println (" ((org.apache.commons.attributes.Sealable) _oattr).seal ();"); pw.println (" }"); pw.println (" " + collectionName + ".add ( _attr );"); pw.println (" }"); } } } protected void outputAttributeExpression (PrintWriter pw, String expression, String filename, int line, String tempVariableName) { AttributeExpressionParser.ParseResult result = AttributeExpressionParser.parse (expression, filename, line); pw.print (" " + result.className + " " + tempVariableName + " = new " + result.className + "("); boolean first = true; Iterator iter = result.arguments.iterator (); while (iter.hasNext ()) { AttributeExpressionParser.Argument arg = (AttributeExpressionParser.Argument) iter.next (); if (arg.field == null) { if (!first) { pw.print (", "); } first = false; pw.print (arg.text); } } pw.println (" // " + filename + ":" + line); pw.println (");"); iter = result.arguments.iterator (); while (iter.hasNext ()) { AttributeExpressionParser.Argument arg = (AttributeExpressionParser.Argument) iter.next (); if (arg.field != null) { String methodName = "set" + arg.field.substring (0, 1).toUpperCase () + arg.field.substring (1); pw.println (" " + tempVariableName + "." + methodName + "(\n" + arg.text + " // " + filename + ":" + line + "\n" + ");"); } } } protected boolean elementHasAttributes (JavaField[] fields) { for (int i = 0; i < fields.length; i++) { if (tagHasAttributes (fields[i].getTags ())) { return true; } } return false; } protected boolean elementHasAttributes (JavaMethod[] methods) { for (int i = 0; i < methods.length; i++) { if (tagHasAttributes (methods[i].getTags ())) { return true; } } return false; } /** * Encodes a class name to the internal Java name. * For example, an inner class Outer.Inner will be * encoded as Outer$Inner. */ private void getTransformedQualifiedName (JavaClass type, StringBuffer sb) { sb.append (type.getFullyQualifiedName ()); } protected String getParameterTypes (JavaParameter[] parameters) { StringBuffer sb = new StringBuffer (); for (int i = 0; i < parameters.length; i++) { if (i > 0) { sb.append (","); } getTransformedQualifiedName (parameters[i].getType ().getJavaClass (), sb); for (int j = 0; j < parameters[i].getType ().getDimensions (); j++) { sb.append ("[]"); } } return sb.toString (); } protected void generateClass (JavaClass javaClass) throws Exception { String name = null; File sourceFile = null; File destFile = null; String packageName = null; String className = null; packageName = javaClass.getPackage (); if (packageName == null) { packageName = ""; } if (javaClass.isInner ()) { sourceFile = getSourceFile (javaClass); String nonPackagePrefix = javaClass.getParent ().getClassNamePrefix (); if (packageName.length () > 0) { nonPackagePrefix = nonPackagePrefix.substring (packageName.length () + 1); } className = nonPackagePrefix + javaClass.getName (); name = javaClass.getParent ().getClassNamePrefix () + javaClass.getName (); } else { name = javaClass.getFullyQualifiedName (); sourceFile = getSourceFile (javaClass); className = javaClass.getName (); } if (sourceFile == null) { log ("Unable to find source file for: " + name); } destFile = new File (destDir, name.replace ('.', '/') + "$__attributeRepository.java"); /*if (javaClass.isAnonymous ()) { log (javaClass.getName () + " is anonymous - ignoring.", Project.MSG_VERBOSE); numIgnored++; return; }*/ if (!hasAttributes (javaClass)) { if (destFile.exists ()) { destFile.delete (); } return; } if (destFile.exists () && sourceFile != null && destFile.lastModified () >= sourceFile.lastModified ()) { return; } numGenerated++; destFile.getParentFile ().mkdirs (); PrintWriter pw = new PrintWriter (new FileWriter (destFile)); try { if (packageName != null && !packageName.equals ("")) { pw.println ("package " + packageName + ";"); } if (sourceFile != null) { copyImports (sourceFile, pw); } StringTokenizer tok = new StringTokenizer (attributePackages, ";"); while (tok.hasMoreTokens ()) { pw.println ("import " + tok.nextToken () + ".*;"); } pw.println ("public class " + className + "$__attributeRepository implements org.apache.commons.attributes.AttributeRepositoryClass {"); { pw.println (" private final java.util.Set classAttributes = new java.util.HashSet ();"); pw.println (" private final java.util.Map fieldAttributes = new java.util.HashMap ();"); pw.println (" private final java.util.Map methodAttributes = new java.util.HashMap ();"); pw.println (" private final java.util.Map constructorAttributes = new java.util.HashMap ();"); pw.println (); pw.println (" public " + className + "$__attributeRepository " + "() {"); pw.println (" initClassAttributes ();"); pw.println (" initMethodAttributes ();"); pw.println (" initFieldAttributes ();"); pw.println (" initConstructorAttributes ();"); pw.println (" }"); pw.println (); pw.println (" public java.util.Set getClassAttributes () { return classAttributes; }"); pw.println (" public java.util.Map getFieldAttributes () { return fieldAttributes; }"); pw.println (" public java.util.Map getConstructorAttributes () { return constructorAttributes; }"); pw.println (" public java.util.Map getMethodAttributes () { return methodAttributes; }"); pw.println (); pw.println (" private void initClassAttributes () {"); addExpressions (javaClass.getTags (), pw, "classAttributes", sourceFile); pw.println (" }"); pw.println (); // ---- Field Attributes pw.println (" private void initFieldAttributes () {"); pw.println (" java.util.Set attrs = null;"); JavaField[] fields = javaClass.getFields (); for (int i = 0; i < fields.length; i++) { JavaField member = (JavaField) fields[i]; if (member.getTags ().length > 0) { String key = member.getName (); pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), pw, "attrs", sourceFile); pw.println (" fieldAttributes.put (\"" + key + "\", attrs);"); pw.println (" attrs = null;"); pw.println (); } } pw.println (" }"); // ---- Method Attributes pw.println (" private void initMethodAttributes () {"); pw.println (" java.util.Set attrs = null;"); pw.println (" java.util.List bundle = null;"); JavaMethod[] methods = javaClass.getMethods (); for (int i = 0; i < methods.length; i++) { JavaMethod member = (JavaMethod) methods[i]; if (!member.isConstructor () && member.getTags ().length > 0) { StringBuffer sb = new StringBuffer (); sb.append (member.getName ()).append ("("); sb.append (getParameterTypes (member.getParameters ())); sb.append (")"); String key = sb.toString (); pw.println (" bundle = new java.util.ArrayList ();"); pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), null, pw, "attrs", sourceFile); pw.println (" bundle.add (attrs);"); pw.println (" attrs = null;"); pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), "return", pw, "attrs", sourceFile); pw.println (" bundle.add (attrs);"); pw.println (" attrs = null;"); JavaParameter[] parameters = member.getParameters (); for (int j = 0; j < parameters.length; j++) { JavaParameter parameter = (JavaParameter) parameters[j]; pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), parameter.getName (), pw, "attrs", sourceFile); pw.println (" bundle.add (attrs);"); pw.println (" attrs = null;"); } pw.println (" methodAttributes.put (\"" + key + "\", bundle);"); pw.println (" bundle = null;"); pw.println (); } } pw.println (" }"); // ---- Constructor Attributes pw.println (" private void initConstructorAttributes () {"); pw.println (" java.util.Set attrs = null;"); pw.println (" java.util.List bundle = null;"); JavaMethod[] constructors = javaClass.getMethods (); for (int i = 0; i < constructors.length; i++) { JavaMethod member = (JavaMethod) constructors[i]; if (member.isConstructor () && member.getTags ().length > 0) { StringBuffer sb = new StringBuffer (); sb.append ("("); sb.append (getParameterTypes (member.getParameters ())); sb.append (")"); String key = sb.toString (); pw.println (" bundle = new java.util.ArrayList ();"); pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), null, pw, "attrs", sourceFile); pw.println (" bundle.add (attrs);"); pw.println (" attrs = null;"); JavaParameter[] parameters = member.getParameters (); for (int j = 0; j < parameters.length; j++) { JavaParameter parameter = (JavaParameter) parameters[j]; pw.println (" attrs = new java.util.HashSet ();"); addExpressions (member.getTags (), parameter.getName (), pw, "attrs", sourceFile); pw.println (" bundle.add (attrs);"); pw.println (" attrs = null;"); } pw.println (" constructorAttributes.put (\"" + key + "\", bundle);"); pw.println (" bundle = null;"); pw.println (); } } pw.println (" }"); } pw.println ("}"); pw.close (); } catch (Exception e) { pw.close (); destFile.delete (); throw e; } } /** * Finds the source file of a class. * * @param qualifiedName the fully qualified class name * @return the file the class is defined in. * @throws BuildException if the file could not be found. */ protected File getSourceFile (JavaClass javaClass) throws BuildException { return javaClass.getSource ().getFile (); } protected boolean hasAttributes (JavaClass javaClass) { if (tagHasAttributes (javaClass.getTags ()) || elementHasAttributes (javaClass.getFields ()) || elementHasAttributes (javaClass.getMethods ()) ) { return true; } return false; } /** * Tests if a tag is an attribute. Currently the test is * only "check if it is defined with two @-signs". */ protected boolean isAttribute (DocletTag tag) { return tag.getName ().length () > 0 && tag.getName ().charAt (0) == '@'; } public void execute () throws BuildException { destDir.mkdirs (); numGenerated = 0; try { JavaDocBuilder builder = new JavaDocBuilder (); for (int i = 0; i < fileSets.size (); i++) { FileSet fs = (FileSet) fileSets.get (i); DirectoryScanner ds = fs.getDirectoryScanner(project); File fromDir = fs.getDir(project); String[] srcFiles = ds.getIncludedFiles(); for (int j = 0; j < srcFiles.length; j++) { String srcName = srcFiles[j]; File sourceFile = new File (fromDir, srcName); builder.addSource (sourceFile); } } JavaClass[] classes = builder.getClasses (); for (int i = 0; i < classes.length; i++) { generateClassAndInners (classes[i]); } log ("Generated attribute information for " + numGenerated + " classes. Ignored " + numIgnored + " classes."); } catch (BuildException be) { throw be; } catch (Exception e) { e.printStackTrace (); throw new BuildException (e.toString (), e); } } public void generateClassAndInners (JavaClass clazz) throws Exception { generateClass (clazz); JavaClass[] classes = clazz.getInnerClasses (); for (int i = 0; i < classes.length; i++) { generateClassAndInners (classes[i]); } } /** * Checks if a collection of XTags contain any tags specifying attributes. */ protected boolean tagHasAttributes (DocletTag[] tags) { for (int i = 0; i < tags.length; i++) { if (isAttribute (tags[i])) { return true; } } return false; } }././@LongLink100644 0 0 157 10464315317 10262 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeExpressionParser.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeExpressionP100644 0 0 14032 10464315316 31461 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.compiler; import java.util.ArrayList; import java.util.List; import org.apache.tools.ant.BuildException; /** * Parser for attribute expressions. */ public class AttributeExpressionParser { public static class Argument { public final String field; public final String text; public final int length; public Argument (String field, String text, int length) { this.field = field; this.text = text; this.length = length; } public boolean equalsOrNull (String a, String b) { if (a == null) { return b == null; } else { return b != null && a.equals (b); } } public boolean equals (Object o) { return o instanceof Argument && equalsOrNull (field, ((Argument) o).field) && ((Argument) o).text.equals (text); } public String toString () { return "[Argument: " + field + ", " + text + ", " + length + "]"; } } public static class ParseResult { public final List arguments = new ArrayList (); public final String className; public ParseResult (String className) { this.className = className; } public boolean equals (Object o) { return o instanceof ParseResult && className.equals (((ParseResult) o).className) && arguments.equals (((ParseResult) o).arguments); } public String toString () { return "[ParseResult: " + className + ", " + arguments + "]"; } } protected static Argument nextArgument (String string, int startPos, String filename, int line) { if (string.charAt (startPos) == ')') { return null; } StringBuffer sb = new StringBuffer (); int i = startPos; int depth = 0; while (!( (string.charAt (i) == ',' || string.charAt (i) == ')') && depth == 0)) { switch (string.charAt (i)) { case '[': case '{': case '(': depth++; break; case ']': case '}': case ')': depth--; break; case '\'': case '"': { // handle string literals char endChar = string.charAt (i); sb.append (string.charAt (i)); i++; while (true) { char ch = string.charAt (i); if (ch == '\\') { sb.append (ch); i++; ch = string.charAt (i); sb.append (ch); } else { if (ch == endChar) { break; } sb.append (ch); } i++; } } } sb.append (string.charAt (i)); i++; if (i == string.length ()) { throw new BuildException (filename + ":" + line + ": Unterminated argument: " + string); } } if (string.charAt (i) == ',') { i++; } String text = sb.toString (); String field = null; int eqPos = text.indexOf ('='); if (eqPos > -1) { boolean identifier = true; for (int j = 0; j < eqPos; j++) { char ch = text.charAt (j); if (Character.isJavaIdentifierPart (ch) || ch == ' ') { } else { identifier = false; } } if (identifier) { field = text.substring (0, eqPos).trim (); text = text.substring (eqPos + 1).trim (); } } Argument arg = new Argument (field, text, i - startPos); return arg; } public static ParseResult parse (String string, String filename, int line) { StringBuffer sb = new StringBuffer (); int i = 0; while (i < string.length () && (Character.isJavaIdentifierPart (string.charAt (i)) || string.charAt (i) == '.' || string.charAt (i) == ' ')) { sb.append (string.charAt (i)); i++; } if (i == string.length () || string.charAt (i) != '(') { throw new BuildException (filename + ":" + line + ": Illegal expression: " + string); } ParseResult result = new ParseResult (sb.toString ()); i++; Argument arg = null; boolean seenField = false; while ((arg = nextArgument (string, i, filename, line)) != null) { if (arg.field != null) { seenField = true; } if (seenField && arg.field == null) { throw new BuildException (filename + ":" + line + ": Un-named parameters must come before the named parameters: " + string); } result.arguments.add (arg); i += arg.length; } return result; } }commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/package.html100644 0 0 1461 10464315316 27636 0ustar 0 0

Provides an Ant task that preprocesses Java files. The resulting files should then be compiled with the originals in order to enable attributes. ././@LongLink100644 0 0 146 10464315317 10260 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeIndexer.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/compiler/AttributeIndexer.jav100644 0 0 15072 10464315317 31365 0ustar 0 0 /* * Copyright 2003-2005 The Apache Software Foundation * * Licensed 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.commons.attributes.compiler; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.jar.JarFile; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import org.apache.commons.attributes.AttributeRepositoryClass; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeUtil; import org.apache.commons.attributes.Indexed; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; /** * Ant task to compile attribute indexes. Usage: * *


 *     <taskdef resource="org/apache/commons/attributes/anttasks.properties"/>
 *     
 *     <attribute-indexer jarFile="myclasses.jar">
 *         <classpath>
 *             ...
 *         </classpath>
 *     </attribute-indexer>
 * 
* * The task will inspect the classes in the given jar and add a META-INF/attrs.index * file to it, which contains the index information. The classpath element is required and * must contain all dependencies for the attributes used. */ public class AttributeIndexer extends Task { private File jarFile; private List classes = new ArrayList (); private Path classPath; private File baseName; private boolean inMaven = false; private final static String INDEX_FILENAME = "META-INF/attrs.index"; public AttributeIndexer () { } public void setJarfile (File jarFile) { this.jarFile = jarFile; } public void setBaseName (File baseName) { inMaven = true; this.baseName = baseName; } public Path createClasspath () { this.classPath = new Path(project); return classPath; } private static final String SUFFIX = "$__attributeRepository.class"; protected void copyEntry (JarFile jar, JarEntry entry, JarOutputStream outputStream) throws Exception { outputStream.putNextEntry (entry); if (!entry.isDirectory ()) { InputStream is = new BufferedInputStream (jar.getInputStream (entry)); try { byte[] buffer = new byte[16384]; while (true) { int numRead = is.read (buffer, 0, 16384); if (numRead == 0 || numRead == -1) { break; } outputStream.write (buffer, 0, numRead); } } finally { is.close (); } } } protected void findJarFile () throws BuildException { File[] allFiles = baseName.getParentFile ().listFiles (); if (allFiles == null) { throw new BuildException ("Unable to find any file with base name " + baseName.getName () + " in " + baseName.getParentFile ().getPath ()); } long newestDate = 0; for (int i = 0; i < allFiles.length; i++) { String name = allFiles[i].getName (); if (name.startsWith (baseName.getName ()) && name.endsWith (".jar") && allFiles[i].lastModified () > newestDate) { jarFile = allFiles[i]; newestDate = allFiles[i].lastModified (); } } if (jarFile == null) { throw new BuildException ("Unable to find any file with base name " + baseName.getName () + " in " + baseName.getParentFile ().getPath ()); } } public void execute () throws BuildException { if (inMaven) { findJarFile (); } if (!jarFile.exists ()) { log ("Can't find " + jarFile.getPath ()); return; } try { log ("Creating attribute index for " + jarFile.getPath ()); JarFile jar = new JarFile (jarFile); File newJarFile = new File (jarFile.getPath () + ".new"); JarOutputStream output = new JarOutputStream (new FileOutputStream (newJarFile)); try { Enumeration e = jar.entries (); while (e.hasMoreElements ()) { JarEntry entry = (JarEntry) e.nextElement (); if (!entry.isDirectory ()) { String className = entry.getName (); if (className.endsWith (SUFFIX)) { className = className.replace ('/', '.').replace ('\\', '.').substring (0, className.length () - SUFFIX.length ()); classes.add (className); } } if (!entry.getName ().equals (INDEX_FILENAME)) { copyEntry (jar, entry, output); } } output.putNextEntry (new JarEntry (INDEX_FILENAME)); Iterator attrs = classes.iterator (); while (attrs.hasNext ()) { String className = (String) attrs.next (); output.write (("Class: " + className + "\n").getBytes ()); } } finally { output.close (); jar.close (); } jarFile.delete (); newJarFile.renameTo (jarFile); } catch (Exception e) { e.printStackTrace (); throw new BuildException (e.toString ()); } } }commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/anttasks.properties100644 0 0 1507 10464315316 27512 0ustar 0 0 # # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. # attribute-compiler=org.apache.commons.attributes.compiler.AttributeCompiler attribute-indexer=org.apache.commons.attributes.compiler.AttributeIndexer attribute-validator=org.apache.commons.attributes.validation.AttributeValidatorTask././@LongLink100644 0 0 152 10464315317 10255 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/AttributeValidator.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/AttributeValidator100644 0 0 2346 10464315317 31435 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.validation; import java.util.Set; /** * Validates that a set of classes have the correct attributes * attached to them. This interface must be implemented by the * validation rules given to the {@link AttributeValidatorTask}. * * @since 2.1 */ public interface AttributeValidator { /** * Validates a set of classes. * * @param classes the classes to validate. * @throws ValidationException if one or more classes have * an invalid set of attributes. * @since 2.1 */ public void validate (Set classes) throws ValidationException; }././@LongLink100644 0 0 156 10464315317 10261 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/AttributeValidatorTask.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/AttributeValidator100644 0 0 15350 10464315317 31454 0ustar 0 0 /* * Copyright 2003-2005 The Apache Software Foundation * * Licensed 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.commons.attributes.validation; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.jar.JarFile; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import org.apache.commons.attributes.AttributeRepositoryClass; import org.apache.commons.attributes.Attributes; import org.apache.commons.attributes.AttributeUtil; import org.apache.commons.attributes.Indexed; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; /** * Ant task that validates attributes. Usage: * *

 *     <taskdef resource="org/apache/commons/attributes/anttasks.properties"/>
 *     
 *     <attribute-validator jarFile="myclasses.jar">
 *         <classpath>
 *             ...
 *         </classpath>
 *         <validator class="my.Validator"/>
 *         <validator class="my.other.Validator"/>
 *     </attribute-validator>
 * 
* * The task will run the validator(s) with the classes the given jar file. */ public class AttributeValidatorTask extends Task { private File jarFile; private List classes = new ArrayList (); private List validators = new ArrayList (); private Path classPath; private File baseName; private boolean inMaven = false; public static class Validator { private String className; public void setClass (String className) { this.className = className; } public String getClassName () { return className; } } public void setJarfile (File jarFile) { this.jarFile = jarFile; } public void setBaseName (File baseName) { inMaven = true; this.baseName = baseName; } public Path createClasspath () { this.classPath = new Path(project); return classPath; } public Validator createValidator () { Validator validator = new Validator (); validators.add (validator); return validator; } private static final String SUFFIX = "$__attributeRepository.class"; protected void findJarFile () throws BuildException { File[] allFiles = baseName.getParentFile ().listFiles (); if (allFiles == null) { throw new BuildException ("Unable to find any file with base name " + baseName.getName () + " in " + baseName.getParentFile ().getPath ()); } long newestDate = 0; for (int i = 0; i < allFiles.length; i++) { String name = allFiles[i].getName (); if (name.startsWith (baseName.getName ()) && name.endsWith (".jar") && allFiles[i].lastModified () > newestDate) { jarFile = allFiles[i]; newestDate = allFiles[i].lastModified (); } } if (jarFile == null) { throw new BuildException ("Unable to find any file with base name " + baseName.getName () + " in " + baseName.getParentFile ().getPath ()); } } public void execute () throws BuildException { if (inMaven) { findJarFile (); } if (!jarFile.exists ()) { log ("Can't find " + jarFile.getPath ()); return; } try { log ("Validating attributes in " + jarFile.getPath ()); JarFile jar = new JarFile (jarFile); try { Enumeration e = jar.entries (); while (e.hasMoreElements ()) { JarEntry entry = (JarEntry) e.nextElement (); if (!entry.isDirectory ()) { String className = entry.getName (); if (className.endsWith (SUFFIX)) { className = className.replace ('/', '.').replace ('\\', '.').substring (0, className.length () - SUFFIX.length ()); classes.add (className); } } } } finally { jar.close (); } AntClassLoader cl = new AntClassLoader (this.getClass ().getClassLoader (), project, classPath, true); try { cl.addPathElement (jarFile.getPath ()); HashSet classesToValidate = new HashSet (); Iterator attrs = classes.iterator (); while (attrs.hasNext ()) { String className = (String) attrs.next (); Class clazz = cl.loadClass (className); classesToValidate.add (clazz); } Iterator iter = validators.iterator (); while (iter.hasNext ()) { Validator validator = (Validator) iter.next (); Class validatorClass = cl.loadClass (validator.getClassName ()); AttributeValidator attrValidator = (AttributeValidator) validatorClass.newInstance (); try { attrValidator.validate (classesToValidate); } catch (ValidationException ve) { throw new BuildException (ve.getInvalidClass () + " failed to validate: " + ve.getMessage ()); } } } finally { cl.cleanup (); } } catch (BuildException be) { throw be; } catch (Exception e) { e.printStackTrace (); throw new BuildException (e.toString ()); } } }././@LongLink100644 0 0 153 10464315317 10256 Lustar 0 0 commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/ValidationException.javacommons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/ValidationExceptio100644 0 0 2703 10464315317 31414 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.validation; /** * Thrown by {@link AttributeValidator}s when an invalid set of * attributes are detected. * * @since 2.1 */ public class ValidationException extends Exception { private final Class invalidClass; /** * Creates a new ValidationException. * * @param invalidClass the class whose attributes are * invalid. * @param message a message describing why the attributes are invalid. * @since 2.1 */ public ValidationException (Class invalidClass, String message) { super (message); this.invalidClass = invalidClass; } /** * Returns the class that triggered the ValidationExeption to * be thrown. * @since 2.1 */ public Class getInvalidClass () { return invalidClass; } }commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/validation/package.html100644 0 0 1061 10464315317 30153 0ustar 0 0

Provides an API for validating internal consistency among attributes.

Many times, an attribute will only make sense in some context. For example, you may have one attribute that must either be applied to no methods, or to all methods in a class. An attribute may require the presence of another attribute.

The AttributeValidatorTask Ant task and its API enables you to define those rules and run them as part of your regular build. commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/javadoc/CATaglet.java100644 0 0 23202 10464315317 27457 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.javadoc; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeMap; import com.sun.javadoc.Tag; import com.sun.tools.doclets.Taglet; public class CATaglet implements Taglet { public static class AttributeTaglet extends CATaglet { private final String name; private final CATaglet caTaglet; public AttributeTaglet(String name, CATaglet caTaglet) { this.name = name; this.caTaglet = caTaglet; } public String getName() { return name; } public String toString(Tag[] tags) { caTaglet.addTags(tags); return null; } } /** * Name of custom tag. */ public static final String NAME = "org.apache.commons.attributes.CATaglet"; /** * Fully qualified class name of the legacy taglet class of JDK1.5. */ public static final String LEGACY_TAGLET_CLASS_NAME = "com.sun.tools.doclets.internal.toolkit.taglets.LegacyTaglet"; /** * List of tags. */ private List tagList = new ArrayList(); /** * Jdk1.5 legacy taglet class constructor. */ private Constructor legacyTagletClassConstructor = null; /** * Default constructor. */ public CATaglet() { try { Class legacyTagletClass = Class.forName(LEGACY_TAGLET_CLASS_NAME); legacyTagletClassConstructor = legacyTagletClass.getConstructor(new Class[] {Taglet.class}); //System.err.println("CATaglet will be wrapped."); } catch (Exception e) { /** * Legacy taglet class not available. Seams that JDK1.4 is used to * generate javadoc. No wrapping of taglets necessary. */ //System.err.println("CATaglet will not be wrapped. See stack trace."); //e.printStackTrace(); } } public void addTags(Tag[] tags) { for (int i = 0; i < tags.length; i++) { tagList.add(tags[i].name() + " " + tags[i].text()); } } /** * Return the name of this custom tag. */ public String getName() { return NAME; } public boolean inField() { return true; } public boolean inConstructor() { return true; } public boolean inMethod() { return true; } public boolean inOverview() { return false; } public boolean inPackage() { return false; } public boolean inType() { return true; } public boolean isInlineTag() { return false; } public static void register(Map tagletMap) { CATaglet caTaglet = new CATaglet(); caTaglet.registerTags(tagletMap); } public void registerTags(Map tagletMap) { Set tagNames = new HashSet(); StringTokenizer tok = new StringTokenizer( System.getProperty( "org.apache.commons.attributes.javadoc.CATaglet.sources"), File.pathSeparator); while (tok.hasMoreTokens()) { try { scanFiles(new File(tok.nextToken()), tagNames); } catch (Exception e) { System.err.println("Caught " + e.toString() + " trying to scan " + "Java sources. Javadoc of attributes may be incomplete."); } } if (tagNames.size() > 0) { Iterator iter = tagNames.iterator(); while (iter.hasNext()) { String name = (String) iter.next(); register(name, tagletMap); } if (tagletMap.containsKey(NAME)) { tagletMap.remove(NAME); } tagletMap.put(NAME, wrapTaglet(this)); } } private void scanFiles(File directory, Collection tagNames) throws Exception { File[] files = directory.listFiles(); if (files == null) { return; } for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { scanFiles(files[i], tagNames); } else { scanFile(files[i], tagNames); } } } private void scanFile(File file, Collection tagNames) throws Exception { BufferedReader br = new BufferedReader(new FileReader(file)); try { String line = null; while ((line = br.readLine()) != null) { scanLine(line, tagNames); } } finally { br.close(); } } private void scanLine(String line, Collection tagNames) throws Exception { int start = line.indexOf("@@"); while (start != -1) { int end = line.indexOf(" ", start); if (end == -1) { end = line.length(); } tagNames.add(line.substring(start + 1, end)); start = line.indexOf("@@", end); } } private void register(String name, Map tagletMap) { Taglet tag = new AttributeTaglet("@" + name, this); if (tagletMap.containsKey(name)) { tagletMap.remove(name); } tagletMap.put(name, wrapTaglet(tag)); } /** * Wraps a JDK1.4 taglet with a JDK1.5 legacy taglet. This is only done if * class com.sun.tools.doclets.internal.toolkit.taglets.LegacyTaglet * exists, what means that JDK1.5 is used to generate Javadoc. * * @param tag Is the taglet to wrap. * @return Returns the wrapped taglet. */ private Object wrapTaglet(Taglet taglet) { Object wrappedTaglet = taglet; if (legacyTagletClassConstructor != null) { try { wrappedTaglet = legacyTagletClassConstructor.newInstance( new Object[] {taglet}); } catch (Exception e) { System.err.println("Wrapping of CATaglet failed."); e.printStackTrace(); } } return wrappedTaglet; } public String toString(Tag tag) { return null; } public String toString(Tag[] _t) { String[] tags = (String[]) tagList.toArray(new String[0]); if (tags.length == 0) { return null; } // Sort by target Map targets = new TreeMap(); for (int i = 0; i < tags.length; i++) { String target = ""; String attribute = tags[i]; if (tags[i].startsWith("@@.")) { int targetEnd = tags[i].indexOf(" ", 3); if (targetEnd != -1) { target = tags[i].substring(3, targetEnd); attribute = "@@" + tags[i].substring(targetEnd).trim(); } } if (!targets.containsKey(target)) { targets.put(target, new ArrayList()); } List tagsForTarget = (List) targets.get(target); tagsForTarget.add(attribute); } StringBuffer result = new StringBuffer(); result.append("

Attributes:"); List attrs = (List) targets.remove(""); if (attrs != null) { result.append("
"); Iterator iter = attrs.iterator(); while (iter.hasNext()) { result.append(iter.next()); if (iter.hasNext()) { result.append("
"); } } result.append("
"); } List returnAttrs = (List) targets.remove("return"); if (targets.size() > 0) { result.append("
Parameter Attributes:"); Iterator parameterTargets = targets.keySet().iterator(); while (parameterTargets.hasNext()) { String target = (String) parameterTargets.next(); attrs = (List) targets.remove(target); result.append("
" + target + " -
"); Iterator iter = attrs.iterator(); while (iter.hasNext()) { result.append("    " + iter.next()); if (iter.hasNext()) { result.append("
"); } } result.append("
"); } } if (returnAttrs != null) { result.append("
Return Value Attributes:"); result.append("
"); Iterator iter = returnAttrs.iterator(); while (iter.hasNext()) { result.append(iter.next()); if (iter.hasNext()) { result.append("
"); } } result.append("
"); } tagList.clear(); return result.toString(); } } commons-attributes-2.2/compiler/src/java/org/apache/commons/attributes/javadoc/package.html100644 0 0 201 10464315317 27403 0ustar 0 0

Provides a Javadoc Taglet for documenting attributes.

././@LongLink100644 0 0 174 10464315317 10261 Lustar 0 0 commons-attributes-2.2/compiler/src/test/org/apache/commons/attributes/compiler/test/AttributeExpressionParserTestCase.javacommons-attributes-2.2/compiler/src/test/org/apache/commons/attributes/compiler/test/AttributeExpres100644 0 0 10463 10464315316 31471 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes.compiler.test; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.Iterator; import org.apache.commons.attributes.compiler.AttributeExpressionParser; import junit.framework.TestCase; public class AttributeExpressionParserTestCase extends TestCase { private void singleTest (String expression, String className, AttributeExpressionParser.Argument[] args) { AttributeExpressionParser.ParseResult result = AttributeExpressionParser.parse (expression, "noFile", 1); AttributeExpressionParser.ParseResult expected = new AttributeExpressionParser.ParseResult (className); for (int i = 0; i < args.length; i++) { expected.arguments.add (args[i]); } assertEquals (expected, result); } public void testExpressions () throws Exception { singleTest ("Inherited()", "Inherited", new AttributeExpressionParser.Argument[] {}); singleTest ("AnAttribute(1,2)", "AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, "1", 0), new AttributeExpressionParser.Argument(null, "2", 0) }); singleTest ("AnAttribute(\"sometext,1,2\",'a',',')", "AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, "\"sometext,1,2\"", 0), new AttributeExpressionParser.Argument(null, "'a'", 0), new AttributeExpressionParser.Argument(null, "','", 0) }); singleTest ("AnAttribute(\"sometext,1,2\",'a',',',alpha='\"',beta=\"\\\'\")", "AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, "\"sometext,1,2\"", 0), new AttributeExpressionParser.Argument(null, "'a'", 0), new AttributeExpressionParser.Argument(null, "','", 0), new AttributeExpressionParser.Argument("alpha", "'\"'", 0), new AttributeExpressionParser.Argument("beta", "\"\\\'\"", 0) }); singleTest ("my.package. AnAttribute(\"sometext,1,2\",'a',',',alpha='\"',beta=\"\\\'\")", "my.package. AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, "\"sometext,1,2\"", 0), new AttributeExpressionParser.Argument(null, "'a'", 0), new AttributeExpressionParser.Argument(null, "','", 0), new AttributeExpressionParser.Argument("alpha", "'\"'", 0), new AttributeExpressionParser.Argument("beta", "\"\\\'\"", 0) }); /* singleTest ("my.package.AnAttribute( \"sometext,1,2\" , 'a' , ',' , alpha='\"', beta=\"\\\'\")", "my.package.AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, "\"sometext,1,2\" ", 0), new AttributeExpressionParser.Argument(null, "'a'", 0), new AttributeExpressionParser.Argument(null, "','", 0), new AttributeExpressionParser.Argument("alpha", "'\"'", 0), new AttributeExpressionParser.Argument("beta", "\"\\\'\"", 0) }); */ singleTest ("AnAttribute( \"sometext,1,2\" )", "AnAttribute", new AttributeExpressionParser.Argument[] { new AttributeExpressionParser.Argument(null, " \"sometext,1,2\" ", 0) }); } }commons-attributes-2.2/compiler/project.xml100644 0 0 3566 10464315316 16362 0ustar 0 0 ${basedir}/../project.xml commons-attributes-compiler Jakarta Commons Attributes Ant Tasks and Utilities org.apache.commons.attributes.compiler Attribute Compiler An Ant task that will precompile Java source. ${basedir}/src/test ant ant 1.5 qdox qdox 1.5 commons-attributes commons-attributes-api 2.2 javadoc javadoc 1.4 commons-attributes-2.2/compiler/manifest.mf100644 0 0 2345 10464315317 16317 0ustar 0 0 Manifest-Version: 1.0 Ant-Version: Apache Ant 1.5.3 Created-By: Apache Maven Built-By: hen Package: org.apache.commons.attributes.compiler Build-Jdk: 1.4.2_05 Extension-Name: commons-attributes-compiler Specification-Title: Attribute Compiler Specification-Vendor: The Apache Software Foundation Implementation-Title: org.apache.commons.attributes.compiler Implementation-Vendor: The Apache Software Foundation Implementation-Version: 2.2 Extension-List: ant qdox commons-attributes-api javadoc ant-Extension-Name: ant ant-Implementation-Version: 1.5 ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5. jar qdox-Extension-Name: qdox qdox-Implementation-Version: 1.5 qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1 .5.jar commons-attributes-api-Extension-Name: commons-attributes-api commons-attributes-api-Implementation-Version: 2.2 commons-attributes-api-Implementation-URL: http://www.ibiblio.org/mave n/commons-attributes/jars/commons-attributes-api-2.2.jar javadoc-Extension-Name: javadoc javadoc-Implementation-Version: 1.4 javadoc-Implementation-URL: http://www.ibiblio.org/maven/javadoc/jars/ javadoc-1.4.jar Implementation-Vendor-Id: org.apache X-Compile-Source-JDK: 1.4 X-Compile-Target-JDK: 1.4 commons-attributes-2.2/site/xdocs/maven_demo.xml100644 0 0 12006 10464315316 17305 0ustar 0 0 Jakarta Commons Development Team Tutorial - Maven Demo

This is a quick demo that shows how to use attributes together with Maven. Don't worry about 90% here seemingly being pure unexplainable magic - the purpose of this part of the tutorial is to show you what steps you must do to make the Commons Attributes package work. In the reference we'll focus more on just what happens, and how the all features work.

All files required for this demo can be found in maven_demo.zip.

In order to get attributes working in your project you need to do three things: (1) declare dependencies, (2) install the commons-attributes plugin and (3) set project properties that will enable the plugin for your project.

Dependencies are declared as you would expect in your project.xml:

commons-attributes commons-attributes-api 2.2 commons-attributes commons-attributes-compiler 2.2 ]]>

You can install the plugin by checking out the sources and doing:

Alternatively, you can download the plugin and put it in your Maven plugin directory.

Since Maven will unconditionally apply all plugins to every project being compiled it is neccessary to explicitly enable the attribute compiler and/or indexer. This is simply to keep them from being run on projects that do not want anything to do with Commons-Attributes. The compiler and/or indexer are enabled by two project properties that you can set in your project.properties file or in your maven.xml file:

The first property will enable the attribute precompilation step. The second will enable the attribute indexing step that takes place after the jar:jar target. Both properties can be set independently of each other, although it makes little sense to enable indexing if compilation isn't enables as well.

You should be able to unzip the demo files, cd into the directory and execute "maven run", like this:

commons-attributes-2.2/site/xdocs/attributes-logo-blue.gif100644 0 0 3426 10464315316 21177 0ustar 0 0 GIF89aL!Äÿÿÿîñõ¼ÈÕ2b@l$Mw5[EiŒVv–g„¡‰Ÿ¶š­À«»ËÌÖàx’«Ýäê,L!ÿ !Ždižhª®lë¾p,Ïtmßx®ï|ïÿÀ pH,ȤrÉl:ŸÐ¨tZ; ®ˆuËíz©†‡#@.“ Äw{ Þ ¶\^X˜ïæÁ|2Ê|‚Scy neƒ w’KŠd ‘$  “{x Ÿ¤D†j)Y'±(VW™&XZ"¶¸%ºW¼%¯²³µ·'ÂĽǭ3xq&XÖ×X¾ØØ´ÚWÝ&¶ÀßÐ%»âÃÛìÝåÙ%ÏÍCve«0xø#¨ŒN@¸÷oŠdüЇ'@?† œ°‡ï€4Q24ÔS¬¡Ç‹ïpDeF5†ÿŠ Yf°KÊÏȽ43Šˆ3*_h$#€Á–zŽÈsâLM8-Sbh*£HË(aF!‹#*‘qð "¯+ 0•Œ¸7pA:ˆ;À Ý2sãöÄ;!™ br»SâˆPnMPµx—°ÞÁò>ö¦ˆ¬Ù„E쥢ÇÂêb§ˆâBLÆ0‰–6czj¼$<ƒ6$`tT¨‘G TZ@ÁÎ+ÚÎ2ià$ŽŸPNylò2Ä”hP&ÜTÕçœWƒ¾œûA2¼}#ïaé¤ Ò[E¼pÒ*zš4á>|3óE 7±¾ý?É'ÂP9ÕàGi˜ÿ C²Bƒ(@8ÂT­I8 Q«‘Î>ùÅFF‡¦!†#P B Š`ONmaÖ*Å€?)¥Û_(¼8¡HÏ)(ÂT à°Ož|UF‘*LubSg à$ >þh" SЉ"\´àT-f)U”R’Á¤mµÖBƒÈm™˜’‘ñ8ÂEŠ$ gJ$ÐIF’l¢àfs~(ØTI¶•^ ¤å¤v)\d ŽBz‰k»å9i ì$äR{šp‘–fzB¤e‚·Ä‘O®`È£A*ÂØs¦›(‚ ¬²Ž@«­+]ÚÝ›°x¥Ô‰°00Þ …ó§«)(r¨ Ò¢P-ÿìÃ諦ŽP­éMÀpkì ×RÛí2f(›H-¦“Œ'ü©ÞC1ŠPŽÐÎ;@¾;Àï½ôš`/¶Q¹Š!!¯ V‰‹,Zߘ–`§-’'c53¯Å;€éœñ›'ƒÜ‘Gþ¸ÇðÂ@Z“d"6\bS¥Aæ: L@Έq4s YÚ¼PKƒˆ€_ò-k‚_ \cÉÃC«Puvx°EÏÕ¤±êÏ;g˜êÕ­âQîÒø9½CÌBq9ê¥SRÝk@¤•rkH·Ýf^(b£pw{¤9Š«^|©–ZÓ‡D#œãc¦ÒäXRN¡7GšW¬á`' ¥C¥ª‰Bÿ· «4ëJIîC‹! ìÈì#¸Nì´ÓÞyâwJ€íãš9T¼biØÂz‹ƒŽ‡,0ó¤-è¼Ó·… ž%èž=ãÏsßBñ’è©“?$ä`ý.¨òá“>‡Ž·¾òŸ›–~—KŒõ¦+iÔ1±8’}$Å?À0T¡=¼„@ܨ c½RYßvÀD/3ªÎ„’¤M%唡š5TX þÄ9 ª^TYÉJ0KÏle&C€"@„Ã*t$À,I0Ì䜒©ô•)X™ZÝák¨p"¢ÙŒ©àCŒ`²Ò5I™M”àešx©¦þà´©© e ' ÖÂÁ†¥ÑJ¼ƒg©N´^ˆ©sxƒ|Ù°X‰A+ó,U>éò/|¢S‘ü<ÂtWzŽ *V;GP,¥HT-F|ʈ’›ƒû!ÀFÖᬀ‰Ü Tz–ÒÇ piL=â®ب4›©çZZ“QŒ4Â&vb¢$`<HÀ1‚é+œT½pª lœ¤.5C‡z`!‹œ2Hj;ÇÁ²ÊPçGT¡ n¨Àª²`jXКv@Ã]-…^÷Ê×¾úõ¯€ ¬`KØÂö°ˆM¬bËXÆ;commons-attributes-2.2/site/xdocs/attributes-logo.gif100644 0 0 6316 10464315316 20253 0ustar 0 0 GIF89aL!÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,L!ÿÿ H° ÁƒþLø¡Â‡.„hP¢@‹36|ˆQãFþ:N¼¨PäHŠ&-J éq É–aVŒ)3ãËš6?Þ,¸§O˜=gòü)tdP C[MãQ”¡F$*µ$U’H§^Í ¨Ã—+m>Ýš•¬Õ“dw>‹ÕãM¶f㺬ÙS$\†p«Nü:—k߉҂ ¯ëFµg+ÝŠWnÔ¶‹iý«Ø±[¿Œ#cþ'îÑ  CƒVâ'B´–S‡dIÕîÛ’Èþóøteº©k3Œ’ïÙÕ›C.ïè㢓Í{™2ïÖI5?çøéµÝ& NÒ´Úá4Ä4~TKJå (™SØåß~¯ý r ˜÷W}»¡&âv¹Ù…|0Á“˜&a’ÁÌ#4>"B ¦_c …#Ø0… ”c0 ú&Î`A.ÏŒ5ÞxPŽ Ç™`I éH0â”r~4Ø—`6d˜a:9¦`N”£~™eAƒÅ£&•’I¦4 ¹Ì0Á¤)dJFâEÆ…æ¢aâ°$,:ЊtD‚¢ R:Ü¥ IÊ™£ÈEj  ‘™¶¹%r¡x¨(*ÿ7<Öºj­ÇÉJ*rtYPzï ´k®l Dkª1¥G®È)çϰÈ)±‘4·ŠÖ*Šöí'ŽhŽ Šul<Ò†”ÜHˆöѹ9¢.Aß‚6A¸lHZ‡‰æé?«¶Ùž hÑÞ¾Åéé†FµJÈ&[h7$Ѱl±9¬„;,[¹¡Ù§ ½—/²AŒqh$ì¶!ha)L­Æ·Þ0qÃ1Ì×ÀZØ ÁZ5—(‹…kÈIª(o±+—jP<>pÃEMCj<Ú@ÐÑ<’d<éM°£?UËj®Ôqzí?ñ€’„œF!”0ŽH#šŸ^†VeÞ ÿ)QÓEëŒö@€®÷?ðhZš O½Ð06cTx_“Ä)(,ÅÊÛRz‡áCÒÓKM—KÖ2Äuß¡šÅ{øGC»@M¯=P<íùúì:´­íÅköOâølê?¢ûP¼Œ÷»¼¯R?PÂË7ýGÛã¾8C jÁCñŠÏW¼×ñèÏÑÑZ  ÙnPq³Èb&9¯1d{¤s†êH^y­« õ^¨øˆÂ¥2Õ¬$áêYkͦŠF Tô¶r«Jµ„}E¡cBØ¡ÅñŽEñÈ¡@تšnñ`à»§7&ìZý(¹»2@‘I ®²pì=Ƴ¾IØ>æ4ƒxöz¥ò‡4,8J-&³ ŠÅaiM;[Ôÿ‡]û‘^xr«FrG 4ÄFÉ ªZî  zOrª¥'Ë]®ÑÒ=V4fºæÑD¦&¥‰G§3³¬¦ð¡È¼1oÓ^Hô^—xÀ M”þ,¾H· 赈{—#$ïæ–< ÈÉÈËÒ„œV¶î×?Âç4¬jQ f0yOæ¢Ó#`bXíÈɇ®µk±`åˆ[qåðJ+²ªcÄF, ¨a2”yÁû•‡9ÌÞ‚œÌÅiš × Ëö2È̬êèv›ÅW_%c]”'@Í®iÐ <|fW§SCÈIq”úb£THhþøëÅÿºY¥±ACÖ1×Ç ½±@¬¹á³€Í~tFôŒÕݦ€,Â[›Ú0Êöt¢»Jçð8 æÐPzxÑÈðnWµÛaÚ%Ž~Z¤²é["€»É­ê©)ƒ¸RÑyµddAy%IÖš®Ÿ@îY,7o„”޵®…ÝÎ!YÊò Ú\V•Þ»êñÜt']M IC|¡IÙdÉ‹3XhGBÈy¼/RÛÚ±ü6XÂ`d¡‹ ‡(ÑèíÐô!‰<ÈG¥·o}‡Æ!²cï= 2pܵ‡³ áÔ ’$;X\ˆZK0´Àæp¤ÇWòIGÀ†œˆEÎ:¶ÙzV´ð²ŠÓíÿaoÂTžª„„úÉ/%ÈŠl0rˆU)aûré“' …€uLÌð›±ßÇB“cÖè ¹¡@8uí'›P^³ùG¸F?8bE†¤©Qu1Wh¡X(žƒ,u†Öá1P˜x}Òã‚"-‚$a€C×ÿ1ƒ¼±óW€qs‚ÿÕƒ/è‚(?88b2ƒ÷„4aƒmÑ„<„  <˜5h…C;commons-attributes-2.2/site/xdocs/ant_demo.xml100644 0 0 30744 10464315316 16772 0ustar 0 0 Jakarta Commons Development Team Tutorial - Ant Demo

This is a quick demo that shows how to use attributes together with Ant. Don't worry about 90% here seemingly being pure unexplainable magic - the purpose of this part of the tutorial is to show you what steps you must do to make the Commons Attributes package work. In the walkthrough we'll focus more on just what happens, and how the all features work.

Download the following files and put them in your $ANT_HOME/lib directory:

Download these files and put them in a directory of your choice:

The buildfile is already set up, so you should only have to do the following:

If you have JDK 1.4 or later, you can also generate Javadocs for the demo with attribute information in the docs:

Look in the javadoc/ subdirectory for the results.

The demo consists of two files. We will first look at the Java source file, and then the build.xml file.

This is simply the definition of an attribute class. It takes one constructor argument, and has one named argument.

OK, now it is getting interesting! This is where we add one instance of the MyAttribute class to the AttributeDemo class. The two @-signs indicate that this is an attribute, and will cause the attribute compiler to pick up the attribute. The first string will be passed to the constructor. The second parameter, however, is on the form name = expression, and will result in the setNamedArgument method being called.

This is where we access the attributes. The Attributes.getAttributes method returns a Collection of all attributes attached to the AttributeDemo class.

The build.xml file is pretty much what you'd expect - a target to compile the Java sources, and a target to run the demo. But in addition you'll find a target to preprocess the Java sources.

The attribute compiler works by first generating a bunch of extra Java sources (one extra file per class with attributes). These extra java sources are then compiled along with the original Java sources. Here's some art to illustrate the process:

Attribute Compiler ---->|Generated Java Files| +------------+ +--------------------+ | | | | | +-------------+ | +-------------->|Java Compiler|<------------------+ +-------------+ | v +-----------------+ |Java .class files| +-----------------+]]>

We must therefore invoke the Attribute Compiler before compiling the sources.

]]>

Nothing special here. We define the Ant tasks provided by the commons-attributes compiler.

]]>

Again nothing special. Just a convenience target to clean up all generated files. But after that comes:

]]>

This is where we do all the preprocessing. The Attribute Compiler generates a set of Java sources with attribute information in them. This is where we tell the compiler to generate attribute repositories (autogenerated .java files) for all existing .java files. When those files are generated, we go on to compile everything:

]]>

Since we use attributes, we have to include the commons-attributes-api-2.2.jar file in the classpath.

]]>

This target simply runs the compiled demo class. JDK 1.4 users can in addition to this generate Javadocs:

]]>

See Documenting for a walkthrough of the Javadoc Taglet.

]]>
commons-attributes-2.2/site/xdocs/indexer.xml100644 0 0 4676 10464315316 16627 0ustar 0 0 Jakarta Commons Development Team Reference - Indexing

The AttributeIndexer tool creates a list of classes that the o.a.c.a.AttributeIndex class should consider for inclusion in its index. The tool is run on a JAR file and will create a file named attrs.index in the META-INF folder. The process is:

This is how the indexer is used:

]]>
Parameter Required Description
jarfile Yes The jar file to create an index for.
commons-attributes-2.2/site/xdocs/images/attributes-logo-white.png100644 0 0 34104 10464315316 22671 0ustar 0 0 ‰PNG  IHDRæP ù ÓbKGDÿÿÿ ½§“ pHYs  ÒÝ~ütIMEÔ¿®½ IDATxœí½yUU’?þyULÄÄD´@mT11Ó"Rl ”Ú =´Ê"PK(tÚ£Ýì´KG»0” ´€¢€ ¬ÅÖPЂ2€4K ÍVÈ*µ£²×{õÞùýQæ5oÞ<÷=ÚùÆo¦™qã½wßYòdæ'3OÞsï c n£ðê·ÙÔUÀm÷?i jë²­_;¿ÿn—V­þßB³­ð¾´~åø«mnÞ¼é9Þ|óM_ú©í­[·\ínݺenݺå¢; ™³gÏšiÓ¦™¬¬,§¢•è:uªï˜£GöŒwóæMsêÔ)3zôh_>S[:4Z9½\–»vírÑMgvìØaêêê\ãiò¤¹ïܹӌ;Ö5÷åË—;|ùòË/͘1c|uhÉ’%¾ØdAó7nœ«üü|“ŸŸïšk^^ž£C±ê%ñ-›H$b"‘ˆ1Æ+0wïÞíšü¸qãÌÎ;œ9sÆäååy&^XXh®_¿î9nܸá0€]¶l™kŒ±cÇš’’ M]]9s挙2eŠª€ÑÆ9}ú´™2eŠJ#³lÙ2‡ŽhŠJG—.]̵k×ÌÕ«WÍÕ«WÍÖ­[MZZZLmÓÒÒ̵k×<Ñ]\\lFm5Dë™3g| ?&Ožì¢wòäÉ1µ`Fe¥UÊ2 š³gϺ”4++ˬX±ÂÑ’·F{NNޝ,—.]jòòò¬†ˆd¹}ûö˜ <³xñb‡/W¯^õÑœžžnJJJ\²®®ÎìØ±Ã3¯›7oš7n8}ÙÀo§ Ì?þñ.õÕW.Bêêꜻtéâ™ôÂ… Í·ß~ëW®\qMþÆæÍ7ß´…÷OÌÊÉÉñŒ“mgÔ¨Q&''Çäææª‚Y²d‰9yò¤CZZš9r¤Y´h‘Y¸p¡1b„ÚnâĉæòåËfþüùι˜ ˜… :m5ÀNœ8Ñ|ýõ×®ã›o¾1ß~û­éÒ¥‹ÉÉÉQùI‚^²d‰Óo—.]̤I“œ1;w;zô¨¹|ù²0`€3ÏáÇ»èÍÎζ¶Õh%>“,% òòò\ºB^—ä¹xñbÕp;vL•gNNNTYºäMiiiæòåËÎ!çGºÊÇ$ïn›‡DͰq£&£˜”éééNÅ ¹~ýº¹víš¹r劙4i’gÒ-Z´0µµµ¦¦¦ÆÔÖÖšÚÚZsùòegâ‹-ò0–[êÿêի޾ùæG¹ø1`Àg ç믿vÚÙ<½sçÎfóæÍæë¯¿vú¨©©1555æðáÃêÜ>üðCÀôë×Ï8pÀTVV:GUU•©®®6‡2-Z´ð´åu+++MuuµÃ'R½#FŒ0¥¥¥æòåËz_{í5O»_ÿúצ_¿~€)((Pi­®®6óæÍSÛjõkkk?~Ü¥¹¹¹®˜ËóÊ•+Ž,,X òöðáÃyrÀhšÆÏÎÎ6GŽqxR]]mªªªLUU•ÉÌÌô´ûðÃ}ç·e˧n—.]ï§éé•+W\õ5ƒ&AÏ*ÁéJþìÞ½<ðýĹsçТE c‰D‰Dœïôyá´kײÌ;ýúõð}¢ àÀèÕ«—S¯K—.غu«óû»ðÚ9h,::tè€K—.©cñ„D\\âââè\è®»îj$i0`æÏŸ¯ÎJAAæÎë™_ß¾}1{ölç7Ÿ#Ñ0wî\¸Ú­]»;vt~Do||<Ö®]‹§žzÊ3æüùóÑ¿­œÞÎ;{ø³gÏFß¾}}éíß¿?öïßïÔIMMž}û/^tÉËËsÀ‰DTBˆÑ³gÏv1xæÌ™HLLôcïÞ½.‹ 4X-Ù4Y~®]»va–——ãƒ>pÆáÊó¸ã JJJŠó? „ ’¾·nÝÚ£III¾ ¤>222à{y>ú裘7ož«Ÿƒâüùóއãtj4Ö××£®®Îá‹ä )/¨««à5ãããQ__víÚaãÆNÝñãÇ#‰à™gžq…Ì|)dŒÁÊ•+>È¥õÏÇ$ºx˜œ`ŒÁÅ‹]b»víê F%¤s/*Á“””„úúzOüM|úé§.¦×"â% 9c9ƒyä0:äš§,.šÍS ÓÌ`0è C8ó9@e1Æ  ºøà6p0môÚ€IC®ylÀ¤q‰^ªË– y.ΧhòlÛ¶-RRRPQQáêkÿþýxøá‡=´ÚxCÞÔÌ@  F"œ^Ì„„ôìÙøÃ\õ'L˜€uëÖá•W^AûöíÕ9fdd  ¹ä+AIãñq9fàÏþ³kð´´4”œÒZ³åb˜~WUUy˜‰D\Ê`[¸ËIh!8pmÚ´ñ(g›{ ú”cÆLg]ðãããOÛœ9øãââ\Ö>šÇäà䯀o[®<ÒCØ—ÚR¡6H@ƒ÷!#(= ã´RíÚµóôwðàAôèÑÃ%‹¸¸8-T(ŒåÀ$Þðq4ÉeA<¡È¥iÓ¦6l ]m8€ÜÜ\tèÐo½õ’’’\sÔ’Vñññž¹h¸¡’{÷îu Lá) µ«lKç8xÿú׿z˜B!/ài"œyÉÉɨ¬¬tõwéÒ%Ü{~v~““Íëñè󀄯*µ•óKHHpÎÙ¼‚\«,ø\µ¶´‘†„+![[¢øôèQO][ôà µ– NNNöôUQQဆk4ÁuTA¶u%]¾ãÑ>fÌTTT`óæÍž¶DÏž=ñÄOàñÇGRR’óŸmIC‚m ÆWö‰˜jËè©W\\¬F?|$uÆ&Oº,=™_¨.#9?m97êóšGOápC† ÁÚµk1dÈ•_ÕÕÕ˜={6ÊËËUã‹AŒ3Æ //ÏóÇܹsÕKó˜œÁÊ#GŽ !!5B£FàÙyGŽQC,[²‚g=yiÛ¶­Ç+ð0Sb2¯«Òß/îýêDSN‹\iEþ¯ËoL?Zmmù<¹…oÚ´©§nii©'ò±- üd øËS¹¦:±sÙ  ì711#FŒÀÊ•+ѽ{wO¿ÕÕÕX¹r¥êl8vlámÐpóª,Àþýû=k ú.cdbr\\>ýôSŒ92&¯IÀäDkab²¼&úðë!›M˜ÚÿjH¡„Yrí¬)¾-D³­»¹qð£WëO®ïeá—Dl‡my Ç úøžj*555Ž—ð[cÉ~7mÚäê§]»vHII±òÇÆ›¡ò3J¶ä¥1“'OÆêÕ«}ûOLLÄ«¯¾Š—^zÉÓ÷Ž;ÔH0ÚºøÎcvíÚU½ã}̘1¸té’4ÚZˆ&uðàA >|ð˜|5•£GâèÑ£.؈¥q´kh?ü°jýüÂ?A°*«Lrñz±(:´¤'ZÂH+±xnN“LßkŠÉiå—ª¨ÜsÏ=hÖ¬™§þŸþô'u}f[{kò|ä‘G<4qo-‹ 8œ^[Žƒç@4;vLíWÝ»wGvv¶«mMMšHÒ²Ç2:t¨5j”‡èŠŠ ¼õÖ[(//·®m8³ÿú׿bøðáèÔ©233])ãøøxdffâ'?ù‰gœmÛ¶©ÀÔÀ©yË_þò—HMMUB‚‹¥p¡ÄÊÚ<¦MȲ_[Û¡W3Z=¹#I~…^Iãc=æ©¿sçΨzÂKEE…ëwJJ ~ñ‹_xŒž_NôØh¿yÈRRRâ©x—2@999žö2©E2‘ꄲ@05¯¹eË<ûì³8räˆ5ÔŒD"X°`òóóQ^^Ž÷ßß^ÑñÞ{ïyÆX¹r¥³3HZ?iIŒ1®íx©©©øýïoF,B•Œ·yYÇ6–Ÿ’íy‰¶¾üÆ“a®¤ÛæQüæÔ·o_´lÙÒU¿¶¶ëÖ­S)A À³µòÝwßUAy;2¼]ÞD뿨¨H•9OvÆÅŹ6À½÷Þ«f•ý’œt¸.—Lœ8Q%¬ªª £FÂO<÷ßÛ·oGqq1>ûì3LŸ>>ú(Þ|óMÀ{gÔÔT«kÑ¢f̘áùï7Þp¾Ë„ ?·páBgótjjª³ùÞ~L×”NzN­øÒoÜXÁK‰e<^+•<ÿ·*ï¸qã}úàí·ßvûâ‹/0yòdç·ôšÆlÚ´É1©©©(**Bjjªªxœy’aTüBÿÉ^¨ÛÑd6E¨¬¬ô£1FÓ¯ð9ÔÔÔ¨ôÚ<ša HÆV¯Y³f˜4i’œ¯¼ò jkkx£ åã?îÔŸ5kúô飮å¸,©O^´%ŒÐÒÒÒÛžÐa5k–Çk’§$`þéOrÚ<øàƒ®5'þlQ§gɉ0`€ëÎüXJRRþð‡?àç?ÿ¹j 4ÁôêÕ ……….÷¿sçN<ýôÓX·nK¨ÅÅÅøÿøüîw¿Ðp£òÊ•+‘’’¢&w88ããã=›ôi¬ÚÚZ_O°mÛ6OÛªª*Gõ°+W®ô´=zô¨º¡Ÿ¹®à¹-Ïæå‹‹‹=m?ûì3_¤s½Ÿ}ö™/­@Íš5ÃäÉ“qÿý÷;çkkk1|øpâäÉ“dYZZŠ3f oß¾¨¬¬DJJ f̘޽{[AÉÁùñÇ{hX»vmÔÐwûöíªÁÓø¥•ââb<ýôÓ8r䈋ÚD3gÎçQ ÝºuÃK/½äÔ£bŒû¡~I @(2t­vnÔÕÕáìÙ³9r$>ìKp^^† ‚ôôt4nÜ7v®[0$a|ãB0ÄâÅ‹±bÅŠ¨ž¢mÛ¶xñÅÑ©S'ÇZÑDøMÒ¡P[¶lAUUvìØãÇ«ý5oÞ­ZµÂ<àÊ2ž>}'OžÄ®]»ðÅ_Xéy衇ðÓŸþM›6ÅücÀ‰'pêÔ)ìܹÓÚ6)) =ôZ¶l‰¦M›âG?úNœ8'N`×®]ª×€Ö­[£U«VhÙ²¥& w:u %%%V&%%¡{÷îhÙ²%Z¶l‰»îº @ÃãdNž<éÛ6##Ý»wÇ]wÝ…ý×Å~ô#ÇÀJïtâÄ ÌŸ?ߣ­$%%aذaxê©§]!Ťí”$ÏC‡áèÑ£X³f•7Í›7Ç<€–-[:¢¶¶§OŸÆŸÿügìܹÓJKëÖ­Ñ­[7<ðÀÎܦNŠÚÚZ$%%!..Îqrr²sÓµ1[¶lqæ4pà@äææ:xâ—ˆ5BãÆñÿð®ƒã'Pßð Wæˆîä¾yó&Î;‡ýû÷cëÖ­ŽwjÖ¬Z¶l‰îÝ»#!!Áé¬I“&® äâIh¤HÚxÁ`‡‘#G\ ‡=z }ûö¸ûî»]À§>å–¾`0ˆñãÇ{²¹üSzðàž{îÐðx‹“'OZ3ƒ2ƒ|ï½÷¢ÿþ0Æ`ݺu8qâDÔ¶ôI@Y»v­C÷¼ð¶/¾ø¢3·©S§º¬8ïCK¤ñ¹ÞnÛ~ýúáÇ?þ± ˜ÚõÓªª*ÇÐð>322Ю];tìØÑ%K2àd¸¹,—-[†ÒÒRßä§õù矇1§NÂúõë­û¶åüˆ/4ΩS§’’‚-Z8´;v ÕÕÕ8räˆs™')) mÚ´ÁÏ~ö3õº¿äa¦I“&(›4iâ.`rå&¯yóæMçñô¸þܲœœÙd ¥àøŽùø ¹…Ž,LBB‚C4õM æq;ßmâŠÙ@´9g^||¼kNdd¤! ½ |ßñÄ£n”äsl¨­¶Ï˜ O8!OàûÝVD+oKóÔRõÄ_â'Í—Œ)Í•ÓÊ·×_%¨¹²Sát’g ƒÏ“)%¶k˜ÜHrÚä˜Ä#2|,>7‡tOêµt6|í¨m”‘zHü&@jÀL°eš8èä£/\±p à¡1‹‡´rýFçy}ÞÕÓ¬b$q “×çsà`ã–’§ú\ ȶõ¤–dˆ–Pñk+ÿ£ß|~Z[­oÛo9í·­2Ù"/ÒK`JÏ*£œ§ ‘årˆÓÊAÀs«.¯£}·YdY8`$Ó¸BI pÏ-£©ˆÒsP[âoËÇåÞ‡æÍÛÈC3š×"ÄÛhÊÉ£¢ƒ·åù.®”±È‘ ùH9iÞ•øÂy#o?ä<¥H‰æ õЦ|L:N?×s®Ë[œœ7 !< åÀäÖO®s8“ù!ŸOP†štžBfn £y^GKøh”E®M¤ÂÙHýñó \h\¤bI‹ÊàŽ:ø9nHd”A4s‘™BÍzË0ŸóU®‰9¿¸²Ò8r™ ×ÏR–\[‘r¤>Iÿ¸¬¹®jÞ‰óMÊŒck+£ið¹Ó‘|—À”%þ'p&k³Q£FêFòjœá`6‹-ÏÒÃðE³¶îãí¥pe‘´PèÃi’–ÏO(r}J´ÉЛ¯Ïy¢J3,29àJZ©&d.[é]lsµZ3RW4&½¦M–±DD’Ôw8véŽ4Î2WÂ=&-³l²Ðò,~´rï)×G LiP8Q2d‘hçLÕ²ƒ>^½€JBæÓiY)Öç©fúÍÃ!*¶X_*¿Í#RßÜJi×›HádÍÁ-b4¢lËH3>šá :áp +¬…À@7nħŸ~Ф¤$<÷ÜsêúæzäÈ,Z´ÿþïÿŽ:¸ŒW\ÞVzI³Ÿ‘—X3¶Ú9Î>~…@“¥ôè4?M’¯Ô^¦ ïÇ)hÎËѲH¢¥›˜š’ðÁýBZËð~%³8Cb¥†¨æ…dè ¸ OpIEÐÚòyrã OÒN¡—4V|,ê7bìØ±N½ÊÊJL›6Íì@ áq”S¦LÁ¡C‡4ìg¦þ(ô—E“µ6_¹ÞŒU–’ÀœN_›JÏÎû#YÊCF/¼­œ/œü<Ÿ“Ë3Š›úw…²œáTäÚ‚ƒRnVçõlñ¹ž´¬ÄdR\R"éU¤0Ip6Pr&ñ°™ÆÒÀ¥y/êƒgôl™G[[j/Ûò9ɰN¶åJÀÇáFOÞ·ºiÓ&Ìœ9Ó•]ß´i¦Nê¹Y™GM<¢àcseÒ$œfíຠ(5ðè…tÆOT6Yp9ȃÓÈûÑ¾ÛæÈy'#+W(ËQMç8(e§d©lÀ”ƒÛÇ=6_4sÅ·…òÓÂòÂÇàFÀ&R n¬¸Rh‰1I }§:~mmŠê·ná4òñäýµ©©©hÔ¨â⾿™™™‰’’ÌŸ?ßuwõÇyB2ᡞ\cú#I¿Ÿ,¥q²ñƒg¸£Œh¶ÑåjsÐtWꘔ§Ö7¤ÒY¹ÞɦYv¾3Þfñ5%ÑÂ,éÍd¸Ãû– “E£0©?ò<Œ•žKFZ?œþòòr”——#333¦¶ëÖ­s= @SRj#J›¿4O=õÖ­[‡-Z`íÚµ®;rø®ø—ùç;½O“‡ŸR<ã’Æûh†E›‹I¬^½ÙÙÙžpTò,šÇ”räõb1øÔÖ6'þ)¶† 0yçš%‘ ­y3Úàšâñ~d&Ï&PM€R˜r~ø5e'&ÊsèÜ+¯¼‚Î;#;;Û£H’c Ú¶më¬ël‚¤ïŸå\ýhä›D¸ ©Í?ÿó?;}òÝÚ”–,½¼P.#-9g?YÊùÈ~¤¾ÜsÏ=8qâ„gGš\Ck}F£ËÏÐÿ`Jj˜HÐ:‘ ¾O‘Ó~ Ñ&£YÉhÎ$)?Kk¢&¢…æÃÃ5¿~µ"IYYæÌ™ƒ¬¬,'qfkoŒÁ¬Y³péÒ%4jä~ÙµýœV `ª±"ÛµðLS0¢Ùè&K9íc Þ}÷]”••©ëYå[^±ÅIDATy©É*É M5ºlEã“­?mŽôÝLN,ÿ”ë É­X‘IÅŠúØúL¡Â§)Šæd_\áùoz„!WLm| ái÷ôü#îJÃHE ‹µ9óöŠ:&àöN¶$Z¡z”ÑÚF§üOÒ*szb-Ò@ 2«W¯öÔ‘¿m†•ëðít¿K9‰'*¾À”ú'Vbèäc±J·Û_YYvïÞí<³…ÆÈÊÊBVVºvíª†{/^Ä‹/¾èR á}£¼~‹-™™‰}ûöáÉ'Ÿt<%Ù¾sçήK@—.]ržr0zôhç¿wß}{÷îEVV–sž+f$ÁÅ‹1sæL´hÑÂyM9ýÇC?^h ýÿÉ'Ÿ8¯=LIIA‡<ÙdòÎ.\À_þòORãî»ïFVV–‹÷į .x4++ ééé½{÷îÅ!COI¥¨¨Èeø:wîŒ-Zxh£ã£>¾}ûpñâE¤§§£k×®ÈÏÏ÷ðÁîÕ«W;úB´’®!==Ý5W^ü"ç¼ù%‰D=þ§—qãÆ€ÉÊÊ2ùùù&++Ë9ÀtíÚÕœ>}ÚÔÕÕ™[·n™[·n™íÛ·›ôôtW=Û1`Àóúë¯ÇT€™7ož©®®6555æðáÃæ7¿ùó_vv¶¹zõª9qâ„IKKsµ=z´¹qㆹqㆹ~ýº9qâ„9r¤‹ŽêêjSQQaÊÊÊÌ… ̹sçÌÙ³gÍ™3g\}½óÎ;æ‹/¾0K—.5ÉÉÉ*)))fÇŽæìÙ³¦¬¬ÌTVVšÚÚZSZZj/^lrrr\õóòòL0ô%%%fêÔ©~._¾Ü„B! ÍÔ©ScæßüùóMMMs\¾|Ù|ýõ×fâĉ&--ͤ¥¥™ÜÜ\“››ëj—žžn–-[æÈXuuufÙ²eYYY&//ÏäååyhX¶l™©««s4ßP(dB¡ùîé!ÎÁ1óƒ€ù¿½ 8ÐÈW_}eÂá°©¯¯7¡PÈ|ùå—.EIOOw^;¸P.\h¾ùæS[[kjjjLUU•©¬¬4åå妼¼ÜÌ;×U¿¢¢Â9¨ÎçŸn:u꤂ü›o¾1;wV•òÚµkæøñã¦K—.žÿú÷ïo*++Í¥K—ÌÅ‹ÍW_}eÎ;g¾üòK˜o¿ývL@˜1c†9wîœΚšóõ×_›o¿ýÖeW•^—æª=æQ†ÞüJ¿é‘¨xæ™g\㧦¦bñâÅèÒ¥‹ÓßСCqþüy¬éñ©#FŒ@ff¦çÿÂÂBç5 6Úål;ÛîX`òg¨rP³Âá°g­·zõjÏC¢H yá_äJB9“õùK^é …wÝuš6mŠfÍš¹Þ’VVV†÷ßü1úöí‹ 6 ÿþ€‚‚GA“’’œœŒN:9m90ä&©ìS¦LÁ°aðqãFŒ3?ûÙÏУGàý÷ßw=¸¢¢óæÍ󼬖RF…,ùF0ÍÀiF? Žó“ƒrïÞ½øøã‘ššŠ§Ÿ~ÚúñáÇ»úüÝï~çz/ìîÝ»Ü@jjªÚG}}½ó6š«¬gã¿gLÉŸ¿·bŒq%ŒH„ð#33ÓH$q"ÜÃHoÃH Áãf]]«/Þ¿4¼qöìÙhÞ¼9B¡1gÎÌ™3œ×ÚSü¤Æý6o 4\Ž:t¨ëNjÛªU+¼÷Þ{8p SÑ¢E6lÒÓÓ;oøµbâÍ]»Œ" “ËI“?¹OnË{ýõ×½zõB0t]â¢dU ð¼ iíÚµ.9?Þù¾fÍôíÛדÄ1Æ )) ýû÷÷ž|"™-´Ï—_ ¾# ùùùNV­k×®ÜO\ãŸTŒ1ƒVe¦BS†.Ô—ô ¡PÈéOz.ºì@¥C‡xøá‡= NôÉ"=¦BQINNV÷ISM›6ÅÀ]OˆÿüóÏ‘˜˜èº£ˆƒ(‰  ª™z-SÉ3ÃÜHþÕÕÕ¹BGª[YYélwŒD"X·nºÑÞ–½_³f {ì11]·nfÍš…gŸ}VÍ®þêW¿ð½‘ä€ Ü/ëå $Ü‘À¤ÉÿñĪU«Ð¥K¤¥¥¹ÀÈK—.9mI±ü°“ÚikLê+šÇLJJB0ToÐèñ¦_;éQ¹·¢º999.`:t={öt¼%)¿®®N½Kß% ÜHh†<&çõœ:‹-¢E‹p;…ä>ú(RSSZ`ýúõxõÕWѱcGW;zJ;7žL ß.®;:”^ïÀ•@´fͬ]»ëׯwµ£PŒÚð¾x ‡Ãƒ. so£…bœ6®ÌrWL¹ABÒ"½­ eýŠ åh𚉉‰Î«*** ]7/K`’Ç”ö¥¡ásåK ù6Àí19›7ovêLž<½zõRŸýÃùÈeK†„Ê /¼€ßþö·Îï '':tÀSO=å¼…óV‚’oäÿóHÀœüá%‰àÂ… x饗дiSüêW¿‚1kÖ¬q%^(”åïI¡ƒžØÐ2\å™Jùˆ}YŸÂ*9O|ðä‡\ ó„_f™{IۇѪU+y⋌ÿŸè£'ûË„ÆGùxÍcj<ác‡ÃaL8ïh|ÉOþ»gÏž(,,Drr²küƒbôèÑèÖ­Ö¯_o‡Ó/Èü‘JjŒÁ… ðøãcß¾}ÈÌÌć~ˆ>}ú¨å'-qBJϘ{ L.rZµ“{ ÙŽŠf…y[©ÚZ‰{9¡Ÿ¯á4`j·9ɛѩ>ç7ñR“?¸MÞþEåÈ‘#èÙ³§kÚÚRÎ[Î÷¾ûîÃÆ±téR,]ºÔy%Ð1<÷Üsøä“O0eÊÏÜd2L®=éûLYÞyç¼øâ‹®Å=óÌ3®Œª&)ž´t²H`jÂæE*Õµíå•ÀÔ.wð°IÖÕ”N–Xh—m]ÆGf(òl‘³S.ä’€Š×œ¾£Gzø¦#Í{Éú@ƒÆ!C°|ùr,[¶ÌÐ-[¶à…^À¤I“œdLîP˜Oôò[×îèäÏàÁƒ=ª‹/F¿~ý<)w)\÷‚šrK/)ÉFÓížçýKËnëC¶õCóàÔ¿¦Ø÷ÝwŸÇ{k‡ ”šÇÔ€)ט2Ħq:¥¥¥8|ø0Ú·ocŒš<㼩ªª‚1Æóúvš?ƒÆàÁƒ±lÙ2×›Ò·nÝŠƒ¢mÛ¶ˆDÜd‘sæ—pè¸#ט{öìq@Ù¥Kdgg»U† T˜Ú›¢Ø@à—²×Š¤m­B}˱8=6ãa ue6•¿wò¡‡Rûç}ÊÍ~ë\Û!I«4Lô¯†·Vsp˱ùxË—/Gee¥ÓWee¥ã¥Ž„Ãa <¯½öšk¼åË—{ú¶û‡æpGsúôéÎ÷´´45ŒÔ€DL´]Ÿ¤¢Ò¯ÈëiÒ£È"P†]ÔFz Û] ÒËÉqxá–ž¿œ6??ßs}0ÿ8@4ÀÙêkŠ”›1ݺusÕ;vìÆ¯V>FEE>ûì3´nÝÚéëèÑ£ž7nK£Ó£G 4ÈC¿ ”~á÷ L^öíÛç|—^äÒ¥K®Ç:rK)-¦,ÑÀ¨míÍ“jÞQ&xáàñ£Uö«…žôJúÄÄD 4Èóĸ¸8´nÝÚ駤¤DJ ¹¹¹laYÏÆoÙç¶mÛ0~üxTTTxÀ±cÇPSSƒ/¾øo¿ý¶CObb"¦OŸŽqãÆyŒÍöíÛ±}ûv×¹ÄÄDgîZÆxëÖ­xùå—1nÜ8$''» LUU•³ꡇr%¹ž—‰-PˆŸ0aÂU2g…{µ´´4\¹r{÷îuÎ]½z'OžÄ©S§Ð¡C"##ååå®zÕÕÕèÔ©Fí²pÍ›7wí4©©©ÁùóçѼysLœ8ÑfÞ¼yÇŽsêŸ;wÕÕÕ4húôéãÐ[TT„O>ùÄ5—³gÏ"))Éã ø^Ìøøx¬X±Âõ“ÊÊJüÓ?ý““™”kTÚ˜]ZZ  !Ì߸q#ª««qýúuœ;w‹/ÆâŋѺukL›6 íÛ·w¼³ íèû}÷݇Ï?ÿ7nÜpþ;þ¼³1üå—_vG‹/vêdddà±ÇÓO>é¡÷úõëøâ‹/\ýÕÔÔ 77½zõrÑðÿøèÞ½;JJJ\4È’˜˜ˆwß}III®å@||<Ξ=‹­[·¾üòK,[¶ _~ù%Î;‡={ö`òäɨªªÂ Aƒð /xúײ±Ú÷¸¸8ïseÿ^‹LðD"¬Zµ 3fÌpÖ™;vDïÞ½1tèP×®—^z ÅÅÅHLLijÏ>‹|ЂìÚµ k×®ÅñãÇѼystïÞÏ>û¬‹Îü9sæ`Û¶m¨ªªBFF „=z ‰ ´´ÔµU†T4§‚‚OþøñãX±b…5dD"xüñÇѺukׯošGuu5Š‹‹QZZêòЉ‰‰hݺ5 „6mÚ¸”Š'|´ð­²²³gÏÆŽ;œ¾ºuëæDDûÏþs´nÝ#GŽDFF†‹fÎ~ðÁ())Auu5î»ï>äææ¢{÷îo8ïˆkÖ¬Á±cÇ: U«VèÖ­òòò\†?3·¸¸[¶lÁ#<‚#GŽ ¢¢Âeˆ“““ѦM <Øá« ½yŸ7FãÆÑ¤I4iÒÄùMïù¹£)S÷|‹˜Ü&×2“&wqh‰^‡¯Ãø%¾Îåí4i—F´·¬ñµ¦–‘äFF†¸šgåci‰êKn;Ó.ùñÏSf/9ô)³Óï5]†ä#_„%ïË/ÉãdZY¿D'}oÔ¨QƒÜ,z|Çí„L‡s’2Q‘àÑ<œ¢¶Î³µãE»!û“‰~W}Ê»øœäø’'Òq ñ»Jøü80£]N’¼×Š×ZBN‹h¾¶þµ>ä¸d,hSºŸq°Ñ¡•ÿ&tAÆÂ`þ]Züh ³ýO[µä.ÞNž#³­_8¥Wäcòï[3T¼žüäÀ—`”¡®æýŠÆ; püÓf؈.¹u‘·õ£¾Ó<ùîºÃ†ߦš.ü0¡[1 Ò»hë-ìÔ@l»lA ”¡¬ЩȰR «ù]ó2 °ñC'Õá!¹ÜÐ y¥e&É p0ùy”hÆÓkkK|æ•ó²Ñ K4Ó}¨²¾¦ß›Ñ¨ü0EÑÀE §­x; à%8é<)2÷^¶¶D‡_¾òPfKé>I‹+’ e¹Ç”óÖ Œ¶®–m‰òº÷`¶R£Ñ6¦&ÉgSŒÏ߯{®<œ¥:ü~T L¹n•ºÜ›ØyÑ@"ÃAiI5o ¸Ã96MèZ]*œ~4óú|òEÁ\ðä)©–ÈÐSz<[8ìçÅd?ä]¸¡°m  ¶D—”?¯þ¿[4 G&»¸“¿µÈÇ–TâãÜQÀ$fI«'ÁÈ_˜ |ÿxÛNêKSP­[ZrÀ~ç‡Í óþä›»y&€GQ4ïÌéç^ŽhÓÂ>ÛÜ5@wáàäà°SÎU3¶õ°Vh,zk¹– —¯”—ˆx_<™¤é ¼–5wبÔÿ®dô[* ˆ¿B/..ÎóÌ ú^R:o£Åæ]4ï$ûÒ€Àc\øö8[X¦%šü”]£)š×ÔæÇÃÙhwóÛh¿)y¥­y5£c3v|®Üxqï¯V.#í²ÖÊjÂ¥°U¥vï¥M9£…s6¨hˆu>$TÍ[’ñË"| $’ÏÍÏ“ksö k9ÈcÊuf4PñHC&Oüø§yo>¦67iì´P–úâN&—m­yÇ“”+ ˆÀIçëëë]a­ŸÇ¼ïˆäÿië¿p>ýTž“àô³ì2äÒúÕ`ðùú]àýPd¢í•üÒèÒ¼%͉·e)/ãh<•!¬ÆWGZ$"Cbþ›êÞQÀäLÔÂ!*<Ë˵6ÍkÊÿü”Ù¦0·ã19Ý$|®@¼h×m´ùѤ…™~ÞŒ·£qÉðiá¤ÍF‹Ln×cr>h<—y?ƒã'7Î-·ÁÏÿO¦a‡þz濱p¯)A<ÅÏŠSþ=š'´ý¯Õ½Ýppg{µ‹Ï[Î-Z(k£KSV¿pVz©ha¬ß8­|,YGþÏ=¥_p›·–¼‰Æí2“+hb•üÿ¿…úßrÿ¨ÆD©~É^la©è´‹bEkKßm Ñæî7'ú®Õ·…æÚ˜0ùñÿ‚Ï·£ÖѼ hcß05°»x÷¿˜T €€0~ ÕÀiSªÃ?{¦ôvA ­¶¢åæñ>c¦_;Û¸ò»ì3ښ̎hß%·Sbø˜~À´Ño¨§ïÿeÀüo-ÚšÉOQ¢)Œíw,!°¾Û)6ZnGlýý-´øy5?£‹!úï4~±F~†îvJ4 ;˜€.ŒXÂ=^l^K'Z»hmüJ¬^EÎõvèº0Ç¢Ä6Ãç·6´ñû‡¨r¬Æ7š±‰V´öÚ÷ÿ§=±ÌhIEND®B`‚commons-attributes-2.2/site/xdocs/images/attributes-logo-white.xcf100644 0 0 6713 10464315317 22653 0ustar 0 0 gimp xcf fileæPBBJ/ gimp-commentCreated with The GIMP¦ Þ(67^`› Text Layerÿ     ="IU›q Æ Ò›‰ê %€€€:üUª:þUÿÿþª9þªÿÿ:þÿÿþâý8þUûªÿâýUþâ0üÿUýqÿ0üªÿUüâÿ/ûUÿÿUüªÿÿ.þUÿÿþUþªÿÿýUªªýq8ýªÿÿþUUû88âÿÿUþüqqüqªqüqùÿÿƪÆÿÿýÆý8âÿÿýªqÿÿôUÿÿªâÿÿþúÿÿªûªÿâúâÿÿâÿþUþUÿÿýÆÿÿüªÆÿÿüÆÿÿøªÿÿqþ8ÿÿþUÿþUþUÿÿÿóªqâUâÿÿâÿÿøªâÿÿUûâÿÿªÿþUþUÿÿôªÿÿÆâªÿUùÆÿÿªÿÿþUûªÿÿªÿþUþUÿÿþªÿÿþUõªÿÿªªÿÿûªÿÿªÿþUþUÿÿûªÿÿÆ ûªÿÿªýUûÆÿÿªÿþUþUÿÿûªÿÿª ûªÿÿªýUªÿÿþªÿþUþUÿÿûªÿÿª ûªÿÿªõÿÿª8ªÿÿªÿþUþUÿÿûªÿÿª ûªÿÿªúÆÿÆUûªÿÿªÿþUþUÿÿûªÿÿª ûªÿÿªûqÿÿqûªÿÿªÿþUþUÿÿûªÿÿª õªÿÿªªÿÿUûªÿÿªÿþUþUÿÿûªÿÿª öªÿÿª8ÿÿÆûªÿÿªÿþUþUÿÿûªÿÿª öªÿÿªªÿÿªûªÿÿªÿþUþUÿÿûªÿÿª öªÿÿªªÿÿâúÆÿÿªÿþUþUÿÿûªÿÿª ùªÿÿªÿÿþªöqââÿÿƪÿöÆâUÿÿúqUÆûªÿÿª ùªÿÿª8ÿÿøâªªÿÿUªÿÿüÆâþªÿÿûƪÿÿûªÆÿ8þÆÿÿ øÆÿÿÆÿÿûÆqÿÿþªþ8ÿÿþâþÿÿþþqÿÿýª8þqÿÿöqUÆÿÿÆqûªÿâUúUÆÿâ÷âÿÆU8ªªþ8ªª€€€ü8ª89ú8ÆÿÿU7ýUâÿÿþU7üqÿÿþU:ÿþU'þUÿþU'þâÿþU&ýqÿÿþU%üâÿÿþU%üªÿÿÿþU$þªÿÿÿþUúUªªUþUUþ8þ8UUþý8âÿÿUþ ÿûU8âÿÿýâüUªÿÿþªü8qâÿÿûUqÿÿþUýqâÿUÿþUûâÿÿªþ8ÿÿþUþUÿÿüªÿqÿøqÿâUUªÿÿýâûªÿÿªÿþUþUÿÿüªÿqÿþý8âÿÿþûªÿÿªÿþUþUÿÿü8ÿâÿþqþÿÿþûªÿÿªÿþUþUÿÿüÆÿÿþUþÿÿþUûªÿÿªÿþUþUÿÿùÿÿUUÿþUþÿÿþûªÿÿªÿþUþUÿÿþUÿÿÿþUûâÿÿªûªÿÿªÿþUþUÿÿûªÿÿUÿþUûªÿÿªûªÿÿªÿþUþUÿÿûªÿÿUÿþUûªÿÿªûªÿÿªÿþUþUÿÿûªÿÿÿþUûªÿÿûªÿÿªÿþUþUÿÿûªÿÿÆÿþUûªÿÿUûªÿÿªÿþUþUÿÿþÿÿþ8ÿþUÿûªÿÿªÿþUþUÿÿþUÿÿþÆÿþUû8ÿÿûªÿÿªÿþUþUÿÿÿþªÿþUûÿâþqÿÿýâÿÿþUþUÿÿþÿÿÿþqûUÿÿ8þ8ÿÿþªüqâUÿÿþþUÿÿöqUÆâÿÿÿþqûUÿâUþâÿÿªÿýUÿÿªÿûªÆÿ8ûâÿÿýÿÿ÷âUUªÿÆý8âÿÿüUÿÿýÆUþÿÿþúâÿª8üqªÿÿüâª8 øªÿÿâüÿÆ8úâÿÆUq***ùUªªU þUªªöq8U8⪪ÿÿýâUùUâÿƪªÿÿþUýªÿÿþUûUÿâ8ûªÿÿUþÆÿÿþüâÿqüªÿUþUÿÿþªû8ÿÿUüÿUÿûUÿÿªüªUUUÿûUUÿÿþq8þÿÿþUþâÿÿýÆ8þUÿÿýÆUý8âÿÿýâUýqâÿÿþªýqâÿÿþª þqÿÿþ8ù8þUÿÿþªýâýUùÿÿªªüâqüUÿøUÿÿÿÿªUUüªÿâüUÿªûqÿÿ8ÿÿýâúUÿÿªúâÿªÿÿýâþUÿÿõªUUqâÿªÿÿýÆqúUªUªÿÿüâª8M&¹<Drop-Shadow#2Ì     6J ˆ¹< ¤((*¹< ¼Ê Jã*%þ úþ÷   øþ ø  ÷ þ ÷  ô þ ø ÷ ï õ   ÷commons-attributes-2.2/site/xdocs/reference.xml100644 0 0 4032 10464315317 17112 0ustar 0 0 Jakarta Commons Development Team Reference

Declaring and Using: This section describes how you add attributes to your source code and how you access them.

Compiling: This section describes the changes and additions you need to do to your build scripts if you are not using the Maven plugin.

Indexing: How to use the attribute indexer tool.

Documenting: Commons-Attributes includes a Taglet for the Javadoc tool, which will include any attributes in the javadoc for the class. Note: Taglets are only supported in Javadoc 1.4 and later.

Validating: How the attribute-validator task helps you ensure the attributes given to each program element are consistent.

commons-attributes-2.2/site/xdocs/changelog.xml100644 0 0 24635 10464315317 17136 0ustar 0 0 Jakarta Commons Development Team Changelog
  • Fixed a potential bug in RuntimeAttributeRepository - the seal() method and the checkSealed() method weren't synchronized properly.

  • Added support for attribute packages (Issue ATTRIBUTES-4):

    When the ant:attribute-compiler is used in ant, there is no way for maven to pass a value for the attributepackages property.

    It would be nice if it were possible to add a property in the project.properties of the current project that specifies the attributepackages. E.g.

    which is then used in the maven plugin:

    [...]]]>

    And that is exactly what was implemented.

  • BUG: Checks for Target specifications would go unnoticed for attributes attached to fields, methods and constructors. The following code would not result in an InvalidAttributeTargetError. The bug is fixed in current CVS.

  • Ported the code to qDox. XJavadoc had an annoying bug where it would silently rewrite the value of a JavaDoc tag, making the resulting expression unparseable by the attribute compiler.

  • CircularDependencyError now expects a list of Class instances instead of a list of any object type. The old behavior is still supported and will remain so.

  • CircularDependencyError now shows the full circle of dependencies.

  • Added a ParameterIndexOutOfBoundsException to be thrown when the client tries to retrieve attributes from a parameter of a constructor or method and the parameter index is out of bounds.

  • Added a SealedAttributeException to be thrown when an attempt to modify a sealed attribute is made. The exception is a subclass of the IllegalStateException that used to be thrown.

  • Added getCause() to applicable Throwables, making them compliant with the standard Java2 1.4 nested throwable spec.

  • CVS version number is now 2.2.

  • Made the Maven plugin only run the attribute compiler if a project property named org.apache.commons.attributes.enabled was set to 'true'. Likewise, the attribute indexer will only run if a project property named org.apache.commons.attributes.index.enabled is set to 'true'. This to keep these two tasks to be run on every single project being built.

  • Created a Maven demo.

  • BUG: Fixed bug in the compiler that made it impossible to add attributes to a method that took a parameter whose type was an inner class. The bug would manifest itself thus:

    The bug is fixed in current CVS.

  • Bumped version number to 2.1. The rationale for this is as follows: Many people had told me that a 2.0 release was required in order for them to get on with their own releases that could only depend on released versions of libraries. Since I could not move Attributes through the promotion and release process fast enough, and since the existing code appeared to work for people, I recommended that the jars simply be renamed from -2.0alpha to -2.0. After all, it was my intent to release the current CVS unchanged as 2.0. Then the bug above popped up and something had to be done. If I release the fixed version as 2.0, we have two "versions" of 2.0 - the one with the bug and the one without - clearly an undesirable state. Therefore the version number went from 2.0alpha to 2.1alpha.

  • Added a Taglet for Javadoc 1.4 and later.

  • Added a the attribute-validator task.

  • Fixed bug where attributes would be inherited from private methods. Since the methods themselves aren't inherited, the attributes shouldn't be either.

  • Changed the way AttributeIndexes are implemented. Previously, any attributes that were both Indexed and Inheritable would not work as expected - the index would not find the class that had inherited the indexed attribute, only the class declaring it.

commons-attributes-2.2/site/xdocs/declaring.xml100644 0 0 26515 10464315317 17136 0ustar 0 0 Jakarta Commons Development Team Reference - Declaring and Using

Attributes are value objects that can be added to language elements such as classes, methods and fields.

What is a value object? Simply stated, a value object is an object that is read-only, constant and can be replaced with another object of the same value without it making any difference. For example, instances of the class java.lang.Integer are value objects. You can replace any instance of that class with any other instance, provided that they are equal. An java.io.Socket is not a value object, as you can't replace an instance of a socket with another - it corresponds to a real resource, in this case a connection.

You should therefore not allow your attribute classes to be mutable, and not use Sockets or similar classes as attributes.

Let's look at the way attributes are added to the code. The general form of the attribute expression is (optional parts are in [brackets]):

This name indicates what sub-element the attribute is to be applied to. Classes and fields have no sub-elements, but methods do. The sub-elements of a method are (1) the arguments and (2) the return value. In order to apply an element to a method argument, you let the target be .argument name. For example:

Will attach MyAttribute to the first argument of the method - not to the method itself. The attribute can be retrieved via Attributes.getParameterAttributes(Method,int).

Adding an attribute to the return value is done by the reserved target name .return:

The attribute can then be retrieved via Attributes.getReturnAttributes(Method).

This is the name of the attribute class. You can use a qualified or unqualified name here - but if you use the unqualified name one of the following must be true:

  • The attribute class is in the same package as the class you are attaching it to. (Standard Java rules for when you need to import a class.)

  • You have an import statement that imports the attribute class.

  • You have listed the package the attribute class is in in the attributePackages attribute of the attribute compiler in your build script. See here.

This is simply a list of arguments to pass to the constructor when instantiating the attribute class. For example, given an attribute:

You would specify the name by including it as a constructor argument:

Commons Attributes provides a simple way of having named arguments. This is done by having setter metods in the attribute class. Adding a field and two methods to the attribute class above we get:

We can now set the optional field by using a named parameter:

The attribute compiler will pass any parameter up to the first one that is on the form name = expression to the constructor. For the remaining parameters, it will invoke a method named setName(expression) on the attribute instance. So for our example above, the following code will be generated:

Named parameters are always optional.

You retrieve attributes by using the methods in the org.apache.commons.attributes.Attributes class. See the JavaDoc for a description of methods in this class.

See the Compiling section of the reference.

Let's define the question via a use case. Suppose you have an attribute (MyAttribute), and you have a class MyClass:

The question is now, will the collection returned by Attributes.getAttributes (MyClass.class) have one or two elements? The answer is that it depends on the way MyAttribute handles equality. The attributes associated with a class, method or field always for a Set, meaning that there are no duplicates. So if MyAttribute is implemented this way:

Then you will get two elements, since each instance of MyAttribute is different from every other instance. However, if MyAttribute is implemented like this:

That is, every instance of MyAttribute is equal to any other instance of the class, then you will only get one element in the collection.

The above also holds true if the attribute has been inherited.

It must have a public constructor. That's all.

That's not supported (yet). It is also very hard to implement since the class name is decided by the Java compiler.

So you have this

and now you'd like to add ONE as an attribute like this:

how can this be done?

The best that can be offered is:

I'm afraid. The expression follwing the @@ must fit the template "new (expression)" optionally suffixed by "()". This makes the compiler much simpler, and the loss of functionality was considered worth it. You can also define a separate ONE class:

and use it.

commons-attributes-2.2/site/xdocs/validator.xml100644 0 0 13520 10464315317 17163 0ustar 0 0 Jakarta Commons Development Team Reference - Validating Attributes at Compile-Time

In many cases an attribute can only be applied to certain elements, and its parameters must satisfy some set of constraints. For example, suppose we have an attribute that declares transaction metadata:

Now, the rule is that if a class has a TransactionDeclaration.EXPLICIT setting, then all methods must have a @@TransactionLevel attribute. For example, this class is valid:

While this one is not, since methodTwo does not define a @@TransactionLevel.

The attribute-validator task enables you to check the consistency of attributes at compile-time.

The attribute-validator task is run like this from your Ant file:

... ]]>
Parameter Required Description
jarFile yes The jar file whose classes should be validated.
Element Required Description
classpath yes The classpath to use when loading classes from the jar file.
validator yes One or more validators, which are classes implementing the AttributeValidator interface.

Writing a validation rule simply means implementing the AttributeValidator interface in a class. For example, this AttributeValidator will check that there are no more than three class attributes given to each class.

3) { throw new ValidationException (clazz, "Classes must have at most three attributes!"); } } } }]]>
commons-attributes-2.2/site/xdocs/style/project.css100644 0 0 101 10464315317 17723 0ustar 0 0 @import url("http://jakarta.apache.org/style/jakarta-maven.css");commons-attributes-2.2/site/xdocs/tutorial.xml100644 0 0 3037 10464315317 17023 0ustar 0 0 Jakarta Commons Development Team Tutorial

This tutorial will walk you through a quick start with Commons Attributes.

commons-attributes-2.2/site/xdocs/documenting.xml100644 0 0 13632 10464315317 17516 0ustar 0 0 Jakarta Commons Development Team Reference - Documenting with the Taglet

A taglet is simply put a handler for a Javadoc tag, such as @author, @since and @param.

The taglet is then responsible for formatting the tag in the HTML output.

We will go through the options below, but in short:

From top to bottom, then, are the options specific for the Commons-Attributes taglet:

Due to the way tags are used by Commons-Attributes, the Taglet must know which Java files it will run on. This is caused by the Taglet API, which requires the Taglet to specify exactly which tags it will handle. Since @@MyAttr() and @@MyOtherAttr() are considered two different tags, the taglet must first scan the source files and compile a list of all potential tag names.

This parameter is a semi-colon (Win32) or colon (Unix) separated list of files or directories that will be used to create Javadocs. If you specify a directory, then all .java files in that directory and any subdirectories are included.

Example:

This is simply the classpath for taglets. Include the commons-attributes-compiler JAR.

Example:

The fully-qualified class name of the taglet.

Example:

Ant usage is similar to command line usage.

]]>

Note the need to:

  • Include an additionalparam option to specify location of source files.

  • Specify the path to the attribute compiler jar when specifying the taglet. (Javadoc is a separate JVM and does not share classpaths with Ant.)

After you've run the Ant Demo, you can also type:

To generate Javadocs for the demo.

commons-attributes-2.2/site/xdocs/compiler.xml100644 0 0 12574 10464315317 17020 0ustar 0 0 Jakarta Commons Development Team Reference - Compiling

This is the process your source files have to go through:

Attribute Compiler ---->|Generated Java Files| +------------+ +--------------------+ | | | | | +-------------+ | +-------------->|Java Compiler|<------------------+ +-------------+ | v +-----------------+ |Java .class files| +-----------------+]]>

This section will focus on the "Attribute Compiler" step. As is implied by the diagram, the Attribute Compiler compiles Java source files into other Java source files.

This is how the compiler is used:

]]>
Parameter Required Description
destdir Yes Destination directory for generated source files
attributepackages No A semi-colon separated list of package names. Attributes in these packages can be used without specifying their fully-qualified names, even if they are not in the same package as the class they are being attached to, and even if they are not imported. (The compiler generates import statements in the generated source files.)

After the attribute compiler has generated the new source files, you should feed them and your own source files to the Java compiler.

No, you don't. You can add attributes to a class by programmatically creating an attribute repository in the class's static initializer. See the Javadoc for RuntimeAttributeRepository for an example. It's not pretty, but it works.

If you use Maven you can just install the Commons-Attributes plugin and add the following lines to your project.properties:

Attribute compilation will happen automatically.

commons-attributes-2.2/site/xdocs/faq.xml100644 0 0 16202 10464315317 15745 0ustar 0 0 Jakarta Commons Development Team Frequently Asked Question

Q: How does Commons-Attributes fit in with the annotations in Java 5.0?

A: With annotations we'll finally have a standard API for metadata in Java. The downside is that we have to switch to Java 5.0. Since people even now are still stuck with Java 1.2 and Java 1.3, it may be a while before a project can require 5.0 and still have a reasonably-sized audience and/or usefulness.

This is where Commons-Attributes comes in.

Ultimately this s a choice you must make based on your own preconditions, but this is my advice: You should switch to 5.0 if you can, given stability, compatibility et cetera. After all, it is the standard that people will use when it becomes the standard (which it will). However, if you foresee that you'll stick with 1.4 or earlier and you think that metadata is the most cost-effective way of solving your problem, then you should definitely take a closer look at Commons-Attributes.

Q: Anyone else using C-A?

A: A number of companies use C-A in their products, and I have myself used in deployed business-critical systems. Less anonymous users are:

Q: How does Commons-Attributes compare to other metadata frameworks, such as JSR175, MetaClass, qDox, JAM, etc?

A: This is a two-part answer. First JSR175: When Java 5.0 becomes as commonly used as 1.3+1.4 is today, nobody will want to use any other metadata framework, just like nobody wants to use any other string class than the java.lang one. Therefore, by that time, C-A will have been rendered superfluous, and development will stop.

Compared to JAM, QDox, etc. C-A stands up very well. It offers a simple API, powerful annotation features, type-safety and low overhead. Let's examine these points:

  • Simple API: Too many frameworks try to be the all-encompassing über-framework - and usually fails at that. The result is an over-complicated API, that still won't let you do what you want to do. C-A aims to do one thing, and do it well.

  • Powerful annotation features: You can attach attributes to classes, methods, fields, method parameters and return values. You can also control how an attribute can be used via the Target meta-attribute. Few other frameworks offer all these features.

  • Type safety: Most other frameworks are limited to key-value pairs of Strings. C-A lets you use JavaBeans, which gives you a layer of compile-time safety against mistyping an attribute name.

  • Low overhead: C-A has no runtime dependencies, and fits into a 36k jar file.

In summary, C-A stands up very well.

Q: What are the future plans for Commons-Attributes?

A: As indicated above, C-A isn't expected to live beyond widespread adoption of Java 5.0. With the 2.2 release it is considered to have approached its end of life, so there are no future plans.

Prior to reaching end of life, the future plans were for ease of use and included:

  • Documentation: The existing code should be further documented, making it easier to understand the package.

  • Helpful code: Exceptions should go out of their way to help the developer find the bug by being precise and having relevant messages. Very often, all a developer will have will be a stack trace in a logfile - let's make that all they need as well.

  • Standards compliance: The code should behave as expected in all Java environments. For example, all Throwables that have a nested Throwable should implement getCause(). This makes it easy for developers to deploy the package in various environments.

  • No dependencies: The runtime API should have no dependencies, making upgrades easy and painless.

  • Maximum backwards compatibility: Upgrading to the latest version of C-A should be a no-brainer, not a carefully decided tradeoff between new features and migration pain.

commons-attributes-2.2/site/xdocs/navigation.xml100644 0 0 4316 10464315317 17320 0ustar 0 0 Commons Attributes &commons; commons-attributes-2.2/site/xdocs/index.xml100644 0 0 23340 10464315317 16306 0ustar 0 0 Jakarta Commons Development Team Overview

Commons Attributes enables Java programmers to use C#/.Net-style attributes in their code. Please see the tutorial and reference for a thorough explanation of the features and how the project integrates into the development process.

Please see the change log for summaries of code changes.

2006-08-03

2004-08-15

  • Attributes 2.1 released!

2004-07-12

  • Attributes promoted out of sandbox to Commons proper.

You can download the full Commons Attributes distribution here.

Download the following files and put them in your $ANT_HOME/lib directory:

Download the following files:

Drop the -api and -compiler jars into your ${maven repository}/commons-attributes/jars/ directory, and the Maven -plugin in your ${maven home}/plugins/ directory. You can now use attributes in your Java code, provided that you declare a dependency on the client API:

commons-attributes commons-attributes-api 2.2 ]]>

The attribute compiler will act as a precompiler to the java:compile goal, so you do not need to do anything else.

Commons Attributes enables you to add attributes to your code:

As the example shows, the attributes are type-safe and provides for validation of values.

API
Can add attributes to classes Yes
Can add attributes to nested classes Yes
Can add attributes to methods and constructors Yes
Can add attributes to return values of methods Yes
Can add attributes to method parameters Yes
Can add attributes to fields Yes
Type safe attributes Yes
Ability to restrict targets Yes, add an appropriate @@Target() attribute.
Attribute inheritance Yes, add the @@Inheritable() attribue to any attribute you wish to be inheritable.
Inheritance without access to superclass source code Yes
Named parameters in attribute declaration Yes, corresponds to setter methods. A Sealable interface enables the instance to become read-only when all relevant setters have been called.
Ability to quickly find all classes with a specific attribute Yes, via attribute indexes.
Object attributes don't have to be serializable Yes
Multiple attributes with same tag on an element Yes, this is controlled by the attribute itself
Tools
Ant task Yes
Maven plugin Yes
Javadoc Taglet Yes (Note: Taglets only exist in Javadoc 1.4 and later)
Incremental compilation Yes
Compile-time Validation Yes
Implementation
Attribute storage Generated classes
Runtime code size 36kB
Unit test coverage Excellent
commons-attributes-2.2/site/etc/ant_demo/build.xml100644 0 0 4564 10464315316 17505 0ustar 0 0 commons-attributes-2.2/site/etc/ant_demo/AttributeDemo.java100644 0 0 2627 10464315316 21275 0ustar 0 0 /* * * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. * */ import org.apache.commons.attributes.Attributes; class MyAttribute { private final String ctorArg; private String namedArg = null; public MyAttribute (String ctorArg) { this.ctorArg = ctorArg; } public void setNamedArgument (String namedArg) { this.namedArg = namedArg; } public String toString () { return "[MyAttribute constructor argument: \"" + ctorArg + "\" named argument: \"" + namedArg + "\"]"; } } /** * @@MyAttribute ("This string is passed to the constructor.", * namedArgument="This argument will be passed to the setNamedArgument method") */ public class AttributeDemo { public static void main (String args[]) { System.out.println (Attributes.getAttributes (AttributeDemo.class)); } }commons-attributes-2.2/site/etc/maven_demo/maven.xml100644 0 0 5574 10464315316 20042 0ustar 0 0 commons-attributes-2.2/site/etc/maven_demo/project.xml100644 0 0 3523 10464315317 20373 0ustar 0 0 commons-attributes commons-attributes-mavendemo Jakarta Commons Attributes - Maven Demo A demo of Commons Attributes for Maven users. A demo of Commons Attributes for Maven users. ${basedir}/src ant ant 1.5 qdox qdox 1.5 commons-attributes commons-attributes-api 2.2 commons-attributes commons-attributes-compiler 2.2 commons-attributes-2.2/site/etc/maven_demo/project.properties100644 0 0 2636 10464315317 21773 0ustar 0 0 # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. ###################################################################### # Properties that override Maven build defaults # $Id: project.properties 155400 2005-02-26 12:48:21Z dirkv $ ###################################################################### ###################################################################### # Commons-Attributes ###################################################################### org.apache.commons.attributes.enable=true org.apache.commons.attributes.index.enable=true ###################################################################### # Apache Central Repository ###################################################################### maven.repo.central=www.apache.org maven.repo.central.directory=/www/www.apache.org/dist/java-repository maven.remote.group=apcvs commons-attributes-2.2/site/etc/maven_demo/src/AttributeDemo.java100644 0 0 2627 10464315317 22411 0ustar 0 0 /* * * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. * */ import org.apache.commons.attributes.Attributes; class MyAttribute { private final String ctorArg; private String namedArg = null; public MyAttribute (String ctorArg) { this.ctorArg = ctorArg; } public void setNamedArgument (String namedArg) { this.namedArg = namedArg; } public String toString () { return "[MyAttribute constructor argument: \"" + ctorArg + "\" named argument: \"" + namedArg + "\"]"; } } /** * @@MyAttribute ("This string is passed to the constructor.", * namedArgument="This argument will be passed to the setNamedArgument method") */ public class AttributeDemo { public static void main (String args[]) { System.out.println (Attributes.getAttributes (AttributeDemo.class)); } }commons-attributes-2.2/site/etc/site.jsl100644 0 0 64137 10464315317 15577 0ustar 0 0 <x:expr select="$nav/title"/> - ${docTitle} ${pom.name} - ${docTitle}
|
${rowMode} ${attr.value}

Goals

GoalDescription
${rowMode} ${_goalName}
DateAuthorFiles/Message
${rowMode}
${pom.repository.url} ${url}?&content-type=text/vnd.viewcvs-markup - v
commons-attributes-2.2/site/etc/stylesheet.css100644 0 0 3563 10464315317 17000 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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. */ /* Javadoc style sheet */ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ body { background-color: #FFFFFF } /* Table colors */ .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ .TableRowColor { background: #FFFFFF } /* White */ /* Font used in left-hand frame lists */ .FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } /* Example of smaller, sans-serif font in frames */ /* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ /* Navigation bar fonts and colors */ .NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ .NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} commons-attributes-2.2/site/project.xml100644 0 0 3711 10464315316 15504 0ustar 0 0 ${basedir}/../project.xml commons-attributes Jakarta Commons Attributes Site org.apache.commons.attributes ant ant 1.5 http://ant.apache.org/ qdox qdox 1.5 http://qdox.codehaus.org/ xml-apis xml-apis 1.0.b2 http://xml.apache.org/xerces2-j/ xerces xerces 2.2.1 http://xml.apache.org/xerces2-j/ maven-license-plugin commons-attributes-2.2/site/maven.xml100644 0 0 3451 10464315316 15145 0ustar 0 0 --- commons-attributes-2.2/site/project.properties100644 0 0 2122 10464315316 17073 0ustar 0 0 # # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. # maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory maven.xdoc.date=left maven.xdoc.poweredby.image=maven-feather.png maven.xdoc.version=${pom.currentVersion} maven.xdoc.developmentProcessUrl=http://jakarta.apache.org/commons/charter.html # # Declaration of the remote links to assign on javadoc generation. # Link declarations can be overriden in the user's build.properties # file. # sun.j2se.link = http://java.sun.com/j2se/1.4/docs/api/ maven.javadoc.links = ${sun.j2se.link} commons-attributes-2.2/api/src/java/org/apache/commons/attributes/DefaultCachedRepository.java100644 0 0 32614 10464315316 30145 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.HashSet; import java.util.HashMap; /** * * @since 2.1 */ class DefaultCachedRepository implements CachedRepository { private final static Collection EMPTY_COLLECTION = new ArrayList (0); private final Collection classAttributes; private final Map fields = new HashMap (); private final Map methods = new HashMap (); private final Map constructors = new HashMap (); private static class MethodAttributeBundle { private Collection attributes = EMPTY_COLLECTION; private List parameterAttributes = new ArrayList (); private Collection returnAttributes = EMPTY_COLLECTION; private final String methodName; public MethodAttributeBundle (String methodName) { this.methodName = methodName; } public Collection getAttributes () { return attributes; } public Collection getReturnAttributes () { return returnAttributes; } public Collection getParameterAttributes (int index) { if (index < 0 || index >= parameterAttributes.size ()) { throw new ParameterIndexOutOfBoundsException (methodName, index, parameterAttributes.size ()); } return (Collection) parameterAttributes.get (index); } public void setAttributes (Collection attributes) { this.attributes = Collections.unmodifiableCollection (attributes); } public void setReturnAttributes (Collection returnAttributes) { this.returnAttributes = Collections.unmodifiableCollection (returnAttributes); } public void addParameterAttributes (Collection parameterAttributes) { this.parameterAttributes.add (Collections.unmodifiableCollection (parameterAttributes)); } } public DefaultCachedRepository (Class clazz, AttributeRepositoryClass repo) { // ---- Fix up class attributes Set tempClassAttributes = new HashSet (); tempClassAttributes.addAll (repo.getClassAttributes ()); tempClassAttributes.addAll (getInheritableClassAttributes (clazz.getSuperclass ())); Class[] ifs = clazz.getInterfaces (); for (int i = 0; i < ifs.length; i++) { tempClassAttributes.addAll (getInheritableClassAttributes (ifs[i])); } this.classAttributes = Collections.unmodifiableCollection (tempClassAttributes); // ---- Fix up method attributes Method[] methods = clazz.getDeclaredMethods (); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; String key = Util.getSignature (m); MethodAttributeBundle bundle = new MethodAttributeBundle (m.toString ()); List attributeBundle = null; if (repo.getMethodAttributes ().containsKey (key)) { attributeBundle = (List) repo.getMethodAttributes ().get (key); } Set attributes = new HashSet (); if (attributeBundle != null) { attributes.addAll ((Collection) attributeBundle.get (0)); } attributes.addAll (getInheritableMethodAttributes (clazz.getSuperclass (), m.getName (), m.getParameterTypes ())); for (int j = 0; j < ifs.length; j++) { attributes.addAll (getInheritableMethodAttributes (ifs[j], m.getName (), m.getParameterTypes ())); } if (attributes.size () > 0) { bundle.setAttributes (attributes); } // ---- Return value attributes attributes = new HashSet (); if (attributeBundle != null) { attributes.addAll ((Collection) attributeBundle.get (1)); } attributes.addAll (getInheritableReturnAttributes (clazz.getSuperclass (), m.getName (), m.getParameterTypes ())); for (int j = 0; j < ifs.length; j++) { attributes.addAll (getInheritableReturnAttributes (ifs[j], m.getName (), m.getParameterTypes ())); } if (attributes.size () > 0) { bundle.setReturnAttributes (attributes); } // ---- Parameter attributes int numParameters = m.getParameterTypes().length; for (int k = 0; k < numParameters; k++) { attributes = new HashSet (); if (attributeBundle != null) { attributes.addAll ((Collection) attributeBundle.get (k + 2)); } attributes.addAll (getInheritableMethodParameterAttributes (clazz.getSuperclass (), m.getName (), m.getParameterTypes (), k)); for (int j = 0; j < ifs.length; j++) { attributes.addAll (getInheritableMethodParameterAttributes (ifs[j], m.getName (), m.getParameterTypes (), k)); } bundle.addParameterAttributes (attributes); } this.methods.put (m, bundle); } // --- Just copy constructor attributes (they aren't inherited) Constructor[] constructors = clazz.getDeclaredConstructors (); for (int i = 0; i < constructors.length; i++) { Constructor ctor = constructors[i]; String key = Util.getSignature (ctor); if (repo.getConstructorAttributes ().containsKey (key)) { List attributeBundle = null; attributeBundle = (List) repo.getConstructorAttributes ().get (key); MethodAttributeBundle bundle = new MethodAttributeBundle (ctor.toString ()); bundle.setAttributes ((Collection) attributeBundle.get (0)); // ---- Parameter attributes int numParameters = ctor.getParameterTypes().length; for (int k = 0; k < numParameters; k++) { bundle.addParameterAttributes ((Collection) attributeBundle.get (k + 1)); } this.constructors.put (ctor, bundle); } } // --- Just copy field attributes (they aren't inherited) Field[] fields = clazz.getDeclaredFields (); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; String key = f.getName (); if (repo.getFieldAttributes ().containsKey (key)) { this.fields.put (f, Collections.unmodifiableCollection ((Collection) repo.getFieldAttributes ().get (key))); } } } private static Collection getInheritableAttributes (Collection attrs) { HashSet result = new HashSet (); Iterator iter = attrs.iterator (); while (iter.hasNext ()) { Object attr = iter.next (); if (Attributes.hasAttributeType (attr.getClass (), Inheritable.class)) { result.add (attr); } } return result; } private static Collection getInheritableClassAttributes (Class c) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); result.addAll (getInheritableAttributes (Attributes.getAttributes (c))); // Traverse the class hierarchy result.addAll (getInheritableClassAttributes (c.getSuperclass ())); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableClassAttributes (ifs[i])); } return result; } private static Collection getInheritableMethodAttributes (Class c, String methodName, Class[] methodParams) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); try { // Get equivalent method in c Method m = c.getDeclaredMethod (methodName, methodParams); if ((m.getModifiers () & Modifier.PRIVATE) == 0) { result.addAll (getInheritableAttributes (Attributes.getAttributes (m))); } } catch (NoSuchMethodException nsme) { } // Traverse the class hierarchy result.addAll (getInheritableMethodAttributes (c.getSuperclass (), methodName, methodParams)); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableMethodAttributes (ifs[i], methodName, methodParams)); } return result; } private static Collection getInheritableMethodParameterAttributes (Class c, String methodName, Class[] methodParams, int parameter) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); try { // Get equivalent method in c Method m = c.getDeclaredMethod (methodName, methodParams); if ((m.getModifiers () & Modifier.PRIVATE) == 0) { result.addAll (getInheritableAttributes (Attributes.getParameterAttributes (m, parameter))); } } catch (NoSuchMethodException nsme) { } // Traverse the class hierarchy result.addAll (getInheritableMethodParameterAttributes (c.getSuperclass (), methodName, methodParams, parameter)); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableMethodParameterAttributes (ifs[i], methodName, methodParams, parameter)); } return result; } private static Collection getInheritableReturnAttributes (Class c, String methodName, Class[] methodParams) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); try { // Get equivalent method in c Method m = c.getDeclaredMethod (methodName, methodParams); if ((m.getModifiers () & Modifier.PRIVATE) == 0) { result.addAll (getInheritableAttributes (Attributes.getReturnAttributes (m))); } } catch (NoSuchMethodException nsme) { } // Traverse the class hierarchy result.addAll (getInheritableReturnAttributes (c.getSuperclass (), methodName, methodParams)); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableReturnAttributes (ifs[i], methodName, methodParams)); } return result; } public Collection getAttributes () { return classAttributes; } public Collection getAttributes (Field f) { if (fields.containsKey (f)) { return (Collection) fields.get (f); } else { return EMPTY_COLLECTION; } } public Collection getAttributes (Method m) { if (methods.containsKey (m)) { return ((MethodAttributeBundle) methods.get (m)).getAttributes (); } else { return EMPTY_COLLECTION; } } public Collection getParameterAttributes (Constructor c, int parameter) { if (constructors.containsKey (c)) { return ((MethodAttributeBundle) constructors.get (c)).getParameterAttributes (parameter); } else { return EMPTY_COLLECTION; } } public Collection getParameterAttributes (Method m, int parameter) { if (methods.containsKey (m)) { return ((MethodAttributeBundle) methods.get (m)).getParameterAttributes (parameter); } else { return EMPTY_COLLECTION; } } public Collection getReturnAttributes (Method m) { if (methods.containsKey (m)) { return ((MethodAttributeBundle) methods.get (m)).getReturnAttributes (); } else { return EMPTY_COLLECTION; } } public Collection getAttributes (Constructor c) { if (constructors.containsKey (c)) { return ((MethodAttributeBundle) constructors.get (c)).getAttributes (); } else { return EMPTY_COLLECTION; } } } commons-attributes-2.2/api/src/java/org/apache/commons/attributes/EmptyCachedRepository.java100644 0 0 3314 10464315316 27632 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; /** * Null implementation of a cached repository. * * @since 2.1 */ class EmptyCachedRepository implements CachedRepository { private final static Collection EMPTY_COLLECTION = new ArrayList (0); public Collection getAttributes () { return EMPTY_COLLECTION; } public Collection getAttributes (Field f) { return EMPTY_COLLECTION; } public Collection getAttributes (Method m) { return EMPTY_COLLECTION; } public Collection getParameterAttributes (Constructor c, int parameter) { return EMPTY_COLLECTION; } public Collection getParameterAttributes (Method m, int parameter) { return EMPTY_COLLECTION; } public Collection getReturnAttributes (Method m) { return EMPTY_COLLECTION; } public Collection getAttributes (Constructor c) { return EMPTY_COLLECTION; } } commons-attributes-2.2/api/src/java/org/apache/commons/attributes/RuntimeAttributeRepository.java100644 0 0 30631 10464315316 30775 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Set; import java.util.Map; import java.util.HashMap; import java.util.HashSet; import java.util.ArrayList; import java.util.List; /** * Class used to define attributes programmatically for a class. * It is recommended that this class is used in the static initializer for * a class: *

 * public class RuntimeSample extends SuperSample implements SampleIFJoin {
 *
 *     static {
 *         try {
 *             RuntimeAttributeRepository rar = 
 *                 new RuntimeAttributeRepository (RuntimeSample.class);
 *
 *             rar.addClassAttribute (new ThreadSafe ());
 *             
 *             rar.addFieldAttribute ("field", new ThreadSafe ());
 *             
 *             rar.addMethodAttribute ("someMethod", new Class[]{}, 
 *                 new Dependency ( SampleService.class, "sample-some-method1" ));
 *             
 *             rar.addParameterAttribute ("methodWithAttributes", 
 *                 new Class[]{ Integer.TYPE, Integer.TYPE }, 1, 
 *                 new ThreadSafe ());
 * 
 *             rar.addReturnAttribute ("methodWithAttributes", 
 *                 new Class[]{ Integer.TYPE, Integer.TYPE }, 
 *                 new Dependency ( SampleService.class, "sample-return" ));
 *             
 *             rar.addMethodAttribute ("someMethod", 
 *                 new Class[]{ Integer.TYPE },  
 *                 new Dependency ( SampleService.class, "sample-some-method2" ));
 *             
 *             Attributes.setAttributes (rar);
 *         } catch (Exception e) {
 *             throw new Error ("Unable to set attribute information: " + e.toString ());
 *         }
 *     }
 * 
* * @since 2.1 */ public class RuntimeAttributeRepository implements AttributeRepositoryClass { /** * Flag indicating whether this repository is modifiable. * Once sealed, a repository can't be un-sealed. */ private volatile boolean sealed = false; /** * Set of class attributes. See javadoc for {@link AttributeRepositoryClass} for structure. */ private final Set classAttributes = new HashSet (); /** * Set of field attributes. See javadoc for {@link AttributeRepositoryClass} for structure. */ private final Map fieldAttributes = new HashMap (); /** * Set of ctor attributes. See javadoc for {@link AttributeRepositoryClass} for structure. */ private final Map constructorAttributes = new HashMap (); /** * Set of method attributes. See javadoc for {@link AttributeRepositoryClass} for structure. */ private final Map methodAttributes = new HashMap (); /** * Class we are defining attributes for. */ private final Class clazz; /** * Synchronization lock for sealing the repository. We use this instead of * synchronizing on the instance (this), since the sync:ing was added * in 2.2 and we don't want to break any code. * * @since 2.2 */ private final Object syncLock = new Object (); /** * Create a new runtime repository. * * @since 2.1 */ public RuntimeAttributeRepository (Class clazz) { this.clazz = clazz; } /** * Adds a new attribute to the class itself. * * @since 2.1 */ public void addClassAttribute (Object attribute) { checkSealed (); classAttributes.add (attribute); } /** * Convenience function to check if the repository is sealed. * * @throws IllegalStateException if sealed * * @since 2.1 */ private void checkSealed () throws IllegalStateException { synchronized (syncLock) { if (sealed) { throw new IllegalStateException ("RuntimeAttributeRepository has been sealed."); } } } /** * Convenience method to get and initialize an enry in the method or * constructor attribute map. * * @since 2.1 */ private List getMethodOrConstructorAttributeBundle (Map map, String signature, int numSlots) { List bundle = (List) map.get (signature); if (bundle == null) { bundle = new ArrayList (); map.put (signature, bundle); for (int i = 0; i < numSlots; i++) { bundle.add (new HashSet ()); } } return bundle; } /** * Convenience method to get and initialize an entry in the method map. * * @return a fully initialized List (as defined for the {@link AttributeRepositoryClass} interface) * for the given method. * * @since 2.1 */ private List getMethodAttributeBundle (Method m) { String signature = Util.getSignature (m); if (m.getDeclaringClass () != clazz) { throw new IllegalArgumentException ("There is no " + signature + " in " + clazz.getName () + ". It is defined in " + m.getDeclaringClass ().getName ()); } return getMethodOrConstructorAttributeBundle (methodAttributes, signature, m.getParameterTypes ().length + 2); } /** * Convenience method to get and initialize an entry in the constructor map. * * @return a fully initialized List (as defined for the {@link AttributeRepositoryClass} interface) * for the given constructor. * * @since 2.1 */ private List getConstructorAttributeBundle (Constructor c) { String signature = Util.getSignature (c); if (c.getDeclaringClass () != clazz) { throw new IllegalArgumentException ("There is no " + signature + " in " + clazz.getName () + ". It is defined in " + c.getDeclaringClass ().getName ()); } return getMethodOrConstructorAttributeBundle (constructorAttributes, signature, c.getParameterTypes ().length + 1); } /** * Adds an attribute to a field. * * @since 2.1 */ public void addFieldAttribute (String name, Object attribute) throws NoSuchFieldException, SecurityException { addFieldAttribute (clazz.getDeclaredField (name), attribute); } /** * Adds an attribute to a field. * * @since 2.1 */ public void addFieldAttribute (Field f, Object attribute) { checkSealed (); String signature = f.getName (); if (f.getDeclaringClass () != clazz) { throw new IllegalArgumentException ("There is no " + signature + " in " + clazz.getName () + ". It is defined in " + f.getDeclaringClass ().getName ()); } Set attributeSet = (Set) fieldAttributes.get (signature); if (attributeSet == null) { attributeSet = new HashSet (); fieldAttributes.put (signature, attributeSet); } attributeSet.add (attribute); } /** * Adds an attribute to a constructor. The constructor is obtained via the getDeclaredConstrutor method * of the class this repository defines. * * @since 2.1 */ public void addConstructorAttribute (Class[] parameters, Object attribute) throws NoSuchMethodException, SecurityException { addConstructorAttribute (clazz.getDeclaredConstructor (parameters), attribute); } /** * Adds an attribute to a constructor. * * @since 2.1 */ public void addConstructorAttribute (Constructor c, Object attribute) { checkSealed (); List bundle = getConstructorAttributeBundle (c); Set ctorAttrs = (Set) bundle.get (0); ctorAttrs.add (attribute); } /** * Adds an attribute to a method. The method is obtained via the getDeclaredMethod method * of the class this repository defines. * * @since 2.1 */ public void addMethodAttribute (String name, Class[] parameters, Object attribute) throws NoSuchMethodException, SecurityException { addMethodAttribute (clazz.getDeclaredMethod (name, parameters), attribute); } /** * Adds an attribute to a method. * * @since 2.1 */ public void addMethodAttribute (Method m, Object attribute) { checkSealed (); List bundle = getMethodAttributeBundle (m); Set methodAttrs = (Set) bundle.get (0); methodAttrs.add (attribute); } /** * Adds an attribute to a parameter of a constructor. The constructor is obtained via the getDeclaredConstrutor method * of the class this repository defines. * * @since 2.1 */ public void addParameterAttribute (Class[] parameters, int parameterIndex, Object attribute) throws NoSuchMethodException, SecurityException { addParameterAttribute (clazz.getDeclaredConstructor (parameters), parameterIndex, attribute); } /** * Adds an attribute to a parameter of a constructor. * * @since 2.1 */ public void addParameterAttribute (Constructor c, int parameterIndex, Object attribute) { checkSealed (); List bundle = getConstructorAttributeBundle (c); Set parameterAttrs = (Set) bundle.get (parameterIndex + 1); parameterAttrs.add (attribute); } /** * Adds an attribute to a parameter of a method. The method is obtained via the getDeclaredMethod method * of the class this repository defines. * * @since 2.1 */ public void addParameterAttribute (String name, Class[] parameters, int parameterIndex, Object attribute) throws NoSuchMethodException, SecurityException { addParameterAttribute (clazz.getDeclaredMethod (name, parameters), parameterIndex, attribute); } /** * Adds an attribute to a parameter of a method. The method is obtained via the getDeclaredMethod method * of the class this repository defines. * * @since 2.1 */ public void addParameterAttribute (Method m, int parameterIndex, Object attribute) { checkSealed (); List bundle = getMethodAttributeBundle (m); Set parameterAttrs = (Set) bundle.get (parameterIndex + 2); parameterAttrs.add (attribute); } /** * Adds an attribute to the return value of a method. The method is obtained via the getDeclaredMethod method * of the class this repository defines. * * @since 2.1 */ public void addReturnAttribute (String name, Class[] parameters, Object attribute) throws NoSuchMethodException, SecurityException { addReturnAttribute (clazz.getDeclaredMethod (name, parameters), attribute); } /** * Adds an attribute to the return value of a method. The method is obtained via the getDeclaredMethod method * of the class this repository defines. * * @since 2.1 */ public void addReturnAttribute (Method m, Object attribute) { checkSealed (); List bundle = getMethodAttributeBundle (m); Set returnAttrs = (Set) bundle.get (1); returnAttrs.add (attribute); } /** * Gets the class this repository defines attributes for. * * @since 2.1 */ public Class getDefinedClass () { return clazz; } public Set getClassAttributes () { return classAttributes; } public Map getFieldAttributes () { return fieldAttributes; } public Map getMethodAttributes () { return methodAttributes; } public Map getConstructorAttributes () { return constructorAttributes; } /** * Seals this repository. A sealed repository can't be modified. * * @since 2.1 */ public void seal () { synchronized (syncLock) { sealed = true; } } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Sealable.java100644 0 0 3202 10464315316 25050 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * Marks an attribute class as being sealable. When an instance of an attribute * class is created it goes through the following phases: * *
    *
  1. Its constructor is called with all non-named parameters in the attribute declaration. *
  2. Its setters are called according to the named parameters in the declaration. *
* * This alone poses a security risk, as a client can call setters on an attribute as well, * and thus make class attributes mutable. In order to notify the attribute class that construction * and initialization is completed, the attribute runtime system will test if it implements Sealable, * and of so, invoke {@link #seal()} on the attribute instance. * * @see DefaultSealable * @since 2.1 */ public interface Sealable { /** * Called to indicate that construction and initialization of this attribute instance * is completed, and that the attribute instance should become read-only. * * @since 2.1 */ public void seal (); }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/package.html100644 0 0 1302 10464315316 24755 0ustar 0 0

Provides an API for accessing attributes. commons-attributes-2.2/api/src/java/org/apache/commons/attributes/SealedAttributeException.java100644 0 0 2061 10464315317 30303 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.util.Iterator; import java.util.List; /** * Thrown when an attempt is made to modify a {@link Sealable} attribute * that has been sealed. * * @see Sealable#seal() * @since 2.2 */ public class SealedAttributeException extends IllegalStateException { public SealedAttributeException () { super ("sealed"); } }././@LongLink100644 0 0 145 10464315317 10257 Lustar 0 0 commons-attributes-2.2/api/src/java/org/apache/commons/attributes/EmptyAttributeRepositoryClass.javacommons-attributes-2.2/api/src/java/org/apache/commons/attributes/EmptyAttributeRepositoryClass.java100644 0 0 2507 10464315317 31420 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.util.Collections; import java.util.Set; import java.util.Map; /** * Empty implementation of AttributeRepositoryClass. * * @since 2.1 */ class EmptyAttributeRepositoryClass implements AttributeRepositoryClass { public static final AttributeRepositoryClass INSTANCE = new EmptyAttributeRepositoryClass(); public Set getClassAttributes () { return Collections.EMPTY_SET; } public Map getFieldAttributes () { return Collections.EMPTY_MAP; } public Map getMethodAttributes () { return Collections.EMPTY_MAP; } public Map getConstructorAttributes () { return Collections.EMPTY_MAP; } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Inheritable.java100644 0 0 1541 10464315317 25573 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * This attribute is used to mark attributes as being inheritable. * Inheritable attributes are inherited down the class and interface * hierarchy. * * @since 2.1 */ public class Inheritable { }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/InvalidAttributeTargetError.java100644 0 0 6135 10464315317 31004 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.util.ArrayList; import java.util.List; /** * Thrown when an attribute has a {@link Target} declaration that forbids * it being applied to the program element it has been applied to. * *

For example: * *


 * /**
 *  * This attribute can only be applied to Classes.
 *  * Target(Target.CLASS)
 *  */
 * public class MyAttribute {}
 *
 * public class MyClass {
 *     /** 
 *       * Error: Can't apply MyAttribute to a field!
 *       * @@MyAttribute() 
 *       */
 *     private String myField;
 * }
 * 
* * @since 2.1 */ public class InvalidAttributeTargetError extends Error { /** * Creates a new InvalidAttributeTargetError. * * @param attributeClass name of the type of the attribute that was applied to the wrong target. * @param element the element that the user tried to apply the attribute to. * @param targetFlags the targets (bitwise OR of the {@link Target}.XXX flags that the attributeClass * can be applied to. * @since 2.1 */ public InvalidAttributeTargetError (String attributeClass, String element, int targetFlags) { super ("Attributes of type " + attributeClass + " can't be applied to " + element + ". " + "They can only be applied to: " + flagsToString (targetFlags)); } private final static String flagsToString (int flags) { List targetNames = new ArrayList (); if ((flags & Target.CLASS) > 0) { targetNames.add ("CLASS"); } if ((flags & Target.FIELD) > 0) { targetNames.add ("FIELD"); } if ((flags & Target.METHOD) > 0) { targetNames.add ("METHOD"); } if ((flags & Target.CONSTRUCTOR) > 0) { targetNames.add ("CONSTRUCTOR"); } if ((flags & Target.METHOD_PARAMETER) > 0) { targetNames.add ("METHOD_PARAMETER"); } if ((flags & Target.CONSTRUCTOR_PARAMETER) > 0) { targetNames.add ("CONSTRUCTOR_PARAMETER"); } if ((flags & Target.RETURN) > 0) { targetNames.add ("RETURN"); } StringBuffer sb = new StringBuffer (); for (int i = 0; i < targetNames.size (); i++) { sb.append (targetNames.get (i)); if (i < targetNames.size () - 1) { sb.append (" | "); } } return sb.toString (); } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/CachedRepository.java100644 0 0 2660 10464315317 26617 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Collection; /** * An attribute repository cache. Used internally to speed up operation. * All collections returned should be unmodifiable. * * @since 2.1 */ interface CachedRepository { public static final CachedRepository EMPTY = new EmptyCachedRepository (); public Collection getAttributes (); public Collection getAttributes (Field f); public Collection getAttributes (Method m); public Collection getParameterAttributes (Method m, int parameter); public Collection getParameterAttributes (Constructor c, int parameter); public Collection getReturnAttributes (Method m); public Collection getAttributes (Constructor c); } ././@LongLink100644 0 0 152 10464315317 10255 Lustar 0 0 commons-attributes-2.2/api/src/java/org/apache/commons/attributes/ParameterIndexOutOfBoundsException.javacommons-attributes-2.2/api/src/java/org/apache/commons/attributes/ParameterIndexOutOfBoundsException100644 0 0 4752 10464315317 31353 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * Thrown when attempting to get attributes for a parameter of a constructor or method * and the parameter index is out of bounds. * *

Note: for performance reasons, this exception is only thrown when the * Commons Attribute runtime can quickly determine that the index is out of bounds. * Therefore, you may sometimes be able to pass an invalid index and not receive this * exception. For example, if the runtime knows that the method or constructor has * no attributes at all, an empty collection / null or false (as appropriate) will be * returned instead. Put simply, don't use this exception to test how many parameters * a method or constructor has. * * @since 2.2 */ public class ParameterIndexOutOfBoundsException extends IndexOutOfBoundsException { /** * Create a new ParameterIndexOutOfBoundsException. * * @param methodOrConstructorName the name of the method or constructor whose parameter * the client tried to get attributes for. * @param index the index supplied by the client. * @param maxIndex the maximum + 1 parameter index allowed. For example, if a method takes * two parameters, the maximum allowed index is 1, and this parameter should * be set to 2. There is no minIndex parameter - it is assumed to be 0. */ public ParameterIndexOutOfBoundsException (String methodOrConstructorName, int index, int maxIndex) { super (formatMessage (methodOrConstructorName, index, maxIndex)); } private static String formatMessage (String methodOrConstructorName, int index, int maxIndex) { if (index < 0) { return String.valueOf (index); } else { return index + ". " + methodOrConstructorName + " has " + maxIndex + " parameters."; } } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/DefaultSealable.java100644 0 0 3375 10464315317 26371 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * Implementation of the {@link Sealable} interface. Subclasses should call * {@link #checkSealed()} before setting any bean properties. * * @since 2.1 */ public class DefaultSealable implements Sealable { /** * Boolean flag indicating whether the {@link seal()} method * has been called. */ private volatile boolean sealed = false; /** * Default ctor. */ public DefaultSealable () { } /** * Checks if the {@link #seal()} method has been called and throws a * IllegalStateException if it has. * * @throws IllegalStateException if this attribute has been sealed. * * @since 2.1 */ protected void checkSealed () throws IllegalStateException { if (sealed) { throw new SealedAttributeException (); } } /** * Seals this attribute. Any future calls to the * {@link #checkSealed()} method will result in an * IllegalStateException being thrown. * * @since 2.1 */ public void seal () { this.sealed = true; } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/CircularDependencyError.java100644 0 0 5503 10464315317 30124 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.util.Iterator; import java.util.List; /** * Thrown when an attribute repository class can't be * loaded because it resulted in a circular dependency. * * @since 2.1 */ public class CircularDependencyError extends RepositoryError { /** * Create a new CircularDependencyError. * * @param className the name of the class that started it all. * @param dependencyList a list of the classes ({@link java.lang.Class}) * that the original * class depended on, the classes they * depended on, and so on. The list should * show the chain of dependencies that resulted * in the exception being thrown. Note: * Versions prior to 2.2 accepted a list of Objects * of any type. This is still supported, but the * formatting may suffer. Please only use lists of * {@link java.lang.Class}. * * @since 2.1 */ public CircularDependencyError (String className, List dependencyList) { super (className + ":" + listDeps (dependencyList), null); } /** * Joins together the elements of a list with -> * delimiters. Used to show the sequence that resulted in the circular * dependency. * * @since 2.1 */ private static String listDeps (List dependencyList) { StringBuffer sb = new StringBuffer (); Iterator iter = dependencyList.iterator (); while (iter.hasNext ()) { Object o = iter.next (); // Test that the user really passed in a Class. Versions // prior to 2.2 received Strings instead, and any user that // used the code would find it broken. if (o != null && o instanceof Class) { sb.append (((Class) o).getName ()); } else { sb.append (o); } if (iter.hasNext ()) { sb.append (" -> "); } } return sb.toString (); } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/AttributeRepositoryClass.java100644 0 0 6064 10464315317 30403 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.util.Set; import java.util.Map; /** * Interface implemented by all attribute repository classes. * This interface is used internally and should not be used * by clients. The only reason it is public is because the * classes implementing it may be in any package. * * @since 2.1 */ public interface AttributeRepositoryClass { /** * Returns a set containing all attributes (instances) associated with this class. * Should not return any attributes of superclasses etc. * * @since 2.1 */ public Set getClassAttributes (); /** * Returns a map with String keys and Set values. The keys correspond to field names, * and their associated Set values are the set of all attributes (instances) associated with that field. * Should not return any attributes of superclasses etc. * * @since 2.1 */ public Map getFieldAttributes (); /** * Returns a map with String keys and List values. The keys correspond to method signatures, * given by get Util.getSignature method, and the lists are as follows:

* * list.get(0) = A Set with the attributes associated with the method.

* list.get(1) = A Set with the attributes associated with the method's return value.

* list.get(2) = A Set with the attributes associated with the method's first parameter.

* list.get(n) = A Set with the attributes associated with the method's (n - 1) th parameter.

* * All slots in the list must be filled, not just those where there are attributes. * *

Should not return any attributes of superclasses etc. * * @since 2.1 */ public Map getMethodAttributes (); /** * Returns a map with String keys and List values. The keys correspond to constructor signatures, * given by get Util.getSignature method, and the lists are as follows:

* * list.get(0) = A Set with the attributes associated with the constructor.

* list.get(1) = A Set with the attributes associated with the constructor's first parameter.

* list.get(n) = A Set with the attributes associated with the constructor's (n - 1) th parameter.

* * All slots in the list must be filled, not just those where there are attributes. * *

Should not return any attributes of superclasses etc. * * @since 2.1 */ public Map getConstructorAttributes (); }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/AttributeUtil.java100644 0 0 7373 10464315317 26157 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Collection; import java.util.Collections; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.WeakHashMap; /** * Commonly used convenience functions. * * @since 2.1 */ public class AttributeUtil { /** * Filters a Collection of Class objects. The returned collection * only contains those classes that have an attribute of the specified type. * That is, for each Class clazz in the * returned collection, * clazz != null && Attributes.hasAttributeType (clazz, attributeClass) * is true. * * @param classes Collection of Classes to filter. May contain null references, * but may not itself be null. * @param attributeClass the class to filter based on. * * @since 2.1 */ public static Collection getClassesWithAttributeType (Collection classes, Class attributeClass) { if (classes == null) { throw new NullPointerException ("classes"); } if (attributeClass == null) { throw new NullPointerException ("attributeClass"); } ArrayList result = new ArrayList (); Iterator iter = classes.iterator (); while (iter.hasNext ()) { Class clazz = (Class) iter.next (); if (clazz != null) { if (Attributes.hasAttributeType (clazz, attributeClass)) { result.add (clazz); } } } return result; } /** * Filters a collection of objects. The returned collection * only contains those objects whose class have an attribute * of the specified type. That is, for each Object o in the * returned collection, * o != null && Attributes.hasAttributeType (o.getClass (), attributeClass) * is true. * * @param objects Collection of objects to filter. May contain null references, * but may not itself be null. * @param attributeClass the class to filter based on. * * @since 2.1 */ public static Collection getObjectsWithAttributeType (Collection objects, Class attributeClass) { if (objects == null) { throw new NullPointerException ("objects"); } if (attributeClass == null) { throw new NullPointerException ("attributeClass"); } ArrayList result = new ArrayList (); Iterator iter = objects.iterator (); while (iter.hasNext ()) { Object object = iter.next (); if (object != null) { Class clazz = object.getClass (); if (Attributes.hasAttributeType (clazz, attributeClass)) { result.add (object); } } } return result; } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Target.java100644 0 0 5152 10464315317 24575 0ustar 0 0 package org.apache.commons.attributes; /** * Attribute indicating what elements an attribute may be applied to. * This is checked at runtime. If the attribute is absent, it defaults * to {@link Target#ALL Target.ALL}. * *

This attribute is intended to be used with attribute classes: * *


 * /**
 *  * MyAttribute can only be applied to classes and fields, not methods.
 *  * @@Target(Target.CLASS | Target.FIELD)
 *  */
 * public class MyAttribute { ... }
 * 
* * @since 2.1 */ public class Target { /** * Indicates that the attribute can be applied to a class or interface. * * @since 2.1 */ public static final int CLASS = 1; /** * Indicates that the attribute can be applied to a field. * * @since 2.1 */ public static final int FIELD = 2; /** * Indicates that the attribute can be applied to a method. * * @since 2.1 */ public static final int METHOD = 4; /** * Indicates that the attribute can be applied to a constructor. * * @since 2.1 */ public static final int CONSTRUCTOR = 8; /** * Indicates that the attribute can be applied to a method parameter. * * @since 2.1 */ public static final int METHOD_PARAMETER = 16; /** * Indicates that the attribute can be applied to a constructor parameter. * * @since 2.1 */ public static final int CONSTRUCTOR_PARAMETER = 32; /** * Indicates that the attribute can be applied to a method return value. * * @since 2.1 */ public static final int RETURN = 64; /** * Indicates that the attribute can be applied to a parameter of a method or a constructor. * It is equal to METHOD_PARAMETER | CONSTRUCTOR_PARAMETER. * * @since 2.1 */ public static final int PARAMETER = METHOD_PARAMETER | CONSTRUCTOR_PARAMETER; /** * Indicates that the attribute can be applied to any program element. * * @since 2.1 */ public static final int ALL = CLASS | FIELD | METHOD | CONSTRUCTOR | PARAMETER | RETURN; private final int flags; /** * Creates a new target attribute. * * @param flags a bitwise or of flags indicating the allowed targets. * @since 2.1 */ public Target (int flags) { this.flags = flags; } /** * Returns an int that is the bitwise or of the allowed target flags. * * @since 2.1 */ public int getFlags () { return flags; } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/MultipleAttributesError.java100644 0 0 2406 10464315317 30222 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * Thrown when one of the {@link Attributes}.getAttribute methods find more * than one instance of the specified attribute class and the method * only expected to find a single instance. * * @since 2.1 */ public class MultipleAttributesError extends Error { /** * Create a new MultipleAttributesError. * * @param clazz the name of the attribute class of which multiple instances were found. * @since 2.1 */ public MultipleAttributesError (String clazz) { super ("There was more than one attribute of class " + clazz + " associated with the element."); } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/AttributeIndex.java100644 0 0 41102 10464315317 26315 0ustar 0 0 /* * Copyright 2003-2005 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Field; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; /** * An index providing a list of elements with given attributes. This * requires that the attribute is {@link Indexed} and that the * attribute indexer tool has been run on the jar file containing the * classes. * * @since 2.1 */ public class AttributeIndex { /** * Reference to a method parameter. A method parameter * is defined by the Method object it is defined in, and the index * of the parameter in the method's parameter list. * * @since 2.1 */ public static class MethodParameter { private final Method method; private final int index; /** * Constructs a new MethodParameter. * * @since 2.1 */ public MethodParameter (Method method, int index) { this.method = method; this.index = index; } /** * Get the method this parameter is defined in. * * @since 2.1 */ public Method getMethod () { return method; } /** * Get the index of this parameter in the parameter list of the method. * * @since 2.1 */ public int getIndex () { return index; } /** * Compares two MethodParameters for equality. * They must point to the same method and have the same index. * * @since 2.1 */ public boolean equals (Object o) { return o != null && o instanceof MethodParameter && method.equals (((MethodParameter) o).method) && index == ((MethodParameter) o).index; } /** * Computes the hashCode. * * @since 2.1 */ public int hashCode () { return method.hashCode () + index; } /** * Converts this method parameter into a human-readable string. * * @since 2.1 */ public String toString () { return method.toString () + ":" + index; } } /** * A constructor parameter. A method parameter * is defined by the Method object it is defined in, and the index * of the parameter in the method's parameter list. * * @since 2.1 */ public static class ConstructorParameter { private final Constructor ctor; private final int index; /** * Constructs a new ConstructorParameter. * * @since 2.1 */ public ConstructorParameter (Constructor ctor, int index) { this.ctor = ctor; this.index = index; } /** * Get the constructor this parameter is defined in. * * @since 2.1 */ public Constructor getConstructor () { return ctor; } /** * Get the index of this parameter in the parameter list of the constructor. * * @since 2.1 */ public int getIndex () { return index; } /** * Compares two ConstructorParameters for equality. * They must point to the same constructor and have the same index. * * @since 2.1 */ public boolean equals (Object o) { return o != null && o instanceof ConstructorParameter && ctor.equals (((ConstructorParameter) o).ctor) && index == ((ConstructorParameter) o).index; } /** * Computes the hashCode. * * @since 2.1 */ public int hashCode () { return ctor.hashCode () + index; } /** * Converts this constructor parameter into a human-readable string. * * @since 2.1 */ public String toString () { return ctor.toString () + ":" + index; } } private static class IndexNode { public Collection classes = new HashSet (); public Collection fields = new HashSet (); public Collection methods = new HashSet (); public Collection constructors = new HashSet (); public Collection returnValues = new HashSet (); public Collection constructorParameters = new HashSet (); public Collection methodParameters = new HashSet (); public void seal () { classes = seal (classes); fields = seal (fields); methods = seal (methods); constructors = seal (constructors); returnValues = seal (returnValues); constructorParameters = seal (constructorParameters); methodParameters = seal (methodParameters); } private Collection seal (Collection coll) { return Collections.unmodifiableCollection (coll); } } private final HashMap index = new HashMap (); private final ClassLoader classLoader; /** * Creates a new AttributeIndex for the given ClassLoader. * * @since 2.1 */ public AttributeIndex (ClassLoader cl) throws Exception { this.classLoader = cl; Enumeration e = cl.getResources ("META-INF/attrs.index"); while (e.hasMoreElements ()) { URL url = (URL) e.nextElement (); loadFromURL (url); } Iterator iter = index.values ().iterator (); while (iter.hasNext ()) { ((IndexNode) iter.next ()).seal (); } } private IndexNode getNode (Class attributeClass) { IndexNode node = (IndexNode) index.get (attributeClass.getName ()); if (node == null) { node = new IndexNode (); index.put (attributeClass.getName (), node); } return node; } private void addIndex (Collection attributes, Class clazz) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).classes.add (clazz); } } private void addIndex (Collection attributes, Field field) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).fields.add (field); } } private void addIndex (Collection attributes, Method method) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).methods.add (method); } } private void addIndex (Collection attributes, Constructor constructor) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).constructors.add (constructor); } } private void addReturnIndex (Collection attributes, Method method) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).returnValues.add (method); } } private void addIndex (Collection attributes, Method method, int parameter) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).methodParameters.add (new MethodParameter (method, parameter)); } } private void addIndex (Collection attributes, Constructor ctor, int parameter) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { getNode (iter.next ().getClass ()).constructorParameters.add (new ConstructorParameter (ctor, parameter)); } } /** * Add a class to the index. */ private void addClass (String clazzName) throws Exception { Class clazz = classLoader.loadClass (clazzName); // Get the attributes attached to the class itself... Collection coll = Attributes.getAttributes (clazz); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, clazz); Field[] fields = clazz.getDeclaredFields (); for (int i = 0; i < fields.length; i++) { coll = Attributes.getAttributes (fields[i]); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, fields[i]); } Method[] methods = clazz.getDeclaredMethods (); for (int i = 0; i < methods.length; i++) { coll = Attributes.getAttributes (methods[i]); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, methods[i]); // Return values coll = Attributes.getReturnAttributes (methods[i]); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addReturnIndex (coll, methods[i]); // Parameters int numParameters = methods[i].getParameterTypes().length; for (int j = 0; j < numParameters; j++) { coll = Attributes.getParameterAttributes (methods[i], j); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, methods[i], j); } } Constructor[] ctors = clazz.getDeclaredConstructors (); for (int i = 0; i < ctors.length; i++) { coll = Attributes.getAttributes (ctors[i]); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, ctors[i]); // Parameters int numParameters = ctors[i].getParameterTypes().length; for (int j = 0; j < numParameters; j++) { coll = Attributes.getParameterAttributes (ctors[i], j); coll = AttributeUtil.getObjectsWithAttributeType (coll, Indexed.class); addIndex (coll, ctors[i], j); } } } /** * Load the attrs.index from a given URL. * * @since 2.1 */ private void loadFromURL (URL url) throws Exception { URLConnection connection = url.openConnection (); BufferedReader br = new BufferedReader (new InputStreamReader (connection.getInputStream ())); try { String currentAttributeClass = null; String line = null; while ((line = br.readLine ()) != null) { if (line.startsWith ("Class: ")) { String className = line.substring ("Class: ".length ()).trim (); addClass (className); } } } finally { br.close (); } } /** * Gets a Collection of the classes that have an attribute of the specified class. * The Collection contains the class names (String). * * @deprecated Use the getClasses(Class) method instead. * * @since 2.1 */ public Collection getClassesWithAttribute (String attributeClass) { if (index.containsKey (attributeClass)) { Collection classes = ((IndexNode) index.get (attributeClass)).classes; Iterator iter = classes.iterator (); Collection converted = new ArrayList (classes.size ()); while (iter.hasNext ()) { converted.add (((Class) iter.next ()).getName ().replace ('$', '.')); } return converted; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the classes that have an attribute of the specified class. * The Collection contains the class names (String). * * @deprecated Use the getClasses(Class) method instead. */ public Collection getClassesWithAttribute (Class attributeClass) { return getClassesWithAttribute (attributeClass.getName ()); } /** * Gets a Collection of the Classes that have an attribute of the specified class. * The Collection contains the classes (Class). * * @since 2.1 */ public Collection getClasses (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).classes; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the Methods that have an attribute of the specified class. * The Collection contains the methods (java.lang.reflect.Method). * * @since 2.1 */ public Collection getMethods (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).methods; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the Methods whose return value has an attribute of the specified class. * The Collection contains the methods (java.lang.reflect.Method). * * @since 2.1 */ public Collection getMethodsReturning (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).returnValues; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the Fields that have an attribute of the specified class. * The Collection contains the methods (java.lang.reflect.Field). * * @since 2.1 */ public Collection getFields (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).fields; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the Constructors that have an attribute of the specified class. * The Collection contains the methods (java.lang.reflect.Constructor). * * @since 2.1 */ public Collection getConstructors (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).constructors; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the ConstructorParameters that have an attribute of the specified class. * The Collection contains the methods ({@link AttributeIndex.ConstructorParameter}). * * @since 2.1 */ public Collection getConstructorParameters (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).constructorParameters; } else { return Collections.EMPTY_SET; } } /** * Gets a Collection of the MethodParameters that have an attribute of the specified class. * The Collection contains the methods ({@link AttributeIndex.MethodParameter}). * * @since 2.1 */ public Collection getMethodParameters (Class attributeClass) { if (index.containsKey (attributeClass.getName ())) { return ((IndexNode) index.get (attributeClass.getName ())).methodParameters; } else { return Collections.EMPTY_SET; } } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Util.java100644 0 0 13041 10464315317 24300 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.List; import java.util.Iterator; import java.util.Set; import java.util.Map; import java.util.Collection; class Util { public static String getSignature (Method m) { return m.getName () + "(" + getParameterList (m.getParameterTypes ()) + ")"; } public static String getSignature (Constructor c) { return "(" + getParameterList (c.getParameterTypes ()) + ")"; } public static String decodedClassName (String rawName) throws IllegalArgumentException { if (!rawName.startsWith ("[")) { return rawName; } else { StringBuffer nesting = new StringBuffer (); int i = 0; while (rawName.charAt (i) == '[') { nesting.append ("[]"); i++; } String type = ""; switch (rawName.charAt (i)) { case 'B': type = "byte"; break; case 'C': type = "char"; break; case 'D': type = "double"; break; case 'F': type = "float"; break; case 'I': type = "int"; break; case 'J': type = "long"; break; case 'L': type = rawName.substring (i + 1, rawName.length () - 1); break; case 'S': type = "short"; break; case 'Z': type = "boolean"; break; default: throw new IllegalArgumentException ("Can't decode " + rawName); } return type + nesting.toString (); } } public static String getParameterList (Class[] params) { StringBuffer sb = new StringBuffer (); for (int i = 0; i < params.length; i++) { if (i > 0) { sb.append (","); } sb.append (decodedClassName (params[i].getName ())); } return sb.toString (); } private static void checkTarget (int target, Object attribute, String element) { Target targetAttr = (Target) Attributes.getAttribute (attribute.getClass (), Target.class); if (targetAttr == null) { return; } if ((targetAttr.getFlags () & target) == 0) { throw new InvalidAttributeTargetError (attribute.getClass ().getName (), element, targetAttr.getFlags ()); } } private static void checkTargets (int target, Collection attributes, String element) { Iterator iter = attributes.iterator (); while (iter.hasNext ()) { checkTarget (target, iter.next (), element); } } public static void validateRepository (Class owningClass, AttributeRepositoryClass repo) { checkTargets (Target.CLASS, repo.getClassAttributes (), owningClass.getName ()); Map fieldAttrs = repo.getFieldAttributes (); for (Iterator iter = fieldAttrs.keySet ().iterator(); iter.hasNext ();) { String fieldName = (String) iter.next (); checkTargets (Target.FIELD, (Collection) fieldAttrs.get (fieldName), owningClass.getName () + "." + fieldName); } Map ctorAttrs = repo.getConstructorAttributes (); for (Iterator iter = ctorAttrs.keySet ().iterator(); iter.hasNext ();) { String ctorName = (String) iter.next (); List bundle = (List) ctorAttrs.get (ctorName); for (int i = 0; i < bundle.size (); i++) { switch (i) { case 0: checkTargets (Target.CONSTRUCTOR, (Collection) bundle.get (0), owningClass.getName () + "." + ctorName); break; default: checkTargets (Target.CONSTRUCTOR_PARAMETER, (Collection) bundle.get (i), "parameter " + (i) + " of " + owningClass.getName () + ctorName); } } } Map methodAttrs = repo.getMethodAttributes (); for (Iterator iter = methodAttrs.keySet ().iterator(); iter.hasNext ();) { String methodName = (String) iter.next (); List bundle = (List) methodAttrs.get (methodName); for (int i = 0; i < bundle.size (); i++) { switch (i) { case 0: checkTargets (Target.METHOD, (Collection) bundle.get (0), owningClass.getName () + "." + methodName); break; case 1: checkTargets (Target.RETURN, (Collection) bundle.get (1), "return value of " + owningClass.getName () + "." + methodName); break; default: checkTargets (Target.METHOD_PARAMETER, (Collection) bundle.get (i), "parameter " + (i - 1) + " of " + owningClass.getName () + "." + methodName); } } } } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/RepositoryError.java100644 0 0 4557 10464315317 26550 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * Thrown when an attribute repository class can't be * loaded or instantiated. * * @since 2.1 */ public class RepositoryError extends Error { private final Throwable nested; /** * Create a new RepositoryError with no message or nested Throwable. * * @since 2.1 */ public RepositoryError () { this (null, null); } /** * Create a new RepositoryError with a message but no nested Throwable. * * @param message the message. * @since 2.1 */ public RepositoryError (String message) { this (message, null); } /** * Create a new RepositoryError with a nested Throwable. The message is set to nested.toString(). * * @param nested the nested Throwable. * @since 2.1 */ public RepositoryError (Throwable nested) { this (nested.toString(), nested); } /** * Create a new RepositoryError with a message and nested Throwable. * * @param message the message. * @param nested the nested Throwable. * @since 2.1 */ public RepositoryError (String message, Throwable nested) { super (message); this.nested = nested; } /** * Get the nested Throwable if any. * * @return the Throwable that caused this Error to be thrown, or null if none exists. * @since 2.1 */ public Throwable getNested () { return nested; } /** * Get the nested Throwable, if any. * * @return the Throwable that caused this Error to be thrown, or null if none exists. * @since 2.2 */ public Throwable getCause () { return nested; } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Attributes.java100644 0 0 101535 10464315317 25537 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Collection; import java.util.Collections; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.WeakHashMap; /** * API for accessing attributes. * *

General Notes on Errors

* * All Methods in this class may throw RepositoryError or subclasses thereof. * This Error is thrown if an attribute repository can not be loaded for some Exceptional * reason. * *

Rationale for Errors instead of Exceptions

* * The methods in this class throws Errors instead of Exceptions. * This rationale behind this is that: * *
    *
  • The programmer should not have to wrap all accesses to * the Attributes API in a try/catch clause. *
  • An Exception being thrown here is caused by missing classes * or other "Error-like" conditions. *
* *

Null References

* *

If a parameter to a method may not be null, and a null is passed to the * method, a {@link java.lang.NullPointerException} will be thrown, with the * parameter name in the message. * *

Rationale for using this instead of {@link java.lang.IllegalArgumentException} * is that it is more precise - the reference was null. * *

Performance Notes

*

The process of loading attributes for a class is a * (relatively) time-consuming process, as it involves some dynamic linking * in the form of inheritable attributes, a lot of reflection and so on. However, * once loaded the attributes are cached, so repeated access to them are fast. * But despite this the process of finding one attribute of a given type * or such operations does involve some iteration of HashSets that runs in linear * time in the number of attributes associated with the program element, and you should * avoid accessing attributes in your innermost loops if you can avoid it. For * example, instead of: * *


 * Class myClass = ...;
 * for (int i = 0; i < 10000; i++) {
 *     if (Attributes.hasAttributeType (myClass, MyAttribute.class)) {
 *         doThis(myClass);
 *     } else {
 *         doThat(myClass);
 *     }
 * }
 * 
* * do: * *

 * Class myClass = ...;
 * boolean shouldDoThis = Attributes.hasAttributeType (myClass, MyAttribute.class);
 * for (int i = 0; i < 10000; i++) {
 *     if (shouldDoThis) {
 *         doThis(myClass);
 *     } else {
 *         doThat(myClass);
 *     }
 * }
 * 
* * if the loop should run at maximum speed. * * @since 2.1 */ public class Attributes { /** * A cache of attribute repositories. The map used is a WeakHashMap keyed on the * Class owning the attribute repository. This works because Class objects use * the identity function to compare for equality - i.e. if the two classes * have the same name, and are loaded from the same two ClassLoaders, then * class1 == class2. Also, (class1.equals(class2)) == (class1 == * class2). This means that a once a Class reference has been garbage-collected, * it can't be re-created. Thus we can treat the cache map as a normal map - the only * entries that will ever disappear are those we can't look up anyway because we * can't ever create the key for them! * *

Also, this will keep the cache from growing too big in environments where * classes are loaded and unloaded all the time (i.e. application servers). */ private final static Map classRepositories = new WeakHashMap (); /** * List used to keep track of the initialization list in getCachedRepository. * Since the method is synchronized static, we only need one list. */ private static List initList = new ArrayList (); private synchronized static CachedRepository getCachedRepository (Class clazz) throws RepositoryError, CircularDependencyError { if (initList.contains (clazz)) { List dependencyList = new ArrayList (); dependencyList.addAll (initList); dependencyList.add (clazz); throw new CircularDependencyError (clazz.getName (), dependencyList); } else if (classRepositories.containsKey (clazz)) { CachedRepository cr = (CachedRepository) classRepositories.get (clazz); return cr; } else { // Indicate that we're loading it. CachedRepository cached = null; initList.add (clazz); try { Class attributeRepo = null; AttributeRepositoryClass repo = EmptyAttributeRepositoryClass.INSTANCE; try { attributeRepo = Class.forName (clazz.getName () + "$__attributeRepository", true, clazz.getClassLoader ()); repo = (AttributeRepositoryClass) attributeRepo.newInstance (); } catch (ClassNotFoundException cnfe) { // OK, just means no repo available, so default to empty one. repo = EmptyAttributeRepositoryClass.INSTANCE; } catch (InstantiationException ie) { throw new RepositoryError (ie); } catch (IllegalAccessException iae) { throw new RepositoryError (iae); } cached = new DefaultCachedRepository (clazz, repo); classRepositories.put (clazz, cached); if (repo != null) { Util.validateRepository (clazz, repo); } } finally { initList.remove (initList.size () - 1); } return cached; } } /** * Selects from a collection of attributes one attribute with a given class. * * @param attrs the collection of attribute instances to select from. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. */ private static Object getAttribute (Collection attrs, Class attributeClass) throws MultipleAttributesError { Object candidate = null; Iterator iter = attrs.iterator (); while (iter.hasNext ()) { Object attr = iter.next (); if (attr.getClass () == attributeClass) { if (candidate == null) { candidate = attr; } else { throw new MultipleAttributesError (attributeClass.getName ()); } } } return candidate; } /** * Get one attributes of a given type from a class. * * @param clazz the class. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * * @since 2.1 */ public static Object getAttribute (Class clazz, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getAttributes (clazz), attributeClass); } /** * Get one attributes of a given type from a field. * * @param field the field. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * * @since 2.1 */ public static Object getAttribute (Field field, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getAttributes (field), attributeClass); } /** * Get one attributes of a given type from a constructor. * * @param constructor the constructor. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * * @since 2.1 */ public static Object getAttribute (Constructor constructor, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getAttributes (constructor), attributeClass); } /** * Get one attributes of a given type from a method. * * @param method the method. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * * @since 2.1 */ public static Object getAttribute (Method method, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getAttributes (method), attributeClass); } /** * Get one attributes of a given type from a parameter. * * @param method the method. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @param parameter index of the parameter in the method's parameter list. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the method accepts. * * @since 2.1 */ public static Object getParameterAttribute (Method method, int parameter, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getParameterAttributes (method, parameter), attributeClass); } /** * Get one attributes of a given type from a constructor's parameter. * * @param constructor the constructor. May not be null. * @param parameter index of the parameter in the method's parameter list. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the constructor accepts. * * @since 2.1 */ public static Object getParameterAttribute (Constructor constructor, int parameter, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getParameterAttributes (constructor, parameter), attributeClass); } /** * Get one attributes of a given type from a method's return value. * * @param method the method. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @return the attribute instance, or null of none could be found. * @throws MultipleAttributesError if the collection contains more than one * instance of the specified class. * * @since 2.1 */ public static Object getReturnAttribute (Method method, Class attributeClass) throws RepositoryError, MultipleAttributesError { return getAttribute (getReturnAttributes (method), attributeClass); } /** * Gets all attributes for a class. * * @param clazz the class. May not be null. * * @since 2.1 */ public static Collection getAttributes (Class clazz) throws RepositoryError { if (clazz == null) { throw new NullPointerException ("clazz"); } return getCachedRepository (clazz).getAttributes (); } /** * Gets all attributes for a method. * * @param method the method. May not be null. * * @since 2.1 */ public static Collection getAttributes (Method method) throws RepositoryError { if (method == null) { throw new NullPointerException ("method"); } return getCachedRepository (method.getDeclaringClass()).getAttributes (method); } /** * Gets all attributes for a parameter of a method. * * @param method the method. May not be null. * @param parameter the index of the parameter in the method's parameter list. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the method accepts. * * @since 2.1 */ public static Collection getParameterAttributes (Method method, int parameter) throws RepositoryError { if (method == null) { throw new NullPointerException ("method"); } return getCachedRepository (method.getDeclaringClass()).getParameterAttributes (method, parameter); } /** * Gets all attributes for a parameter of a constructor. * * @param constructor the constructor. May not be null. * @param parameter the index of the parameter in the constructor's parameter list. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the constructor accepts. * * @since 2.1 */ public static Collection getParameterAttributes (Constructor constructor, int parameter) throws RepositoryError { if (constructor == null) { throw new NullPointerException ("constructor"); } return getCachedRepository (constructor.getDeclaringClass()).getParameterAttributes (constructor, parameter); } /** * Gets all attributes for the return value of a method. * * @param method the method. May not be null. * * @since 2.1 */ public static Collection getReturnAttributes (Method method) throws RepositoryError { if (method == null) { throw new NullPointerException ("method"); } return getCachedRepository (method.getDeclaringClass()).getReturnAttributes (method); } /** * Gets all attributes for a field. * * @param field the field. May not be null. * * @since 2.1 */ public static Collection getAttributes (Field field) throws RepositoryError { if (field == null) { throw new NullPointerException ("field"); } return getCachedRepository (field.getDeclaringClass()).getAttributes (field); } /** * Gets all attributes for a constructor. * * @param constructor the constructor. May not be null. * * @since 2.1 */ public static Collection getAttributes (Constructor constructor) throws RepositoryError { if (constructor == null) { throw new NullPointerException ("constructor"); } return getCachedRepository (constructor.getDeclaringClass()).getAttributes (constructor); } /** * Selects from a collection of attributes only those with a given class. * * @since 2.1 */ private static Collection getAttributes (Collection attrs, Class attributeClass) { HashSet result = new HashSet (); Iterator iter = attrs.iterator (); while (iter.hasNext ()) { Object attr = iter.next (); if (attr.getClass () == attributeClass) { result.add (attr); } } return Collections.unmodifiableCollection (result); } /** * Get all attributes of a given type from a class. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param clazz the class. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * * @since 2.1 */ public static Collection getAttributes (Class clazz, Class attributeClass) throws RepositoryError { return getAttributes (getAttributes (clazz), attributeClass); } /** * Get all attributes of a given type from a field. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param field the field. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * * @since 2.1 */ public static Collection getAttributes (Field field, Class attributeClass) throws RepositoryError { return getAttributes (getAttributes (field), attributeClass); } /** * Get all attributes of a given type from a constructor. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param constructor the constructor. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * * @since 2.1 */ public static Collection getAttributes (Constructor constructor, Class attributeClass) throws RepositoryError { return getAttributes (getAttributes (constructor), attributeClass); } /** * Get all attributes of a given type from a method. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param method the method. May not be null. * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * * @since 2.1 */ public static Collection getAttributes (Method method, Class attributeClass) throws RepositoryError { return getAttributes (getAttributes (method), attributeClass); } /** * Get all attributes of a given type from a method's parameter. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param method the method. May not be null. * @param parameter index of the parameter in the method's parameter list * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the method accepts. * * @since 2.1 */ public static Collection getParameterAttributes (Method method, int parameter, Class attributeClass) throws RepositoryError { return getAttributes (getParameterAttributes (method, parameter), attributeClass); } /** * Get all attributes of a given type from a method's parameter. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param constructor the constructor. May not be null. * @param parameter index of the parameter in the constructor's parameter list * @param attributeClass the type of attribute. May be null, but this will not match anything. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the constructor accepts. * * @since 2.1 */ public static Collection getParameterAttributes (Constructor constructor, int parameter, Class attributeClass) throws RepositoryError { return getAttributes (getParameterAttributes (constructor, parameter), attributeClass); } /** * Get all attributes of a given type from a method's return value. For all objects o in the returned * collection, o.getClass() == attributeClass. * * @param method the method * @param attributeClass the type of attribute wanted. May be null, but this will not match anything. * * @since 2.1 */ public static Collection getReturnAttributes (Method method, Class attributeClass) throws RepositoryError { return getAttributes (getReturnAttributes (method), attributeClass); } /** * Convenience function to test whether a collection of attributes contain * an attribute of a given class. * * @since 2.1 */ private static boolean hasAttributeType (Collection attrs, Class attributeClass) { Iterator iter = attrs.iterator (); while (iter.hasNext ()) { Object attr = iter.next (); if (attr.getClass () == attributeClass) { return true; } } return false; } /** * Tests if a class has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param clazz the class. May not be null. * @param attributeClass the type of attribute. May be null, but this will not match anything. * * @since 2.1 */ public static boolean hasAttributeType (Class clazz, Class attributeClass) throws RepositoryError { return hasAttributeType (getAttributes (clazz), attributeClass); } /** * Tests if a field has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param field the field. May not be null. * @param attributeClass the type of attribute. May be null, but this will not match anything. * * @since 2.1 */ public static boolean hasAttributeType (Field field, Class attributeClass) throws RepositoryError { return hasAttributeType (getAttributes (field), attributeClass); } /** * Tests if a constructor has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param constructor the constructor. May not be null. * @param attributeClass the type of attribute. May be null, but this will not match anything. * * @since 2.1 */ public static boolean hasAttributeType (Constructor constructor, Class attributeClass) throws RepositoryError { return hasAttributeType (getAttributes (constructor), attributeClass); } /** * Tests if a method has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param method the method. May not be null. * @param attributeClass the type of attribute. May be null, but this will not match anything. * * @since 2.1 */ public static boolean hasAttributeType (Method method, Class attributeClass) throws RepositoryError { return hasAttributeType (getAttributes (method), attributeClass); } /** * Tests if a method's parameter has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param method the method. May not be null. * @param parameter the index of the parameter in the method's parameter list. * @param attributeClass the type of attribute. May be null, but this will not match anything. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the method accepts. * * @since 2.1 */ public static boolean hasParameterAttributeType (Method method, int parameter, Class attributeClass) throws RepositoryError { return hasAttributeType (getParameterAttributes (method, parameter), attributeClass); } /** * Tests if a constructor's parameter has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param constructor the constructor. May not be null. * @param parameter the index of the parameter in the constructor's parameter list. * @param attributeClass the type of attribute. May be null, but this will not match anything. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the constructor accepts. * * @since 2.1 */ public static boolean hasParameterAttributeType (Constructor constructor, int parameter, Class attributeClass) throws RepositoryError { return hasAttributeType (getParameterAttributes (constructor, parameter), attributeClass); } /** * Tests if a method's return value has an attribute of a given type. That is, is there any attribute * attr such that attr.getClass() == attributeClass? * * @param method the method. May not be null. * @param attributeClass the type of attribute. May be null, but this will not match anything. * * @since 2.1 */ public static boolean hasReturnAttributeType (Method method, Class attributeClass) throws RepositoryError { return hasAttributeType (getReturnAttributes (method), attributeClass); } /** * Convenience function to test whether a collection of attributes contain * an attribute. * * @since 2.1 */ private static boolean hasAttribute (Collection attrs, Object attribute) throws RepositoryError { return attrs.contains (attribute); } /** * Tests if a class has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param clazz the class. May not be null. * @param attribute the attribute to compare to. * * @since 2.1 */ public static boolean hasAttribute (Class clazz, Object attribute) throws RepositoryError { return hasAttribute (getAttributes (clazz), attribute); } /** * Tests if a field has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param field the field. May not be null. * @param attribute the attribute to compare to. * * @since 2.1 */ public static boolean hasAttribute (Field field, Object attribute) throws RepositoryError { return hasAttribute (getAttributes (field), attribute); } /** * Tests if a constructor has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param constructor the constructor. May not be null. * @param attribute the attribute to compare to. * * @since 2.1 */ public static boolean hasAttribute (Constructor constructor, Object attribute) throws RepositoryError { return hasAttribute (getAttributes (constructor), attribute); } /** * Tests if a method has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param method the method. May not be null. * @param attribute the attribute to compare to. * * @since 2.1 */ public static boolean hasAttribute (Method method, Object attribute) throws RepositoryError { return hasAttribute (getAttributes (method), attribute); } /** * Tests if a method's parameter has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param method the method. May not be null. * @param parameter the index of the parameter in the method's parameter list. * @param attribute the attribute to compare to. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the method accepts. * * @since 2.1 */ public static boolean hasParameterAttribute (Method method, int parameter, Object attribute) throws RepositoryError { return hasAttribute (getParameterAttributes (method, parameter), attribute); } /** * Tests if a constructor's parameter has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param constructor the constructor. May not be null. * @param parameter the index of the parameter in the constructor's parameter list. * @param attribute the attribute to compare to. * @throws ParameterIndexOutOfBoundsException if the parameter index is < 0 or greater than the number * of parameters the constructor accepts. * * @since 2.1 */ public static boolean hasParameterAttribute (Constructor constructor, int parameter, Object attribute) throws RepositoryError { return hasAttribute (getParameterAttributes (constructor, parameter), attribute); } /** * Tests if a method's return value has an attribute. That is, is there any attribute * attr such that attr.equals(attribute)? * * @param method the method. May not be null. * @param attribute the attribute to compare to. * * @since 2.1 */ public static boolean hasReturnAttribute (Method method, Object attribute) throws RepositoryError { return hasAttribute (getReturnAttributes (method), attribute); } /** * Set attributes for a given class. The class must not have attributes set for it already * (i.e. you can't redefine the attributes of a class at runtime). This because it * really messes up the concept of inheritable attributes, and because the attribute set * associated with a class is immutable, like the set of methods and fields. * * @param repo The repository. The repository will be sealed before any attributes are * set. This to guarantee that the repository remains constant * during setting. * @throws IllegalStateException if the class whose attributes are defined already have * attributes defined for it (even if it has no attributes). * @since 2.1 */ public static synchronized void setAttributes (RuntimeAttributeRepository repo) throws IllegalStateException { if (repo == null) { throw new NullPointerException ("repo"); } repo.seal (); Class clazz = repo.getDefinedClass (); if (classRepositories.get (clazz) != null) { throw new IllegalStateException (clazz.getName ()); } Util.validateRepository (clazz, repo); DefaultCachedRepository cached = new DefaultCachedRepository (clazz, repo); classRepositories.put (clazz, cached); } }commons-attributes-2.2/api/src/java/org/apache/commons/attributes/Indexed.java100644 0 0 2405 10464315317 24725 0ustar 0 0 /* * Copyright 2003-2004 The Apache Software Foundation * * Licensed 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.commons.attributes; /** * This attribute is used to mark attributes as being indexed. * Elements with indexed attributes can be found via an {@link AttributeIndex}, * but incur a slight processing and memory penalty. You must also * run the attribute-indexer tool on the Jar-file containing the classes * you wish to find via the index. * *

Note regarding {@link Inheritable} attributes: Indexed attributes * that are inherited will not be found via an {@link AttributeIndex}. You will * only find the class/method/field where the attribute is actually declared via the index. * * @since 2.1 */ public class Indexed { }commons-attributes-2.2/api/src/java/overview.html100644 0 0 3456 10464315317 17374 0ustar 0 0

The Jakarta Commons Attributes projects enables developers to use C#-like attributes in their programs.

Please see the project website at http://jakarta.apache.org/commons/attributes/ for a tutorial and instructions for use.

IMPORTANT

This documentation reflects the current CVS, which is not necessarily equal to the binary downloads available at the project website.

commons-attributes-2.2/api/manifest.mf100644 0 0 1471 10464315316 15254 0ustar 0 0 Manifest-Version: 1.0 Ant-Version: Apache Ant 1.5.3 Created-By: Apache Maven Built-By: hen Package: org.apache.commons.attributes Build-Jdk: 1.4.2_05 Extension-Name: commons-attributes-api Specification-Title: Client API for Jakarta Commons Attributes. Specification-Vendor: The Apache Software Foundation Implementation-Title: org.apache.commons.attributes Implementation-Vendor: The Apache Software Foundation Implementation-Version: 2.2 Extension-List: ant qdox ant-Extension-Name: ant ant-Implementation-Version: 1.5 ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5. jar qdox-Extension-Name: qdox qdox-Implementation-Version: 1.5 qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1 .5.jar Implementation-Vendor-Id: org.apache X-Compile-Source-JDK: 1.4 X-Compile-Target-JDK: 1.4 commons-attributes-2.2/api/project.xml100644 0 0 3114 10464315317 15307 0ustar 0 0 ${basedir}/../project.xml commons-attributes commons-attributes-api Jakarta Commons Attributes API org.apache.commons.attributes Client API for Jakarta Commons Attributes. A precompiler for java that enables the use of attributes as seen in C#. ${basedir}/target/temp ant ant 1.5 qdox qdox 1.5 commons-attributes-2.2/plugin/plugin.properties100644 0 0 1563 10464315316 17265 0ustar 0 0 # # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. # # ------------------------------------------------------------------ # P L U G I N P R O P E R T I E S # ------------------------------------------------------------------- # Commons-Attributes plugin. # ------------------------------------------------------------------- commons-attributes-2.2/plugin/plugin.jelly100644 0 0 7574 10464315316 16220 0ustar 0 0 commons-attributes-2.2/plugin/project.xml100644 0 0 5314 10464315317 16040 0ustar 0 0 ${basedir}/../project.xml 3 commons-attributes-plugin Jakarta Commons Attributes Maven Plugin Commons Attributes Plugin for Maven Commons Attributes Plugin for Maven org.apache.commons.attributes commons-attributes commons-attributes-api 2.2 commons-attributes commons-attributes-compiler 2.2 ant ant 1.5 qdox qdox 1.5 ${basedir}/src/java ${basedir}/src/test **/*Test.java ${basedir}/src/plugin-resources plugin-resources ${basedir} plugin.jelly plugin.properties project.properties project.xml commons-attributes-2.2/plugin/manifest.mf100644 0 0 2435 10464315317 16003 0ustar 0 0 Manifest-Version: 1.0 Ant-Version: Apache Ant 1.5.3 Created-By: Apache Maven Built-By: leo Package: org.apache.commons.attributes Build-Jdk: 1.4.2_02 Extension-Name: commons-attributes-plugin Specification-Title: Commons Attributes Plugin for Maven Specification-Vendor: The Apache Software Foundation Implementation-Title: org.apache.commons.attributes Implementation-Vendor: The Apache Software Foundation Implementation-Version: 2.2 Extension-List: commons-attributes-api commons-attributes-compiler ant qdox commons-attributes-api-Extension-Name: commons-attributes-api commons-attributes-api-Implementation-Version: 2.2 commons-attributes-api-Implementation-URL: http://www.ibiblio.org/maven/commons-attributes/jars/commons-attributes-api-2.2.jar commons-attributes-compiler-Extension-Name: commons-attributes-compiler commons-attributes-compiler-Implementation-Version: 2.2 commons-attributes-compiler-Implementation-URL: http://www.ibiblio.org/maven/commons-attributes/jars/commons-attributes-compiler-2.2.jar ant-Extension-Name: ant ant-Implementation-Version: 1.5 ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar qdox-Extension-Name: qdox qdox-Implementation-Version: 1.5 qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1.5.jar commons-attributes-2.2/build.xml100644 0 0 15600 10464315316 14211 0ustar 0 0 commons-attributes-2.2/README.html100644 0 0 3031 10464315317 14167 0ustar 0 0

Commons-Attributes 2.2

This is the 2.2 version of commons-attributes. It is available in both binary and source distributions.

Note: The tar files in the distribution use GNU tar extensions and must be untarred with a GNU compatible version of tar. The version of tar on Solaris and Mac OS X will not work with these files

Changes

The changes in this release are detailed in the release notes.

Thank you for using Commons-Attributes.

From the Apache Jakarta Project
http://jakarta.apache.org/

Signatures

Many of the files have been digitally signed using GnuPG. If so, there will be an accompanying file.asc signature file in the same directory as the file (binaries/ or source/). The signing keys can be found in the distribution directory at <http://www.apache.org/dist/jakarta/commons/attributes/KEYS>.

Always download the KEYS file directly from the Apache site, never from a mirror site.

Always test available signatures, e.g.,
$ pgpk -a KEYS
$ pgpv commons-attributes-2.2.tar.gz.asc
or,
$ pgp -ka KEYS
$ pgp commons-attributes-2.2.tar.gz.asc
or,
$ gpg --import KEYS
$ gpg --verify commons-attributes-2.2.tar.gz.asc

commons-attributes-2.2/maven.xml100644 0 0 26300 10464315317 14220 0ustar 0 0 commons-attributes-2.2/project.properties100644 0 0 6436 10464315317 16144 0ustar 0 0 # Copyright 2003-2004 The Apache Software Foundation # # Licensed 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. ###################################################################### # Properties that override Maven build defaults # $Id: project.properties 420505 2006-07-10 12:07:58Z dennisl $ ###################################################################### maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory ###################################################################### # Specify the JVM version. ###################################################################### maven.compile.source=1.4 maven.compile.target=1.4 ###################################################################### # Jar Manifest Additional Attributes ###################################################################### maven.jar.manifest.attributes.list=Implementation-Vendor-Id,X-Compile-Source-JDK,X-Compile-Target-JDK maven.jar.manifest.attribute.Implementation-Vendor-Id=org.apache maven.jar.manifest.attribute.X-Compile-Source-JDK=${maven.compile.source} maven.jar.manifest.attribute.X-Compile-Target-JDK=${maven.compile.target} ###################################################################### # Apache Central Repository ###################################################################### maven.repo.central=www.apache.org maven.repo.central.directory=/www/www.apache.org/dist/java-repository maven.remote.group=apcvs ###################################################################### # JUnit Testing ###################################################################### maven.test.failure = false maven.junit.fork=true #If you wish to skip tests when doing builds, uncomment #maven.test.skip = true ###################################################################### # commons site L&F ###################################################################### maven.xdoc.date=left maven.xdoc.poweredby.image=maven-feather.png maven.xdoc.version=${pom.currentVersion} maven.xdoc.developmentProcessUrl=http://jakarta.apache.org/commons/charter.html maven.xdoc.includeProjectDocumentation=yes # once we create a theme url it should go here. #maven.xdoc.theme.url=???? ###################################################################### # Checkstyle ###################################################################### # maven.checkstyle.properties=${basedir}/checkstyle.xml maven.linkcheck.enable=false ###################################################################### # JavaDoc # # javadoc urls can be added here, multiple urls are appended using a comma # # maven.javadoc.links = http://foo/bar/api,\ # http://flim/flam/api/ ###################################################################### maven.javadoc.links = http://java.sun.com/j2se/1.4.2/docs/api/ commons-attributes-2.2/project.xml100644 0 0 16437 10464315317 14572 0ustar 0 0 3 Attributes commons-attributes commons-attributes /images/attributes-logo-white.png The Apache Software Foundation http://jakarta.apache.org/ http://jakarta.apache.org/images/original-jakarta-logo.gif 2.2 2003 Commons Attributes A package for handling runtime information about types (including Java classes) http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/ Leo Sutic leosutic leosutic@apache.org - All of them. The Apache Software License, Version 2.0 /LICENSE.txt repo jakarta http://issues.apache.org/jira/browse/${pom.artifactId.substring(8).toUpperCase()} people.apache.org /www/jakarta.apache.org/commons/${pom.artifactId.substring(8)}/ /www/jakarta.apache.org/builds/jakarta-commons/${pom.artifactId.substring(8)}/ scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk/ Commons Dev List commons-dev-subscribe@jakarta.apache.org commons-dev-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/eyebrowse/SummarizeList?listName=commons-dev@jakarta.apache.org Commons User List commons-user-subscribe@jakarta.apache.org commons-user-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/eyebrowse/SummarizeList?listName=commons-user@jakarta.apache.org maven maven-xdoc-plugin 1.9.2 http://maven.apache.org/maven-1.x/reference/plugins/xdoc/ plugin <strong>Site Only</strong> - v1.9.2 (minimum) true commons-dev@jakarta.apache.org ${basedir}/src/java ${basedir}/src/test **/*TestCase* **/Abstract* ${basedir}/src/test **/*.dtd **/*.properties **/*.xinfo **/*.xtype **/*.xprofile **/*.xconfig **/*.xml **/*.xservice **/*.mf **/*.jar ${maven.conf.dir} **/*.properties ${basedir}/src/test/conf **/* ${basedir}/src/java **/*.dtd **/*.properties **/*.xinfo **/*.xtype **/*.xprofile **/*.xconfig **/*.xml **/*.xservice ${basedir}/../ LICENSE.txt NOTICE.txt ${maven.conf.dir} BLOCK-INF block.xml Runtime API org.apache.commons.attributes Compiler and Tools API org.apache.commons.attributes.validation commons-attributes-2.2/LICENSE.txt100644 0 0 26136 10464315317 14222 0ustar 0 0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. er modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally su