Package xcat.ports

Examples of xcat.ports.UsesPortInfo


    logger.finest("called with uses port: " + usingPortName);
   
    if (!usesPortMap.containsKey(usingPortName))
      throw new NonstandardException("Uses Port: " + usingPortName +
             " not defined");
    UsesPortInfo uInfo =
      (UsesPortInfo) usesPortMap.get(usingPortName);
    if (uInfo.getConnectionID() == null)
      return null;
    else
      return uInfo.getConnectionID().getConnectionInfo();
  }
View Full Code Here


    logger.finest("called for portName: " + usingPortName);

    // call this in a separate thread as it needs to block
    new Thread() {
  public void run () {
    UsesPortInfo uInfo = (UsesPortInfo) usesPortMap.get(usingPortName);
    if (uInfo != null) {
      synchronized(uInfo) {
        if (uInfo.isUnregistered()) {
    logger.severe("Uses port: " + usingPortName +
            " has been unregistered");

    // callback the AppCoordinator with an exception
    try {
      AppCoordinatorCallback coord = (AppCoordinatorCallback)
        HandleResolver.resolveHandle(coordinatorHandle,
             AppCoordinatorCallback.class.getName());
      coord.migrationApproval(providesComponentName,
            getComponentID().getInstanceName(),
            usingPortName,
            AppCoordinatorCallback.EXCEPTION);
    } catch (gov.cca.CCAException ce) {
      logger.severe("Can't invoke notification on remote AppCoordinator",
        ce);
    }

    return;
        }

        // wait till the port is released
        while (uInfo.getInUse()) {
    try {
      logger.finest("wait till the port is released");
      uInfo.wait();
    } catch (InterruptedException ie) {
      logger.severe("Caught InterruptedException while waiting", ie);
    }
        }

        // notify that this port requests migration
        uInfo.requestMigration()
       
        // Callback the App Coordinator notifying that the uses
        // side is ready for migration
        try {
    AppCoordinatorCallback coord = (AppCoordinatorCallback)
View Full Code Here

   */
  public void confirmMigration(String usingPortName)
    throws gov.cca.CCAException {
    logger.finest("called for portName: " + usingPortName);

    UsesPortInfo uInfo = (UsesPortInfo) usesPortMap.get(usingPortName);
    if (uInfo != null) {
      synchronized(uInfo) {
  if (uInfo.isUnregistered())
    throw new PortNotDefinedException("Uses port: " + usingPortName +
              " has been unregistered");

  // confirm that this port is migrating
  uInfo.confirmMigration();
      }
    } else {
      logger.severe("Port " + usingPortName + " not defined");
      throw new PortNotDefinedException("Port " + usingPortName + " not defined");
    }
View Full Code Here

   */
  public void migrationComplete(String usingPortName)
    throws gov.cca.CCAException {
    logger.finest("called for portName: " + usingPortName);

    UsesPortInfo uInfo = (UsesPortInfo) usesPortMap.get(usingPortName);
    if (uInfo != null) {
      synchronized(uInfo) {
  if (uInfo.isUnregistered())
    throw new PortNotDefinedException("Uses port: " + usingPortName +
              " has been unregistered");

  // confirm that this port has finished migrating
  uInfo.migrationComplete();

  // notify sleepers waiting for this port to finish migrating
  uInfo.notify();
      }
    } else {
      logger.severe("Port " + usingPortName + " not defined");
      throw new PortNotDefinedException("Port " + usingPortName + " not defined");
    }
View Full Code Here

      sInfoBuffer.append("<portName>" +
       (String) userKeys[i] +
       "</portName>");
     
      // copy over information from UsesPortInfo to UsesPortRecord
      UsesPortInfo uInfo = (UsesPortInfo) usesPortMap.get(userKeys[i]);
      sInfoBuffer.append("<usesPortRecord>");
      sInfoBuffer.append("<portName>" +
       uInfo.getPortName() +
       "</portName>");
      sInfoBuffer.append("<portType>" +
       uInfo.getPortType() +
       "</portType>");
      sInfoBuffer.append("<inUse>" +
       false +
       "</inUse>"); // inUse is always false before & after migration
      sInfoBuffer.append("<unregistered>" +
       uInfo.isUnregistered() +
       "</unregistered>");
      sInfoBuffer.append("<migrationStatus>" +
       uInfo.getMigrationStatus() +
       "</migrationStatus>");
     
      // copy over the TypeMap object
      sInfoBuffer.append("<properties>");
      TypeMap tMap = uInfo.getProperties();
      String[] mapKeys = tMap.getAllKeys();
      for (int j = 0; j < mapKeys.length; j++) {
  sInfoBuffer.append("<propertiesEntry>");
  sInfoBuffer.append("<key>" +
         mapKeys[j] +
         "</key>");
  sInfoBuffer.append("<type>" +
         TypeUtil.toString(tMap.typeOf(mapKeys[j])) +
         "</type>");
  sInfoBuffer.append("<value>" +
         tMap.getAsString(mapKeys[j]) +
         "</value>");
  sInfoBuffer.append("</propertiesEntry>");
      }
      sInfoBuffer.append("</properties>");
     
      // copy over information from the ConnectionID
      XCATConnectionID connID = uInfo.getConnectionID();
      if (connID != null) {
  sInfoBuffer.append("<connectionID>");
  sInfoBuffer.append("<providerIntfName>" +
         connID.getProviderIntfName() +
         "</providerIntfName>");
View Full Code Here

        migrationStatus = Integer.parseInt((String) nextItem.readNextChild());
      }
    }

    // create a UsesPortInfo entry
    UsesPortInfo uInfo = new UsesPortInfo(portName,
                  portType,
                  tMap);
    uInfo.setInUse(inUse);
    if (unregistered)
      uInfo.unregisterPort();
    uInfo.setMigrationStatus(migrationStatus);
    if (connID != null)
      uInfo.setConnectionID(connID);

    // add this uses port to the HashMap
    usesPortMap.put(portName, uInfo);
        }
      }
View Full Code Here

  return pInfo.getProvidesPortReference();
      }
    }

    // For uses ports
    UsesPortInfo uInfo =
      (UsesPortInfo) usesPortMap.get(portName);
    if (uInfo != null) {
      synchronized(uInfo) {
  while (uInfo.getInUse() || uInfo.getInMigration()) {
    try {
      logger.finest("wait till the port is available");
      uInfo.wait();
    } catch (InterruptedException ie) {
      logger.severe("Exception while waiting for port to be released", ie);
    }
  }
  if (uInfo.isUnregistered())
    throw new PortNotDefinedException("Uses port: " + portName +
              " has been unregistered");
  if (uInfo.getConnectionID() == null)
    throw new PortNotConnectedException("Port " + portName
                + " not connected");
  uInfo.setInUse(true);
  return uInfo.getProvidesPortReference();
      }
    }

    logger.severe("Port " + portName + " not defined");
    throw new PortNotDefinedException("Port " + portName + " not defined");
View Full Code Here

  }
      }
    }

    // For uses ports
    UsesPortInfo uInfo =
      (UsesPortInfo) usesPortMap.get(portName);
    if (uInfo != null) {
      synchronized(uInfo) {
  if (uInfo.isUnregistered())
    throw new PortNotDefinedException("Uses port: " + portName +
              " has been unregistered");
  if (uInfo.getInUse() || uInfo.getInMigration()) {
    logger.finest("port not available");
    return null;
  }
  else if (uInfo.getConnectionID() == null)
    throw new PortNotConnectedException("Port " + portName + " not connected");
  else {
    uInfo.setInUse(true);
    // return the reference to the provides port
    return uInfo.getProvidesPortReference();
  }
      }
    }

    logger.severe("Port " + portName + " not defined");
View Full Code Here

    throw new PortNotInUseException("Port " + portName + " not in use");
      }
    }

    // For uses ports
    UsesPortInfo uInfo =
      (UsesPortInfo) usesPortMap.get(portName);
    if (uInfo != null) {
      synchronized(uInfo) {
  if (uInfo.isUnregistered())
    throw new PortNotDefinedException("Uses port: " + portName +
              " has been unregistered");
  if (uInfo.getInUse()) {
    uInfo.setInUse(false);
    logger.finest("wake up sleeper waiting for port to be released");
    uInfo.notify();
    return;
  }
  else
    throw new PortNotInUseException("Port " + portName + " not in use");
      }
View Full Code Here

  // add a couple of standard properties
  properties.putString("cca.portName", portName);
  properties.putString("cca.portType", type);

  // create a new UsesPortInfo object and add it to usesPortMap
  UsesPortInfo uInfo = new UsesPortInfo(portName, type, properties);
  usesPortMap.put(portName, uInfo);
      }
    }
  }
View Full Code Here

TOP

Related Classes of xcat.ports.UsesPortInfo

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.