Projet

Général

Profil

« Précédent | Suivant » 

Révision 96454bcd

Ajouté par Sylvain Sauvage il y a plus de 11 ans

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.

  • All:
    - code cleaned and refactored
    - lots of bugs fixed
    - dependencies checked and trimmed
    - documentation added
    - Identity handling added
  • New library modules (Mu, Nu)
  • New signature modules (SigMa)
  • Access Layer and User interfaces (ALfA and OMeGa):
    - code refactored
    - new, better APIs
    - Identity handling added
    - use EPCglobal and DS events (no proxy types anymore)
  • New tempororay DSeTa web service (pending new DS)
  • ETa corrected and added to the IoTa-Installer
    - 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)
  • CaPPa: overall refactoring of XACML handling
    - new temporary User web service
    - new Xi module: XACML Interrogation web service (was two modules: TCP and
    servlet)
  • PSi now signs its events
  • Installer, now also installs or configures:
    - ETa and its Callback modules
    - ActiveMQ
    - SigMa
    - certificate/signing key
  • Greyc letters figures:
    - 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

Voir les différences:

EpcILoN/src/main/java/fr/unicaen/iota/epcilon/discovery/XPublisher.java
*/
package fr.unicaen.iota.epcilon.discovery;
import fr.unicaen.iota.discovery.client.DsClient;
import fr.unicaen.iota.discovery.client.model.Event;
import fr.unicaen.iota.discovery.client.model.EventInfo;
import fr.unicaen.iota.discovery.client.model.Session;
import fr.unicaen.iota.discovery.client.model.UserInfo;
import fr.unicaen.iota.discovery.client.util.EnhancedProtocolException;
import fr.unicaen.iota.dseta.client.DSeTaClient;
import fr.unicaen.iota.epcilon.conf.Configuration;
import fr.unicaen.iota.epcilon.model.EventToPublish;
import fr.unicaen.iota.epcilon.util.SQLQueryModule;
import java.rmi.RemoteException;
import fr.unicaen.iota.tau.model.Identity;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
......
public class XPublisher extends Thread {
private static final Log log = LogFactory.getLog(XPublisher.class);
private Session session;
private SQLQueryModule queryOperationsModule;
private DsClient dsClient;
private DSeTaClient dsetaClient;
private Identity identity;
public XPublisher() {
queryOperationsModule = new SQLQueryModule();
dsClient = new DsClient(Configuration.DISCOVERY_SERVICE_ADDRESS);
identity = new Identity();
identity.setAsString(Configuration.IDENTITY);
dsetaClient = new DSeTaClient(identity, Configuration.DISCOVERY_SERVICE_ADDRESS);
}
@Override
......
List<EventToPublish> blackList = new ArrayList<EventToPublish>();
String dsAddress = Configuration.DISCOVERY_SERVICE_ADDRESS;
try {
if (login().equals(Configuration.SESSION_FAILED_ID)) {
log.warn("Can't connect to the DS with these login/password " + dsAddress);
blackList.addAll(toPublishList);
return blackList;
}
log.debug("connected to " + dsAddress);
log.debug("USER INFO");
if (session == null) {
throw new Exception("unloged user try to publish");
}
UserInfo uInfo = dsClient.userInfo(session.getSessionId(), Configuration.LOGIN);
String partnerId = uInfo.getPartnerId();
int tmp = 0;
while (tmp < toPublishList.size()) {
List<EventInfo> list = new ArrayList<EventInfo>();
......
}
EventToPublish e = toPublishList.get(i);
Calendar ets = Calendar.getInstance();
Calendar sts = Calendar.getInstance();
ets.setTime(e.getEventTime());
Calendar sts = Calendar.getInstance();
sts.setTime(new Date());
Event event = new Event(0,
e.getEpc(),
partnerId,
uInfo.getUserId(),
null, // userInfo.partnerID, not used by server
null, // userInfo.userID, not used by server
e.getBizStep(),
e.getEventType(), e.getEventClass(), ets, sts,
e.getEventType(),
e.getEventClass(),
ets,
sts,
new HashMap<String, String>());
EventInfo eInfo = new EventInfo(event, 1, 30);
list.add(eInfo);
}
tmp += Configuration.SIMULTANEOUS_PUBLISH_LIMIT;
dsClient.multipleEventCreate(session.getSessionId(), partnerId, list);
dsetaClient.multipleEventCreate(identity.getAsString(), list);
log.info(list.size() + " events published at " + dsAddress);
Thread.sleep(1);
}
logout();
} catch (RemoteException ex) {
log.error("Events not published, the DS does not answer", ex);
blackList.addAll(toPublishList);
} catch (Exception ex) {
log.error("Publisher thread interrupted", ex);
blackList.addAll(toPublishList);
......
return blackList;
}
private String login() throws Exception {
log.debug("LOGIN");
session = dsClient.userLogin(fr.unicaen.iota.discovery.client.util.Configuration.DEFAULT_SESSION, Configuration.LOGIN, Configuration.PASS);
if (session == null) {
log.error("BAD LOGIN OR PASSWORD => END");
return null;
}
return session.getSessionId();
}
private void logout() throws RemoteException, EnhancedProtocolException {
log.debug("LOGOUT");
if (session != null) {
dsClient.userLogout(session.getSessionId());
session = null;
}
}
public String epcToEpcClass(String epc) {
String[] epcTab = epc.split("\\.");
StringBuilder epcClass = new StringBuilder();

Formats disponibles : Unified diff