001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.core.model.instance;
023:
024: import org.jboss.portal.common.i18n.LocalizedString;
025: import org.jboss.portal.portlet.Portlet;
026: import org.jboss.portal.portlet.PortletInvokerException;
027: import org.jboss.portal.portlet.invocation.PortletInvocation;
028: import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
029: import org.jboss.portal.portlet.state.PropertyChange;
030: import org.jboss.portal.portlet.state.PropertyMap;
031:
032: import java.util.Set;
033:
034: /**
035: * A shared portlet instance.
036: *
037: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
038: * @version $Revision: 9574 $
039: */
040: public interface Instance {
041: /** The attribute name under which the instance id can be accessed. */
042: String INSTANCE_ID_ATTRIBUTE = "instanceid";
043:
044: /**
045: * Return the id.
046: *
047: * @return the id
048: */
049: String getId();
050:
051: /**
052: * Return the display name
053: *
054: * @return the display name
055: */
056: LocalizedString getDisplayName();
057:
058: /**
059: * Set the display name
060: *
061: * @param localizedString
062: */
063: void setDisplayName(LocalizedString localizedString);
064:
065: /**
066: * Return the runtime metadata for this portlet.
067: *
068: * @return the info
069: */
070: Portlet getPortlet() throws PortletInvokerException;
071:
072: /**
073: * Return the container of this object.
074: *
075: * @return the instance container
076: */
077: InstanceContainer getContainer();
078:
079: /**
080: * Invoke the instance
081: *
082: * @param invocation the invocation
083: */
084: PortletInvocationResponse invoke(PortletInvocation invocation)
085: throws PortletInvokerException;
086:
087: /**
088: * Return the instance preferences.
089: *
090: * @return the prefs
091: */
092: PropertyMap getProperties() throws PortletInvokerException;
093:
094: /**
095: * Return the instance preferences.
096: *
097: * @return the prefs
098: */
099: PropertyMap getProperties(Set keys) throws PortletInvokerException;
100:
101: /**
102: * Update the prefs of this instance.
103: *
104: * @param changes the changes
105: */
106: void setProperties(PropertyChange[] changes)
107: throws PortletInvokerException;
108:
109: /**
110: * Return a customization of this instance related to the provided customization id.
111: *
112: * @return an instance customization
113: */
114: InstanceCustomization getCustomization(String customizationId);
115:
116: /**
117: * Destroy the customization
118: *
119: * @param customizationId the id of the customization to destroy
120: */
121: void destroyCustomization(String customizationId);
122: }
|