KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > policy > PolicyComponent


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.policy;
18
19 import java.util.Collection JavaDoc;
20
21 import org.alfresco.service.namespace.QName;
22
23
24 /**
25  * Policy Component for managing Policies and Behaviours.
26  *
27  * This component provides the ability to:
28  *
29  * a) Register policies
30  * b) Bind behaviours to policies
31  * c) Invoke policy behaviours
32  *
33  * A behaviour may be bound to a Policy before the Policy is registered. In
34  * this case, the behaviour is not validated (i.e. checked to determine if it
35  * supports the policy interface) until the Policy is registered. Otherwise,
36  * the behaviour is validated at bind-time.
37  *
38  * @author David Caruana
39  *
40  */

41 public interface PolicyComponent
42 {
43     /**
44      * Register a Class-level Policy
45      *
46      * @param <P> the policy interface
47      * @param policy the policy interface class
48      * @return A delegate for the class-level policy (typed by the policy interface)
49      */

50     public <P extends ClassPolicy> ClassPolicyDelegate<P> registerClassPolicy(Class JavaDoc<P> policy);
51
52     /**
53      * Register a Property-level Policy
54      *
55      * @param <P> the policy interface
56      * @param policy the policy interface class
57      * @return A delegate for the property-level policy (typed by the policy interface)
58      */

59     public <P extends PropertyPolicy> PropertyPolicyDelegate<P> registerPropertyPolicy(Class JavaDoc<P> policy);
60     
61     /**
62      * Register a Association-level Policy
63      *
64      * @param <P> the policy interface
65      * @param policy the policy interface class
66      * @return A delegate for the association-level policy (typed by the policy interface)
67      */

68     public <P extends AssociationPolicy> AssociationPolicyDelegate<P> registerAssociationPolicy(Class JavaDoc<P> policy);
69     
70     /**
71      * Gets all registered Policies
72      *
73      * @return the collection of registered policy definitions
74      */

75     public Collection JavaDoc<PolicyDefinition> getRegisteredPolicies();
76
77     /**
78      * Gets the specified registered Policy
79      *
80      * @param policyType the policy type
81      * @param policy the policy name
82      * @return the policy definition (or null, if it has not been registered)
83      */

84     public PolicyDefinition getRegisteredPolicy(PolicyType policyType, QName policy);
85
86     /**
87      * Determine if the specified policy has been registered
88      *
89      * @param policyType the policy type
90      * @param policy the policy name
91      * @return true => registered, false => not yet
92      */

93     public boolean isRegisteredPolicy(PolicyType policyType, QName policy);
94
95     /**
96      * Bind a Class specific behaviour to a Class-level Policy
97      *
98      * @param policy the policy name
99      * @param behaviour the behaviour
100      * @return the registered behaviour definition
101      */

102     public BehaviourDefinition<ClassBehaviourBinding> bindClassBehaviour(QName policy, QName classRef, Behaviour behaviour);
103
104     /**
105      * Bind a Service behaviour to a Class-level Policy
106      *
107      * @param policy the policy name
108      * @param service the service (any object, in fact)
109      * @param behaviour the behaviour
110      * @return the registered behaviour definition
111      */

112     public BehaviourDefinition<ServiceBehaviourBinding> bindClassBehaviour(QName policy, Object JavaDoc service, Behaviour behaviour);
113     
114     /**
115      * Bind a Property specific behaviour to a Property-level Policy
116      *
117      * @param policy the policy name
118      * @param className the class to bind against
119      * @param propertyName the property to bind against
120      * @param behaviour the behaviour
121      * @return the registered behaviour definition
122      */

123     public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour);
124
125     /**
126      * Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class)
127      *
128      * @param policy the policy name
129      * @param className the class to bind against
130      * @param behaviour the behaviour
131      * @return the registered behaviour definition
132      */

133     public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour);
134
135     /**
136      * Bind a Service specific behaviour to a Property-level Policy
137      *
138      * @param policy the policy name
139      * @param service the binding service
140      * @param behaviour the behaviour
141      * @return the registered behaviour definition
142      */

143     public BehaviourDefinition<ServiceBehaviourBinding> bindPropertyBehaviour(QName policy, Object JavaDoc service, Behaviour behaviour);
144
145     /**
146      * Bind an Association specific behaviour to an Association-level Policy
147      *
148      * @param policy the policy name
149      * @param className the class to bind against
150      * @param assocRef the association to bind against
151      * @param behaviour the behaviour
152      * @return the registered behaviour definition
153      */

154     public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour);
155
156     /**
157      * Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class)
158      *
159      * @param policy the policy name
160      * @param className the class to bind against
161      * @param behaviour the behaviour
162      * @return the registered behaviour definition
163      */

164     public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, Behaviour behaviour);
165
166     /**
167      * Bind a Service specific behaviour to an Association-level Policy
168      *
169      * @param policy the policy name
170      * @param service the binding service
171      * @param behaviour the behaviour
172      * @return the registered behaviour definition
173      */

174     public BehaviourDefinition<ServiceBehaviourBinding> bindAssociationBehaviour(QName policy, Object JavaDoc service, Behaviour behaviour);
175     
176 }
177
178
179
Popular Tags