001: /*
002: * Copyright 2000-2001,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: /*
018:
019: */
020:
021: package org.apache.wsrp4j.producer.provider;
022:
023: import oasis.names.tc.wsrp.v1.types.PortletContext;
024: import oasis.names.tc.wsrp.v1.types.RuntimeContext;
025: import oasis.names.tc.wsrp.v1.types.UserContext;
026:
027: /**
028: * <p>This interface provides methods generating URLs or namespacing
029: * tokens that should be called within the getMarkup method of a service.</p>
030: * <p>There are two kinds of methods:
031: * <ul>
032: * <li>Methods defining URLs or tokens to be rewritten by the consumer.</li>
033: * <li>Methods defining complete URLs or namespaced tokens according to the
034: * templates delivered by the Consumer.</li>
035: * </p>
036: *
037: * @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
038: * @author <a href="mailto:stephan.laertz@de.ibm.com">Stephan Laertz</a>
039: */
040: public interface URLComposer {
041:
042: // create URLs that have to be rewritten by the consumer
043:
044: /**
045: * Creates an complete parameter string for a blocking action link. Depended on
046: * the passed <code>RuntimeContext</code> and appearance of a non-null
047: * (secure)blockingaction or (secure)default template the url are either furnished with embracing rewrite
048: * tokens or not.
049: * Passing a null value for any of the provided parameters implicates that
050: * these url-parameters will not be included in the resulting url.
051: * Passing a null RuntimeContext or a RuntimeContext with a null blockingAction
052: * and default templates implicates the generation of url's which need to be rewritten at the
053: * consumer side. Otherwise the consumers template is used to generate the urls.
054: * If a <code>UserContext</code> and/or <code>PortletContext</code> is also passed
055: * then the portlethandle and userContextKey from these strutures is used to make
056: * the produce url specific to that values.
057: *
058: * @param portletMode The portlet mode to be inserted into the parameter
059: * string of the url.
060: * @param navigationalState The navigational state to be inserted into the
061: * parameter string of the url.
062: * @param interactionState The interaction state to be inserted into the
063: * parameter string of the url.
064: * @param windowState The window State to be inserted into the parameter
065: * string of the url.
066: * @param secureURL Boolean flag indicating if secure
067: * communications should be used when activating
068: * the link.
069: *
070: * @param runtimeContext The <code>RuntimeContext</code> object from the
071: * wsrp request. Passing a null results in url's wich
072: * require consumer rewriting.
073: * @param portletContext If a portlet context is passed with a valid portlet handle
074: * then this handle is used to be inserted in the url only
075: * if the runtimecontext contained a valid blockingAction or default template.
076: **/
077: public String createBlockingActionURL(String portletMode,
078: String navigationalState, String interactionState,
079: String windowState, boolean secureURL,
080: RuntimeContext runtimeContext,
081: PortletContext portletContext, UserContext userContext);
082:
083: /**
084: * Creates an complete parameter string for a render link. Depended on
085: * the passed <code>RuntimeContext</code> and appearance of a non-null
086: * render or default template the url are either furnished with embracing rewrite
087: * tokens or not.
088: * Passing a null value for any of the provided parameters implicates that
089: * these url-parameters will not be included in the resulting url.
090: * Passing a null RuntimeContext or a RuntimeContext with a null render and default
091: * templates implicates the generation of url's which need to be rewritten at the
092: * consumer side. Otherwise the consumers template is used to generate the urls.
093: * If a <code>UserContext</code> and/or <code>PortletContext</code> is also passed
094: * then the portlethandle and userContextKey from these strutures is used to make
095: * the produce url specific to that values.
096: *
097: * @param portletMode The portlet mode to be inserted into the parameter
098: * string of the url.
099: * @param navigationalState The navigational state to be inserted into the
100: * parameter string of the url.
101: * @param windowState The window State to be inserted into the parameter
102: * string of the url.
103: * @param secureURL Boolean flag indicating if secure
104: * communications should be used when activating
105: * the link.
106: *
107: * @param runtimeContext The <code>RuntimeContext</code> object from the
108: * wsrp request. Passing a null results in url's wich
109: * require consumer rewriting.
110: * @param portletContext If a portlet context is passed with a valid portlet handle
111: * then this handle is used to be inserted in the url only
112: * if the runtimecontext contained a valid render or default template.
113: **/
114: public String createRenderURL(String portletMode,
115: String navigationalState, String windowState,
116: boolean secureURL, RuntimeContext runtimeContext,
117: PortletContext portletContext, UserContext userContext);
118:
119: /**
120: * Creates an complete parameter string for a resource link. Depended on
121: * the passed <code>RuntimeContext</code> and appearance of a non-null
122: * render or default template the url are either furnished with embracing rewrite
123: * tokens or not.
124: * Passing a null value for any of the provided parameters implicates that
125: * these url-parameters will not be included in the resulting url.
126: * Passing a null RuntimeContext or a RuntimeContext with a null render and default
127: * templates implicates the generation of url's which need to be rewritten at the
128: * consumer side. Otherwise the consumers template is used to generate the urls.
129: * If a <code>UserContext</code> and/or <code>PortletContext</code> is also passed
130: * then the portlethandle and userContextKey from these strutures is used to make
131: * the produce url specific to that values.
132: *
133: * @param url Provides the actual url to the resource.
134: * @param rewriteResource Boolean flag informing the Consumer that the
135: * resource needs to be parsed for URL rewriting.
136: * @param secureURL Boolean flag indicating whether secure
137: * communications should be used when activating
138: * the link.
139: * @param runtimeContext The <code>RuntimeContext</code> object from the
140: * wsrp request. Passing a null results in url's wich
141: * require consumer rewriting.
142: * @param portletContext If a portlet context is passed with a valid portlet handle
143: * then this handle is used to be inserted in the url only
144: * if the runtimecontext contained a valid resource or default template.
145: **/
146: public String createResourceURL(String url,
147: boolean rewriteResource, boolean secureURL,
148: RuntimeContext runtimeContext,
149: PortletContext portletContext, UserContext userContext);
150:
151: /**
152: * Marks a token that has to be namespaced by the consumer.
153: * If a <code>RuntimeContext</code> with a non-null namespace prefix
154: * attributed is passed then this prefix is used to namespace the given token.
155: * Passing a null RuntimeContext results in a namespace url that requires consumer
156: * rewriting.
157: *
158: * @param token Token to be namespaced.
159: * @param runtimeContext A <code>RuntimeContext</code> with a valid namespaceprefix or null.
160: */
161: public String createNamespacedToken(String token,
162: RuntimeContext runtimeContext);
163: }
|