hzzz 6 years ago
parent
commit
8399a7ce94
  1. BIN
      fine-portlet-api/.DS_Store
  2. BIN
      fine-portlet-api/src/.DS_Store
  3. BIN
      fine-portlet-api/src/com/.DS_Store
  4. BIN
      fine-portlet-api/src/com/fr/third/.DS_Store
  5. 162
      fine-portlet-api/src/com/fr/third/javax/portlet/ActionRequest.java
  6. 225
      fine-portlet-api/src/com/fr/third/javax/portlet/ActionResponse.java
  7. 464
      fine-portlet-api/src/com/fr/third/javax/portlet/GenericPortlet.java
  8. 108
      fine-portlet-api/src/com/fr/third/javax/portlet/PortalContext.java
  9. 183
      fine-portlet-api/src/com/fr/third/javax/portlet/Portlet.java
  10. 118
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletConfig.java
  11. 456
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletContext.java
  12. 160
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletException.java
  13. 154
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletMode.java
  14. 107
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletModeException.java
  15. 265
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletPreferences.java
  16. 669
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletRequest.java
  17. 80
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletRequestDispatcher.java
  18. 113
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletResponse.java
  19. 89
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletSecurityException.java
  20. 377
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletSession.java
  21. 90
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletSessionUtil.java
  22. 211
      fine-portlet-api/src/com/fr/third/javax/portlet/PortletURL.java
  23. 53
      fine-portlet-api/src/com/fr/third/javax/portlet/PreferencesValidator.java
  24. 88
      fine-portlet-api/src/com/fr/third/javax/portlet/ReadOnlyException.java
  25. 43
      fine-portlet-api/src/com/fr/third/javax/portlet/RenderRequest.java
  26. 342
      fine-portlet-api/src/com/fr/third/javax/portlet/RenderResponse.java
  27. 134
      fine-portlet-api/src/com/fr/third/javax/portlet/UnavailableException.java
  28. 132
      fine-portlet-api/src/com/fr/third/javax/portlet/ValidatorException.java
  29. 135
      fine-portlet-api/src/com/fr/third/javax/portlet/WindowState.java
  30. 105
      fine-portlet-api/src/com/fr/third/javax/portlet/WindowStateException.java
  31. 38
      fine-portlet-api/src/com/fr/third/javax/portlet/package-info.java

BIN
fine-portlet-api/.DS_Store vendored

Binary file not shown.

BIN
fine-portlet-api/src/.DS_Store vendored

Binary file not shown.

BIN
fine-portlet-api/src/com/.DS_Store vendored

Binary file not shown.

BIN
fine-portlet-api/src/com/fr/third/.DS_Store vendored

Binary file not shown.

162
fine-portlet-api/src/com/fr/third/javax/portlet/ActionRequest.java

@ -0,0 +1,162 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>ActionRequest</CODE> represents the request sent to the portlet
* to handle an action.
* It extends the PortletRequest interface to provide action request
* information to portlets.<br>
* The portlet container creates an <CODE>ActionRequest</CODE> object and
* passes it as argument to the portlet's <CODE>processAction</CODE> method.
*
* @see PortletRequest
* @see RenderRequest
*/
public interface ActionRequest extends PortletRequest
{
/**
* Retrieves the body of the HTTP request from client to
* portal as binary data using
* an <CODE>InputStream</CODE>. Either this method or
* {@link #getReader} may be called to read the body, but not both.
* <p>
* For HTTP POST data of type application/x-www-form-urlencoded
* this method throws an <code>IllegalStateException</code>
* as this data has been already processed by the
* portal/portlet-container and is available as request parameters.
*
* @return an input stream containing the body of the request
*
* @exception java.lang.IllegalStateException
* if getReader was already called, or it is a
* HTTP POST data of type application/x-www-form-urlencoded
* @exception java.io.IOException
* if an input or output exception occurred
*/
public java.io.InputStream getPortletInputStream () throws java.io.IOException;
/**
* Overrides the name of the character encoding used in the body of this
* request. This method must be called prior to reading input
* using {@link #getReader} or {@link #getPortletInputStream}.
* <p>
* This method only sets the character set for the Reader that the
* {@link #getReader} method returns.
*
* @param enc a <code>String</code> containing the name of
* the chararacter encoding.
*
* @exception java.io.UnsupportedEncodingException if this is not a valid encoding
* @exception java.lang.IllegalStateException if this method is called after
* reading request parameters or reading input using
* <code>getReader()</code>
*/
public void setCharacterEncoding(String enc)
throws java.io.UnsupportedEncodingException;
/**
* Retrieves the body of the HTTP request from the client to the portal
* as character data using
* a <code>BufferedReader</code>. The reader translates the character
* data according to the character encoding used on the body.
* Either this method or {@link #getPortletInputStream} may be called to read the
* body, not both.
* <p>
* For HTTP POST data of type application/x-www-form-urlencoded
* this method throws an <code>IllegalStateException</code>
* as this data has been already processed by the
* portal/portlet-container and is available as request parameters.
*
* @return a <code>BufferedReader</code>
* containing the body of the request
*
* @exception java.io.UnsupportedEncodingException
* if the character set encoding used is
* not supported and the text cannot be decoded
* @exception java.lang.IllegalStateException
* if {@link #getPortletInputStream} method
* has been called on this request, it is a
* HTTP POST data of type application/x-www-form-urlencoded.
* @exception java.io.IOException
* if an input or output exception occurred
*
* @see #getPortletInputStream
*/
public java.io.BufferedReader getReader()
throws java.io.UnsupportedEncodingException, java.io.IOException;
/**
* Returns the name of the character encoding used in the body of this request.
* This method returns <code>null</code> if the request
* does not specify a character encoding.
*
* @return a <code>String</code> containing the name of
* the chararacter encoding, or <code>null</code>
* if the request does not specify a character encoding.
*/
public java.lang.String getCharacterEncoding();
/**
* Returns the MIME type of the body of the request,
* or null if the type is not known.
*
* @return a <code>String</code> containing the name
* of the MIME type of the request, or null
* if the type is not known.
*/
public java.lang.String getContentType();
/**
* Returns the length, in bytes, of the request body
* which is made available by the input stream, or -1 if the
* length is not known.
*
*
* @return an integer containing the length of the
* request body or -1 if the length is not known
*
*/
public int getContentLength();
}

225
fine-portlet-api/src/com/fr/third/javax/portlet/ActionResponse.java

@ -0,0 +1,225 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>ActionResponse</CODE> interface represents the portlet
* response to an action request.
* It extends the <CODE>PortletResponse</CODE> interface to provide specific
* action response functionality to portlets.<br>
* The portlet container creates an <CODE>ActionResponse</CODE> object and
* passes it as argument to the portlet's <CODE>processAction</CODE> method.
*
* @see ActionRequest
* @see PortletResponse
*/
public interface ActionResponse extends PortletResponse
{
/**
* Sets the window state of a portlet to the given window state.
* <p>
* Possible values are the standard window states and any custom
* window states supported by the portal and the portlet.
* Standard window states are:
* <ul>
* <li>MINIMIZED
* <li>NORMAL
* <li>MAXIMIZED
* </ul>
*
* @param windowState
* the new portlet window state
*
* @exception WindowStateException
* if the portlet cannot switch to the specified window state.
* To avoid this exception the portlet can check the allowed
* window states with <code>Request.isWindowStateAllowed()</code>.
* @exception java.lang.IllegalStateException
* if the method is invoked after <code>sendRedirect</code> has been called.
*
* @see WindowState
*/
public void setWindowState (WindowState windowState)
throws WindowStateException;
/**
* Sets the portlet mode of a portlet to the given portlet mode.
* <p>
* Possible values are the standard portlet modes and any custom
* portlet modes supported by the portal and the portlet. Portlets
* must declare in the deployment descriptor the portlet modes they
* support for each markup type.
* Standard portlet modes are:
* <ul>
* <li>EDIT
* <li>HELP
* <li>VIEW
* </ul>
* <p>
* Note: The portlet may still be called in a different window
* state in the next render call, depending on the portlet container / portal.
*
* @param portletMode
* the new portlet mode
*
* @exception PortletModeException
* if the portlet cannot switch to this portlet mode,
* because the portlet or portal does not support it for this markup,
* or the current user is not allowed to switch to this portlet mode.
* To avoid this exception the portlet can check the allowed
* portlet modes with <code>Request.isPortletModeAllowed()</code>.
* @exception java.lang.IllegalStateException
* if the method is invoked after <code>sendRedirect</code> has been called.
*/
public void setPortletMode (PortletMode portletMode)
throws PortletModeException;
/**
* Instructs the portlet container to send a redirect response
* to the client using the specified redirect location URL.
* <p>
* This method only accepts an absolute URL (e.g.
* <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
* or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
* If required,
* the portlet container may encode the given URL before the
* redirection is issued to the client.
* <p>
* The sendRedirect method can not be invoked after any of the
* following methods of the ActionResponse interface has been called:
* <ul>
* <li>setPortletMode
* <li>setWindowState
* <li>setRenderParameter
* <li>setRenderParameters
* </ul>
*
* @param location the redirect location URL
*
* @exception java.io.IOException
* if an input or output exception occurs.
* @exception java.lang.IllegalArgumentException
* if a relative path URL is given
* @exception java.lang.IllegalStateException
* if the method is invoked after any of above mentioned methods of
* the ActionResponse interface has been called.
*/
public void sendRedirect(String location)
throws java.io.IOException;
/**
* Sets a parameter map for the render request.
* <p>
* All previously set render parameters are cleared.
* <p>
* These parameters will be accessible in all
* sub-sequent render calls via the
* <code>PortletRequest.getParameter</code> call until
* a new request is targeted to the portlet.
* <p>
* The given parameters do not need to be encoded
* prior to calling this method.
*
* @param parameters Map containing parameter names for
* the render phase as
* keys and parameter values as map
* values. The keys in the parameter
* map must be of type String. The values
* in the parameter map must be of type
* String array (<code>String[]</code>).
*
* @exception java.lang.IllegalArgumentException
* if parameters is <code>null</code>, if
* any of the key/values in the Map are <code>null</code>,
* if any of the keys is not a String, or if any of
* the values is not a String array.
* @exception java.lang.IllegalStateException
* if the method is invoked after <code>sendRedirect</code> has been called.
*/
public void setRenderParameters(java.util.Map parameters);
/**
* Sets a String parameter for the render request.
* <p>
* These parameters will be accessible in all
* sub-sequent render calls via the
* <code>PortletRequest.getParameter</code> call until
* a request is targeted to the portlet.
* <p>
* This method replaces all parameters with the given key.
* <p>
* The given parameter do not need to be encoded
* prior to calling this method.
*
* @param key key of the render parameter
* @param value value of the render parameter
*
* @exception java.lang.IllegalArgumentException
* if key or value are <code>null</code>.
* @exception java.lang.IllegalStateException
* if the method is invoked after <code>sendRedirect</code> has been called.
*/
public void setRenderParameter(String key, String value);
/**
* Sets a String array parameter for the render request.
* <p>
* These parameters will be accessible in all
* sub-sequent render calls via the
* <code>PortletRequest.getParameter</code> call until
* a request is targeted to the portlet.
* <p>
* This method replaces all parameters with the given key.
* <p>
* The given parameter do not need to be encoded
* prior to calling this method.
*
* @param key key of the render parameter
* @param values values of the render parameter
*
* @exception java.lang.IllegalArgumentException
* if key or value are <code>null</code>.
* @exception java.lang.IllegalStateException
* if the method is invoked after <code>sendRedirect</code> has been called.
*/
public void setRenderParameter(String key, String[] values);
}

464
fine-portlet-api/src/com/fr/third/javax/portlet/GenericPortlet.java

