db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject VOTE: Issue 132: Factory Sequences
Date Tue, 20 Sep 2005 00:01:33 GMT
Here's what we could do for the factory construction. Please vote or  
discuss.

1. Remove factory-class from the metadata. It's too much work for  
this late in the project. All sequences would be implemented by the  
JDO vendor.

2. Retain the attributes name and strategy but add a nested element  
sequence-property. We still need to add some other interfaces or  
methods to allow the factory sequence to implement transactional  
sequences.

<!ELEMENT sequence (extension*, sequence-property*, extension*)>
<!ATTLIST sequence name CDATA #REQUIRED>
<!ATTLIST sequence datastore-sequence CDATA #IMPLIED>
<!ATTLIST sequence factory-class CDATA #IMPLIED>
<!ATTLIST sequence strategy (nontransactional|contiguous| 
noncontiguous) #REQUIRED>

<!ELEMENT sequence-property (extension*)>
<!ATTLIST sequence-property key CDATA #REQUIRED>
<!ATTLIST sequence-property value CDATA #IMPLIED>

Example:

<sequence name="MySequence" factory- 
class="org.apache.jdo.tck.sequence.TestSequence">
<sequence-property key="javax.jdo.sequence.Strategy"  
value="transactional"/>
<sequence-property key="org.apache.jdo.tck.sequence.InitialValue"  
value="1009"/>
<sequence-property key="org.apache.jdo.tck.sequence.Increment"  
value="10"/>
</sequence>

We could standardize some of the property names and leave others to  
the implementation, exactly as we do now for PMF properties.

Then, the newInstance method would take the name and Properties as  
arguments:

public static Sequence newInstance(String name, Properties props);

We might also add the PersistenceManagerFactory to the newInstance  
method allowing the factory to use the same DataSource as used by the  
PMF. Or define the parameters as a Map and pass the PMF as the value  
of the key "javax.jdo.sequence.PersistenceManagerFactory".

3. Some other mechanism for passing construction values to the sequence.

Craig

On Sep 19, 2005, at 11:10 AM, Craig Russell wrote:

> Javadogs,
>
> The spec doesn't provide enough information for factory  
> implementations of Sequence. Specifically:
> 1. The factory method newInstance has no parameters, so it's  
> impossible to tell it what its name is and what its strategy is.
> 2. There is no support in JDOImplHelper for the factory Sequence to  
> get information needed. The Sequence doesn't know which PMF is  
> being used, and therefore what DataSource to use.
> 3. There is not even a way to give the Sequence the extensions that  
> might be defined on the metdata sequence element.
> 4. There's no support for transactional sequences. A sequence needs  
> to know the context in which it is called in order to know whether  
> to make transactional or non-transactional calls to the underlying  
> DataSource. It cannot determine whether it needs to block.
>
> Comments?
>
> Craig
>
> 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!


Mime
View raw message