Package xcat.ports

Examples of xcat.ports.ProvidesPortInfo


  public gov.cca.Port getPort(java.lang.String portName)
    throws gov.cca.CCAException {
    logger.finest("called for portName: " + portName);
   
    // For provides ports
    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(portName);
    if (pInfo != null) {
      synchronized(pInfo) {
  while (pInfo.getInUse()) {
    try {
      logger.finest("wait till the port is released");
      pInfo.wait();
    } catch (InterruptedException ie) {
      logger.severe("Exception while waiting for port to be released", ie);
    }
  }
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides port : " + portName +
              " has been removed");
  pInfo.setInUse(true);
  return pInfo.getProvidesPortReference();
      }
    }

    // For uses ports
    UsesPortInfo uInfo =
View Full Code Here


  public gov.cca.Port getPortNonblocking(java.lang.String portName)
    throws gov.cca.CCAException {
    logger.finest("called for portName: " + portName);

    // For provides ports
    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(portName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides port : " + portName +
              " has been removed");
  if (pInfo.getInUse()) {
    logger.finest("port is in use");
    return null;
  }
  else {
    pInfo.setInUse(true);
    return pInfo.getProvidesPortReference();
  }
      }
    }

    // For uses ports
View Full Code Here

  public void releasePort(java.lang.String portName)
    throws gov.cca.CCAException {
    logger.finest("called for portName: " + portName);

    // For provides ports
    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(portName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides port : " + portName +
              " has been removed");
  if (pInfo.getInUse()) {
    pInfo.setInUse(false);
    logger.finest("wake up sleeper waiting for port to be released");
    pInfo.notify();
    return;
  }
  else
    throw new PortNotInUseException("Port " + portName + " not in use");
      }
View Full Code Here

  // Set the GSH for the provides port
  String providesPortHandle = HandleResolver.createGSH(portName);
  ((XCATPort) inPort).setGSH(providesPortHandle);

  logger.finest("adding port with handle: " + providesPortHandle);
  ProvidesPortInfo pInfo = new ProvidesPortInfo(portName,
                  type,
                  properties,
                  providesPortHandle);
  providesPortMap.put(portName, pInfo);
View Full Code Here

    throws gov.cca.CCAException {
    logger.finest("called for portName: " + name);

    // provides ports
    if (providesPortMap.containsKey(name)) {
      ProvidesPortInfo pInfo = (ProvidesPortInfo) providesPortMap.get(name);
      return pInfo.getProperties();
    }

    // uses ports
    if (usesPortMap.containsKey(name)) {
      UsesPortInfo uInfo = (UsesPortInfo) usesPortMap.get(name);
View Full Code Here

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

    ProvidesPortInfo pInfo = (ProvidesPortInfo) providesPortMap.get(portName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.getInUse())
    // Can't remove if port is still in use
    throw new NonstandardException("ProvidesPort " + portName + " still in use");
  else if (pInfo.getNumConnections() != 0)
    // Can't remove if port is still connected remotely
    throw new NonstandardException("ProvidesPort " + portName + " still connected");
  else {
    pInfo.removePort();
    // NOTE: SHOULD I SHUTDOWN THE XSOAP SERVICE HERE?
    providesPortMap.remove(portName);
  }
      }
    } else
View Full Code Here

   */
  public String getProvidesPortType(String providesPortName)
    throws gov.cca.CCAException {
    logger.finest("called for port: " + providesPortName);

    ProvidesPortInfo pInfo = (ProvidesPortInfo) providesPortMap.get(providesPortName);
    if (pInfo != null) {
      synchronized(pInfo) {
  TypeMap pMap = pInfo.getProperties();
  return pMap.getString("cca.portType", "None");
      }
    } else
      throw new PortNotDefinedException("Port " + providesPortName + " not defined");
  }
View Full Code Here

   */
  public String getPortHandle(String providesPortName)
    throws gov.cca.CCAException {
    logger.finest("called for provides port: " + providesPortName);

    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(providesPortName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides Port : " + providesPortName +
              " has been removed");
  String retVal = pInfo.getProvidesPortHandle();
  return retVal;
      }
    } else
      throw new PortNotDefinedException("Provides Port : " + providesPortName +
          " not defined");
View Full Code Here

   */
  public String incrementUsers(String providesPortName)
    throws gov.cca.CCAException {
    logger.finest("called for provides port: " + providesPortName);

    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(providesPortName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides Port : " + providesPortName +
              " has been removed");
  String retVal = pInfo.getProvidesPortHandle();
  pInfo.incrNumConnections();
  return retVal;
      }
    } else
      throw new PortNotDefinedException("Provides Port : " + providesPortName +
          " not defined");
View Full Code Here

   */
  public void disconnectUser(String providingPortName)
    throws gov.cca.CCAException {
    logger.finest("called with provides port: " + providingPortName);

    ProvidesPortInfo pInfo =
      (ProvidesPortInfo) providesPortMap.get(providingPortName);
    if (pInfo != null) {
      synchronized(pInfo) {
  if (pInfo.isRemoved())
    throw new PortNotDefinedException("Provides Port : " + providingPortName +
              " has been removed");
  pInfo.decrNumConnections();
      }
    } else
      throw new PortNotDefinedException("Provides Port : " + providingPortName +
          " not defined");
  }
View Full Code Here

TOP

Related Classes of xcat.ports.ProvidesPortInfo

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.