com.ibm.portal.propertybroker.service
Interface PropertyFactory


public interface PropertyFactory

An factory interface provided by the Property Broker. It provides methods for creation of PropertyController, PropertyValue, ActionController and ParameterController objects.

The PropertyFactory interface is implemented by a PortletService. A portlet can obtain the service by using JNDI. A boolean guard may be used to guard uses of the PropertyFactory by the portlet; this will enable the portlet to execute correctly in JSR-168 compliant portlet containers outside of WebSphere Portal. A snippet of the JNDI lookup code:  
 
 
   boolean propertyFactoryAvailable = false;
   PropertyFactory propertyFactory = null;

   try {
     Context ctx = new InitialContext();
     PortletServiceHome serviceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.propertybroker.service.PropertyFactory");
     propertyFactory = (PropertyFactory)serviceHome.getPortletService(com.ibm.portal.propertybroker.service.PropertyFactory.class);
     propertyFactoryAvailable = true;
   }
   catch(Throwable t) {
   }
A similar interface, com.ibm.wps.pb.property.PropertyFactory is available for use by portlets written to IBM's portlet API.

Since:
5.1.0.1

Method Summary
 ActionController PortletRequest)">createAction(PortletRequest request)
          Creates and returns an action associated with a portlet, given the PortletRequest.
 ParameterController createParameter(Action action, Property property)
          Creates and returns a parameter associated with a portlet's action.
 PropertyController PortletRequest)">createProperty(PortletRequest request)
          Creates and returns a property associated with a portlet, given the PortletRequest.
 PropertyValue createPropertyValue(PortletRequest request, Property property, java.lang.Object value)
          Creates and returns a PropertyValue.
 PropertyValue createPropertyValue(PortletRequest request, Property property, java.lang.Object value, PropertyValueChangeType changeType)
          Creates and returns a PropertyValue with a change reason code.
 

Method Detail

createPropertyValue

PropertyValue createPropertyValue(PortletRequest request,
                                  Property property,
                                  java.lang.Object value)
                                  throws CreateFailedException,
                                         AccessFailedException
Creates and returns a PropertyValue. PropertyValue encapsulates a Property with its value.

Parameters:
request - the current portlet request. Must not be null.
property - the Property to be encapsulated in the returned object. Must not be null.
value - the value to be encapsulated in the returned object. May be null.
Returns:
a PropertyValue object encapsulating the information passed in
Throws:
CreateFailedException
AccessFailedException
See Also:
PropertyValue

createPropertyValue

PropertyValue createPropertyValue(PortletRequest request,
                                  Property property,
                                  java.lang.Object value,
                                  PropertyValueChangeType changeType)
                                  throws CreateFailedException,
                                         AccessFailedException
Creates and returns a PropertyValue with a change reason code. PropertyValue encapsulates a Property with its value and a reason the value changed.

Parameters:
request - the current portlet request. Must not be null.
property - the Property to be encapsulated in the returned object. Must not be null.
value - the value to be encapsulated in the returned object. May be null.
changeType - the reason the property value changed
Returns:
a PropertyValue object encapsulating the information passed in
Throws:
CreateFailedException
AccessFailedException
See Also:
PropertyValue

PortletRequest)">

createProperty

PropertyController createProperty(PortletRequest request)
                                  throws CreateFailedException
Creates and returns a property associated with a portlet, given the PortletRequest. PropertyController has setters which allow various attribute values to be set.

Parameters:
request - the PortletRequest object. Must not be null.
Returns:
the new PropertyController object created for this portlet
Throws:
CreateFailedException - if the property cannot be created
See Also:
Property, PropertyController

PortletRequest)">

createAction

ActionController createAction(PortletRequest request)
                              throws CreateFailedException
Creates and returns an action associated with a portlet, given the PortletRequest. ActionController has setters which allow various attribute values of the action to be set.

Parameters:
request - the PortletRequest object. Must not be null
Returns:
the new ActionController object created for this portlet
Throws:
CreateFailedException - if the action cannot be created
See Also:
Action, ActionController

createParameter

ParameterController createParameter(Action action,
                                    Property property)
                                    throws CreateFailedException
Creates and returns a parameter associated with a portlet's action. This will be typically done during the portlet's init() method. Setter methods may be invoked on the returned ParameterController to modify any attributes of the parameter prior to registering the action.

Parameters:
action - the Action the parameter is associated with. Must not be null.
property - the Property the parameter is associated with. Must not be null.
Returns:
the new ParameterController object created for this portlet
Throws:
CreateFailedException - if the parameter cannot be created
See Also:
ParameterController, Action, Property