ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/rootfilter/RootFilter.java
Revision: 1.12
Committed: Tue Dec 12 20:59:03 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Changes since 1.11: +3 -3 lines
Log Message:
fixed mistake where it creates both interfaces but should only create one

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 tdb 1.3 package uk.ac.ukc.iscream.rootfilter;
3 tdb 1.1
4     //---IMPORTS---
5 ajm 1.5 import uk.ac.ukc.iscream.util.*;
6 tdb 1.1 import uk.ac.ukc.iscream.core.*;
7 ajm 1.8 import uk.ac.ukc.iscream.clientinterface.*;
8 tdb 1.1
9     /**
10 ajm 1.10 * The root filter is what all filters talk to
11     * Hosts cannot talk to this implementation of a filter.
12     * It provides hooks to all data interfaces for the system
13     * namely the client interface and the db interface.
14     * This is an i-scream component that starts the
15     * RootFilter services.
16 tdb 1.1 *
17 ajm 1.5 * @author $Author: ajm4 $
18 ajm 1.12 * @version $Id: RootFilter.java,v 1.11 2000/12/12 20:44:03 ajm4 Exp $
19 tdb 1.1 */
20 ajm 1.10 public class RootFilter implements uk.ac.ukc.iscream.util.Component {
21 tdb 1.1
22     //---FINAL ATTRIBUTES---
23    
24     /**
25     * The current CVS revision of this class
26     */
27 ajm 1.12 public static final String REVISION = "$Revision: 1.11 $";
28 ajm 1.10
29 tdb 1.1 //---STATIC METHODS---
30    
31 ajm 1.10 //---CONSTRUCTORS---
32    
33     //---PUBLIC METHODS---
34 ajm 1.5
35 ajm 1.10 /**
36     * This starts the Root Filter for the system
37     */
38     public void start() throws ComponentStartException {
39 ajm 1.5
40 ajm 1.10 _logger.write(toString(), Logger.SYSINIT, "coming up");
41 ajm 1.5
42     // configuration variables we require
43     String ourName = null;
44 ajm 1.8 String realInterface = null;
45     String dbInterface = null;
46 ajm 1.5
47 ajm 1.10 Configuration config = _refman.getCM().getConfiguration("RootFilter");
48 ajm 1.5 if (config == null) {
49 ajm 1.10 System.err.println("CRITICAL:Unable to obtain configuration" +
50     "\n Advise you check the i-scream log for more information.");
51     _logger.write(toString(), Logger.FATAL, "ERROR - unable to obtain configuration");
52     System.exit(1);
53 ajm 1.5 } else {
54     try {
55 ajm 1.8 ourName = config.getProperty("RootFilter.name");
56     realInterface = config.getProperty("RootFilter.realtimeInterfaceName");
57     dbInterface = config.getProperty("RootFilter.dbInterfaceName");
58 ajm 1.5 } catch (org.omg.CORBA.MARSHAL e) {
59 ajm 1.10 System.err.println ("CRITICAL:Unable to obtain required configuration property" +
60     "\n Advise you check the i-scream log for more information.");
61     _logger.write(toString(), Logger.FATAL, "ERROR - required configuration property not present");
62     System.exit(1);
63 ajm 1.5 }
64 tdb 1.1 }
65 ajm 1.5 // now we have the name of the Root Filter we set it
66 ajm 1.10 NAME = ourName;
67    
68     _logger.write(toString(), Logger.SYSINIT, "configured");
69 ajm 1.8
70     // get reference to the client interfaces - the real time one
71 ajm 1.11 if (realInterface != null) {
72     ClientInterface ciReal = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + realInterface));
73     }
74 ajm 1.10 // get reference to the client interfaces - and the db one
75 ajm 1.11 if (dbInterface != null) {
76     ClientInterface ciDB = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + dbInterface));
77     }
78    
79     ClientInterface[] clientInterfaces;
80     if (realInterface == null) {
81     _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + dbInterface);
82 ajm 1.12 clientInterfaces = {ciDB};
83 ajm 1.11 } else if (dbInterface == null) {
84     _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface);
85     clientInterfaces = {ciReal};
86     } else {
87     _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface);
88     clientInterfaces = {ciReal, ciDB};
89     }
90 ajm 1.8
91     // RootFilterServant start (for inbound child filter data)
92 ajm 1.10 _logger.write(toString(), Logger.DEBUG, "starting Root Filter");
93 ajm 1.8 RootFilterServant filterServant = new RootFilterServant(clientInterfaces);
94     // bind to the naming service as a filter
95 ajm 1.10 _refman.bindToOrb(filterServant, "iscream.Filter." + _name);
96 tdb 1.1
97 ajm 1.10 _logger.write(toString(), Logger.SYSINIT, "started");
98 tdb 1.1 }
99 ajm 1.10
100     /**
101     * Overrides the {@link java.lang.Object#toString() Object.toString()}
102     * method to provide clean logging (every class should have this).
103     *
104     * This uses the uk.ac.ukc.iscream.util.NameFormat class
105     * to format the toString()
106     *
107     * @return the name of this class and its CVS revision
108     */
109     public String toString() {
110     return FormatName.getName(
111     _name,
112     getClass().getName(),
113     REVISION);
114 tdb 1.1 }
115    
116     //---PRIVATE METHODS---
117    
118     //---ACCESSOR/MUTATOR METHODS---
119    
120     //---ATTRIBUTES---
121    
122 ajm 1.10 /**
123     * This is the friendly identifier of the
124     * component this class is running in.
125     * eg, a Filter may be called "filter1",
126     * If this class does not have an owning
127     * component, a name from the configuration
128     * can be placed here. This name could also
129     * be changed to null for utility classes.
130     */
131     private String _name = RootFilter.NAME;
132    
133     /**
134     * This holds a reference to the
135     * system logger that is being used.
136     */
137     private Logger _logger = ReferenceManager.getInstance().getLogger();
138    
139     /**
140     * A reference to the reference manager in use
141     */
142     private ReferenceManager _refman = ReferenceManager.getInstance();
143    
144 tdb 1.1 //---STATIC ATTRIBUTES---
145 ajm 1.10
146     /**
147     * The friendly name for this component, used by
148     * all related classes.
149     * This is set from the configuration.
150     */
151     public static String NAME;
152 tdb 1.1
153 ajm 1.5 }