Package edu.isi.karma.rep.sources

Examples of edu.isi.karma.rep.sources.DataSource


      logger.error("The alignment tree is null.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. The alignment model is null."));
    }

    DataSource source = new DataSource(wk.getTitle(), tree);
   
    Map<WebService, Map<String, String>> servicesAndMappings =
      WebServiceLoader.getInstance().getServicesWithInputContainedInModel(source.getModel(), null);
   
    if (servicesAndMappings == null) {
      logger.error("Cannot find any services to be invoked according to this source model.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. Cannot find any services to be invoked according to this source model."));
View Full Code Here


  public UpdateContainer doIt(Workspace workspace) throws CommandException {
   
    Worksheet wk = workspace.getWorksheet(worksheetId);

    WebService service = null;
    DataSource source = null;
   
    if (!wk.containService()) {
      logger.info("The worksheet does not have a service object.");
//      return new UpdateContainer(new ErrorUpdate(
//        "Error occured while publishing the model. The worksheet does not have a service object."));
    } else
      service = wk.getMetadataContainer().getService();
   
    AlignmentManager mgr = AlignmentManager.Instance();
    String alignmentId = mgr.constructAlignmentId(workspace.getId(), worksheetId);
    Alignment al = mgr.getAlignment(alignmentId);
   
    if (al == null) {
      logger.error("The alignment model is null.");
      if (service == null)
        return new UpdateContainer(new ErrorUpdate(
          "Error occured while publishing the source. The alignment model is null."));
    }
   
    DirectedWeightedMultigraph<Node, LabeledLink> tree = null;
    if (al != null)
      tree = al.getSteinerTree();
   
    if (tree == null) {
      logger.error("The alignment tree is null.");
      if (service == null)
        return new UpdateContainer(new ErrorUpdate(
          "Error occured while publishing the source. The alignment tree is null."));
    }
   
    if (service != null) service.updateModel(tree);
    else {
      source = new DataSource(wk.getTitle(), tree);
      MetadataContainer metaData = wk.getMetadataContainer();
      if (metaData == null) {
        metaData = new MetadataContainer();
        wk.setMetadataContainer(metaData);
      }
      metaData.setSource(source);
      logger.info("Source added to the Worksheet.");
    }
   
    try {
      if (service != null) {
        WebServicePublisher servicePublisher = new WebServicePublisher(service);
        servicePublisher.publish(Repository.Instance().LANG, true);
        logger.info("Service model has successfully been published to repository: " + service.getId());
        return new UpdateContainer(new InfoUpdate(
        "Service model has successfully been published to repository: " + service.getId()));
      } else { //if (source != null) {
        DataSourcePublisher sourcePublisher = new DataSourcePublisher(source, workspace.getFactory(), wk.getMetadataContainer().getSourceInformation());
        sourcePublisher.publish(Repository.Instance().LANG, true);
        logger.info("Source model has successfully been published to repository: " + source.getId());
        return new UpdateContainer(new InfoUpdate(
        "Source model has successfully been published to repository: " + source.getId()));
      }

    } catch (IOException e) {
      logger.error("Error occured while publishing the source/service ", e);
      return new UpdateContainer(new ErrorUpdate(
View Full Code Here

  public UpdateContainer undoIt(Workspace workspace) {

    Worksheet wk = workspace.getWorksheet(worksheetId);

    WebService service = null;
    DataSource source = null;
   
    if (!wk.containService()) {
      logger.error("The worksheet does not have a service object.");
//      return new UpdateContainer(new ErrorUpdate(
//        "Error occured while deleting the model. The worksheet does not have a service object."));
    } else
      service = wk.getMetadataContainer().getService();
   
    if (!wk.containSource()) {
      logger.error("The worksheet does not have a source object.");
//      return new UpdateContainer(new ErrorUpdate(
//        "Error occured while deleting the model. The worksheet does not have a source object."));
    } else
      source = wk.getMetadataContainer().getSource();
   
    try {

      // one way to un-publish is just set the service model to null and publish it again.
      // in this way the invocation part will be kept in the repository.
//      ServicePublisher servicePublisher = new ServicePublisher(service);
//      servicePublisher.publish("N3", true);

      // deleting the service completely from the repository.
      if (service != null) {
        WebServiceLoader.getInstance().deleteSourceByUri(service.getUri());
        logger.info("Service model has successfully been deleted from repository.");
        return new UpdateContainer(new ErrorUpdate(
            "Service model has successfully been deleted from repository."));
      }
      else {
        DataSourceLoader.getInstance().deleteSourceByUri(source.getUri());
        logger.info("Source model has successfully been deleted from repository.");
        return new UpdateContainer(new ErrorUpdate(
            "Source model has successfully been deleted from repository."));
      }
View Full Code Here

   
    Model m = Repository.Instance().getNamedModel(uri);
    if (m == null)
      return null;

    DataSource source = importSourceFromJenaModel(m);
    return source;
  }
View Full Code Here

        logger.debug("source id: " + source_id);
        if (name != null && name.isLiteral()) source_name = name.asLiteral().getString();
        logger.debug("source name: " + source_name);
       
        if (source_id.trim().length() > 0)
          sourceList.add(new DataSource(source_id, source_name));
        else
          logger.info("length of source id is zero.");
      }
     
      return sourceList;
View Full Code Here

      source_name = node.asLiteral().getString();
      logger.debug("source name: " + source_name);
    } else
      logger.debug("source does not have a name.");
   
    DataSource source = new DataSource(source_id);
    source.setName(source_name);
    source.setVariables(getVariables(model, source_resource));
     source.setAttributes(getAttributes(model, source_resource));
     source.setModel(getSemanticModel(model, source_resource));
   
    return source;
  }
View Full Code Here

  }
 
  private static void testGetSourceByUri() {
    String uri = "http://isi.edu/integration/karma/sources/AEEA5A9A-744C-8096-B372-836ACC820D5A#";
//    String uri = "http://isi.edu/integration/karma/sources/940466A8-8733-47B1-2597-11DC112F0437F#";
    DataSource source = (DataSource) DataSourceLoader.getInstance().getSourceByUri(uri);
    if (source != null) source.print();
  }
View Full Code Here

TOP

Related Classes of edu.isi.karma.rep.sources.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.