@ -0,0 +1,464 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>GenericPortlet</CODE> class provides a default implementation
* for the <CODE>Portlet</CODE> interface.
* <p>
* It provides an abstract class to be subclassed to create portlets. A
* subclass of <CODE>GenericPortlet</CODE> should override at least
* one method, usually one of the following:
* <ul>
* <li>processAction, to handle action requests</li>
* <li>doView, to handle render requests when in VIEW mode</li>
* <li>doEdit, to handle render requests when in EDIT mode</li>
* <li>doHelp, to handle render request when in HELP mode</li>
* <li>init and destroy, to manage resources that are held for the life of
* the servlet</li>
* </ul>
* <p>
* Normally there is no need to override the render or the doDispatch
* methods. Render handles render requests setting the title of the
* portlet in the response and invoking doDispatch. doDispatch dispatches
* the request to one of the doView, doEdit or doHelp method depending on
* the portlet mode indicated in the request.
* <p>
* Portlets typically run on multithreaded servers, so please note that a
* portlet must handle concurrent requests and be careful to synchronize
* access to shared resources. Shared resources include in-memory data
* such as instance or class variables and external objects such as
* files, database connections, and network connections.
*/
public abstract class GenericPortlet implements Portlet, PortletConfig
{
private transient PortletConfig config;
/**
* Does nothing.
*/
public GenericPortlet()
{
}
/**
* Called by the portlet container to indicate to a portlet that the
* portlet is being placed into service.
* <p>
* The default implementation just stores the <code>PortletConfig</code>
* object.
* <p>The portlet container calls the <code>init</code>
* method exactly once after instantiating the portlet.
* The <code>init</code> method must complete successfully
* before the portlet can receive any requests.
*
* <p>The portlet container cannot place the portlet into service
* if the <code>init</code> method does one of the following:
* <ol>
* <li>it throws a <code>PortletException</code>
* <li>it does not return within a time period defined by the Web server
* </ol>
*
*
* @param config a <code>PortletConfig</code> object
* containing the portlet
* configuration and initialization parameters
*
* @exception PortletException if an exception has occurred that
* interferes with the portlet normal
* operation.
* @exception UnavailableException if the portlet cannot perform the initialization at this time.
*/
public void init (PortletConfig config) throws PortletException
{
this.config = config;
this.init();
}
/**
*
* A convenience method which can be overridden so that there's no need
* to call <code>super.init(config)</code>.
*
* <p>Instead of overriding {@link #init(PortletConfig)}, simply override
* this method and it will be called by
* <code>GenericPortlet.init(PortletConfig config)</code>.
* The <code>PortletConfig</code> object can still be retrieved via {@link
* #getPortletConfig}.
*
* @exception PortletException if an exception has occurred that
* interferes with the portlet normal
* operation.
* @exception UnavailableException if the portlet is unavailable to perform init
*/
public void init() throws PortletException
{
}
/**
* Called by the portlet container to allow the portlet to process
* an action request. This method is called if the client request was
* originated by a URL created (by the portlet) with the
* <code>RenderResponse.createActionURL()</code> method.
* <p>
* The default implementation throws an exception.
*
* @param request
* the action request
* @param response
* the action response
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to process the action at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
public void processAction (ActionRequest request, ActionResponse response)
throws PortletException, java.io.IOException {
throw new PortletException("processAction method not implemented");
}
/**
* The default implementation of this method sets the title
* using the <code>getTitle</code> method and invokes the
* <code>doDispatch</code> method.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
public void render (RenderRequest request,
RenderResponse response)
throws PortletException, java.io.IOException
{
response.setTitle(getTitle(request));
doDispatch(request, response);
}
/**
* Used by the render method to get the title.
* <p>
* The default implementation gets the title from the ResourceBundle
* of the PortletConfig of the portlet. The title is retrieved
* using the 'javax.portlet.title' resource name.
* <p>
* Portlets can overwrite this method to provide dynamic
* titles (e.g. based on locale, client, and session information).
* Examples are:
* <UL>
* <LI>language-dependant titles for multi-lingual portals
* <LI>shorter titles for WAP phones
* <LI>the number of messages in a mailbox portlet
* </UL>
*
* @return the portlet title for this window
*/
protected java.lang.String getTitle(RenderRequest request) {
return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title");
}
/**
* The default implementation of this method routes the render request
* to a set of helper methods depending on the current portlet mode the
* portlet is currently in.
* These methods are:
* <ul>
* <li><code>doView</code> for handling <code>view</code> requests
* <li><code>doEdit</code> for handling <code>edit</code> requests
* <li><code>doHelp</code> for handling <code>help</code> requests
* </ul>
* <P>
* If the window state of this portlet is <code>minimized</code>, this
* method does not invoke any of the portlet mode rendering methods.
* <p>
* For handling custom portlet modes the portlet should override this
* method.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
* @see #doView(RenderRequest, RenderResponse)
* @see #doEdit(RenderRequest, RenderResponse)
* @see #doHelp(RenderRequest, RenderResponse)
*/
protected void doDispatch (RenderRequest request,
RenderResponse response) throws PortletException,java.io.IOException
{
WindowState state = request.getWindowState();
if ( ! state.equals(WindowState.MINIMIZED)) {
PortletMode mode = request.getPortletMode();
if (mode.equals(PortletMode.VIEW)) {
doView (request, response);
}
else if (mode.equals(PortletMode.EDIT)) {
doEdit (request, response);
}
else if (mode.equals(PortletMode.HELP)) {
doHelp (request, response);
}
else {
throw new PortletException("unknown portlet mode: " + mode);
}
}
}
/**
* Helper method to serve up the mandatory <code>view</code> mode.
* <p>
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
protected void doView (RenderRequest request,
RenderResponse response)
throws PortletException, java.io.IOException
{
throw new PortletException("doView method not implemented");
}
/**
* Helper method to serve up the <code>edit</code> mode.
* <p>
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
protected void doEdit (RenderRequest request,
RenderResponse response)
throws PortletException, java.io.IOException
{
throw new PortletException("doEdit method not implemented");
}
/**
* Helper method to serve up the <code>help</code> mode.
* <p>
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
protected void doHelp (RenderRequest request,
RenderResponse response)
throws PortletException, java.io.IOException
{
throw new PortletException("doHelp method not implemented");
}
/**
* Returns the PortletConfig object of this portlet.
*
* @return the PortletConfig object of this portlet
*/
public PortletConfig getPortletConfig ()
{
return config;
}
/**
* Called by the portlet container to indicate to a portlet that the portlet
* is being taken out of service.
* <p>
* The default implementation does nothing.
*
*/
public void destroy ()
{
// do nothing
}
//-------------------------------------------------------------------------
// implement PortletConfig
//-------------------------------------------------------------------------
/**
* Returns the name of this portlet.
*
* @return the portlet name
*
* @see PortletConfig#getPortletName()
*/
public String getPortletName ()
{
return config.getPortletName();
}
/**
* Returns the <code>PortletContext</code> of the portlet application
* the portlet is in.
*
* @return the portlet application context
*/
public PortletContext getPortletContext ()
{
return config.getPortletContext();
}
/**
* Gets the resource bundle for the given locale based on the
* resource bundle defined in the deployment descriptor
* with <code>resource-bundle</code> tag or the inlined resources
* defined in the deployment descriptor.
*
* @return the resource bundle for the given locale
*/
public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
{
return config.getResourceBundle(locale);
}
/**
* Returns a String containing the value of the named initialization parameter,
* or null if the parameter does not exist.
*
* @param name a <code>String</code> specifying the name
* of the initialization parameter
*
* @return a <code>String</code> containing the value
* of the initialization parameter
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public String getInitParameter(java.lang.String name)
{
return config.getInitParameter(name);
}
/**
* Returns the names of the portlet initialization parameters as an
* Enumeration of String objects, or an empty Enumeration if the
* portlet has no initialization parameters.
*
* @return an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the portlet
* initialization parameters, or an empty Enumeration if the
* portlet has no initialization parameters.
*/
public java.util.Enumeration getInitParameterNames()
{
return config.getInitParameterNames();
}
}

108
fine-portlet-api/src/com/fr/third/javax/portlet/PortalContext.java

@ -0,0 +1,108 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortalContext</CODE> interface gives the portlet
* the ability to retrieve information about the portal calling this portlet.
* <p>
* The portlet can only read the <CODE>PortalContext</CODE> data.
*/
public interface PortalContext
{
/**
* Returns the portal property with the given name,
* or a <code>null</code> if there is
* no property by that name.
*
* @param name property name
*
* @return portal property with key <code>name</code>
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.lang.String getProperty(java.lang.String name);
/**
* Returns all portal property names, or an empty
* <code>Enumeration</code> if there are no property names.
*
* @return All portal property names as an
* <code>Enumeration</code> of <code>String</code> objects
*/
public java.util.Enumeration getPropertyNames();
/**
* Returns all supported portlet modes by the portal
* as an enumertation of <code>PorltetMode</code> objects.
* <p>
* The portlet modes must at least include the
* standard portlet modes <code>EDIT, HELP, VIEW</code>.
*
* @return All supported portal modes by the portal
* as an enumertation of <code>PorltetMode</code> objects.
*/
public java.util.Enumeration getSupportedPortletModes();
/**
* Returns all supported window states by the portal
* as an enumertation of <code>WindowState</code> objects.
* <p>
* The window states must at least include the
* standard window states <code> MINIMIZED, NORMAL, MAXIMIZED</code>.
*
* @return All supported window states by the portal
* as an enumertation of <code>WindowState</code> objects.
*/
public java.util.Enumeration getSupportedWindowStates();
/**
* Returns information about the portal like vendor, version, etc.
* <p>
* The form of the returned string is <I>servername/versionnumber</I>. For
* example, the reference implementation Pluto may return the string
* <CODE>Pluto/1.0</CODE>.
* <p>
* The portlet container may return other optional information after the
* primary string in parentheses, for example, <CODE>Pluto/1.0
* (JDK 1.3.1; Windows NT 4.0 x86)</CODE>.
*
* @return a <CODE>String</CODE> containing at least the portal name and version number
*/
public java.lang.String getPortalInfo();
}

183
fine-portlet-api/src/com/fr/third/javax/portlet/Portlet.java

@ -0,0 +1,183 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>Portlet</CODE> interface is used by the portlet container to
* invoke the portlets. Every portlet has to implement this interface,
* either by directly implementing it, or by using an existing class
* implementing the Portlet interface.
* <P>
* A portlet is a Java technology-based web component. It is managed by the portlet container and
* processes requests and generates dynamic content as response. Portlets are used by portals as
* pluggable user interface components.
* <p>
* The content generated by a portlet is called a fragment. A fragment is a piece of
* markup (e.g. HTML, XHTML, WML) adhering to certain rules and can be aggregated
* with other fragments into a complete document. The content of a portlet is normally
* aggregated with the content of other portlets into the portal page.
* <P>
* The portlet container instanciates portlets, manages their lifecycle
* and invoking them to process requests. The lifecycle consists of:
* <ul>
* <li>initializing the portlet using using the <code>init</code> method
* <li>request processsing
* <li>taking the portlet out of service using the <code>destroy</code> method
* </ul>
* <p>
* Request processing is divided into two types:
* <ul>
* <li>action requests handled through the <code>processAction</code> method,
* to perform actions targeted to the portlet
* <li>render requests handled through the <code>render</code> method,
* to perform the render operation
* </ul>
*/
public interface Portlet
{
/**
* Called by the portlet container to indicate to a portlet that the
* portlet is being placed into service.
*
* <p>The portlet container calls the <code>init</code>
* method exactly once after instantiating the portlet.
* The <code>init</code> method must complete successfully
* before the portlet can receive any requests.
*
* <p>The portlet container cannot place the portlet into service
* if the <code>init</code> method
* <ol>
* <li>Throws a <code>PortletException</code>
* <li>Does not return within a time period defined by the portlet container.
* </ol>
*
*
* @param config a <code>PortletConfig</code> object
* containing the portlet's
* configuration and initialization parameters
*
* @exception PortletException if an exception has occurred that
* interferes with the portlet's normal
* operation.
* @exception UnavailableException if the portlet cannot perform the initialization at this time.
*
*
*/
public void init(PortletConfig config) throws PortletException;
/**
* Called by the portlet container to allow the portlet to process
* an action request. This method is called if the client request was
* originated by a URL created (by the portlet) with the
* <code>RenderResponse.createActionURL()</code> method.
* <p>
* Typically, in response to an action request, a portlet updates state
* based on the information sent in the action request parameters.
* In an action the portlet may:
* <ul>
* <li>issue a redirect
* <li>change its window state
* <li>change its portlet mode
* <li>modify its persistent state
* <li>set render parameters
* </ul>
* <p>
* A client request triggered by an action URL translates into one
* action request and many render requests, one per portlet in the portal page.
* The action processing must be finished before the render requests
* can be issued.
*
* @param request
* the action request
* @param response
* the action response
* @exception PortletException
* if the portlet has problems fulfilling the
* request
* @exception UnavailableException
* if the portlet is unavailable to process the action at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception IOException
* if the streaming causes an I/O problem
*/
public void processAction (ActionRequest request, ActionResponse response)
throws PortletException, java.io.IOException;
/**
* Called by the portlet container to allow the portlet to generate
* the content of the response based on its current state.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet has problems fulfilling the
* rendering request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
public void render (RenderRequest request, RenderResponse response)
throws PortletException, java.io.IOException;
/**
*
* Called by the portlet container to indicate to a portlet that the
* portlet is being taken out of service.
* <p>
* Before the portlet container calls the destroy method, it should
* allow any threads that are currently processing requests within
* the portlet object to complete execution. To avoid
* waiting forever, the portlet container can optionally wait for
* a predefined time before destroying the portlet object.
*
* <p>This method enables the portlet to do the following:
* <ul>
* <li>clean up any resources that it holds (for example, memory,
* file handles, threads)
* <li>make sure that any persistent state is
* synchronized with the portlet current state in memory.
* </ul>
*/
public void destroy();
}

118
fine-portlet-api/src/com/fr/third/javax/portlet/PortletConfig.java

