001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: Elem.java 3634 2007-01-08 21:42:24Z gbevin $
007: */
008: package com.uwyn.rife.engine.annotations;
009:
010: import java.lang.annotation.*;
011:
012: import com.uwyn.rife.engine.ElementSupport;
013:
014: /**
015: * Declares that a Java class is a RIFE element.
016: * <p>If {@link #id} isn't specified, the short class name (without the
017: * package) will be used as the element's ID. The ID will be interpreted
018: * relative to the ID of the sub-site in which the element is defined.
019: * <p>For example, a site with ID <code>MY.SITE</code>, and an element with
020: * class <code>mypackage.FooStuff</code>, will result in the following
021: * absolute ID for the element: <code>MY.SITE.FooStuff</code>.
022: * <p>If {@link #url} isn't specified, the lower-case short class name will
023: * be used. For example the class <code>mypackage.FooStuff</code>, will result
024: * in the <code>foostuff</code> URL.
025: *
026: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
027: * @version $Revision: 3634 $
028: * @since 1.5
029: */
030: @Retention(RetentionPolicy.RUNTIME)
031: @Target({ElementType.TYPE})
032: @Documented
033: public @interface Elem {
034: final static String DEFAULT_CONTENT_TYPE = "[default content type]";
035: final static String DEFAULT_URL = "[default url]";
036:
037: /**
038: * The ID of this element.
039: * <p>If the ID isn't specified, a default will be generated based on the
040: * short class name. See the class documentation for more information.
041: * @since 1.5
042: */
043: String id() default "";
044:
045: /**
046: * The URL of this element.
047: * <p>If the URL isn't specified, a default will be generated based on the
048: * lower-cased short class name. See the class documentation for more
049: * information.
050: * <p>To explicit specify that no URL should be used, provide an empty string.
051: * @since 1.5
052: */
053: String url() default DEFAULT_URL;
054:
055: /**
056: * The ID of the element whose behavior should be inherited.
057: * <p>If <code>inheritsClass</code> is provided, it will override the
058: * <code>inheritsId</code> value.
059: * @see #inheritsClass
060: * @since 1.5
061: */
062: String inheritsId() default "";
063:
064: /**
065: * The Java class of the element whose behavior should be inherited. This
066: * class should at least have an {@link Elem} annotation.
067: * <p>If <code>inheritsClass</code> is provided, it will override the
068: * <code>inheritsId</code> value.
069: * <p>The ID will be evaluated locally to the current subsite. If you
070: * have to refer to an ID in another subsite, you have to use the
071: * {@link #inheritsClassIdPrefix}.
072: * @see #inheritsId
073: * @see #inheritsClassIdPrefix
074: * @since 1.5
075: */
076: Class inheritsClass() default void.class;
077:
078: /**
079: * The prefix that will be added to the <code>inheritsClass</code> ID.
080: * <p>This makes it possible to refer to an ID in another subsite.
081: * Note that this prefix is not validated individually, it is merely added
082: * as a string to build the final ID that will be used.
083: * @see #inheritsClass
084: * @since 1.5
085: */
086: String inheritsClassIdPrefix() default "";
087:
088: /**
089: * The ID of the element that should precede this element.
090: * <p>If <code>preClass</code> is provided, it will override the
091: * <code>preId</code> value.
092: * @see #preClass
093: * @since 1.5
094: */
095: String preId() default "";
096:
097: /**
098: * The Java class of the element that should precede this element. This
099: * class should at least have an {@link Elem} annotation.
100: * <p>If <code>preClass</code> is provided, it will override the
101: * <code>preId</code> value.
102: * <p>The ID will be evaluated locally to the current subsite. If you
103: * have to refer to an ID in another subsite, you have to use the
104: * {@link #preClassIdPrefix}.
105: * @see #preId
106: * @see #preClassIdPrefix
107: * @since 1.5
108: */
109: Class preClass() default void.class;
110:
111: /**
112: * The prefix that will be added to the <code>preClass</code> ID.
113: * <p>This makes it possible to refer to an ID in another subsite.
114: * Note that this prefix is not validated individually, it is merely added
115: * as a string to build the final ID that will be used.
116: * @see #preClass
117: * @since 1.5
118: */
119: String preClassIdPrefix() default "";
120:
121: /**
122: * The content type of this element's output. By default this will be
123: * whatever is specified by {@link com.uwyn.rife.config.RifeConfig.Engine#getDefaultContentType()}
124: * <p>If you want to use a dynamic content type, set it to an empty string
125: * (<code>""</code>) here, and use {@link ElementSupport#setContentType(String)}
126: * during the element logic.
127: * @since 1.5
128: */
129: String contentType() default DEFAULT_CONTENT_TYPE;
130:
131: /**
132: * This element's inputs.
133: * @since 1.5
134: */
135: Input[] inputs() default {};
136:
137: /**
138: * This element's input beans.
139: * @since 1.5
140: */
141: InBean[] inbeans() default {};
142:
143: /**
144: * This element's incookies.
145: *
146: * @since 1.5
147: */
148: InCookie[] incookies() default {};
149:
150: /**
151: * This element's outputs.
152: * @since 1.5
153: */
154: Output[] outputs() default {};
155:
156: /**
157: * This element's output beans.
158: * @since 1.5
159: */
160: OutBean[] outbeans() default {};
161:
162: /**
163: * This element's outcookies.
164: * @since 1.5
165: */
166: OutCookie[] outcookies() default {};
167:
168: /**
169: * This element's submissions.
170: * @since 1.5
171: */
172: Submission[] submissions() default {};
173:
174: /**
175: * This element's exits.
176: * @since 1.5
177: */
178: Exit[] exits() default {};
179:
180: /**
181: * This element's child triggers.
182: * @since 1.5
183: */
184: ChildTrigger[] childTriggers() default {};
185:
186: /**
187: * This element's pathinfo specifications.
188: * @since 1.5
189: */
190: Pathinfo pathinfo() default @Pathinfo(mappings={});
191:
192: /**
193: * This element's flow links.
194: * @since 1.5
195: */
196: Flowlink[] flowlinks() default {};
197:
198: /**
199: * This element's data links.
200: * @since 1.5
201: */
202: Datalink[] datalinks() default {};
203:
204: /**
205: * This element's auto links.
206: * @since 1.5.1
207: */
208: Autolink[] autolinks() default {};
209: }
|