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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services;
1819//jetspeed stuff20import org.apache.jetspeed.portal.PortletSet;
21import org.apache.jetspeed.portal.PortletSkin;
22import org.apache.jetspeed.portal.PortletControl;
23import org.apache.jetspeed.portal.PortletController;
24import org.apache.jetspeed.om.profile.Control;
25import org.apache.jetspeed.om.profile.Controller;
26import org.apache.jetspeed.om.profile.Portlets;
27import org.apache.jetspeed.om.profile.Skin;
28import org.apache.jetspeed.services.portaltoolkit.PortalToolkitService;
29import org.apache.turbine.services.TurbineServices;
30import org.apache.jetspeed.om.SecurityReference;
31import org.apache.jetspeed.om.profile.Profile;
3233/***34 * Commodity static wrapper around the PortalToolit service35 * 36 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>37 * @version $Id: PortalToolkit.java,v 1.5 2004/02/23 04:00:57 jford Exp $38 */39publicclassPortalToolkit40 {
4142/*** 43 * Commodity method for getting a reference to the service44 * singleton45 */46privatestaticPortalToolkitService getService()
47 {
48return (PortalToolkitService)TurbineServices
49 .getInstance()
50 .getService(PortalToolkitService.SERVICE_NAME);
51 }
5253/***54 * Instanciates a PortletControl based on a Registry entry, if available 55 * or directly from a classname.56 *57 * @param name a PortletControl name available in the registry or a classname58 * @return the created PortletControl59 */60publicstaticPortletControl getControl( String name )
61 {
62return getService().getControl(name);
63 }
6465/***66 * Instanciates a PortletControl based on a PSML Control object67 *68 * @param control the PSML control object69 * @return the created PortletControl70 */71publicstaticPortletControl getControl( Control control )
72 {
73return getService().getControl(control);
74 }
7576/***77 * Instanciates a PortletController based on a Registry entry, if available 78 * or directly from a classname.79 *80 * @param name a PortletController name available in the registry or a classname81 * @return the created PortletController82 */83publicstaticPortletController getController( String name )
84 {
85return getService().getController(name);
86 }
8788/***89 * Instanciates a PortletController based on a PSML Controller object90 *91 * @param control the PSML controller object92 * @return the created PortletController93 */94publicstaticPortletController getController( Controller controller )
95 {
96return getService().getController(controller);
97 }
9899/***100 * Create a PortletSkin object based on a Registry entry if available101 *102 * @param name the skin name in the Registry103 * @return the new PortletSkin object104 */105publicstaticPortletSkin getSkin( String name )
106 {
107return getService().getSkin(name);
108 }
109110/***111 * Create a PortletSkin object based on PSML skin description112 *113 * @param skin the PSML Skin object114 * @return the new PortletSkin object115 */116publicstaticPortletSkin getSkin( Skin skin )
117 {
118return getService().getSkin(skin);
119 }
120121/***122 * Creates a PortletSet from a PSML portlets description123 *124 * @param portlets the PSML portlet set description125 * @return a new instance of PortletSet126 */127publicstaticPortletSet getSet( Portlets portlets )
128 {
129return getService().getSet(portlets);
130 }
131132/***133 * Given a locator String path, returns a Portlets collecton134 *135 * @param locatorPath ProfileLocator resource path identifier136 * @return a portlets collection from the PSML resource137 */138publicstaticPortlets getReference(String locatorPath)
139 {
140return getService().getReference(locatorPath);
141 }
142143/***144 * Gets default security ref based on the profile type (user|role|group). Returns145 * null if no default is defined.146 * 147 * @param profile148 * @return default security reference149 */150publicstaticSecurityReference getDefaultSecurityRef(Profile profile)
151 {
152return getService().getDefaultSecurityRef(profile);
153 }
154155/***156 * Gets default security ref based on the profile type (user|role|group). Returns157 * null if no default is defined.158 *159 * @param type of entity to return default security ref for160 * @return default security reference161 */162publicstaticSecurityReference getDefaultSecurityRef(String type)
163 {
164return getService().getDefaultSecurityRef(type);
165 }
166167 }
168