View Javadoc

1   /*
2    * Licensed to the University Corporation for Advanced Internet Development, 
3    * Inc. (UCAID) under one or more contributor license agreements.  See the 
4    * NOTICE file distributed with this work for additional information regarding
5    * copyright ownership. The UCAID licenses this file to You under the Apache 
6    * License, Version 2.0 (the "License"); you may not use this file except in 
7    * compliance with the License.  You may obtain a copy of the License at
8    *
9    *    http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package edu.internet2.middleware.shibboleth.common.service;
19  
20  /**
21   * A simple interface that represents coarse grained services, or components, within the software.
22   */
23  public interface Service {
24  
25      /**
26       * Gets the ID of this service.
27       * 
28       * @return ID of this service
29       */
30      public String getId();
31  
32      /**
33       * Gets whether the service is initialized and ready for use.
34       * 
35       * @return true if the service is ready for use, false it not
36       */
37      public boolean isInitialized();
38  
39      /**
40       * Initializes this service. Calling this on an initialized service should return immediately without affecting any
41       * service state.
42       * 
43       * @throws ServiceException thrown if there is a problem initializing the service
44       */
45      public void initialize() throws ServiceException;
46  
47      /**
48       * Gets whether the service has been destroyed.
49       * 
50       * @return true if the service has been destroyed
51       */
52      public boolean isDestroyed();
53  
54      /**
55       * Destroys a service, freeing any resources it may currently be using. Whether a service can be re-initialized
56       * after being destroyed is implementation dependent.
57       * 
58       * @throws ServiceException thrown if there is a problem destroying the service
59       */
60      public void destroy() throws ServiceException;
61  }