You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by dl...@apache.org on 2005/08/29 20:18:04 UTC
cvs commit: ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces DescriptionHandler.java PortletInvoker.java PortletPool.java PortletRegistrationFilter.java PortletRegistrationFilterWriter.java PortletState.java PortletStateManager.java Provider.java URLComposer.java
dlouzan 2005/08/29 11:18:03
Added: sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces
DescriptionHandler.java PortletInvoker.java
PortletPool.java PortletRegistrationFilter.java
PortletRegistrationFilterWriter.java
PortletState.java PortletStateManager.java
Provider.java URLComposer.java
Log:
Initial commit.
Revision Changes Path
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/DescriptionHandler.java
Index: DescriptionHandler.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import oasis.names.tc.wsrp.v1.types.PortletDescription;
import oasis.names.tc.wsrp.v1.types.RegistrationContext;
import oasis.names.tc.wsrp.v1.types.ServiceDescription;
import oasis.names.tc.wsrp.v1.types.UserContext;
import org.apache.wsrp4j.commons.exception.WSRPException;
/**
* This interface provides methods to access portlet descriptions as well as
* the service description.
*
* @author Stefan Behl
*
* @version $Id: DescriptionHandler.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface DescriptionHandler {
/**
* Returns a ServiceDescription, based on the input arguments.
* See the getProducerOfferedPortletDescriptions() method for more details.
*
* @param regContext contains data related to a particular
* registration
* (e.g. the registration handle and state)
* @param desiredLocales array of requested locales, if null request
* all available locales
*
*/
ServiceDescription getServiceDescription(RegistrationContext regContext,
String[] desiredLocales)
throws WSRPException;
/**
* Indicates whether registration is required (for this Producer) or not.
*
* @return Returns true if registration is required, otherwise false.
*/
boolean isRegistrationRequired() throws WSRPException;
/**
* Returns an array containing all portlet descriptions, i.e. one portlet
* description per producer offered portlet.
*
* @param regContext contains data related to a particular
* registration
* (e.g. the registration handle and state)
* @param desiredLocales array of requested locales, if null request
* all available locales
*
* @return Array of PortletDescription-objects.
*/
PortletDescription[] getProducerOfferedPortletDescriptions(
RegistrationContext regContext,
String[] desiredLocales)
throws WSRPException;
/**
* Returns an PortletDescription for the given PortletHandle based on the
* input arguments. On how the desiredLocales and sendAllLocales parameter
* affects the returned PortletDescription, please see the method
* getProducerOfferedPortletDescriptions().
*
* @param portletHandle the handle of a particular portlet
* @param regContext contains data related to a particular
* registration
* (e.g. the registration handle and state)
* @param userContext contains the user context
* @param desiredLocales array of requested locales, if null request
* all available locales
*
* @return PortletDescription
*/
PortletDescription getPortletDescription(
String portletHandle,
RegistrationContext regContext,
UserContext userContext,
String[] desiredLocales)
throws WSRPException;
/**
* Returns a complete PortletDescription for the given PortletHandle.
*
* @param portletHandle the handle of a particular portlet
*
* @return PortletDescription
*/
PortletDescription getPortletDescription(String portletHandle)
throws WSRPException;
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletInvoker.java
Index: PortletInvoker.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import oasis.names.tc.wsrp.v1.types.BlockingInteractionResponse;
import oasis.names.tc.wsrp.v1.types.MarkupResponse;
import oasis.names.tc.wsrp.v1.types.GetMarkup;
import oasis.names.tc.wsrp.v1.types.PerformBlockingInteraction;
import org.apache.wsrp4j.commons.exception.WSRPException;
/**
* Specifies the interface to the markup generating component.
* The methods are called during a WSRP markup request
* @version $Id: PortletInvoker.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletInvoker {
/**
* Generate the WSRP MarkupResponse for a given MarkupRequest
* @param request GetMarkup WSRP markup request
* @return MarkupResponse
* @throw WSRPException
*/
MarkupResponse invokeGetMarkup(GetMarkup request) throws WSRPException;
/**
* Invoke a portlet action for a given WSRP action request
* @param request WSRP blocking interaction request
* @return BlockingInteractionResponse
* @throw WSRPExceptin
*/
BlockingInteractionResponse invokePerformBlockingInteraction(
PerformBlockingInteraction request)
throws WSRPException;
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletPool.java
Index: PortletPool.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import java.util.Iterator;
import org.apache.wsrp4j.commons.exception.WSRPException;
/**
* <p>This class provides the interface to the portlet pool. All portlets
* (producer offered as well as consumer configured portlets) should be kept
* within the portlet pool. It is recommended that this interface is
* implemented by a container associating portlet handles with portlet-objects.
* </p>
*
* @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
* @version $Id: PortletPool.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletPool {
/**
* <p>Clones an portlet (Producer Offered or Consumer Configured Portlet)
* associated by portlet-handle. Only the portlet-object should be cloned,
* not the portlet-description the portlet references.</p>
* <p>Adds the new Consumer Configured Portlet (after assigning a new
* portletHandle)to the hashmap after cloning.</p>
* <p>Creates a new portlet state corresponding to the portlet state of
* the portlet to be cloned by calling the PortletStateManager.</p>
* <p>Throws CommonException if portlet to be cloned could not be found</p>
*
* @param portletHandle String identifying the portlet to be cloned.
*
* @return ConsumerConfiguredPortlet The portlet-clone.
*/
Portlet clone(String portletHandle) throws WSRPException;
/**
* Returns all portlets that are currently stored within the
* PortletPool.
*
* @return Iterator of an portlet collection containing all portlets.
*/
Iterator getAllProducerOfferedPortlets();
/**
* Returns all portlets that are currently stored within the
* PortletPool.
*
* @return Iterator of an portlet collection containing all portlets.
*/
Iterator getAllConsumerConfiguredPortlets();
/**
* Returns a certain portlet identified by portletHandle.
* Throws CommonException if there is no portlet corresponding to
* portletHandle.
*
* @param portletHandle String representing the portletHandle.
*
* @return ProducerOfferedPortlet portlet-object identified by
* portletHandle.
*/
Portlet get(String portletHandle) throws WSRPException;
/**
* <p>Deletes the portlet identified by portletHandle from the PortletPool.
* Only consumer configured portlets can be deleted, NOT producer offered
* ones.
* After update, the persistent file store is refreshed.</p>
* <p>Deletes all existing portlet sessions (SessionHandler) and portlet
* states (PortletStateManager) as well.</p>
* <p>Throws CommonException if portlet corresponding to portletHandle
* could not be found.</p>
*
* @param portletHandle String representing the portletHandle.
*
* @return Boolean indicating if deletion was successful. Returns false,
* if portletHandle refers to a producer offered portlet.
*/
boolean destroy(String portletHandle) throws WSRPException;
/**
* Deletes several portlets from the PortletPool.
*
* @param portletHandles Iterator of portletHandles.
*
* @return Iterator containing those portletHandles refering to portlets
* that could not be deleted (e.g. producer offered portlets).
*/
Iterator destroySeveral(Iterator portletHandles);
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletRegistrationFilter.java
Index: PortletRegistrationFilter.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import java.util.Iterator;
/**
* This interface provides methods to inspect portlets that are
* accessible by a certain consumer.
*
* @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
*
* @version $Id: PortletRegistrationFilter.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletRegistrationFilter {
/**
* Returns all portlet handles of portlets, a certain consumer (identified
* by regHandle) can utilize. Returns null if there are no entries for
* the provided regHandle.
*
* @param regHandle String representing the registration handle of a
* consumer
*
* @return Iterator of portlet handles
*/
Iterator getAvailable(String regHandle);
/**
* Indicates whether a certain consumer is allowed to utilize the portlet
* identified by portletHandle or not. Returns false if there is no entry
* for the provided handles.
*
* @param regHandle String representing the registration handle of a
* consumer
* @param portletHandle String representing the portlet handle of a portlet
*
* @return boolean indicating whether the consumer corresponding to
* regHandle is allowed to use the portlet identified by portletHandle
*/
boolean isAvailable(String regHandle, String portletHandle);
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletRegistrationFilterWriter.java
Index: PortletRegistrationFilterWriter.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import java.util.Iterator;
import org.apache.wsrp4j.commons.exception.WSRPException;
/**
* This interface provides methods to make portlets available
* to a certain consumer. If a certain consumer deregisters, the consumer
* registry is responsible for updating, i.e. removing the entries within
* the PortletRegistratinFilter component. If an portlet was removed, the
* portlet pool has to remove the affected entries by calling the provided
* remove-methods.
*
* @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
*
* @version $Id: PortletRegistrationFilterWriter.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletRegistrationFilterWriter
extends PortletRegistrationFilter {
/**
* Makes a certain portlet (identified by portletHandle) available to a
* consumer (identified by regHandle). If there is no portlet in the
* portlet pool that corresponds to portletHandle, the method performs
* nothing.
*
* @param regHandle String representing the registration handle of a
* consumer
* @param portletHandle String representing the portlet handle of a consumer
*/
void makeAvailable(String regHandle, String portletHandle)
throws WSRPException;
/**
* Makes several portlets (identified by portletHandles) available to
* a certain consumer (identified by regHandle). For portlet handles that do
* not correspond to portlets kept within the portlet pool, the method makes
* no availability-entry.
*
* @param regHandle String representing the registration handle of a
* consumer
* @param portletHandles Iterator containing some portlet handles of
* portlets
*/
void makeAvailable(String regHandle, Iterator portletHandles)
throws WSRPException;
/**
* Removes an entire entry for a certain consumer (identified by regHandle).
* If there are no entries for the provided regHandle, the method performs
* nothing. The method is useful when a consumer deregisters.
*
* @param regHandle String representing the registration handle of a
* consumer
*/
void remove(String regHandle);
/**
* Abrogates the availability of a certain portlet (identified by
* portletHandle) regarding a certain consumer (identified by regHandle).
* If there is no entry for the provided regHandle and portletHandle, the
* method performs nothing.
*
* @param regHandle String representing the registration handle of a
* consumer
* @param portletHandle String representing the portlet handle of a
* consumer
*/
void remove(String regHandle, String portletHandle) throws WSRPException;
/**
* Abrogates the availability of several portlets (identified by
* portletHandles) regarding a certain consumer (identified by regHandle).
* For portlet handles that do not correspond to portlets kept within the
* portlet pool, the method performs nothing.
*
* @param regHandle String representing the registration handle of a
* consumer
* @param portletHandles Iterator containing some portlet handles of
* portlets
*/
void remove(String regHandle, Iterator portletHandles) throws WSRPException;
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletState.java
Index: PortletState.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import java.util.HashMap;
import oasis.names.tc.wsrp.v1.types.ModelDescription;
import oasis.names.tc.wsrp.v1.types.PropertyList;
import org.w3c.dom.Element;
/**
* This interface provides access to the portlet's internal state.
* @author Stefan Behl
*
* @version $Id: PortletState.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletState {
/**
* Method getAsString.
* @return String
*/
String getAsString();
/**
* Method getPortletHandle
* @return portletHandle as String
*/
String getPortletHandle();
/**
* Method setPortletHandle
* @param portletHandle as String
*/
void setPortletHandle(String portletHandle);
/**
* Method getAsPropertyList.
* @return Iterator
*/
PropertyList getAsPropertyList();
/**
* Method setAsString.
* @param state
*/
void setAsString(String state);
/**
* Method setAsPropertyList.
* @param props
*/
void setAsPropertyList(PropertyList props);
/**
* Method getAsPropertylist.
* @param names
*/
PropertyList getAsPropertylist(String[] names);
/**
* Method getAsString.
* @param names
* @return String
*/
String getAsString(String[] names);
/**
* Method setAsElement.
* @param props
*/
void setAsElement(Element props);
/**
* Method getAsElement.
*/
Element getAsElement();
/**
* Method getAsElement.
* @param names
*/
Element getAsElement(String[] names);
/**
* Return the Property map
* @return HashMap
*/
HashMap getPropertyMap();
/**
* Set the Property map
* @param propertyMap properties
*/
void setPropertyMap(HashMap propertyMap);
/**
* Set the WSRP model description
* @param modelDescription WSRP model description
*/
void setModelDescription(ModelDescription modelDescription);
/**
* Return the WSRP model description
* @return ModelDescription
*/
ModelDescription getModelDescription();
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/PortletStateManager.java
Index: PortletStateManager.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import oasis.names.tc.wsrp.v1.types.ModelDescription;
import oasis.names.tc.wsrp.v1.types.PropertyList;
/**
* Manages the portlet states. Provides convenience mehtods usefull for state
* handling
*
* @author Stefan Behl
* @version $Id: PortletStateManager.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface PortletStateManager {
/** defines an error state */
static final int INITIALIZATION_FAILED = 3007;//TODO do we need this?
/**
* Returns the portlet's state for a given portlet handle
* @param portletHandle String representing a portlet handle
* @return PortletState
*/
PortletState get(String portletHandle);
/**
* Returns the portlet's state as String for a given portlet handle
* @param portletHandle String representing a portlet handle
* @return String representing the portlet's state
*/
String getAsString(String portletHandle);
/**
* Converts a PortletState object to java.lang.String
* @param state PortletState
* @return java.lang.String representing a portlet state
*/
String getAsString(PortletState state);
/**
* Converts a subset of the portlet stateto java.lang.String.
* The subset of the state is represented by an array of names.
* @param portletHandle String representing a portlet handle
* @param names array of String
* @return String representing a subset of a portlte state
*/
String getAsString(String portletHandle, String[] names);
/**
* Returns the portlet's state as PropertyList
* @param portletHandle String representing a portlte handle
* @return PropertyList
*/
PropertyList getAsPropertyList(String portletHandle);
/**
* Converts a portlet's state to a PropertyList
* @param state the portlet's state
* @return PropertyList
*/
PropertyList getAsPropertyList(PortletState state);
/**
* Converts a subset of the portlet state to a PropertyList. The subset
* of the state is represented by an array of names.
* @param portletHandle String representing a portlet handle
* @param names array of String
* @return PropertyList
*/
PropertyList getAsPropertyList(String portletHandle, String[] names);
/**
* Set the portlet's state
* @param portletHandle String representing a portlet handle
* @param state PortletState
*/
void set(String portletHandle, PortletState state);
/**
* Set the portlet state
* @param portletHandle String representing a portlet handle
* @param state String representing the portlet's state
*/
void setAsString(String portletHandle, String state);
/**
* Set the portlet state
* @param portletHandle String representing a portlet handle
* @param state PropretyList representing the portlte's state
*/
void setAsPropertyList(String portletHandle, PropertyList state);
/**
* Destroys a portlet state
* @param portletHandle String representing a portlet handle
*/
void destroy(String portletHandle);
/**
* Returns the WSRP model description for a portlet's state.
* @param portletHandle String representing a portlet handle
* @param desiredLocales determine the desired locales
* @param sendAllLocales indicates if all locales are desired
* @return ModelDescription
*/
ModelDescription getModelDescription(String portletHandle,
String[] desiredLocales,
boolean sendAllLocales);
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/Provider.java
Index: Provider.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import org.apache.wsrp4j.commons.exception.WSRPException;
import org.apache.wsrp4j.commons.producer.provider.interfaces.
PortletRegistrationFilterWriter;
import org.apache.wsrp4j.commons.producer.provider.interfaces.
PortletRegistrationFilter;
/**
* @version $Id: Provider.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface Provider {
/**
* Returns an instance of DescriptionHandler by calling the constructor
* of the corresponding class implementing the DescriptionHandler-Interface
*
* @return DescriptionHandler DescriptionHandler-instance.
*/
DescriptionHandler getDescriptionHandler();
/**
* Returns an instance of PortletInvoker by calling the constructor
* of the corresponding class implementing the PortletInvoker-Interface
*
* @return PortletInvoker PortletInvoker-instance.
*/
PortletInvoker getPortletInvoker();
/**
* Returns an instance of PortletPool by calling the constructor
* of the corresponding class implementing the PortletPool-Interface
*
* @return PortletPool PortletPool-instance.
*/
PortletPool getPortletPool();
/**
* Returns an instance of PortletProperties by calling the constructor
* of the corresponding class implementing the PortletProperties-Interface
*
* @return PortletProperties PortletProperties-instance.
*/
PortletStateManager getPortletStateManager() throws WSRPException;
/**
* Returns an instance of URLComposer by calling the constructor
* of the corresponding class implementing the URLComposer-Interface
*
* @return URLComposer URLComposer-instance.
*/
URLComposer getURLComposer();
/**
* Returns an instance of the PortletRegistrationFilterWriter
*
* @return PortletRegistrationFilterWriter
*/
PortletRegistrationFilterWriter getPortletRegistrationFilterWriter();
/**
* Returns an instance of the PortletRegistrationFilter
*
* @return PortletRegistrationFilter
*/
PortletRegistrationFilter getPortletRegistrationFilter();
}
1.1 ws-wsrp4j/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/interfaces/URLComposer.java
Index: URLComposer.java
===================================================================
/*
* Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wsrp4j.commons.producer.provider.interfaces;
import oasis.names.tc.wsrp.v1.types.RuntimeContext;
import oasis.names.tc.wsrp.v1.types.UserContext;
import oasis.names.tc.wsrp.v1.types.PortletContext;
/**
* <p>This interface provides methods generating URLs or namespacing
* tokens that should be called within the getMarkup method of a service.</p>
* <p>There are two kinds of methods:
* <ul>
* <li>Methods defining URLs or tokens to be rewritten by the consumer.</li>
* <li>Methods defining complete URLs or namespaced tokens according to the
* templates delivered by the Consumer.</li>
* </p>
*
* @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
* @author <a href="mailto:stephan.laertz@de.ibm.com">Stephan Laertz</a>
* @version $Id: URLComposer.java,v 1.1 2005/08/29 18:18:03 dlouzan Exp $
*/
public interface URLComposer
{
// create URLs that have to be rewritten by the consumer
/**
* Creates a complete parameter string for a blocking action link.
* Depending on the passed <code>RuntimeContext</code> and appearance of a
* non-null (secure)blockingaction or (secure)default template the url are
* either furnished with embracing rewrite tokens or not.
* Passing a null value for any of the provided parameters implicates that
* these url-parameters will not be included in the resulting url.
* Passing a null RuntimeContext or a RuntimeContext with a null
* blockingAction and default templates implicates the generation of url's
* which need to be rewritten at the consumer side. Otherwise the consumers
* template is used to generate the urls. If a <code>UserContext</code>
* and/or <code>PortletContext</code> is also passed then the portlethandle
* and userContextKey from these structures is used to make the producer url
* specific to that values.
*
* @param portletMode The portlet mode to be inserted into the
* parameter string of the url.
* @param navigationalState The navigational state to be inserted into the
* parameter string of the url.
* @param interactionState The interaction state to be inserted into the
* parameter string of the url.
* @param windowState The window State to be inserted into the
* parameter string of the url.
* @param secureURL Boolean flag indicating if secure
* communications should be used when activating
* the link.
*
* @param runtimeContext The <code>RuntimeContext</code> object from the
* wsrp request. Passing a null results in url's
* which require consumer rewriting.
* @param portletContext If a portlet context is passed with a valid
* portlet handle then this handle is used to be
* inserted in the url only if the runtimecontext
* contained a valid blockingAction or default
* template.
*/
String createBlockingActionURL(
String portletMode,
String navigationalState,
String interactionState,
String windowState,
boolean secureURL,
RuntimeContext runtimeContext,
PortletContext portletContext,
UserContext userContext);
/**
* Creates an complete parameter string for a render link. Depended on
* the passed <code>RuntimeContext</code> and appearance of a non-null
* render or default template the url are either furnished with embracing
* rewrite tokens or not.
* Passing a null value for any of the provided parameters implicates that
* these url-parameters will not be included in the resulting url.
* Passing a null RuntimeContext or a RuntimeContext with a null render and
* default templates implicates the generation of url's which need to be
* rewritten at the consumer side. Otherwise the consumers template is used
* to generate the urls. If a <code>UserContext</code> and/or
* <code>PortletContext</code> is also passed then the portlethandle and
* userContextKey from these strutures is used to make the produce url
* specific to that values.
*
* @param portletMode The portlet mode to be inserted into the
* parameter string of the url.
* @param navigationalState The navigational state to be inserted into the
* parameter string of the url.
* @param windowState The window State to be inserted into the
* parameter string of the url.
* @param secureURL Boolean flag indicating if secure
* communications should be used when activating
* the link.
*
* @param runtimeContext The <code>RuntimeContext</code> object from the
* wsrp request. Passing a null results in url's
* which require consumer rewriting.
* @param portletContext If a portlet context is passed with a valid
* portlet handle then this handle is used to be
* inserted in the url only if the runtimecontext
* contained a valid render or default template.
*/
String createRenderURL(
String portletMode,
String navigationalState,
String windowState,
boolean secureURL,
RuntimeContext runtimeContext,
PortletContext portletContext,
UserContext userContext);
/**
* Creates an complete parameter string for a resource link. Depended on
* the passed <code>RuntimeContext</code> and appearance of a non-null
* render or default template the url are either furnished with embracing
* rewrite tokens or not.
* Passing a null value for any of the provided parameters implicates that
* these url-parameters will not be included in the resulting url.
* Passing a null RuntimeContext or a RuntimeContext with a null render and
* default templates implicates the generation of url's which need to be
* rewritten at the consumer side. Otherwise the consumers template is used
* to generate the urls. If a <code>UserContext</code> and/or
* <code>PortletContext</code> is also passed then the portlethandle and
* userContextKey from these strutures is used to make the produce url
* specific to that values.
*
* @param url Provides the actual url to the resource.
* @param rewriteResource Boolean flag informing the Consumer that the
* resource needs to be parsed for URL rewriting.
* @param secureURL Boolean flag indicating whether secure
* communications should be used when activating
* the link.
* @param runtimeContext The <code>RuntimeContext</code> object from the
* wsrp request. Passing a null results in url's
* which require consumer rewriting.
* @param portletContext If a portlet context is passed with a valid
* portlet handle then this handle is used to be
* inserted in the url only if the runtimecontext
* contained a valid resource or default template.
*/
String createResourceURL(
String url,
boolean rewriteResource,
boolean secureURL,
RuntimeContext runtimeContext,
PortletContext portletContext,
UserContext userContext);
/**
* Marks a token that has to be namespaced by the consumer.
* If a <code>RuntimeContext</code> with a non-null namespace prefix
* attributed is passed then this prefix is used to namespace the given
* token. Passing a null RuntimeContext results in a namespace url that
* requires consumer rewriting.
*
* @param token Token to be namespaced.
* @param runtimeContext A <code>RuntimeContext</code> with a valid
* namespaceprefix or null.
*/
String createNamespacedToken(String token, RuntimeContext runtimeContext);
}