You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2005/05/22 20:40:21 UTC
svn commit: r171355 [2/31] - in /incubator/jdo/trunk/fostore20: ./ src/
src/conf/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/
src/java/org/apache/jdo/impl/fostore/ test/ test/conf/ test/fsuid2/
test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/
test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/
test/java/org/apache/ test/java/org/apache/jdo/
test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/
test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/
test/java/org/apache/jdo/pc/empdept/
test/java/org/apache/jdo/pc/serializable/
test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/
test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/
test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/
test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/
test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/
test/jdo/org/apache/jdo/pc/xempdept/
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AIDTranscriber.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AIDTranscriber.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AIDTranscriber.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AIDTranscriber.java Sun May 22 11:40:13 2005
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.IOException;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.spi.PersistenceCapable;
+
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOClass;
+import org.apache.jdo.model.jdo.JDOField;
+import org.apache.jdo.util.I18NHelper;
+
+
+/**
+ *
+ * @author Marina Vatkina
+ */
+class AIDTranscriber
+ implements PersistenceCapable.ObjectIdFieldConsumer {
+
+ // Streams to use
+ private FOStoreOutput out;
+
+ // Metadata for the request.
+ private final FOStoreModel model;
+ private final Class cls;
+
+ /** I18N support. */
+ private static final I18NHelper msg = I18NHelper.getInstance(I18N.NAME);
+
+ AIDTranscriber(FOStoreOutput out, Class pcClass, FOStorePMF pmf) {
+ this.out = out;
+ cls = pcClass;
+ model = pmf.getModel();
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeBooleanField(int fieldNumber, boolean value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeBoolean(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeBooleanField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeCharField(int fieldNumber, char value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeChar(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeCharField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeByteField(int fieldNumber, byte value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeByte(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeByteField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeShortField(int fieldNumber, short value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeShort(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeShortField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeIntField(int fieldNumber, int value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeInt(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeIntField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeLongField(int fieldNumber, long value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeLong(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeLongField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeFloatField(int fieldNumber, float value){
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeFloat(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeFloatField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeDoubleField(int fieldNumber, double value) {
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeDouble(value, out);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeDoubleField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeStringField(int fieldNumber, String value) {
+ assertNotNull(fieldNumber, value);
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeObject(value, out, null);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeStringField", ex); // NOI18N
+ }
+ }
+
+ /** Store one field into the field manager. This field was retrieved from
+ * the field of the ObjectId.
+ * @param fieldNumber the field number of the key field.
+ * @param value the value of the field from the ObjectId.
+ */
+ public void storeObjectField(int fieldNumber, Object value) {
+ assertNotNull(fieldNumber, value);
+ FOStoreTranscriber t = model.getTranscriber(cls, fieldNumber);
+ try {
+ t.storeObject(value, out, null); // no need have pm here.
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "storeObjectField", ex); // NOI18N
+ }
+ }
+
+ void assertNotNull(int fieldNumber, Object value) {
+ if (value == null) {
+ JDOClass jdoClass = model.getJDOClass(cls);
+ JavaType javaType = jdoClass.getJavaType();
+ String className = javaType.getName();
+ JDOField jdoField = jdoClass.getField(fieldNumber);
+ JavaField javaField = jdoField.getJavaField();
+ String fieldName = javaField.getName();
+ throw new NullPointerException(
+ msg.msg("EXC_ObjectIdKeyFieldNull", className, fieldName));
+ }
+ }
+
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldManager.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldManager.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldManager.java Sun May 22 11:40:13 2005
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import org.apache.jdo.state.FieldManager;
+
+/**
+* An implementation of FieldManager in which all methods throw a
+* FOStoreAbstractMethodException with the name of the method invoked.
+*
+* @author Dave Bristor
+*/
+class AbstractFieldManager implements FieldManager {
+ private static final String name = AbstractFieldManager.class.getName();
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeBooleanField(int fieldNum,
+ * boolean value)
+ */
+ public void storeBooleanField(int fieldNum, boolean value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeBooleanField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchBooleanField(int fieldNum)
+ */
+ public boolean fetchBooleanField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchBooleanField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeCharField(int fieldNum,
+ * char value)
+ */
+ public void storeCharField(int fieldNum, char value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeCharField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchCharField(int fieldNum)
+ */
+ public char fetchCharField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchCharField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeByteField(int fieldNum,
+ * byte value)
+ */
+ public void storeByteField(int fieldNum, byte value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeByteField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchByteField(int fieldNum)
+ */
+ public byte fetchByteField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchByteField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeShortField(int fieldNum,
+ * short value)
+ */
+ public void storeShortField(int fieldNum, short value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeShortField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchShortField(int fieldNum)
+ */
+ public short fetchShortField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchShortField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeIntField(int fieldNum, int value)
+ */
+ public void storeIntField(int fieldNum, int value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeIntField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchIntField(int fieldNum)
+ */
+ public int fetchIntField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchIntField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeLongField(int fieldNum,
+ * long value)
+ */
+ public void storeLongField(int fieldNum, long value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeLongField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchLongField(int fieldNum)
+ */
+ public long fetchLongField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchLongField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeFloatField(int fieldNum,
+ * float value)
+ */
+ public void storeFloatField(int fieldNum, float value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeFloatField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchFloatField(int fieldNum)
+ */
+ public float fetchFloatField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchFloatField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeDoubleField(int fieldNum,
+ * double value)
+ */
+ public void storeDoubleField(int fieldNum, double value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeDoubleField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchDoubleField(int fieldNum)
+ */
+ public double fetchDoubleField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchDoubleField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeStringField(int fieldNum,
+ * String value)
+ */
+ public void storeStringField(int fieldNum, String value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeStringField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchStringField(int fieldNum)
+ */
+ public String fetchStringField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchStringField"); // NOI18N
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeObjectField(int fieldNum,
+ * Object value)
+ */
+ public void storeObjectField(int fieldNum, Object value) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": storeObjectField"); // NOI18N
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchObjectField(int fieldNum)
+ */
+ public Object fetchObjectField(int fieldNum) {
+ throw new FOStoreAbstractMethodException(
+ name + " " + fieldNum + ": fetchObjectField"); // NOI18N
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldRequest.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldRequest.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractFieldRequest.java Sun May 22 11:40:13 2005
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import org.apache.jdo.state.FieldManager;
+import org.apache.jdo.state.StateManagerInternal;
+
+/**
+* This is an AbstractRequest that uses an exception-throwing implementation
+* FieldManager to implement that interface. Subclasses can override
+* particular FieldManager methods they need. E.g., a subclass might override
+* only the storeABCField methods, knowing that its fetchABCField methods will
+* never be invoked.
+*
+* @author Dave Bristor
+*/
+abstract class AbstractFieldRequest
+ extends AbstractRequest implements FieldManager {
+
+ private AbstractFieldManager afm = new AbstractFieldManager();
+
+ AbstractFieldRequest(StateManagerInternal sm, Message m, FOStorePMF pmf) {
+ super(sm, m, pmf);
+ }
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeBooleanField(int fieldNum,
+ * boolean value)
+ */
+ public void storeBooleanField(int fieldNum, boolean value) {
+ afm.storeBooleanField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchBooleanField(int fieldNum)
+ */
+ public boolean fetchBooleanField(int fieldNum) {
+ return afm.fetchBooleanField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeCharField(int fieldNum,
+ * char value)
+ */
+ public void storeCharField(int fieldNum, char value) {
+ afm.storeCharField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchCharField(int fieldNum)
+ */
+ public char fetchCharField(int fieldNum) {
+ return afm.fetchCharField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeByteField(int fieldNum,
+ * byte value)
+ */
+ public void storeByteField(int fieldNum, byte value) {
+ afm.storeByteField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchByteField(int fieldNum)
+ */
+ public byte fetchByteField(int fieldNum) {
+ return afm.fetchByteField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeShortField(int fieldNum,
+ * short value)
+ */
+ public void storeShortField(int fieldNum, short value) {
+ afm.storeShortField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchShortField(int fieldNum)
+ */
+ public short fetchShortField(int fieldNum) {
+ return afm.fetchShortField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeIntField(int fieldNum, int value)
+ */
+ public void storeIntField(int fieldNum, int value) {
+ afm.storeIntField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchIntField(int fieldNum)
+ */
+ public int fetchIntField(int fieldNum) {
+ return afm.fetchIntField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeLongField(int fieldNum,
+ * long value)
+ */
+ public void storeLongField(int fieldNum, long value) {
+ afm.storeLongField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchLongField(int fieldNum)
+ */
+ public long fetchLongField(int fieldNum) {
+ return afm.fetchLongField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeFloatField(int fieldNum,
+ * float value)
+ */
+ public void storeFloatField(int fieldNum, float value) {
+ afm.storeFloatField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchFloatField(int fieldNum)
+ */
+ public float fetchFloatField(int fieldNum) {
+ return afm.fetchFloatField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeDoubleField(int fieldNum,
+ * double value)
+ */
+ public void storeDoubleField(int fieldNum, double value) {
+ afm.storeDoubleField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchDoubleField(int fieldNum)
+ */
+ public double fetchDoubleField(int fieldNum) {
+ return afm.fetchDoubleField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeStringField(int fieldNum,
+ * String value)
+ */
+ public void storeStringField(int fieldNum, String value) {
+ afm.storeStringField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchStringField(int fieldNum)
+ */
+ public String fetchStringField(int fieldNum) {
+ return afm.fetchStringField(fieldNum);
+ }
+
+
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#storeObjectField(int fieldNum,
+ * Object value)
+ */
+ public void storeObjectField(int fieldNum, Object value) {
+ afm.storeObjectField(fieldNum, value);
+ }
+
+ /**
+ * @see org.apache.jdo.state.FieldManager#fetchObjectField(int fieldNum)
+ */
+ public Object fetchObjectField(int fieldNum) {
+ return afm.fetchObjectField(fieldNum);
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractRequest.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractRequest.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/AbstractRequest.java Sun May 22 11:40:13 2005
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.jdo.PersistenceManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jdo.model.jdo.JDOClass;
+import org.apache.jdo.state.StateManagerInternal;
+import org.apache.jdo.util.I18NHelper;
+
+/**
+* Base implementation for all Request subtypes. Provides RequestId, and
+* representation of Request types for all subclasses. Ergo, when you add a
+* Request type you must add it's request type representation here.
+*
+* @author Dave Bristor
+*/
+abstract class AbstractRequest implements Request {
+ //
+ // Several members are accessible from subclasses
+ //
+
+ /**
+ * The state manager which is the subject of this request.
+ */
+ // Please treat this as final after constructors have run.
+ protected /* final */ StateManagerInternal sm;
+
+ /**
+ * PersistenceManagerFactory via which request is being done.
+ */
+ protected final FOStorePMF pmf;
+
+ /**
+ * Stream to which request writes itself.
+ */
+ protected final FOStoreOutput out;
+
+ /**
+ * Class meta data of the object represented by the constructor's given
+ * state manager
+ */
+ // Please treat this as final after constructors (including those of
+ // subclasses, which might set this) have run.
+ protected /* final */ JDOClass jdoClass;
+
+ /**
+ * uid corresponding to the same java.lang.Class that initializes
+ * jdoClass.
+ */
+ // Please treat this as final after constructors (including those of
+ // subclasses, which might set this) have run.
+ protected /* final */ FOStoreSchemaUID fsuid;
+
+ protected static final I18NHelper msg = I18NHelper.getInstance(I18N.NAME);
+
+ /** Logger */
+ static final Log logger = LogFactory.getFactory().getInstance(
+ "org.apache.jdo.impl.fostore"); // NOI18N
+
+ //
+ // Requests are written into the FOStoreOutput, and have this
+ // format:
+ //
+ // * RequestId: Per-PMF, one per request.
+ // * RequestType: See above table requestTypes.
+ // * Length: Length in bytes of the RequestType-specific data
+ // * RequestType-specific data, Length bytes long.
+ //
+ // The methods in this class provide the means of writing the RequestId
+ // and RequestType (via beginRequest()) and the Length (via
+ // endRequest()). All AbstractRequest subclasses should invoke these
+ // methods at the beginning and end of their operations which create the
+ // actual RequestType-specific data.
+ //
+
+ // Position in the output at which we will write the length of the
+ // request. Set when we beginRequest(). Referenced when we
+ // endRequest().
+ private int lengthPos = 0;
+
+ // Written at lengthPos to advance the output over the length field.
+ protected static final int LENGTH_COOKIE = 0x10badbad;
+
+ // Identifies this request uniquely within a PMF.
+ private final RequestId requestId;
+
+ // Identifies the type of the request. Please treat as 'final' after
+ // beginRequest.
+ private RequestType requestType;
+
+ // When true, indicates that the request has written all its information
+ // to the FOStoreOutput. See endRequest().
+ private boolean sealed = false;
+
+ protected AbstractRequest(StateManagerInternal sm, Message m,
+ FOStorePMF pmf) {
+
+ this(m, pmf);
+
+ this.sm = sm;
+ FOStoreModel model = pmf.getModel();
+ if (sm != null) {
+ Class cls = sm.getPCClass();
+ this.fsuid = FOStoreSchemaUID.lookup(cls, model);
+ this.jdoClass = model.getJDOClass(cls);
+ }
+ }
+
+ protected AbstractRequest(Message m, FOStorePMF pmf) {
+ this.out = m.getOutput();
+ this.pmf = pmf;
+
+ this.requestId = RequestId.allocate(pmf);
+ m.putRequest(requestId, this);
+ }
+
+ //
+ // NOTE: when initialized by the second constructor, the sm and jdoClass
+ // fields are not filled in. Therefore, methods in this class must *not*
+ // assume they have valid values!
+ //
+
+ protected RequestId getId() {
+ return requestId;
+ }
+
+ /**
+ * @see Request#doRequest
+ */
+ public final void doRequest() throws IOException {
+ // We must be the only one writing to the output to ensure we
+ // write a valid request
+ synchronized (out) {
+ beginRequest();
+ doRequestBody();
+ endRequest();
+ }
+ }
+
+ /**
+ * Writes the header of the request. The header is always:<p>
+ * request id<br>
+ * request type<br>
+ * length<br>
+ *
+ * No, we don't really know the length yet. We write out any old
+ * integer, and then later (in endRequest) come back and write in the
+ * real length.
+ */
+ // Final to enforce the above rules
+ private final void beginRequest() throws IOException {
+ if (lengthPos != 0) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "beginRequest", // NOI18N
+ msg.msg("ERR_RequestAlreadyBegun")); // NOI18N
+ }
+ requestId.write(out);
+ requestType = RequestType.get(this.getClass());
+ if (null == requestType) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "beginRequest", // NOI18N
+ msg.msg("ERR_NoRequestType", this.getClass().getName())); // NOI18N
+ }
+ requestType.write(out);
+ lengthPos = out.getPos();
+ out.writeInt(LENGTH_COOKIE);
+ }
+
+ /**
+ * Subclasses must implement in this method the actual writing of their
+ * Request type-specific data.
+ */
+ protected abstract void doRequestBody() throws IOException;
+
+ /**
+ * Write the length. Remember, in beginRequest we only wrote a
+ * placeholder.
+ */
+ // Final to enforce the rules noted in beginRequest().
+ private final void endRequest() throws IOException {
+ if (sealed) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "endRequest", // NOI18N
+ msg.msg("ERR_RequestAlreadyEnded")); // NOI18N
+ }
+ int currentPos = out.getPos();
+ // Subtract off an extra 4, which is the size of the length itself.
+ int length = currentPos - lengthPos - 4;
+ out.setPos(lengthPos);
+ out.writeInt(length);
+ out.setPos(currentPos);
+ sealed = true;
+
+ if (logger.isTraceEnabled()) {
+ logger.trace("Request " + requestId + "/" + requestType); // NOI18N
+ Tester.dump("REQ", out, lengthPos, length); // NOI18N
+ }
+ }
+
+ /** Get the StateManager associated with this request, null if none.
+ *@return the StateManager.
+ */
+ public StateManagerInternal getStateManager() {
+ return sm;
+ }
+
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassHandler.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassHandler.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassHandler.java Sun May 22 11:40:13 2005
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Iterator;
+
+/**
+* Process requests to activate classes. 'Activating a class' means giving it
+* a representation in the store.
+*
+* @author Dave Bristor
+*/
+// This is server-side code. It does not need to live in the client.
+class ActivateClassHandler extends RequestHandler {
+
+ private ActivateClassHandler(Reply reply, int length,
+ FOStoreServerConnection con) {
+
+ super(reply, length, con);
+ }
+
+ public static final HandlerFactory factory =
+ new HandlerFactory() {
+ public RequestHandler getHandler(Reply reply, int length,
+ FOStoreServerConnection con) {
+ return new ActivateClassHandler(reply, length, con);
+ }};
+
+
+ /** Takes care of changing the provisional CLIDs in fields whose classes
+ * have been activated into real CLIDs.
+ */
+ class ActivateClassFinisher implements RequestFinisher {
+ private final FOStoreDatabase db;
+ private final OID oid;
+
+ ActivateClassFinisher(FOStoreDatabase db, OID oid) {
+ this.db = db;
+ this.oid = oid;
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACFinisher for " + oid); // NOI18N
+ }
+ }
+
+ /**
+ * @see RequestFinisher#finish
+ */
+ public void finish() {
+ DBClass dbClass = null;
+ try {
+ dbClass = (DBClass)db.get(oid);
+
+ if (dbClass.hasProvisionals()) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACFinisher for " + oid + " remapCLIDs"); // NOI18N
+ }
+ dbClass.remapCLIDs(db);
+ }
+
+ if (dbClass.hasSuperclasses()) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACFinisher for " + oid + " setupSubclasses"); // NOI18N
+ }
+ dbClass.setupSubclasses(db);
+ }
+
+ db.replace(oid, dbClass);
+ } catch (FOStoreDatabaseException ex) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "finish", ex); // NOI18N
+ }
+ }
+ }
+ // end of class ActivateClassFinisher
+
+ /** @see RequestHandler#handleRequest
+ * @see ActivateClassRequest#doRequestBody
+ */
+ RequestFinisher handleRequest()
+ throws IOException, FOStoreDatabaseException {
+
+ RequestFinisher rc = null;
+
+ // We know the CLID is provisional; we wouldn't be activating
+ // otherwise. See if we have already activated this class in this
+ // store. If so, return it's CLID in the reply; otherwise allocate a
+ // new CLID and provide that to the client.
+
+ DataInput in = con.getInputFromClient();
+ FOStoreDatabase db = con.getDatabase();
+ DBInfo dbInfo = db.getDBInfo();
+
+ OID classOID = null; // datastore-assigned OID for given class
+ CLID rCLID = null; // datastore-assigned CLID for given class
+
+ String name = in.readUTF();
+ CLID pCLID = CLID.read(in);
+ FOStoreSchemaUID fsuid = FOStoreSchemaUID.read(in);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "ActivateClassHandler.hR/0: " + pCLID + // NOI18N
+ ", " + name + // NOI18N
+ ", fsuid=" + fsuid); // NOI18N
+ }
+
+ // Iterate over all classes in the store, looking for one who's name
+ // is the same. If there isn't one, assign a new CLID, and store the
+ // below data with it. If there already is one, get it's CLID, and
+ // read the rest of the data from the buffer, but throw it away.
+ DBExtent extent = null;
+ for (Iterator i = dbInfo.getExtents(); i.hasNext();) {
+ extent = (DBExtent)i.next();
+ if (extent.isExtentFor(name, fsuid)) {
+ break;
+ } else {
+ extent = null;
+ }
+ }
+
+ // Regardless of whether the class is already activated, we create a
+ // DBClass, as doing so reads the remainder of the associated data.
+ // XXX PERF Skip bytes instead of reading/parsing data
+ DBClass dbClass = DBClass.create(name, pCLID, fsuid,in, db);
+
+ if (null != extent) {
+ classOID = extent.getDBClassOID();
+ rCLID = classOID.getCLID();
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "ActivateClassHandler.hR/1: existing " + // NOI18N
+ classOID);
+ }
+ } else {
+ // Get a real OID for the dbClass. Keep dbClass's existing CLID
+ // around to map from references to it from other requests in the
+ // same message as this ActivateClassRequest.
+ classOID = dbInfo.newClassOID();
+ rCLID = classOID.getCLID();
+ dbClass.setCLID(rCLID);
+
+ // Put the dbClass in the database
+ db.put(classOID, dbClass);
+
+ // Now create an extent for objects of this type.
+ DBExtent dbExtent =
+ DBExtent.create(db, dbClass.getName(), fsuid, rCLID);
+ dbExtent.store(db);
+ con.addExtent(dbExtent);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ActivateClassHandler.hr/3:"); // NOI18N
+ for (Iterator i = dbInfo.getExtents(); i.hasNext();) {
+ extent = (DBExtent)i.next();
+ OID o = extent.getDBClassOID();
+ DBClass dbc = (DBClass)db.get(o);
+ logger.debug(dbc.toString());
+ }
+ }
+
+ db.mapProvisionalCLIDToReal(pCLID, rCLID);
+ reply.writeCLID(rCLID);
+ reply.setStatus(Status.OK);
+
+ if (dbClass.hasProvisionals() || dbClass.hasSuperclasses()) {
+ rc = new ActivateClassFinisher(db, classOID);
+ }
+
+ return rc;
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassRequest.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassRequest.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ActivateClassRequest.java Sun May 22 11:40:13 2005
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.jdo.impl.model.java.runtime.RuntimeJavaModelFactory;
+import org.apache.jdo.model.jdo.JDOClass;
+import org.apache.jdo.model.jdo.JDOField;
+import org.apache.jdo.state.StateManagerInternal;
+
+
+
+/**
+ * Represents a request to cause the description of a class in the client to
+ * have a representation in the store.
+ *
+ * @author Dave Bristor
+ */
+//
+// This is client-side code. It does not need to live in the server.
+//
+class ActivateClassRequest extends AbstractRequest {
+ // CLID of the class to be activated.
+ private final CLID clid;
+
+ /** RuntimeJavaModelFactory. */
+ private static final RuntimeJavaModelFactory javaModelFactory =
+ (RuntimeJavaModelFactory) AccessController.doPrivileged(
+ new PrivilegedAction () {
+ public Object run () {
+ return RuntimeJavaModelFactory.getInstance();
+ }
+ }
+ );
+
+ ActivateClassRequest(Class cls, Message m, FOStorePMF pmf) {
+ super(m, pmf);
+ FOStoreModel model = pmf.getModel();
+ this.clid = model.getCLID(cls);
+ super.fsuid = FOStoreSchemaUID.lookup(cls, model);
+ super.jdoClass = model.getJDOClass(cls);
+ }
+
+ /**
+ * @see AbstractRequest#doRequestBody
+ * The format of this request is (aside from the request header):
+ * <pre>
+ * class's name: String
+ * clid: CLID (will always be provisional)
+ * FOStoreSchemaUID for class
+ * numPCSuperclasses: int
+ * foreach PCSuperclass in inheritance order going towards Object:
+ * the superclass' class name
+ * the superclass's CLID
+ * the superclass's FOStoreSchemaUID
+ * numFields: int
+ * scoField: boolean
+ * foreach field in the class:
+ * the field's name
+ * the field's CLID
+ * the field's class's FOStoreSchemaUID
+ * </pre>
+ * Note that we do not currently support all sco information, and will
+ * have to ammend this when we do. In that case, we will write also
+ * write, for each field:
+ * <pre>
+ * scoField: boolean
+ * elementType: String
+ * allowNulls: boolean
+ * initialSize: int
+ * </pre>
+ * Note that we write out information in order of name, CLID, FSUID in all
+ * cases above.
+ */
+ public void doRequestBody() throws IOException {
+
+ FOStoreModel model = pmf.getModel();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACRequest.dRB: " + clid + // NOI18N
+ ", " + jdoClass.getName() + // NOI18N
+ ", fsuid=" + fsuid); // NOI18N
+ }
+ out.writeUTF(jdoClass.getName());
+ clid.write(out);
+ fsuid.write(out);
+
+ // Write PC superclass information
+ ArrayList jdoSupers = null;
+ int numSupers = 0;
+ JDOClass jdoSuper = jdoClass.getPersistenceCapableSuperclass();
+ if (null != jdoSuper) {
+ jdoSupers = new ArrayList();
+ while (null != jdoSuper) {
+ jdoSupers.add(jdoSuper);
+ jdoSuper = jdoSuper.getPersistenceCapableSuperclass();
+ }
+ numSupers = jdoSupers.size();
+ }
+
+ out.writeInt(numSupers);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACRequest.dRB: numSupers=" + numSupers); // NOI18N
+ }
+
+ for (int i = 0; i < numSupers; i++) {
+ jdoSuper = (JDOClass)jdoSupers.get(i);
+ Class javaSuper = javaModelFactory.getJavaClass(jdoSuper.getJavaType());
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "ACRequest.dRB: jdoSuper: " + //NOI18N
+ jdoSuper + ", javaSuper: " + javaSuper); // NOI18N
+ }
+ CLID superCLID = model.getCLID(javaSuper);
+ FOStoreSchemaUID superFSUID =
+ FOStoreSchemaUID.lookup(javaSuper, model);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACRequest.dRB: super" + i + // NOI18N
+ ", " + javaSuper.getName() + // NOI18N
+ ", " + superCLID + // NOI18N
+ ", superFSUID: " + superFSUID); // NOI18N
+ }
+
+ out.writeUTF(jdoSuper.getName());
+ superCLID.write(out);
+ superFSUID.write(out);
+ }
+
+ // Write field information.
+ JDOField fields[] = jdoClass.getManagedFields();
+ int numFields = fields.length;
+ out.writeInt(numFields);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACRequest.dRB: numFields=" + numFields); // NOI18N
+ }
+
+ for (int i = 0; i < numFields; i++) {
+ // XXX TBD Model: Add SCO-, other model-provided info
+ JDOField fld = fields[i];
+
+ Class cls = javaModelFactory.getJavaClass(fld.getType());
+ CLID fldCLID = model.getCLID(cls);
+ FOStoreSchemaUID fldFSUID = FOStoreSchemaUID.lookup(cls, model);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ACRequest.dRB: field" + i + // NOI18N
+ ", " + cls.getName() + // NOI18N
+ ", " + fldCLID + // NOI18N
+ ", fldFSUID: " + fldFSUID); // NOI18N
+ }
+
+ out.writeUTF(fld.getName());
+ fldCLID.write(out);
+ fldFSUID.write(out);
+ }
+ }
+
+ /**
+ * @see Request#handleReply
+ */
+ public void handleReply(Status status, DataInput in, int length)
+ throws IOException {
+ //
+ // The format of this reply is:
+ //
+ // clid
+ //
+
+ CLID newClid = CLID.read(in);
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "ActivateClass.hR: " + status + ", " + clid + " " + // NOI18N
+ Tester.toHex(clid.getId(), 16) +
+ " -> " + newClid + " " + // NOI18N
+ Tester.toHex(newClid.getId(), 16));
+ }
+
+ // Update the metadata to use the new, store-provided "real" CLID.
+ pmf.getModel().updateCLID(clid, newClid);
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxHandler.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxHandler.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxHandler.java Sun May 22 11:40:13 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.IOException;
+
+/**
+* Process BeginTx requests.
+*
+* @author Dave Bristor
+*/
+// This is server-side code. It does not need to live in the client.
+class BeginTxHandler extends RequestHandler {
+ private BeginTxHandler(Reply reply, int length,
+ FOStoreServerConnection con) {
+
+ super(reply, length, con);
+ }
+
+ public static final HandlerFactory factory =
+ new HandlerFactory() {
+ public RequestHandler getHandler(Reply reply, int length,
+ FOStoreServerConnection con) {
+ return new BeginTxHandler(reply, length, con);
+ }};
+
+ RequestFinisher handleRequest()
+ throws IOException, FOStoreDatabaseException {
+
+ FOStoreInput in = con.getInputFromClient();
+ boolean optimistic = in.readBoolean();
+ con.setOkToReleaseDatabase(optimistic);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("BeginTxHandler.hR: " + optimistic); // NOI18N
+ }
+
+ reply.setStatus(Status.OK);
+
+ return null;
+ }
+}
+
+
+
+
+
+
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxRequest.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxRequest.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BeginTxRequest.java Sun May 22 11:40:13 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.IOException;
+
+/**
+* Represents a request to inform the store that a transaction is beginning.
+*
+* @author Dave Bristor
+*/
+//
+// This is client-side code. It does not need to live in the server.
+//
+class BeginTxRequest extends AbstractRequest {
+ /** Indicates whether an optimistic (true) or datastore (false)
+ * transaction is started.
+ */
+ private final boolean optimistic;
+
+ BeginTxRequest(Message m, FOStorePMF pmf, boolean optimistic) {
+ super(m, pmf);
+ this.optimistic = optimistic;
+ }
+
+ //
+ // Methods from AbstractRequest
+ //
+
+ protected void doRequestBody() throws IOException {
+ //
+ // The format of this request is (aside from the request header):
+ //
+ // optimistic: boolean, indicates whether transaction is optimistic or
+ // datastore
+ //
+
+ if (logger.isDebugEnabled())
+ logger.debug("BeginTxRequest.dRB: " + optimistic); // NOI18N
+ out.writeBoolean(optimistic);
+ }
+
+ //
+ // Methods from Request
+ //
+
+ public void handleReply(Status status, DataInput in, int length)
+ throws IOException {
+
+ if (logger.isDebugEnabled())
+ logger.debug("BeginTxRequest.hR: " + status); // NOI18N
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Block.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Block.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Block.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Block.java Sun May 22 11:40:13 2005
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.netbeans.mdr.persistence.StorageException;
+import org.netbeans.mdr.persistence.Streamable;
+
+/**
+* Represents an object stored in the database as a semi-opaque value. While
+* it has no methods which allow interesting access to itself, the store has
+* metadata which describes its contents.
+* <p>
+* This class is <code>public</code> so that it can be used as a
+* <code>Streamable</code> and stored in the database.
+*
+* @author Dave Bristor
+*/
+// XXX PERF Fix this and/or the btree package to avoid the extra copy.
+// Right now, we're making a copy of the data in the client's Message. We
+// don't want to do that, eventually; we want to use the bytes that are
+// there.
+public class Block implements Streamable {
+ // Our copy of data from the client
+ private byte data[] = null;
+
+ Block(FOStoreInput in, int length) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+
+ try {
+ dos.write(in.getBuf(), in.getPos(), length);
+ data = baos.toByteArray();
+ in.advance(length);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "constructor(FOStoreInput, int)", ex); // NOI18N
+ }
+ }
+
+ byte[] getData() {
+ return data;
+ }
+
+ //
+ // Implement Streamable
+ //
+
+ public Block() { }
+
+ public void write(OutputStream os) throws StorageException {
+ try {
+ DataOutputStream dos = new DataOutputStream(os);
+ dos.writeInt(data.length);
+ dos.write(data, 0, data.length);
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "write", ex); // NOI18N
+ }
+ }
+
+ public void read(InputStream is) throws StorageException {
+ try {
+ DataInputStream dis = new DataInputStream(is);
+
+ int length = dis.readInt();
+
+ data = new byte[length];
+ dis.readFully(data, 0, length);
+
+ } catch (IOException ex) {
+ throw new FOStoreFatalIOException(
+ this.getClass(), "read", ex); // NOI18N
+ }
+ }
+
+ // Debug support
+ //
+ public void dump() {
+ Tester.dump("BLK", data, data.length); // NOI18N
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BooleanTranscriber.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BooleanTranscriber.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BooleanTranscriber.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BooleanTranscriber.java Sun May 22 11:40:13 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+* Transcribes boolean values.
+*
+* @author Dave Bristor
+*/
+class BooleanTranscriber extends FOStoreTranscriber {
+ private static BooleanTranscriber instance = new BooleanTranscriber();
+
+ private BooleanTranscriber() {}
+
+ static BooleanTranscriber getInstance() {
+ return instance;
+ }
+
+ void storeBoolean(boolean value, DataOutput out)
+ throws IOException {
+
+ out.writeBoolean(value);
+ }
+
+ boolean fetchBoolean(DataInput in) throws IOException {
+ return in.readBoolean();
+ }
+
+ void skip(DataInput in) throws IOException {
+ in.readBoolean();
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BufferedRequestFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BufferedRequestFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BufferedRequestFactory.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/BufferedRequestFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+
+import org.apache.jdo.pm.PersistenceManagerInternal;
+import org.apache.jdo.state.StateManagerInternal;
+
+
+/**
+ * Creates different kinds of requests.
+ *
+ * @author Dave Bristor
+ */
+class BufferedRequestFactory implements RequestFactory {
+ private static BufferedRequestFactory instance;
+
+ private BufferedRequestFactory() { }
+
+ static RequestFactory getInstance() {
+ if (null == instance) {
+ instance = new BufferedRequestFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * @see RequestFactory#getCreateOIDRequest
+ */
+ public CreateOIDRequest getCreateOIDRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf,
+ OID oid, PersistenceManagerInternal pm) {
+
+ return new CreateOIDRequest(sm, m, pmf, oid, pm);
+ }
+
+ /**
+ * @see RequestFactory#getActivateClassRequest
+ */
+ public ActivateClassRequest getActivateClassRequest(
+ Class cls, Message m, FOStorePMF pmf) {
+
+ return new ActivateClassRequest(cls, m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getInsertRequest
+ */
+ public InsertRequest getInsertRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf) {
+
+ return new InsertRequest(sm, m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getUpdateRequest
+ */
+ public UpdateRequest getUpdateRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf,
+ BitSet loadedFields, BitSet dirtyFields, boolean optimistic) {
+
+ return new UpdateRequest(sm, m, pmf,
+ loadedFields, dirtyFields, optimistic);
+ }
+
+ /**
+ * @see RequestFactory#getVerifyRequest
+ */
+ public VerifyRequest getVerifyRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf,
+ boolean verifyFields, BitSet fieldsToVerify) {
+
+ return new VerifyRequest(sm, m, pmf, verifyFields, fieldsToVerify);
+ }
+
+ /**
+ * @see RequestFactory#getFetchRequest
+ */
+ public FetchRequest getFetchRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf) {
+
+ return new FetchRequest(sm, m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getGetExtentRequest
+ */
+ public GetExtentRequest getGetExtentRequest(
+ FOStoreExtent extent, Class pcClass,
+ boolean subclasses, Message m,
+ PersistenceManagerInternal pm) {
+
+ return new GetExtentRequest(extent, pcClass, subclasses, m, pm);
+ }
+
+ /**
+ * @see RequestFactory#getGetInstancesRequest
+ */
+ public GetInstancesRequest getGetInstancesRequest(
+ ArrayList oids, int start, int numInstances,
+ Message m, PersistenceManagerInternal pm, Class cls) {
+
+ return new GetInstancesRequest(oids, start, numInstances, m, pm, cls);
+ }
+
+ /**
+ * @see RequestFactory#getDeleteRequest
+ */
+ public DeleteRequest getDeleteRequest(
+ StateManagerInternal sm, Message m, FOStorePMF pmf) {
+
+ return new DeleteRequest(sm, m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getGetClassRequest
+ */
+ public GetClassRequest getGetClassRequest(
+ CLID clid, Message m, FOStorePMF pmf, PersistenceManagerInternal pm) {
+
+ return new GetClassRequest(clid, m, pmf, pm);
+ }
+
+ /**
+ * @see RequestFactory#getBeginTxRequest
+ */
+ public BeginTxRequest getBeginTxRequest(
+ Message m, FOStorePMF pmf, boolean optimistic) {
+
+ return new BeginTxRequest(m, pmf, optimistic);
+ }
+
+ /**
+ * @see RequestFactory#getCommitRequest
+ */
+ public CommitRequest getCommitRequest(
+ Message m, FOStorePMF pmf) {
+
+ return new CommitRequest(m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getRollbackRequest
+ */
+ public RollbackRequest getRollbackRequest(
+ Message m, FOStorePMF pmf) {
+
+ return new RollbackRequest(m, pmf);
+ }
+
+ /**
+ * @see RequestFactory#getDumpRequest
+ */
+ public DumpRequest getDumpRequest(
+ DumpOption option, String className, Message m,
+ FOStorePMF pmf) {
+ return new DumpRequest(option, className, m, pmf);
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Bundle.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Bundle.properties (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/Bundle.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,407 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Resource bundle for the messages
+#
+# Source files are listed in alphabetical order: please keep it this way!
+#
+# Messages within a source file are not necessarily in alphabetical
+# order; feel free to add to the end of the list.
+#
+# Note that since this is for the fostore package, id's don't have that as
+# part of their name, in the interests of brevity, for example "transcriber"
+# instead of "fostoretranscriber" and "nyi" instead of
+#"fostorenotyetimplementedexception".
+#
+# NOTE: Messages with a line before them '#NOI18N' are NOT to be localized!
+# See http://www.netbeans.org/i18n, section 2.1.2, item 2.
+#
+
+#
+# Generic
+#
+MSG_CannotGetSystemProperty=WARNING: a SecurityException was thrown when \
+trying to read the system property ''{0}''. \
+\n{1}\
+\nYou must grant java.util.PropertyPermission("*","read") to the codeBase \
+containing the JDO Reference Implementation (jdo-ri.jar).
+
+#
+# AbstractRequest
+#
+#NOI18N
+ERR_RequestAlreadyBegun=Request already begun.
+#NOI18N
+ERR_NoRequestType=No request type for class {0}.
+#NOI18N
+ERR_RequestAlreadyEnded=Request already ended.
+
+#
+# AIDTranscriber
+#
+EXC_ObjectIdKeyFieldNull=Key field ''{1}'' of class ''{0}'' has a null value.
+EXC_GetObjectByIdKeyFieldNull=Key fields in object id instances must not be null. {0}
+EXC_MakePersistentKeyFieldNull=Key fields in persistent instances must not be null. {0}
+
+#
+# CLID
+#
+#NOI18N
+ERR_OutOfProvisionalCLIDs=Ran out of provisional CLID's (max is {0}).
+#NOI18N
+ERR_InvalidRange=Id {0} is out of range {1} to {2}.
+#NOI18N
+ERR_Unknown=Class {0} does not have a known CLID.
+
+#
+# CommitHandler
+#
+#NOI18N
+ERR_CommitFailed=Commit failed: {0}.
+
+#
+# DBExtent
+#
+#NOI18N
+ERR_SecondInstance=Attempt to add a second instance with {0} to extent of {1}.
+
+#
+# DBInfo
+#
+#NOI18N
+ERR_OutOfUIDs=Ran out of UID's (max is {0}).
+#NOI18N
+ERR_NoUIDsForCLID=No nextUIDs entry was allocated for {0}.
+
+#
+# DeleteHandler
+#
+EXC_DeleteVerifyFailed=Optimistic transaction cannot delete object with id {0} because it does not exist in the database.
+#NOI18N
+ERR_DatastoreFailed=Internal error: Datastore transaction attempt to delete object with id {0} when it does not exist in the database.
+
+#
+# DumpOption
+#
+EXC_BadValue=Dump option not recognized: {0}.
+
+#
+# Dumper
+#
+EXC_InstantiateClass=Could not load specified class {0}.
+MSG_MissingDumpOption=Missing dumpOption parameter.
+MSG_DumperException=Dumper caught exception: {0}
+MSG_ExtentName=Extent of {0}:
+MSG_ExtentCount=Extent of {0} has {1} objects.
+MSG_Usage=\nFOStore dumper program usage:\n\t-DdumpOption=<option> -DclassNames=<classNames>\nParameter <option> can be one of the following alternatives: \n\tdbInfo: prints general information about the store.\n\tclassMetadata: prints the metadata for the classes <classNames>.\n \tclassInstances: prints all instances of the classes <classNames>.\n \tclassSubclasses: prints all information about all subclasses of the classes <classNames>.
+
+#
+# DumpHandler
+#
+MSG_MissingParameter=Parameter {0} is null.
+MSG_DbClassNotFound=There is no information on class {0} in the database.
+MSG_NoSubclasses=Class {0} does not have any subclasses.
+MSG_Subclasses=Class {0} has these subclasses:
+# NOI18N
+ERR_NoSubHandler=No dump suboption named {0}.
+
+#
+# FetchHandler
+# GetClassHandler
+#
+EXC_DoesNotExist=Object with identity {0} does not exist in the database.
+
+
+#
+# FieldFetcher
+#
+EXC_CannotLoadInstanceClass=Attempting to fetch an instance of class {0}, but cannot load that class.
+EXC_CannotLoadFieldClass=Attempting to fetch an instance of class {0}, but cannot load class {1} which is required for one of its fields.
+#NOI18N
+ERR_ClassMismatch=While fetching an instance of class {0}, the type of a field in the database is {1} which does not match {2}, which is the type of that same field in the current Java virtual machine.
+EXC_FsuidMismatch=Class structure mismatch for class {0}. The persistente structure of the class in the database does not match that in the running Java virtual machine.
+
+#
+# FOStoreConnectionFactory
+#
+#NOI18N
+ERR_Badformat=Integer found in invalid format: should not happen!
+#NOI18N
+ERR_CannotClose=Could not close database {0}.
+#NOI18N
+ERR_CloseConnectionpoolPut=InterruptedException while closing connection.
+#NOI18N
+ERR_DuplicatePool=Pool created but already exists.
+#NOI18N
+ERR_PoolPutFill=InterruptedException while filling connection pool.
+#NOI18N
+ERR_PoolGet=InterruptedException while getting connection.
+EXC_AssertConfigurableFailure=Cannot configure connection factory after first connection is acquired.
+EXC_CannotCreateConnection=Cannot create a connection to {0}
+EXC_ConnectException=Connection refused by host {0} at port {1}.
+EXC_UnknownHostException=Unknown host {0}.
+EXC_CannotSpecifyStreamHandler=A SecurityException was thrown when trying to \
+connect to the fostore database. You must grant \
+java.net.NetPermission("specifyStreamHandler") to the codeBase \
+containing the JDO Reference Implementation (jdo-ri.jar).
+
+#
+# FOStoreConnector
+#
+EXC_RollbackOnly=Database has rolled back due to internal error and cannot perform further operations.
+#NOI18N
+EXC_Busy=Reentrancy problem: Attempt to reenter a FOStoreConnector while it is being flushed.
+
+#
+# FOStoreDatabase
+#
+EXC_SecurityExceptionOnCreateBtreeStorage=A SecurityException was thrown when trying to \
+create a fostore datastore. You must grant the following permissions to the \
+codeBases containing the JDO Reference Implementation (jdo-ri.jar and \
+btree.jar): \
+java.io.FilePermission("<fostore database files>","read,write,delete") and \
+java.util.PropertyPermission("*","read").
+EXC_SecurityExceptionOnCloseBtreeStorage=A SecurityException was thrown when trying to \
+close a fostore datastore. You must grant the following permissions to the \
+codeBases containing the JDO Reference Implementation (jdo-ri.jar and \
+btree.jar): \
+java.io.FilePermission("<fostore database files>","read,write,delete") and \
+java.util.PropertyPermission("*","read").
+EXC_CannotReadFile=A SecurityException was thrown when trying to read file or \
+directory ''{0}''. You must grant java.io.FilePermission("{0}","read") to the \
+codeBase containing the JDO Reference Implementation (jdo-ri.jar).
+EXC_CannotDeleteFile=A SecurityException was thrown when trying to delete file \
+or directory ''{0}''. You must grant java.io.FilePermission("{0}","delete") to \
+the codeBase containing the JDO Reference Implementation (jdo-ri.jar).
+#NOI18N
+ERR_CLIDNotProv=given CLID is not provisional: {0}.
+#NOI18N
+ERR_OIDNotProv=given OID is not provisional: {0}.
+#NOI18N
+ERR_CloseDatabase=Database {0} not found in databaseMap.
+#NOI18N
+ERR_DirectoryDoesNotExist=Directory {0} does not exist.
+
+#
+# FOStoreInput
+#
+#NOI18N
+ERR_InvalidSeekPos=Given seek position {0} is not in range 0 to {1}.
+
+#
+# FOStoreModel
+#
+#NOI18N
+ERR_NoJDOClass=Cannot get JDO Model class information for class {0}; caught exception {1}.
+
+#
+# FOStoreOutput
+#
+#NOI18N
+ERR_InvalidSeekPos=Given seek position {0} is not in range 0 to {1}.
+#NOI18N
+ERR_Closed=Output is closed.
+
+#
+# FOStorePMF
+#
+#NOI18N
+ERR_OIDNotProv=given OID is not provisional: {0}.
+#NOI18N
+ERR_DuplicateProvOID=duplicate provisional OID: {0}.
+EXC_CannotCreateJDOQLQueryFactory=Cannot create JDOQLQueryFactory of class ''{0}''.
+
+#
+# FOStoreSchemaUID
+#
+#NOI18N
+ERR_Algorithm=Cannot create FOStoreSchemaUID.
+
+#
+# FOStoreServerConnectionImpl
+#
+#NOI18N
+ERR_CloseDatabaseInterrupted=Interrupted closing database.
+#NOI18N
+ERR_GetDatabaseInterrupted=Interrupted getting database.
+#NOI18N
+ERR_GetDatabaseException=Exception getting database.
+
+#
+# FOStoreStoreManager
+#
+EXC_NotOID=Given object is not a valid OID.
+EXC_UnboundOID=Cannot get datastore OID for given provisional OID.
+EXC_VerifyFields=Field values in memory and database do not match.
+ERR_Security=SecurityException thrown while getting JDOImplHelper: {0}.
+
+#
+# GetClassRequest
+#
+EXC_NoClassForCLID=No class found for {0}: {1}.
+
+#
+# FOStoreExtent
+#
+# NOI18N
+EXC_RemoveNotSupported=JDO iterators do not support the remove method.
+
+#
+# InsertHandler
+#
+#NOI18N
+ERR_NullRealCLID=Failed to get a datastore CLID for provisional {0}.
+ERR_InsertException=Object with id {0} already exists in the database.
+
+#
+# Main
+#
+#NOI18N
+ERR_HandleConnectionReadIOException=IOException reading from socket.
+#NOI18N
+ERR_HandleConnectionWriteIOException=IOException writing to socket.
+#NOI18N
+ERR_HandleConnectionWriteInterruptedException=InterruptedException writing to socket.
+
+#
+# Login Handler
+#
+EXC_LoginFailed=Could not login user {1} to database {0}.
+
+#
+# LoginRequest
+#
+#NOI18N
+ERR_NoSuchAlgorithmException=Unable to login to database '{0}' as user '{1}'. No such algorithm: {2}.
+#NOI18N
+ERR_UnsupportedEncodingException=Unable to login to database '{0}' as user '{1}'. Unsupported encoding: {2}
+EXC_CannotLogin=Unable to login to database.
+
+#
+# Main
+#
+MSG_MainUsage1=FOStore Main program usage:\n\t-Dport=<port number> listening port number for connection requests; default: {0}
+MSG_MainUsage2=\t-Dbacklog=<backlog number> listening backlog number for connection requests; default: {0}
+MSG_MainUsage3=\t-Droot=<file path> root path name for databases; default: <user.dir>\n\t-Dtimeout=<timeout> seconds before server process shuts down due to lack of activity; default: {0}\n\nConnect using URL:\n\tfostore://<server-name>[:<port-number>]/<database-name>
+
+#
+# Message
+#
+#NOI18N
+ERR_DuplicateRequestID=Message.putRequest got duplicate RequestId {0}.
+#NOI18N
+ERR_SendToStore=Message.sendToStore got IOException.
+#NOI18N
+ERR_ReceiveFromStore=Message.receiveFromStore got IOException.
+#NOI18N
+ERR_InitOutput=Message.initOutput got IOException.
+#NOI18N
+ERR_FinishOutput=Message.finishOutput got IOException.
+#NOI18N
+ERR_CloseConnection=Message.closeConnection got IOException.
+EXC_MessageVersionMismatch=Version number mismatch while reading message from client: expected {0}, but received {1}.
+
+
+#
+# ObjectTranscriber
+#
+#NOI18N
+ERR_NoTranscriberForClass=No transcriber for class {0}.
+#NOI18N
+ERR_ShouldNotHappen=Should not happen: {0}.
+#NOI18N
+ERR_NullComponentType=Null component type.
+EXC_ClassNotTranscribable=Cannot transcribe instances of class {0}.
+EXC_UnsupportedArrayType=Unsupported array type {0}.
+EXC_CannotLoadClass=Cannot load class named {0}.
+
+#
+# OID
+#
+#NOI18N
+ERR_InvalidAttemptToCreateOID=Invalid attempt to create provisional OID with id of {0}.
+EXC_CannotCompareNonOID=Invalid attempt to compare an OID with a non-OID
+
+#
+# Reply
+#
+#NOI18N
+ERR_Closed=Reply is closed.
+EXC_ReplyVersionMismatch=Version number mismatch while reading reply information from database server: expected {0}, but received {1}.
+
+#
+# ReplyHandler
+#
+EXC_Exceptions=Exceptions occurred during processing.
+EXC_Optimistic=Optimistic verification failed.
+#NOI18N
+ERR_CannotGetRequest=Cannot get request object corresponding to {0}.
+# NOI18N
+ERR_FatalReply=Fatal error in database: {0}.
+
+
+#
+# RequestHandler
+#
+#NOI18N
+ERR_CannotCreateHandler=Could not create request handler for {0}.
+#NOI18N
+ERR_SendToClient=Could not send reply to client: {0}.
+EXC_Unknown=Unknown cause.
+
+#
+# RequestId
+#
+#NOI18N
+ERR_Overflow=Ran out of request id's (max is {0}).
+
+#
+# RollbackHandler
+#
+#NOI18N
+ERR_RollbackFailed=Rollback failed: {0}.
+
+#
+# Status
+#
+#NOI18N
+ERR_OutOfRange=Status value {0} is out of range {1} to {2}.
+MSG_Unknown=unknown
+MSG_Ok=ok
+MSG_Warn=warn
+MSG_Error=error
+MSG_Fatal=fatal
+MSG_Invalid=invalid
+MSG_Rollback=rollback
+MSG_Login=login
+MSG_Optimistic=optimistic
+
+#
+# UpdateHandler
+#
+EXC_OptimisticDoesNotExist=Optimistic transaction cannot verify object with id {0} because it does not exist in the database.
+EXC_OptimisticVerifyFailed=Optimistic transaction failed when verifying object id {0}.
+
+#
+# UpdateRequest
+#
+#NOI18N
+ERR_OidIsProvisional=Object id {0} is provisional and cannot be updated without being inserted first.
+
+#
+# VerifyHandler
+#
+#NOI18N
+ERR_VerifyException=Exception while verifying {0}; nested exception follows.
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ByteTranscriber.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ByteTranscriber.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ByteTranscriber.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/ByteTranscriber.java Sun May 22 11:40:13 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+* Transcribes byte values.
+*
+* @author Dave Bristor
+*/
+class ByteTranscriber extends FOStoreTranscriber {
+ private static ByteTranscriber instance = new ByteTranscriber();
+
+ private ByteTranscriber() {}
+
+ static ByteTranscriber getInstance() {
+ return instance;
+ }
+
+ void storeByte(byte value, DataOutput out) throws IOException {
+ out.writeByte(value);
+ }
+
+ byte fetchByte(DataInput in) throws IOException {
+ return in.readByte();
+ }
+
+ void skip(DataInput in) throws IOException {
+ in.readByte();
+ }
+}