mirror of https://github.com/apache/openjpa.git
removed some dead code and cleaned up some javadoc
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@421722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4bc5b3bd0f
commit
4ddf63ea3f
|
@ -31,7 +31,7 @@ import org.apache.openjpa.util.UserException;
|
|||
/**
|
||||
* <p>{@link BrokerFactory} implementation for use with the
|
||||
* {@link AbstractStoreManager}. This provides integration into the
|
||||
* {@link Bootstrap#getBrokerFactory} bootstrapping mechanism, to facilitate
|
||||
* {@link Bootstrap#getBrokerFactory()} bootstrapping mechanism, to facilitate
|
||||
* the process of creating a subclass of {@link AbstractStoreManager}. New
|
||||
* store manager implementations need not extend this class. Instead, set the
|
||||
* <code>org.apache.openjpa.BrokerFactory</code> configuration property to
|
||||
|
@ -64,7 +64,7 @@ public class AbstractStoreBrokerFactory
|
|||
|
||||
/**
|
||||
* Factory method for obtaining a possibly-pooled {@link BrokerFactory}
|
||||
* from properties. Invoked from {@link Bootstrap#getBrokerFactory}.
|
||||
* from properties. Invoked from {@link Bootstrap#getBrokerFactory()}.
|
||||
*/
|
||||
public static AbstractStoreBrokerFactory getInstance
|
||||
(ConfigurationProvider cp) {
|
||||
|
@ -80,7 +80,7 @@ public class AbstractStoreBrokerFactory
|
|||
|
||||
/**
|
||||
* Factory method for constructing a {@link BrokerFactory}
|
||||
* from properties. Invoked from {@link Bootstrap#newBrokerFactory}.
|
||||
* from properties. Invoked from {@link Bootstrap#newBrokerFactory()}.
|
||||
*/
|
||||
public static AbstractStoreBrokerFactory newInstance
|
||||
(ConfigurationProvider cp) {
|
||||
|
|
|
@ -21,7 +21,8 @@ import org.apache.openjpa.lib.conf.PluginValue;
|
|||
/**
|
||||
* <p>Value type used to represent the {@link BrokerFactory}. This type is
|
||||
* defined separately so that it can be used both in the global configuration
|
||||
* and in {@link OpenJPAHelper} with the same encapsulated configuration.</p>
|
||||
* and in {@link org.apache.openjpa.kernel.Bootstrap} with the same
|
||||
* encapsulated configuration.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
* @nojavadoc
|
||||
|
|
|
@ -186,7 +186,7 @@ public abstract class AbstractQueryCache
|
|||
* your cache subclass relies on OpenJPA for clustering support, make it
|
||||
* implement <code>RemoteCommitListener</code>. This method will take
|
||||
* care of invalidating entries from remote commits, by delegating to
|
||||
* {@link #typesChanged}.
|
||||
* {@link #onTypesChanged}.
|
||||
*/
|
||||
public void afterCommit(RemoteCommitEvent event) {
|
||||
if (_closed)
|
||||
|
|
|
@ -426,7 +426,6 @@ public class DataCacheStoreManager
|
|||
DataCache cache;
|
||||
DataCachePCData data;
|
||||
BitSet fields;
|
||||
FetchConfiguration fc;
|
||||
|
||||
for (Iterator itr = sms.iterator(); itr.hasNext();) {
|
||||
sm = (OpenJPAStateManager) itr.next();
|
||||
|
@ -449,12 +448,6 @@ public class DataCacheStoreManager
|
|||
|| sm.getPCState() == PCState.HOLLOW) {
|
||||
data = cache.get(sm.getObjectId());
|
||||
if (data != null) {
|
||||
// ### fc isn't ever accessed; we should check that
|
||||
// ### getFetchConfiguration() doesn't have any side-effects
|
||||
// ### and remove this code.
|
||||
fc = (load == FORCE_LOAD_ALL) ? null
|
||||
: fetchState.getFetchConfiguration();
|
||||
|
||||
// load unloaded fields
|
||||
fields = sm.getUnloaded(fetchState);
|
||||
data.load(sm, fields, fetchState, edata);
|
||||
|
|
|
@ -65,8 +65,9 @@ public interface QueryCache
|
|||
* <p/>
|
||||
* <p>This method is typically not invoked directly from outside
|
||||
* the <code>QueryCache</code> class. Instead, the cache should
|
||||
* be updated by invoking {@link #typesChanged}, which will
|
||||
* result in all queries that may be invalid being dropped.</p>
|
||||
* be updated by implementing {@link
|
||||
* org.apache.openjpa.event.RemoteCommitListener},
|
||||
* which will result in all queries that may be invalid being dropped.</p>
|
||||
*
|
||||
* @return The previously cached value, or <code>null</code> if
|
||||
* the key was not previously cached. See {@link Map#remove}
|
||||
|
@ -86,7 +87,7 @@ public interface QueryCache
|
|||
* causes this data to be ignored when determining whether or not
|
||||
* the cache is full, effectively increasing the total amount of
|
||||
* data stored in the cache. This method does not affect the
|
||||
* behavior of {@link #remove} or {@link #typesChanged}.
|
||||
* behavior of {@link #remove} or {@link #onTypesChanged}.
|
||||
*
|
||||
* @return <code>true</code> if <code>key</code>'s value was
|
||||
* pinned into the cache; <code>false</code> if the
|
||||
|
|
|
@ -43,7 +43,6 @@ import serp.util.Strings;
|
|||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
private OpenJPAConfiguration _conf = null;
|
||||
private File _dir = null;
|
||||
private CodeFormat _format = null;
|
||||
private ClassMetaData _meta = null;
|
||||
|
@ -54,15 +53,13 @@ public class CodeGenerator {
|
|||
* Constructor. Supply configuration and class to generate code for.
|
||||
*/
|
||||
public CodeGenerator(OpenJPAConfiguration conf, Class type) {
|
||||
this(conf, new MetaDataRepository(conf).
|
||||
getMetaData(type, null, true));
|
||||
this(new MetaDataRepository(conf).getMetaData(type, null, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Supply configuration and metadata to generate code for.
|
||||
*/
|
||||
public CodeGenerator(OpenJPAConfiguration conf, ClassMetaData meta) {
|
||||
_conf = conf;
|
||||
public CodeGenerator(ClassMetaData meta) {
|
||||
_meta = meta;
|
||||
_type = meta.getDescribedType();
|
||||
}
|
||||
|
@ -302,7 +299,7 @@ public class CodeGenerator {
|
|||
private void appendFieldCode(FieldMetaData fmd, CodeFormat decs,
|
||||
CodeFormat code) {
|
||||
String fieldName = fmd.getName();
|
||||
String capFieldName = StringUtils.capitalise(fieldName);
|
||||
String capFieldName = StringUtils.capitalize(fieldName);
|
||||
String propertyName = fieldName;
|
||||
if (propertyName.startsWith("_"))
|
||||
propertyName = propertyName.substring(1);
|
||||
|
|
|
@ -251,8 +251,6 @@ public class LifecycleEventManager
|
|||
MetaDataDefaults def = meta.getRepository().getMetaDataFactory().
|
||||
getDefaults();
|
||||
|
||||
int mode = meta.getRepository().getMetaDataFactory().
|
||||
getDefaults().getCallbackMode();
|
||||
boolean callbacks = def.getCallbacksBeforeListeners(type);
|
||||
boolean failFast = (def.getCallbackMode() & CALLBACK_FAIL_FAST) != 0;
|
||||
|
||||
|
|
|
@ -170,7 +170,6 @@ public class TCPRemoteCommitProvider
|
|||
if (cur > numBroadcastThreads) {
|
||||
// Notify the extra worker threads so they stop themselves
|
||||
// Threads will not end until they send another pk.
|
||||
Iterator iter = _broadcastThreads.iterator();
|
||||
for (int i = numBroadcastThreads; i < cur; i++) {
|
||||
BroadcastWorkerThread worker = (BroadcastWorkerThread)
|
||||
_broadcastThreads.removeFirst();
|
||||
|
@ -434,7 +433,7 @@ public class TCPRemoteCommitProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Threads to broadcast packets placed in the {@link BroadcastQueueu}.
|
||||
* Threads to broadcast packets placed in the {@link BroadcastQueue}.
|
||||
*/
|
||||
private class BroadcastWorkerThread
|
||||
extends Thread {
|
||||
|
|
|
@ -135,7 +135,6 @@ public class BrokerImpl
|
|||
private static final int FLAG_FLUSH_REQUIRED = 2 << 8;
|
||||
private static final int FLAG_REMOTE_LISTENER = 2 << 9;
|
||||
private static final int FLAG_RETAINED_CONN = 2 << 10;
|
||||
private static final int FLAG_SET_OPERATION = 2 << 11;
|
||||
|
||||
private static final Localizer _loc =
|
||||
Localizer.forPackage(BrokerImpl.class);
|
||||
|
|
|
@ -430,7 +430,6 @@ public class DetachManager
|
|||
|
||||
// detach fields and set detached variables
|
||||
DetachedStateManager detSM = null;
|
||||
ClassMetaData meta = sm.getMetaData();
|
||||
if (_opts.getDetachedStateManager()
|
||||
&& useDetachedStateManager(sm, _opts))
|
||||
detSM = new DetachedStateManager(detachedPC, sm, fields,
|
||||
|
|
|
@ -67,8 +67,6 @@ public class FetchConfigurationImpl
|
|||
private Set _rootInstances;
|
||||
private Map _hints = null;
|
||||
|
||||
private static final String[] EMPTY_STRINGS = new String[0];
|
||||
|
||||
public StoreContext getContext() {
|
||||
return _ctx;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,6 @@ public class FetchStateImpl
|
|||
|
||||
void traverse(FieldMetaData fm) {
|
||||
int sourceDepth = getDepth(fm.getDeclaringMetaData());
|
||||
int targetDepth = getDepth(fm.getDeclaredTypeMetaData());
|
||||
int traversalCount = getTraversalCount(fm);
|
||||
boolean isRecursive = fm.getDeclaringMetaData() ==
|
||||
fm.getDeclaredTypeMetaData();
|
||||
|
@ -204,42 +203,4 @@ public class FetchStateImpl
|
|||
return ((Integer) _depths.get(cm)).intValue();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combination of an instance and its field used as key.
|
||||
*/
|
||||
private static class InstanceFieldKey {
|
||||
|
||||
final OpenJPAStateManager _sm;
|
||||
final FieldMetaData _fm;
|
||||
|
||||
/**
|
||||
* Supply configuration.
|
||||
*
|
||||
* @param sm can be null
|
||||
* @param fm must not be null
|
||||
*/
|
||||
public InstanceFieldKey(OpenJPAStateManager sm, FieldMetaData fm) {
|
||||
_sm = sm;
|
||||
_fm = fm;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof InstanceFieldKey) {
|
||||
InstanceFieldKey that = (InstanceFieldKey) other;
|
||||
return (_sm == that._sm) && (_fm == that._fm);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int smHash = (_sm != null) ? _sm.hashCode() : 0;
|
||||
int fmHash = (_fm != null) ? _fm.hashCode() : 0;
|
||||
return smHash + fmHash;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return _sm + "." + _fm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -833,7 +833,7 @@ public class Filters {
|
|||
if (e instanceof InvocationTargetException)
|
||||
t = ((InvocationTargetException) e).getTargetException();
|
||||
throw new UserException(_loc.get("bad-getter-hint",
|
||||
target.getClass(), hintKey)).setCause(e);
|
||||
target.getClass(), hintKey)).setCause(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,8 +185,7 @@ public interface OpenJPAStateManager
|
|||
* Return the identifier for this state manager. This may return a
|
||||
* temporary identifier for new unflushed instances that have not been
|
||||
* assigned an object id, or for non-persistent or embedded instances.
|
||||
* For all other instances this method is the same as
|
||||
* {@link StateManager#getObjectId}.
|
||||
* For all other instances this method is the same as {@link #getObjectId}.
|
||||
*/
|
||||
public Object getId();
|
||||
|
||||
|
|
|
@ -139,8 +139,7 @@ public interface QueryContext {
|
|||
public Class getResultType();
|
||||
|
||||
/**
|
||||
* Specify the type of object in which the
|
||||
* result of invoking {@link #execute} or one of its siblings.
|
||||
* Specify the type of object in which the result of evaluating this query.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
|
@ -278,12 +277,12 @@ public interface QueryContext {
|
|||
|
||||
/**
|
||||
* Synchronize on the query's internal lock.
|
||||
*/
|
||||
public void lock ();
|
||||
*/
|
||||
public void lock ();
|
||||
|
||||
|
||||
/**
|
||||
* Unlock the query's internal lock.
|
||||
*/
|
||||
public void unlock ();
|
||||
/**
|
||||
* Unlock the query's internal lock.
|
||||
*/
|
||||
public void unlock();
|
||||
}
|
||||
|
|
|
@ -1732,7 +1732,6 @@ public class QueryImpl
|
|||
LinkedMap paramTypes = ex.getParameterTypes(_storeQuery);
|
||||
if (paramTypes != null && !paramTypes.isEmpty()) {
|
||||
Map.Entry entry;
|
||||
Object param;
|
||||
for (Iterator itr = paramTypes.entrySet().iterator();
|
||||
itr.hasNext();) {
|
||||
entry = (Map.Entry) itr.next();
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface QueryOperations {
|
|||
* Symbolic constant that indicates that this query will be
|
||||
* performing a select operation.
|
||||
*
|
||||
* @see Query#getOperation
|
||||
* @see QueryContext#getOperation
|
||||
*/
|
||||
public static final int OP_SELECT = 1;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public interface QueryOperations {
|
|||
* Symbolic constant that indicates that this query will be
|
||||
* performing a delete operation.
|
||||
*
|
||||
* @see Query#getOperation
|
||||
* @see QueryContext#getOperation
|
||||
*/
|
||||
public static final int OP_DELETE = 2;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public interface QueryOperations {
|
|||
* Symbolic constant that indicates that this query will be
|
||||
* performing a update operation.
|
||||
*
|
||||
* @see Query#getOperation
|
||||
* @see QueryContext#getOperation
|
||||
*/
|
||||
public static final int OP_UPDATE = 3;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,8 @@ public interface StoreManager
|
|||
* Initialization involves first calling the
|
||||
* {@link OpenJPAStateManager#initialize} method with
|
||||
* a new instance of the correct type constructed with the
|
||||
* {@link PCRegistry#newInstance(Class,StateManager,Object)} method
|
||||
* {@link org.apache.openjpa.enhance.PCRegistry#newInstance(Class,
|
||||
* org.apache.openjpa.enhance.StateManager, boolean)} method
|
||||
* (this will reset the state manager's metadata if the actual type was a
|
||||
* subclass). After instance initialization, load any the fields for the
|
||||
* given fetch configuration that can be efficiently retrieved. If any of
|
||||
|
@ -169,7 +170,7 @@ public interface StoreManager
|
|||
/**
|
||||
* Initialize, load, or validate the existance of all of the given
|
||||
* objects. This method is called from various broker methods that act
|
||||
* on multiple objects, such as {@link Broker#findAll}. It gives
|
||||
* on multiple objects, such as {@link StoreContext#retrieveAll}. It gives
|
||||
* the store manager an opportunity to efficiently batch-load data for
|
||||
* several objects. Each of the given state managers will be in one of
|
||||
* three states, each requiring a different action:
|
||||
|
@ -240,7 +241,7 @@ public interface StoreManager
|
|||
* The current version will roll over to this next version upon successful
|
||||
* commit.
|
||||
*
|
||||
* @see org.apache.openjpa.util.ApplicationIds#assign
|
||||
* @see org.apache.openjpa.util.ApplicationIds#assign()
|
||||
*/
|
||||
public Collection flush(Collection sms);
|
||||
|
||||
|
@ -260,7 +261,7 @@ public interface StoreManager
|
|||
* {@link #flush}
|
||||
* @see org.apache.openjpa.util.ImplHelper#generateFieldValue
|
||||
* @see org.apache.openjpa.util.ImplHelper#generateIdentityValue
|
||||
* @see org.apache.openjpa.util.ApplicationIds#assign
|
||||
* @see org.apache.openjpa.util.ApplicationIds#assign()
|
||||
* @since 3.3
|
||||
*/
|
||||
public boolean assignObjectId(OpenJPAStateManager sm, boolean preFlush);
|
||||
|
|
|
@ -58,7 +58,6 @@ class Concat
|
|||
StringBuffer cat = new StringBuffer(str.toString());
|
||||
|
||||
Object arg = _args.eval(candidate, orig, ctx, params);
|
||||
int idx;
|
||||
if (arg instanceof Object[]) {
|
||||
for (int i = 0; i < ((Object[]) arg).length; i++)
|
||||
cat.append((((Object[]) arg)[i]).toString());
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
|
||||
import org.apache.openjpa.kernel.StoreContext;
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
|
||||
/**
|
||||
* <p>A distinct set of the specified values.</p>
|
||||
|
@ -30,9 +29,6 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
class Distinct
|
||||
extends Val {
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage
|
||||
(AggregateVal.class);
|
||||
|
||||
private final Val _val;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +57,8 @@ class Distinct
|
|||
StoreContext ctx, Object[] params) {
|
||||
if (candidate == null)
|
||||
candidate = Collections.EMPTY_LIST;
|
||||
|
||||
|
||||
// ### should arg be used in eval below?
|
||||
Collection arg = candidate instanceof Collection
|
||||
? (Collection) candidate : Collections.singleton(candidate);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class MatchesExpression
|
|||
|
||||
private final String _single;
|
||||
private final String _multi;
|
||||
private final String _escape;
|
||||
private final String _escape; // ### in-memory queries are not using escapes
|
||||
private final boolean _affirmation;
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package org.apache.openjpa.kernel.exps;
|
||||
|
||||
import org.apache.openjpa.kernel.StoreContext;
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
|
||||
/**
|
||||
* <p>Represents an unbound variable. When the query is evaluated,
|
||||
|
@ -28,9 +27,6 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
class UnboundVariable
|
||||
extends Val {
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage
|
||||
(UnboundVariable.class);
|
||||
|
||||
private Class _type = null;
|
||||
private Object _val = null;
|
||||
|
||||
|
|
|
@ -34,10 +34,8 @@ import org.apache.openjpa.kernel.ExpressionStoreQuery;
|
|||
import org.apache.openjpa.kernel.QueryContext;
|
||||
import org.apache.openjpa.kernel.QueryOperations;
|
||||
import org.apache.openjpa.kernel.exps.AbstractExpressionBuilder;
|
||||
import org.apache.openjpa.kernel.exps.AggregateListener;
|
||||
import org.apache.openjpa.kernel.exps.Expression;
|
||||
import org.apache.openjpa.kernel.exps.ExpressionFactory;
|
||||
import org.apache.openjpa.kernel.exps.FilterListener;
|
||||
import org.apache.openjpa.kernel.exps.Literal;
|
||||
import org.apache.openjpa.kernel.exps.Parameter;
|
||||
import org.apache.openjpa.kernel.exps.Path;
|
||||
|
@ -66,14 +64,12 @@ class JPQLExpressionBuilder
|
|||
extends AbstractExpressionBuilder
|
||||
implements JPQLTreeConstants {
|
||||
|
||||
private static final int VAR_OK = 0;
|
||||
private static final int VAR_PATH = 1;
|
||||
private static final int VAR_ERROR = 2;
|
||||
|
||||
private static Localizer _loc = Localizer.forPackage
|
||||
(JPQLExpressionBuilder.class);
|
||||
|
||||
private final ExpressionStoreQuery query;
|
||||
private final Stack contexts = new Stack();
|
||||
private LinkedMap parameterTypes;
|
||||
private int aliasCount = 0;
|
||||
|
@ -90,7 +86,6 @@ class JPQLExpressionBuilder
|
|||
ExpressionStoreQuery query, Object parsedQuery) {
|
||||
super(factory, query.getResolver());
|
||||
|
||||
this.query = query;
|
||||
contexts.push(new Context(parsedQuery instanceof ParsedJPQL
|
||||
? (ParsedJPQL) parsedQuery
|
||||
: parsedQuery instanceof String
|
||||
|
@ -261,10 +256,6 @@ class JPQLExpressionBuilder
|
|||
return e1 == null ? e2 : e2 == null ? e1 : factory.and(e1, e2);
|
||||
}
|
||||
|
||||
private Expression or(Expression e1, Expression e2) {
|
||||
return e1 == null ? e2 : e2 == null ? e1 : factory.or(e1, e2);
|
||||
}
|
||||
|
||||
private static String assemble(JPQLNode node) {
|
||||
return assemble(node, ".", 0);
|
||||
}
|
||||
|
@ -453,7 +444,6 @@ class JPQLExpressionBuilder
|
|||
|
||||
protected void evalSetClause(QueryExpressions exps) {
|
||||
// handle SET field = value
|
||||
Set joins = null;
|
||||
JPQLNode[] nodes = root().findChildrenByID(JJTUPDATEITEM);
|
||||
|
||||
Map updates = null;
|
||||
|
@ -687,10 +677,6 @@ class JPQLExpressionBuilder
|
|||
* Recursive helper method to evaluate the given node.
|
||||
*/
|
||||
private Object eval(JPQLNode node) {
|
||||
Expression exp1, exp2;
|
||||
FilterListener listener;
|
||||
AggregateListener agg;
|
||||
Path path;
|
||||
Value val1 = null;
|
||||
Value val2 = null;
|
||||
Value val3 = null;
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -147,7 +146,6 @@ public class ClassMetaData
|
|||
private String _seqName = DEFAULT_STRING;
|
||||
private SequenceMetaData _seqMeta = null;
|
||||
private Map _fgs = new HashMap();
|
||||
private SortedSet _lgSet = null;
|
||||
private String _cacheName = DEFAULT_STRING;
|
||||
private int _cacheTimeout = Integer.MIN_VALUE;
|
||||
private Boolean _detachable = null;
|
||||
|
|
|
@ -29,7 +29,7 @@ public interface MetaDataDefaults
|
|||
|
||||
/**
|
||||
* Return the default access type for base persistent class with
|
||||
* {@link ClassMetaData.ACCESS_UNKNOWN} access type.
|
||||
* {@link ClassMetaData#ACCESS_UNKNOWN} access type.
|
||||
*/
|
||||
public int getDefaultAccessType();
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.collections.map.IdentityMap;
|
||||
import org.apache.commons.collections.set.MapBackedSet;
|
||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||
|
||||
/**
|
||||
* <p>Base class that provides utilities to change trackers.</p>
|
||||
|
@ -48,10 +47,6 @@ public abstract class AbstractChangeTracker
|
|||
*/
|
||||
protected Collection change = null;
|
||||
|
||||
// we need the configuration for context when figuring out if a type
|
||||
// is managed
|
||||
private final OpenJPAConfiguration _conf;
|
||||
|
||||
private boolean _autoOff = true;
|
||||
private boolean _track = false;
|
||||
private Boolean _identity = null;
|
||||
|
@ -60,8 +55,7 @@ public abstract class AbstractChangeTracker
|
|||
/**
|
||||
* Constructor; supply configuration.
|
||||
*/
|
||||
public AbstractChangeTracker(OpenJPAConfiguration conf) {
|
||||
_conf = conf;
|
||||
public AbstractChangeTracker() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,6 @@ public class CollectionChangeTrackerImpl
|
|||
*/
|
||||
public CollectionChangeTrackerImpl(Collection coll, boolean dups,
|
||||
boolean order, OpenJPAConfiguration conf) {
|
||||
super(conf);
|
||||
_coll = coll;
|
||||
_dups = dups;
|
||||
_order = order;
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Iterator;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||
import org.apache.openjpa.enhance.PersistenceCapable;
|
||||
import org.apache.openjpa.kernel.FetchConfiguration;
|
||||
import org.apache.openjpa.kernel.FetchState;
|
||||
import org.apache.openjpa.kernel.LockManager;
|
||||
import org.apache.openjpa.kernel.OpenJPAStateManager;
|
||||
|
@ -100,7 +99,6 @@ public class ImplHelper {
|
|||
PCState state, int load, FetchState fetchState, Object context) {
|
||||
Collection failed = null;
|
||||
OpenJPAStateManager sm;
|
||||
FetchConfiguration fc;
|
||||
LockManager lm;
|
||||
for (Iterator itr = sms.iterator(); itr.hasNext();) {
|
||||
sm = (OpenJPAStateManager) itr.next();
|
||||
|
@ -109,8 +107,6 @@ public class ImplHelper {
|
|||
failed = addFailedId(sm, failed);
|
||||
} else if (load != StoreManager.FORCE_LOAD_NONE
|
||||
|| sm.getPCState() == PCState.HOLLOW) {
|
||||
fc = (load == StoreManager.FORCE_LOAD_ALL) ? null
|
||||
: fetchState.getFetchConfiguration();
|
||||
|
||||
lm = sm.getContext().getLockManager();
|
||||
if (!store.load(sm, sm.getUnloaded(fetchState),
|
||||
|
|
|
@ -18,9 +18,9 @@ package org.apache.openjpa.util;
|
|||
/**
|
||||
* <p>Change tracker that can be used for maps. If the user calls
|
||||
* any mutating methods on the map that do not have an equivalent in
|
||||
* this change tracker, then you must call {@link #stopTracking} after
|
||||
* applying the operation to the map. The collections returned from
|
||||
* {@link ChangeTracker#getAdd} and {@link ChangeTracker#getRemove} will
|
||||
* this change tracker, then you must call {@link ChangeTracker#stopTracking}
|
||||
* after applying the operation to the map. The collections returned from
|
||||
* {@link ChangeTracker#getAdded} and {@link ChangeTracker#getRemoved} will
|
||||
* be collections of keys to add/remove.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
|
|
|
@ -36,7 +36,6 @@ public class MapChangeTrackerImpl
|
|||
* Constructor; supply delegate map.
|
||||
*/
|
||||
public MapChangeTrackerImpl(Map map, OpenJPAConfiguration conf) {
|
||||
super(conf);
|
||||
_map = map;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package org.apache.openjpa.util;
|
||||
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
|
||||
/**
|
||||
* <p>Identity type appropriate for object primary key fields and shared
|
||||
* id classes.</p>
|
||||
|
@ -26,8 +24,6 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
public final class ObjectId
|
||||
extends OpenJPAId {
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage(ObjectId.class);
|
||||
|
||||
private Object _key;
|
||||
|
||||
public ObjectId(Class cls, Object key) {
|
||||
|
|
|
@ -16,8 +16,6 @@ import java.lang.reflect.Array;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
|
||||
/**
|
||||
* A list of plugins. Defaults and aliases on plugin lists apply only
|
||||
* to individual class names.
|
||||
|
@ -29,9 +27,6 @@ public class PluginListValue extends ObjectValue {
|
|||
|
||||
private static final String[] EMPTY = new String[0];
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage
|
||||
(PluginListValue.class);
|
||||
|
||||
private String[] _names = EMPTY;
|
||||
private String[] _props = EMPTY;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class LoggingConnectionDecorator implements ConnectionDecorator {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see {@link #setPrettyPrint}
|
||||
* @see #setPrettyPrint
|
||||
*/
|
||||
public boolean getPrettyPrint() {
|
||||
return _prettyPrint;
|
||||
|
@ -114,7 +114,7 @@ public class LoggingConnectionDecorator implements ConnectionDecorator {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see {@link #setPrettyPrintLineLength}
|
||||
* @see #setPrettyPrintLineLength
|
||||
*/
|
||||
public int getPrettyPrintLineLength() {
|
||||
return _prettyPrintLineLength;
|
||||
|
@ -190,17 +190,6 @@ public class LoggingConnectionDecorator implements ConnectionDecorator {
|
|||
return new ReportingSQLException(sqle, sql);
|
||||
}
|
||||
|
||||
private static String getExceptionMessage(SQLException sqle,
|
||||
Statement stmnt) {
|
||||
try {
|
||||
return sqle.getMessage() + " {" + stmnt + "} "
|
||||
+ "[code=" + sqle.getErrorCode() + ", state="
|
||||
+ sqle.getSQLState() + "]";
|
||||
} catch (Throwable t) {
|
||||
return sqle.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface that allows customization of what to do when
|
||||
* {@link SQLWarning}s occur.
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.collections.map.LinkedMap;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
|
||||
/**
|
||||
* Helps serialize metadata objects to package and class elements.
|
||||
|
@ -30,9 +29,6 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
*/
|
||||
public abstract class CFMetaDataSerializer extends XMLMetaDataSerializer {
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage
|
||||
(CFMetaDataSerializer.class);
|
||||
|
||||
private String _package = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,6 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
|||
private int _loc = -1;
|
||||
private final List _urls = new ArrayList(3);
|
||||
private int _url = -1;
|
||||
private URL _last = null;
|
||||
|
||||
/**
|
||||
* Constructor; supply the class whose metadata to find, the suffix
|
||||
|
|
|
@ -36,7 +36,7 @@ public interface MetaDataSerializer {
|
|||
* not be included in the output.
|
||||
*
|
||||
* @param flags bit flags specifying the output flags; e.g.
|
||||
* {@link PRETTY #PRETTY}
|
||||
* {@link #PRETTY}
|
||||
*/
|
||||
public void serialize(int flags) throws IOException;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public interface MetaDataSerializer {
|
|||
* keys that are the {@link File} instances, and
|
||||
* values that are the {@link String} contents of the metadata
|
||||
* @param flags bit flags specifying the output flags; e.g.
|
||||
* {@link PRETTY #PRETTY}
|
||||
* {@link #PRETTY}
|
||||
*/
|
||||
public void serialize(Map output, int flags) throws IOException;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public interface MetaDataSerializer {
|
|||
* Serialize the current set of objects to the given file.
|
||||
*
|
||||
* @param flags bit flags specifying the output flags; e.g.
|
||||
* {@link PRETTY #PRETTY} | {@link APPEND #APPEND}
|
||||
* {@link #PRETTY} | {@link #APPEND}
|
||||
*/
|
||||
public void serialize(File file, int flags) throws IOException;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public interface MetaDataSerializer {
|
|||
* Serialize the current set of objects to the given stream.
|
||||
*
|
||||
* @param flags bit flags specifying the output flags; e.g.
|
||||
* {@link PRETTY #PRETTY}
|
||||
* {@link #PRETTY}
|
||||
*/
|
||||
public void serialize(Writer out, int flags) throws IOException;
|
||||
}
|
||||
|
|
|
@ -399,18 +399,6 @@ public abstract class XMLMetaDataParser extends DefaultHandler
|
|||
return !added;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether we previously parsed the given file.
|
||||
*/
|
||||
private boolean parsed(File file, String cur) throws IOException {
|
||||
if (file == null)
|
||||
return false;
|
||||
String src = file.getCanonicalFile().toURL().toString();
|
||||
if (src.equals(cur))
|
||||
return false;
|
||||
return parsed(src);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (_log != null && _log.isTraceEnabled())
|
||||
_log.trace(_loc.get("clear-parser", this));
|
||||
|
|
|
@ -425,7 +425,6 @@ public class FormatPreservingProperties extends Properties {
|
|||
|
||||
public void store(OutputStream out, String header) throws IOException {
|
||||
boolean endWithNewline = source != null && source.endsInNewline;
|
||||
boolean firstLine = true;
|
||||
|
||||
// Must be ISO-8859-1 ecoding according to Properties.load javadoc
|
||||
PrintWriter writer = new PrintWriter
|
||||
|
|
|
@ -294,7 +294,7 @@ public class Options extends TypedProperties {
|
|||
// setter with more than 1 arg is ignored; calc setter and getter
|
||||
// name to look for
|
||||
String[] find = Strings.split(key, ".", 2);
|
||||
String base = StringUtils.capitalise(find[0]);
|
||||
String base = StringUtils.capitalize(find[0]);
|
||||
String set = "set" + base;
|
||||
String get = "get" + base;
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class Options extends TypedProperties {
|
|||
Member getter = getMeth;
|
||||
if (setter == null) {
|
||||
Field[] fields = type.getFields();
|
||||
String uncapBase = StringUtils.uncapitalise(find[0]);
|
||||
String uncapBase = StringUtils.uncapitalize(find[0]);
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getName().equals(base)
|
||||
|| fields[i].getName().equals(uncapBase)) {
|
||||
|
|
|
@ -40,7 +40,6 @@ class ZipResourceBundleProvider implements ResourceBundleProvider {
|
|||
return null;
|
||||
|
||||
ZipInputStream zip = new ZipInputStream(in);
|
||||
ResourceBundle bundle = null;
|
||||
try {
|
||||
ZipEntry ze;
|
||||
while (true) {
|
||||
|
|
|
@ -920,7 +920,9 @@ public class ConcurrentHashMap extends AbstractMap
|
|||
|
||||
// Read in size(number of Mappings)
|
||||
int size = s.readInt();
|
||||
int maxSize = s.readInt();
|
||||
|
||||
// read the max size
|
||||
maxSize = s.readInt();
|
||||
|
||||
// Read the keys and values, and put the mappings in the
|
||||
// ConcurrentHashMap
|
||||
|
|
|
@ -227,7 +227,6 @@ public class CopyOnWriteArrayList implements List, Cloneable, Serializable {
|
|||
Object[] newarr = new Object[length + ca.length];
|
||||
int moved = length - index;
|
||||
System.arraycopy(oldarr, 0, newarr, 0, index);
|
||||
int pos = length;
|
||||
System.arraycopy(ca, 0, newarr, index, ca.length);
|
||||
if (moved > 0) {
|
||||
System
|
||||
|
|
|
@ -73,7 +73,6 @@ class FIFOWaitQueue extends WaitQueue implements java.io.Serializable {
|
|||
|
||||
public Collection getWaitingThreads() {
|
||||
List list = new ArrayList();
|
||||
int count = 0;
|
||||
WaitNode node = head_;
|
||||
while (node != null) {
|
||||
if (node.waiting) list.add(node.owner);
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.apache.openjpa.lib.conf.Value;
|
|||
import org.apache.openjpa.lib.test.AbstractTestCase;
|
||||
|
||||
/**
|
||||
* Tests the {@link ConfigurationImpl} type, and in so doing tests
|
||||
* the {@link AbstractConfiguration} as well. This needs to be placed
|
||||
* Tests the {@link ConfigurationImpl} type. This needs to be placed
|
||||
* in a sub-package so that it can have its own localizer.properties
|
||||
* properties, which are required for the bean descriptors used by the
|
||||
* configuration framework {@link Value}.
|
||||
|
|
|
@ -480,7 +480,7 @@ public abstract class AbstractTestCase extends TestCase {
|
|||
/**
|
||||
* Execute a test method in multiple threads.
|
||||
*
|
||||
* @param thread the number of Threads to run in
|
||||
* @param threads the number of Threads to run in
|
||||
* @param iterations the number of times the method should
|
||||
* be execute in a single Thread
|
||||
* @param method the name of the method to execute
|
||||
|
@ -782,7 +782,7 @@ public abstract class AbstractTestCase extends TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see timeout(long)
|
||||
* @see #timeout(long)
|
||||
*/
|
||||
public boolean timeout(long millis, String methodName) throws Throwable {
|
||||
// we are in the timing out-thread: do nothing so the
|
||||
|
@ -1382,13 +1382,6 @@ public abstract class AbstractTestCase extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private static String trim(String str, int max) {
|
||||
if (str.length() < max)
|
||||
return str;
|
||||
|
||||
return str.substring(0, max) + "...";
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called by the child. E.g.:
|
||||
* <code> public static void main(String [] args) { main(TestBug375.class);
|
||||
|
|
|
@ -112,18 +112,4 @@ public class TestReferenceSet extends TestCase {
|
|||
_coll.add("foo");
|
||||
assertTrue(_coll.contains(held));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to test inherited functionality.
|
||||
*/
|
||||
private static final class Node {
|
||||
|
||||
public int hashCode() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -870,7 +870,6 @@ public class AnnotationPersistenceMetaDataParser
|
|||
* Create fetch groups.
|
||||
*/
|
||||
private void parseFetchGroups(ClassMetaData meta, FetchGroup... groups) {
|
||||
MetaDataRepository repos = getRepository();
|
||||
for (FetchGroup group : groups) {
|
||||
if (StringUtils.isEmpty(group.name()))
|
||||
throw new MetaDataException(_loc.get("unnamed-fg", meta));
|
||||
|
@ -1483,7 +1482,6 @@ public class AnnotationPersistenceMetaDataParser
|
|||
*/
|
||||
private void parseNamedQueries(AnnotatedElement el, NamedQuery... queries) {
|
||||
QueryMetaData meta;
|
||||
QueryHint[] hints;
|
||||
for (NamedQuery query : queries) {
|
||||
if (StringUtils.isEmpty(query.name()))
|
||||
throw new MetaDataException(_loc.get("no-query-name", el));
|
||||
|
|
|
@ -437,7 +437,7 @@ public interface OpenJPAEntityManager
|
|||
* Validate the changes made in this transaction, reporting any optimistic
|
||||
* violations, constraint violations, etc. In a datastore transaction or
|
||||
* a flushed optimistic transaction, this method will act just like
|
||||
* {@link #flush}. In an optimistic transaction that has not yet begun a
|
||||
* {@link #flush()}. In an optimistic transaction that has not yet begun a
|
||||
* datastore-level transaction, however, it will only report exceptions
|
||||
* that would occur on flush, without retaining any datastore resources.
|
||||
*/
|
||||
|
|
|
@ -1142,13 +1142,6 @@ public class XMLPersistenceMetaDataSerializer
|
|||
addAttribute("mapped-by", fmd.getMappedBy());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the content of the given value. Does nothing by default.
|
||||
*/
|
||||
private void serializeStrategyMappingContent(FieldMetaData vmd)
|
||||
throws SAXException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents ordered set of {@link SequenceMetaData}s with a
|
||||
* common class scope.
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.openjpa.kernel.FetchConfiguration;
|
|||
import org.apache.openjpa.kernel.FetchState;
|
||||
import org.apache.openjpa.kernel.OpenJPAStateManager;
|
||||
import org.apache.openjpa.kernel.PCState;
|
||||
import org.apache.openjpa.lib.log.Log;
|
||||
import org.apache.openjpa.lib.rop.ListResultObjectProvider;
|
||||
import org.apache.openjpa.lib.rop.ResultObjectProvider;
|
||||
import org.apache.openjpa.meta.ClassMetaData;
|
||||
|
@ -52,7 +51,6 @@ public class XMLStoreManager
|
|||
|
||||
private XMLConfiguration _conf;
|
||||
private XMLStore _store;
|
||||
private Log _log;
|
||||
|
||||
// changed data within the current transaction
|
||||
private Collection _updates;
|
||||
|
@ -81,7 +79,6 @@ public class XMLStoreManager
|
|||
// cache operational state
|
||||
_conf = (XMLConfiguration) ctx.getConfiguration();
|
||||
_store = _conf.getStore();
|
||||
_log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
}
|
||||
|
||||
public boolean exists(OpenJPAStateManager sm, Object context) {
|
||||
|
|
Loading…
Reference in New Issue