Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/derby/iapi/services/monitor/ModuleControl.java


1   /*
2   
3      Derby - Class org.apache.derby.iapi.services.monitor.ModuleControl
4   
5      Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable.
6   
7      Licensed under the Apache License, Version 2.0 (the "License");
8      you may not use this file except in compliance with the License.
9      You may obtain a copy of the License at
10  
11        http://www.apache.org/licenses/LICENSE-2.0
12  
13     Unless required by applicable law or agreed to in writing, software
14     distributed under the License is distributed on an "AS IS" BASIS,
15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16     See the License for the specific language governing permissions and
17     limitations under the License.
18  
19   */
20  
21  package org.apache.derby.iapi.services.monitor;
22  
23  import java.util.Properties;
24  import org.apache.derby.iapi.error.StandardException;
25  
26  /**
27    ModuleControl is <B>optionally</B> implemented by a module's factory class.
28  */
29  
30  public interface ModuleControl {
31  
32    /**
33      Boot this module with the given properties. Creates a module instance
34      that can be found using the findModule() methods of Monitor.
35      The module can only be found using one of these findModule() methods
36      once this method has returned.
37      <P>
38      An implementation's boot method can throw StandardException. If it
39      is thrown the module is not registered by the monitor and therefore cannot
40      be found through a findModule(). In this case the module's stop() method
41      is not called, thus throwing this exception must free up any
42      resources.
43      <P>
44      When create is true the contents of the properties object
45      will be written to the service.properties of the persistent
46      service. Thus any code that requires an entry in service.properties
47      must <B>explicitly</B> place the value in this properties set
48      using the put method.
49      <BR>
50      Typically the properties object contains one or more default
51      properties sets, which are not written out to service.properties.
52      These default sets are how callers modify the create process. In a
53      JDBC connection database create the first set of defaults is a properties
54      object that contains the attributes that were set on the jdbc:derby: URL.
55      This attributes properties set has the second default properties set as
56      its default. This set (which could be null) contains the properties
57      that the user set on their DriverManager.getConnection() call, and are thus
58      not owned by cloudscape code, and thus must not be modified by cloudscape
59      code.
60      <P>
61      When create is false the properties object contains all the properties
62      set in the service.properties file plus a <B>limited</B> number of
63      attributes from the JDBC URL attributes or connection properties set.
64      This avoids properties set by the user compromising the boot process.
65      An example of a property passed in from the JDBC world is the bootPassword
66      for encrypted databases.
67  
68      <P>
69      Code should not hold onto the passed in properties reference after boot time
70      as its contents may change underneath it. At least after the complete boot
71      is completed, the links to all the default sets will be removed.
72  
73      @exception StandardException Module cannot be started.
74  
75      @see Monitor
76      @see ModuleFactory
77      
78    */
79  
80    public void boot(boolean create, Properties properties)
81      throws StandardException;
82  
83    /**
84      Stop the module.
85  
86      The module may be found via a findModule() method until some time after
87      this method returns. Therefore the factory must be prepared to reject requests
88      to it once it has been stopped. In addition other modules may cache a reference
89      to the module and make requests of it after it has been stopped, these requests
90      should be rejected as well.
91  
92      @see Monitor
93      @see ModuleFactory
94    */
95  
96    public void stop();
97  
98  
99  }