You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig L Russell <Cr...@Sun.COM> on 2007/12/18 22:01:13 UTC

Properties for PersistenceManagerFactory

Here's the writeup for allowing the name of listener classes and  
datastore cache to be specified as properties in the properties file,  
similar to the specification in jdoconfig.xml.

<proposed>
Properties whose key begins with the prefix  
"javax.jdo.listener.InstanceLifecycleListener." have special  
treatment. The part of the key following the prefix is used as the  
class name of a class that implements the static method getInstance()  
and returns an instance that implements  
javax.jdo.listener.InstanceLifecycleListener. The implementation  
constructs an instance of this class, and the value of the key is a  
comma-separated list of classes to which the instantiated listener is  
registered to listen.
Similarly, properties whose key begins with the prefix  
"javax.jdo.datastore.DataStoreCache." have special treatment. The  
part of the key following the prefix is used as the class name of a  
class that implements the static method getInstance() and returns an  
instance that implements javax.jdo.datastore.DataStoreCache. The  
implementation constructs an instance of this class and registers it  
as the cache for the PersistenceManagerFactory.
</proposed>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Properties for PersistenceManagerFactory

Posted by Craig L Russell <Cr...@Sun.COM>.
Here's the latest:

<proposed>
Properties whose key begins with the prefix  
"javax.jdo.listener.InstanceLifecycleListener." have special  
treatment. The part of the key following the prefix is used as the  
class name of a class that implements  
javax.jdo.listener.InstanceLifecycleListener. The implementation  
first attempts to get an instance via the static method getInstance()  
that returns an instance that implements the  
javax.jdo.listener.InstanceLifecycleListener. If this is  
unsuccessful, an instance of this class is constructed via a no-args  
constructor. The value of the key is a comma-separated list of  
classes to which the instantiated listener is registered to listen.
Similarly, properties whose key begins with the prefix  
"javax.jdo.datastore.DataStoreCache." have special treatment. The  
part of the key following the prefix is used as the class name of a  
class that implements javax.jdo.datastore.DataStoreCache. The  
implementation first attempts to get an instance via the static  
method getInstance() that returns an instance that implements the  
javax.jdo.datastore.DataStoreCache. If this is unsuccessful, an  
instance of this class is constructed via a no-args constructor. The  
implementation registers it as the cache for the  
PersistenceManagerFactory.
</proposed>

On Dec 26, 2007, at 9:49 AM, Craig L Russell wrote:

> Hi Matthew,
>
> After I wrote that, I realized that either a static newInstance or  
> a no-args constructor would be equivalent.
>
> The reason I went with the static constructor at first was to  
> account for the case where the same listener class was used to  
> listen to multiple target classes, and it would be better if there  
> were a single instance listening to all target classes.
>
> I'll update the spec per your comment.
>
> Craig
>
> On Dec 26, 2007, at 9:16 AM, Matthew Adams wrote:
>
>> This is the first that I've heard of the static getInstance  
>> methods for InstanceLifecycleListener and DataStoreCache; I  
>> thought we would just do Class.newInstance() using the no-arg  
>> constructor (thereby requiring it).  Requiring the developer to  
>> provide a static getInstance method is an unnecessary burden.
>>
>> I propose adding the behavior of falling back to Class.newInstance 
>> () and requiring a no-arg constructor if there is no static  
>> getInstance method.
>>
>> -matthew
>>
>> On Dec 18, 2007, at 1:01 PM, Craig L Russell wrote:
>>
>>> Here's the writeup for allowing the name of listener classes and  
>>> datastore cache to be specified as properties in the properties  
>>> file, similar to the specification in jdoconfig.xml.
>>>
>>> <proposed>
>>> Properties whose key begins with the prefix  
>>> "javax.jdo.listener.InstanceLifecycleListener." have special  
>>> treatment. The part of the key following the prefix is used as  
>>> the class name of a class that implements the static method  
>>> getInstance() and returns an instance that implements  
>>> javax.jdo.listener.InstanceLifecycleListener. The implementation  
>>> constructs an instance of this class, and the value of the key is  
>>> a comma-separated list of classes to which the instantiated  
>>> listener is registered to listen.
>>> Similarly, properties whose key begins with the prefix  
>>> "javax.jdo.datastore.DataStoreCache." have special treatment. The  
>>> part of the key following the prefix is used as the class name of  
>>> a class that implements the static method getInstance() and  
>>> returns an instance that implements  
>>> javax.jdo.datastore.DataStoreCache. The implementation constructs  
>>> an instance of this class and registers it as the cache for the  
>>> PersistenceManagerFactory.
>>> </proposed>
>>>
>>> Craig Russell
>>> Architect, Sun Java Enterprise System http://java.sun.com/ 
>>> products/jdo
>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>> P.S. A good JDO? O, Gasp!
>>>
>>
>> Matthew Adams
>> matthew@matthewadams.org
>> http://blog.matthewadams.org
>>
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Properties for PersistenceManagerFactory

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Matthew,

