View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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 javax.jdo.spi;
18  
19  /***
20   * This interface is implemented by classes that can be detached from the
21   * persistence context and later attached. The interface includes the 
22   * contract by which the StateManager can set the object id, version,
23   * BitSet of loaded fields, and BitSet of modified fields 
24   * so they are preserved while outside the persistence environment.
25   * <P>The detached state is stored as a field in each instance of Detachable. 
26   * The field is serialized so as to maintain the state of the instance 
27   * while detached. While detached, only the BitSet of modified fields 
28   * will be modified. The structure of the Object[] jdoDetachedState
29   * is as follows:
30   *  <ul><li>jdoDetachedState[0]: the Object Id of the instance
31   * </li><li>jdoDetachedState[1]: the Version of the instance
32   * </li><li>jdoDetachedState[2]: a BitSet of loaded fields
33   * </li><li>jdoDetachedState[3]: a BitSet of modified fields
34   * </li></ul>
35   * @version 2.0
36   */
37  
38  public interface Detachable {
39  
40      /*** This method calls the StateManager with the current detached 
41       * state instance as a parameter and replaces the current detached 
42       * state instance with the value provided by the StateManager.  
43       * @since 2.0
44       */    
45      public void jdoReplaceDetachedState();
46  }