org.apache.avalon.phoenix
Interface BlockContext


public interface BlockContext

Context via which Blocks communicate with container.

Author:
Peter Donald

Field Summary
static String APP_HOME_DIR
           
static String APP_NAME
           
static String NAME
           
 
Method Summary
 File getBaseDirectory()
          Base directory of .sar application.
 Logger getLogger(String name)
          Deprecated. This allows block writers to "break-out" of their logging hierarchy which is considered bad form. Replace by Logger.getChildLogger(String) where original logger is aquired via AbstractLogEnabled.
 String getName()
          Retrieve name of block.
 InputStream getResourceAsStream(String name)
          Retrieve a resource from the SAR file.
 void requestShutdown()
          A block can request that the application it resides in be shut down.
 

Field Detail

APP_NAME

public static final String APP_NAME
See Also:
Constant Field Values

APP_HOME_DIR

public static final String APP_HOME_DIR
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values
Method Detail

getBaseDirectory

public File getBaseDirectory()
Base directory of .sar application. TODO: Should this be getHomeDirectory() or getWorkingDirectory() or other? TODO: Should a Block be able to declare it doesn't use the Filesystem? If it declares this then it would be an error to call this method.

Returns:
the base directory

getName

public String getName()
Retrieve name of block.

Returns:
the name of block

requestShutdown

public void requestShutdown()
A block can request that the application it resides in be shut down. This method will schedule the blocks application for shutdown. Note that this is just a request and the kernel may or may not honour the request (by default the request will be honored).


getResourceAsStream

public InputStream getResourceAsStream(String name)
Retrieve a resource from the SAR file. The specified name is relative the root of the archive. So you could use it to retrieve a html page from within sar by loading the resource named "data/main.html" or similar. Names may be prefixed with '/' character.

Parameters:
name - the name of resource
Returns:
the InputStream for resource or null if no such resource

getLogger

public Logger getLogger(String name)
Deprecated. This allows block writers to "break-out" of their logging hierarchy which is considered bad form. Replace by Logger.getChildLogger(String) where original logger is aquired via AbstractLogEnabled.

Retrieve logger coresponding to named category.

Returns:
the logger


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.