View Javadoc

1   /*
2      Copyright 2007 Ramon Servadei
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15   */
16  package fulmine.context;
17  
18  import fulmine.distribution.IDistributionManager;
19  import fulmine.distribution.connection.IConnectionBroker;
20  import fulmine.distribution.connection.IConnectionDiscoverer;
21  import fulmine.model.container.IContainer;
22  
23  /**
24   * The framework context; this provides access to properties of the context that
25   * should only be accessed by the framework internals.
26   * 
27   * @author Ramon Servadei
28   */
29  public interface IFrameworkContext extends IFulmineContext
30  {
31  
32      final static String NAME = "Fulmine";
33  
34      /**
35       * Get the connection broker for the context.
36       * 
37       * @return the broker for this context, <code>null</code> if there is no
38       *         broker in the context
39       * @see #setConnectionBroker(IConnectionBroker)
40       */
41      IConnectionBroker getConnectionBroker();
42  
43      /**
44       * Get the network
45       * 
46       * @return the network for this context
47       */
48      INetwork getNetwork();
49  
50      /**
51       * Get the component that will report on the state of this context
52       * 
53       * @return a component that can report on the state of this context
54       */
55      IContextWatchdog getContextWatchdog();
56  
57      /**
58       * Set the connection broker for the context. This allows the context to
59       * create connections to remote contexts. This must be called before
60       * {@link #start()}.
61       * 
62       * @param broker
63       *            the broker to use to create connections to remote contexts
64       */
65      void setConnectionBroker(IConnectionBroker broker);
66  
67      /**
68       * Set the discover for the context. This allows the context to discover
69       * connections to remote contexts. This must be called before
70       * {@link #start()}.
71       * 
72       * @param discoverer
73       *            the discoverer to use to find connections to other remote
74       *            contexts
75       */
76      void setConnectionDiscoverer(IConnectionDiscoverer discoverer);
77  
78      /**
79       * Get the connection discoverer in use by this context.
80       * 
81       * @return the connection discoverer in use, <code>null</code> if there is
82       *         not one allocated.
83       */
84      IConnectionDiscoverer getConnectionDiscoverer();
85  
86      /**
87       * Provide a different implementation of the distribution manager.
88       * 
89       * @param distributionManager
90       *            the distribution manager to use
91       */
92      void setDistributionManager(IDistributionManager distributionManager);
93  
94      /**
95       * Get the distribution manager assigned to the context
96       * 
97       * @return the distribution manager assigned to this context
98       */
99      IDistributionManager getDistributionManager();
100 
101     /**
102      * Get the event processor identity prefix. This appears as the prefix for
103      * all event processor threads in this context.
104      * 
105      * @return the event processor identity prefix
106      */
107     String getEventProcessorIdentityPrefix();
108 
109     /**
110      * Get the 'system info' record that is used to encapsulate any system level
111      * information about the context. This is typically used by remote
112      * subscribers to inspect the state of the context.
113      * <p>
114      * Bespoke attributes can be attached to this record by application code.
115      */
116     IContainer getSystemInfo();
117 }