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.core.model.instance.metadata.InstanceMetaData;
025: import org.jboss.portal.portlet.PortletInvoker;
026: import org.jboss.portal.portlet.PortletInvokerException;
027: import org.jboss.portal.security.spi.provider.AuthorizationDomain;
028:
029: import java.util.Collection;
030:
031: /**
032: * A container for instances of component.
033: *
034: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
035: * @version $Revision: 8786 $
036: */
037: public interface InstanceContainer {
038:
039: /**
040: * Return the underlying portlet invoker for the instance container.
041: *
042: * @return the portlet invoker
043: */
044: PortletInvoker getPortletInvoker();
045:
046: /**
047: * Return the specified instance from its id or null if it does not exist.
048: *
049: * @param id the instance id
050: * @throws IllegalArgumentException if the instance id is null
051: */
052: InstanceDefinition getDefinition(String id)
053: throws IllegalArgumentException;
054:
055: /**
056: * Create a new instance of the specified portlet.
057: *
058: * @param id
059: * @param portletId the portlet id
060: * @return the newly created instance
061: * @throws DuplicateInstanceException if the instance already exist
062: * @throws IllegalArgumentException if the instance id is null
063: */
064: InstanceDefinition createDefinition(String id, String portletId)
065: throws DuplicateInstanceException,
066: IllegalArgumentException, PortletInvokerException;
067:
068: /**
069: * Create a new instance of the specified portlet.
070: *
071: * @param instanceMetaData the instance Metadata
072: * @return the newly created instance
073: * @throws DuplicateInstanceException if the instance already exist
074: * @throws IllegalArgumentException if the instance id is null
075: */
076: InstanceDefinition createDefinition(
077: InstanceMetaData instanceMetaData)
078: throws DuplicateInstanceException,
079: IllegalArgumentException, PortletInvokerException;
080:
081: /**
082: * Create a new instance of the specified portlet.
083: *
084: * @param id
085: * @param portletId the portlet id
086: * @param clone force a clone of the portlet
087: * @return the newly created instance
088: * @throws DuplicateInstanceException if the instance already exist
089: * @throws IllegalArgumentException if the instance id is null
090: */
091: InstanceDefinition createDefinition(String id, String portletId,
092: boolean clone) throws DuplicateInstanceException,
093: IllegalArgumentException, PortletInvokerException;
094:
095: /**
096: * Destroy the specified instance.
097: *
098: * @param id
099: * @throws IllegalArgumentException if the instance id is null
100: */
101: void destroyDefinition(String id) throws NoSuchInstanceException,
102: PortletInvokerException, IllegalArgumentException;
103:
104: /**
105: * Return all the instances in the container.
106: *
107: * @return a collection containing the instances in the container
108: */
109: Collection getDefinitions();
110:
111: /**
112: * Return the AuthorizationDomain
113: *
114: * @return the authorization domain
115: */
116: AuthorizationDomain getAuthorizationDomain();
117: }
|