Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Transcriber.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Transcriber.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Transcriber.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Transcriber.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,26 @@
+/*
+ * 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.store;
+
+/**
+* A Transcriber provides a way to get a different representation for an
+* object.
+*
+* @author Dave Bristor
+*/
+public interface Transcriber {
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/TranscriberFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/TranscriberFactory.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/TranscriberFactory.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/TranscriberFactory.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,26 @@
+/*
+ * 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.store;
+
+/**
+* Provides a means to create an array of transcribers for a given Class.
+*
+* @author Dave Bristor
+*/
+public interface TranscriberFactory {
+ public Transcriber[] getTranscriber(Class cls);
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/package.html Fri Mar 18 17:02:29 2005
@@ -0,0 +1,26 @@
+<!--
+ 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 org.apache.jdo.store</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains StoreManager and store-related interfaces plus an abstract StoreManager implementation.</p>
+</body>
+</html>
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Bundle.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Bundle.properties (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Bundle.properties Fri Mar 18 17:02:29 2005
@@ -0,0 +1,51 @@
+#
+# 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.
+
+#
+# JDORIVersion
+#
+
+# Vendor Name
+MSG_VendorName=Sun Microsystems
+# Version Number
+MSG_VersionNumber=1.0.1
+# Displayed Version
+MSG_DisplayVersion=Version: {0}
+
+#
+# Pool
+#
+EXC_CountOutOfRange=Invalid state: {0} is out of range 0 - {1}
+EXC_DuplicateObject=Illegal attempt to add an object to a Pool that is already there: {0}
+EXC_PoolGetTimeout=Timed out getting an entry from the pool.
+
+#
+# JDOJdk14Logger
+#
+EXC_LoggerSetupSecurityException=A SecurityException was thrown when trying \
+to read the logging configuration file ''{0}''. In order to configure JDK 1.4 \
+logging, you must grant java.util.logging.LoggingPermission("control") to the \
+codeBase containing the JDO Reference Implementation (jdo-ri.jar).
+EXC_LoggerSetupIOException=A IOException was thrown when trying to read the \
+logging configuration file ''{0}''.
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,350 @@
+/*
+ * 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.util;
+
+import java.util.*;
+import java.text.MessageFormat;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.jdo.JDOFatalInternalException;
+
+/** Helper class for constructing messages from bundles. The intended usage
+ * of this class is to construct a new instance bound to a bundle, as in
+ * <P>
+ * <code>I18NHelper msg = I18NHelper.getInstance("javax.jdo.Bundle");</code>
+ * <P>
+ * This call uses the class loader that loaded the I18NHelper class to find
+ * the specified Bundle. The class provides two overloaded getInstance
+ * methods allowing to specify a different class loader:
+ * {@link #getInstance(Class cls)} looks for a bundle
+ * called "Bundle.properties" located in the package of the specified class
+ * object and {@link #getInstance(String bundleName,ClassLoader loader)}
+ * uses the specified class loader to find the bundle.
+ * <P>
+ * Subsequently, instance methods can be used to format message strings
+ * using the text from the bundle, as in
+ * <P>
+ * <code>throw new JDOFatalInternalException (msg.msg("ERR_NoMetadata", cls.getName()));</code>
+ * @version 1.0.2
+ */
+public class I18NHelper {
+
+ /** Bundles that have already been loaded
+ */
+ private static Hashtable bundles = new Hashtable();
+
+ /** Helper instances that have already been created
+ */
+ private static Hashtable helpers = new Hashtable();
+
+ /** The default locale for this VM.
+ */
+ private static Locale locale = Locale.getDefault();
+
+ /** The bundle used by this instance of the helper.
+ */
+ private ResourceBundle bundle = null;
+
+ /** Throwable if ResourceBundle couldn't be loaded
+ */
+ private Throwable failure = null;
+
+ /** The unqualified standard name of a bundle. */
+ private static final String bundleSuffix = ".Bundle"; // NOI18N
+
+ /** Constructor */
+ private I18NHelper() {
+ }
+
+ /** Constructor for an instance bound to a bundle.
+ * @param bundleName the name of the resource bundle
+ * @param loader the class loader from which to load the resource
+ * bundle
+ */
+ private I18NHelper (String bundleName, ClassLoader loader) {
+ try {
+ bundle = loadBundle (bundleName, loader);
+ }
+ catch (Throwable e) {
+ failure = e;
+ }
+ }
+
+ /** An instance bound to a bundle. This method uses the current class
+ * loader to find the bundle.
+ * @param bundleName the name of the bundle
+ * @return the helper instance bound to the bundle
+ */
+ public static I18NHelper getInstance (String bundleName) {
+ return getInstance (bundleName, I18NHelper.class.getClassLoader());
+ }
+
+ /** An instance bound to a bundle. This method figures out the bundle name
+ * for the class object's package and uses the class' class loader to
+ * find the bundle. Note, the specified class object must not be
+ * <code>null</code>.
+ * @param cls the class object from which to load the resource bundle
+ * @return the helper instance bound to the bundle
+ */
+ public static I18NHelper getInstance (final Class cls) {
+ ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged (
+ new PrivilegedAction () {
+ public Object run () {
+ return cls.getClassLoader();
+ }
+ }
+ );
+ String bundle = getPackageName (cls.getName()) + bundleSuffix;
+ return getInstance (bundle, classLoader);
+ }
+
+ /** An instance bound to a bundle. This method uses the specified class
+ * loader to find the bundle. Note, the specified class loader must not
+ * be <code>null</code>.
+ * @param bundleName the name of the bundle
+ * @param loader the class loader from which to load the resource
+ * bundle
+ * @return the helper instance bound to the bundle
+ */
+ public static I18NHelper getInstance (String bundleName,
+ ClassLoader loader) {
+ I18NHelper helper = (I18NHelper) helpers.get (bundleName);
+ if (helper != null) {
+ return helper;
+ }
+ helper = new I18NHelper(bundleName, loader);
+ helpers.put (bundleName, helper);
+ // if two threads simultaneously create the same helper, return the first
+ // one to be put into the Hashtable. The other will be garbage collected.
+ return (I18NHelper) helpers.get (bundleName);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @return the resolved message text
+ */
+ public String msg (String messageKey) {
+ assertBundle (messageKey);
+ return getMessage (bundle, messageKey);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param arg1 the first argument
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, Object arg1) {
+ assertBundle (messageKey);
+ return getMessage (bundle, messageKey, arg1);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, Object arg1, Object arg2) {
+ assertBundle (messageKey);
+ return getMessage (bundle, messageKey, arg1, arg2);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @param arg3 the third argument
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, Object arg1, Object arg2, Object arg3) {
+ assertBundle (messageKey);
+ return getMessage (bundle, messageKey, arg1, arg2, arg3);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param args the array of arguments
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, Object[] args) {
+ assertBundle (messageKey);
+ return getMessage (bundle, messageKey, args);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param arg the argument
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, int arg) {
+ assertBundle (messageKey);
+ return getMessage(bundle, messageKey, arg);
+ }
+
+ /** Message formatter
+ * @param messageKey the message key
+ * @param arg the argument
+ * @return the resolved message text
+ */
+ public String msg (String messageKey, boolean arg) {
+ assertBundle (messageKey);
+ return getMessage(bundle, messageKey, arg);
+ }
+
+ //========= Internal helper methods ==========
+
+ /**
+ * Load ResourceBundle by bundle name
+ * @param bundleName the name of the bundle
+ * @param loader the class loader from which to load the resource bundle
+ * @return the ResourceBundle
+ */
+ final private static ResourceBundle loadBundle(
+ String bundleName, ClassLoader loader) {
+ ResourceBundle messages = (ResourceBundle)bundles.get(bundleName);
+
+ if (messages == null) //not found as loaded - add
+ {
+ messages = ResourceBundle.getBundle(bundleName, locale, loader);
+ bundles.put(bundleName, messages);
+ }
+ return messages;
+ }
+
+ /** Assert resources available
+ * @param key the message key
+ * @since 1.0.2
+ * @throws JDOFatalInternalException if the resource bundle could not
+ * be loaded during construction.
+ */
+ private void assertBundle (String key) {
+ if (failure != null)
+ throw new JDOFatalInternalException (
+ "No resources could be found to annotate error message key:\"" +
+ key + "\"", failure);
+ }
+
+ /**
+ * Returns message as <code>String</code>
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey)
+ {
+ return messages.getString(messageKey);
+ }
+
+ /**
+ * Formats message by adding array of arguments
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param msgArgs an array of arguments to substitute into the message
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, Object msgArgs[])
+ {
+ for (int i=0; i<msgArgs.length; i++) {
+ if (msgArgs[i] == null) msgArgs[i] = ""; // NOI18N
+ }
+ MessageFormat formatter = new MessageFormat(messages.getString(messageKey));
+ return formatter.format(msgArgs);
+ }
+
+ /**
+ * Formats message by adding an <code>Object</code> argument.
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param arg the argument
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg)
+ {
+ Object []args = {arg};
+ return getMessage(messages, messageKey, args);
+ }
+
+ /**
+ * Formats message by adding two <code>Object</code> arguments.
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg1,
+ Object arg2)
+ {
+ Object []args = {arg1, arg2};
+ return getMessage(messages, messageKey, args);
+ }
+
+ /**
+ * Formats message by adding three <code>Object</code> arguments.
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @param arg3 the third argument
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg1,
+ Object arg2, Object arg3)
+ {
+ Object []args = {arg1, arg2, arg3};
+ return getMessage(messages, messageKey, args);
+ }
+
+ /**
+ * Formats message by adding an <code>int</code> as an argument.
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param arg the argument
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, int arg)
+ {
+ Object []args = {new Integer(arg)};
+ return getMessage(messages, messageKey, args);
+ }
+
+ /**
+ * Formats message by adding a <code>boolean</code> as an argument.
+ * @param messages the resource bundle
+ * @param messageKey the message key
+ * @param arg the argument
+ * @return the resolved message text
+ */
+ final private static String getMessage(ResourceBundle messages, String messageKey, boolean arg)
+ {
+ Object []args = {String.valueOf(arg)};
+ return getMessage(messages, messageKey, args);
+ }
+
+ /**
+ * Returns the package portion of the specified class.
+ * @param className the name of the class from which to extract the
+ * package
+ * @return package portion of the specified class
+ */
+ final private static String getPackageName(final String className)
+ {
+ final int index = className.lastIndexOf('.');
+ return ((index != -1) ? className.substring(0, index) : ""); // NOI18N
+ }
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDOJdk14Logger.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDOJdk14Logger.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDOJdk14Logger.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDOJdk14Logger.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,93 @@
+/*
+ * 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.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.util.logging.LogManager;
+
+import javax.jdo.JDOFatalUserException;
+
+import org.apache.commons.logging.impl.Jdk14Logger;
+
+/**
+ * JDO-specific subclass of the apache commons logging Log
+ * implementation that wraps the standard JDK 1.4 logging.
+ * This class configures the JDK LogManager using a properties file
+ * called logging.properties found via the CLASSPATH.
+ *
+ * @author Michael Bouschen
+ * @since 1.1
+ * @version 1.1
+ */
+public class JDOJdk14Logger
+ extends Jdk14Logger
+{
+ /** Logging properties file name. */
+ public static final String PROPERIES_FILE = "logging.properties";
+
+ /** Indicates whether JDK 1.4 logging has been configured by this class. */
+ private static boolean configured = false;
+
+ /** I18N support. */
+ private final static I18NHelper msg =
+ I18NHelper.getInstance("org.apache.jdo.util.Bundle"); // NOI18N
+
+ /**
+ * Constructor checking whether JDK 1.4 logging should be
+ * configuared after calling super constructor.
+ */
+ public JDOJdk14Logger(String name) {
+ super(name);
+ if (!configured) {
+ configured = true;
+ configureJDK14Logger();
+ }
+ }
+
+ /**
+ * Configures JDK 1.4 LogManager.
+ */
+ private void configureJDK14Logger() {
+ final LogManager logManager = LogManager.getLogManager();
+ final ClassLoader cl = getClass().getClassLoader();
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run () {
+ try {
+ InputStream config = cl.getResourceAsStream(PROPERIES_FILE);
+ logManager.readConfiguration(config);
+ return null;
+ }
+ catch (IOException ex) {
+ throw new JDOFatalUserException(
+ msg.msg("EXC_LoggerSetupIOException", //NOI18N
+ PROPERIES_FILE), ex);
+ }
+ catch (SecurityException ex) {
+ throw new JDOFatalUserException(
+ msg.msg("EXC_LoggerSetupSecurityException", // NOI18N
+ PROPERIES_FILE), ex);
+ }
+ }
+ });
+ }
+
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDORIVersion.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDORIVersion.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDORIVersion.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/JDORIVersion.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+/*
+ * JDORIVersion.java
+ *
+ * Created on December 1, 2000
+ */
+
+package org.apache.jdo.util;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.FileNotFoundException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+
+import javax.jdo.JDOException;
+
+/**
+ * Helper class to handle properties object with version number and vendor name.
+ *
+ * @author Marina Vatkina
+ */
+public class JDORIVersion {
+ private static Properties _properties = null;
+ private final static String default_bundle = "org.apache.jdo.util.Bundle"; // NOI18N
+
+ private final static String vendor_name_msg = "MSG_VendorName"; // NOI18N
+ private final static String version_number_msg = "MSG_VersionNumber"; // NOI18N
+
+ private final static String vendor_name = "VendorName"; // NOI18N
+ private final static String version_number = "VersionNumber"; // NOI18N
+
+ private final static I18NHelper msg = I18NHelper.getInstance(default_bundle);
+
+ private final static String vendor = msg.msg(vendor_name_msg);
+ private final static String version = msg.msg(version_number_msg);
+
+ public static void main(String[] args) {
+ if (args == null || args.length == 0 ||
+ (args.length == 1 && args[0].equals("-version")) ) { // NOI18N
+ System.out.println( msg.msg("MSG_DisplayVersion", version)); // NOI18N
+ }
+ System.exit(0);
+ }
+
+ /**
+ * Constructor without parameters
+ */
+ public JDORIVersion() {
+ loadProperties();
+ }
+
+ /**
+ * Constructor without parameters
+ */
+ public JDORIVersion(String fileName) {
+ loadProperties(fileName);
+ }
+
+ /**
+ * Load default properties
+ */
+ private static void loadProperties() {
+ _properties = new Properties();
+ _properties.setProperty(vendor_name, vendor);
+ _properties.setProperty(version_number, version);
+ }
+
+ /**
+ * Load specific properties file
+ */
+ private static void loadProperties(String fileName) {
+ Properties temp_properties = new Properties();
+ try {
+ InputStream in = JDORIVersion.class.getResourceAsStream(fileName);
+ if (in == null)
+ throw new java.io.FileNotFoundException(fileName);
+
+ temp_properties.load(in);
+ in.close();
+ } catch (java.io.IOException e) {
+ throw new JDOException(null, e);
+ }
+
+ _properties = new Properties();
+ _properties.setProperty(vendor_name, temp_properties.getProperty(vendor_name));
+ _properties.setProperty(version_number, temp_properties.getProperty(version_number));
+ }
+
+ /**
+ * Return Vendor properties for a given file name
+ */
+ public static Properties getVendorProperties(String fileName) {
+ loadProperties(fileName);
+ return getVendorProperties();
+ }
+
+ /**
+ * Return Vendor properties
+ */
+ public synchronized static Properties getVendorProperties() {
+ if (_properties == null) {
+ loadProperties();
+ }
+ return _properties;
+ }
+
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Pool.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Pool.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Pool.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/Pool.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,158 @@
+/*
+ * 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.util;
+
+import java.util.Stack;
+
+import javax.jdo.JDOFatalInternalException;
+import javax.jdo.JDOUserException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+* A general purpose pooling class.
+*
+* @author Dave Bristor
+*/
+public class Pool {
+ // Objects in the pool
+ private final Stack stack = new Stack();
+
+ // Size of the pool
+ private final int size;
+
+ // Number of elements release by Pool for client use
+ private int count = 0;
+
+ /** Number of millis to wait for a free entry
+ * Currently fixed; might be made configurable in future.
+ */
+ private int waitMillis = 1000;
+
+ /** Number of times to wait for a free entry
+ * Currently fixed; might be made configurable in future.
+ */
+ private int waitNumber = 5;
+
+ /** I18N */
+ private final static I18NHelper msg = I18NHelper.getInstance("org.apache.jdo.util.Bundle"); // NOI18N
+
+ // For debugging TBD!!!
+ static final Log test = LogFactory.getFactory().getInstance(
+ "org.apache.jdo.util"); // NOI18N
+
+ /**
+ * Constructs a pool that will limit the number of objects which it can
+ * contain.
+ * @param size The maximum number of items that can be put into the pool.
+ */
+ public Pool(int size) {
+ this.size = size;
+ }
+
+ /**
+ * Puts the given object into the pool, if there the pool has fewer than
+ * the number of elements specifed when created. If the pool is full,
+ * blocks until an element is removed.
+ * @param o Object to be put in the pool.
+ * @throws InterruptedException
+ */
+ public synchronized void put(Object o) throws InterruptedException {
+ boolean debug = test.isDebugEnabled();
+
+ if (debug) {
+ test.debug("Pool.put: " + o); // NOI18N
+ }
+
+ if (count > size || count < 0) {
+ if (debug) {
+ test.debug("Pool: count " + count + // NOI18N
+ " out of range 0-" + size); // NOI18N
+ }
+ throw new JDOFatalInternalException(
+ msg.msg(
+ "EXC_CountOutOfRange", // NOI18N
+ new Integer(count).toString(),
+ new Integer(size).toString()));
+ }
+
+ if (stack.contains(o)) {
+ if (debug) {
+ test.debug("Pool: duplicate object"); // NOI18N
+ }
+ throw new JDOFatalInternalException(
+ msg.msg(
+ "EXC_DuplicateObject", o)); // NOI18N
+ }
+
+ while (count == size) {
+ if (debug) {
+ test.debug("Pool.put: block"); // NOI18N
+ }
+ wait();
+ }
+ stack.push(o);
+ ++count;
+ notify();
+ }
+
+ /**
+ * Gets an object from the pool, if one is available. If an object is not
+ * available, waits until one is. The waiting is governed by two
+ * variables, which are currently fixed: waitMillis and waitNumber.
+ * If no object is available from the pool within (waitNumber) times
+ * (waitMillis) milliseconds, then a JDOUserException is thrown.
+ * In future, the waitMillis and waitNumber should be configurable.
+ * @return An object from the pool.
+ */
+ public synchronized Object get() throws InterruptedException {
+ boolean debug = test.isDebugEnabled();
+ Object rc = null;
+
+ if (count > size || count < 0) {
+ if (debug) {
+ test.debug("Pool: count " + count + // NOI18N
+ " out of range 0-" + size); // NOI18N
+ }
+ throw new JDOFatalInternalException(
+ msg.msg(
+ "EXC_CountOutOfRange", // NOI18N
+ new Integer(count).toString(),
+ new Integer(size).toString()));
+ }
+
+ int timeouts = 0;
+ while (count == 0 && timeouts++ < waitNumber) {
+ if (debug) {
+ test.debug("Pool.get: block " + timeouts); // NOI18N
+ }
+ wait(waitMillis);
+ }
+ if (timeouts >= waitNumber) {
+ throw new JDOUserException(
+ msg.msg("EXC_PoolGetTimeout")); // NOI18N
+ }
+ rc = stack.pop();
+ --count;
+ notify();
+ if (debug) {
+ test.debug("Pool.get: " + rc); // NOI18N
+ }
+ return rc;
+ }
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakHashSet.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakHashSet.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakHashSet.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakHashSet.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,181 @@
+/*
+ * 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.util;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * A weak HashSet. An element stored in the WeakHashSet might be
+ * garbage collected, if there is no strong reference to this element.
+ */
+
+public class WeakHashSet extends HashSet {
+ /**
+ * Helps to detect garbage collected values.
+ */
+ ReferenceQueue queue = new ReferenceQueue();
+
+ /**
+ * Returns an iterator over the elements in this set. The elements
+ * are returned in no particular order.
+ *
+ * @return an Iterator over the elements in this set.
+ */
+ public Iterator iterator() {
+ // remove garbage collected elements
+ processQueue();
+
+ // get an iterator of the superclass WeakHashSet
+ final Iterator i = super.iterator();
+
+ return new Iterator() {
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public Object next() {
+ // unwrap the element
+ return getReferenceObject((WeakReference) i.next());
+ }
+
+ public void remove() {
+ // remove the element from the HashSet
+ i.remove();
+ }
+ };
+ }
+
+ /**
+ * Returns <code>true</code> if this set contains the specified element.
+ *
+ * @param o element whose presence in this set is to be tested.
+ * @return <code>true</code> if this set contains the specified element.
+ */
+ public boolean contains(Object o) {
+ return super.contains(WeakElement.create(o));
+ }
+
+ /**
+ * Adds the specified element to this set if it is not already
+ * present.
+ *
+ * @param o element to be added to this set.
+ * @return <code>true</code> if the set did not already contain the specified
+ * element.
+ */
+ public boolean add(Object o) {
+ processQueue();
+ return super.add(WeakElement.create(o, this.queue));
+ }
+
+ /**
+ * Removes the given element from this set if it is present.
+ *
+ * @param o object to be removed from this set, if present.
+ * @return <code>true</code> if the set contained the specified element.
+ */
+ public boolean remove(Object o) {
+ return super.remove(WeakElement.create(o));
+ }
+
+ /**
+ * Returns the number of elements in this set (its cardinality).
+ *
+ * @return the number of elements in this set (its cardinality).
+ */
+ public int size() {
+ processQueue();
+ return super.size();
+ }
+
+ /**
+ * A convenience method to return the object held by the
+ * weak reference or <code>null</code> if it does not exist.
+ */
+ private final Object getReferenceObject(WeakReference ref) {
+ return (ref == null) ? null : ref.get();
+ }
+
+ /**
+ * Removes all garbage collected values with their keys from the map.
+ * Since we don't know how much the ReferenceQueue.poll() operation
+ * costs, we should call it only in the add() method.
+ */
+ private final void processQueue() {
+ WeakElement wv = null;
+
+ while ((wv = (WeakElement) this.queue.poll()) != null) {
+ super.remove(wv);
+ }
+ }
+
+ /**
+ * A WeakHashSet stores objects of class WeakElement.
+ * A WeakElement wraps the element that should be stored in the WeakHashSet.
+ * WeakElement inherits from java.lang.ref.WeakReference.
+ * It redefines equals and hashCode which delegate to the corresponding methods
+ * of the wrapped element.
+ */
+ static private class WeakElement extends WeakReference {
+ private int hash; /* Hashcode of key, stored here since the key
+ may be tossed by the GC */
+
+ private WeakElement(Object o) {
+ super(o);
+ hash = o.hashCode();
+ }
+
+ private WeakElement(Object o, ReferenceQueue q) {
+ super(o, q);
+ hash = o.hashCode();
+ }
+
+ private static WeakElement create(Object o) {
+ return (o == null) ? null : new WeakElement(o);
+ }
+
+ private static WeakElement create(Object o, ReferenceQueue q) {
+ return (o == null) ? null : new WeakElement(o, q);
+ }
+
+ /* A WeakElement is equal to another WeakElement iff they both refer to objects
+ that are, in turn, equal according to their own equals methods */
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof WeakElement))
+ return false;
+ Object t = this.get();
+ Object u = ((WeakElement) o).get();
+ if (t == u)
+ return true;
+ if ((t == null) || (u == null))
+ return false;
+ return t.equals(u);
+ }
+
+ public int hashCode() {
+ return hash;
+ }
+ }
+
+}
+
+
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakValueHashMap.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakValueHashMap.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakValueHashMap.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/WeakValueHashMap.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,440 @@
+/*
+ * 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.util;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * A WeakValueHashMap is implemented as a HashMap that maps keys to
+ * WeakValues. Because we don't have access to the innards of the
+ * HashMap, we have to wrap/unwrap value objects with WeakValues on
+ * every operation. Fortunately WeakValues are small, short-lived
+ * objects, so the added allocation overhead is tolerable. This
+ * implementaton directly extends java.util.HashMap.
+ *
+ * @author Markus Fuchs
+ * @see java.util.HashMap
+ * @see java.lang.ref.WeakReference
+ */
+
+public class WeakValueHashMap extends HashMap {
+
+ /* Reference queue for cleared WeakValues */
+ private ReferenceQueue queue = new ReferenceQueue();
+
+ /**
+ * Returns the number of key-value mappings in this map.<p>
+ * @return the number of key-value mappings in this map.
+ */
+ public int size() {
+ // delegate to entrySet, as super.size() also counts WeakValues
+ return entrySet().size();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains no key-value mappings.<p>
+ * @return <tt>true</tt> if this map contains no key-value mappings.
+ */
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains a mapping for the specified
+ * key.<p>
+ * @param key key whose presence in this map is to be tested
+ * @return <tt>true</tt> if this map contains a mapping for the specified
+ * key.
+ */
+ public boolean containsKey(Object key) {
+ // need to clean up gc'ed values before invoking super method
+ processQueue();
+ return super.containsKey(key);
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map maps one or more keys to the
+ * specified value.<p>
+ * @param value value whose presence in this map is to be tested
+ * @return <tt>true</tt> if this map maps one or more keys to this value.
+ */
+ public boolean containsValue(Object value) {
+ return super.containsValue(WeakValue.create(value));
+ }
+
+ /**
+ * Gets the value for the given key.<p>
+ * @param key key whose associated value, if any, is to be returned
+ * @return the value to which this map maps the specified key.
+ */
+ public Object get(Object key) {
+ // We don't need to remove garbage collected values here;
+ // if they are garbage collected, the get() method returns null;
+ // the next put() call with the same key removes the old value
+ // automatically so that it can be completely garbage collected
+ return getReferenceObject((WeakReference) super.get(key));
+ }
+
+ /**
+ * Puts a new (key,value) into the map.<p>
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key or the value has been garbage
+ * collected by the garbage collector.
+ */
+ public Object put(Object key, Object value) {
+ // If the map already contains an equivalent key, the new key
+ // of a (key, value) pair is NOT stored in the map but the new
+ // value only. But as the key is strongly referenced by the
+ // map, it can not be removed from the garbage collector, even
+ // if the key becomes weakly reachable due to the old
+ // value. So, it isn't necessary to remove all garbage
+ // collected values with their keys from the map before the
+ // new entry is made. We only clean up here to distribute
+ // clean up calls on different operations.
+ processQueue();
+
+ WeakValue oldValue =
+ (WeakValue)super.put(key, WeakValue.create(key, value, queue));
+ return getReferenceObject(oldValue);
+ }
+
+ /**
+ * Removes key and value for the given key.<p>
+ * @param key key whose mapping is to be removed from the map.
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key or the value has been garbage
+ * collected by the garbage collector.
+ */
+ public Object remove(Object key) {
+ return getReferenceObject((WeakReference) super.remove(key));
+ }
+
+ /**
+ * A convenience method to return the object held by the
+ * weak reference or <code>null</code> if it does not exist.
+ */
+ private final Object getReferenceObject(WeakReference ref) {
+ return (ref == null) ? null : ref.get();
+ }
+
+ /**
+ * Removes all garbage collected values with their keys from the map.
+ * Since we don't know how much the ReferenceQueue.poll() operation
+ * costs, we should not call it every map operation.
+ */
+ private void processQueue() {
+ WeakValue wv = null;
+
+ while ((wv = (WeakValue) this.queue.poll()) != null) {
+ // "super" is not really necessary but use it
+ // to be on the safe side
+ super.remove(wv.key);
+ }
+ }
+
+ /* -- Helper classes -- */
+
+ /**
+ * We need this special class to keep the backward reference from
+ * the value to the key, so that we are able to remove the key if
+ * the value is garbage collected.
+ */
+ private static class WeakValue extends WeakReference {
+ /**
+ * It's the same as the key in the map. We need the key to remove
+ * the value if it is garbage collected.
+ */
+ private Object key;
+
+ private WeakValue(Object value) {
+ super(value);
+ }
+
+ /**
+ * Creates a new weak reference without adding it to a
+ * ReferenceQueue.
+ */
+ private static WeakValue create(Object value) {
+ if (value == null) return null;
+ else return new WeakValue(value);
+ }
+
+ private WeakValue(Object key, Object value, ReferenceQueue queue) {
+ super(value, queue);
+ this.key = key;
+ }
+
+ /**
+ * Creates a new weak reference and adds it to the given queue.
+ */
+ private static WeakValue create(Object key, Object value,
+ ReferenceQueue queue) {
+ if (value == null) return null;
+ else return new WeakValue(key, value, queue);
+ }
+
+ /**
+ * A WeakValue is equal to another WeakValue iff they both refer
+ * to objects that are, in turn, equal according to their own
+ * equals methods.
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (!(obj instanceof WeakValue))
+ return false;
+
+ Object ref1 = this.get();
+ Object ref2 = ((WeakValue) obj).get();
+
+ if (ref1 == ref2)
+ return true;
+
+ if ((ref1 == null) || (ref2 == null))
+ return false;
+
+ return ref1.equals(ref2);
+ }
+
+ /**
+ *
+ */
+ public int hashCode() {
+ Object ref = this.get();
+
+ return (ref == null) ? 0 : ref.hashCode();
+ }
+ }
+
+ /**
+ * Internal class for entries. This class wraps/unwraps the
+ * values of the Entry objects returned from the underlying map.
+ */
+ private class Entry implements Map.Entry {
+ private Map.Entry ent;
+ private Object value; /* Strong reference to value, so that the
+ GC will leave it alone as long as this
+ Entry exists */
+
+ Entry(Map.Entry ent, Object value) {
+ this.ent = ent;
+ this.value = value;
+ }
+
+ public Object getKey() {
+ return ent.getKey();
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ // This call changes the map. Please see the comment on
+ // the put method for the correctness remark.
+ Object oldValue = this.value;
+ this.value = value;
+ ent.setValue(WeakValue.create(getKey(), value, queue));
+ return oldValue;
+ }
+
+ private boolean valEquals(Object o1, Object o2) {
+ return (o1 == null) ? (o2 == null) : o1.equals(o2);
+ }
+
+ public boolean equals(Object o) {
+ if (!(o instanceof Map.Entry)) return false;
+ Map.Entry e = (Map.Entry) o;
+ return (valEquals(ent.getKey(), e.getKey())
+ && valEquals(value, e.getValue()));
+ }
+
+ public int hashCode() {
+ Object k;
+ return ((((k = ent.getKey()) == null) ? 0 : k.hashCode())
+ ^ ((value == null) ? 0 : value.hashCode()));
+ }
+
+ }
+
+ /**
+ * Internal class for entry sets to unwrap/wrap WeakValues stored
+ * in the map.
+ */
+ private class EntrySet extends AbstractSet {
+
+ public Iterator iterator() {
+ // remove garbage collected elements
+ processQueue();
+
+ return new Iterator() {
+ Iterator hashIterator = hashEntrySet.iterator();
+ Entry next = null;
+
+ public boolean hasNext() {
+ if (hashIterator.hasNext()) {
+ // since we removed garbage collected elements,
+ // we can simply return the next entry.
+ Map.Entry ent = (Map.Entry) hashIterator.next();
+ WeakValue wv = (WeakValue) ent.getValue();
+ Object v = (wv == null) ? null : wv.get();
+ next = new Entry(ent, v);
+ return true;
+ }
+ return false;
+ }
+
+ public Object next() {
+ if ((next == null) && !hasNext())
+ throw new NoSuchElementException();
+ Entry e = next;
+ next = null;
+ return e;
+ }
+
+ public void remove() {
+ hashIterator.remove();
+ }
+
+ };
+ }
+
+ public boolean isEmpty() {
+ return !(iterator().hasNext());
+ }
+
+ public int size() {
+ int j = 0;
+ for (Iterator i = iterator(); i.hasNext(); i.next()) j++;
+ return j;
+ }
+
+ public boolean remove(Object o) {
+ if (!(o instanceof Map.Entry)) return false;
+ Map.Entry e = (Map.Entry) o;
+ Object ek = e.getKey();
+ Object ev = e.getValue();
+ Object hv = WeakValueHashMap.this.get(ek);
+ if (hv == null) {
+ // if the map's value is null, we have to check, if the
+ // entry's value is null and the map contains the key
+ if ((ev == null) && WeakValueHashMap.this.containsKey(ek)) {
+ WeakValueHashMap.this.remove(ek);
+ return true;
+ } else {
+ return false;
+ }
+ // otherwise, simply compare the values
+ } else if (hv.equals(ev)) {
+ WeakValueHashMap.this.remove(ek);
+ return true;
+ }
+
+ return false;
+ }
+
+ public int hashCode() {
+ int h = 0;
+ for (Iterator i = hashEntrySet.iterator(); i.hasNext(); ) {
+ Map.Entry ent = (Map.Entry) i.next();
+ Object k;
+ WeakValue wv = (WeakValue) ent.getValue();
+ if (wv == null) continue;
+ h += ((((k = ent.getKey()) == null) ? 0 : k.hashCode())
+ ^ wv.hashCode());
+ }
+ return h;
+ }
+
+ }
+
+ // internal helper variable, because we can't access
+ // entrySet from the superclass inside the EntrySet class
+ private Set hashEntrySet = null;
+ // stores the EntrySet instance
+ private Set entrySet = null;
+
+ /**
+ * Returns a <code>Set</code> view of the mappings in this map.<p>
+ * @return a <code>Set</code> view of the mappings in this map.
+ */
+ public Set entrySet() {
+ if (entrySet == null) {
+ hashEntrySet = super.entrySet();
+ entrySet = new EntrySet();
+ }
+ return entrySet;
+ }
+
+ // stores the value collection
+ private transient Collection values = null;
+
+ /**
+ * Returns a <code>Collection</code> view of the values contained
+ * in this map.<p>
+ * @return a <code>Collection</code> view of the values contained
+ * in this map.
+ */
+ public Collection values() {
+ // delegates to entrySet, because super method returns
+ // WeakValues instead of value objects
+ if (values == null) {
+ values = new AbstractCollection() {
+ public Iterator iterator() {
+ return new Iterator() {
+ private Iterator i = entrySet().iterator();
+
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public Object next() {
+ return ((Entry)i.next()).getValue();
+ }
+
+ public void remove() {
+ i.remove();
+ }
+ };
+ }
+
+ public int size() {
+ return WeakValueHashMap.this.size();
+ }
+
+ public boolean contains(Object v) {
+ return WeakValueHashMap.this.containsValue(v);
+ }
+ };
+ }
+ return values;
+ }
+
+}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/package.html Fri Mar 18 17:02:29 2005
@@ -0,0 +1,26 @@
+<!--
+ 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 org.apache.jdo.ejb</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains utility classes used across the JDORI including I18N support, Logger.</p>
+</body>
+</html>
Added: incubator/jdo/trunk/ri11/test/conf/CF.properties.sav
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/CF.properties.sav?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/CF.properties.sav (added)
+++ incubator/jdo/trunk/ri11/test/conf/CF.properties.sav Fri Mar 18 17:02:29 2005
@@ -0,0 +1,16 @@
+#
+# 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.
+
+org.apache.jdo.FOStoreConnectionFactory.option.UserName:quetzalcoatl
Added: incubator/jdo/trunk/ri11/test/conf/JDO101Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/JDO101Policy?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/JDO101Policy (added)
+++ incubator/jdo/trunk/ri11/test/conf/JDO101Policy Fri Mar 18 17:02:29 2005
@@ -0,0 +1,81 @@
+// This is the policy file for JDO 1.0.1 assuming that
+// the JDO RI classes are in jar ${jdori}/src/jdori.jar,
+// the JDO classes are in jar ${jdori}/src/jdo.jar,
+// your application classes are in jar ${jdori}/src/test-classes.jar, and
+// your database files are in ${jdori}/src/test/database.
+
+grant codeBase "file:${jdori}/release/lib/ext/btree.jar" {
+ // Allow btree classes to read the properties
+ // org.netbeans.modules.mdr.btreestorage.*.
+ permission java.util.PropertyPermission "org.netbeans.modules.mdr.btreestorage.*", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database${/}*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdori}/src/jdori.jar" {
+ // Allow jdori classes to read system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // jdori-logger, user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdori}${/}src${/}jdo.jar", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}pcclasses.jar", "read";
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database${/}*", "read,write,delete";
+ // Allow jdori classes to read the default file to specify jdori logger.
+ permission java.io.FilePermission "${user.home}${/}.jdori-logger.properties", "read";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ // Allow jdori classes to get the class loader for a class.
+ // This is necessary if the persistent capable classes are loaded by
+ // a different class loader from the jdori classes.
+ permission java.lang.RuntimePermission "getClassLoader";
+ };
+
+grant codeBase "file:${jdori}/src/jdo.jar" {
+ // Allow jdo classes to get metadata for persistence capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdori}/src/test/jdori-test.jar" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "Test_Query.log", "write";
+ // Allow the test classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+ // Allow test classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+ };
+
+grant codeBase "file:${jdori}/release/lib/ext/xerces.jar" {
+ // Allow the xerces classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ };
Added: incubator/jdo/trunk/ri11/test/conf/JDO102Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/JDO102Policy?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/JDO102Policy (added)
+++ incubator/jdo/trunk/ri11/test/conf/JDO102Policy Fri Mar 18 17:02:29 2005
@@ -0,0 +1,94 @@
+// This is the policy file for JDO 1.0.2 assuming that
+// the JDO RI classes are in jar ${jdori}/src/jdori.jar,
+// the JDO classes are in jar ${jdori}/src/jdo.jar,
+// your application classes are in jar ${jdori}/src/test-classes.jar, and
+// your database files are in ${jdori}/src/test/database.
+
+grant codeBase "file:${jdori}/release/lib/ext/btree.jar" {
+ // Allow btree classes to read the properties
+ // org.netbeans.modules.mdr.btreestorage.*.
+ permission java.util.PropertyPermission "org.netbeans.modules.mdr.btreestorage.*", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database${/}*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdori}/src/jdori.jar" {
+ // Allow jdori classes to read system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // jdori-logger, user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdori}${/}src${/}jdo.jar", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}pcclasses.jar", "read";
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}database${/}*", "read,write,delete";
+ // Allow jdori classes to read the default file to specify jdori logger.
+ permission java.io.FilePermission "${user.home}${/}.jdori-logger.properties", "read";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ // Allow jdori classes to get the class loader for a class.
+ // This is necessary if the persistence-capable classes are loaded by
+ // a different class loader from the jdori classes.
+ permission java.lang.RuntimePermission "getClassLoader";
+ };
+
+grant codeBase "file:${jdori}/src/jdo.jar" {
+ // Allow jdo classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdori}/src/test/jdori-test.jar" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "Test_Query.log", "write";
+ // Allow the test classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+ // Allow test classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+ // Allow test classes to create a class loader
+ permission java.lang.RuntimePermission "createClassLoader";
+ // Allow test classes to get a class loader
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow class loaders in test classes to read jar files
+ permission java.io.FilePermission "${jdori}${/}src${/}test${/}pcclasses.jar", "read";
+ permission java.io.FilePermission "${jdori}${/}src${/}jdo.jar", "read";
+ // Allow test classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow test classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ };
+
+grant codeBase "file:${jdori}/release/lib/ext/xerces.jar" {
+ // Allow the xerces classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ };
Added: incubator/jdo/trunk/ri11/test/conf/JDO10Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/JDO10Policy?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/JDO10Policy (added)
+++ incubator/jdo/trunk/ri11/test/conf/JDO10Policy Fri Mar 18 17:02:29 2005
@@ -0,0 +1,79 @@
+// This is the policy file for JDO 1.0 assuming that
+// the JDO RI classes are in jar ${jdori}/src/jdori.jar,
+// the JDO classes are in jar ${jdori}/src/jdo.jar,
+// your application classes are in jar ${jdori}/src/test-classes.jar, and
+// your database files are in ${jdori}/src/test/database.
+
+grant codeBase "file:${jdori}/release/lib/ext/btree.jar" {
+ // Allow btree classes to read the properties
+ // org.netbeans.modules.mdr.btreestorage.*.
+ permission java.util.PropertyPermission "org.netbeans.modules.mdr.btreestorage.*", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}/src/test/database/*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdori}/src/jdori.jar" {
+ // Allow jdori classes to read system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // jdori-logger, user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdori}/src/jdo.jar", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${jdori}/src/test/pcclasses.jar", "read";
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${jdori}/src/test/database", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}/src/test/database/*", "read,write,delete";
+ // Allow jdori classes to read the default file to specify jdori logger.
+ permission java.io.FilePermission "${user.home}/.jdori-logger.properties", "read";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ // Allow jdori classes to get the class loader for a class.
+ // This is necessary if the persistent capable classes are loaded by
+ // a different class loader from the jdori classes.
+ permission java.lang.RuntimePermission "getClassLoader";
+ };
+
+grant codeBase "file:${jdori}/src/jdo.jar" {
+ // Allow jdo classes to get metadata for persistence capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdori}/src/test/jdori-test.jar" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "Test_Query.log", "write";
+ // Allow the test classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+ };
+
+grant codeBase "file:${jdori}/src/test/pcclasses.jar" {
+ // Allow persistence capable classes to set their state manager.
+ // This permission is removed as soon as the enhancer generates a call
+ // to JDOImplHelper.checkAuthorizedStateManager.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
Added: incubator/jdo/trunk/ri11/test/conf/JDO11Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/JDO11Policy?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/JDO11Policy (added)
+++ incubator/jdo/trunk/ri11/test/conf/JDO11Policy Fri Mar 18 17:02:29 2005
@@ -0,0 +1,132 @@
+// This is the policy file for JDO 1.1 assuming that
+// - the JDO API classes are in jar ${jdoapi},
+// - the btree implementation is in ${jdobtree},
+// - the JDO RI classes are in ${jdori},
+// - your test classes are in jar ${jdoritests},
+// - your application pc classes are in ${pcclasses},
+// - your database files are in ${testdir},
+// - junit is in ${junit},
+// - commons-logging is in ${logging},
+// - an XML parser implementation (if necessray) is in ${xmlparser}
+// - testlist is ${testlist}
+
+grant codeBase "file:${jdobtree}" {
+ // Allow btree classes to read the properties
+ // org.netbeans.mdr.persistence.*.
+ permission java.util.PropertyPermission "org.netbeans.mdr.persistence.*", "read";
+ permission java.util.PropertyPermission "perf.mdr.MDRCache", "read";
+ permission java.util.PropertyPermission "debug.mdr.MDRCache", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdori}" {
+ // Allow jdori classes to read system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdoapi}", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${pcclasses}", "read";
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${testdir}", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ // Allow jdori classes to get the class loader for a class.
+ // This is necessary if the persistence-capable classes are loaded by
+ // a different class loader from the jdori classes.
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow the jdori classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${jdoapi}" {
+ // Allow jdo classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdoritests}" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the test classes to read test lists.
+ permission java.io.FilePermission "${testlist}", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "${testdir}", "write";
+ // Allow test classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+ // Allow test classes to create a class loader
+ permission java.lang.RuntimePermission "createClassLoader";
+ // Allow test classes to get a class loader
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow class loaders in test classes to read jar files
+ permission java.io.FilePermission "${pcclasses}", "read";
+ permission java.io.FilePermission "${fsuidjar}", "read";
+ permission java.io.FilePermission "${jdoapi}", "read";
+ // Allow test classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+ // Allow test classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow test classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow test classes to access declared constructors via reflection
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // JUnit problem: accessing junit.properties is not privileged
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // JUnit problem: accessing .junitsession is not privileged
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ // JUnit problem: accessing JUnit GUI icons is not privileged
+ permission java.io.FilePermission "${junit}", "read";
+ };
+
+grant codeBase "file:${junit}" {
+ // Allow junit classes to read system properties
+ permission java.util.PropertyPermission "*", "read";
+ // Allow junit classes to read the default file to specify junit properties.
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // Allow junit classes to manage a file to specify the junit session.
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ };
+
+grant codeBase "file:${logging}" {
+ // Allow the apache commons logging classes to read logging properties files
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${xmlparser}" {
+ // Allow the xmlparser classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ };
Added: incubator/jdo/trunk/ri11/test/conf/JDO20Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/JDO20Policy?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/JDO20Policy (added)
+++ incubator/jdo/trunk/ri11/test/conf/JDO20Policy Fri Mar 18 17:02:29 2005
@@ -0,0 +1,125 @@
+// This is the policy file for JDO 2.0 assuming that
+// - the JDO RI classes are in ${jdori}/src/jdo-ri.jar
+// - the JDO classes are in jar ${jdori}/src/jdo.jar,
+// - your application classes are in jar ${jdori}/test/jdori-test.jar, and
+// - your database files are in ${jdori}/test/database.
+
+grant codeBase "file:${jdori}/release/lib/ext/btree.jar" {
+ // Allow btree classes to read the properties
+ // org.netbeans.mdr.persistence.*.
+ permission java.util.PropertyPermission "org.netbeans.mdr.persistence.*", "read";
+ permission java.util.PropertyPermission "perf.mdr.MDRCache", "read";
+ permission java.util.PropertyPermission "debug.mdr.MDRCache", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}test${/}database${/}*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdori}/src/jdo-ri.jar" {
+ // Allow jdori classes to read and write system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdori}${/}src${/}jdo.jar", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${jdori}${/}test${/}pcclasses.jar", "read";
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${jdori}${/}test${/}database", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}test${/}database${/}*", "read,write,delete";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ // Allow jdori classes to get the class loader for a class.
+ // This is necessary if the persistence-capable classes are loaded by
+ // a different class loader from the jdori classes.
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow the jdori classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdori}/test/jdori-test.jar", "read";
+ };
+
+grant codeBase "file:${jdori}/src/jdo.jar" {
+ // Allow jdo classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdori}/test/jdori-test.jar" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the query test to read test lists.
+ permission java.io.FilePermission "*", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "*", "write";
+ // Allow test classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+ // Allow test classes to create a class loader
+ permission java.lang.RuntimePermission "createClassLoader";
+ // Allow test classes to get a class loader
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow class loaders in test classes to read jar files
+ permission java.io.FilePermission "${jdori}${/}test${/}pcclasses.jar", "read";
+ permission java.io.FilePermission "${jdori}${/}src${/}jdo.jar", "read";
+ // Allow test classes to manage fostore database files.
+ permission java.io.FilePermission "${jdori}${/}test${/}database${/}*", "read,write,delete";
+ // Allow test classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow test classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow test classes to access declared constructors via reflection
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // JUnit problem: accessing junit.properties is not privileged
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // JUnit problem: accessing .junitsession is not privileged
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ // JUnit problem: accessing JUnit GUI icons is not privileged
+ permission java.io.FilePermission "${jdori}${/}release${/}lib${/}ext${/}junit.jar", "read";
+ };
+
+grant codeBase "file:${jdori}/release/lib/ext/junit.jar" {
+ // Allow junit classes to read system properties
+ permission java.util.PropertyPermission "*", "read";
+ // Allow junit classes to read the default file to specify junit properties.
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // Allow junit classes to manage a file to specify the junit session.
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ };
+
+grant codeBase "file:${jdori}/release/lib/ext/xerces.jar" {
+ // Allow the xerces classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ };
+
+grant codeBase "file:${jdori}/release/lib/ext/commons-logging.jar" {
+ // Allow the apache commons logging classes to read logging properties files
+ permission java.io.FilePermission "${jdori}/test/jdori-test.jar", "read";
+ };
Added: incubator/jdo/trunk/ri11/test/conf/PMF.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/PMF.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/PMF.properties (added)
+++ incubator/jdo/trunk/ri11/test/conf/PMF.properties Fri Mar 18 17:02:29 2005
@@ -0,0 +1,18 @@
+#
+# 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.
+
+javax.jdo.PersistenceManagerFactoryClass: org.apache.jdo.impl.fostore.FOStorePMF
+
+
Added: incubator/jdo/trunk/ri11/test/conf/commons-logging.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/conf/commons-logging.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/conf/commons-logging.properties (added)
+++ incubator/jdo/trunk/ri11/test/conf/commons-logging.properties Fri Mar 18 17:02:29 2005
@@ -0,0 +1,46 @@
+#
+# 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 is a sample apache commons logging configuration file defining logging
+# properties for the JDO RI sources and test cases. It defines what logging
+# implementation the apache commons logging API should use by specifying the
+# property org.apache.commons.logging.Log (see below). Please note, that there
+# are separate property files for each logging implementation to set the log
+# level of the loggers:
+# - SimpleLog: simplelog.properties
+# - JDK1.4 logging: logging.properties
+#
+# The JDO RI sources use the following logger instances:
+# org.apache.jdo.impl.fostore File Object Store implementation
+# org.apache.jdo.impl.jdoql JDOQL query runtime
+# org.apache.jdo.impl.jdoql.jdoqlc JDOQL query compiler
+# org.apache.jdo.impl.model.jdo JDOModel implementation
+# org.apache.jdo.impl.model.jdo.xml XML parser for JDO metadata files
+# org.apache.jdo.impl.pm PM and PMF implementation
+# org.apache.jdo.impl.sco SCO implementation
+# org.apache.jdo.impl.state StateManager implementation
+# org.apache.jdo.store Generic StoreManager implementation
+# org.apache.jdo.util Utility classes
+#
+# The JDO RI test cases use the following logger instance:
+# org.apache.jdo.test
+#
+
+# Uncomment the next line if you want to use the apache simple logger
+#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
+
+# Uncomment the next two lines if you want to use JDK 1.4 logging
+#org.apache.commons.logging.Log = org.apache.jdo.util.JDOJdk14Logger
|