01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.jdbc.meta.strats;
20:
21: import java.sql.SQLException;
22: import java.util.Map;
23: import java.util.Collections;
24:
25: import org.apache.openjpa.jdbc.kernel.JDBCStore;
26: import org.apache.openjpa.jdbc.meta.ClassMapping;
27: import org.apache.openjpa.jdbc.meta.Version;
28: import org.apache.openjpa.jdbc.meta.VersionStrategy;
29: import org.apache.openjpa.jdbc.sql.Result;
30: import org.apache.openjpa.jdbc.sql.Select;
31: import org.apache.openjpa.kernel.OpenJPAStateManager;
32: import org.apache.openjpa.kernel.StoreManager;
33:
34: /**
35: * No-op strategy for easy extension.
36: *
37: * @author Abe White
38: */
39: public abstract class AbstractVersionStrategy extends AbstractStrategy
40: implements VersionStrategy {
41:
42: /**
43: * The owning version.
44: */
45: protected Version vers = null;
46:
47: public void setVersion(Version owner) {
48: vers = owner;
49: }
50:
51: public boolean select(Select sel, ClassMapping mapping) {
52: return false;
53: }
54:
55: public void load(OpenJPAStateManager sm, JDBCStore store, Result res)
56: throws SQLException {
57: }
58:
59: public void afterLoad(OpenJPAStateManager sm, JDBCStore store) {
60: }
61:
62: public boolean checkVersion(OpenJPAStateManager sm,
63: JDBCStore store, boolean updateVersion) throws SQLException {
64: return false;
65: }
66:
67: public int compareVersion(Object v1, Object v2) {
68: return StoreManager.VERSION_SAME;
69: }
70:
71: public Map getBulkUpdateValues() {
72: return Collections.EMPTY_MAP;
73: }
74: }
|