@ -0,0 +1,118 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletConfig</CODE> interface provides the portlet with
* its configuration. The configuration holds information about the
* portlet that is valid for all users. The configuration is retrieved
* from the portlet definition in the deployment descriptor.
* The portlet can only read the configuration data.
* <p>
* The configuration information contains the portlet name, the portlet
* initialization parameters, the portlet resource bundle and the portlet
* application context.
*
* @see Portlet
*/
public interface PortletConfig
{
/**
* Returns the name of the portlet.
* <P>
* The name may be provided via server administration, assigned in the
* portlet application deployment descriptor with the <code>portlet-name</code>
* tag.
*
* @return the portlet name
*/
public String getPortletName ();
/**
* Returns the <code>PortletContext</code> of the portlet application
* the portlet is in.
*
* @return a <code>PortletContext</code> object, used by the
* caller to interact with its portlet container
*
* @see PortletContext
*/
public PortletContext getPortletContext ();
/**
* Gets the resource bundle for the given locale based on the
* resource bundle defined in the deployment descriptor
* with <code>resource-bundle</code> tag or the inlined resources
* defined in the deployment descriptor.
*
* @param locale the locale for which to retrieve the resource bundle
*
* @return the resource bundle for the given locale
*
*/
public java.util.ResourceBundle getResourceBundle(java.util.Locale locale);
/**
* Returns a String containing the value of the named initialization parameter,
* or null if the parameter does not exist.
*
* @param name a <code>String</code> specifying the name
* of the initialization parameter
*
* @return a <code>String</code> containing the value
* of the initialization parameter
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public String getInitParameter(java.lang.String name);
/**
* Returns the names of the portlet initialization parameters as an
* <code>Enumeration</code> of String objects, or an empty <code>Enumeration</code> if the
* portlet has no initialization parameters.
*
* @return an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the portlet
* initialization parameters, or an empty <code>Enumeration</code> if the
* portlet has no initialization parameters.
*/
public java.util.Enumeration getInitParameterNames();
}

456
fine-portlet-api/src/com/fr/third/javax/portlet/PortletContext.java

@ -0,0 +1,456 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletContext</CODE> interface defines a portlet view
* of the portlet container.
* The <CODE>PortletContext</CODE> also makes resources available
* to the portlet. Using the context, a portlet can access
* the portlet log, and obtain URL references to resources.
*
* <p>There is one context per "portlet application" per Java Virtual Machine. (A
* "portlet application" is a collection of portlets, servlets, and content installed
* under a specific subset of the server URL namespace, such as <code>/catalog</code>.
* They are possibly installed via a <code>.war</code> file.)
* As a web application, a portlet application also has a servlet context.
* The portlet context leverages most of its functionality from the
* servlet context of the portlet application.
* <p>
* Attibutes stored in the context are global for <I>all</I> users and <I>all</I>
* components in the portlet application.
* <p>
* In the case of a web
* application marked "distributed" in its deployment descriptor, there will
* be one context instance for each virtual machine. In this situation, the
* context cannot be used as a location to share global information (because
* the information is not truly global). Use an external resource, such as
* a database to achieve sharing on a global scope.
*/
public interface PortletContext
{
/**
* Returns the name and version of the portlet container in which the
* portlet is running.
*
* <P>
* The form of the returned string is <code>containername/versionnumber</code>.
*
*
* @return the string containing at least name and version number
*/
public String getServerInfo ();
/**
* Returns a {@link PortletRequestDispatcher} object that acts
* as a wrapper for the resource located at the given path.
* A <code>PortletRequestDispatcher</code> object can be used include the
* resource in a response. The resource can be dynamic or static.
*
* <p>The pathname must begin with a slash (<code> / </code>) and is interpreted as relative
* to the current context root.
*
* <p>This method returns <code>null</code> if the <code>PortletContext</code>
* cannot return a <code>PortletRequestDispatcher</code>
* for any reason.
*
*
* @param path a <code>String</code> specifying the pathname
* to the resource
* @return a <code>PortletRequestDispatcher</code> object
* that acts as a wrapper for the resource
* at the specified path.
* @see PortletRequestDispatcher
*/
public PortletRequestDispatcher getRequestDispatcher(String path);
/**
* Returns a {@link PortletRequestDispatcher} object that acts
* as a wrapper for the named servlet.
*
* <p>Servlets (and also JSP pages) may be given names via server
* administration or via a web application deployment descriptor.
*
* <p>This method returns <code>null</code> if the
* <code>PortletContext</code> cannot return a
* <code>PortletRequestDispatcher</code> for any reason.
*
*
* @param name a <code>String</code> specifying the name
* of a servlet to be wrapped
*
* @return a <code>PortletRequestDispatcher</code> object
* that acts as a wrapper for the named servlet
*
* @see PortletRequestDispatcher
*
*/
public PortletRequestDispatcher getNamedDispatcher(String name);
/**
* Returns the resource located at the given path as an InputStream object.
* The data in the InputStream can be of any type or length. The method returns
* null if no resource exists at the given path.
* <p>
* In order to access protected resources the path has to be prefixed with
* <code>/WEB-INF/</code> (for example <code>/WEB-INF/myportlet/myportlet.jsp</code>).
* Otherwise, the direct path is used
* (for example <code>/myportlet/myportlet.jsp</code>).
*
* @param path the path to the resource
*
* @return the input stream
*/
public java.io.InputStream getResourceAsStream (String path);
/**
* Returns the major version of the Portlet API that this portlet
* container supports.
*
* @return the major version
*
* @see #getMinorVersion()
*/
public int getMajorVersion ();
/**
* Returns the minor version of the Portlet API that this portlet
* container supports.
*
* @return the minor version
*
* @see #getMajorVersion()
*/
public int getMinorVersion ();
/**
* Returns the MIME type of the specified file, or <code>null</code> if
* the MIME type is not known. The MIME type is determined
* by the configuration of the portlet container and may be specified
* in a web application deployment descriptor. Common MIME
* types are <code>text/html</code> and <code>image/gif</code>.
*
*
* @param file a <code>String</code> specifying the name
* of a file
*
* @return a <code>String</code> specifying the MIME type of the file
*
*/
public String getMimeType(String file);
/**
* Returns a <code>String</code> containing the real path
* for a given virtual path. For example, the path <code>/index.html</code>
* returns the absolute file path of the portlet container file system.
*
* <p>The real path returned will be in a form
* appropriate to the computer and operating system on
* which the portlet container is running, including the
* proper path separators. This method returns <code>null</code>
* if the portlet container cannot translate the virtual path
* to a real path for any reason (such as when the content is
* being made available from a <code>.war</code> archive).
*
* @param path a <code>String</code> specifying a virtual path
*
* @return a <code>String</code> specifying the real path,
* or null if the transformation cannot be performed.
*/
public String getRealPath(String path);
/**
* Returns a directory-like listing of all the paths to resources within
* the web application longest sub-path of which
* matches the supplied path argument. Paths indicating subdirectory paths
* end with a slash (<code>/</code>). The returned paths are all
* relative to the root of the web application and have a leading slash.
* For example, for a web application
* containing<br><br>
* <code>
* /welcome.html<br>
* /catalog/index.html<br>
* /catalog/products.html<br>
* /catalog/offers/books.html<br>
* /catalog/offers/music.html<br>
* /customer/login.jsp<br>
* /WEB-INF/web.xml<br>
* /WEB-INF/classes/com.acme.OrderPortlet.class,<br><br>
* </code>
*
* <code>getResourcePaths("/")</code> returns
* <code>{"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}</code><br>
* <code>getResourcePaths("/catalog/")</code> returns
* <code>{"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}</code>.<br>
*
* @param path
* the partial path used to match the resources, which must start with a slash
* @return a Set containing the directory listing, or <code>null</code> if there
* are no resources in the web application of which the path
* begins with the supplied path.
*/
public java.util.Set getResourcePaths(String path);
/**
* Returns a URL to the resource that is mapped to a specified
* path. The path must begin with a slash (<code>/</code>) and is interpreted
* as relative to the current context root.
*
* <p>This method allows the portlet container to make a resource
* available to portlets from any source. Resources
* can be located on a local or remote
* file system, in a database, or in a <code>.war</code> file.
*
* <p>The portlet container must implement the URL handlers
* and <code>URLConnection</code> objects that are necessary
* to access the resource.
*
* <p>This method returns <code>null</code>
* if no resource is mapped to the pathname.
*
* <p>Some containers may allow writing to the URL returned by
* this method using the methods of the URL class.
*
* <p>The resource content is returned directly, so be aware that
* requesting a <code>.jsp</code> page returns the JSP source code.
* Use a <code>RequestDispatcher</code> instead to include results of
* an execution.
*
* <p>This method has a different purpose than
* <code>java.lang.Class.getResource</code>,
* which looks up resources based on a class loader. This
* method does not use class loaders.
*
* @param path a <code>String</code> specifying
* the path to the resource
*
* @return the resource located at the named path,
* or <code>null</code> if there is no resource
* at that path
*
* @exception MalformedURLException if the pathname is not given in
* the correct form
*
*/
public java.net.URL getResource(String path) throws java.net.MalformedURLException;
/**
* Returns the portlet container attribute with the given name,
* or null if there is no attribute by that name.
* An attribute allows a portlet container to give the
* portlet additional information not
* already provided by this interface.
* A list of supported attributes can be retrieved using
* <code>getAttributeNames</code>.
*
* <p>The attribute is returned as a <code>java.lang.Object</code>
* or some subclass.
* Attribute names should follow the same convention as package
* names. The Java Portlet API specification reserves names
* matching <code>java.*</code>, <code>javax.*</code>,
* and <code>sun.*</code>.
*
*
* @param name a <code>String</code> specifying the name
* of the attribute
*
* @return an <code>Object</code> containing the value
* of the attribute, or <code>null</code>
* if no attribute exists matching the given
* name
*
* @see #getAttributeNames
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.lang.Object getAttribute(java.lang.String name);
/**
* Returns an <code>Enumeration</code> containing the attribute names
* available within this portlet context, or an emtpy
* <code>Enumeration</code> if no attributes are available. Use the
* {@link #getAttribute} method with an attribute name
* to get the value of an attribute.
*
* @return an <code>Enumeration</code> of attribute names
*
* @see #getAttribute
*/
public java.util.Enumeration getAttributeNames();
/**
* Returns a String containing the value of the named context-wide
* initialization parameter, or <code>null</code> if the parameter does not exist.
* This method provides configuration information which may be useful for
* an entire "portlet application".
*
* @param name a <code>String</code> containing the name of the
* requested parameter
*
* @return a <code>String</code> containing the value
* of the initialization parameter, or
* <code>null</code> if the parameter does not exist.
*
* @see #getInitParameterNames
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.lang.String getInitParameter(java.lang.String name);
/**
* Returns the names of the context initialization parameters as an
* <code>Enumeration</code> of String objects, or an empty Enumeration if the context
* has no initialization parameters.
*
* @return an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the context
* initialization parameters
*
* @see #getInitParameter
*/
public java.util.Enumeration getInitParameterNames();
/**
* Writes the specified message to a portlet log file, usually an event log.
* The name and type of the portlet log file is specific to the portlet container.
* <p>
* This method mapps to the <code>ServletContext.log</code> method.
* The portlet container may in addition log this message in a
* portlet container specific log file.
*
* @param msg a <code>String</code> specifying the
* message to be written to the log file
*/
public void log(java.lang.String msg);
/**
* Writes an explanatory message and a stack trace for a given
* Throwable exception to the portlet log file.
* The name and type of the portlet log file is specific to the
* portlet container, usually an event log.
* <p>
* This method is mapped to the <code>ServletContext.log</code> method.
* The portlet container may in addition log this message in a
* portlet container specific log file.
*
* @param message a <code>String</code> that
* describes the error or exception
* @param throwable the <code>Throwable</code> error
* or exception
*/
public void log(java.lang.String message, java.lang.Throwable throwable);
/**
* Removes the attribute with the given name from the portlet context.
* After removal, subsequent calls to
* {@link #getAttribute} to retrieve the attribute's value
* will return <code>null</code>.
*
* @param name a <code>String</code> specifying the name
* of the attribute to be removed
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void removeAttribute(java.lang.String name);
/**
* Binds an object to a given attribute name in this portlet context.
* If the name specified is already used for an attribute, this method
* removes the old attribute and binds the name to the new attribute.
* <p>
* If a null value is passed, the effect is the same as calling
* <code>removeAttribute()</code>.
*
* <p>Attribute names should follow the same convention as package
* names. The Java Portlet API specification reserves names
* matching <code>java.*</code>, <code>javax.*</code>, and
* <code>sun.*</code>.
*
* @param name a <code>String</code> specifying the name
* of the attribute
* @param object an <code>Object</code> representing the
* attribute to be bound
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void setAttribute(java.lang.String name, java.lang.Object object);
/**
* Returns the name of this portlet application correponding to this PortletContext as specified
* in the <code>web.xml</code> deployment descriptor for this web application by the
* <code>display-name</code> element.
*
*
* @return The name of the web application or null if no name has been declared in the deployment descriptor.
*/
public String getPortletContextName();
}

160
fine-portlet-api/src/com/fr/third/javax/portlet/PortletException.java

