KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > phoenix > interfaces > ApplicationContext


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.phoenix.interfaces;
9
10 import org.apache.avalon.framework.configuration.Configuration;
11 import org.apache.avalon.framework.configuration.ConfigurationException;
12 import org.apache.avalon.framework.logger.Logger;
13 import org.apache.avalon.phoenix.metadata.SarMetaData;
14 import org.apache.excalibur.threadcontext.ThreadContext;
15 import java.io.InputStream JavaDoc;
16
17 /**
18  * Manage the "context" in which Applications operate.
19  *
20  * @author <a HREF="mailto:peter at apache.org">Peter Donald</a>
21  */

22 public interface ApplicationContext
23 {
24     String JavaDoc ROLE = ApplicationContext.class.getName();
25
26     SarMetaData getMetaData();
27
28     ThreadContext getThreadContext();
29
30     /**
31      * A application can request that it be be shutdown. In most cases
32      * the kernel will schedule the shutdown to occur in another thread.
33      */

34     void requestShutdown();
35
36     /**
37      * Export specified object into management system.
38      * The object is exported using specifed interface
39      * and using the specified name.
40      *
41      * @param name the name of object to export
42      * @param interfaceClasses the interface of object with which to export
43      * @param object the actual object to export
44      */

45     void exportObject( String JavaDoc name, Class JavaDoc[] interfaceClasses, Object JavaDoc object )
46         throws Exception JavaDoc;
47
48     /**
49      * Unexport specified object from management system.
50      *
51      * @param name the name of object to unexport
52      */

53     void unexportObject( String JavaDoc name )
54         throws Exception JavaDoc;
55
56     /**
57      * Get ClassLoader for the current application.
58      *
59      * @return the ClassLoader
60      */

61     ClassLoader JavaDoc getClassLoader();
62
63     /**
64      * Retrieve a resource from the SAR file. The specified
65      * name is relative the root of the archive. So you could
66      * use it to retrieve a html page from within sar by loading
67      * the resource named "data/main.html" or similar.
68      */

69     InputStream JavaDoc getResourceAsStream( String JavaDoc name );
70
71     /**
72      * Get the Configuration for specified component.
73      *
74      * @param component the component
75      * @return the Configuration
76      */

77     Configuration getConfiguration( String JavaDoc component )
78         throws ConfigurationException;
79
80     /**
81      * Get logger with category for application.
82      * Note that this name may not be the absolute category.
83      *
84      * @param name the name of logger
85      * @return the Logger
86      */

87     Logger getLogger( String JavaDoc name );
88 }
89
Popular Tags