001 /* 002 * Copyright (c) 2002-2005 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 005 * use this file except in compliance with the License. You may obtain a copy of 006 * the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 package org.springframework.richclient.security; 017 018 import java.util.Map; 019 020 /** 021 * A SecurityControllerManager is responsible for linking a controllable object, one that 022 * implements {@link org.springframework.richclient.core.SecurityControllable}, to the 023 * appropriate {@link SecurityController} to manage it. 024 * <p> 025 * The SecurityControllable object will provide a controller Id that needs to be mapped to 026 * a specific controller. See {@link SecurityControllable#getSecurityControllerId()}. 027 * This id will then be used in a call to {@link #getSecurityController(String)} to find 028 * the registered security controller. 029 * <p> 030 * Each security controller is implicitly registered under its bean context id. Aliases 031 * may be registered by calling 032 * {@link #registerSecurityControllerAlias(String, SecurityController)}. Subsequently, 033 * any call to <code>getSecurityController</code> with that alias id will return the 034 * registered security controller. This is useful for mapping generated command security 035 * controller ids (which are often a combination of a form id and a command face id) to 036 * the actual security controller that should manage the command. This provides a 037 * declarative model for linking commands to controllers instead of requiring the 038 * subclassing a Form in order to specify the command's security controller id. 039 * 040 * @author Larry Streepy 041 * @see org.springframework.richclient.security.support.DefaultSecurityControllerManager 042 * 043 */ 044 public interface SecurityControllerManager { 045 046 /** 047 * Set the map of controller Ids to controller instances. 048 * @param map keyed by controller Id, value is {@link SecurityController} instance 049 */ 050 public void setSecurityControllerMap(Map map); 051 052 /** 053 * Register an alias for a SecurityController. 054 * @param aliasId to register 055 * @param securityController to register under given alias Id 056 */ 057 public void registerSecurityControllerAlias(String aliasId, SecurityController securityController); 058 059 /** 060 * Get the security controller for a given Id. 061 * @param id of security controller 062 * @return controller instance, or null if nothing is registered for the id 063 */ 064 public SecurityController getSecurityController(String id); 065 }