View Javadoc

1   /* This file is part of COPAL (COntext Provisioning for All).
2    *
3    * COPAL is a part of SM4All (Smart hoMes for All) project.
4    *
5    * COPAL is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU Lesser General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    *
10   * COPAL is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU Lesser General Public License for more details.
14   *
15   * You should have received a copy of the GNU Lesser General Public License
16   * along with COPAL. If not, see <http://www.gnu.org/licenses/>.
17   */
18  package at.ac.tuwien.infosys.sm4all.copal.api;
19  
20  import at.ac.tuwien.infosys.sm4all.copal.api.event.ContextEventAction;
21  import at.ac.tuwien.infosys.sm4all.copal.api.event.ContextEventType;
22  
23  /**
24   * This class is used with the {@link ContextListener}s to create queries which
25   * listen on occurrence of processed events (i.e. events for which all
26   * {@link ContextEventAction}s are finished}.
27   * 
28   * @author sanjin
29   */
30  public class ProcessedEventQuery extends ContextQuery {
31  
32      /**
33       * Create instance of the query for processed events. The <code>name</code>
34       * should be globally unique, meaning that if two context query have same
35       * <code>name</code> then their <code>eventType</code>s and
36       * <code>criteria</code>s are equal. The <code>eventType</code> is name of
37       * {@link ContextEventType} to be caught.
38       * 
39       * @param name the globally unique name of the query.
40       * @param eventType the name of {@link ContextEventType}.
41       * @throws NullPointerException if specified name or event name is
42       *         <code>null</code>.
43       * @throws IllegalArgumentException if specified name or event name is an
44       *         empty or blank string.
45       */
46      public ProcessedEventQuery(final String name, final String eventType) {
47          super(name, eventType);
48      }
49  
50      /**
51       * Create instance of the query for processed events. The <code>name</code>
52       * should be globally unique, meaning that if two context queries have same
53       * <code>name</code> then their <code>eventType</code>s and
54       * <code>criteria</code>s are equal. The <code>eventType</code> is name of
55       * {@link ContextEventType} on which <code>criteria</code> is executed. The
56       * <code>criteria</code> is the logical statement which further separates
57       * the processed events of interest. If query should catch all
58       * <code>eventType</code> events, we set <code>criteria</code> to be
59       * <code>null</code> or blank string or use
60       * {@link ContextQuery#ContextQuery(String, String) ContextQuery(String,
61       * String)} constructor.
62       * 
63       * @param name the globally unique name of the query.
64       * @param eventType the name of {@link ContextEventType}.
65       * @param criteria the logical expression.
66       * @throws NullPointerException if specified name or event name is
67       *         <code>null</code>.
68       * @throws IllegalArgumentException if specified name or event name is an
69       *         empty or blank string.
70       */
71      public ProcessedEventQuery(final String name, final String eventType,
72              final String criteria) {
73          super(name, eventType, criteria);
74      }
75  }