DS> Alex, what would someone have to do to create their own KeyGenerator? I
DS> am sure someone will want to port the high-low generator.
There are two basic interfaces in org.jboss.ejb.plugins.keygenerator
package:
1. for key generator:
/**
* An implementation of KeyGenerator must return a unique key from
* each call to generateKey().
* Each enitity with unknown primary key has an instance of
* KeyGenerator that it acquires from the corresponding
* KeyGeneratorFactory
*/
public interface KeyGenerator {
public Object generateKey();
}
2. for factory of key generators:
public interface KeyGeneratorFactory {
/** return a JNDI name of the factory */
public String getFactoryName();
/** return the instance of a key generator */
public KeyGenerator getKeyGenerator()
throws Exception;
}
Then an instance of implemented KeyGeneratorFactory should be bound to JNDI.
For UUIDKeyGeneratorFactory, there is a service
UUIDKeyGeneratorFactoryService that does it when it starts and
unbounds the factory when it's stopped. The service implements only
two methods: startService() and stopService().
Hope that's enough to get the idea. If methods in the interfaces
require additional parameters and/or exceptions it's acceptable.
Any improvements are welcome!
alex
>> JBossCMP becomes cooler. Now it supports Unknown primary keys (Refer to EJB2.0 spec
>10.8.3 for details).
>>
>> To make use of this feature, entity beans must have prim-key-class declared as
>java.lang.Object and no primkey-field in ejb-jar.xml.
>> To set up unknown primary key, the new optional unknown-pk element is used in
>jbosscmp-jdbc.xml. (See jbosscmp-jdbc_3_0.dtd for details).
>> If unknown-pk element is omitted in jbosscmp-jdbc.xml, the default one from
>standardjbosscmp-jdbc.xml will be used.
>> The default (and the only for now) key generator factory is
>> UUIDKeyGeneratorFactory. It's deployed as a service (in default and all
>configurations) and bound to the global JNDI context.
>> Other key generator factory implementations are welcome!
>>
>> The feature is available in CVS HEAD version.
--
Best regards,
Alex Loubyansky
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user