Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ServiceDefinition |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2006-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php | |
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.kuali.rice.ksb.api.bus; | |
18 | ||
19 | import java.net.URL; | |
20 | ||
21 | import javax.xml.namespace.QName; | |
22 | ||
23 | import org.kuali.rice.core.api.config.ConfigurationException; | |
24 | import org.kuali.rice.core.api.security.credentials.CredentialsType; | |
25 | import org.kuali.rice.ksb.api.registry.ServiceRegistry; | |
26 | ||
27 | ||
28 | ||
29 | /** | |
30 | * Defines the common parameters for the publication and export of a service | |
31 | * to the {@link ServiceBus} and {@link ServiceRegistry}. Implementations of | |
32 | * this interface may define additional properties that are required for the | |
33 | * publication of services of that particular type. | |
34 | * | |
35 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
36 | */ | |
37 | public interface ServiceDefinition { | |
38 | ||
39 | /** | |
40 | * Validates the service definition after creation of the service definition. | |
41 | * It's intended that portions of the KSB that handle publication and export | |
42 | * of services to the bus will execute this prior to successful export of | |
43 | * the service. | |
44 | * | |
45 | * @throws ConfigurationException if this service definition is not | |
46 | * configured properly | |
47 | */ | |
48 | void validate(); | |
49 | ||
50 | /** | |
51 | * Establishes and returns an {@link Endpoint} to this service which | |
52 | * generates the {@link ServiceConfiguration} for this service definition | |
53 | * as well as including the actual service implementation as provided by | |
54 | * {@link #getService()}. | |
55 | * | |
56 | * <p>The {@link #validate()} method should be invoked prior to executing | |
57 | * this method in order to ensure that the appropriate internal state for | |
58 | * the {@link ServiceDefinition} has been established. | |
59 | * | |
60 | * @return the established endpoint, should never return null | |
61 | */ | |
62 | Endpoint establishEndpoint(); | |
63 | ||
64 | /** | |
65 | * Return the actual service implementation to publish and export to the | |
66 | * service bus. | |
67 | * | |
68 | * @return the service to publish | |
69 | */ | |
70 | Object getService(); | |
71 | ||
72 | /** | |
73 | * Returns the qualified name for this service. | |
74 | * | |
75 | * @return the qualified name for this service | |
76 | */ | |
77 | QName getServiceName(); | |
78 | ||
79 | /** | |
80 | * Returns the URL of the endpoint which provides this service. | |
81 | * | |
82 | * @return the endpoint URL of the service | |
83 | */ | |
84 | URL getEndpointUrl(); | |
85 | ||
86 | /** | |
87 | * Returns the {@link ClassLoader} that should be set as the context | |
88 | * classloader on the thread prior to any invocations on the service | |
89 | * | |
90 | * @return the classloader for this service | |
91 | */ | |
92 | ClassLoader getServiceClassLoader(); | |
93 | ||
94 | /** | |
95 | * Returns the url path to export the service under. | |
96 | * | |
97 | * @return the url path to export the service under | |
98 | */ | |
99 | String getServicePath(); | |
100 | ||
101 | /** | |
102 | * Returns the id of the application which owns this service. | |
103 | * | |
104 | * @return the id of the application which owns this service | |
105 | */ | |
106 | String getApplicationId(); | |
107 | ||
108 | /** | |
109 | * Returns the version of this service. | |
110 | * | |
111 | * @return the version of this service | |
112 | */ | |
113 | String getServiceVersion(); | |
114 | ||
115 | /** | |
116 | * Returns the type of this service. | |
117 | * | |
118 | * @return the type of this service | |
119 | */ | |
120 | String getType(); | |
121 | ||
122 | /** | |
123 | * Return true if this service uses queue-style messaging, false if it uses | |
124 | * topic-style messaging. | |
125 | * | |
126 | * @return true if this service uses queue-style messaging, false if it uses | |
127 | * topic-style messaging | |
128 | */ | |
129 | boolean isQueue(); | |
130 | ||
131 | /** | |
132 | * Returns the processing priority for messages that are sent to this service. | |
133 | * | |
134 | * @return the message processing priority for this service | |
135 | */ | |
136 | Integer getPriority(); | |
137 | ||
138 | /** | |
139 | * Returns the retry attempts to use when processing messages sent to this | |
140 | * service. | |
141 | * | |
142 | * @return the retry attempts for this service | |
143 | */ | |
144 | Integer getRetryAttempts(); | |
145 | ||
146 | /** | |
147 | * Returns the maximum amount of milliseconds a message to this service can | |
148 | * live and attempt to be processed successfully by this service before it's | |
149 | * forced into processing by it's exception handler. | |
150 | * | |
151 | * @return the maximum lifetime for this message, if null then this message has | |
152 | * an infinite lifetime | |
153 | */ | |
154 | Long getMillisToLive(); | |
155 | ||
156 | /** | |
157 | * Returns the name of the exception handler to invoke whenever messages to | |
158 | * this service fail to be sent. If null, the default message exception | |
159 | * handler will be used. | |
160 | * | |
161 | * @return the name of the message exception handler for this service, or | |
162 | * null if the default handler should be used | |
163 | */ | |
164 | String getMessageExceptionHandler(); | |
165 | ||
166 | /** | |
167 | * Returns true if this service is secured by standard KSB security features. | |
168 | * | |
169 | * @return true if this service is secured, false otherwise | |
170 | */ | |
171 | Boolean getBusSecurity(); | |
172 | ||
173 | /** | |
174 | * Returns the type of security credentials that should be used when | |
175 | * attempting to authorize access to this service. | |
176 | * | |
177 | * @return the type of security credentials to use when access this service | |
178 | */ | |
179 | CredentialsType getCredentialsType(); | |
180 | ||
181 | } |