L2p Service Migration v0.6 to v0.7 - rwth-acis/las2peer-template-project GitHub Wiki

Service bundles

  • Service dependencies should be bundles into the service jar. The core does not handle dependencies anymore to circumvent security and compatibility issues. Please update your build script according to the template project.

  • One service, one jar. No two services in one jar are allowed anymore.

Java API

  • The API lives now in its own package i5.las2peer.api. The service may only access this package, the RESTMapper package i5.las2peer.restMapper and some JDK packages. Access to all other classes is restricted, except they are bundles in the service bundle.

Quick refactoring hints

A brief overview of renamed classes is given in the following. Some features changed significally, please refer to the API documentation for more information.

  • rename i5.las2peer.webConnector.WebConnector.properties files to i5.las2peer.connectors.webConnector.WebConnector.properties

  • organise imports, some classes/interfaces moved to api package

  • remove L2pSecurityException

  • replace L2pServiceException with InternalServiceException or remove it

  • replace Event with MonitoringEvent

  • replace AgentNotKnownException with AgentNotFoundException

  • replace Service.getContext() with Context.get()

  • replace fetchEnvelope with requestEnvelope

  • replace ArtifactNotFoundException with EnvelopeNotFoundException

  • replace Agent.getId() with Agent.getIdentifier()

  • replace Agent.unlockPrivateKey() with Agent.unlock()

  • replace Context.get().getAgent(long) with Context.get().requestAgent(String), the retrieved agent is automatically unlocked using the current main agent

  • replace createEnvelope(identifier, content, owner) with createEnvelope(identifier, owner) and setContent(content) call on the returned envelope instance usual update or create structure looks like this:

    Envelope env;
    
    try {
      env = Context.get().requestEnvelope(identifier);
    } catch (EnvelopeNotFoundException e) {
      logger.info("Envelope (" + identifier + ") not found. Creating new one. " + e.toString());
      env = Context.get().createEnvelope(identifier, owner);
    }
    
    // update envelope content
    env.setContent(file);
    
    // store envelope with new content
    Context.get().storeEnvelope(env, owner);