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.wsrp;
023:
024: import org.jboss.portal.api.event.PortalEventListener;
025: import org.jboss.portal.portlet.PortletInvoker;
026: import org.jboss.portal.portlet.PortletInvokerException;
027: import org.jboss.portal.portlet.invocation.PortletInvocation;
028: import org.jboss.portal.wsrp.consumer.ProducerInfo;
029: import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
030: import org.jboss.portal.wsrp.consumer.RefreshResult;
031: import org.jboss.system.Service;
032:
033: import javax.servlet.http.HttpSession;
034:
035: /**
036: * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
037: * @author <a href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.wsrp.WSRPConsumer">Chris Laprun</a>
038: * @version $Revision: 8782 $
039: * @since 2.4
040: */
041: public interface WSRPConsumer extends PortletInvoker, Service,
042: PortalEventListener {
043: /**
044: * Retrieves the identifier for the producer this consumer is associated with.
045: *
046: * @return the identifier of the associated producer
047: */
048: String getProducerId();
049:
050: /**
051: * Retrieves the session information for the producer associated with this consumer.
052: *
053: * @param invocation a portlet invocation from which the session information should be extracted.
054: * @return the session information for the producer associated with this consumer.
055: * @see ProducerSessionInformation
056: */
057: ProducerSessionInformation getProducerSessionInformationFrom(
058: PortletInvocation invocation);
059:
060: /**
061: * Retrieves the session information for the producer associated with this consumer.
062: *
063: * @param session the session from the information should be extracted.
064: * @return the session information for the producer associated with this consumer.
065: * @see ProducerSessionInformation
066: */
067: ProducerSessionInformation getProducerSessionInformationFrom(
068: HttpSession session);
069:
070: /**
071: * @return
072: * @since 2.6
073: */
074: ProducerInfo getProducerInfo();
075:
076: /**
077: * @param producerInfo
078: * @since 2.6
079: */
080: void setProducerInfo(ProducerInfo producerInfo);
081:
082: /**
083: * @throws PortletInvokerException
084: * @since 2.6
085: */
086: void refreshProducerInfo() throws PortletInvokerException;
087:
088: /**
089: * Releases all the sessions held by this Consumer
090: *
091: * @since 2.6
092: */
093: void releaseSessions() throws PortletInvokerException;
094:
095: /**
096: * Prepares this Consumer to be used: service is started, endpoints are ready.
097: *
098: * @throws Exception
099: * @since 2.6
100: */
101: void activate() throws Exception;
102:
103: /**
104: * Removes this Consumer from service. It cannot be used before being activated again.
105: *
106: * @throws Exception
107: * @since 2.6
108: */
109: void deactivate() throws Exception;
110:
111: /**
112: * @return
113: * @since 2.6
114: */
115: boolean isActive();
116:
117: /**
118: * @return
119: * @since 2.6
120: */
121: boolean isRefreshNeeded();
122:
123: /**
124: * @param forceRefresh
125: * @return
126: * @since 2.6
127: */
128: RefreshResult refresh(boolean forceRefresh)
129: throws PortletInvokerException;
130: }
|