@ -0,0 +1,160 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletException</CODE> class defines a general exception
* that a portlet can throw when it is unable to perform its operation
* successfully.
*/
public class PortletException extends java.lang.Exception
{
private Throwable _cause;
/**
* Constructs a new portlet exception.
*/
public PortletException ()
{
super();
}
/**
* Constructs a new portlet exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public PortletException (String text)
{
super (text);
}
/**
* Constructs a new portlet exception when the portlet needs to do
* the following:
* <ul>
* <li>throw an exception
* <li>include the "root cause" exception
* <li>include a description message
* </ul>
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public PortletException (String text, Throwable cause)
{
super(text);
_cause = cause;
// change this when going to jdk1.4: super (text, cause);
}
/**
* Constructs a new portlet exception when the portlet needs to throw an
* exception. The exception's message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public PortletException (Throwable cause)
{
_cause = cause;
// change this when going to jdk1.4: super (cause);
}
/**
* Prints the stack trace of this exception to the standard error stream.
*/
public void printStackTrace()
{
this.printStackTrace(System.err);
}
/**
* Prints the stack trace of this exception to the specified print stream.
*
* @param out the <code>PrintStream</code> to be used for output
*/
public void printStackTrace(java.io.PrintStream out)
{
this.printStackTrace(new java.io.PrintWriter(out, true));
}
/**
* Prints the stack trace of this exception to the specified print writer.
*
* @param out the <code>PrintWriter</code> to be used for output
*/
public void printStackTrace(java.io.PrintWriter out)
{
super.printStackTrace(out);
if( getCause () != null ) {
out.println();
out.print("Nested Exception is ");
getCause ().printStackTrace(out);
}
// change this when going tojdk1.4:
/*
super.printStackTrace(out);
if( getRootCause () != null )
{
out.println();
out.print("Nested Exception is ");
getRootCause ().printStackTrace(out);
}
*/
}
/**
* Returns the cause of this throwable or <code>null</code> if the
* cause is nonexistent or unknown. (The cause is the throwable that
* caused this throwable to get thrown.)
*
* <p>This implementation returns the cause that was supplied via one of
* the constructors requiring a <tt>Throwable</tt>.
*
* @return the cause of this throwable or <code>null</code> if the
* cause is nonexistent or unknown.
*/
public Throwable getCause() {
return (_cause!=null ? _cause : null);
}
}

154
fine-portlet-api/src/com/fr/third/javax/portlet/PortletMode.java

@ -0,0 +1,154 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletMode</CODE> class represents
* the possible modes that a portlet can assume.
* <P>
* A portlet mode indicates the function a portlet is performing.
* Normally, portlets perform different tasks and create different
* content depending on the function they are currently performing.
* When invoking a portlet, the portlet container provides the
* current portlet mode to the portlet.
* <p>
* Portlets can programmatically change their portlet
* mode when processing an action request.
* <P>
* This class defines the default portlet modes <code>EDIT, HELP, VIEW</code>.
* Additional portlet modes may be defined by calling the constructor
* of this class. If a portal/portlet-container does not support a
* custom portlet mode defined in the portlet application deployment descriptor,
* the custom portlet mode will be ignored by the portal/portlet container.
*/
public class PortletMode
{
/**
* The expected functionality for a portlet in <code>VIEW</code> portlet mode
* is to generate markup reflecting the current state of the portlet.
* For example, the <code>VIEW</code> portlet mode of a portlet may
* include one or more screens that the user can navigate and interact
* with, or it may consist of static content that does not require any
* user interaction.
* <P>
* This mode must be supported by the portlet.
* <p>
* The string value for this mode is <code>"view"</code>.
*/
public final static PortletMode VIEW = new PortletMode ("view");
/**
* Within the <code>EDIT</code> portlet mode, a portlet should provide
* content and logic that lets a user customize the behavior of the portlet.
* The EDIT portlet mode may include one or more screens among which
* users can navigate to enter their customization data.
* <p>
* Typically, portlets in <code>EDIT</code> portlet mode will
* set or update portlet preferences.
* <P>
* This mode is optional.
* <p>
* The string value for this mode is <code>"edit"</code>.
*/
public final static PortletMode EDIT = new PortletMode ("edit");
/**
* When in <code>HELP</code> portlet mode, a portlet should provide help
* information about the portlet. This help information could be
* a simple help screen explaining the entire portlet in
* coherent text or it could be context-sensitive help.
* <P>
* This mode is optional.
* <p>
* The string value for this mode is <code>"help"</code>.
*/
public final static PortletMode HELP = new PortletMode ("help");
private String _name;
/**
* Creates a new portlet mode with the given name.
* <p>
* Upper case letters in the name are converted to
* lower case letters.
*
* @param name The name of the portlet mode
*/
public PortletMode(String name) {
if (name==null) {
throw new IllegalArgumentException("PortletMode name can not be NULL");
}
_name = name.toLowerCase();
}
/**
* Returns a String representation of this portlet mode.
* Portlet mode names are always lower case names.
*
* @return String representation of this portlet mode
*/
public String toString() {
return _name;
}
/**
* Returns the hash code value for this portlet mode.
* The hash code is constructed by producing the
* hash value of the String value of this mode.
*
* @return hash code value for this portlet mode
*/
public int hashCode() {
return _name.hashCode();
}
/**
* Compares the specified object with this portlet mode
* for equality. Returns <code>true</code> if the
* Strings <code>equals</code> method for the String
* representing the two portlet modes returns <code>true</code>.
*
* @param object the portlet mode to compare this portlet mode with
*
* @return true, if the specified object is equal with this portlet mode
*/
public boolean equals(Object object) {
if ( object instanceof PortletMode )
return _name.equals(((PortletMode) object)._name);
else
return false;
}
}

107
fine-portlet-api/src/com/fr/third/javax/portlet/PortletModeException.java

@ -0,0 +1,107 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletModeException</CODE> is thrown when a portlet
* tries to use or set a portlet mode that is not supported by the current
* runtime environment or the portlet.
*/
public class PortletModeException extends PortletException
{
private transient PortletMode _mode = null;
/**
* Constructs a new portlet mode exception with the given text and the
* portlet mode that caused this exception. The
* portlet container may use the text and portlet mode write it to a log.
*
* @param text
* the exception text
* @param mode
* the mode causing the exception
*/
public PortletModeException (String text, PortletMode mode)
{
super (text);
_mode = mode;
}
/**
* Constructs a new portlet mode exception when the portlet needs to do
* the following:
* <ul>
* <il>throw an exception
* <li>include a message about the "root cause" that interfered
* with its normal operation
* <li>include a description message
* <li>include the portlet mode that caused this exception
* </ul>
*
* @param text
* the exception text
* @param cause
* the root cause
* @param mode
* the mode causing the exception
*/
public PortletModeException (String text, Throwable cause, PortletMode mode)
{
super(text, cause);
_mode = mode;
}
/**
* Constructs a new portlet mode exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception and the portlet mode that caused this exception.
*
* @param cause
* the root cause
* @param mode
* the mode causing the exception
*/
public PortletModeException (Throwable cause, PortletMode mode)
{
super(cause);
_mode = mode;
}
/**
* Returns the unsupported portlet mode causing this exception.
*
* @return the portlet mode that caused this exception
*/
public PortletMode getMode()
{
return _mode;
}
}

265
fine-portlet-api/src/com/fr/third/javax/portlet/PortletPreferences.java

@ -0,0 +1,265 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletPreferences</CODE> interface allows the portlet to store
* configuration data. It is not the
* purpose of this interface to replace general purpose databases.
* <p>
* There are two different types of preferences:
* <ul>
* <li>modifiable preferences - these preferences can be changed by the
* portlet in any standard portlet mode (<code>EDIT, HELP, VIEW</code>).
* Per default every preference is modifiable.
* <li>read-only preferences - these preferences cannot be changed by the
* portlet in any standard portlet mode, but may be changed by administrative modes.
* Preferences are read-only, if the are defined in the
* deployment descriptor with <code>read-only</code> set to <code>true</code>,
* or if the portlet container restricts write access.
* </ul>
* <p>
* Changes are persisted when the <code>store</code> method is called. The <code>store</code> method
* can only be invoked within the scope of a <code>processAction</code> call.
* Changes that are not persisted are discarded when the
* <code>processAction</code> or <code>render</code> method ends.
*/
public interface PortletPreferences
{
/**
* Returns true, if the value of this key cannot be modified by the user.
* <p>
* Modifiable preferences can be changed by the
* portlet in any standard portlet mode (<code>EDIT, HELP, VIEW</code>).
* Per default every preference is modifiable.
* <p>
* Read-only preferences cannot be changed by the
* portlet in any standard portlet mode, but inside of custom modes
* it may be allowed changing them.
* Preferences are read-only, if they are defined in the
* deployment descriptor with <code>read-only</code> set to <code>true</code>,
* or if the portlet container restricts write access.
*
* @return false, if the value of this key can be changed, or
* if the key is not known
*
* @exception java.lang.IllegalArgumentException
* if <code>key</code> is <code>null</code>.
*/
public boolean isReadOnly(String key);
/**
* Returns the first String value associated with the specified key of this preference.
* If there is one or more preference values associated with the given key
* it returns the first associated value.
* If there are no preference values associated with the given key, or the
* backing preference database is unavailable, it returns the given
* default value.
*
* @param key key for which the associated value is to be returned
* @param def the value to be returned in the event that there is no
* value available associated with this <code>key</code>.
*
* @return the value associated with <code>key</code>, or <code>def</code>
* if no value is associated with <code>key</code>, or the backing
* store is inaccessible.
*
* @exception java.lang.IllegalArgumentException
* if <code>key</code> is <code>null</code>. (A
* <code>null</code> value for <code>def</code> <i>is</i> permitted.)
*
* @see #getValues(String, String[])
*/
public String getValue(String key, String def);
/**
* Returns the String array value associated with the specified key in this preference.
*
* <p>Returns the specified default if there is no value
* associated with the key, or if the backing store is inaccessible.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists and is accessible, it is used in favor of the
* specified default.
*
*
* @param key key for which associated value is to be returned.
* @param def the value to be returned in the event that this
* preference node has no value associated with <code>key</code>
* or the associated value cannot be interpreted as a String array,
* or the backing store is inaccessible.
*
* @return the String array value associated with
* <code>key</code>, or <code>def</code> if the
* associated value does not exist.
*
* @exception java.lang.IllegalArgumentException if <code>key</code> is <code>null</code>. (A
* <code>null</code> value for <code>def</code> <i>is</i> permitted.)
*
* @see #getValue(String,String)
*/
public String[] getValues(String key, String[] def);
/**
* Associates the specified String value with the specified key in this
* preference.
* <p>
* The key cannot be <code>null</code>, but <code>null</code> values
* for the value parameter are allowed.
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
*
* @exception ReadOnlyException
* if this preference cannot be modified for this request
* @exception java.lang.IllegalArgumentException if key is <code>null</code>,
* or <code>key.length()</code>
* or <code>value.length</code> are to long. The maximum length
* for key and value are implementation specific.
*
* @see #setValues(String, String[])
*/
public void setValue(String key, String value) throws ReadOnlyException;
/**
* Associates the specified String array value with the specified key in this
* preference.
* <p>
* The key cannot be <code>null</code>, but <code>null</code> values
* in the values parameter are allowed.
*
* @param key key with which the value is to be associated
* @param values values to be associated with key
*
* @exception java.lang.IllegalArgumentException if key is <code>null</code>, or
* <code>key.length()</code>
* is to long or <code>value.size</code> is to large. The maximum
* length for key and maximum size for value are implementation specific.
* @exception ReadOnlyException
* if this preference cannot be modified for this request
*
* @see #setValue(String,String)
*/
public void setValues(String key, String[] values) throws ReadOnlyException;
/**
* Returns all of the keys that have an associated value,
* or an empty <code>Enumeration</code> if no keys are
* available.
*
* @return an Enumeration of the keys that have an associated value,
* or an empty <code>Enumeration</code> if no keys are
* available.
*/
public java.util.Enumeration getNames();
/**
* Returns a <code>Map</code> of the preferences.
* <p>
* The values in the returned <code>Map</code> are from type
* String array (<code>String[]</code>).
* <p>
* If no preferences exist this method returns an empty <code>Map</code>.
*
* @return an immutable <code>Map</code> containing preference names as
* keys and preference values as map values, or an empty <code>Map</code>
* if no preference exist. The keys in the preference
* map are of type String. The values in the preference map are of type
* String array (<code>String[]</code>).
*/
public java.util.Map getMap();
/**
* Resets or removes the value associated with the specified key.
* <p>
* If this implementation supports stored defaults, and there is such
* a default for the specified preference, the given key will be
* reset to the stored default.
* <p>
* If there is no default available the key will be removed.
*
* @param key to reset
*
* @exception java.lang.IllegalArgumentException if key is <code>null</code>.
* @exception ReadOnlyException
* if this preference cannot be modified for this request
*/
public void reset(String key) throws ReadOnlyException;
/**
* Commits all changes made to the preferences via the
* <code>set</code> methods in the persistent store.
* <P>
* If this call returns succesfull, all changes are made
* persistent. If this call fails, no changes are made
* in the persistent store. This call is an atomic operation
* regardless of how many preference attributes have been modified.
* <P>
* All changes made to preferences not followed by a call
* to the <code>store</code> method are discarded when the
* portlet finishes the <code>processAction</code> method.
* <P>
* If a validator is defined for this preferences in the
* deployment descriptor, this validator is called before
* the actual store is performed to check wether the given
* preferences are vaild. If this check fails a
* <code>ValidatorException</code> is thrown.
*
* @exception java.io.IOException
* if changes cannot be written into
* the backend store
* @exception ValidatorException
* if the validation performed by the
* associated validator fails
* @exception java.lang.IllegalStateException
* if this method is called inside a render call
*
* @see PreferencesValidator
*/
public void store() throws java.io.IOException, ValidatorException;
}

