users@glassfish.java.net

Re: Is there a JAVA API for asadmin 'create-jdbc-connection-pool' and 'create-jdbc-resource' commands?

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Tue, 09 Aug 2011 08:46:25 +0530

It is possible via embedded api [1]. You need to get hold of GlassFish
object and then call getCommandRunner from it.

Option #1:You can write a simple osgi bundle and get hold of GlassFish
object there. See the complete sample at [2].

Option #2: You can write OSGi web app or EJB app and can directly get
hold of GlassFish object:

@Inject @OSGiService
GlassFish gf;

Option #3:
Although something like
@Resource GlassFish gf;
works in regular Java EE app, it is not specified to work, so can break
any time. It is a side effect of how our naming module works.

Thanks,
Sahoo

[1]
http://embedded-glassfish.java.net/nonav/apidocs/org/glassfish/embeddable/GlassFish.html
[2]
https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/sample/sample.embeddedgf/sample.embeddedgf.helloworld/

On Monday 08 August 2011 01:54 PM, forums_at_java.net wrote:
> Hello,
>
> Is there a JAVA API for asadmin 'create-jdbc-connection-pool' and
> 'create-jdbc-resource' commands in Glasfish 3.1?
>
> Thanks, Dror
>
>
> --
>
> [Message sent by forum member 'dror_class12']
>
> View Post: http://forums.java.net/node/830598
>
>