Révision 96454bcd
Ajouté par Sylvain Sauvage il y a plus de 11 ans
ALfA/ALfA/src/main/java/fr/unicaen/iota/application/operations/EpcisOperation.java | ||
---|---|---|
*/
|
||
package fr.unicaen.iota.application.operations;
|
||
|
||
import java.net.URL;
|
||
import fr.unicaen.iota.eta.query.ETaQueryControlClient;
|
||
import fr.unicaen.iota.tau.model.Identity;
|
||
import java.rmi.RemoteException;
|
||
import java.util.ArrayList;
|
||
import java.util.HashMap;
|
||
... | ... | |
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
import org.fosstrak.epcis.model.*;
|
||
import org.fosstrak.epcis.queryclient.QueryControlClient;
|
||
|
||
public class EpcisOperation {
|
||
|
||
private final String EPCIS_SERVICE_ADDRESS;
|
||
private final Identity IDENTITY;
|
||
private static final Log log = LogFactory.getLog(EpcisOperation.class);
|
||
|
||
public EpcisOperation(String epcis_service_address) throws Exception {
|
||
public EpcisOperation(Identity identity, String epcis_service_address) {
|
||
IDENTITY = identity;
|
||
EPCIS_SERVICE_ADDRESS = epcis_service_address;
|
||
}
|
||
|
||
... | ... | |
return queryParam;
|
||
}
|
||
|
||
private List<EPCISEventType> getFilteredEvent(Map<String, String> filters) throws RemoteException {
|
||
public List<EPCISEventType> getFilteredEvent(Map<String, String> filters) throws RemoteException {
|
||
log.trace("getFilteredEvent");
|
||
try {
|
||
QueryControlClient client = new QueryControlClient();
|
||
client.configureService(new URL(EPCIS_SERVICE_ADDRESS), null);
|
||
ETaQueryControlClient client = new ETaQueryControlClient(IDENTITY, EPCIS_SERVICE_ADDRESS);
|
||
QueryParams queryParams = new QueryParams();
|
||
for (Map.Entry<String, String> entry : filters.entrySet()) {
|
||
queryParams.getParam().add(createEPCISParameter(entry.getKey(), entry.getValue()));
|
||
... | ... | |
|
||
public List<EPCISEventType> getEventFromEPC(String EPC) throws RemoteException {
|
||
log.trace("getEventFromEPC: " + EPC);
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
map.put("MATCH_epc", EPC);
|
||
return getFilteredEvent(map);
|
||
List<EPCISEventType> res = new ArrayList<EPCISEventType>();
|
||
res.addAll(getObjectEventFromEPC(EPC, new HashMap<String, String>()));
|
||
res.addAll(getAggregationEventFromEPC(EPC, new HashMap<String, String>()));
|
||
res.addAll(getQuantityEventFromEPC(EPC, new HashMap<String, String>()));
|
||
res.addAll(getTransactionEventFromEPC(EPC, new HashMap<String, String>()));
|
||
return res;
|
||
}
|
||
|
||
public List<EPCISEventType> getObjectEventFromEPC(String EPC, Map<String, String> filters) throws RemoteException {
|
||
log.trace("getObjectEventFromEPC: " + EPC);
|
||
Map<String, String> allFilters = new HashMap<String, String>(filters);
|
||
allFilters.put("MATCH_epc", EPC);
|
||
allFilters.put("eventType", "ObjectEvent");
|
||
return getFilteredEvent(allFilters);
|
||
}
|
||
|
||
public List<EPCISEventType> getTransactionEventFromEPC(String EPC, Map<String, String> filters) throws RemoteException {
|
||
log.trace("getObjectEventFromEPC: " + EPC);
|
||
Map<String, String> allFilters = new HashMap<String, String>(filters);
|
||
allFilters.put("MATCH_parentID", EPC);
|
||
allFilters.put("eventType", "TransactionEvent");
|
||
return getFilteredEvent(allFilters);
|
||
}
|
||
|
||
public List<EPCISEventType> getObjectEventFromEPC(String EPC) throws RemoteException {
|
||
public List<EPCISEventType> getQuantityEventFromEPC(String EPC, Map<String, String> filters) throws RemoteException {
|
||
log.trace("getObjectEventFromEPC: " + EPC);
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
map.put("MATCH_epc", EPC);
|
||
map.put("eventType", "ObjectEvent");
|
||
return getFilteredEvent(map);
|
||
Map<String, String> allFilters = new HashMap<String, String>(filters);
|
||
allFilters.put("MATCH_epc", EPC);
|
||
allFilters.put("eventType", "QuantityEvent");
|
||
return getFilteredEvent(allFilters);
|
||
}
|
||
|
||
public List<EPCISEventType> getAggregationEventFromEPC(String EPC) throws RemoteException {
|
||
public List<EPCISEventType> getAggregationEventFromEPC(String EPC, Map<String, String> filters) throws RemoteException {
|
||
log.trace("getAggregationEventFromEPC: " + EPC);
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
map.put("MATCH_parentID", EPC);
|
||
map.put("eventType", "AggregationEvent");
|
||
return getFilteredEvent(map);
|
||
Map<String, String> allFilters = new HashMap<String, String>(filters);
|
||
allFilters.put("MATCH_parentID", EPC);
|
||
allFilters.put("eventType", "AggregationEvent");
|
||
return getFilteredEvent(allFilters);
|
||
}
|
||
|
||
private List<EPCISEventType> getEvents(EventListType eventListType) {
|
Formats disponibles : Unified diff
Version 1.9-mock
This is version 1.9-mock. 1.9 because the API still have changes pending
(principally relative to the Discovery Services). “mock” because TLS
configuration is not yet available and the signatures (SigMa) are not fully
implemented.
- code cleaned and refactored
- lots of bugs fixed
- dependencies checked and trimmed
- documentation added
- Identity handling added
- code refactored
- new, better APIs
- Identity handling added
- use EPCglobal and DS events (no proxy types anymore)
- ETa-Callback modules are now available as web applications
- filtering rules: if a part of an event is not allowed, now the whole
event is deleted from the result (before only the rejectd part was)
- new temporary User web service
- new Xi module: XACML Interrogation web service (was two modules: TCP and
servlet)
- ETa and its Callback modules
- ActiveMQ
- SigMa
- certificate/signing key
- new simplified figures (sans IoTa and simplified IoTa)
- new figure for ETa modules
- show 3rd party clients
- data flows specified
- TLS and link security added
- IDs and trusted IDs added
- color adjusted for printing
- GREYC logo added