View Javadoc

1   /*
2    *  
3    *  Fosstrak LLRP Commander (www.fosstrak.org)
4    * 
5    *  Copyright (C) 2008 ETH Zurich
6    *
7    *  This program is free software: you can redistribute it and/or modify
8    *  it under the terms of the GNU General Public License as published by
9    *  the Free Software Foundation, either version 3 of the License, or
10   *  (at your option) any later version.
11   *
12   *  This program is distributed in the hope that it will be useful,
13   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   *  GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License
18   *  along with this program.  If not, see <http://www.gnu.org/licenses/> 
19   *
20   */
21  
22  package org.fosstrak.llrp.client;
23  
24  import java.util.List;
25  
26  import org.fosstrak.llrp.adaptor.AdaptorManagement;
27  import org.fosstrak.llrp.adaptor.exception.LLRPRuntimeException;
28  import org.fosstrak.llrp.client.repository.sql.roaccess.ROAccessItem;
29  
30  /**
31   * Common interface for all the implementations providing access to the 
32   * RO_ACCESS_REPORTS data-base. The actual implementation of the interface 
33   * is chosen at runtime via the strategy pattern from the respective Context 
34   * (in this case the implementation of the {@link Repository} interface). The 
35   * interface extends the {@link MessageHandler} interface, in order to be able 
36   * to receive LLRP RO_ACCESS_REPORTS messages. 
37   * <h3>NOTICE:</h3> The registration at the {@link AdaptorManagement} is done 
38   * automatically for the implementing class. So do this ONLY, if you know 
39   * exactly what you are planing to do (otherwise messages might get logged 
40   * twice!!!).
41   * @author sawielan
42   *
43   */
44  public interface ROAccessReportsRepository extends MessageHandler {
45  	
46  	/**
47  	 * set the repository that "owns" this RO_ACCESS_REPORTS repository.
48  	 * @param repository the repository that "owns" this RO_ACCESS_REPORTS repository.
49  	 */
50  	public void setRepository(Repository repository);
51  	
52  	/**
53  	 * Initializer for the RO_ACCESS_REPORTS repository. 
54  	 * <strong>NOTICE</strong>: if you create an instance of a subclass of this 
55  	 * interface, you <strong>MUST</strong> call this method directly after 
56  	 * instantiation.
57  	 * @param repository the repository belonging to this RO_ACCESS_REPORTS DB.
58  	 * @throws when there is a problem with initialization (eg. missing param).
59  	 */
60  	public void initialize(Repository repository) throws LLRPRuntimeException;
61  	
62  	/**
63  	 * retrieves all the RO_ACCESS_REPORTS elements in the database.
64  	 * @return a list of all the entries in the database stored into 
65  	 * {@link ROAccessItem}.
66  	 * @throws Exception when there is an error of any kind.
67  	 */
68  	public List<ROAccessItem> getAll() throws Exception;
69  	
70  	/**
71  	 * drop all the messages in the repository.
72  	 * @throws Exception when there is an error of any kind.
73  	 */
74  	public void clear() throws Exception;
75  }