Examples of VinciFrame


Examples of org.apache.vinci.transport.VinciFrame

    return getFrame(ok, "Delete Service request failed");
  }

  VinciFrame delAlias(VinciFrame in) {
    logRequest(dirCmdDelAlias, in.fgetString("vinci:REMOTEIP"), null);
    VinciFrame service = in.fgetVinciFrame("SERVICE");
    boolean ok = true;
    if (service.fgetString("NAME") == null || service.fgetString("TARGET") == null) {
      getFrame(false, "Malformed request");
    } else {
      synchronized (SR) {
        ok = SR.delAlias(service.fgetString("NAME"));
      }
    }
    return getFrame(ok, "Delete alias request failed");
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

  }

  VinciFrame updateService(VinciFrame in) {
    logRequest(dirCmdUpdateService, in.fgetString("vinci:REMOTEIP"), null);

    VinciFrame service = in.fgetVinciFrame("SERVICE");

    Hashtable H = new Hashtable();

    int total = service.getKeyValuePairCount();
    KeyValuePair P;
    for (int i = 0; i < total; i++) {
      P = service.getKeyValuePair(i);
      if (P.isValueALeaf()) {
        H.put(P.getKey(), P.getValueAsString());
      } else {
        H.put(P.getKey(), P.getValue());
      }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

      if (servicelist == null)
        servicelist = new Object[0]; // For safety
      Debug.p("Matches for getList : " + servicelist.length);
    }

    VinciFrame F = new VinciFrame();
    for (int i = 0; i < servicelist.length; i++) {
      if (ServiceAlias.isAlias(servicelist))
        F.fadd("SERVICE", ((ServiceAlias) servicelist[i]).toFrame());
      else
        F.fadd("SERVICE", ((Service) servicelist[i]).toFrame());
    }

    return F;
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

      if (servicelist == null)
        servicelist = new String[0]; // For safety
      Debug.p("Matches for getNames : " + servicelist.length);
    }

    VinciFrame F = new VinciFrame();
    for (int i = 0; i < servicelist.length; i++) {
      F.fadd("SERVICE", servicelist[i]);
    }

    return F;
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

  }

  VinciFrame getHits(VinciFrame in) {
    String type = in.fgetString("TYPE");

    VinciFrame F = new VinciFrame();
    VinciFrame temp;
    String key;

    if (type != null) {
      if (type.equals("all")) {
        Enumeration keys = hits.keys();
        while (keys.hasMoreElements()) {
          key = (String) keys.nextElement();
          temp = new VinciFrame();
          temp.fadd("TYPE", key);
          temp.fadd("COUNT", hits.get(key).toString());
          F.fadd("HITS", temp);
        }
        F.fadd("TOTAL", "" + totalhits);
      } else {
        if (hits.get(type) != null)
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

    }
  }

  /* Helper method to return the correct VinciFrame */
  VinciFrame getFrame(boolean ok, String err) {
    VinciFrame F = null;
    if (ok) {
      F = new VinciFrame();
      F.fadd("STATUS", "OK");
    } else
      return new ErrorFrame(err);

    return F;
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

    this.name = name;
    this.target = target;
  }

  public Frame toFrame() {
    Frame F = new VinciFrame(); // hack around the fact that Frame is an abstract class

    F.fadd("NAME", name);
    F.fadd("TARGET", target);

    return F;
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

   * @see org.apache.uima.resource.service.ResourceServiceStub#callGetMetaData()
   */
  public ResourceMetaData callGetMetaData() throws ResourceServiceException {
    try {
      // create Vinci Frame
      VinciFrame queryFrame = new VinciFrame();
      // Add Vinci Command, so that the receiving service knows what to do
      queryFrame.fadd("vinci:COMMAND", "GetMeta");
      // Send the request to the service and wait for response

      if (debug) {
        System.out.println("Calling GetMeta");
      }

      VinciFrame resultFrame = mVinciClient.rpc(queryFrame, mGetMetaDataTimeout);

      if (debug) {
        System.out.println("Success");
      }

      // Extract the data from Vinci Response frame
      // System.out.println(resultFrame.toXML()); //DEBUG

      // Remove things from the result frame that are not the MetaData objects we expect.
      // In the future other things may go in here.
      int i = 0;
      while (i < resultFrame.getKeyValuePairCount()) {
        String key = resultFrame.getKeyValuePair(i).getKey();
        if (key.length() < 8 || !key.substring(key.length() - 8).equalsIgnoreCase("metadata")) {
          resultFrame.fdrop(key);
        } else {
          i++;
        }
      }

View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

      AFrame queryFrame = new AFrame();
      // Add Vinci Command, so that the receiving service knows what to do
      queryFrame.fadd("vinci:COMMAND", Constants.IS_READONLY);

      // make RPC call
      VinciFrame resultFrame = mVinciClient.rpc(queryFrame);
      boolean result = resultFrame.fgetBoolean("Result");
      return result;
    } catch (Exception e) {
      throw new ResourceServiceException(e);
    }
  }
View Full Code Here

Examples of org.apache.vinci.transport.VinciFrame

      AFrame queryFrame = new AFrame();
      // Add Vinci Command, so that the receiving service knows what to do
      queryFrame.fadd("vinci:COMMAND", Constants.IS_STATELESS);

      // make RPC call
      VinciFrame resultFrame = mVinciClient.rpc(queryFrame);
      boolean result = resultFrame.fgetBoolean("Result");
      return result;
    } catch (Exception e) {
      throw new ResourceServiceException(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.