669
fine-portlet-api/src/com/fr/third/javax/portlet/PortletRequest.java

@ -0,0 +1,669 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletRequest</CODE> defines the base interface to provide client
* request information to a portlet. The portlet container uses two specialized
* versions of this interface when invoking a portlet, <CODE>ActionRequest</CODE>
* and <CODE>RenderRequest</CODE>. The portlet container creates these objects and
* passes them as arguments to the portlet's <CODE>processAction</CODE> and
* <CODE>render</CODE> methods.
*
* @see ActionRequest
* @see RenderRequest
*/
public interface PortletRequest
{
/** Used to retrieve user information attributes with the
* <code>getAttribute</code> call. The user information is returned
* as a <code>Map</code> object. The portlet must define the
* user information attribute it is interested in inside the
* <code>user-attribute</code> section of the deployment descriptor.
* If an attribute is not supported
* by the current runtime system it will not show up in the user
* attribute map.<BR>
* If the user-attribute is supported by the runtime system, but not
* defined for a particular user, then for that user the attribute
* exists in the returned map and the attribute has a <code>null</code> value.
* <p>
* If the user-attribute is not defined for the current user it
* will not show up in the Map.
* <p>
* The value is <code>javax.portlet.userinfo</code>.
*/
public static final String USER_INFO = "javax.portlet.userinfo";
/**
* String identifier for Basic authentication. Value "BASIC".
*/
public static final String BASIC_AUTH = "BASIC";
/**
* String identifier for Form based authentication. Value "FORM".
*/
public static final String FORM_AUTH = "FORM";
/**
* String identifier for Certification based authentication. Value "CLIENT_CERT".
*/
public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
/**
* String identifier for Digest based authentication. Value "DIGEST".
*/
public static final String DIGEST_AUTH = "DIGEST";
/**
* Returns true, if the given window state is valid
* to be set for this portlet in the context
* of the current request.
*
* @param state window state to checked
*
* @return true, if it is valid for this portlet
* in this request to change to the
* given window state
*
*/
public boolean isWindowStateAllowed(WindowState state);
/**
* Returns true, if the given portlet mode is a valid
* one to set for this portlet in the context
* of the current request.
*
* @param mode portlet mode to check
*
* @return true, if it is valid for this portlet
* in this request to change to the
* given portlet mode
*
*/
public boolean isPortletModeAllowed(PortletMode mode);
/**
* Returns the current portlet mode of the portlet.
*
* @return the portlet mode
*/
public PortletMode getPortletMode ();
/**
* Returns the current window state of the portlet.
*
* @return the window state
*/
public WindowState getWindowState ();
/**
* Returns the preferences object associated with the portlet.
*
* @return the portlet preferences
*/
public PortletPreferences getPreferences ();
/**
* Returns the current portlet session or, if there is no current session,
* creates one and returns the new session.
* <p>
* Creating a new portlet session will result in creating
* a new <code>HttpSession</code> on which the portlet session is based on.
*
* @return the portlet session
*/
public PortletSession getPortletSession ();
/**
* Returns the current portlet session or, if there is no current session
* and the given flag is <CODE>true</CODE>, creates one and returns
* the new session.
* <P>
* If the given flag is <CODE>false</CODE> and there is no current
* portlet session, this method returns <CODE>null</CODE>.
* <p>
* Creating a new portlet session will result in creating
* a new <code>HttpSession</code> on which the portlet session is based on.
*
* @param create
* <CODE>true</CODE> to create a new session, <BR>
* <CODE>false</CODE> to return <CODE>null</CODE> if there
* is no current session
* @return the portlet session
*/
public PortletSession getPortletSession (boolean create);
/**
* Returns the value of the specified request property
* as a <code>String</code>. If the request did not include a property
* of the specified name, this method returns <code>null</code>.
* <p>
* A portlet can access portal/portlet-container specific properties
* through this method and, if available, the
* headers of the HTTP client request.
* <p>
* This method should only be used if the
* property has only one value. If the property might have
* more than one value, use {@link #getProperties}.
* <p>
* If this method is used with a multivalued
* parameter, the value returned is equal to the first value
* in the Enumeration returned by <code>getProperties</code>.
*
* @param name a <code>String</code> specifying the
* property name
*
* @return a <code>String</code> containing the
* value of the requested
* property, or <code>null</code>
* if the request does not
* have a property of that name.
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public String getProperty(String name);
/**
* Returns all the values of the specified request property
* as a <code>Enumeration</code> of <code>String</code> objects.
* <p>
* If the request did not include any propertys
* of the specified name, this method returns an empty
* <code>Enumeration</code>.
* The property name is case insensitive. You can use
* this method with any request property.
*
* @param name a <code>String</code> specifying the
* property name
*
* @return a <code>Enumeration</code> containing
* the values of the requested property. If
* the request does not have any properties of
* that name return an empty <code>Enumeration</code>.
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.util.Enumeration getProperties(String name);
/**
*
* Returns a <code>Enumeration</code> of all the property names
* this request contains. If the request has no
* properties, this method returns an empty <code>Enumeration</code>.
*
*
* @return an <code>Enumeration</code> of all the
* property names sent with this
* request; if the request has
* no properties, an empty <code>Enumeration</code>.
*/
public java.util.Enumeration getPropertyNames();
/**
* Returns the context of the calling portal.
*
* @return the context of the calling portal
*/
public PortalContext getPortalContext();
/**
* Returns the name of the authentication scheme used for the
* connection between client and portal,
* for example, <code>BASIC_AUTH</code>, <code>CLIENT_CERT_AUTH</code>,
* a custom one or <code>null</code> if there was no authentication.
*
* @return one of the static members <code>BASIC_AUTH</code>,
* <code>FORM_AUTH</code>, <code>CLIENT_CERT_AUTH</code>,
* <code>DIGEST_AUTH</code> (suitable for == comparison)
* indicating the authentication scheme,
* a custom one, or
* <code>null</code> if the request was
* not authenticated.
*/
public java.lang.String getAuthType();
/**
* Returns the context path which is the path prefix associated with the deployed
* portlet application. If the portlet application is rooted at the
* base of the web server URL namespace (also known as "default" context),
* this path must be an empty string. Otherwise, it must be the path the
* portlet application is rooted to, the path must start with a '/' and
* it must not end with a '/' character.
* <p>
* To encode a URL the {@link PortletResponse#encodeURL} method must be used.
*
* @return a <code>String</code> specifying the
* portion of the request URL that indicates the context
* of the request
*
* @see PortletResponse#encodeURL
*/
public String getContextPath();
/**
* Returns the login of the user making this request, if the user
* has been authenticated, or null if the user has not been authenticated.
*
* @return a <code>String</code> specifying the login
* of the user making this request, or <code>null</code>
* if the user login is not known.
*
*/
public java.lang.String getRemoteUser();
/**
* Returns a java.security.Principal object containing the name of the
* current authenticated user.
*
* @return a <code>java.security.Principal</code> containing
* the name of the user making this request, or
* <code>null</code> if the user has not been
* authenticated.
*/
public java.security.Principal getUserPrincipal();
/**
* Returns a boolean indicating whether the authenticated user is
* included in the specified logical "role". Roles and role membership can be
* defined using deployment descriptors. If the user has not been
* authenticated, the method returns <code>false</code>.
*
* @param role a <code>String</code> specifying the name
* of the role
*
* @return a <code>boolean</code> indicating whether
* the user making this request belongs to a given role;
* <code>false</code> if the user has not been
* authenticated.
*/
public boolean isUserInRole(java.lang.String role);
/**
*
* Returns the value of the named attribute as an <code>Object</code>,
* or <code>null</code> if no attribute of the given name exists.
* <p>
* Attribute names should follow the same conventions as package
* names. This specification reserves names matching <code>java.*</code>,
* and <code>javax.*</code>.
* <p>
* In a distributed portlet web application the <code>Object</code>
* needs to be serializable.
*
* @param name a <code>String</code> specifying the name of
* the attribute
*
* @return an <code>Object</code> containing the value
* of the attribute, or <code>null</code> if
* the attribute does not exist.
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*
*/
public Object getAttribute(String name);
/**
* Returns an <code>Enumeration</code> containing the
* names of the attributes available to this request.
* This method returns an empty <code>Enumeration</code>
* if the request has no attributes available to it.
*
*
* @return an <code>Enumeration</code> of strings
* containing the names
* of the request attributes, or an empty
* <code>Enumeration</code> if the request
* has no attributes available to it.
*/
public java.util.Enumeration getAttributeNames();
/**
* Returns the value of a request parameter as a <code>String</code>,
* or <code>null</code> if the parameter does not exist. Request parameters
* are extra information sent with the request. The returned parameter
* are "x-www-form-urlencoded" decoded.
* <p>
* Only parameters targeted to the current portlet are accessible.
* <p>
* This method should only be used if the
* parameter has only one value. If the parameter might have
* more than one value, use {@link #getParameterValues}.
* <p>
* If this method is used with a multivalued
* parameter, the value returned is equal to the first value
* in the array returned by <code>getParameterValues</code>.
*
*
*
* @param name a <code>String</code> specifying the
* name of the parameter
*
* @return a <code>String</code> representing the
* single value of the parameter
*
* @see #getParameterValues
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*
*/
public String getParameter(String name);
/**
*
* Returns an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the parameters contained
* in this request. If the request has
* no parameters, the method returns an
* empty <code>Enumeration</code>.
* <p>
* Only parameters targeted to the current portlet are returned.
*
*
* @return an <code>Enumeration</code> of <code>String</code>
* objects, each <code>String</code> containing
* the name of a request parameter; or an
* empty <code>Enumeration</code> if the
* request has no parameters.
*/
public java.util.Enumeration getParameterNames();
/**
* Returns an array of <code>String</code> objects containing
* all of the values the given request parameter has, or
* <code>null</code> if the parameter does not exist.
* The returned parameters are "x-www-form-urlencoded" decoded.
* <p>
* If the parameter has a single value, the array has a length
* of 1.
*
*
* @param name a <code>String</code> containing the name of
* the parameter the value of which is requested
*
* @return an array of <code>String</code> objects
* containing the parameter values.
*
* @see #getParameter
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*
*/
public String[] getParameterValues(String name);
/**
* Returns a <code>Map</code> of the parameters of this request.
* Request parameters are extra information sent with the request.
* The returned parameters are "x-www-form-urlencoded" decoded.
* <p>
* The values in the returned <code>Map</code> are from type
* String array (<code>String[]</code>).
* <p>
* If no parameters exist this method returns an empty <code>Map</code>.
*
* @return an immutable <code>Map</code> containing parameter names as
* keys and parameter values as map values, or an empty <code>Map</code>
* if no parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (<code>String[]</code>).
*/
public java.util.Map getParameterMap();
/**
* Returns a boolean indicating whether this request was made
* using a secure channel between client and the portal, such as HTTPS.
*
* @return true, if the request was made using a secure channel.
*/
public boolean isSecure();
/**
* Stores an attribute in this request.
*
* <p>Attribute names should follow the same conventions as
* package names. Names beginning with <code>java.*</code>,
* <code>javax.*</code>, and <code>com.sun.*</code> are
* reserved for use by Sun Microsystems.
*<br> If the value passed into this method is <code>null</code>,
* the effect is the same as calling {@link #removeAttribute}.
*
*
* @param name a <code>String</code> specifying
* the name of the attribute
*
* @param o the <code>Object</code> to be stored
*
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void setAttribute(String name, Object o);
/**
*
* Removes an attribute from this request. This method is not
* generally needed, as attributes only persist as long as the request
* is being handled.
*
* <p>Attribute names should follow the same conventions as
* package names. Names beginning with <code>java.*</code>,
* <code>javax.*</code>, and <code>com.sun.*</code> are
* reserved for use by Sun Microsystems.
*
* @param name a <code>String</code> specifying
* the name of the attribute to be removed
*
*
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void removeAttribute(String name);
/**
*
* Returns the session ID indicated in the client request.
* This session ID may not be a valid one, it may be an old
* one that has expired or has been invalidated.
* If the client request
* did not specify a session ID, this method returns
* <code>null</code>.
*
* @return a <code>String</code> specifying the session
* ID, or <code>null</code> if the request did
* not specify a session ID
*
* @see #isRequestedSessionIdValid
*
*/
public String getRequestedSessionId();
/**
*
* Checks whether the requested session ID is still valid.
*
* @return <code>true</code> if this
* request has an id for a valid session
* in the current session context;
* <code>false</code> otherwise
*
* @see #getRequestedSessionId
* @see #getPortletSession
*/
public boolean isRequestedSessionIdValid();
/**
* Returns the portal preferred content type for the response.
* <p>
* The content type only includes the MIME type, not the
* character set.
* <p>
* Only content types that the portlet has defined in its
* deployment descriptor are valid return values for
* this method call. If the portlet has defined
* <code>'*'</code> or <code>'* / *'</code> as supported content
* types, these may also be valid return values.
*
* @return preferred MIME type of the response
*/
public String getResponseContentType();
/**
* Gets a list of content types which the portal accepts for the response.
* This list is ordered with the most preferable types listed first.
* <p>
* The content type only includes the MIME type, not the
* character set.
* <p>
* Only content types that the portlet has defined in its
* deployment descriptor are valid return values for
* this method call. If the portlet has defined
* <code>'*'</code> or <code>'* / *'</code> as supported content
* types, these may also be valid return values.
*
* @return ordered list of MIME types for the response
*/
public java.util.Enumeration getResponseContentTypes();
/**
* Returns the preferred Locale in which the portal will accept content.
* The Locale may be based on the Accept-Language header of the client.
*
* @return the prefered Locale in which the portal will accept content.
*/
public java.util.Locale getLocale();
/**
* Returns an Enumeration of Locale objects indicating, in decreasing
* order starting with the preferred locale in which the portal will
* accept content for this request.
* The Locales may be based on the Accept-Language header of the client.
*
* @return an Enumeration of Locales, in decreasing order, in which
* the portal will accept content for this request
*/
public java.util.Enumeration getLocales();
/**
* Returns the name of the scheme used to make this request.
* For example, <code>http</code>, <code>https</code>, or <code>ftp</code>.
* Different schemes have different rules for constructing URLs,
* as noted in RFC 1738.
*
* @return a <code>String</code> containing the name
* of the scheme used to make this request
*/
public String getScheme();
/**
* Returns the host name of the server that received the request.
*
* @return a <code>String</code> containing the name
* of the server to which the request was sent
*/
public String getServerName();
/**
* Returns the port number on which this request was received.
*
* @return an integer specifying the port number
*/
public int getServerPort();
}

