dev@glassfish.java.net

Re: V3 : Upgrade Service Questions

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 17 Aug 2009 12:00:30 -0700

Rebecca Searls wrote:
> Kumar Jayanti wrote:
>> Hi all,
>>
>> Has anyone completed their upgrade service implementation ?. If yes
>> please pass on the pointers to your code so i can take a look.
>>
>> Specifically i have questions like :
>>
>> 1. How does the Upgrade Service Access the domain.xml of the source
>> V2 server?. 2. And can i assume that the domain.xml entities of the
>> destination V3 server can be injected as usual
>
> Look at the Grizzle code.
> Search for class GrizzlyConfigSchemaMigrator.java in module
> admin/config-api.
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?

Thanks,
Mitesh

>
>
>> 3. Is there any specific location (module/dir-structure) etc. for
>> the Upgrade Service. I mean can i for example implement the Security
>> Upgrade Service inside the security/core module.
>
> You must implement the service tag. Look at the Upgrade Service TOI
> slides
> on the wiki.
> http://wiki.glassfish.java.net/Wiki.jsp?page=V3UpgradeDashboard
> It identifies the API you must implement.
>
>> 4. Does the upgrade service automatically copy resources under the
>> domainX/config directory from the source V2 server to the destination
>> V3 server
>
> If there is domain config information that you component requires your
> service
> must tranlate that information from the V2 and V3-Prelude to the V3 env.
>
>> 5. Where can i find samples and instructions on how to run the
>> upgrade tool or specifically unit test the Upgrade Service
>> implementation for my specific module.
> See the Upgrade Service TOI slide for your options.
>
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>