Index: src/java/javax/jdo/Constants.java
===================================================================
--- src/java/javax/jdo/Constants.java (revision 1232175)
+++ src/java/javax/jdo/Constants.java (working copy)
@@ -38,13 +38,14 @@
/**
* The name of the standard service configuration resource text file containing
- * the name of an implementation of {@link PersistenceManagerFactory}.
- * Constant value is META-INF/services/javax.jdo.PersistenceManagerFactory.
+ * the name of an implementation of {@link PersistenceManagerFactoryService}.
+ * Constant value is META-INF/services/javax.jdo.PersistenceManagerFactoryService.
*
+ * @version 3.1
* @since 2.1
*/
static String SERVICE_LOOKUP_PMF_RESOURCE_NAME
- = "META-INF/services/javax.jdo.PersistenceManagerFactory";
+ = "META-INF/services/javax.jdo.PersistenceManagerFactoryService";
/**
* The name of the standard service configuration resource text file containing
Index: src/java/javax/jdo/JDOHelper.java
===================================================================
--- src/java/javax/jdo/JDOHelper.java (revision 1232175)
+++ src/java/javax/jdo/JDOHelper.java (working copy)
@@ -818,11 +818,11 @@
* If you have a jar file that provides the jdo implementation,
* a file naming the implementation goes into the file
* packaged into the jar file, called
- * META-INF/services/javax.jdo.PersistenceManagerFactory.
- * The contents of the file is a string that is the PMF class name,
+ * META-INF/services/javax.jdo.PersistenceManagerFactoryService.
+ * The contents of the file is a string that is the PMF service class name,
* null or blank.
* For each file in pmfClassLoader named
- * META-INF/services/javax.jdo.PersistenceManagerFactory,
+ * META-INF/services/javax.jdo.PersistenceManagerFactoryService,
* this method will try to invoke the getPersistenceManagerFactory
* method of the implementation class.
* Return the factory if a valid class name is extracted from
@@ -830,6 +830,7 @@
* Otherwise add the exception thrown to
* an exception list.
*/
+ String pmfServiceClassName = null;
Enumeration urls = null;
try {
urls = getResources(pmfClassLoader,
@@ -842,13 +843,13 @@
while (urls.hasMoreElements()) {
try {
- pmfClassName = getClassNameFromURL(
+ pmfServiceClassName = getClassNameFromURL(
(URL) urls.nextElement());
// return the implementation that is valid.
PersistenceManagerFactory pmf =
invokeGetPersistenceManagerFactoryOnImplementation(
- pmfClassName, overrides, props, pmfClassLoader);
+ pmfServiceClassName, overrides, props, pmfClassLoader);
return pmf;
} catch (Throwable ex) {
@@ -1114,7 +1115,7 @@
* with Map overrides, Map properties parameters will be invoked.
* If the overrides parameter to this method is null, the static method
* with Map properties parameter will be invoked.
- * @param pmfClassName the name of the implementation factory class
+ * @param pmfServiceClassName the name of the implementation factory class
* @param overrides a Map of overrides
* @param properties a Map of properties
* @param cl the class loader to use to load the implementation class
@@ -1122,11 +1123,11 @@
*/
protected static PersistenceManagerFactory
invokeGetPersistenceManagerFactoryOnImplementation(
- String pmfClassName, Map, ?> overrides, Map, ?> properties, ClassLoader cl) {
+ String pmfServiceClassName, Map, ?> overrides, Map, ?> properties, ClassLoader cl) {
if (overrides != null) {
// overrides is not null; use getPersistenceManagerFactory(Map overrides, Map props)
try {
- Class> implClass = forName(pmfClassName, true, cl);
+ Class> implClass = forName(pmfServiceClassName, true, cl);
Method m = getMethod(implClass,
"getPersistenceManagerFactory", //NOI18N
new Class[]{Map.class, Map.class});
@@ -1135,25 +1136,25 @@
null, new Object[]{overrides, properties});
if (pmf == null) {
throw new JDOFatalInternalException(msg.msg (
- "EXC_GetPMFNullPMF", pmfClassName)); //NOI18N
+ "EXC_GetPMFNullPMF", pmfServiceClassName)); //NOI18N
}
return pmf;
} catch (ClassNotFoundException e) {
throw new JDOFatalUserException(msg.msg(
- "EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N
+ "EXC_GetPMFClassNotFound", pmfServiceClassName), e); //NOI18N
} catch (NoSuchMethodException e) {
throw new JDOFatalInternalException(msg.msg(
- "EXC_GetPMFNoSuchMethod2", pmfClassName), e); //NOI18N
+ "EXC_GetPMFNoSuchMethod2", pmfServiceClassName), e); //NOI18N
} catch (NullPointerException e) {
throw new JDOFatalInternalException (msg.msg(
- "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
+ "EXC_GetPMFNullPointerException", pmfServiceClassName), e); //NOI18N
} catch (IllegalAccessException e) {
throw new JDOFatalUserException(msg.msg(
- "EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N
+ "EXC_GetPMFIllegalAccess", pmfServiceClassName), e); //NOI18N
} catch (ClassCastException e) {
throw new JDOFatalInternalException (msg.msg(
- "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
+ "EXC_GetPMFClassCastException", pmfServiceClassName), e); //NOI18N
} catch (InvocationTargetException ite) {
Throwable nested = ite.getTargetException();
if (nested instanceof JDOException) {
@@ -1164,7 +1165,7 @@
} else {
// overrides is null; use getPersistenceManagerFactory(Map props)
try {
- Class> implClass = forName(pmfClassName, true, cl);
+ Class> implClass = forName(pmfServiceClassName, true, cl);
Method m = getMethod(implClass,
"getPersistenceManagerFactory", //NOI18N
new Class[]{Map.class});
@@ -1173,24 +1174,24 @@
null, new Object[]{properties});
if (pmf == null) {
throw new JDOFatalInternalException(msg.msg (
- "EXC_GetPMFNullPMF", pmfClassName)); //NOI18N
+ "EXC_GetPMFNullPMF", pmfServiceClassName)); //NOI18N
}
return pmf;
} catch (ClassNotFoundException e) {
throw new JDOFatalUserException(msg.msg(
- "EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N
+ "EXC_GetPMFClassNotFound", pmfServiceClassName), e); //NOI18N
} catch (NoSuchMethodException e) {
throw new JDOFatalInternalException(msg.msg(
- "EXC_GetPMFNoSuchMethod", pmfClassName), e); //NOI18N
+ "EXC_GetPMFNoSuchMethod", pmfServiceClassName), e); //NOI18N
} catch (NullPointerException e) {
throw new JDOFatalInternalException (msg.msg(
- "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
+ "EXC_GetPMFNullPointerException", pmfServiceClassName), e); //NOI18N
} catch (IllegalAccessException e) {
throw new JDOFatalUserException(msg.msg(
- "EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N
+ "EXC_GetPMFIllegalAccess", pmfServiceClassName), e); //NOI18N
} catch (ClassCastException e) {
throw new JDOFatalInternalException (msg.msg(
- "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
+ "EXC_GetPMFClassCastException", pmfServiceClassName), e); //NOI18N
} catch (InvocationTargetException ite) {
Throwable nested = ite.getTargetException();
if (nested instanceof JDOException) {
Index: src/java/javax/jdo/PersistenceManagerFactoryService.java
===================================================================
--- src/java/javax/jdo/PersistenceManagerFactoryService.java (revision 0)
+++ src/java/javax/jdo/PersistenceManagerFactoryService.java (revision 0)
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 javax.jdo;
+
+import java.util.Map;
+
+/** The PersistenceManagerFactoryService is the interface
+ * for ClusterJHelper to use to obtain PersistenceManagerFactory
+ * instances using Java 6 services lookup.
+ * The PersisenceManagerFactory is then used to create PersistenceManager
+ * instances.
+ * The Java 6 pattern is to include in the class path of the application
+ * a jar file containing the name of the implementation class that implements
+ * the PersistenceManagerFactoryService interface.
+ * The file is named META-INF/services/javax.jdo.PersistenceManagerFactoryService
+ * and it contains the fully-qualified class name of the implementation class
+ * that implements PersistenceManagerFactoryService.
+ * This is used by JDOHelper to find an implementation for the methods
+ * getPersistenceManagerFactory(ClassLoader pmfClassLoader)
+ * getPersistenceManagerFactory(File propsFile)
+ * getPersistenceManagerFactory(File propsFile, ClassLoader loader)
+ * getPersistenceManagerFactory(InputStream stream)
+ * getPersistenceManagerFactory(InputStream stream, ClassLoader loader)
+ * getPersistenceManagerFactory(Map, ?> props)
+ * getPersistenceManagerFactory(Map, ?> props, ClassLoader pmfClassLoader)
+ * getPersistenceManagerFactory(Map, ?> overrides, String name)
+ * getPersistenceManagerFactory(Map, ?> overrides, String name, ClassLoader resourceLoader)
+ * getPersistenceManagerFactory(Map, ?> overrides, String name, ClassLoader resourceLoader, ClassLoader pmfLoader)
+ * getPersistenceManagerFactory(String name)
+ * getPersistenceManagerFactory(String name, ClassLoader loader)
+ * getPersistenceManagerFactory(String name, ClassLoader resourceLoader, ClassLoader pmfLoader)
+ *
+ * @version 3.1
+ * @since 3.1
+ */
+
+public interface PersistenceManagerFactoryService {
+
+ /**
+ * Get a PersistenceManagerFactory with the properties in the
+ * parameter props. The factory might have been created earlier.
+ * @param props a Map of configuration properties
+ * @return a nonconfigurable PersistenceManagerFactory based on the
+ * properties in the parameter Map
+ * @since 3.1
+ */
+ PersistenceManagerFactory getPersistenceManagerFactory (Map, ?> props);
+
+ /**
+ * Get a PersistenceManagerFactory with the properties in the
+ * parameters props and overrides. The factory might have been created earlier.
+ * @param overrides a Map of configuration properties that override the
+ * properties in the props parameter
+ * @param props a Map of configuration properties
+ * @return a nonconfigurable PersistenceManagerFactory based on the
+ * properties in the parameter Map
+ * @since 3.1
+ */
+ PersistenceManagerFactory getPersistenceManagerFactory (
+ Map, ?> overrides, Map, ?> props);
+
+}
Property changes on: src/java/javax/jdo/PersistenceManagerFactoryService.java
___________________________________________________________________
Added: svn:eol-style
+ LF