View Javadoc

1   package at.ac.tuwien.infosys.sm4all.copal.service.copal;
2   
3   import at.ac.tuwien.infosys.sm4all.copal.api.ContextProcessor;
4   import at.ac.tuwien.infosys.sm4all.copal.api.event.ContextEventType;
5   
6   /**
7    * Interface which COPAL core provides to register, unregister, and query
8    * {@link ContextProcessor}s.
9    * 
10   * @author fei
11   * @author sanjin
12   */
13  public interface ContextProcessorRegistry {
14  
15      /**
16       * Register {@link ContextProcessor} with COPAL core.
17       * 
18       * @param processor the context processor.
19       * @return <code>true</code> if registering was successful;
20       *         <code>false</code> otherwise.
21       */
22      boolean register(ContextProcessor processor);
23  
24      /**
25       * Unregister {@link ContextProcessor} with specified name from COPAL core.
26       * 
27       * @param name the name of a registered {@link ContextProcessor}.
28       * @return <code>true</code> if unregistering was successful;
29       *         <code>false</code> otherwise.
30       */
31      boolean unregister(String name);
32  
33      /**
34       * Checks if a {@link ContextProcessor} with specified name is currently
35       * registered with COPAL core.
36       * 
37       * @param name the name of {@link ContextProcessor}.
38       * @return <code>true</code> if the {@link ContextProcessor} with specified
39       *         name is registered; <code>false</code> otherwise.
40       */
41      boolean isRegistered(String name);
42  
43      /**
44       * @return all currently registered {@link ContextProcessor}s.
45       */
46      ContextProcessor[] getProcessors();
47  
48      /**
49       * @param name the name of a {@link ContextProcessor}.
50       * @return the {@link ContextProcessor} used in registration; or
51       *         <code>null</code> if there is no registered
52       *         {@link ContextProcessor} with specified name.
53       */
54      ContextProcessor getProcessor(String name);
55  
56      /**
57       * @param eventType the name of {@link ContextEventType}.
58       * @return all {@link ContextProcessor}s which process events of
59       *         {@link ContextEventType} that has name equal to specified
60       *         <code>eventType</code>.
61       */
62      ContextProcessor[] getProcessors(String eventType);
63  }