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.services.information;
18  
19  import javax.servlet.ServletConfig;
20  
21  import org.apache.jetspeed.components.portletregistry.PortletRegistry;
22  import org.apache.pluto.om.common.ObjectID;
23  import org.apache.pluto.om.portlet.PortletDefinition;
24  import org.apache.pluto.services.information.PortalContextProvider;
25  import org.apache.pluto.services.information.StaticInformationProvider;
26  
27  /***
28   * Provides static information to Pluto Container:
29   * 
30   * 1. PortletDefinition - given a unique registry id, 
31   *                        retrieve the portlet definition from the portlet registry   
32   *
33   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
34   * @version $Id: StaticInformationProviderImpl.java 516448 2007-03-09 16:25:47Z ate $
35   */
36  public class StaticInformationProviderImpl implements StaticInformationProvider
37  {
38      private final PortletRegistry portletRegistry;
39  
40      /***
41       * @obsolete
42       */
43      public StaticInformationProviderImpl(ServletConfig config, PortalContextProvider portalContextProvider, PortletRegistry portletRegistry)
44      {
45          this(portletRegistry);
46      }
47      
48      public StaticInformationProviderImpl(PortletRegistry portletRegistry)
49      {
50          this.portletRegistry = portletRegistry;
51      }
52  
53      /***
54       *  Given a unique registry id, 
55       * retrieve the portlet definition from the portlet registry
56       *    
57       * @param uniqueId The uniquely identifying portlet id in the registry
58       */
59      public PortletDefinition getPortletDefinition(String uniqueId)
60      {        
61          return portletRegistry.getPortletDefinitionByIdentifier(uniqueId);
62      }
63  
64      /*** 
65       * <p>
66       * getPortalContextProvider
67       * </p>
68       * 
69       * @see org.apache.pluto.services.information.StaticInformationProvider#getPortalContextProvider()
70       * @return
71       */
72      public PortalContextProvider getPortalContextProvider()
73      {
74          throw new UnsupportedOperationException();
75      }
76  
77      /*** 
78       * <p>
79       * getPortletDefinition
80       * </p>
81       * 
82       * @see org.apache.pluto.services.information.StaticInformationProvider#getPortletDefinition(org.apache.pluto.om.common.ObjectID)
83       * @param arg0
84       * @return
85       */
86      public PortletDefinition getPortletDefinition(ObjectID id)
87      {        
88          return portletRegistry.getPortletDefinition(id);
89      }
90  
91  }