80
fine-portlet-api/src/com/fr/third/javax/portlet/PortletRequestDispatcher.java

@ -0,0 +1,80 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <code>PortletRequestDispatcher</code> interface
* defines an object that receives requests from the client
* and sends them to the specified resources (such as a servlet,
* HTML file, or JSP file) on the server. The portlet
* container creates the <code>PortletRequestDispatcher</code> object,
* which is used as a wrapper around a server resource located
* at a particular path or given by a particular name.
*
*/
public interface PortletRequestDispatcher {
/**
*
* Includes the content of a resource (servlet, JSP page,
* HTML file) in the response. In essence, this method enables
* programmatic server-side includes.
* <p>
* The included servlet cannot set or change the response status code
* or set headers; any attempt to make a change is ignored.
*
*
* @param request a {@link RenderRequest} object
* that contains the client request
*
* @param response a {@link RenderResponse} object
* that contains the render response
*
* @exception PortletException if the included resource throws a ServletException,
* or other exceptions that are not Runtime-
* or IOExceptions.
*
* @exception java.io.IOException if the included resource throws this exception
*
*
*/
public void include(RenderRequest request, RenderResponse response)
throws PortletException, java.io.IOException;
}

113
fine-portlet-api/src/com/fr/third/javax/portlet/PortletResponse.java

@ -0,0 +1,113 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletResponse</CODE> defines the base interface to assist a
* portlet in creating and sending a response to the client.
* The portlet container uses two specialized versions of this interface
* when invoking a portlet, <CODE>ActionResponse</CODE> and
* <CODE>RenderResponse</CODE>. The portlet container creates these
* objects and passes them as arguments to the portlet's <CODE>processAction</CODE>
* and <CODE>render</CODE> methods.
*
* @see ActionResponse
* @see RenderResponse
*/
public interface PortletResponse
{
/**
* Adds a String property to an existing key to be returned to the portal.
* <p>
* This method allows response properties to have multiple values.
* <p>
* Properties can be used by portlets to provide vendor specific
* information to the portal.
*
* @param key the key of the property to be returned to the portal
* @param value the value of the property to be returned to the portal
*
* @exception java.lang.IllegalArgumentException
* if key is <code>null</code>.
*/
public void addProperty(String key, String value);
/**
* Sets a String property to be returned to the portal.
* <p>
* Properties can be used by portlets to provide vendor specific
* information to the portal.
* <p>
* This method resets all properties previously added with the same key.
*
* @param key the key of the property to be returned to the portal
* @param value the value of the property to be returned to the portal
*
* @exception java.lang.IllegalArgumentException
* if key is <code>null</code>.
*/
public void setProperty(String key, String value);
/**
* Returns the encoded URL of the resource, like servlets,
* JSPs, images and other static files, at the given path.
* <p>
* Some portal/portlet-container implementation may require
* those URLs to contain implementation specific data encoded
* in it. Because of that, portlets should use this method to
* create such URLs.
* <p>
* The <code>encodeURL</code> method may include the session ID
* and other portal/portlet-container specific information into the URL.
* If encoding is not needed, it returns the URL unchanged.
*
* @param path
* the URI path to the resource. This must be either
* an absolute URL (e.g.
* <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
* or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
*
* @exception java.lang.IllegalArgumentException
* if path doesn't have a leading slash or is not an absolute URL
*
* @return the encoded resource URL as string
*/
public String encodeURL (String path);
}

89
fine-portlet-api/src/com/fr/third/javax/portlet/PortletSecurityException.java

@ -0,0 +1,89 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* A portlet should throw a <CODE>PortletSecurityException</CODE>
* when a call fails because of security reasons.<br>
* Additionally it can be thrown by the portal/portlet-container.
*/
public class PortletSecurityException extends PortletException
{
private PortletSecurityException ()
{
}
/**
* Constructs a new security exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public PortletSecurityException (String text)
{
super (text);
}
/**
* Constructs a new portlet security exception when the portlet needs to do
* the following:
* <ul>
* <il>throw an exception
* <li>include a message about the "root cause" that interfered
* with its normal operation
* <li>include a description message
* </ul>
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public PortletSecurityException (String text, Throwable cause)
{
super(text, cause);
}
/**
* Constructs a new portlet security exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public PortletSecurityException (Throwable cause)
{
super(cause);
}
}

377
fine-portlet-api/src/com/fr/third/javax/portlet/PortletSession.java

@ -0,0 +1,377 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletSession</CODE> interface provides a way to identify a user
* across more than one request and to store transient information about that user.
* <p>
* A <code>PortletSession</code> is created per user client per portlet application.
* <p>
* A portlet can bind an object attribute into a <code>PortletSession</code> by name.
* The <code>PortletSession</code> interface defines two scopes for storing objects:
* <ul>
* <li><code>APPLICATION_SCOPE</code>
* <li><code>PORTLET_SCOPE</code>
* </ul>
* All objects stored in the session using the <code>APPLICATION_SCOPE</code>
* must be available to all the portlets, servlets and
* JSPs that belongs to the same portlet application and that handles a
* request identified as being a part of the same session.
* Objects stored in the session using the <code>PORTLET_SCOPE</code> must be
* available to the portlet during requests for the same portlet window
* that the objects where stored from. Attributes stored in the
* <code>PORTLET_SCOPE</code> are not protected from other web components
* of the portlet application. They are just conveniently namespaced.
* <P>
* The portlet session is based on the <code>HttpSession</code>. Therefore all
* <code>HttpSession</code> listeners do apply to the portlet session and
* attributes set in the portlet session are visible in the <code>HttpSession</code>
* and vice versa.
*/
public interface PortletSession
{
/**
* This constant defines an application wide scope for the session attribute.
* <code>APPLICATION_SCOPE</code> session attributes enable Portlets
* within one portlet application to share data.
* <p>
* Portlets may need to prefix attributes set in this scope with some
* ID, to avoid overwriting each other's attributes in the
* case where two portlets of the same portlet definition
* are created.
* <p>
* Value: <code>0x01</code>
*/
public static final int APPLICATION_SCOPE = 0x01;
/**
* This constant defines the scope of the session attribute to be
* private to the portlet and its included resources.
* <p>
* Value: <code>0x02</code>
*/
public static final int PORTLET_SCOPE = 0x02;
/**
* Returns the object bound with the specified name in this session
* under the <code>PORTLET_SCOPE</code>, or <code>null</code> if no
* object is bound under the name in that scope.
*
* @param name a string specifying the name of the object
*
* @return the object with the specified name for
* the <code>PORTLET_SCOPE</code>.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session.
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.lang.Object getAttribute(java.lang.String name);
/**
* Returns the object bound with the specified name in this session,
* or <code>null</code> if no object is bound under the name in the given scope.
*
* @param name a string specifying the name of the object
* @param scope session scope of this attribute
*
* @return the object with the specified name
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public java.lang.Object getAttribute(java.lang.String name,int scope);
/**
* Returns an <code>Enumeration</code> of String objects containing the names of
* all the objects bound to this session under the <code>PORTLET_SCOPE</code>, or an
* empty <code>Enumeration</code> if no attributes are available.
*
* @return an <code>Enumeration</code> of
* <code>String</code> objects specifying the
* names of all the objects bound to
* this session, or an empty <code>Enumeration</code>
* if no attributes are available.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
*/
public java.util.Enumeration getAttributeNames();
/**
* Returns an <code>Enumeration</code> of String objects containing the names of
* all the objects bound to this session in the given scope, or an
* empty <code>Enumeration</code> if no attributes are available in the
* given scope.
*
* @param scope session scope of the attribute names
*
* @return an <code>Enumeration</code> of
* <code>String</code> objects specifying the
* names of all the objects bound to
* this session, or an empty <code>Enumeration</code>
* if no attributes are available in the given scope.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
*/
public java.util.Enumeration getAttributeNames(int scope);
/**
* Returns the time when this session was created, measured in
* milliseconds since midnight January 1, 1970 GMT.
*
* @return a <code>long</code> specifying
* when this session was created,
* expressed in
* milliseconds since 1/1/1970 GMT
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
*/
public long getCreationTime();
/**
* Returns a string containing the unique identifier assigned to this session.
*
* @return a string specifying the identifier
* assigned to this session
*/
public java.lang.String getId();
/**
* Returns the last time the client sent a request associated with this session,
* as the number of milliseconds since midnight January 1, 1970 GMT.
*
* <p>Actions that your portlet takes, such as getting or setting
* a value associated with the session, do not affect the access
* time.
*
* @return a <code>long</code>
* representing the last time
* the client sent a request associated
* with this session, expressed in
* milliseconds since 1/1/1970 GMT
*/
public long getLastAccessedTime();
/**
* Returns the maximum time interval, in seconds, for which the portlet container
* keeps this session open between client accesses. After this interval,
* the portlet container invalidates the session. The maximum time
* interval can be set
* with the <code>setMaxInactiveInterval</code> method.
* A negative time indicates the session should never timeout.
*
* @return an integer specifying the number of
* seconds this session remains open
* between client requests
*
* @see #setMaxInactiveInterval
*/
public int getMaxInactiveInterval();
/**
* Invalidates this session (all scopes) and unbinds any objects bound to it.
* <p>
* Invalidating the portlet session will result in invalidating the underlying
* <code>HttpSession</code>
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has already been invalidated
*/
public void invalidate();
/**
* Returns true if the client does not yet know about the session or
* if the client chooses not to join the session.
*
* @return <code>true</code> if the
* server has created a session,
* but the client has not joined yet.
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has already been invalidated
*
*/
public boolean isNew();
/**
* Removes the object bound with the specified name under
* the <code>PORTLET_SCOPE</code> from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
*
* @param name the name of the object to be
* removed from this session in the
* <code> PORTLET_SCOPE</code>.
*
* @exception java.lang.IllegalStateException
* if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void removeAttribute(String name) ;
/**
* Removes the object bound with the specified name and the given scope from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
*
* @param name the name of the object to be
* removed from this session
* @param scope session scope of this attribute
*
* @exception java.lang.IllegalStateException
* if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void removeAttribute(String name, int scope) ;
/**
* Binds an object to this session under the <code>PORTLET_SCOPE</code>, using the name specified.
* If an object of the same name in this scope is already bound to the session,
* that object is replaced.
*
* <p>After this method has been executed, and if the new object
* implements <code>HttpSessionBindingListener</code>,
* the container calls
* <code>HttpSessionBindingListener.valueBound</code>. The container then
* notifies any <code>HttpSessionAttributeListeners</code> in the web
* application.
* <p>If an object was already bound to this session
* that implements <code>HttpSessionBindingListener</code>, its
* <code>HttpSessionBindingListener.valueUnbound</code> method is called.
*
* <p>If the value is <code>null</code>, this has the same effect as calling
* <code>removeAttribute()</code>.
*
*
* @param name the name to which the object is bound under
* the <code>PORTLET_SCOPE</code>;
* this cannot be <code>null</code>.
* @param value the object to be bound
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void setAttribute(java.lang.String name, java.lang.Object value);
/**
* Binds an object to this session in the given scope, using the name specified.
* If an object of the same name in this scope is already bound to the session,
* that object is replaced.
*
* <p>After this method has been executed, and if the new object
* implements <code>HttpSessionBindingListener</code>,
* the container calls
* <code>HttpSessionBindingListener.valueBound</code>. The container then
* notifies any <code>HttpSessionAttributeListeners</code> in the web
* application.
* <p>If an object was already bound to this session
* that implements <code>HttpSessionBindingListener</code>, its
* <code>HttpSessionBindingListener.valueUnbound</code> method is called.
*
* <p>If the value is <code>null</code>, this has the same effect as calling
* <code>removeAttribute()</code>.
*
*
* @param name the name to which the object is bound;
* this cannot be <code>null</code>.
* @param value the object to be bound
* @param scope session scope of this attribute
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is <code>null</code>.
*/
public void setAttribute(java.lang.String name, java.lang.Object value, int scope);
/**
* Specifies the time, in seconds, between client requests, before the
* portlet container invalidates this session. A negative time
* indicates the session should never timeout.
*
* @param interval An integer specifying the number
* of seconds
*/
public void setMaxInactiveInterval(int interval);
/**
* Returns the portlet application context associated with this session.
*
* @return the portlet application context
*/
public PortletContext getPortletContext ();
}

90
fine-portlet-api/src/com/fr/third/javax/portlet/PortletSessionUtil.java

@ -0,0 +1,90 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletSessionUtil</CODE> class helps identify and decode
* attributes in the <CODE>PORTLET_SCOPE</CODE> scope of the PortletSession
* when accessed through the HttpSession an from within calls to methods
* of the HttpSessionBindingListener interface.
*/
public class PortletSessionUtil
{
private static final String PORTLET_SCOPE_NAMESPACE = "javax.portlet.p.";
/**
* Returns the attribute name of an attribute in the
* <code>PORTLET_SCOPE</code>. If the attribute is in the
* <code>APPLICATION_SCOPE</code> it returns the attribute name unchanged.
*
* @param name a string specifying the name of the
* encoded portlet attribute
*
* @return the decoded attribute name
*/
public static java.lang.String decodeAttributeName(java.lang.String name)
{
if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) {
int index = name.indexOf('?');
if (index>-1) {
name = name.substring(index+1);
}
}
return name;
}
/**
* Returns the portlet attribute scope from an encoded portlet
* attribute.
* <br>Possible return values are:
* <ul>
* <li><code>PortletSession.APPLICATION_SCOPE</code></li>
* <li><code>PortletSession.PORTLET_SCOPE</code></li>
* </ul>
*
* @param name a string specifying the name of the
* encoded portlet attribute
*
* @return the decoded attribute scope
* @see PortletSession
*/
public static int decodeScope(java.lang.String name)
{
int scope = PortletSession.APPLICATION_SCOPE; // APP
if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) {
int index = name.indexOf('?');
if (index>-1) {
scope = PortletSession.PORTLET_SCOPE; // PORTLET
}
}
return scope;
}
}

