org.glassfish.embed
Class GlassFish

java.lang.Object
  extended by org.glassfish.embed.GlassFish

public class GlassFish
extends java.lang.Object

Entry point to the embedded GlassFish.

TODO: the way this is done today is that the embedded API wraps the ugliness of the underlying GFv3 internal abstractions, but ideally, it should be the other way around — this should be the native interface inside GlassFish, and application server launcher and CLI commands should be the client of this API. This is how all the other sensible containers do it, like Tomcat and Jetty.

Author:
Kohsuke Kawaguchi

Field Summary
protected  com.sun.enterprise.v3.server.ApplicationLifecycle appLife
           
protected  com.sun.enterprise.deploy.shared.ArchiveFactory archiveFactory
           
protected  com.sun.enterprise.v3.server.ServerEnvironment env
           
protected  org.jvnet.hk2.component.Habitat habitat
           
protected  com.sun.enterprise.v3.server.SnifferManager snifMan
           
 
Constructor Summary
GlassFish()
          Starts an empty do-nothing GlassFish v3.
GlassFish(int httpPort)
          Starts GlassFish v3 with minimalistic configuration that involves single HTTP listener listening on the given port.
 
Method Summary
 GFHttpListener createHttpListener(int listenerPort)
           
protected  java.io.File createTempDir()
           
 GFVirtualServer createVirtualServer(GFHttpListener listener)
           
protected  com.sun.hk2.component.InhabitantsParser decorateInhabitantsParser(com.sun.hk2.component.InhabitantsParser parser)
          Tweaks the 'recipe' --- for embedded use, we'd like GFv3 to behave a little bit differently from normal stand-alone use.
 GFApplication deploy(java.io.File archive)
          Deploys WAR/EAR/RAR/etc to this GlassFish.
 GFApplication deploy(org.glassfish.api.deployment.archive.ReadableArchive a)
           
static void setLogLevel(java.util.logging.Level level)
          Sets the overall logging level for GlassFish.
 void stop()
          Stops the running server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

habitat

protected org.jvnet.hk2.component.Habitat habitat

appLife

protected com.sun.enterprise.v3.server.ApplicationLifecycle appLife

snifMan

protected com.sun.enterprise.v3.server.SnifferManager snifMan

archiveFactory

protected com.sun.enterprise.deploy.shared.ArchiveFactory archiveFactory

env

protected com.sun.enterprise.v3.server.ServerEnvironment env
Constructor Detail

GlassFish

public GlassFish()
          throws GFException
Starts an empty do-nothing GlassFish v3.

In particular, no HTTP listener is configured out of the box, so you'd have to add some programatically via createHttpListener(int) and createVirtualServer(GFHttpListener).

Throws:
GFException

GlassFish

public GlassFish(int httpPort)
          throws GFException
Starts GlassFish v3 with minimalistic configuration that involves single HTTP listener listening on the given port.

Throws:
GFException
Method Detail

setLogLevel

public static void setLogLevel(java.util.logging.Level level)
Sets the overall logging level for GlassFish.


decorateInhabitantsParser

protected com.sun.hk2.component.InhabitantsParser decorateInhabitantsParser(com.sun.hk2.component.InhabitantsParser parser)
Tweaks the 'recipe' --- for embedded use, we'd like GFv3 to behave a little bit differently from normal stand-alone use.


createTempDir

protected java.io.File createTempDir()
                              throws java.io.IOException
Throws:
java.io.IOException

createVirtualServer

public GFVirtualServer createVirtualServer(GFHttpListener listener)

createHttpListener

public GFHttpListener createHttpListener(int listenerPort)

deploy

public GFApplication deploy(java.io.File archive)
                     throws java.io.IOException
Deploys WAR/EAR/RAR/etc to this GlassFish.

Returns:
always non-null. Represents the deployed application.
Throws:
java.io.IOException

deploy

public GFApplication deploy(org.glassfish.api.deployment.archive.ReadableArchive a)
                     throws java.io.IOException
Throws:
java.io.IOException

stop

public void stop()
Stops the running server.



Copyright © 2008 Sun Microsystems, Inc.. All Rights Reserved.