Beispiel #1
0
  private String internal_call(String ws, String[] values) {
    logger.info("#" + index + "请求调用web service: " + ws);
    OWLValue output;
    try {
      mKB = OWLFactory.createKB();
      mKB.createOntology(null);
      Service service = mKB.readService(URI.create(ws));

      ValueMap<Input, OWLValue> inputs = new ValueMap<Input, OWLValue>();

      for (int i = 0; i < values.length; i++) {
        Input input = service.getProcess().getInputs().get(i);
        inputs.setValue(input, mKB.createDataValue(values[i]));
        logger.info("\t" + input.getLocalName() + "  :  " + values[i]);
      }

      ProcessExecutionEngine exec = OWLSFactory.createExecutionEngine();
      ValueMap<Output, OWLValue> outputs;
      outputs = exec.execute(service.getProcess(), inputs, mKB);

      output = outputs.getDataValue(service.getProcess().getOutput().getName());
      logger.info("Result : " + output);
      return output.toString();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ExecutionException e) {
      e.printStackTrace();
    }
    return "";
  }
  @Override
  protected void setUp() throws IOException {
    Configuration conf = new Configuration();

    kfsEmul = new KFSEmulationImpl(conf);
    kosmosFileSystem = new KosmosFileSystem(kfsEmul);
    // a dummy URI; we are not connecting to any setup here
    kosmosFileSystem.initialize(URI.create("kfs:///"), conf);
    baseDir = new Path(System.getProperty("test.build.data", "/tmp") + "/kfs-test");
  }
  public void initialize(URI uri, Configuration conf) throws IOException {

    try {
      if (kfsImpl == null) {
        kfsImpl =
            new KFSImpl(
                conf.get("fs.kfs.metaServerHost", ""),
                conf.getInt("fs.kfs.metaServerPort", -1),
                statistics);
      }
      this.localFs = FileSystem.getLocal(conf);
      this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority());

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("Unable to initialize KFS");
      System.exit(-1);
    }
  }
Beispiel #4
0
 /**
  * Construct a new request.
  *
  * @param request request string without the base URI
  * @param data data to send to the server
  * @param m HTTP method
  */
 protected Put(final String request, final byte[] data, final HTTPMethod m) {
   uri = URI.create(BASE_URL + request);
   content = data;
   method = m;
 }
Beispiel #5
0
 /**
  * Construct a new GET request.
  *
  * @param request request string without the base URI
  */
 public Get(final String request) {
   uri = URI.create(BASE_URL + request);
 }