211
fine-portlet-api/src/com/fr/third/javax/portlet/PortletURL.java

@ -0,0 +1,211 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PortletURL</CODE> interface represents a URL
* that reference the portlet itself.
* <p>
* A PortletURL is created through the <CODE>RenderResponse</CODE>.
* Parameters, a portlet mode, a window state and a security level
* can be added to <CODE>PortletURL</CODE> objects. The PortletURL
* must be converted to a String in order to embed it into
* the markup generated by the portlet.
* <P>
* There are two types of PortletURLs:
* <ul>
* <li>Action URLs, they are created with <CODE>RenderResponse.createActionURL</CODE>, and
* trigger an action request followed by a render request.
* <li>Render URLs, they are created with <CODE>RenderResponse.createRenderURL</CODE>, and
* trigger a render request.
* </ul>
* <p>
* The string reprensentation of a PortletURL does not need to be a valid
* URL at the time the portlet is generating its content. It may contain
* special tokens that will be converted to a valid URL, by the portal,
* before the content is returned to the client.
*/
public interface PortletURL
{
/**
* Indicates the window state the portlet should be in, if this
* portlet URL triggers a request.
* <p>
* A URL can not have more than one window state attached to it.
* If more than one window state is set only the last one set
* is attached to the URL.
*
* @param windowState
* the portlet window state
*
* @exception WindowStateException
* if the portlet cannot switch to this state,
* because the portal does not support this state, the portlet has not
* declared in its deployment descriptor that it supports this state, or the current
* user is not allowed to switch to this state.
* The <code>PortletRequest.isWindowStateAllowed()</code> method can be used
* to check if the portlet can set a given window state.
* @see PortletRequest#isWindowStateAllowed
*/
public void setWindowState (WindowState windowState)
throws WindowStateException;
/**
* Indicates the portlet mode the portlet must be in, if this
* portlet URL triggers a request.
* <p>
* A URL can not have more than one portlet mode attached to it.
* If more than one portlet mode is set only the last one set
* is attached to the URL.
*
* @param portletMode
* the portlet mode
*
* @exception PortletModeException
* if the portlet cannot switch to this mode,
* because the portal does not support this mode, the portlet has not
* declared in its deployment descriptor that it supports this mode for the current markup,
* or the current user is not allowed to switch to this mode.
* The <code>PortletRequest.isPortletModeAllowed()</code> method can be used
* to check if the portlet can set a given portlet mode.
* @see PortletRequest#isPortletModeAllowed
*/
public void setPortletMode (PortletMode portletMode)
throws PortletModeException;
/**
* Sets the given String parameter to this URL.
* <p>
* This method replaces all parameters with the given key.
* <p>
* The <code>PortletURL</code> implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* <p>
* A portlet container may prefix the attribute names internally
* in order to preserve a unique namespace for the portlet.
*
* @param name
* the parameter name
* @param value
* the parameter value
*
* @exception java.lang.IllegalArgumentException
* if name or value are <code>null</code>.
*/
public void setParameter (String name, String value);
/**
* Sets the given String array parameter to this URL.
* <p>
* This method replaces all parameters with the given key.
* <p>
* The <code>PortletURL</code> implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* <p>
* A portlet container may prefix the attribute names internally
* in order to preserve a unique namespace for the portlet.
*
* @param name
* the parameter name
* @param values
* the parameter values
*
* @exception java.lang.IllegalArgumentException
* if name or values are <code>null</code>.
*/
public void setParameter (String name, String[] values);
/**
* Sets a parameter map for this URL.
* <p>
* All previously set parameters are cleared.
* <p>
* The <code>PortletURL</code> implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* <p>
* A portlet container may prefix the attribute names internally,
* in order to preserve a unique namespace for the portlet.
*
* @param parameters Map containing parameter names for
* the render phase as
* keys and parameter values as map
* values. The keys in the parameter
* map must be of type String. The values
* in the parameter map must be of type
* String array (<code>String[]</code>).
*
* @exception java.lang.IllegalArgumentException
* if parameters is <code>null</code>, if
* any of the key/values in the Map are <code>null</code>,
* if any of the keys is not a String, or if any of
* the values is not a String array.
*/
public void setParameters(java.util.Map parameters);
/**
* Indicated the security setting for this URL.
* <p>
* Secure set to <code>true</code> indicates that the portlet requests
* a secure connection between the client and the portlet window for
* this URL. Secure set to <code>false</code> indicates that the portlet
* does not need a secure connection for this URL. If the security is not
* set for a URL, it will stay the same as the current request.
*
* @param secure true, if portlet requests to have a secure connection
* between its portlet window and the client; false, if
* the portlet does not require a secure connection.
*
* @throws PortletSecurityException if the run-time environment does
* not support the indicated setting
*/
public void setSecure (boolean secure) throws PortletSecurityException;
/**
* Returns the portlet URL string representation to be embedded in the
* markup.<br>
* Note that the returned String may not be a valid URL, as it may
* be rewritten by the portal/portlet-container before returning the
* markup to the client.
*
* @return the encoded URL as a string
*/
public String toString ();
}

53
fine-portlet-api/src/com/fr/third/javax/portlet/PreferencesValidator.java

@ -0,0 +1,53 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>PreferencesValidator</CODE> allows to validate the set of
* preferences of the associated portlet just before they are
* stored in the persistent store.
* <p>
* The portlet container invokes the <code>validate</code> method as
* part of the invocation of the <code>store</code> method of the
* <code>PortletPreferences</code>.
*/
public interface PreferencesValidator
{
/**
* If the preferences values are successfully validated the call to this method
* must finish gracefully. Otherwise it must throw a <code>ValidatorException</code>.
*
* @param preferences preferences to validate
*
* @throws ValidatorException if the given preferences contains invalid
* settings
*
*/
public void validate(PortletPreferences preferences)
throws ValidatorException;
}

88
fine-portlet-api/src/com/fr/third/javax/portlet/ReadOnlyException.java

