1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.services.security;
16
17 import org.figure8.join.core.InvalidParameterException;
18
19 import java.util.List;
20 import java.io.Serializable;
21 /**
22 * A Resolver is an object that helps retrieving resources to whom
23 * could apply security permissions. Such a resolver is associated to security
24 * roles for discovering the resources they are protecting ...
25 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
26 * @version $Revision: 1.2 $
27 */
28 public interface PermissionResourceResolver extends Serializable{
29
30
31
32 /**
33 * Retrieve a list of resolved resources
34 * @return A List of resources to expose for security permission allocation
35 */
36 public List getResourceList();
37
38 /**
39 * Retrieve a list of resolved resources wrapped within {@link PermissionResource}
40 * @return A List of <code>org.figure8.join.services.security.PermissionResource</code>
41 */
42 public List getPermissionResourceList();
43
44 /**
45 * Tells if given resource is a valid one
46 * @param resource Object to try to resolve
47 * @return true is resource is managed by this resolver, false otherwise
48 */
49 public boolean isValidResource(Object resource);
50
51 /**
52 * Get a resource using its unique identifier
53 * @param resourceId Unique identifier corresponding to resource
54 * @return Object representing the resource
55 * @throws InvalidParameterException if the <b>resourceId</b> is unknown.
56 */
57 public Object getResource(String resourceId) throws InvalidParameterException;
58
59 /**
60 * Get a resource unique identifier
61 * @param resource The object representing the resource
62 * @return The string representation of the resource unique identifier
63 * @throws InvalidParameterException if the <b>resource</b> cannot be resolved
64 */
65 public String getResourceId(Object resource) throws InvalidParameterException;
66
67 /**
68 * Get a resource label for display
69 * @param resource The object representing the resource
70 * @return A string representing the display label of resource
71 * @throws InvalidParameterException if the <b>resource</b> cannot be resolved
72 */
73 public String getResourceLabel(Object resource) throws InvalidParameterException;
74 }