View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.components.portletregistry;
18  
19  import java.util.Collection;
20  import java.util.Locale;
21  
22  import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
23  import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
24  import org.apache.pluto.om.common.Language;
25  import org.apache.pluto.om.common.ObjectID;
26  import org.apache.pluto.om.portlet.PortletApplicationDefinition;
27  import org.apache.pluto.om.portlet.PortletDefinition;
28  
29  /***
30   * <p>
31   * PortletRegistryComponentImpl
32   * </p>
33   * 
34   * 
35   * @
36   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
37   * @version $ $
38   *
39   */
40  public interface PortletRegistry
41  {
42  
43      Language createLanguage( Locale locale, String title, String shortTitle, String description, Collection keywords )
44      throws RegistryException;
45  
46      Collection getAllPortletDefinitions();
47  
48      /***
49       * Retreives a PortletApplication by it's unique ObjectID.
50       * The unqiue ObjectID is generally a function of the native
51       * storage mechanism of the container whether it be auto-generated
52       * by an RDBMS, O/R tool or some other mechanism.
53       * This is different than the portlet applaiction's unique indentfier
54       * which is specified within the portlet.xml
55       * @param id 
56       * @return
57       */
58      MutablePortletApplication getPortletApplication( ObjectID id );
59  
60      /***
61       * Retreives a PortletApplication by it's unique name.  We use
62       * PortletApplicationComposite interface which extends the PortletApplication
63       * and adds additional functionallity to it.
64       * @param id 
65       * @return PortletApplicationComposite
66       */
67      MutablePortletApplication getPortletApplication( String name );
68  
69      /***
70       * Locates a portlet application using it's unique <code>identifier</code> 
71       * field.
72       * @param identifier Unique id for this portlet application
73       * @return portlet application matching this unique id.
74       */
75      MutablePortletApplication getPortletApplicationByIdentifier( String identifier );
76  
77      Collection getPortletApplications();
78  
79      /***
80       * Locates a portlet using it's unique <code>identifier</code> 
81       * field.
82       * <br/>
83       * This method automatically calls {@link getStoreableInstance(PortletDefinitionComposite portlet)}
84       * on the returned <code>PortletEntityInstance</code>
85       * @param identifier Unique id for this portlet
86       * @return Portlet matching this unique id.
87       * @throws java.lang.IllegalStateException If <code>PortletDefinitionComposite != null</code> AND
88       *  <code>PortletDefinitionComposite.getPortletApplicationDefinition() ==  null</code>.
89       * The reason for this is that every PortletDefinition is required to
90       * have a parent PortletApplicationDefinition
91       */
92      PortletDefinitionComposite getPortletDefinitionByIdentifier( String identifier );
93      
94      
95      /***
96       * Locates the portlet defintion by its unique <code>ObjectID</code>.
97       * The ObjectID is generated internally by the portal when the portlet
98       * definition is first registered and has no connection to the information
99       * stored within the <code>portlet.xml</code>.
100      * @param id
101      * @return PortletDefinitionComposite
102      */
103     PortletDefinitionComposite getPortletDefinition(ObjectID id);
104     
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( String name );
126 
127     /***
128      * Checks whether or not a portlet application with this identity has all ready
129      * been registered to the container.
130      * @param appIdentity portlet application indetity to check for.
131      * @return boolean <code>true</code> if a portlet application with this identity
132      * is alreay registered, <code>false</code> if it has not.
133      */
134     boolean portletApplicationExists( String appIentity );
135     
136     /***
137      * 
138      * <p>
139      * namedPortletApplicationExists
140      * </p>
141      *
142      * @param appName
143      * @return
144      */
145     boolean namedPortletApplicationExists( String appName );
146 
147     /***
148      * Checks whether or not a portlet with this identity has all ready
149      * been registered to the container.
150      * @param portletIndentity portlet indetity to check for.
151      * @return boolean <code>true</code> if a portlet with this identity
152      * is alreay registered, <code>false</code> if it has not.
153      */
154     boolean portletDefinitionExists( String portletIndentity );
155 
156     /***
157      * Checks whether or not a portlet with this identity has all ready
158      * been registered to the PortletApplication.
159      * @param portletIndentity portlet indetity to check for.
160      * @param app PortletApplication to check .
161      * @return boolean <code>true</code> if a portlet with this identity
162      * is alreay registered, <code>false</code> if it has not.
163      */
164     boolean portletDefinitionExists( String portletName, MutablePortletApplication app );
165 
166     /***
167      * Creates a new <code>PortletApplicationDefinition</code> 
168      * within the Portal.          
169      * @param newApp
170      */
171     void registerPortletApplication( PortletApplicationDefinition newApp ) throws RegistryException;
172 
173     void removeApplication( PortletApplicationDefinition app ) throws RegistryException;
174 
175     /***
176      * Makes any changes to the <code>PortletApplicationDefinition</code>
177      * persistent.
178      * @param app
179      */
180     void updatePortletApplication( PortletApplicationDefinition app ) throws RegistryException;
181     
182     /***
183      * 
184      * <p>
185      * savePortletDefinition
186      * </p>
187      *
188      * @param portlet
189      * @throws FailedToStorePortletDefinitionException
190      */
191     void savePortletDefinition(PortletDefinition portlet) throws FailedToStorePortletDefinitionException;
192 	
193     void addRegistryListener(RegistryEventListener listener);
194     
195     void removeRegistryEventListner(RegistryEventListener listener);
196 	
197 
198 }