After I wrote that, I realized that either a static newInstance or a  
no-args constructor would be equivalent.

The reason I went with the static constructor at first was to account  
for the case where the same listener class was used to listen to  
multiple target classes, and it would be better if there were a  
single instance listening to all target classes.

I'll update the spec per your comment.

Craig

On Dec 26, 2007, at 9:16 AM, Matthew Adams wrote:

> This is the first that I've heard of the static getInstance methods  
> for InstanceLifecycleListener and DataStoreCache; I thought we  
> would just do Class.newInstance() using the no-arg constructor  
> (thereby requiring it).  Requiring the developer to provide a  
> static getInstance method is an unnecessary burden.
>
> I propose adding the behavior of falling back to Class.newInstance 
> () and requiring a no-arg constructor if there is no static  
> getInstance method.
>
> -matthew
>
> On Dec 18, 2007, at 1:01 PM, Craig L Russell wrote:
>
>> Here's the writeup for allowing the name of listener classes and  
>> datastore cache to be specified as properties in the properties  
>> file, similar to the specification in jdoconfig.xml.
>>
>> <proposed>
>> Properties whose key begins with the prefix  
>> "javax.jdo.listener.InstanceLifecycleListener." have special  
>> treatment. The part of the key following the prefix is used as the  
>> class name of a class that implements the static method getInstance 
>> () and returns an instance that implements  
>> javax.jdo.listener.InstanceLifecycleListener. The implementation  
>> constructs an instance of this class, and the value of the key is  
>> a comma-separated list of classes to which the instantiated  
>> listener is registered to listen.
>> Similarly, properties whose key begins with the prefix  
>> "javax.jdo.datastore.DataStoreCache." have special treatment. The  
>> part of the key following the prefix is used as the class name of  
>> a class that implements the static method getInstance() and  
>> returns an instance that implements  
>> javax.jdo.datastore.DataStoreCache. The implementation constructs  
>> an instance of this class and registers it as the cache for the  
>> PersistenceManagerFactory.
>> </proposed>
>>
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>
> Matthew Adams
> matthew@matthewadams.org
> http://blog.matthewadams.org
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Properties for PersistenceManagerFactory

Posted by Matthew Adams <ma...@matthewadams.org>.
This is the first that I've heard of the static getInstance methods  
for InstanceLifecycleListener and DataStoreCache; I thought we would  
just do Class.newInstance() using the no-arg constructor (thereby  
requiring it).  Requiring the developer to provide a static  
getInstance method is an unnecessary burden.

I propose adding the behavior of falling back to Class.newInstance()  
and requiring a no-arg constructor if there is no static getInstance  
method.

-matthew

On Dec 18, 2007, at 1:01 PM, Craig L Russell wrote:

> Here's the writeup for allowing the name of listener classes and  
> datastore cache to be specified as properties in the properties  
> file, similar to the specification in jdoconfig.xml.
>
> <proposed>
> Properties whose key begins with the prefix  
> "javax.jdo.listener.InstanceLifecycleListener." have special  
> treatment. The part of the key following the prefix is used as the  
> class name of a class that implements the static method getInstance 
> () and returns an instance that implements  
> javax.jdo.listener.InstanceLifecycleListener. The implementation  
> constructs an instance of this class, and the value of the key is a  
> comma-separated list of classes to which the instantiated listener  
> is registered to listen.
> Similarly, properties whose key begins with the prefix  
> "javax.jdo.datastore.DataStoreCache." have special treatment. The  
> part of the key following the prefix is used as the class name of a  
> class that implements the static method getInstance() and returns  
> an instance that implements javax.jdo.datastore.DataStoreCache. The  
> implementation constructs an instance of this class and registers  
> it as the cache for the PersistenceManagerFactory.
> </proposed>
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>

Matthew Adams
matthew@matthewadams.org
http://blog.matthewadams.org