--
-------------------------------------------------------------------
Michael Watzek [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------
Index: src/java/javax/jdo/JDOHelper.java
===================================================================
--- src/java/javax/jdo/JDOHelper.java (revision 209452)
+++ src/java/javax/jdo/JDOHelper.java (working copy)
@@ -373,7 +373,7 @@
/**
* Returns a [EMAIL PROTECTED] PersistenceManagerFactory}
configured based
* on the properties stored in the file at
- * <code>propsResource</code>. This method is equivalent to
+ * <code>propsFile</code>. This method is equivalent to
* invoking [EMAIL PROTECTED]
* #getPersistenceManagerFactory(File,ClassLoader)} with
* <code>Thread.currentThread().getContextClassLoader()</code> as
@@ -391,7 +391,7 @@
/**
* Returns a [EMAIL PROTECTED] PersistenceManagerFactory}
configured based
* on the properties stored in the file at
- * <code>propsResource</code>. Creates a [EMAIL PROTECTED]
+ * <code>propsFile</code>. Creates a [EMAIL PROTECTED]
* PersistenceManagerFactory} with <code>loader</code>. Any
* <code>IOException</code>s or
* <code>FileNotFouldException</code>s thrown during resource
@@ -426,19 +426,19 @@
}
- /**
- * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} at the
JNDI
- * location specified by <code>jndiLocation</code> in the context
- * <code>context</code>. If <code>context</code> is
- * <code>null</code>, <code>new InitialContext()</code> will be
- * used. This method is equivalent to invoking [EMAIL PROTECTED]
- * #getPersistenceManagerFactory(String,Context,ClassLoader)}
- * with
- * <code>Thread.currentThread().getContextClassLoader()</code> as
- * the <code>loader</code> argument.
- *
- * @since 2.0
- */
+ /**
+ * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} at the JNDI
+ * location specified by <code>jndiLocation</code> in the context
+ * <code>context</code>. If <code>context</code> is
+ * <code>null</code>, <code>new InitialContext()</code> will be
+ * used. This method is equivalent to invoking [EMAIL PROTECTED]
+ * #getPersistenceManagerFactory(String,Context,ClassLoader)}
+ * with
+ * <code>Thread.currentThread().getContextClassLoader()</code> as
+ * the <code>loader</code> argument.
+ *
+ * @since 2.0
+ */
public static PersistenceManagerFactory getPersistenceManagerFactory
(String jndiLocation, Context context) {
return getPersistenceManagerFactory (jndiLocation, context,
@@ -446,17 +446,17 @@
}
- /**
- * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} at the
JNDI
- * location specified by <code>jndiLocation</code> in the context
- * <code>context</code>. If <code>context</code> is
- * <code>null</code>, <code>new InitialContext()</code> will be
- * used. Creates a [EMAIL PROTECTED] PersistenceManagerFactory}
with
- * <code>loader</code>. Any <code>NamingException</code>s thrown
- * will be wrapped in a [EMAIL PROTECTED] JDOFatalUserException}.
- *
- * @since 2.0
- */
+ /**
+ * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} at the JNDI
+ * location specified by <code>jndiLocation</code> in the context
+ * <code>context</code>. If <code>context</code> is
+ * <code>null</code>, <code>new InitialContext()</code> will be
+ * used. Creates a [EMAIL PROTECTED] PersistenceManagerFactory} with
+ * <code>loader</code>. Any <code>NamingException</code>s thrown
+ * will be wrapped in a [EMAIL PROTECTED] JDOFatalUserException}.
+ *
+ * @since 2.0
+ */
public static PersistenceManagerFactory getPersistenceManagerFactory
(String jndiLocation, Context context, ClassLoader loader) {
if (jndiLocation == null)
@@ -475,4 +475,50 @@
(msg.msg ("EXC_NamingException", jndiLocation, loader), ne);
}
}
+
+ /**
+ * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} configured based
+ * on the properties stored in the input stream at
+ * <code>stream</code>. This method is equivalent to
+ * invoking [EMAIL PROTECTED]
+ * #getPersistenceManagerFactory(InputStream,ClassLoader)} with
+ * <code>Thread.currentThread().getContextClassLoader()</code> as
+ * the <code>loader</code> argument.
+ *
+ * @since 2.0
+ */
+ public static PersistenceManagerFactory getPersistenceManagerFactory
+ (InputStream stream) {
+ return getPersistenceManagerFactory (stream,
+ Thread.currentThread().getContextClassLoader());
+ }
+
+
+ /**
+ * Returns a [EMAIL PROTECTED] PersistenceManagerFactory} configured based
+ * on the properties stored in the input stream at
+ * <code>stream</code>. Creates a [EMAIL PROTECTED]
+ * PersistenceManagerFactory} with <code>loader</code>. Any
+ * <code>IOException</code>s or
+ * <code>FileNotFouldException</code>s thrown during resource
+ * loading will be wrapped in a [EMAIL PROTECTED] JDOFatalUserException}.
+ *
+ * @since 2.0
+ */
+ public static PersistenceManagerFactory getPersistenceManagerFactory
+ (InputStream stream, ClassLoader loader) {
+ if (stream == null)
+ throw new JDOFatalUserException (msg.msg ("EXC_NullStream"));
+ if (loader == null)
+ throw new JDOFatalUserException (msg.msg ("EXC_NullLoader"));
+ Properties props = new Properties ();
+ try {
+ props.load (stream);
+ } catch (IOException ioe) {
+ throw new JDOFatalUserException
+ (msg.msg ("EXC_IOExceptionStream"), ioe);
+ }
+ return getPersistenceManagerFactory (props, loader);
+ }
+
}
Index: src/java/javax/jdo/Bundle.properties
===================================================================
--- src/java/javax/jdo/Bundle.properties (revision 209452)
+++ src/java/javax/jdo/Bundle.properties (working copy)
@@ -46,3 +46,6 @@
PersistenceManagerFactory at "{0}" from JNDI.
EXC_StringWrongLength: There must be exactly one character in the id in the
input String for CharIdentity.
EXC_IllegalEventType:The event type is outside the range of valid event types.
+EXC_NullStream: The stream argument to this method cannot be null.
+EXC_IOExceptionStream: An IOException was thrown while loading from a stream \
+into a java.util.Properties object.