001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.kernel;
020:
021: import java.io.Serializable;
022: import java.util.BitSet;
023:
024: /**
025: * Holds data about a single persistence capable instance. This interface is
026: * used in the caching framework, and may also be used by simple store manager
027: * back-ends to hold persistent state.
028: *
029: * @author Patrick Linskey
030: */
031: public interface PCData extends Serializable {
032:
033: /**
034: * Return the id of this instance.
035: */
036: public Object getId();
037:
038: /**
039: * Return the type of this instance.
040: */
041: public Class getType();
042:
043: /**
044: * Returns the instance-level impl data, or null if none.
045: */
046: public Object getImplData();
047:
048: /**
049: * Sets the stored instance-level impl data.
050: */
051: public void setImplData(Object val);
052:
053: /**
054: * Returns the current version object that this data was loaded from.
055: */
056: public Object getVersion();
057:
058: /**
059: * Sets the current version object that this data was loaded from.
060: */
061: public void setVersion(Object version);
062:
063: /**
064: * Loads all fields that are currently stored in the cache
065: * into the given state manager.
066: *
067: * @param sm the state manager to load
068: * @param fetch the fetch configuration to use for loading related objects
069: * @param context current context information
070: */
071: public void load(OpenJPAStateManager sm, FetchConfiguration fetch,
072: Object context);
073:
074: /**
075: * Loads some or all of the marked fields from the cache into the
076: * given state manager.
077: *
078: * @param sm the state manager to load
079: * @param fields the fields to load; clear the bits for the fields
080: * that are successfully loaded
081: * @param fetch the fetch configuration to use for loading related objects
082: * @param context current context information
083: */
084: public void load(OpenJPAStateManager sm, BitSet fields,
085: FetchConfiguration fetch, Object context);
086:
087: /**
088: * Store all loaded fields of the state manager.
089: */
090: public void store(OpenJPAStateManager sm);
091:
092: /**
093: * Store the given fields from the state manager.
094: */
095: public void store(OpenJPAStateManager sm, BitSet fields);
096:
097: /**
098: * Return the data stored in the given field index.
099: */
100: public Object getData(int i);
101:
102: /**
103: * Whether the given field index has stored data.
104: */
105: public boolean isLoaded(int i);
106: }
|