001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.components.portletregistry;
018:
019: import java.util.Collection;
020: import java.util.Locale;
021:
022: import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
023: import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
024: import org.apache.pluto.om.common.Language;
025: import org.apache.pluto.om.common.ObjectID;
026: import org.apache.pluto.om.portlet.PortletApplicationDefinition;
027: import org.apache.pluto.om.portlet.PortletDefinition;
028:
029: /**
030: * <p>
031: * PortletRegistryComponentImpl
032: * </p>
033: *
034: *
035: * @
036: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
037: * @version $ $
038: *
039: */
040: public interface PortletRegistry {
041:
042: Language createLanguage(Locale locale, String title,
043: String shortTitle, String description, Collection keywords)
044: throws RegistryException;
045:
046: Collection getAllPortletDefinitions();
047:
048: /**
049: * Retreives a PortletApplication by it's unique ObjectID.
050: * The unqiue ObjectID is generally a function of the native
051: * storage mechanism of the container whether it be auto-generated
052: * by an RDBMS, O/R tool or some other mechanism.
053: * This is different than the portlet applaiction's unique indentfier
054: * which is specified within the portlet.xml
055: * @param id
056: * @return
057: */
058: MutablePortletApplication getPortletApplication(ObjectID id);
059:
060: /**
061: * Retreives a PortletApplication by it's unique name. We use
062: * PortletApplicationComposite interface which extends the PortletApplication
063: * and adds additional functionallity to it.
064: * @param id
065: * @return PortletApplicationComposite
066: */
067: MutablePortletApplication getPortletApplication(String name);
068:
069: /**
070: * Locates a portlet application using it's unique <code>identifier</code>
071: * field.
072: * @param identifier Unique id for this portlet application
073: * @return portlet application matching this unique id.
074: */
075: MutablePortletApplication getPortletApplicationByIdentifier(
076: String identifier);
077:
078: Collection getPortletApplications();
079:
080: /**
081: * Locates a portlet using it's unique <code>identifier</code>
082: * field.
083: * <br/>
084: * This method automatically calls {@link getStoreableInstance(PortletDefinitionComposite portlet)}
085: * on the returned <code>PortletEntityInstance</code>
086: * @param identifier Unique id for this portlet
087: * @return Portlet matching this unique id.
088: * @throws java.lang.IllegalStateException If <code>PortletDefinitionComposite != null</code> AND
089: * <code>PortletDefinitionComposite.getPortletApplicationDefinition() == null</code>.
090: * The reason for this is that every PortletDefinition is required to
091: * have a parent PortletApplicationDefinition
092: */
093: PortletDefinitionComposite getPortletDefinitionByIdentifier(
094: String identifier);
095:
096: /**
097: * Locates the portlet defintion by its unique <code>ObjectID</code>.
098: * The ObjectID is generated internally by the portal when the portlet
099: * definition is first registered and has no connection to the information
100: * stored within the <code>portlet.xml</code>.
101: * @param id
102: * @return PortletDefinitionComposite
103: */
104: PortletDefinitionComposite getPortletDefinition(ObjectID id);
105:
106: /**
107: * unique name is a string formed by the combination of a portlet's
108: * unique within it's parent application plus the parent application's
109: * unique name within the portlet container using ":" as a delimiter.
110: * <br/>
111: * <strong>FORMAT: </strong> <i>application name</i>::<i>portlet name</i>
112: * <br/>
113: * <strong>EXAMPLE: </strong> com.myapp.portletApp1::weather-portlet
114: * <br/>
115: * This methos automatically calls {@link getStoreableInstance(PortletDefinitionComposite portlet)}
116: * on the returned <code>PortletEntityInstance</code>
117: * @param name portlets unique name.
118: * @return Portlet that matches the unique name
119: * @throws java.lang.IllegalStateException If <code>PortletDefinitionComposite != null</code> AND
120: * <code>PortletDefinitionComposite.getPortletApplicationDefinition() == null</code>.
121: * The reason for this is that every PortletDefinition is required to
122: * have a parent PortletApplicationDefinition
123: *
124: */
125: PortletDefinitionComposite getPortletDefinitionByUniqueName(
126: String name);
127:
128: /**
129: * Checks whether or not a portlet application with this identity has all ready
130: * been registered to the container.
131: * @param appIdentity portlet application indetity to check for.
132: * @return boolean <code>true</code> if a portlet application with this identity
133: * is alreay registered, <code>false</code> if it has not.
134: */
135: boolean portletApplicationExists(String appIentity);
136:
137: /**
138: *
139: * <p>
140: * namedPortletApplicationExists
141: * </p>
142: *
143: * @param appName
144: * @return
145: */
146: boolean namedPortletApplicationExists(String appName);
147:
148: /**
149: * Checks whether or not a portlet with this identity has all ready
150: * been registered to the container.
151: * @param portletIndentity portlet indetity to check for.
152: * @return boolean <code>true</code> if a portlet with this identity
153: * is alreay registered, <code>false</code> if it has not.
154: */
155: boolean portletDefinitionExists(String portletIndentity);
156:
157: /**
158: * Checks whether or not a portlet with this identity has all ready
159: * been registered to the PortletApplication.
160: * @param portletIndentity portlet indetity to check for.
161: * @param app PortletApplication to check .
162: * @return boolean <code>true</code> if a portlet with this identity
163: * is alreay registered, <code>false</code> if it has not.
164: */
165: boolean portletDefinitionExists(String portletName,
166: MutablePortletApplication app);
167:
168: /**
169: * Creates a new <code>PortletApplicationDefinition</code>
170: * within the Portal.
171: * @param newApp
172: */
173: void registerPortletApplication(PortletApplicationDefinition newApp)
174: throws RegistryException;
175:
176: void removeApplication(PortletApplicationDefinition app)
177: throws RegistryException;
178:
179: /**
180: * Makes any changes to the <code>PortletApplicationDefinition</code>
181: * persistent.
182: * @param app
183: */
184: void updatePortletApplication(PortletApplicationDefinition app)
185: throws RegistryException;
186:
187: /**
188: *
189: * <p>
190: * savePortletDefinition
191: * </p>
192: *
193: * @param portlet
194: * @throws FailedToStorePortletDefinitionException
195: */
196: void savePortletDefinition(PortletDefinition portlet)
197: throws FailedToStorePortletDefinitionException;
198:
199: void addRegistryListener(RegistryEventListener listener);
200:
201: void removeRegistryEventListner(RegistryEventListener listener);
202:
203: }
|