Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java Fri Mar
18 17:02:29 2005
@@ -0,0 +1,132 @@
+/*
+ * 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.BitSet;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.model.jdo.PersistenceModifier;
+import org.apache.jdo.state.StateManagerInternal;
+import org.apache.jdo.util.I18NHelper;
+
+
+/**
+ * Represents a request to verify that in-memory data is the same as that in
+ * the database.
+ *
+ * @author Dave Bristor
+ */
+//
+// This is client-side code. It does not need to live in the server.
+//
+
+//
+// XXX About VerifyRequest's current implementation
+// For now, VerifyRequest ignores the given array which indicates which
+// fields should be checked.
+//
+class VerifyRequest extends InsertRequest {
+ /** If true, verify values of object, otherwise verify only existence (and
+ * ignore remaining parameters). */
+ private final boolean verifyFields;
+
+ /** Fields to verify in database. */
+ private final BitSet fieldsToVerify;
+
+ /** Result of executing request. */
+ private boolean verified;
+
+ VerifyRequest(StateManagerInternal sm, Message m, FOStorePMF pmf,
+ boolean verifyFields, BitSet fieldsToVerify) {
+
+ super(sm, m, pmf);
+ this.verifyFields = verifyFields;
+ this.fieldsToVerify = fieldsToVerify;
+ }
+
+ //
+ // Methods from AbstractRequest
+ //
+
+ /**
+ * Provides the information necessary for a VerifyRequest.
+ * The format of this request is (aside from the request header):
+ * <pre>
+ * oid: OID
+ * boolean: verifyFields
+ * data block (optional; only if verifyFields is true)
+ * </pre>
+ * @see AbstractRequest#doRequestBody
+ */
+ protected void doRequestBody() throws IOException {
+ OID oid = (OID)sm.getInternalObjectId();
+ if (oid.isProvisional()) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "doRequestBody", // NOI18N
+ msg.msg("ERR_OidIsProvisional", oid)); // NOI18N
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.dRB: begin, "+ oid + // NOI18N
+ ", verifyFields=" + verifyFields); // NOI18N
+ }
+
+ oid.write(out);
+ out.writeBoolean(verifyFields);
+
+ if (verifyFields) {
+ // XXX For now, verify the values of all the fields.
+ int fieldNumbers[] = jdoClass.getPersistentFieldNumbers();
+ writeBlock(fieldNumbers, true);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.dRB: end"); // NOI18N
+ }
+ }
+
+ //
+ // Methods from Request
+ //
+
+ /**
+ * Handles reply data from a VerifyReply.
+ * The format of this reply is
+ * <pre>
+ * boolean: true => object exists in database, and (if verifyFields is
+ * true) values match those in request.
+ * </pre>
+ */
+ public void handleReply(Status status, DataInput in, int length)
+ throws IOException {
+
+ verified = in.readBoolean();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.hR: " + getOID() + // NOI18N
+ ", verified=" + verified + ", status=" + status); // NOI18N
+ }
+ }
+
+ boolean getVerified() {
+ return verified;
+ }
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/fostore/package.html Fri Mar 18
17:02:29 2005
@@ -0,0 +1,84 @@
+<!--
+ 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.
+-->
+
+<html>
+<head>
+<title>Package javax.jdo</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body bgcolor="#FFFFFF">
+<p>This package contains the implementation of the File/Object Store JDO Reference
+ Implementation (FOStore, pronounced "foster"). </p>
+<p>This file provides information for implementors and maintainers of the package.</p>
+<h3>Identity in FOStore and provisional ID's</h3>
+<p>All objects created by the client have a datastore-provided ID, called an Object
+ Id (OID.java). Part of the OID represents the class of the object; these id's
+ are called Class Id's and are separately managed (CLID.java). When an object
+ is made persistent:</p>
+<blockquote>
+ <pre>Employee emp = new Employee("John Doe", 12345);</pre>
+ <pre>PersistenceManager pm = PersistenceManagerFactory.getPersistenceManager();</pre>
+ <pre>pm.makePersistent(emp);</pre>
+</blockquote>
+<p>the object is assigned a "provisional" OID, assigned by the client,
+ not by the datastore. When a real OID is required (getObjectId) or the transaction
+ commits, the user's object is then flushed to the store, and a real ID is provided.
+ The datastore provides a datastore ID corresponding to the provisional ID.</p>
+<p>The mapping from provisional to real id's is maintained by both the client
+ and the store. The client maintains it on a per-PMF basis (in FOStorePMF.java).
+ The store maintains it for all clients (currently a single map, which is incorrect
+ as it should be per-client; see FOStoreDatabase.java).</p>
+<p>Similar tables are kept, separately, for CLIDs. These tables are in FOStoreModel.java
+ on the client side, and in FOStoreDatabase.java on the store side. Recall that
+ the OID of an object contains the CLID of the class of the object. If no instances
+ of that class have yet been stored, then the OID contains a provisional CLID.
+ The process of storing the object also stores a representation of the object's
+ class, and creates a datastore-provided CLID.</p>
+<p>The need for each of the tables is as follows:</p>
+<p>OID, client: Assume a persistent object is created, and put into a persistent
+ graph structure. Assume further that the object is comitted, but not the graph
+ structure. At that point, the graph still refers to the object by its provisional
+ OID. Having this table allows us to find the real object ID.</p>
+<p>OID, store: Assume a graph structure of new objects is to be stored, in which
+ a single object is referenced more than once. Each time it is referenced, it
+ is with the provisional ID assigned by the client. The store must ensure that
+ an object is only assigned a single datastore ID, and this table ensures that.</p>
+<p>CLID, client: StoreManager implementations are required to be able to provide
+ a java.lang.Class given an OID. When assigning OIDs, FOStore will never use
+ a provisional CLID if the datastore-provided CLID is available. However, it
+ is possible that two objects of the same class are created, and one is stored.
+ The CLID table in FOStoreMetaData will, after the store, only the datastore-provided
+ ID. If one then asks the store manager for the class of the unstored object
+ by it's OID, we still have to provide the right answer. By keeping a mapping
+ of provisional IDs to datastore IDs in this table, we can do so.</p>
+<p>CLID, store: Exactly the same reasoning as for the OID table in the store:
+ ensuring that a given class is only ever assigned a single CLID. </p>
+<h3>Storing and Fetching Objects</h3>
+<p>Objects are stored in the database by way of InsertRequest, and fetched by
+way of FetchRequest. Each contains several methods to store and fetch Java
+types. If in the unlikely event that more primitive types are added to Java,
+they will have to be added here. Also, support will have to be added to
+FieldManager, which is outside of FOStore in the common package, and to it's
+implementation in the fostore package, in AbstractFieldManager</p>
+<p>More likely, however, is the need to extend the set of non-primitive types,
+ such as Collection types, that FOStore supports. Support for these lies in 2
+ files: CLID.java and the various <i>XXX</i>Transcriber.java files. The first
+ keeps a table of "known" CLID's, which maps between a java.lang.Class
+ and a compiletime-fixed CLID. The latter has a Transcriber class for each of
+ the known CLID's, for instance LocaleTranscriber writes and reads java.util.Locale
+ objects to/from I/O streams.</p>
+</body>
+</html>
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/jdoql/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/jdoql/Bundle.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/jdoql/Bundle.properties (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/jdoql/Bundle.properties Fri Mar
18 17:02:29 2005
@@ -0,0 +1,225 @@
+#
+# 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.
+
+# This file should conform to netbeans standards
+# (http://www.netbeans.org/i18n)
+
+# resource bundle for the messages
+# key consists of: <PREFIX_><description>
+# <PREFIX_> - any valid prefix like MSG_, EXC_, etc.
+# <description> - short description started with the upper case letter and used
+# upper case to represent each next word.
+
+#
+# resource bundle for query messages
+#
+
+#
+# generic
+#
+EXC_MissingCandidateClass=Missing candidate class specification.
+
+#
+# QueryImpl
+#
+EXC_NullQueryInstance=Specified query is null.
+EXC_InvalidCompiledQuery=Invalid compiled query of type ''{0}''.
+EXC_UnboundQuery=Query is not bound to a PersistenceManager.
+EXC_UnknownCandidateClass=Unknown candidate class ''{0}''
+EXC_NoTransaction=No transaction and NontransactionalRead is false.
+
+#
+# main jdoqlc compiler class
+#
+#NOI18N
+ERR_UnexpectedExceptionSemantic=JDOQLC.semanticCheck unexpected exception
+#NOI18N
+ERR_UnexpectedExceptionOptimizer=JDOQLC.optimize unexpected exception
+
+#
+# jdoqlc error message helper class
+#
+EXC_PositionInfoMsg={0}: {1}
+EXC_PositionInfoMsgColumn={0} column({1}): {2}
+EXC_PositionInfoMsgLineColumn={0} line({1}) column({2}): {3}
+
+#
+# jdoqlc syntax error messages
+#
+EXC_SyntaxError=Syntax error.
+EXC_SyntaxErrorAt=Syntax error at ''{0}''.
+EXC_UnexpectedToken=Syntax error unexpected token ''{0}''.
+EXC_UnexpectedChar=Syntax error unexpected char ''{0}''.
+EXC_ExpectedCharFound=Syntax error expected char ''{0}'', found ''{1}''.
+EXC_UnexpectedEOF=Unexpected end of text.
+#NOI18N
+ERR_UnexpectedExceptionUnicode=JDOQLLexer.UNICODE_STR unexpected exception
+
+#
+# jdoqlc semantic error messages (unsupported operations)
+#
+
+#
+# jdoqlc semantic error messages (user errors)
+#
+EXC_CollectionElementTypeMismatch=Collection element type ''{0}'' and argument type ''{1}''
not compatible.
+EXC_ClassTypeExpressionExpected=Expression of class type expected.
+EXC_InvalidStaticReference=Cannot make a static reference to non-static variable ''{0}''
of class ''{1}''.
+EXC_NotSortableType=Operand type ''{0}'' of {1} is not sortable.
+EXC_UndefinedExpression=Undefined expression ''{0}''.
+EXC_BooleanFilterExpected=Boolean expression expected, filter expression has type ''{0}''.
+EXC_CollectionTypeExpected=Collection expression expected, expression has type ''{0}''.
+EXC_StringTypeExpected=String expression expected, expression has type ''{0}''.
+EXC_MultipleDeclaration=Multiple declaration of ''{0}''.
+EXC_MultipleImport=Multiple import of ''{0}''.
+EXC_WrongNumberOfArgs=Wrong number of arguments.
+EXC_ArgumentTypeMismatch=Incompatible type of argument. Cannot convert ''{0}'' to ''{1}''.
+EXC_InvalidArguments=Invalid argument(s) for ''{0}''.
+EXC_InvalidMethodCall=Invalid method call.
+EXC_UnknownField=Field ''{0}'' not defined for class ''{1}''.
+EXC_UnknownType=Unknown type ''{0}''.
+EXC_UndefinedIdentifier=Undefined identifier ''{0}''.
+EXC_InvalidCast=Cannot cast expression of type ''{0}'' to type ''{1}''.
+EXC_NotSortableInOrdering=Type ''{0}'' of ordering expression is not sortable.
+EXC_InvalidParameterAccess=Identifier ''{0}'' used in parameter access node is not declared
as parameter
+EXC_InvalidVariableAccess=Identifier ''{0}'' used in variable access node is not declared
as variable
+#NOI18N
+ERR_SemanticError=Semantic error:
+#NOI18N
+ERR_MissingChildren=Ivalid node (missing children): ''{0}''
+
+#
+# jdoqlc variable checker
+#
+EXC_UnsupportedMultipleConstraints=Multiple constraints for variable ''{0}''.
+EXC_UnconstraintVariable=Variable ''{0}'' is not constrained by contains call - unconstrained
variables not supported.
+EXC_UnusedVariable=Variable ''{0}'' defined but not used.
+EXC_UnsupportedCyclicConstaint=Unsupported cyclic constraint definition for variable ''{0}''.
+EXC_DifferentConstraints=Different constraints for the same variable ''{0}''.
+#NOI18N
+ERR_VariableCheckerUndefinedVariable=VariableChecker.{0}: undefined variable ''{1}''
+#NOI18N
+ERR_VariableCheckerMultipleDependencies=VariableChecker.markUsed: multiple dependencies for
variable ''{0}'' old ''{1}'' new ''{2}''
+
+#
+# jdoqlc optimizer messages
+#
+EXC_InvalidLiteral=Invalid {0} literal ''{1}''.
+#NOI18N
+ERR_OptimizerError=Optimizer error:
+#NOI18N
+ERR_OptmizerInvalidType=Optimizer.{0}: invalid type ''{1}''
+#NOI18N
+ERR_OptmizerNumberExpected=Optimizer.{0}: expected number value ''{1}''
+#NOI18N
+ERR_OptmizerCollectionExpected=Optimizer.{0}: expected collection ''{1}''
+
+#
+# jdoqlc JDOQLASTFactory
+#
+#NOI18N
+ERR_UnexpectedExceptionClone=Unexpected exception during clone
+
+#
+# scope.AbstractValueTable
+#
+#NOI18N
+ERR_InvalidTableForExecution=Invalid table ''{0}'' for query execution, value map not initialized.
+#NOI18N
+ERR_UnexpectedCloneProblems=Unexpected problems during clone
+
+#
+# scope.ParameterTable
+#
+EXC_UnboundQueryParameter=Unbound query parameter ''{0}''.
+EXC_UndefinedQueryParameter=Undefined query parameter ''{0}''.
+EXC_WrongNumberOfQueryParameters=Wrong number of query parameter values.
+EXC_IncompatibleTypeOfQueryParameter=Incompatible type of actual query parameter. Cannot
convert ''{0}'' to ''{1}''.
+
+#
+# scope.VariableTable
+#
+EXC_UndefinedQueryVariable=Undefined query variable ''{0}''.
+
+#
+# TypeSupport
+#
+EXC_CannotFindField=Cannot find field ''{0}'' of class ''{1}''.
+EXC_CannotAccessField=Cannot access field ''{0}'' of class ''{1}''.
+# {0} - field name
+# {1} - class name
+EXC_CannotChangeAccessibility=A SecurityException was thrown when trying to \
+make field ''{0}'' in class ''{1}'' accessible in order to access its value \
+while executing a query. In order to execute queries on transient instances, \
+you must grant java.lang.reflect.ReflectPermission("suppressAccessChecks") to \
+the codeBase containing the JDO Reference Implementation (jdori.jar).
+EXC_InstanceBoundToDifferentPM=Instance ''{0}'' not bound to the PersistenceManager of the
query
+#NOI18N
+ERR_CollectionFieldExpected=Collection field expected; field ''{0}'' of class ''{1}'' has
type ''{2}''.
+
+#
+# tree.BinaryExpr
+#
+EXC_IncompatibleTypes=The operands ''{0}'', ''{1}'' for binary expression ''{2}'' have incompatible
types. Change one of the operands.
+
+#
+# tree.CastExpr
+#
+EXC_IllegalCast=Cannot cast ''{0}'' to ''{1}''. Change one of the operands for cast expression
''{2}''.
+
+#
+# tree.MethodCallExpr
+#
+EXC_IllegalNumberOfParameters=Illegal number of parameters supplied for method call ''{0}''.
+
+#
+# tree.ContainsCallExpr
+# tree.IsEmptyCallExpr
+#
+EXC_NoCollectionType=The target expression ''{0}'' must have a collection type for method
call expression ''{1}''. Change the target expression.
+
+#
+# tree.EndsWithCallExpr
+# tree.StartsWithCallExpr
+#
+EXC_NoStringType=The target expression ''{0}'' must have a string type for method call expression
''{1}''. Change the target expression.
+
+#
+# tree.FieldAccessExpr
+#
+EXC_NoSuchField=The identifier ''{0}'' does neither correspond with a declared parameter/variable
nor with a field in class ''{1}''.
+
+#
+# tree.Node
+#
+EXC_CannotProcessNullNodes=Cannot construct node ''{0}'' for children which equal null. Do
not use null arguments in any expression factory methods.
+EXC_CannotReuseNodes=The node ''{0}'' is already used in expression ''{1}''. Cannot reuse
this node in another expression.
+
+#
+# tree.Tree
+#
+EXC_ParameterVariableCollision=You try to declare a parameter having name ''{0}''. This name
is already used by a declared variable.
+EXC_VariableParameterCollision=You try to declare a variable having name ''{0}''. This name
is already used by a declared parameter.
+EXC_IllegalTypeForFilterExpression=Cannot set filter expression ''{0}'' as it returns a non
boolean type.
+EXC_IllegalIdentifier=You cannot create an identifier expression for Java key word. Do not
use ''{0}'' for an identifier.
+EXC_NonSupportedMethodCall=Cannot construct a method call expression for method ''{0}''.
This method is not supported.
+EXC_CannotResolveTokenType=Cannot resolve token type ''{0}''.
+
+#
+# MemoryQuery
+#
+EXC_IllegalResultTypeForExpression=Cannot apply operator ''{0}'' for operands of type ''{1}''.
+EXC_CannotAccessUnboundVariables=Cannot access unbound variable ''{0}''. Unbound variables
do not have a corresponding contains clause.
+EXC_CannotProcessMultipleContainsClauses=Cannot process two contains clauses for the same
binary expression.
|