dev@glassfish.java.net

Re: V3 : Upgrade Service Questions

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Tue, 18 Aug 2009 09:47:09 -0700

AFAIK, it should be added to V3, being javadoc'd to say it's there
only for backward compatibility. But is that the case?

Lloyd

On Aug 17, 2009, at 10:23 PM, Mitesh Meswani wrote:

> 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
>>>
>>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>

Lloyd Chambers
lloyd.chambers_at_sun.com
GlassFish Team