View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services;
18  
19  import org.apache.jetspeed.om.registry.RegistryEntry;
20  import org.apache.jetspeed.om.registry.RegistryException;
21  import org.apache.jetspeed.services.registry.RegistryService;
22  import org.apache.turbine.services.TurbineServices;
23  import java.util.Enumeration;
24  
25  /***
26   * <P>This is a commodity static accessor class around the
27   * <code>RegistryService</code></P>
28   *
29   * @see org.apache.jetspeed.services.registry.RegistryService
30   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
31   * @version $Id: Registry.java,v 1.8 2004/02/23 04:00:57 jford Exp $
32   */
33  public class Registry
34  {
35  
36      /*** Default Portlet Registry name */
37      public static String PORTLET = "Portlet";
38  
39      /*** Default PortletControl Registry name */
40      public static String PORTLET_CONTROL = "PortletControl";
41  
42      /*** Default PortletController Registry name */
43      public static String PORTLET_CONTROLLER = "PortletController";
44  
45      /*** Default MediaType Registry name */
46      public static String MEDIA_TYPE = "MediaType";
47  
48      /*** Default Client Registry name */
49      public static String CLIENT = "Client";
50  
51      /*** Default Security Registry name */
52      public static String SECURITY = "Security";
53  
54      /*** Default Skin Registry name */
55      public static String SKIN = "Skin";
56  
57      /***
58       * Commodity method for getting a reference to the service
59       * singleton
60       */
61      private static RegistryService getService()
62      {
63          return (RegistryService)TurbineServices
64                  .getInstance()
65                  .getService(RegistryService.SERVICE_NAME);
66      }
67  
68      /***
69       * @see RegistryService#getNames
70       */
71      public static Enumeration getNames()
72      {
73          return getService().getNames();
74      }
75  
76      /***
77       * @see RegistryService#get
78       */
79      public static org.apache.jetspeed.om.registry.Registry get( String regName )
80      {
81          return getService().get( regName );
82      }
83  
84      /***
85       * @see RegistryService#createEntry
86       */
87      public static RegistryEntry createEntry( String regName )
88      {
89          return getService().createEntry( regName );
90  	}
91  
92      /***
93       * @see RegistryService#getEntry
94       */
95      public static RegistryEntry getEntry( String regName, String entryName )
96      {
97          return getService().getEntry( regName, entryName );
98      }
99  
100     /***
101      * @see RegistryService#addEntry
102      */
103     public static void addEntry( String regName, RegistryEntry value )
104         throws RegistryException
105     {
106         getService().addEntry( regName, value );
107     }
108 
109     /***
110      * @see RegistryService#removeEntry
111      */
112     public static void removeEntry( String regName, String entryName )
113     {
114         getService().removeEntry( regName, entryName );
115     }
116 }