001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.internal;
022:
023: import java.lang.reflect.*;
024: import java.net.*;
025: import java.util.*;
026:
027: import com.db4o.*;
028: import com.db4o.config.*;
029: import com.db4o.ext.*;
030: import com.db4o.foundation.*;
031: import com.db4o.internal.handlers.*;
032: import com.db4o.reflect.*;
033: import com.db4o.reflect.generic.*;
034: import com.db4o.types.*;
035:
036: /**
037: * @exclude
038: */
039: public class JDK {
040:
041: /** @param runnable */
042: Thread addShutdownHook(Runnable runnable) {
043: return null;
044: }
045:
046: /** @param transaction TODO*/
047: Db4oCollections collections(Transaction transaction) {
048: return null;
049: }
050:
051: Class constructorClass() {
052: return null;
053: }
054:
055: Object createReferenceQueue() {
056: return null;
057: }
058:
059: public Object createWeakReference(Object obj) {
060: return obj;
061: }
062:
063: /**
064: * @param queue
065: * @param ref
066: * @param obj
067: */
068: Object createActivateObjectReference(Object queue,
069: ObjectReference ref, Object obj) {
070: return null;
071: }
072:
073: /** @param bytes */
074: Object deserialize(byte[] bytes) {
075: throw new Db4oException(Messages.NOT_IMPLEMENTED);
076: }
077:
078: /**
079: * @param clazz
080: * @param config
081: */
082: public Config4Class extendConfiguration(ReflectClass clazz,
083: Configuration config, Config4Class classConfig) {
084: return classConfig;
085: }
086:
087: void forEachCollectionElement(Object obj, Visitor4 visitor) {
088: if (!Deploy.csharp) {
089: Enumeration e = null;
090: if (obj instanceof Hashtable) {
091: e = ((Hashtable) obj).elements();
092: } else if (obj instanceof Vector) {
093: e = ((Vector) obj).elements();
094: }
095: if (e != null) {
096: while (e.hasMoreElements()) {
097: visitor.visit(e.nextElement());
098: }
099: }
100: }
101: }
102:
103: /** @param showTime */
104: String format(Date date, boolean showTime) {
105: return date.toString();
106: }
107:
108: Object getContextClassLoader() {
109: return null;
110: }
111:
112: /** @param obj */
113: Object getYapRefObject(Object obj) {
114: return null;
115: }
116:
117: boolean isCollectionTranslator(Config4Class config) {
118: if (!Deploy.csharp) {
119: if (config != null) {
120: ObjectTranslator ot = config.getTranslator();
121: if (ot != null) {
122: return ot instanceof THashtable;
123: }
124: }
125: }
126: return false;
127: }
128:
129: public boolean isConnected(Socket socket) {
130: return socket != null;
131: }
132:
133: public int ver() {
134: return 1;
135: }
136:
137: /** @param obj */
138: void killYapRef(Object obj) {
139:
140: }
141:
142: /**
143: * @param classLoader
144: */
145: public Class loadClass(String className, Object classLoader)
146: throws ClassNotFoundException {
147: // We can't use the ClassLoader here since JDK get's converted to .NET
148: // Functionality is overridden in JDKReflect
149: return Class.forName(className);
150: }
151:
152: /**
153: * @param path
154: * @param file
155: */
156: synchronized void lockFile(String path, Object file) {
157: }
158:
159: /**
160: * use for system classes only, since not ClassLoader
161: * or Reflector-aware
162: * @param className
163: * @param methodName
164: * @param params
165: */
166: boolean methodIsAvailable(String className, String methodName,
167: Class[] params) {
168: return false;
169: }
170:
171: /**
172: * @param session
173: * @param referenceQueue
174: */
175: void pollReferenceQueue(ObjectContainerBase session,
176: Object referenceQueue) {
177:
178: }
179:
180: /** @param reflector */
181: public void registerCollections(GenericReflector reflector) {
182:
183: }
184:
185: /** @param thread */
186: void removeShutdownHook(Thread thread) {
187:
188: }
189:
190: /** @param clazz */
191: public Constructor serializableConstructor(Class clazz) {
192: return null;
193: }
194:
195: /** @param obj */
196: byte[] serialize(Object obj) throws Exception {
197: throw new Db4oException(Messages.NOT_IMPLEMENTED);
198: }
199:
200: /** @param accessibleObject */
201: void setAccessible(Object accessibleObject) {
202: }
203:
204: /**
205: * @param reflector
206: * @param clazz
207: */
208: boolean isEnum(Reflector reflector, ReflectClass clazz) {
209: return false;
210: }
211:
212: /**
213: * @param path
214: * @param file
215: */
216: synchronized void unlockFile(String path, Object file) {
217: }
218:
219: public Object weakReferenceTarget(Object weakRef) {
220: return weakRef;
221: }
222:
223: /** @param classLoader */
224: public Reflector createReflector(Object classLoader) {
225: return null;
226: }
227:
228: /** @param clazz */
229: public Reflector reflectorForType(Class clazz) {
230: return null;
231: }
232:
233: /** @param container */
234: public NetTypeHandler[] types(ObjectContainerBase container) {
235: return new NetTypeHandler[] {};
236: }
237: }
|