@ -0,0 +1,88 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>ReadOnlyException</CODE> is thrown when a portlet tries
* to change the value for a read-only preference attribute.
*/
public class ReadOnlyException extends PortletException
{
private ReadOnlyException ()
{
}
/**
* Constructs a new read-only exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public ReadOnlyException (String text)
{
super (text);
}
/**
* Constructs a new read-only exception when the portlet needs to do
* the following:
* <ul>
* <il>throw an exception
* <li>include a message about the "root cause" that interfered
* with its normal operation
* <li>include a description message
* </ul>
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public ReadOnlyException (String text, Throwable cause)
{
super(text, cause);
}
/**
* Constructs a new read-only exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public ReadOnlyException (Throwable cause)
{
super(cause);
}
}

43
fine-portlet-api/src/com/fr/third/javax/portlet/RenderRequest.java

@ -0,0 +1,43 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>RenderRequest</CODE> represents the request sent to the portlet
* to handle a render.
* It extends the PortletRequest interface to provide render request
* information to portlets.<br>
* The portlet container creates a <CODE>RenderRequest</CODE> object and
* passes it as argument to the portlet's <CODE>render</CODE> method.
*
* @see PortletRequest
* @see ActionRequest
*/
public interface RenderRequest extends PortletRequest
{
}

342
fine-portlet-api/src/com/fr/third/javax/portlet/RenderResponse.java

@ -0,0 +1,342 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>RenderResponse</CODE> defines an object to assist a portlet in
* sending a response to the portal.
* It extends the <CODE>PortletResponse</CODE> interface to provide specific
* render response functionality to portlets.<br>
* The portlet container creates a <CODE>RenderResponse</CODE> object and
* passes it as argument to the portlet's <CODE>render</CODE> method.
*
* @see RenderRequest
* @see PortletResponse
*/
public interface RenderResponse extends PortletResponse
{
/**
* Property to set the expiration time in seconds for this
* response using the <code>setProperty</code> method.
* <P>
* If the expiration value is set to 0, caching is disabled
* for this portlet; if the value is set to -1,
* the cache does not expire.
* <p>
* The value is <code>"portlet.expiration-cache"</code>.
*/
public static final String EXPIRATION_CACHE = "portlet.expiration-cache";
/**
* Returns the MIME type that can be used to contribute
* markup to the render response.
* <p>
* If no content type was set previously using the {@link #setContentType} method
* this method retuns <code>null</code>.
*
* @see #setContentType
*
* @return the MIME type of the response, or <code>null</code>
* if no content type is set
*/
public String getContentType ();
/**
* Creates a portlet URL targeting the portlet. If no portlet mode,
* window state or security modifier is set in the PortletURL the
* current values are preserved. If a request is triggered by the
* PortletURL, it results in a render request.
* <p>
* The returned URL can be further extended by adding
* portlet-specific parameters and portlet modes and window states.
* <p>
* The created URL will per default not contain any parameters
* of the current render request.
*
* @return a portlet render URL
*/
public PortletURL createRenderURL ();
/**
* Creates a portlet URL targeting the portlet. If no portlet mode,
* window state or security modifier is set in the PortletURL the
* current values are preserved. If a request is triggered by the
* PortletURL, it results in an action request.
* <p>
* The returned URL can be further extended by adding
* portlet-specific parameters and portlet modes and window states.
* <p>
* The created URL will per default not contain any parameters
* of the current render request.
*
* @return a portlet action URL
*/
public PortletURL createActionURL ();
/**
* The value returned by this method should be prefixed or appended to
* elements, such as JavaScript variables or function names, to ensure
* they are unique in the context of the portal page.
*
* @return the namespace
*/
public String getNamespace ();
/**
* This method sets the title of the portlet.
* <p>
* The value can be a text String
*
* @param title portlet title as text String or resource URI
*/
public void setTitle(String title);
/**
* Sets the MIME type for the render response. The portlet must
* set the content type before calling {@link #getWriter} or
* {@link #getPortletOutputStream}.
* <p>
* Calling <code>setContentType</code> after <code>getWriter</code>
* or <code>getOutputStream</code> does not change the content type.
*
* @param type the content MIME type
*
* @throws java.lang.IllegalArgumentException
* if the given type is not in the list returned
* by <code>PortletRequest.getResponseContentTypes</code>
*
* @see RenderRequest#getResponseContentTypes
* @see #getContentType
*/
public void setContentType(String type);
/**
* Returns the name of the charset used for
* the MIME body sent in this response.
*
* <p>See <a href="http://ds.internic.net/rfc/rfc2045.txt">RFC 2047</a>
* for more information about character encoding and MIME.
*
* @return a <code>String</code> specifying the
* name of the charset, for
* example, <code>ISO-8859-1</code>
*
*/
public String getCharacterEncoding();
/**
* Returns a PrintWriter object that can send character
* text to the portal.
* <p>
* Before calling this method the content type of the
* render response must be set using the {@link #setContentType}
* method.
* <p>
* Either this method or {@link #getPortletOutputStream} may be
* called to write the body, not both.
*
* @return a <code>PrintWriter</code> object that
* can return character data to the portal
*
* @exception java.io.IOException
* if an input or output exception occurred
* @exception java.lang.IllegalStateException
* if the <code>getPortletOutputStream</code> method
* has been called on this response,
* or if no content type was set using the
* <code>setContentType</code> method.
*
* @see #setContentType
* @see #getPortletOutputStream
*/
public java.io.PrintWriter getWriter() throws java.io.IOException;
/**
* Returns the locale assigned to the response.
*
* @return Locale of this response
*/
public java.util.Locale getLocale();
/**
* Sets the preferred buffer size for the body of the response.
* The portlet container will use a buffer at least as large as
* the size requested.
* <p>
* This method must be called before any response body content is
* written; if content has been written, or the portlet container
* does not support buffering, this method may throw an
* <code>IllegalStateException</code>.
*
* @param size the preferred buffer size
*
* @exception java.lang.IllegalStateException
* if this method is called after
* content has been written, or the
* portlet container does not support buffering
*
* @see #getBufferSize
* @see #flushBuffer
* @see #isCommitted
* @see #reset
*/
public void setBufferSize(int size);
/**
* Returns the actual buffer size used for the response. If no buffering
* is used, this method returns 0.
*
* @return the actual buffer size used
*
* @see #setBufferSize
* @see #flushBuffer
* @see #isCommitted
* @see #reset
*/
public int getBufferSize();
/**
* Forces any content in the buffer to be written to the client. A call
* to this method automatically commits the response.
*
* @exception java.io.IOException if an error occured when writing the output
*
* @see #setBufferSize
* @see #getBufferSize
* @see #isCommitted
* @see #reset
*/
public void flushBuffer() throws java.io.IOException;
/**
* Clears the content of the underlying buffer in the response without
* clearing properties set. If the response has been committed,
* this method throws an <code>IllegalStateException</code>.
*
* @exception IllegalStateException if this method is called after
* response is comitted
*
* @see #setBufferSize
* @see #getBufferSize
* @see #isCommitted
* @see #reset
*/
public void resetBuffer();
/**
* Returns a boolean indicating if the response has been
* committed.
*
* @return a boolean indicating if the response has been
* committed
*
* @see #setBufferSize
* @see #getBufferSize
* @see #flushBuffer
* @see #reset
*/
public boolean isCommitted();
/**
* Clears any data that exists in the buffer as well as the properties set.
* If the response has been committed, this method throws an
* <code>IllegalStateException</code>.
*
* @exception java.lang.IllegalStateException if the response has already been
* committed
*
* @see #setBufferSize
* @see #getBufferSize
* @see #flushBuffer
* @see #isCommitted
*/
public void reset();
/**
* Returns a <code>OutputStream</code> suitable for writing binary
* data in the response. The portlet container does not encode the
* binary data.
* <p>
* Before calling this method the content type of the
* render response must be set using the {@link #setContentType}
* method.
* <p>
* Calling <code>flush()</code> on the OutputStream commits the response.
* <p>
* Either this method or {@link #getWriter} may be called to write the body, not both.
*
* @return a <code>OutputStream</code> for writing binary data
*
* @exception java.lang.IllegalStateException if the <code>getWriter</code> method
* has been called on this response, or
* if no content type was set using the
* <code>setContentType</code> method.
*
* @exception java.io.IOException if an input or output exception occurred
*
* @see #setContentType
* @see #getWriter
*/
public java.io.OutputStream getPortletOutputStream() throws java.io.IOException;
}

134
fine-portlet-api/src/com/fr/third/javax/portlet/UnavailableException.java

@ -0,0 +1,134 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The portlet should throw the <CODE>UnavailableException</CODE> when
* the portlet is either temporarily or permanently unavailable to handle requests.
*
**/
public class UnavailableException extends PortletException
{
private boolean permanent; // needs admin action?
private int seconds; // unavailability estimate
/**
*
* Constructs a new exception with a descriptive
* message indicating that the portlet is permanently
* unavailable.
*
* @param text a <code>String</code> specifying the
* descriptive message
*
*/
public UnavailableException(String text) {
super(text);
permanent = true;
}
/**
* Constructs a new exception with a descriptive message
* indicating that the portlet is temporarily unavailable
* and giving an estimate of how long it will be unavailable.
*
* <p>In some cases, the portlet cannot make an estimate. For
* example, the portlet might know that a server it needs is
* not running, but it might not be able to report how long it will take
* to be restored to functionality. This can be indicated with
* a negative or zero value for the <code>seconds</code> argument.
*
* @param text a <code>String</code> specifying the
* descriptive message. This message can be written
* to a log file or displayed for the user.
*
* @param seconds an integer specifying the number of seconds
* for which the portlet expects to be unavailable; if
* this is zero or negative, it indicates that the portlet
* cannot make an estimate.
*
*/
public UnavailableException(String text, int seconds) {
super(text);
if (seconds <= 0)
this.seconds = -1;
else
this.seconds = seconds;
permanent = false;
}
/**
*
* Returns a <code>boolean</code> indicating
* whether the portlet is permanently unavailable.
* If so, something is wrong with the portlet, and the
* system administrator must take some corrective action.
*
* @return <code>true</code> if the portlet is
* permanently unavailable; <code>false</code>
* if the portlet is temporarily
* unavailable.
*
*/
public boolean isPermanent() {
return permanent;
}
/**
* Returns the time in seconds for which the portlet can be expected to
* be unavailable.
* <p>
* If the portlet is called again while it is still unavailable, it
* indicates the same time estimate. No effort is
* made to correct for the time elapsed since the exception was
* first reported.
* <p>
* If this method returns zero or a negative number, the portlet
* is permanently unavailable or cannot provide an estimate of
* how long it will be unavailable.
*
* @return an integer specifying the number of seconds
* the portlet will be temporarily unavailable,
* or zero or a negative number if the portlet is permanently
* unavailable or cannot make an estimate.
*
*/
public int getUnavailableSeconds() {
return permanent ? -1 : seconds;
}
}

132
fine-portlet-api/src/com/fr/third/javax/portlet/ValidatorException.java

@ -0,0 +1,132 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
/**
* The <CODE>ValidatorException</CODE> is thrown by the
* <CODE>validate</CODE> method of a PreferencesValidator when
* the validation of a preference failed.
*/
public class ValidatorException extends PortletException
{
private transient ArrayList failedKeyVector = new ArrayList();
private ValidatorException ()
{
}
/**
* Constructs a new validator exception with the given text. The
* portlet container may use the text write it to a log.
* <p>
* The collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be <code>null</code>.
*
* @param text
* the exception text
* @param failedKeys
* keys that failed the validation; may be <code>null</code>
*/
public ValidatorException (String text, Collection failedKeys)
{
super (text);
if ( failedKeys != null )
failedKeyVector.addAll(failedKeys);
}
/**
* Constructs a new portlet validator exception.
* Used, when the portlet needs to do one of the following:
* <ul>
* <il>throw an exception
* <li>include a message about the "root cause" that interfered
* with its normal operation
* <li>include a description message
* </ul>
* <p>
* The Collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be <code>null</code>.
*
* @param text
* the exception text
* @param cause
* the root cause
* @param failedKeys
* keys that failed the validation; may be <code>null</code>
*/
public ValidatorException (String text, Throwable cause, Collection failedKeys)
{
super(text, cause);
if ( failedKeys != null )
failedKeyVector.addAll(failedKeys);
}
/**
* Constructs a new portlet validator exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
* <p>
* The Collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be <code>null</code>.
*
* @param cause
* the root cause
* @param failedKeys
* keys that failed the validation; may be <code>null</code>
*/
public ValidatorException (Throwable cause, Collection failedKeys)
{
super(cause);
if ( failedKeys != null )
failedKeyVector.addAll(failedKeys);
}
/**
* Returns the keys that failed the validation.
* <p>
* The Enumeration of failed keys may contain all failed keys, only the
* first key that failed validation, or an empty
* <code>Enumeration</code> if no failed keys are available.
*
* @return the keys that failed validation, or an empty
* <code>Enumeration</code> if no failed keys are available.
*/
public Enumeration getFailedKeys()
{
return Collections.enumeration(failedKeyVector);
}
}

135
fine-portlet-api/src/com/fr/third/javax/portlet/WindowState.java

@ -0,0 +1,135 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
* The <CODE>WindowState</CODE> class represents
* the possible window states that a portlet window can assume.
* <P>
* This class defines a standard set of the most basic portlet window states.
* Additional window states may be defined by calling the constructor of
* this class. If a portal/portlet-container does not support a
* custom window state defined in the portlet application deployment descriptor,
* the custom window state will be ignored by the portal/portlet container.
*/
public class WindowState
{
/**
* The <code>NORMAL</code> window state indicates that a portlet
* may be sharing the page with other portlets. It may also
* indicate that the target device has limited display capabilities.
* Therefore, a portlet should restrict the size of its rendered
* output in this window state.
* <p>
* The string value for this state is <code>"normal"</code>.
*/
public final static WindowState NORMAL = new WindowState ("normal");
/**
* The <code>MAXIMIZED</code> window state is an indication
* that a portlet may be the only portlet being rendered in the
* portal page, or that the portlet has more space compared to other portlets
* in the portal page. A portlet may generate richer content
* when its window state is <code>MAXIMIZED</code>.
* <p>
* The string value for this state is <code>"maximized"</code>.
*/
public final static WindowState MAXIMIZED = new WindowState ("maximized");
/**
* When a portlet is in <code>MINIMIZED</code> window state,
* the portlet should only render minimal output or no output at all.
* <p>
* The string value for this state is <code>"minimized"</code>.
*/
public final static WindowState MINIMIZED = new WindowState ("minimized");
private String _name;
/**
* Creates a new window state with the given name.
* <p>
* Upper case letters in the name are converted to
* lower case letters.
*
* @param name The name of the portlet mode
*/
public WindowState(String name) {
if (name==null) {
throw new IllegalArgumentException("WindowState name can not be NULL");
}
_name = name.toLowerCase();
}
/**
* Returns a String representation of this window state.
* Window state names are always lower case names.
*
* @return String representation of this window state.
*/
public String toString() {
return _name;
}
/**
* Returns the hash code value for this window state.
* The hash code is constructed by producing the
* hash value of the String value of this window state.
*
* @return hash code value for this window state
*/
public int hashCode() {
return _name.hashCode();
}
/**
* Compares the specified object with this window state
* for equality. Returns <code>true</code> if the
* Strings <code>equals</code> method for the String
* representing the two window states returns <code>true</code>.
*
* @param object the window state to compare this window state with.
*
* @return true, if the specified object is equal with this window state.
*/
public boolean equals(Object object) {
if ( object instanceof WindowState )
return _name.equals(((WindowState) object)._name);
else
return false;
}
}

105
fine-portlet-api/src/com/fr/third/javax/portlet/WindowStateException.java

@ -0,0 +1,105 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package com.fr.third.javax.portlet;
/**
** The <CODE>WindowStateException</CODE> is thrown when a portlet
** tries to use a window state that is not supported by the current
** runtime environment or the portlet.
**/
public class WindowStateException extends PortletException
{
private transient WindowState _state = null;
/**
* Constructs a new portlet state exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
* @param state
* the state causing the exception
*/
public WindowStateException (String text, WindowState state)
{
super (text);
_state = state;
}
/**
* Constructs a new portlet state exception when the portlet needs to do
* the following:
* <ul>
* <il>throw an exception
* <li>include a message about the "root cause" that interfered
* with its normal operation
* <li>include a description message
* </ul>
*
* @param text
* the exception text
* @param cause
* the root cause
* @param state
* the state causing the exception
*/
public WindowStateException (String text, Throwable cause, WindowState state)
{
super(text, cause);
_state = state;
}
/**
* Constructs a new portlet state exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
* @param state
* the state causing the exception
*/
public WindowStateException (Throwable cause, WindowState state)
{
super(cause);
_state = state;
}
/**
* Returns the portlet state causing this exception.
*
* @return the window state causing this exception
*/
public WindowState getState()
{
return _state;
}
}

38
fine-portlet-api/src/com/fr/third/javax/portlet/package-info.java

@ -0,0 +1,38 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* The com.fr.third.javax.portlet package defines the API for portlets.
* <p>
* A portlet is a Java technology based web component, managed by a portlet container,
* that processes requests and generates dynamic content. Portlets provide a presentation
* layer to Information Systems.
* <p>
* Portlets generate fragments of markup (e.g. HTML, XHTML, WML). A portal combines markup
* fragments generated by different portlets into a portal page.
* <p>
* A portlet container manages the lifecyle of portlets. It also provides the required runtime environment.
* <p>
* Portlets are bundled in Portlet Applications as web applications using the WAR file format.
* A portlet application consists of two deployment descriptors: one to specify
* the web application resources (web.xml) and one to specify the portlet resources
* (portlet.xml). The portlet.xml deployment descriptor must conform to the schema identified
* by the namespace http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd.
* <p>
*/
package com.fr.third.javax.portlet;
Loading…
Cancel
Save