View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * 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 javax.jdo.spi;
19  
20  /**
21   * This interface is implemented by classes that can be detached from the
22   * persistence context and later attached. The interface includes the 
23   * contract by which the StateManager can set the object id, version,
24   * BitSet of loaded fields, and BitSet of modified fields 
25   * so they are preserved while outside the persistence environment.
26   * <P>The detached state is stored as a field in each instance of Detachable. 
27   * The field is serialized so as to maintain the state of the instance 
28   * while detached. While detached, only the BitSet of modified fields 
29   * will be modified. The structure of the Object[] jdoDetachedState
30   * is as follows:
31   *  <ul><li>jdoDetachedState[0]: the Object Id of the instance
32   * </li><li>jdoDetachedState[1]: the Version of the instance
33   * </li><li>jdoDetachedState[2]: a BitSet of loaded fields
34   * </li><li>jdoDetachedState[3]: a BitSet of modified fields
35   * </li></ul>
36   * @version 2.0
37   */
38  
39  public interface Detachable {
40  
41      /** This method calls the StateManager with the current detached 
42       * state instance as a parameter and replaces the current detached 
43       * state instance with the value provided by the StateManager.  
44       * @since 2.0
45       */    
46      public void jdoReplaceDetachedState();
47  }