http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanProperty.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanProperty.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanProperty.java new file mode 100755 index 0000000..363947f --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanProperty.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2014. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; +import java.util.*; + +import com.ibm.juno.core.*; +import com.ibm.juno.core.filter.*; +import com.ibm.juno.core.jena.*; +import com.ibm.juno.core.xml.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Used tailor how bean properties get interpreted by the framework. + * <p> + * Can be used to do the following: + * <ul> + * <li>Override the name of a property. + * <li>Identify a getter or setter with a non-standard naming convention. + * <li>Identify a specific subclass for a property with a general class type. + * <li>Identify class types of elements in properties of type <code>Collection</code> or <code>Map</code>. + * <li>Hide properties during serialization. + * <li>Associate filters with bean property values, such as a filter to convert a <code>Calendar</code> field to a string. + * <li>Override the list of properties during serialization on child elements of a property of type <code>Collection</code> or <code>Map</code>. + * <li>Identify a property as the URL for a bean. + * <li>Identify a property as the ID for a bean. + * </ul> + * <p> + * This annotation is applied to public fields and public getter/setter methods of beans. + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target({FIELD,METHOD}) +@Retention(RUNTIME) +@Inherited +public @interface BeanProperty { + + /** + * Identifies the name of the property. + * <p> + * Normally, this is automatically inferred from the field name or getter method name + * of the property. However, this property can be used to assign a different + * property name from the automatically inferred value. + * <p> + * If the {@link BeanContextProperties#BEAN_beanFieldVisibility} setting on the bean context excludes this field (e.g. the visibility + * is set to PUBLIC, but the field is PROTECTED), this annotation can be used to force the field to be identified as a property. + */ + String name() default ""; + + /** + * Identifies a specialized class type for the property. + * <p> + * Normally this can be inferred through reflection of the field type or getter return type. + * However, you'll want to specify this value if you're parsing beans where the bean property class + * is an interface or abstract class to identify the bean type to instantiate. Otherwise, you may + * cause an {@link InstantiationException} when trying to set these fields. + * <p> + * This property must denote a concrete bean class with a no-arg constructor. + * + * <dl> + * <dt>Example:</dt> + * <dd> + * <p class='bcode'> + * <jk>public class</jk> MyBean { + * + * <jc>// Identify concrete map type.</jc> + * <ja>@BeanProperty</ja>(type=HashMap.<jk>class</jk>) + * <jk>public</jk> Map <jf>p1</jf>; + * } + * </p> + * </dd> + * </dl> + */ + Class<?> type() default Object.class; + + /** + * For bean properties of maps and collections, this annotation can be used to identify + * the class types of the contents of the bean property object when the generic parameter + * types are interfaces or abstract classes. + * + * <dl> + * <dt>Example:</dt> + * <dd> + * <p class='bcode'> + * <jk>public class</jk> MyBean { + * + * <jc>// Identify concrete map type with String keys and Integer values.</jc> + * <ja>@BeanProperty</ja>(type=HashMap.<jk>class</jk>, params={String.<jk>class</jk>,Integer.<jk>class</jk>}) + * <jk>public</jk> Map <jf>p1</jf>; + * } + * </p> + * </dd> + * </dl> + */ + Class<?>[] params() default {}; + + /** + * Associates an object filter with this bean property that will convert it + * to a different value during serialization and parsing. + * <p> + * This annotation supersedes any filter associated with the bean property type + * class itself. + * <p> + * Typically used for rendering {@link Date Dates} and {@link Calendar Calendars} + * as a particular string format. + * + * <dl> + * <dt>Example:</dt> + * <dd> + * <p class='bcode'> + * <jk>public class</jk> MyClass { + * + * <jc>// During serialization, convert to ISO8601 date-time string.</jc> + * <ja>@BeanProperty</ja>(filter=CalendarFilter.ISO8601DT.<jk>class</jk>) + * <jk>public</jk> Calendar getTime(); + * } + * </p> + * </dd> + * </dl> + */ + Class<? extends PojoFilter<?,?>> filter() default PojoFilter.NULL.class; + + /** + * Used to limit which child properties are rendered by the serializers. + * <p> + * Can be used on any of the following bean property types: + * <ul> + * <li>Beans - Only render the specified properties of the bean. + * <li>Maps - Only render the specified entries in the map. + * <li>Bean/Map arrays - Same, but applied to each element in the array. + * <li>Bean/Map collections - Same, but applied to each element in the collection. + * </ul> + * + * <dl> + * <dt>Example:</dt> + * <dd> + * <p class='bcode'> + * <jk>public class</jk> MyClass { + * + * <jc>// Only render 'f1' when serializing this bean property.</jc> + * <ja>@BeanProperty</ja>(properties={<js>"f1"</js>}) + * <jk>public</jk> MyChildClass x1 = <jk>new</jk> MyChildClass(); + * } + * + * <jk>public class</jk> MyChildClass { + * <jk>public int</jk> f1 = 1; + * <jk>public int</jk> f2 = 2; + * } + * + * <jc>// Renders "{x1:{f1:1}}"</jc> + * String json = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(<jk>new</jk> MyClass()); + * </p> + * </dd> + * </dl> + */ + String[] properties() default {}; + + /** + * Marks a bean property as a resource URI identifier for the bean. + * <p> + * Has the following effects on the following serializers: + * <ul> + * <li>{@link XmlSerializer} - Will be rendered as an XML attribute on the bean element, unless + * marked with a {@link Xml#format} value of {@link XmlFormat#ELEMENT}. + * <li>{@link RdfSerializer} - Will be rendered as the value of the <js>"rdf:about"</js> attribute + * for the bean. + * </ul> + */ + boolean beanUri() default false; +} +
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.class new file mode 100755 index 0000000..a3a120f Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.java new file mode 100755 index 0000000..30f02b5 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/BeanSubType.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2014. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +/** + * Maps a bean subclass with a string identifier. + * <p> + * Used in conjunction with {@link Bean#subTypes()} for defining mappings of bean subclasses with string identifiers. + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target({}) +@Retention(RUNTIME) +@Inherited +public @interface BeanSubType { + + /** + * The bean subclass. + * <p> + * Must be a subclass or subinterface of the parent bean. + */ + Class<?> type(); + + /** + * A string identifier for this subtype. + * <p> + * This identifier is used in conjunction with the {@link Bean#subTypeProperty()} during serialization + * to create a <code>{subType:<js>'id'</js>}</code> property on the serialized object. + */ + String id(); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.class new file mode 100755 index 0000000..b5d8a1b Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.java new file mode 100755 index 0000000..916ed55 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Consumes.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +import com.ibm.juno.core.parser.*; + +/** + * Annotation used on subclasses of {@link Parser} to identify the media types that it consumes. + * + * + * <h6 class='topic'>Description</h6> + * <p> + * Provides a way to define the contents of {@link Parser#getMediaTypes()} through an annotation. + * <p> + * The {@link Parser#getMediaTypes()} default implementation gathers the media types by looking + * for this annotation. + * It should be noted that this annotation is optional and that the {@link Parser#getMediaTypes()} method can + * be overridden by subclasses to return the media types programmatically. + * + * + * <h6 class='topic'>Examples</h6> + * <p> + * Standard example: + * <p class='bcode'> + * <ja>@Consumes</ja>({<js>"application/json"</js>,<js>"text/json"</js>}) + * <jk>public class</jk> JsonParser <jk>extends</jk> ReaderParser {...} + * </p> + * <p> + * The media types can also be <code>media-range</code> values per + * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1'>RFC2616/14.1</a>. + * <p class='bcode'> + * <jc>// Consumes any text</jc> + * <ja>@Consumes</ja>({<js>"text\/*"</js>}) + * <jk>public class</jk> AnythingParser <jk>extends</jk> ReaderParser {...} + * + * <jc>// Consumes anything</jc> + * <ja>@Consumes</ja>({<js>"*\/*"</js>}) + * <jk>public class</jk> AnythingParser <jk>extends</jk> ReaderParser {...} + * </p> + * + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target(TYPE) +@Retention(RUNTIME) +@Inherited +public @interface Consumes { + + /** + * The media types that the parser can handle. + * <p> + * Can contain meta-characters per the <code>media-type</code> specification of + * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1'>RFC2616/14.1</a> + * @return The media types that the parser can handle. + */ + String[] value() default {}; +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.class new file mode 100755 index 0000000..817787c Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.java new file mode 100755 index 0000000..a0147ca --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Filter.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2014. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +import com.ibm.juno.core.filter.*; +import com.ibm.juno.core.serializer.*; + +/** + * Annotation that can be applied to a class to associate a filter with it. + * <p> + * Typically used to associate {@link PojoFilter PojoFilters} with classes using annotations + * instead of programatically through a method such as {@link Serializer#addFilters(Class...)}. + * + * <h6 class='topic'>Example</h6> + * <p> + * In this case, a filter is being applied to a bean that will force it to be serialized as a <code>String</code> + * <p class='bcode'> + * <jc>// Our bean class</jc> + * <ja>@Filter</ja>(BFilter.<jk>class</jk>) + * <jk>public class</jk> B { + * <jk>public</jk> String <jf>f1</jf>; + * } + * + * <jc>// Our filter to force the bean to be serialized as a String</jc> + * <jk>public class</jk> BFilter <jk>extends</jk> PojoFilter<B,String> { + * <jk>public</jk> String filter(B o) <jk>throws</jk> SerializeException { + * <jk>return</jk> o.f1; + * } + * <jk>public</jk> B unfilter(String f, ClassMeta<?> hint) <jk>throws</jk> ParseException { + * B b1 = <jk>new</jk> B(); + * b1.<jf>f1</jf> = f; + * <jk>return</jk> b1; + * } + * } + * + * <jk>public void</jk> testFilter() <jk>throws</jk> Exception { + * WriterSerializer s = JsonSerializer.<jsf>DEFAULT</jsf>; + * B b = <jk>new</jk> B(); + * b.<jf>f1</jf> = <js>"bar"</js>; + * String json = s.serialize(b); + * <jsm>assertEquals</jsm>(<js>"'bar'"</js>, json); + * + * ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>; + * b = p.parse(json, B.<jk>class</jk>); + * <jsm>assertEquals</jsm>(<js>"bar"</js>, t.<jf>f1</jf>); + * } + * </p> + * <p> + * Note that using this annotation is functionally equivalent to adding filters to the serializers and parsers: + * <p class='bcode'> + * WriterSerializer s = <jk>new</jk> JsonSerializer.addFilters(BFilter.<jk>class</jk>); + * ReaderParser p = <jk>new</jk> JsonParser.addFilters(BFilter.<jk>class</jk>); + * </p> + * <p> + * It is technically possible to associate a {@link BeanFilter} with a bean class using this annotation. + * However in practice, it's almost always less code to simply use the {@link Bean @Bean} annotation. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target(TYPE) +@Retention(RUNTIME) +@Inherited +public @interface Filter { + + /** + * The filter class. + */ + Class<? extends com.ibm.juno.core.filter.Filter> value() default com.ibm.juno.core.filter.Filter.NULL.class; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.class new file mode 100755 index 0000000..e25af65 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.java new file mode 100755 index 0000000..df21fc3 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/NameProperty.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +import com.ibm.juno.core.ini.*; + +/** + * Identifies a setter as a method for setting the name of a POJO as it's known by + * its parent object. + * <p> + * For example, the {@link Section} class must know the name it's known by it's parent + * {@link ConfigFileImpl} class, so parsers will call this method with the sectio name + * using the {@link Section#setName(String)} method. + * + * @author James Bognar ([email protected]) + */ +@Target({METHOD}) +@Retention(RUNTIME) +@Inherited +public @interface NameProperty {} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.class new file mode 100755 index 0000000..02e8788 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.java new file mode 100755 index 0000000..68f6d61 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/ParentProperty.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +import com.ibm.juno.core.ini.*; + +/** + * Identifies a setter as a method for adding a parent reference to a child object. + * <p> + * Used by the parsers to add references to parent objects in child objects. + * For example, the {@link Section} class cannot exist outside the scope of a parent + * {@link ConfigFileImpl} class, so parsers will add a reference to the config file + * using the {@link Section#setParent(ConfigFileImpl)} method. + * + * @author James Bognar ([email protected]) + */ +@Target({METHOD}) +@Retention(RUNTIME) +@Inherited +public @interface ParentProperty {} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.class new file mode 100755 index 0000000..0cb6bcf Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.java new file mode 100755 index 0000000..11aa004 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Produces.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +import com.ibm.juno.core.serializer.*; + +/** + * Annotation used on subclasses of {@link Serializer} to identify the media types that it produces. + * + * + * <h6 class='topic'>Description</h6> + * <p> + * Provides a way to define the contents of {@link Serializer#getMediaTypes()} through an annotation. + * <p> + * The {@link Serializer#getMediaTypes()} default implementation gathers the media types by looking + * for this annotation. + * It should be noted that this annotation is optional and that the {@link Serializer#getMediaTypes()} method can + * be overridden by subclasses to return the media types programmatically. + * + * + * <h6 class='topic'>Examples</h6> + * <p> + * Standard example: + * <p class='bcode'> + * <ja>@Produces</ja>({<js>"application/json"</js>,<js>"text/json"</js>}) + * <jk>public class</jk> JsonSerializer <jk>extends</jk> WriterSerializer {...} + * </p> + * <p> + * The media types can also be <code>media-range</code> values per + * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1'>RFC2616/14.1</a>. + * When meta-characters are used, you should specify the {@link #contentType()} value to + * indicate the real media type value that can be set on the <code>Content-Type</code> response header. + * + * <p class='bcode'> + * <jc>// Produces any text</jc> + * <ja>@Produces</ja>(value=<js>"text\/*"</js>, contentType=<js>"text/plain"</js>) + * <jk>public class</jk> AnythingSerializer <jk>extends</jk> WriterSerializer {...} + * + * <jc>// Produces anything</jc> + * <ja>@Produces</ja>(value=<js>"*\/*"</js>, contentType=<js>"text/plain"</js>) + * <jk>public class</jk> AnythingSerializer <jk>extends</jk> WriterSerializer {...} + * </p> + * + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target(TYPE) +@Retention(RUNTIME) +@Inherited +public @interface Produces { + + /** + * The media types that the serializer can handle. + * <p> + * Can contain meta-characters per the <code>media-type</code> specification of + * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1'>RFC2616/14.1</a> + * @return The media types that the parser can handle. + */ + String[] value() default {}; + + /** + * The content type that this serializer produces. + * <p> + * Can be used to override the <code>Content-Type</code> response type if the media types + * are <code>media-ranges</code> with meta-characters, or the <code>Content-Type</code> + * differs from the media type for some reason. + * @return The content type that this serializer produces, or blank if no overriding value exists. + */ + String contentType() default ""; +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.class new file mode 100755 index 0000000..aabecef Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.java new file mode 100755 index 0000000..b8bb148 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/Remoteable.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * � Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; + +/** + * Identifies services whose Java class or methods can be invoked remotely. + */ +@Documented +@Target({TYPE,METHOD}) +@Retention(RUNTIME) +@Inherited +public @interface Remoteable {} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.class new file mode 100755 index 0000000..5dea9ed Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.java new file mode 100755 index 0000000..4f7a888 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/URI.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.annotation; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + +import java.lang.annotation.*; +import java.net.*; + +import com.ibm.juno.core.serializer.*; + +/** + * Used to identify a class or bean property as a URI. + * <p> + * By default, instances of {@link URL} and {@link URI} are considered URIs during serialization, and are + * handled differently depending on the serializer (e.g. <code>HtmlSerializer</code> creates a hyperlink, + * <code>RdfXmlSerializer</code> creates an <code>rdf:resource</code> object, etc...). + * <p> + * This annotation allows you to identify other classes that return URIs via <code>toString()</code> as URI objects. + * <p> + * Relative URIs are automatically prepended with {@link SerializerProperties#SERIALIZER_absolutePathUriBase} and {@link SerializerProperties#SERIALIZER_relativeUriBase} + * during serialization just like relative <code>URIs</code>. + * <p> + * This annotation can be applied to classes, interfaces, or bean property methods for fields. + * + * <h6 class='topic'>Examples</h6> + * <p class='bcode'> + * + * <jc>// Applied to a class whose toString() method returns a URI.</jc> + * <ja>@URI</ja> + * <jk>public class</jk> MyURI { + * <ja>@Override</ja> + * <jk>public</jk> String toString() { + * <jk>return</jk> <js>"http://localhost:9080/foo/bar"</js>; + * } + * } + * + * <jc>// Applied to bean properties</jc> + * <jk>public class</jk> MyBean { + * + * <ja>@URI</ja> + * <jk>public</jk> String <jf>beanUri</jf>; + * + * <ja>@URI</ja> + * <jk>public</jk> String getParentUri() { + * ... + * } + * } + * </p> + * + * @author James Bognar ([email protected]) + */ +@Documented +@Target({TYPE,FIELD,METHOD}) +@Retention(RUNTIME) +@Inherited +public @interface URI {} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/package.html ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/package.html b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/package.html new file mode 100755 index 0000000..e876381 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/annotation/package.html @@ -0,0 +1,34 @@ +<!DOCTYPE HTML> +<!-- + Licensed Materials - Property of IBM + (c) Copyright IBM Corporation 2014. All Rights Reserved. + + Note to U.S. Government Users Restricted Rights: + Use, duplication or disclosure restricted by GSA ADP Schedule + Contract with IBM Corp. + --> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css"> + /* For viewing in Page Designer */ + @IMPORT url("../../../../../../javadoc.css"); + + /* For viewing in REST interface */ + @IMPORT url("../htdocs/javadoc.css"); + body { + margin: 20px; + } + </style> + <script> + /* Replace all @code and @link tags. */ + window.onload = function() { + document.body.innerHTML = document.body.innerHTML.replace(/\{\@code ([^\}]+)\}/g, '<code>$1</code>'); + document.body.innerHTML = document.body.innerHTML.replace(/\{\@link (([^\}]+)\.)?([^\.\}]+)\}/g, '<code>$3</code>'); + } + </script> +</head> +<body> +<p>General bean annotations</p> +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.class new file mode 100755 index 0000000..d9caecd Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.java new file mode 100755 index 0000000..f7c3e30 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/CsvSerializer.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.csv; + +import java.io.*; +import java.util.*; + +import com.ibm.juno.core.*; +import com.ibm.juno.core.annotation.*; +import com.ibm.juno.core.serializer.*; + +/** + * TODO - Work in progress. CSV serializer. + */ +@Produces("text/csv") +@SuppressWarnings({"unchecked","rawtypes"}) +public final class CsvSerializer extends WriterSerializer { + + //-------------------------------------------------------------------------------- + // Overridden methods + //-------------------------------------------------------------------------------- + + @Override /* Serializer */ + protected void doSerialize(Object o, Writer out, SerializerContext ctx) throws IOException, SerializeException { + BeanContext bc = ctx.getBeanContext(); + ClassMeta cm = bc.getClassMetaForObject(o); + Collection l = null; + if (cm.isArray()) { + l = Arrays.asList((Object[])o); + } else + l = (Collection)o; + if (l.size() > 0) { + ClassMeta entryType = bc.getClassMetaForObject(l.iterator().next()); + if (entryType.isBean()) { + BeanMeta<?> bm = entryType.getBeanMeta(); + int i = 0; + for (BeanPropertyMeta pm : bm.getPropertyMetas()) { + if (i++ > 0) + out.append(","); + append(out, pm.getName()); + } + out.append("\n"); + for (Object o2 : l) { + i = 0; + BeanMap bean = bc.forBean(o2); + for (BeanPropertyMeta pm : bm.getPropertyMetas()) { + if (i++ > 0) + out.append(","); + append(out, pm.get(bean)); + } + out.append("\n"); + } + } + + } + } + + private void append(Writer w, Object o) throws IOException { + if (o == null) + w.append("null"); + else { + String s = o.toString(); + boolean mustQuote = false; + for (int i = 0; i < s.length() && ! mustQuote; i++) { + char c = s.charAt(i); + if (Character.isWhitespace(c) || c == ',') + mustQuote = true; + } + if (mustQuote) + w.append('"').append(s).append('"'); + else + w.append(s); + } + } + + @Override /* Serializer */ + public CsvSerializer clone() { + try { + return (CsvSerializer)super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); // Shouldn't happen. + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/package.html ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/package.html b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/package.html new file mode 100755 index 0000000..9089ea5 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/csv/package.html @@ -0,0 +1,55 @@ +<!DOCTYPE HTML> +<!-- + Licensed Materials - Property of IBM + (c) Copyright IBM Corporation 2014. All Rights Reserved. + + Note to U.S. Government Users Restricted Rights: + Use, duplication or disclosure restricted by GSA ADP Schedule + Contract with IBM Corp. + --> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css"> + /* For viewing in Page Designer */ + @IMPORT url("../../../../../javadoc.css"); + + /* For viewing in REST interface */ + @IMPORT url("../htdocs/javadoc.css"); + body { + margin: 20px; + } + </style> + <script> + /* Replace all @code and @link tags. */ + window.onload = function() { + document.body.innerHTML = document.body.innerHTML.replace(/\{\@code ([^\}]+)\}/g, '<code>$1</code>'); + document.body.innerHTML = document.body.innerHTML.replace(/\{\@link (([^\}]+)\.)?([^\.\}]+)\}/g, '<code>$3</code>'); + } + </script> +</head> +<body> +<p>CSV serialization and parsing support</p> + +<script> + function toggle(x) { + var div = x.nextSibling; + while (div != null && div.nodeType != 1) + div = div.nextSibling; + if (div != null) { + var d = div.style.display; + if (d == 'block' || d == '') { + div.style.display = 'none'; + x.className += " closed"; + } else { + div.style.display = 'block'; + x.className = x.className.replace(/(?:^|\s)closed(?!\S)/g , '' ); + } + } + } +</script> + +This code is currently work-in-progress. + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/doc-files/AddressBook.html ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/doc-files/AddressBook.html b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/doc-files/AddressBook.html new file mode 100755 index 0000000..2f83bd7 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/doc-files/AddressBook.html @@ -0,0 +1,106 @@ +<!DOCTYPE HTML> +<!-- + Licensed Materials - Property of IBM + (c) Copyright IBM Corporation 2014. All Rights Reserved. + + Note to U.S. Government Users Restricted Rights: + Use, duplication or disclosure restricted by GSA ADP Schedule + Contract with IBM Corp. + --> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css">@IMPORT url("../../../../../../javadoc.css");</style> +</head> +<body style='margin:0 20'> + <p></p> + <!-- ======================================================================================================== --> + <a id="AddressBookSampleSource"></a><h2 class='topic'>AddressBook sample source</h2> + <p> + Sample code use in various examples throughout the Javadocs. Represents a simple POJO model consisting + of a collection (<code>LinkedList</code>), beans (<code>Address</code>, <code>Person</code>), and a type 4a filtered type (<code>Calendar</code>). + </p> + <p> + Public fields are used for bean properties in-leu of getters and setters to reduce the size of the example. + Bean properties defined using getters and setters would work identically. + </p> + <a id="AddressBook"></a> + <h6 class='figure'>AddressBook.java</h6> + <p class='bcode'> + <jc>// A collection of people</jc> + <jk>public class</jk> AddressBook <jk>extends</jk> LinkedList<Person> { + + <jc>// Extra method for adding a person to this address book. + // Used in PojoIntrospector usage examples.</jc> + <jk>public void</jk> addPerson(String name, <jk>String</jk> birthDate, List<Address> addresses) { + add(<jk>new</jk> Person(name, birthdate, addresses)); + } + } + </p> + <a id="Address"></a> + <h6 class='figure'>Address.java</h6> + <p class='bcode'> + <jk>public class</jk> Address { + + <jc>// Bean properties</jc> + <jk>public</jk> String <jf>street</jf>, <jf>city</jf>, <jf>state</jf>; + <jk>public int</jk> <jf>zip</jf>; + <jk>public boolean</jk> <jf>isCurrent</jf>; + + <jc>// Bean constructor</jc> + <jk>public</jk> Address() {} + + <jc>// Other constructor</jc> + <jk>public</jk> Address(String street, String city, String state, <jk>int</jk> zip, <jk>boolean</jk> isCurrent) { + <jk>this</jk>.<jf>street</jf> = street; + <jk>this</jk>.<jf>city</jf> = city; + <jk>this</jk>.<jf>state</jf> = state; + <jk>this</jk>.<jf>zip</jf> = zip; + <jk>this</jk>.<jf>isCurrent</jf> = isCurrent; + } + } + </p> + <a id="Person"></a> + <h6 class='figure'>Person.java</h6> + <p class='bcode'> + <jk>public class</jk> Person { + + <jc>// Bean properties</jc> + <jk>public</jk> String <jf>name</jf>; + <jk>public int</jk> <jf>age</jf>; + <jk>public</jk> Calendar <jf>birthDate</jf>; + + <jk>public</jk> LinkedList<Address> <jf>addresses</jf> = <jk>new</jk> LinkedList<Address>(); + + <jc>// Bean constructor</jc> + <jk>public</jk> Person() {} + + <jc>// Other constructor</jc> + <jk>public</jk> Person(String name, String birthDate, Address...addresses) { + <jk>this</jk>.<jf>name</jf> = name; + <jk>this</jk>.<jf>birthDate</jf> = <jsm>getBirthDate</jsm>(birthDate); + <jk>this</jk>.<jf>age</jf> = <jsm>calcAge</jsm>(birthDate); + <jk>this</jk>.<jf>addresses</jf>.addAll(Arrays.<jsm>asList</jsm>(addresses)); + } + + <jc>// Other method</jc> + <jc>// Calculates a persons age based on the birthdate</jc> + <jk>public static int</jk> calcAge(String birthDate) { + <jk>return new</jk> GregorianCalendar().get(Calendar.<jsf>YEAR</jsf>) - getBirthDate(birthDate).get(Calendar.<jsf>YEAR</jsf>); + } + + <jc>// Utility method</jc> + <jc>// Converts a birthdate string to a Calendar</jc> + <jk>private static</jk> Calendar getBirthDate(String birthDate) { + <jk>try</jk> { + Calendar c = <jk>new</jk> GregorianCalendar(); + c.setTime(DateFormat.<jsm>getDateInstance</jsm>(DateFormat.<jsf>MEDIUM</jsf>).parse(birthDate)); + <jk>return</jk> c; + } <jk>catch</jk> (ParseException e) { + <jk>throw new</jk> RuntimeException(e); + } + } + } + </p> + +</body> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.class new file mode 100755 index 0000000..ca9f6c5 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.java new file mode 100755 index 0000000..ca0fd1f --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/Link.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2011, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto; + +import java.text.*; + +import com.ibm.juno.core.html.*; +import com.ibm.juno.core.urlencoding.*; +import com.ibm.juno.core.utils.*; + +/** + * Simple bean that implements a hyperlink for the HTML serializer. + * <p> + * The name and url properties correspond to the following parts of a hyperlink in an HTML document... + * <p class='bcode'> + * <xt><a</xt> <xa>href</xa>=<xs>'href'</xs><xt>></xt>name<xt></a></xt> + * <p> + * When encountered by the {@link HtmlSerializer} class, this object gets converted to a hyperlink.<br> + * All other serializers simply convert it to a simple bean. + * + * @author James Bognar ([email protected]) + */ +@HtmlLink(nameProperty = "name", hrefProperty = "href") +public class Link implements Comparable<Link> { + private String name, href; + + /** No-arg constructor. */ + public Link() {} + + /** + * Constructor. + * + * @param name Corresponds to the text inside of the <xt><A></xt> element. + * @param href Corresponds to the value of the <xa>href</xa> attribute of the <xt><A></xt> element. + * @param hrefArgs Optional arguments for {@link MessageFormat} style arguments in the href. + */ + public Link(String name, String href, Object...hrefArgs) { + setName(name); + setHref(href, hrefArgs); + } + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Bean property getter: <property>name</property>. + * Corresponds to the text inside of the <xt><A></xt> element. + * + * @return The value of the <property>name</property> property on this bean, or <jk>null</jk> if it is not set. + */ + public String getName() { + return name; + } + + /** + * Bean property setter: <property>name</property>. + * + * @param name The new value for the <property>name</property> property on this bean. + * @return This object (for method chaining). + */ + public Link setName(String name) { + this.name = name; + return this; + } + + /** + * Bean property getter: <property>href</property>. + * Corresponds to the value of the <xa>href</xa> attribute of the <xt><A></xt> element. + * + * @return The value of the <property>href</property> property on this bean, or <jk>null</jk> if it is not set. + */ + public String getHref() { + return href; + } + + /** + * Bean property setter: <property>href</property>. + * + * @param href The new value for the <property>href</property> property on this bean. + * @return This object (for method chaining). + */ + public Link setHref(String href) { + setHref(href, new Object[0]); + return this; + } + + /** + * Bean property setter: <property>href</property>. + * Same as {@link #setHref(String)} except allows for {@link MessageFormat} style arguments. + * + * @param href The new href. + * @param args Optional message format arguments. + * @return This object (for method chaining). + */ + public Link setHref(String href, Object...args) { + for (int i = 0; i < args.length; i++) + args[i] = UrlEncodingSerializer.DEFAULT.serializeUrlPart(args[i]); + this.href = (args.length > 0 ? MessageFormat.format(href, args) : href); + return this; + } + + /** + * Returns the name so that the {@link PojoQuery} class can search against it. + */ + @Override /* Object */ + public String toString() { + return name; + } + + @Override /* Comparable */ + public int compareTo(Link o) { + return name.compareTo(o.name); + } + + @Override /* Object */ + public boolean equals(Object o) { + if (! (o instanceof Link)) + return false; + return (compareTo((Link)o) == 0); + } + + @Override /* Object */ + public int hashCode() { + return super.hashCode(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.class new file mode 100755 index 0000000..d35c250 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.java new file mode 100755 index 0000000..e381bc8 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/ResultSetList.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto; + +import java.sql.*; +import java.util.*; + +import com.ibm.juno.core.utils.*; + +/** + * Transforms an SQL {@link ResultSet ResultSet} into a list of maps. + * <p> + * Loads the entire result set into an in-memory data structure, and then closes the result set object. + * + * @author James Bognar ([email protected]) + */ +public final class ResultSetList extends LinkedList<Map<String,Object>> { + + private static final long serialVersionUID = 1L; + + /** + * Constructor. + * + * @param rs The result set to load into this DTO. + * @param pos The start position (zero-indexed). + * @param limit The maximum number of rows to retrieve. + * @param includeRowNums Make the first column be the row number. + * @throws SQLException Database error. + */ + public ResultSetList(ResultSet rs, int pos, int limit, boolean includeRowNums) throws SQLException { + try { + int rowNum = pos; + + // Get the column names. + ResultSetMetaData rsmd = rs.getMetaData(); + int offset = (includeRowNums ? 1 : 0); + int cc = rsmd.getColumnCount(); + String[] columns = new String[cc + offset]; + if (includeRowNums) + columns[0] = "ROW"; + int[] colTypes = new int[cc]; + + for (int i = 0; i < cc; i++) { + columns[i+offset] = rsmd.getColumnName(i+1); + colTypes[i] = rsmd.getColumnType(i+1); + } + + while (--pos > 0 && rs.next()) {} + + // Get the rows. + while (limit-- > 0 && rs.next()) { + Object[] row = new Object[cc + offset]; + if (includeRowNums) + row[0] = rowNum++; + for (int i = 0; i < cc; i++) { + Object o = readEntry(rs, i+1, colTypes[i]); + row[i+offset] = o; + } + add(new SimpleMap(columns, row)); + } + } finally { + try { + rs.close(); + } catch (Exception e) {} + } + } + + /** + * Reads the specified column from the current row in the result set. + * Subclasses can override this method to handle specific data types in special ways. + * + * @param rs The result set to read from. + * @param col The column number (indexed by 1). + * @param dataType The {@link Types type} of the entry. + * @return The entry as an Object. + */ + protected Object readEntry(ResultSet rs, int col, int dataType) { + try { + switch (dataType) { + case Types.BLOB: + Blob b = rs.getBlob(col); + return "blob["+b.length()+"]"; + case Types.CLOB: + Clob c = rs.getClob(col); + return "clob["+c.length()+"]"; + case Types.LONGVARBINARY: + return "longvarbinary["+IOUtils.count(rs.getBinaryStream(col))+"]"; + case Types.LONGVARCHAR: + return "longvarchar["+IOUtils.count(rs.getAsciiStream(col))+"]"; + case Types.LONGNVARCHAR: + return "longnvarchar["+IOUtils.count(rs.getCharacterStream(col))+"]"; + case Types.TIMESTAMP: + return rs.getTimestamp(col); // Oracle returns com.oracle.TIMESTAMP objects from getObject() which isn't a Timestamp. + default: + return rs.getObject(col); + } + } catch (Exception e) { + return e.getLocalizedMessage(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.class new file mode 100755 index 0000000..2129715 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.java new file mode 100755 index 0000000..c384b4e --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Category.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomCategory</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomCategory = + * element atom:category { + * atomCommonAttributes, + * attribute term { text }, + * attribute scheme { atomUri }?, + * attribute label { text }?, + * undefinedContent + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="category") +public class Category extends Common { + + private String term; + private URI scheme; + private String label; + + /** + * Normal constructor. + * @param term The category term. + */ + public Category(String term) { + this.term = term; + } + + /** Bean constructor. */ + public Category() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * @return The category term. + */ + @Xml(format=ATTR) + public String getTerm() { + return term; + } + + /** + * Sets the category term. + * + * @param term The category term. + * @return This object (for method chaining). + */ + public Category setTerm(String term) { + this.term = term; + return this; + } + + /** + * Returns the category scheme. + * + * @return The category scheme. + */ + @Xml(format=ATTR) + public URI getScheme() { + return scheme; + } + + /** + * Sets the category scheme. + * + * @param scheme The category scheme. + * @return This object (for method chaining). + */ + public Category setScheme(URI scheme) { + this.scheme = scheme; + return this; + } + + /** + * Returns the category label. + * + * @return The category label. + */ + @Xml(format=ATTR) + public String getLabel() { + return label; + } + + /** + * Sets the category label. + * + * @param label The category label. + * @return This object (for method chaining). + */ + public Category setLabel(String label) { + this.label = label; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Category setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Category setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.class new file mode 100755 index 0000000..4d02fe9 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.java new file mode 100755 index 0000000..a1b19f9 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Common.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomCommonAttributes</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomCommonAttributes = + * attribute xml:base { atomUri }?, + * attribute xml:lang { atomLanguageTag }?, + * undefinedAttribute* + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +public abstract class Common { + + private URI base; + private String lang; + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the uri base of this object. + * + * @return The URI base of this object. + */ + @Xml(prefix="xml", format=ATTR) + public URI getBase() { + return base; + } + + /** + * Sets the URI base of this object. + * + * @param base The URI base of this object. + * @return This object (for method chaining). + */ + public Common setBase(URI base) { + this.base = base; + return this; + } + + /** + * Returns the language of this object. + * + * @return The language of this object. + */ + @Xml(prefix="xml", format=ATTR) + public String getLang() { + return lang; + } + + /** + * Sets the language of this object. + * + * @param lang The language of this object. + * @return This object (for method chaining). + */ + public Common setLang(String lang) { + this.lang = lang; + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.class new file mode 100755 index 0000000..8b8cf45 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.java new file mode 100755 index 0000000..510cbee --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/CommonEntry.java @@ -0,0 +1,276 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.util.*; + +import com.ibm.juno.core.annotation.*; +import com.ibm.juno.core.filters.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Parent class of {@link Entry}, {@link Feed}, and {@link Source} + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@SuppressWarnings("hiding") +public class CommonEntry extends Common { + + private List<Person> authors; + private List<Category> categories; + private List<Person> contributors; + private Id id; + private List<Link> links; + private Text rights; + private Text title; + private Calendar updated; + + + /** + * Normal constructor. + * @param id The ID of this object. + * @param title The title of this object. + * @param updated The updated timestamp of this object. + */ + public CommonEntry(Id id, Text title, Calendar updated) { + this.id = id; + this.title = title; + this.updated = updated; + } + + /** Bean constructor. */ + public CommonEntry() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the list of authors for this object. + * + * @return The list of authors for this object. + */ + @Xml(format=COLLAPSED, childName="author") + public List<Person> getAuthors() { + return authors; + } + + /** + * Sets the list of authors for this object. + * + * @param authors The list of authors for this object. + * @return This object (for method chaining). + */ + public CommonEntry setAuthors(List<Person> authors) { + this.authors = authors; + return this; + } + + /** + * Adds one or more authors to the list of authors of this object. + * + * @param authors The author to add to the list. + * @return This object (for method chaining). + */ + public CommonEntry addAuthors(Person...authors) { + if (this.authors == null) + this.authors = new LinkedList<Person>(); + this.authors.addAll(Arrays.asList(authors)); + return this; + } + + /** + * Returns the list of categories of this object. + * + * @return The list of categories of this object. + */ + @Xml(format=COLLAPSED, childName="category") + public List<Category> getCatetories() { + return categories; + } + + /** + * Sets the list of categories of this object. + * + * @param categories The list of categories of this object. + * @return This object (for method chaining). + */ + public CommonEntry setCategories(List<Category> categories) { + this.categories = categories; + return this; + } + + /** + * Adds one or more categories to the list of categories of this object. + * + * @param categories The categories to add to the list. + * @return This object (for method chaining). + */ + public CommonEntry addCategories(Category...categories) { + if (this.categories == null) + this.categories = new LinkedList<Category>(); + this.categories.addAll(Arrays.asList(categories)); + return this; + } + + /** + * Returns the list of contributors of this object. + * + * @return The list of contributors of this object. + */ + @Xml(format=COLLAPSED, childName="contributor") + public List<Person> getContributors() { + return contributors; + } + + /** + * Sets the list of contributors of this object. + * + * @param contributors The list of contributors of this object. + * @return This object (for method chaining). + */ + public CommonEntry setContributors(List<Person> contributors) { + this.contributors = contributors; + return this; + } + + /** + * Adds one or more contributors to the list of contributors of this object. + * + * @param contributors The contributor to add to the list. + * @return This object (for method chaining). + */ + public CommonEntry addContributors(Person...contributors) { + if (this.contributors == null) + this.contributors = new LinkedList<Person>(); + this.contributors.addAll(Arrays.asList(contributors)); + return this; + } + + /** + * Returns the ID of this object. + * + * @return The ID of this object. + */ + public Id getId() { + return id; + } + + /** + * Sets the ID of this object. + * + * @param id The ID of this object. + * @return This object (for method chaining). + */ + public CommonEntry setId(Id id) { + this.id = id; + return this; + } + + /** + * Returns the list of links of this object. + * + * @return The list of links of this object. + */ + @Xml(format=COLLAPSED) + public List<Link> getLinks() { + return links; + } + + /** + * Sets the list of links of this object. + * + * @param links The list of links of this object. + * @return This object (for method chaining). + */ + public CommonEntry setLinks(List<Link> links) { + this.links = links; + return this; + } + + /** + * Adds one or more links to the list of links of this object. + * + * @param links The links to add to the list. + * @return This object (for method chaining). + */ + public CommonEntry addLinks(Link...links) { + if (this.links == null) + this.links = new LinkedList<Link>(); + this.links.addAll(Arrays.asList(links)); + return this; + } + + /** + * Returns the rights statement of this object. + * + * @return The rights statement of this object. + */ + public Text getRights() { + return rights; + } + + /** + * Sets the rights statement of this object. + * + * @param rights The rights statement of this object. + * @return This object (for method chaining). + */ + public CommonEntry setRights(Text rights) { + this.rights = rights; + return this; + } + + /** + * Returns the title of this object. + * + * @return The title of this object. + */ + public Text getTitle() { + return title; + } + + /** + * Sets the title of this object. + * + * @param title The title of this object. + * @return This object (for method chaining). + */ + public CommonEntry setTitle(Text title) { + this.title = title; + return this; + } + + /** + * Returns the update timestamp of this object. + * + * @return The update timestamp of this object. + */ + @BeanProperty(filter=CalendarFilter.ISO8601DT.class) + public Calendar getUpdated() { + return updated; + } + + /** + * Sets the update timestamp of this object. + * + * @param updated The update timestamp of this object. + * @return This object (for method chaining). + */ + public CommonEntry setUpdated(Calendar updated) { + this.updated = updated; + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.class new file mode 100755 index 0000000..8d5ce17 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.java new file mode 100755 index 0000000..e1e4cca --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Content.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomContent</code> construct in the RFC4287 specification. + * <p> + * + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomContent = atomInlineTextContent + * | atomInlineXHTMLContent + * | atomInlineOtherContent + * | atomOutOfLineContent + * + * atomInlineTextContent = + * element atom:content { + * atomCommonAttributes, + * attribute type { "text" | "html" }?, + * (text)* + * } + * + * atomInlineXHTMLContent = + * element atom:content { + * atomCommonAttributes, + * attribute type { "xhtml" }, + * xhtmlDiv + * } + * + * atomInlineOtherContent = + * element atom:content { + * atomCommonAttributes, + * attribute type { atomMediaType }?, + * (text|anyElement)* + * } + * + * atomOutOfLineContent = + * element atom:content { + * atomCommonAttributes, + * attribute type { atomMediaType }?, + * attribute src { atomUri }, + * empty + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +public class Content extends Text { + + private URI src; + + + /** + * Normal content. + * + * @param type The content type of this content. + * @param content The content of this content. + */ + public Content(String type, String content) { + super(type, content); + } + + /** + * Normal content. + * + * @param content The content of this content. + */ + public Content(String content) { + super(content); + } + + /** Bean constructor. */ + public Content() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the source URI. + * + * @return the source URI. + */ + @Xml(format=ATTR) + public URI getSrc() { + return src; + } + + /** + * Sets the source URI. + * + * @param src The source URI. + * @return This object (for method chaining). + */ + public Content setSrc(URI src) { + this.src = src; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Text */ + public Content setText(String text) { + super.setText(text); + return this; + } + + @Override /* Text */ + public Content setType(String type) { + super.setType(type); + return this; + } + + @Override /* Common */ + public Content setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Content setLang(String lang) { + super.setLang(lang); + return this; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.class new file mode 100755 index 0000000..e9a66fe Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.java new file mode 100755 index 0000000..1a1cfcb --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Entry.java @@ -0,0 +1,243 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import java.net.URI; +import java.util.*; + +import com.ibm.juno.core.annotation.*; +import com.ibm.juno.core.filters.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomEntry</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomEntry = + * element atom:entry { + * atomCommonAttributes, + * (atomAuthor* + * & atomCategory* + * & atomContent? + * & atomContributor* + * & atomId + * & atomLink* + * & atomPublished? + * & atomRights? + * & atomSource? + * & atomSummary? + * & atomTitle + * & atomUpdated + * & extensionElement*) + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="entry") +public class Entry extends CommonEntry { + + private Content content; + private Calendar published; + private Source source; + private Text summary; + + /** + * Normal constructor. + * + * @param id The ID of this entry. + * @param title The title of this entry. + * @param updated The updated timestamp of this entry. + */ + public Entry(Id id, Text title, Calendar updated) { + super(id, title, updated); + } + + /** Bean constructor. */ + public Entry() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the content of this entry. + * + * @return The content of this entry. + */ + public Content getContent() { + return content; + } + + /** + * Sets the content of this entry. + * + * @param content The content of this entry. + * @return This object (for method chaining). + */ + public Entry setContent(Content content) { + this.content = content; + return this; + } + + /** + * Returns the publish timestamp of this entry. + * + * @return The publish timestamp of this entry. + */ + @BeanProperty(filter=CalendarFilter.ISO8601DT.class) + public Calendar getPublished() { + return published; + } + + /** + * Sets the publish timestamp of this entry. + * + * @param published The publish timestamp of this entry. + * @return This object (for method chaining). + */ + public Entry setPublished(Calendar published) { + this.published = published; + return this; + } + + /** + * Returns the source of this entry. + * + * @return The source of this entry. + */ + public Source getSource() { + return source; + } + + /** + * Sets the source of this entry. + * + * @param source The source of this entry. + * @return This object (for method chaining). + */ + public Entry setSource(Source source) { + this.source = source; + return this; + } + + /** + * Returns the summary of this entry. + * + * @return The summary of this entry. + */ + public Text getSummary() { + return summary; + } + + /** + * Sets the summary of this entry. + * + * @param summary The summary of this entry. + * @return This object (for method chaining). + */ + public Entry setSummary(Text summary) { + this.summary = summary; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* CommonEntry */ + public Entry setAuthors(List<Person> authors) { + super.setAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Entry addAuthors(Person...authors) { + super.addAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Entry setCategories(List<Category> categories) { + super.setCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Entry addCategories(Category...categories) { + super.addCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Entry setContributors(List<Person> contributors) { + super.setContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Entry addContributors(Person...contributors) { + super.addContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Entry setId(Id id) { + super.setId(id); + return this; + } + + @Override /* CommonEntry */ + public Entry setLinks(List<Link> links) { + super.setLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Entry addLinks(Link...links) { + super.addLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Entry setRights(Text rights) { + super.setRights(rights); + return this; + } + + @Override /* CommonEntry */ + public Entry setTitle(Text title) { + super.setTitle(title); + return this; + } + + @Override /* CommonEntry */ + public Entry setUpdated(Calendar updated) { + super.setUpdated(updated); + return this; + } + + @Override /* Common */ + public Entry setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Entry setLang(String lang) { + super.setLang(lang); + return this; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.class new file mode 100755 index 0000000..9484bd7 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.class differ
