Package edu.isi.karma.webserver

Examples of edu.isi.karma.webserver.KarmaException


   
    try{
      if(hTableId==null || hTableId.isEmpty()){
        //get table id based on the hNodeId
        if(hNodeId==null)
          throw new KarmaException("TableId and NodeId are empty. Can't add column.");
        hTableId = workspace.getFactory().getHNode(hNodeId).getHTableId();
      }
      HTable hTable = workspace.getFactory().getHTable(hTableId);
      if(hTable == null)
      {
        logger.error("No HTable for id "+ hTableId);
        throw new KarmaException("No HTable for id "+ hTableId );
      }
      if (null != hTable.getHNodeFromColumnName(newColumnName)) {
        logger.error("Add column failed to create " + newColumnName
            + " because it already exists!");
        return new UpdateContainer(new ErrorUpdate(
            "Add column failed to create " + newColumnName
                + " because it already exists!"));
      }  
      //add new column to this table
      //add column after the column with hNodeId
      HNode ndid = hTable.addNewHNodeAfter(hNodeId, HNodeType.Transformation, workspace.getFactory(), newColumnName, worksheet,true);
      if(ndid == null)
      {
        logger.error("Unable to add new HNode!");
        throw new KarmaException("Unable to add new HNode!");
      }
      //add as first column in the table if hNodeId is null
      //HNode ndid = currentTable.addNewHNodeAfter(null, vWorkspace.getRepFactory(), newColumnName, worksheet,true);

      //save the new hNodeId for undo
View Full Code Here


      createDirectory(metadataDirPath);
    }
    catch(KarmaException  e)
    {
      logger.error("Unable to create directory for " + parameter.name());
      throw new KarmaException("Unable to create directory for " + parameter.name(), e);
    }
  }
View Full Code Here

  protected void createDirectory(
      String metadataDirPath) throws KarmaException {
    File metadataDir = new File(metadataDirPath);
    if(metadataDir.exists() && !metadataDir.isDirectory())
    {
      throw new KarmaException("Directory provided is actually a file!" + metadataDirPath);
    }
    if(!metadataDir.exists())
    {
      if(!metadataDir.mkdirs())
      {
        throw new KarmaException("Unable to create directory for metadata! " + metadataDirPath);
      }
    }
  }
View Full Code Here

      try{
        metadataFile.createNewFile();
      }
      catch (IOException e)
      {
        throw new KarmaException("Unable to create directory for metadata! " + metadataFilePath, e);
      }
    }
  }
View Full Code Here

    this.urlColumnName = (urlColumnName == null || urlColumnName.trim().length() == 0) ? "url" : urlColumnName;
    this.idList = idList;
    this.encoding = encoding;
    requestURLs = URLManager.getURLsFromStrings(requestURLStrings);
    if (requestURLs == null || requestURLs.size() == 0)
      throw new KarmaException("Cannot model a service without any request example.");
   
    this.serviceData = null;
    this.invocations = new ArrayList<Invocation>();
   
    json = new JsonArray();
View Full Code Here

    this.idList.add("1");
    List<String> requestURLList = new ArrayList<String>();
    requestURLList.add(requestURLString);
    requestURLs = URLManager.getURLsFromStrings(requestURLList);
    if (requestURLs == null || requestURLs.size() == 0)
      throw new KarmaException("Cannot model a service without any request example.");
   
    this.serviceData = null;
    this.invocations = new ArrayList<Invocation>();
   
    json = new JsonArray();
View Full Code Here

    String userDirPath = ServletContextParameterMap.getParameterValue(ContextParameter.USER_DIRECTORY_PATH);
   
    File userDir = new File(userDirPath);
    if(userDir.exists() && !userDir.isDirectory())
    {
      throw new KarmaException("Directory provided for user preferences is actually a file!");
    }
    if(!userDir.exists())
    {
      if(!userDir.mkdirs())
      {
        throw new KarmaException("Unable to create directory for KARMA_WORK_HOME.  Please define the environment variable KARMA_WORK_HOME to save preferences and Karma's learning");
      }
    }
  }
View Full Code Here

      URL url = new URL(urlStr);
      if (i == 0) firstEndpoint = getEndPoint(url);
     
      // only urls with the same endpoints will be added to the list.
      if (!firstEndpoint.equalsIgnoreCase(getEndPoint(url)))
        throw new KarmaException("To model a service, all request examples should have the same endpoint.");
      urls.add(url);
    }
   
    return urls;
  }
View Full Code Here

    // check the connection first
    if (checkConnection(tripleStoreURL)) {
      logger.info("Connection Test passed");
    } else {
      logger.info("Failed connection test : " + tripleStoreURL);
      throw new KarmaException("Failed connect test : " + tripleStoreURL);
    }
  }
View Full Code Here

    else{
      //add it after hNodeId
      int index = orderedNodeIds.indexOf(hNodeId);
      if(index<0){
        //node not found;
        throw new KarmaException("Node " + hNodeId + " not found in table " + tableName);
      }
      else if (index == orderedNodeIds.size() - 1)
        //last node
        orderedNodeIds.add(hn.getId());
      else
View Full Code Here

TOP

Related Classes of edu.isi.karma.webserver.KarmaException

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.