dev@glassfish.java.net

Re: V3 : Upgrade Service Questions

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 17 Aug 2009 22:23:29 -0700

Thanks Jagadish. This helps.

Nandini/Lloyd,

As also pointed by Jagadish, PersistenceManagerFactoryResource config
serverbeans is removed in v3. Is there any other mechanism to read it
from a V2 domain or should it be added to V3 to facilitate upgrade?

Thanks,
Mitesh

Jagadish Prasath Ramu wrote:
> On Mon, 2009-08-17 at 12:00 -0700, Mitesh Meswani wrote:
>
>> As part of CMP migration, I need to translate following element of V2
>> <persistence-manager-factory-resource enabled="true"
>> factory-class="com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl"
>> jdbc-resource-jndi-name="*jdbc/oracle*" jndi-name="*jdo/s1qePM*"
>> object-type="user">
>> ....
>> </persistence-manager-factory-resource>
>>
>> into following for V3
>>
>> <jdbc-resource enabled="true" jndi-name="*jdo/s1qePM*"
>> object-type="user" pool-name="*<pool pointed to by jdbc/oracle>"*/>
>>
>> In other works, I need to implement following psuedocode
>>
>> translateCMPSettings() {
>> final Config config = domain.getConfigs().getConfig().get(0);
>> Collection collection pmfResources =
>> config.getPersistenceManagerFactoryResources(); <------ (1)
>> for each pmfResource {
>> String jndiName =
>> pmfResource.getJNDIName();
>> <------ (2)
>> String jdbcResourceJNDIName =
>> pmfResource.getJdbcResourceJNDIName(); <------ (3)
>> String poolName = find-jdbc-connection-pool
>> (jdbcResourceJNDIName); <------ (4)
>> create-jdbc-resource(jndiName,
>> poolName);
>> <------ (5)
>> }
>>
>> I do not have enough expertise in working with manipulating domain.xml.
>> Can any one with knowledge in this area guide me on how to implement
>> above? Specifically, I have following questions.
>>
>> - There is no call on config like
>> getPersistenceManagerFactoryResources() like (1) above. How to retrieve
>> equivalent information?
>> -How to retrieve (2) and (3) once (1) is achieved?
>> -How to interate through defined jdbc-connection-pool of a domain to
>> implement (4)
>> -How to create an entry for jdbc-resource as in (5) above?
>>
>
> Hi Mitesh,
> You can try as follows :
>
> @Inject
> Resources resources;
>
> {
> Collection<PersistenceManagerFactoryResource> =
> resources.getResources(PersistenceManagerFactoryResource)
>
> //Iterate through PMFResources
> {
> String jdbcResourceName = pmfResource.getJdbcResourceJndiName();
>
> JdbcResource jdbcResource = resources.getResourceByName(JdbcResource,
> jdbcResourceName)
>
> JdbcConnectionPool jdbcPool =
> resources.getResourceByName(JdbcConnectionPool,
> jdbcResource.getPoolName());
>
> //refer org.jdbc.admin.cli.JdbcResourceManager.create() which creates
> jdbc-resource configuration in domain.xml
>
> } // end of iteration
>
> }
>
>
> Note : I guess, PersistenceManagerFactoryResource config serverbeans is
> removed in v3. Probably it has to be reintroduced for upgrade purposes
> alone ?
>
> Thanks,
> -Jagadish
>
>
>
>> Thanks,
>> Mitesh
>>
>>
>
>
>