You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2004/02/13 20:22:31 UTC
cvs commit: xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/spi JClassBuilder.java JSourceParams.java
pcal 2004/02/13 11:22:31
Modified: v2/src/jam/org/apache/xmlbeans/impl/jam JAnnotation.java
JAnnotationLoader.java JAnnotationMember.java
JService.java
v2/src/jam/org/apache/xmlbeans/impl/jam/editable/impl
LazyEClass.java
v2/src/jam/org/apache/xmlbeans/impl/jam/internal
BaseJAnnotation.java JServiceParamsImpl.java
v2/src/jam/org/apache/xmlbeans/impl/jam/provider
BaseJProvider.java CompositeJClassBuilder.java
DefaultJProvider.java
Added: v2/src/jam/org/apache/xmlbeans/impl/jam/provider
CompositeJInitializer.java JInitializer.java
JInitializerParams.java
Removed: v2/src/jam/org/apache/xmlbeans/impl/jam/provider
EClassBuilder.java JClassBuilderParams.java
v2/src/jam/org/apache/xmlbeans/impl/jam/spi
JClassBuilder.java JSourceParams.java
Log:
jam: more 175 work, add JInitializer
Revision Changes Path
1.6 +59 -9 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotation.java
Index: JAnnotation.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotation.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JAnnotation.java 12 Feb 2004 20:06:09 -0000 1.5
+++ JAnnotation.java 13 Feb 2004 19:22:31 -0000 1.6
@@ -46,6 +46,41 @@
public String getName();
/**
+ * <p>Returns the JAnnotationMember which represents the member of this
+ * annotation if this annotation qualifies as a 'single member
+ * annotation.'</p>
+ *
+ * <p>This method should not be used lightly, as it is here primarily to
+ * provide support simple javadoc tags of the form '@mytag value'. If you
+ * are using tags of this form, you probably need to do some thinking
+ * about how you want to map your tag system into 175 annotation types.
+ * getSingleMember() provides one avenue for such a mapping by equating
+ * such simple javadoc tags as JSR175 single member annotations.</p>
+ *
+ * <p>The qualifications for being a 'single member annotation' are as
+ * follows:</p>
+ * <ul>
+ * <li>For JSR175 tags, as described in the spec, the annotation must be
+ * of a type which either has only one member, or has multiple members
+ * but exactly one member which has no default value (which is
+ * considered the single member).</li>
+ * <li>All javadoc tags implicitly qualify as single member tags,
+ * although not all of them should be treated as such. For simple
+ * javadoc tags (@mytag value), this method provides thoe only
+ * means of accessing the tag value. However, if the tag contains
+ * complex content (typically expressed as name=value pairs), this
+ * method returns a member which contains the entire raw text of
+ * the tag, whitespace and '=' signs included. Typically, this is not
+ * useful - you should call getMembers() or getMember("name") to get
+ * at the structured data.</li>
+ * </ul>
+ *
+ * <p>If this annotation does not qualify as a single member annotation,
+ * as described above, this method will return null.</p.
+ */
+ public JAnnotationMember getSingleMember();
+
+ /**
* Returns an array containing this annotation's members. Returns an
* empty array if the annotation has no members.
*/
@@ -61,46 +96,61 @@
public JAnnotationMember getMember(String named);
/**
- * Returns a representation of this annotation's type declaration.
+ * Returns a representation of this annotation's type declaration. This
+ * typically returns null if the Annotation is does not represent a
+ * JSR175 annotation.
*/
public JAnnotationDeclaration getDeclaration();
+ /**
+ * <p>If this JAnnotation represents a JSR175 annotation, returns the
+ * underlying java.lang.Annotation instance. Returns null otherwise.</p>
+ */
+ public Object getAnnotationObject();
+
// ========================================================================
- // These methods will all be deprecated soon
+ // Deprecated - please get values from members instead
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public String getStringValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public int getIntValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public boolean getBooleanValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public long getLongValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public short getShortValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public double getDoubleValue();
/**
- * @deprecated
+ * @deprecated Please refer to the javadocs on getSingleMember() for
+ * more information on the preferred alternative.
*/
public byte getByteValue();
}
1.3 +1 -0 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotationLoader.java
Index: JAnnotationLoader.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotationLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JAnnotationLoader.java 12 Feb 2004 20:06:09 -0000 1.2
+++ JAnnotationLoader.java 13 Feb 2004 19:22:31 -0000 1.3
@@ -24,6 +24,7 @@
* programmatically add markup to a JAM.</p>
*
* @author Patrick Calaham <pc...@bea.com>
+ * @deprecated This functionality will soon be supplanted by JInitializer.
*/
public interface JAnnotationLoader {
1.6 +189 -41 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotationMember.java
Index: JAnnotationMember.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JAnnotationMember.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JAnnotationMember.java 12 Feb 2004 20:06:09 -0000 1.5
+++ JAnnotationMember.java 13 Feb 2004 19:22:31 -0000 1.6
@@ -18,26 +18,18 @@
/**
+ * <p>Represents a member value of a JAnnotation.</p>
*
* @author Patrick Calahan <pc...@bea.com>
*/
public interface JAnnotationMember {
/**
- * Returns the name of this annotation member.
+ * <p>Returns the value of this annotation as an Object. If the value
+ * is primitive, an instance of one of the java.lang wrappers (e.g. Integer)
+ * will be returned.</p>
*
- * REVIEW this is a little weird - it's going to be the same as
- * getDeclaration().getSimpleName(); it really is type information,
- * which I thought we didn't want to expose here. However,
- * I think name is still needed here simply because we may not always
- * have a declaration (i.e. in the javadoc case), but we will still
- * have a name.
- */
- public String getName();
-
- /**
- * Returns the value of this annotation as an Object. If the value
- * is primitive, one of the
+ * <p>Note that for javadoc tags, this method always returns a String.</p>
*/
public Object getValue();
@@ -57,64 +49,220 @@
public boolean isDefaultValueUsed();
/**
- * Returns the a representation of the declaration of this member in its
- * annotation type declaration.
- */
- public JAnnotationMemberDeclaration getDeclaration();
+ * <p>Returns the a representation of the declaration of this member in its
+ * annotation type declaration. This will typically return null if
+ * the AnnotationMember is not not part of a JSR175 annotation.</p>
+ */
+ public JAnnotationMemberDeclaration getMemberDeclaration();
/**
- * Returns the String value of the annotation. Returns an empty string
- * by default.
+ * <p>If this member is complex (i.e. an instance of another annotation
+ * type), this method returns a representation of the annotation instance.
+ * Returns null in all other cases. This method always returns null if the
+ * annotation is a javdoc tag, as such tags only support one level of
+ * nesting.</p>
*/
public JAnnotation getValueAsAnnotation();
/**
- * Returns the value of this member as a JClass. Returns null if the
+ * <p>Returns the value of this member as a JClass. Returns null if the
* value cannot be understood as a class name or if the type of the member
- * is known to be something other than java.lang.Class.
+ * is known to be something other than java.lang.Class.</p>
*/
public JClass getValueAsClass();
/**
- * Returns the String value of the annotation. Returns an empty string
- * by default.
+ * <p>Returns the String value of the annotation. If the value is
+ * known to be a simple, non-array type other than String, it will be
+ * converted in a resonable manner (with an appropriate toString() or
+ * String.valueOf() method). If the value is known to be complex or is an
+ * array, this method will return null.</p>
+ *
+ * <p>If no type information is available for the annotation member (i.e.
+ * it's a javadoc tag), then the raw textual value of the member is
+ * returned.</p>
*/
public String getValueAsString();
/**
- * Returns the value as an int. Returns 0 by default if the value
- * cannot be understood as an int.
+ * <p>Returns the member's value as an int. If the value is not known to be
+ * an int, (because it's a javadoc tag or because it's a 175 annotation
+ * member of a type other than int) getValueAsString() is called. If the result is
+ * null, NumberFormatException is thrown. Otherwise, the String is
+ * converted to an int with Integer.valueOf(), which again may throw
+ * NumberFormatException.</p>
+ */
+ public int getValueAsInt() throws NumberFormatException;
+
+ /**
+ * <p>Returns the member's value as a boolean. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt(), except that IllegalArgumentException is
+ * thrown instead of NumberFormatException.</p>
+ */
+ public boolean getValueAsBoolean() throws IllegalArgumentException;
+
+ /**
+ * <p>Returns the member's value as a long. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt().</p>
+ */
+ public long getValueAsLong() throws NumberFormatException;
+
+ /**
+ * <p>Returns the member's value as a short. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt().</p>
+ */
+ public short getValueAsShort() throws NumberFormatException;
+
+ /**
+ * <p>Returns the member's value as a double. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt().</p>
+ */
+ public double getValueAsDouble() throws NumberFormatException;
+
+ /**
+ * <p>Returns the member's value as a float. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt().</p>
*/
- public int getValueAsInt();
+ public float getValueAsFloat() throws NumberFormatException;
/**
- * Returns the value as a boolean. Returns false by default if the
- * annotation value cannot be understood as a boolean.
+ * <p>Returns the member's value as a byte. If necessary, type
+ * conversion is performed in a similar manner as described for
+ * getValueAsInt().</p>
*/
- public boolean getValueAsBoolean();
+ public byte getValueAsByte() throws NumberFormatException;
/**
- * Returns the value as a long. Returns 0 by default if the
- * annotation value cannot be understood as a long.
+ * <p>Returns the member's value as a char. If necessary, type
+ * conversion is performed by calling getStringValue(). If the result
+ * is null or is a String that is not exactly of length 1,
+ * IllegalArgumentException is thrown.</p>
*/
- public long getValueAsLong();
+ public char getValueAsChar() throws IllegalArgumentException;
/**
- * Returns the value as a short. Returns 0 by default if the
- * annotation value cannot be understood as a short.
+ * <p>If this member is known to be of an array type, returns the value
+ * as an array of Objects. If the array component type is primitive,
+ * the array objects will be instances of an appropriate java.lang
+ * wrapper (e.g., Integer). Returns null if the member type is
+ * not an array.</p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
*/
- public short getValueAsShort();
+ public Object[] getValueAsArray();
/**
- * Returns the value as a double. Returns 0 by default if the
- * annotation value cannot be understood as a double.
+ * <p>If this member is known to be an array of classes, returns an
+ * array of JClass representations of those classes. If the memeber
+ * is known to be an array of a simple non-array type, this method
+ * will call getValueAsStringArray() and attempt to return a JClass
+ * by treating each string in the returned array as a qualified classname.
+ * Returns null otherwise.
+ * </p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public JClass[] getValueAsClassArray();
+
+ /**
+ * <p>If this member is known to be an array of annotations (i.e.
+ * complex, nested types), this method returns an array containing
+ * each complex value as a JAnnotation. Returns null in all other cases.
+ * </p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public JClass[] getValueAsAnnotationArray();
+
+ /**
+ * <p>Returns this member's value as an array of Strings. If this member is
+ * not of an array type, or is an array of arrays or complex annotations,
+ * this method returns null. If it is an array of a simple, non-array type
+ * other than String, conversion on each component will be attempted as
+ * described under getStringValue().</p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
*/
- public double getValueAsDouble();
+ public String[] getValueAsStringArray();
/**
- * Returns the value as a byte. Returns 0 by default if the
- * annotation value cannot be understood as a byte.
+ * <p>Returns this member's value as an array of ints. If this member is
+ * not of an array type, or is an array of arrays or complex annotations,
+ * this method returns null. If it is an array of a simple, non-array type
+ * other than int, conversion on each component will be attempted as
+ * described under getIntValue().</p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public int[] getValueAsIntArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of booleans. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray(), except that IllegalArgumentException may be
+ * thrown instead of NumberFormatException.</p>
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public boolean[] getValueAsBooleanArray() throws IllegalArgumentException;
+
+ /**
+ * <p>Returns this member's value as an array of shorts. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray().
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public short[] getValueAsShortArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of longs. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray().
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public long[] getValueAsLongArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of doubles. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray().
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public double[] getValueAsDoubleArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of floats. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray().
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public float[] getValueAsFloatArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of bytes. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray().
+ *
+ * <p>This method always returns null for javadoc tags.</p>
+ */
+ public byte[] getValueAsByteArray() throws NumberFormatException;
+
+ /**
+ * <p>Returns this member's value as an array of bytes. If necessary,
+ * type conversion is performed in a similar manner as described for
+ * getValueAsIntArray() and getValueAsChar()..
+ *
+ * <p>This method always returns null for javadoc tags.</p>
*/
- public byte getValueAsByte();
+ public char[] getValueAsCharArray() throws IllegalArgumentException;
}
1.4 +4 -0 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JService.java
Index: JService.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/JService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JService.java 12 Feb 2004 20:06:09 -0000 1.3
+++ JService.java 13 Feb 2004 19:22:31 -0000 1.4
@@ -47,4 +47,8 @@
* getClassNames().
*/
public JClassIterator getClasses();
+
+ //public void invalidate(JClass clazz);
+
+ //public void invalidateAll();
}
1.3 +11 -11 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/editable/impl/LazyEClass.java
Index: LazyEClass.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/editable/impl/LazyEClass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LazyEClass.java 12 Feb 2004 20:06:14 -0000 1.2
+++ LazyEClass.java 13 Feb 2004 19:22:31 -0000 1.3
@@ -15,14 +15,14 @@
package org.apache.xmlbeans.impl.jam.editable.impl;
-import org.apache.xmlbeans.impl.jam.provider.EClassBuilder;
+import org.apache.xmlbeans.impl.jam.provider.JInitializer;
import org.apache.xmlbeans.impl.jam.*;
/**
* Implementation of JClass which can be instantiated for a given class name
* without having to interact with any source or classfile artifacts. Only
* when the user requests something substantive about the java type will
- * this impl request a given EClassBuilder to populate it, which in turn
+ * this impl request a given JInitializer to populate it, which in turn
* might cause a source file to be parsed. This allows the caller to deal
* with JClass objects without having to parse anything for classes which
* they aren't interested in.
@@ -34,9 +34,9 @@
// ========================================================================
// Variables
- private EClassBuilder mBuilder = null;
- private boolean mIsIntialized = false;
- private boolean mIsPopulated = true;
+ private JInitializer mIntitializer = null;
+ private boolean mIsInitialized = false;
+ private boolean mIsUnresolved;
// ========================================================================
// Constructors
@@ -44,9 +44,9 @@
public LazyEClass(String packageName,
String className,
JClassLoader loader,
- EClassBuilder builder) {
+ JInitializer builder) {
super(packageName,className,loader);
- mBuilder = builder;
+ mIntitializer = builder;
}
// ========================================================================
@@ -70,7 +70,7 @@
public boolean isUnresolved() {
checkInitialized();
- return !mIsPopulated;//yuck
+ return mIsUnresolved;
}
public JClass getSuperclass() {
@@ -147,8 +147,8 @@
// Private methods
private void checkInitialized() {
- if (mIsIntialized) return;
- mIsPopulated = mBuilder.populateClass(this);
- mIsIntialized = true;
+ if (mIsInitialized) return;
+ mIsUnresolved = mIntitializer.initialize(this);
+ mIsInitialized = true;
}
}
1.10 +118 -1 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/BaseJAnnotation.java
Index: BaseJAnnotation.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/BaseJAnnotation.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BaseJAnnotation.java 12 Feb 2004 20:06:15 -0000 1.9
+++ BaseJAnnotation.java 13 Feb 2004 19:22:31 -0000 1.10
@@ -25,7 +25,9 @@
*
* @author Patrick Calahan <pc...@bea.com>
*/
-public class BaseJAnnotation extends BaseJElement implements JAnnotation {
+public class BaseJAnnotation extends BaseJElement
+ implements JAnnotation, JAnnotationMember
+ {
// ========================================================================
// Constants
@@ -81,6 +83,14 @@
return mName;
}
+ public Object getValue() {
+ return null;
+ }
+
+ public boolean isDefaultValueUsed() {
+ return false;
+ }
+
public String getSimpleName() {
return mName;
} //FIXME
@@ -104,6 +114,10 @@
return null;
}
+ public Object getAnnotationObject() {
+ return null;
+ }
+
public JSourcePosition getSourcePosition() {
return mSourcePosition;
}
@@ -163,6 +177,109 @@
} catch (NumberFormatException nfe) {
return 0;
}
+ }
+
+ public JAnnotationMember getSingleMember() {
+ return this;
+ }
+
+ // ========================================================================
+ // JAnnotationMember implementation
+
+ public JAnnotationMemberDeclaration getMemberDeclaration() {
+ return null;
+ }
+
+ public JAnnotation getValueAsAnnotation() {
+ return null;
+ }
+
+ public JClass getValueAsClass() {
+ return null;
+ }
+
+ public String getValueAsString() {
+ return getStringValue();
+ }
+
+ public int getValueAsInt() {
+ return getIntValue();
+ }
+
+ public boolean getValueAsBoolean() {
+ return getBooleanValue();
+ }
+
+ public long getValueAsLong() {
+ return getLongValue();
+ }
+
+ public short getValueAsShort() {
+ return getShortValue();
+ }
+
+ public double getValueAsDouble() {
+ return getDoubleValue();
+ }
+
+ public float getValueAsFloat() throws NumberFormatException {
+ return 0;
+ }
+
+ public byte getValueAsByte() {
+ return getByteValue();
+ }
+
+ public char getValueAsChar() throws IllegalArgumentException {
+ return 0;
+ }
+
+ public Object[] getValueAsArray() {
+ return null;
+ }
+
+ public JClass[] getValueAsClassArray() {
+ return null;
+ }
+
+ public JClass[] getValueAsAnnotationArray() {
+ return null;
+ }
+
+ public String[] getValueAsStringArray() {
+ return null;
+ }
+
+ public int[] getValueAsIntArray() throws NumberFormatException {
+ return null;
+ }
+
+ public boolean[] getValueAsBooleanArray() throws IllegalArgumentException {
+ return null;
+ }
+
+ public short[] getValueAsShortArray() throws NumberFormatException {
+ return null;
+ }
+
+ public long[] getValueAsLongArray() throws NumberFormatException {
+ return null;
+ }
+
+ public double[] getValueAsDoubleArray() throws NumberFormatException {
+ return null;
+ }
+
+ public float[] getValueAsFloatArray() throws NumberFormatException {
+ return null;
+ }
+
+ public byte[] getValueAsByteArray() throws NumberFormatException {
+ return null;
+ }
+
+ public char[] getValueAsCharArray() throws IllegalArgumentException {
+ return null;
}
// ========================================================================
1.3 +3 -3 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/JServiceParamsImpl.java
Index: JServiceParamsImpl.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/JServiceParamsImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JServiceParamsImpl.java 12 Feb 2004 20:06:15 -0000 1.2
+++ JServiceParamsImpl.java 13 Feb 2004 19:22:31 -0000 1.3
@@ -18,7 +18,7 @@
import org.apache.xmlbeans.impl.jam.JAnnotationLoader;
import org.apache.xmlbeans.impl.jam.JClassLoader;
import org.apache.xmlbeans.impl.jam.JServiceParams;
-import org.apache.xmlbeans.impl.jam.provider.JClassBuilderParams;
+import org.apache.xmlbeans.impl.jam.provider.JInitializerParams;
import org.apache.xmlbeans.impl.jam.provider.JPath;
import java.util.*;
@@ -30,7 +30,7 @@
*
* @author Patrick Calahan <pc...@bea.com>
*/
-public class JServiceParamsImpl implements JServiceParams, JClassBuilderParams
+public class JServiceParamsImpl implements JServiceParams, JInitializerParams
{
// ========================================================================
// Variables
@@ -191,7 +191,7 @@
}
// ========================================================================
- // JClassBuilderParams implementation
+ // JInitializerParams implementation
public JPath getInputClasspath() {
return createJPath(mClasspath);
1.3 +2 -2 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/BaseJProvider.java
Index: BaseJProvider.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/BaseJProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BaseJProvider.java 12 Feb 2004 20:06:16 -0000 1.2
+++ BaseJProvider.java 13 Feb 2004 19:22:31 -0000 1.3
@@ -24,7 +24,7 @@
import org.apache.xmlbeans.impl.jam.internal.JServiceImpl;
import org.apache.xmlbeans.impl.jam.internal.JServiceParamsImpl;
import org.apache.xmlbeans.impl.jam.internal.reflect.RClassBuilder;
-import org.apache.xmlbeans.impl.jam.provider.JClassBuilderParams;
+import org.apache.xmlbeans.impl.jam.provider.JInitializerParams;
import org.apache.xmlbeans.impl.jam.provider.JClassBuilder;
import java.io.IOException;
@@ -73,7 +73,7 @@
* Subclasses just need to override this to provide use with a
* JClassBuilder; we'll take care of the rest.
*/
- public abstract JClassBuilder createJClassBuilder(JClassBuilderParams jcb)
+ public abstract JClassBuilder createJClassBuilder(JInitializerParams jcb)
throws IOException;
// ========================================================================
1.4 +1 -0 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/CompositeJClassBuilder.java
Index: CompositeJClassBuilder.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/CompositeJClassBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CompositeJClassBuilder.java 12 Feb 2004 20:06:16 -0000 1.3
+++ CompositeJClassBuilder.java 13 Feb 2004 19:22:31 -0000 1.4
@@ -24,6 +24,7 @@
* to build a new JClass, it will try each builder on the list until
* one of them is able to build the class.
*
+ * @deprecated this is being replaced by JInitializer.
* @author Patrick Calahan <pc...@bea.com>
*/
public class CompositeJClassBuilder implements JClassBuilder {
1.3 +3 -3 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/DefaultJProvider.java
Index: DefaultJProvider.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/DefaultJProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultJProvider.java 12 Feb 2004 20:06:16 -0000 1.2
+++ DefaultJProvider.java 13 Feb 2004 19:22:31 -0000 1.3
@@ -47,7 +47,7 @@
// ========================================================================
// BaseJProvider implementation
- public JClassBuilder createJClassBuilder(JClassBuilderParams params)
+ public JClassBuilder createJClassBuilder(JInitializerParams params)
throws IOException
{
List builderList = new ArrayList();
@@ -65,7 +65,7 @@
// ========================================================================
// Public methods
- public JClassBuilder createSourceService(JClassBuilderParams jp)
+ public JClassBuilder createSourceService(JInitializerParams jp)
throws IOException
{
//FIXME someday should make the name of the service class to use here
@@ -73,7 +73,7 @@
return JDClassBuilder.create((JServiceParamsImpl)jp);
}
- public JClassBuilder createClassService(JClassBuilderParams jp)
+ public JClassBuilder createClassService(JInitializerParams jp)
throws IOException
{
//FIXME someday should make the name of the service class to use here
1.1 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/CompositeJInitializer.java
Index: CompositeJInitializer.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache
* XMLBeans", nor may "Apache" appear in their name, without prior
* written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2003 BEA Systems
* Inc., <http://www.bea.com/>. For more information on the Apache Software
* Foundation, please see <http://www.apache.org/>.
*/
package org.apache.xmlbeans.impl.jam.provider;
import org.apache.xmlbeans.impl.jam.editable.EClass;
import java.util.Collection;
/**
*
* @author Patrick Calahan <pc...@bea.com>
*/
public class CompositeJInitializer implements JInitializer {
// ========================================================================
// Variables
private JInitializer[] mInitializers;
// ========================================================================
// Constructors
public CompositeJInitializer(Collection inits) {
mInitializers = new JInitializer[inits.size()];
inits.toArray(mInitializers);
}
public CompositeJInitializer(JInitializer[] inits) {
mInitializers = inits;
}
// ========================================================================
// JInitializer implementation
public boolean initialize(EClass clazz) {
return false;
}
}
1.1 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/JInitializer.java
Index: JInitializer.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache
* XMLBeans", nor may "Apache" appear in their name, without prior
* written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2003 BEA Systems
* Inc., <http://www.bea.com/>. For more information on the Apache Software
* Foundation, please see <http://www.apache.org/>.
*/
package org.apache.xmlbeans.impl.jam.provider;
import org.apache.xmlbeans.impl.jam.editable.EClass;
/**
* <p>Interface for objects which are capable of populating type information
* for a given java class representation. A typical implementation might
* would check the name of the class given in the initialize() method,
* load a java source or class file, and then flesh out the EClass as
* appropriate.</p>
*
* <p>Secondary JInitializers can also be used to take the result of an
* initialization described above and manipulate it in some way. For example,
* a secondary JInitializer could be used to augment or alter the metadata
* associated ith parts of a given java type. CompositeJInitializer can
* be used to chain together JInitializers for such purposes.</p>
*
* @author Patrick Calahan <pc...@bea.com>
*/
public interface JInitializer {
/**
* <p>Initialize the given EClass. The class will typically have no
* information associated with it aside from it's qualified name - it is the
* responsibility of the implementation to locate information about the java
* type (e.g. from a java source file on disk) and populate the given EClass
* to represent that type appropriately.</p>
*
* <p>Returns true if java type information for the given clazz could be
* found and was used; returns false otherwise, indicating a ClassNotFound
* condition.</p>
*/
public boolean initialize(EClass clazz);
//public boolean initialize(EPackage pkg)
}
1.1 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/provider/JInitializerParams.java
Index: JInitializerParams.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache
* XMLBeans", nor may "Apache" appear in their name, without prior
* written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2003 BEA Systems
* Inc., <http://www.bea.com/>. For more information on the Apache Software
* Foundation, please see <http://www.apache.org/>.
*/
package org.apache.xmlbeans.impl.jam.provider;
import java.io.File;
import java.io.PrintWriter;
import java.util.Properties;
/**
* Structure containing information given to a BaseJProvider subclass in
* order to instantiate a new JClassBuilder.
*
* @author Patrick Calahan <pc...@bea.com>
*/
public interface JInitializerParams {
// ========================================================================
// Public methods
/**
* @return The classpath to be searched when trying to initialize an EClass
* for a java class which was not in the inputSources or inputClasses,
* or null.
*/
public JPath getInputClasspath();
/**
* @return The sourcepath to be searched when trying to initialize an EClass
* for a java class which was not in the inputSources or inputClasses, or
* null.
*/
public JPath getInputSourcepath();
/**
* @return a PrintWriter to which logging and debugging information should
* be written by the JInitializer, or null, indicating that such output
* should be suppressed.
*/
public PrintWriter getOut();
/**
* @return The classpath to be used in loading external classes on which
* the service implementation depends, or null. This is not generally
* needed.
*/
public JPath getToolClasspath();
/**
* @return a set of service implementation-specific properties specified
* by the client, or null.
*/
public Properties getProperties();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org