org.mortbay.util

Class Container

Implemented Interfaces:
EventProvider, LifeCycle, Serializable
Known Direct Subclasses:
HttpContext, HttpServer, ServletHandler

public abstract class Container
extends java.lang.Object
implements LifeCycle, EventProvider, Serializable

Abstract Container. Provides base handling for LifeCycle and Component events.
Version:
$Id: Container.java,v 1.4 2005/08/13 08:49:59 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Method Summary

protected void
addComponent(Object o)
void
addEventListener(EventListener listener)
Add a server event listener.
void
destroy()
Destroy a stopped server.
protected abstract void
doStart()
Do start operations.
protected abstract void
doStop()
Do stop operations.
Collection
getComponents()
boolean
isStarted()
protected boolean
isStarting()
protected boolean
isStopping()
protected void
removeComponent(Object o)
void
removeEventListener(EventListener listener)
void
start()
Start the server.
void
stop()
Stop the container.

Method Details

addComponent

protected void addComponent(Object o)

addEventListener

public void addEventListener(EventListener listener)
            throws IllegalArgumentException
Add a server event listener.
Specified by:
addEventListener in interface EventProvider
Parameters:
listener - ComponentEventListener or LifeCycleEventListener

destroy

public void destroy()
Destroy a stopped server. Remove all components and send notifications to all event listeners. The HttpServer must be stopped before it can be destroyed.

doStart

protected abstract void doStart()
            throws Exception
Do start operations. This abstract method is called by start to perform the actual start operations.

doStop

protected abstract void doStop()
            throws Exception
Do stop operations. This abstract method is called by stop to perform the actual stop operations.

getComponents

public Collection getComponents()

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle

isStarting

protected boolean isStarting()

isStopping

protected boolean isStopping()

removeComponent

protected void removeComponent(Object o)

removeEventListener

public void removeEventListener(EventListener listener)
Specified by:
removeEventListener in interface EventProvider

start

public final void start()
            throws Exception
Start the server. Generate LifeCycleEvents for starting and started either side of a call to doStart
Specified by:
start in interface LifeCycle

stop

public final void stop()
            throws InterruptedException
Stop the container. Generate LifeCycleEvents for stopping and stopped either side of a call to doStop
Specified by:
stop in interface LifeCycle

Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.