Package com.maverick.util

Examples of com.maverick.util.ByteArrayReader


    try {
      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceId);
      Request request = new Request(SETUP_AND_LAUNCH_WEB_FORWARD, baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        String uri = bar.readString();
        agent.getGUI().openBrowser(uri);
        // #ifdef DEBUG
        log.debug("Application launch setup");
        // #endif
//        processLaunchRequest(request);
View Full Code Here


    try {
      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceId);
      Request request = new Request(SETUP_AND_LAUNCH_NETWORK_PLACE, baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        String uri = bar.readString();
        agent.getGUI().openBrowser(uri);
        // #ifdef DEBUG
        log.debug("Network place setup");
        // #endif
//        processLaunchRequest(request);
View Full Code Here

    msg.writeString(launchId);
    return msg.toByteArray();
  }

  public byte[] open(byte[] data) throws IOException {
    ByteArrayReader msg = new ByteArrayReader(data);
    this.hostname = msg.readString();
    this.port = (int) msg.readInt();
    this.launchId = msg.readString();
        this.socket = MultiplexedSocketFactory.getDefault().createSocket(hostname, port);
    return null;
  }
View Full Code Here

      }
    }
  }

  public byte[] open(byte[] data) throws IOException, ChannelOpenException {
    ByteArrayReader reply = new ByteArrayReader(data);

    String launchId = reply.readString();
    int id = (int) reply.readInt();
    String name = reply.readString();
    int type = (int) reply.readInt();
    String transport = reply.readString();
    String sourceInterface = reply.readString();
    int sourcePort = (int) reply.readInt();
    int destinationPort = (int) reply.readInt();
    String destinationHost = reply.readString();
   

    if(agent.getConfiguration().isRemoteTunnelsRequireConfirmation()) {
      if(!agent.getGUI().confirm(AgentClientGUI.WARNING, Messages.getString("RemoteForwardingChannelListener.confirmRemoteTunnel")//$NON-NLS-1$$
        Messages.getString("RemoteForwardingChannelListener.cancelRemoteTunnel"),    //$NON-NLS-1$$
View Full Code Here

      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceType);
      Request request = new Request("getResources", baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true)) {
        if(request.getRequestData()!=null) {
          ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
          int count = (int) reader.readInt();
          if (count > 0) {
                      if(agent.getGUI().isMenuExists(menu))
                          agent.getGUI().clearMenu(menu);
                      else
                          agent.getGUI().addMenu(menu);
            for (int i = 0; i < count; i++) {
              int resourceId = (int) reader.readInt();
              agent.getGUI().addMenuItem(menu, new ResourceLaunchAction(resourceId, reader.readString()));
            }
          }
          else {
                        if(agent.getGUI().isMenuExists(menu))
                            agent.getGUI().removeMenu(menu);             
View Full Code Here

//      if (portItem.getActiveTunnelCount() == 0) {
//        portMonitor.removeItemAt(idx);
//      } else {
     
      try {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        int resourceId = (int)bar.readInt();
        String resourceName = bar.readString();
        String launchId = bar.readString();
        String listeningInterface = bar.readString();
        int listeningPort = (int) bar.readInt();
        String destinationHost = bar.readString();
        int destinationPort = (int) bar.readInt();
       
        /**
         * This code should be called after this method but from the agent
         * class.
         */
 
View Full Code Here

  void stopLocalTunnel(Request request) {

    if (request.getRequestData() == null)
      return;
    try {
      ByteArrayReader msg = new ByteArrayReader(request.getRequestData());
      stopLocalTunnel(new Integer((int) msg.readInt()), false);
      request.setRequestData(null);

    } catch (IOException ex) {
      // #ifdef DEBUG
      log.error("Failed to read tunnel id from request", ex);
View Full Code Here

      /**
       * Start a local forwarding. This creates a listening socket on the
       * client and will forward sockets opened through the multiplexed
       * connection to the Adito server.
       */
      ByteArrayReader reply = new ByteArrayReader(configurationData);
      String launchId = reply.readString();

      int id = (int) reply.readInt();
      String name = reply.readString();
      int type = (int) reply.readInt();
      String transport = reply.readString();
      String sourceInterface = reply.readString();
      int sourcePort = (int) reply.readInt();
      int destinationPort = (int) reply.readInt();
      String destinationHost = reply.readString();

      // #ifdef DEBUG
      log.info("Received permanent tunnel named " + name + " for " + destinationHost + ":" + destinationPort);
      // #endif

View Full Code Here

  public boolean processRequest(Request request, MultiplexedConnection connection) {
    AgentTunnel agent = (AgentTunnel) connection;
    if (request.getRequestName().equals(SETUP_AND_LAUNCH_WEB_FORWARD) && request.getRequestData()!=null) {
      try {
        ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
        int id = (int)reader.readInt();
        WebForward resource = (WebForward)WebForwardPlugin.WEBFORWARD_RESOURCE_TYPE.getResourceById(id);
        if (resource == null) {
          throw new Exception("No resource with ID " + id);
        }
        Policy policy = LaunchSessionManager.getLaunchRequestPolicy(null, agent.getSession(), resource);
View Full Code Here

  boolean processLaunchRequest(Request request) throws IOException {

    if(request.getRequestData()==null)
      return true;
   
    ByteArrayReader msg = new ByteArrayReader(request.getRequestData());
   
    // If this was a server side the no further processing is required
    boolean serverSide = msg.readBoolean();
    if(serverSide) {
      // #ifdef DEBUG
      log.info("Server side launch. No further processing required.");
      // #endif
      return false;
    }

    // Get the application name
    String name = msg.readString();
    msg.readInt(); // shortcut id
    String launchId = msg.readString();
    String descriptor = msg.readString();
    Hashtable parameters = new Hashtable();
    parameters.put("launchId", launchId);
    parameters.put("ticket", launchId);

    Application app = launchApplication(name, descriptor, parameters);
View Full Code Here

TOP

Related Classes of com.maverick.util.ByteArrayReader

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.