View Javadoc

1   /* (c) Copyright 2003 Caleigo AB, All rights reserved. 
2    * 
3    * This library is free software; you can redistribute it and/or
4    * modify it under the terms of the GNU Lesser General Public
5    * License as published by the Free Software Foundation; either
6    * version 2.1 of the License, or (at your option) any later version.
7    * 
8    * This library is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   * Lesser General Public License for more details.
12   * 
13   * You should have received a copy of the GNU Lesser General Public
14   * License along with this library; if not, write to the Free Software
15   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   *  
17   */
18  
19  package org.caleigo.service;
20  
21  /*** The IService interface is the root interface that all service objects must
22   * implement. The interface makes it possile to handle services in an abstract
23   * and distributet way. The provided service is accessed by the service object 
24   * that can be accessed from the IService interface. <BR><BR>
25   *
26   * Note tha if possible all IService implementations should also implement
27   * the interface of the specific service they provide. If they do not it should
28   * be specially motivated and documented.
29   *
30   * @author  Dennis Zikovic
31   * @version 1.00
32   * 
33   *//* 
34   *
35   * WHEN        WHO               WHY & WHAT
36   * ------------------------------------------------------------------------------
37   * den 20 juli 2001  Dennis Zikovic    Creation
38   */
39  public interface IService extends java.io.Serializable, org.caleigo.toolkit.tunnel.IDistributable
40  {
41      /*** This method is always called by the ServiceManager before any other 
42       * method in the service is called. 
43       */ 
44      public void initializeService();
45      
46      /*** This method is always called by the ServiceManager before the service
47       * is released. No other method calls will then be performed on this
48       * instance of the service. 
49       */ 
50      public void finalizeService();
51      
52      /*** Should return true if the service is online and reponding to calls.
53       * Note that initializeService() must be called prior to this method.
54       */ 
55      public boolean ping();
56      
57      /*** Returns the service object that this service provides. This object
58       * should always implement the interface defined by the service interface 
59       * class.
60       */
61      public Object getServiceInterface();
62      
63      /*** Returns the class object the defines the service interface that all 
64       * services with the same type provides.
65       */
66      public Class getServiceInterfaceClass();
67      
68      /*** Returns a URI that defines the type of this service. Note that
69       * there can be multiple services implementing the same service type but 
70       * implementations of a given type must implement the same service
71       * interface. 
72       */
73      public Object getServiceType();
74      
75      /*** Returns the URI defining the a unique individual service. 
76       */ 
77      public Object getServiceIdentity();
78      
79      /*** If this method returns true then the method getCustomProxyService must
80       * not return <code>null</code>.
81       */
82      public boolean hasCustomProxyService();
83      
84      /*** Returns an IProxyService that is responsible for handling remote invokations
85       * on this service.
86       */
87      public IProxyService getCustomProxyService(org.caleigo.toolkit.tunnel.ITunnel tunnel);
88      
89      /*** Returns true if this service is stateless, that is, it is possile to change
90       * the actual service instance that is used by an IProxyService for this service.
91       * This means that it is possible that two consecutive invokations of methods
92       * on an IProxyService for this service are handled by two different service
93       * instances.
94       * <p>If this method returns <code>null</code> then hasCustomProxyService must
95       * return <code>false</code>.
96       */
97      //public boolean isStateless();
98  }