Package xcat.exceptions

Examples of xcat.exceptions.NonstandardException


   *
   *  This method is not implemented, and throws a NonstandardException
   */
  public gov.cca.TypeMap getConnectionProperties(gov.cca.ConnectionID connID)
    throws gov.cca.CCAException {
    throw new NonstandardException("This method currently not supported");
  }
View Full Code Here


   */
  public String getGSH()
    throws gov.cca.CCAException {
    logger.finest("called");
    if (componentHandle == null)
      throw new NonstandardException("GSH for this port is not set");
    return componentHandle;
  }
View Full Code Here

   * This method is not implemented, and a NonstandardException is thrown
   */
  public void setConnectionProperties(gov.cca.ConnectionID connID,
              gov.cca.TypeMap map)
    throws gov.cca.CCAException {
    throw new NonstandardException("Can't set properties after connection is made");
  }
View Full Code Here

   */
  public void setGSH(String handle)
    throws gov.cca.CCAException {
    logger.finest("called with handle: " + handle);
    if (componentHandle != null)
      throw new NonstandardException("GSH for this port is already set");
    componentHandle = handle;
  }
View Full Code Here

      connID.getUser().getInstanceName() +
      " and provides port of " +
      connID.getProvider().getInstanceName());

    if (!(connID instanceof XCATConnectionID))
      throw new NonstandardException("ConnectionID not an instance of XCATConnectionID");
   
    if (!(connID.getProvider() instanceof XCATComponentID) ||
  !(connID.getUser() instanceof XCATComponentID))
      throw new NonstandardException("ComponentIDs not instances of XCATComponentID");

    XCATComponentID provider = (XCATComponentID) connID.getProvider();
    XCATComponentID user = (XCATComponentID) connID.getUser();

    // remove the connection of the user's side
View Full Code Here

   */
  public void disconnectAll(gov.cca.ComponentID id1,
          gov.cca.ComponentID id2,
          float timeout)
    throws gov.cca.CCAException {
    throw new NonstandardException("This method currently not supported");
  }
View Full Code Here

          componentHandle,
          className);     
      // Create an instance of the client side of XCATComponentID
      cid = new MobileComponentIDClientImpl(instanceName, componentHandle);
    } else
      throw new NonstandardException("Unknown componentType: " + componentType);

    // transfer the properties object to the component
    cid.setProperties(TypeUtil.toXML(properties));

    // update the namedComponentIDs hashMap
View Full Code Here

      " properties = " + properties);
   
    // get all the required properties
    String execHost = properties.getString("execHost", "None");
    if (execHost.equals("None"))
      throw new NonstandardException("Property execHost is not set");
    String execDir = properties.getString("execDir", "None");
    if (execDir.equals("None"))
      throw new NonstandardException("Property execDir is not set");
    String execName = properties.getString("execName", "None");
    if (execName.equals("None"))
      throw new NonstandardException("Property execName is not set");
    String componentType = properties.getString("componentType", "basic");
    if (!(componentType.equals("basic") || componentType.equals("mobile")))
      throw new NonstandardException("Unknown componentType: " + componentType);

    logger.finest(" execHost = " + execHost +
      " execDir = " + execDir +
      " execName = " + execName +
      " componentType = " + componentType);

    try {
      // Create a GSH for this component, if it has not been provided already
      String componentHandle =
  properties.getString("componentHandle",
           HandleResolver.createGSH(instanceName));
     
      // retrieve the URL of the Handle Resolver
      String handleResolverURL = HandleResolver.getHandleResolverURL();

      // get the stdOut and stdErr variables
      String stdOut = properties.getString("stdOut", "None");
      String stdErr = properties.getString("stdErr", "None");
      if (stdOut.equals("None"))
  stdOut = instanceName + ".out";
      if (stdErr.equals("None"))
  stdErr = instanceName + ".err";
     
      // check if the component has been migrated
      boolean isMigrated = properties.getBool("isMigrated", false);
 
      // construct the RSL
      String theRSL =
  "&(executable=" + execName + ")" +
  "(arguments=" + componentType + " " + instanceName +
  " " + className + " " + handleResolverURL + " " +
  builderGSH + " " + componentHandle + " " +
  isMigrated + ")" +
  "(directory=" + execDir + ")" +
  "(stdout=" + stdOut + ")" +
  "(stderr=" + stdErr + ")";
     
      // create a Gram Job
      GramJob theJob = new GramJob(theRSL);

      // if a proxy is passed via the typeMap, use it
      String proxyPath = properties.getString("X509_USER_PROXY", "None");
      if(!proxyPath.equals("None")) {
  File f = new File(proxyPath);
  byte [] data = new byte[(int) f.length()];
  FileInputStream in = new FileInputStream(f);
  // read in the credential data
  in.read(data);
  in.close();
 
  ExtendedGSSManager manager =
    (ExtendedGSSManager) ExtendedGSSManager.getInstance();
  GSSCredential proxy =
    manager.createCredential(data,
           ExtendedGSSCredential.IMPEXP_OPAQUE,
           GSSCredential.DEFAULT_LIFETIME,
           null, // use default mechanism - GSI
           GSSCredential.INITIATE_AND_ACCEPT);
  theJob.setCredentials(proxy);
      }

      // request execution of the job
      boolean NOT_BATCH = false;
      boolean NOT_LIMITED = false;
      Gram.request(execHost, theJob, NOT_BATCH, NOT_LIMITED);
    } catch (Exception e) {
      logger.severe("Can not launch remote component", e);
      throw new NonstandardException("Can not launch remote component", e);
    }

    // initialize XCATComponentIDClient with a null GSH
    XCATComponentID cid = null;
    if (componentType.equals("basic"))
      cid = new XCATComponentIDClientImpl(instanceName, null);
    else if (componentType.equals("mobile"))
      cid = new MobileComponentIDClientImpl(instanceName, null);
    else // shouldn't get here, since we have thrown this exception before
      throw new NonstandardException("Unknown componentType: " + componentType);

    // insert into the namedComponentIDs hashMap
    namedComponentIDs.put(instanceName, cid);

    synchronized(cid) {
      if (cid.getSerialization() == null)
  try {
    logger.finest("waiting to receive ComponentID");

    // wait to receive the ComponentID from remote component
    long timeout = properties.getLong("timeout", DEFAULT_TIMEOUT);
    logger.finest("received timeout: " + timeout);
    cid.wait(timeout);
 
    logger.finest("woken up after waiting to receive ComponentID");
  } catch (InterruptedException ie) {
    logger.severe(ie.toString(), ie);
  }
    }

    // check if the ComponentiD has been received
    if (cid.getSerialization() == null)
      throw new NonstandardException("Timed out while receiving ComponentID");

    // transfer the properties object to the component
    cid.setProperties(TypeUtil.toXML(properties));

    // return the ComponentID from the namedComponentIDs hashMap
View Full Code Here

   */
  public void loadFromDatabase()
    throws gov.cca.CCAException {
    // make sure the database URL is not null
    if (dburl == null)
      throw new NonstandardException("Database URL is Null");

    // connection information is already in database
    cInfoStored = true;

    try {
      Connection conn = null;
      // connect to the database
      conn = DriverManager.getConnection(dburl,
           dbuser,
           dbpasswd);
     
     
      // get the list of components for this application
      String sqlStmt0 =
  "select * from coordinator_table where " +
  "application_id = '" + applicationID + "';";
      PreparedStatement stmt0 = conn.prepareStatement(sqlStmt0);
      ResultSet rs0 = stmt0.executeQuery();

      // convert the result set into ComponentInfo[]'s
      rs0.last();
      ComponentInfo[] cInfo = new ComponentInfo[rs0.getRow()];
      rs0.beforeFirst();
      int i = 0;
      while (rs0.next()) {
  cInfo[i++] = new ComponentInfoImpl(rs0.getString("instance_name"),
             rs0.getString("instance_handle"),
             rs0.getString("instance_location"),
             rs0.getString("creation_proto"),
             rs0.getString("component_xml"));
      }

      // create a connection graph from retrieved information
      createConnectionGraph(cInfo);

      // load information about old checkpoints
      String sqlStmt1 =
  "select * from distributed_checkpoint_table where " +
  "application_id = '" + applicationID + "';";
      PreparedStatement stmt1 = conn.prepareStatement(sqlStmt1);
      ResultSet rs1 = stmt1.executeQuery();

      // convert the result set into ComponentInfo[]'s
      rs1.beforeFirst();
      while (rs1.next()) {
  CheckpointInfo cpInfo =
    new CheckpointInfo(rs1.getString("individual_storage_service_url"),
           rs1.getString("storage_id"));
  String instanceName =
    (String) instanceMap.get(rs1.getString("instance_handle"));
  checkpointMap.put(instanceName, cpInfo);
      }

      // clean up
      conn.close();
    } catch (Exception e) {
      logger.severe("Error while loading AppCoordinator state from database", e);
      throw new NonstandardException("Error while loading AppCoordinator state from database",
             e);
    }
  }
View Full Code Here

      " properties = " + properties);
   
    // get all the required properties
    String execHost = properties.getString("execHost", "None");
    if (execHost.equals("None"))
      throw new NonstandardException("Property execHost is not set");
    String execDir = properties.getString("execDir", "None");
    if (execDir.equals("None"))
      throw new NonstandardException("Property execDir is not set");
    String execName = properties.getString("execName", "None");
    if (execName.equals("None"))
      throw new NonstandardException("Property execName is not set");
    String sshHome = properties.getString("sshHome", "None");
    if (sshHome.equals("None"))
      throw new NonstandardException("Property sshHome is not set");
    String componentType = properties.getString("componentType", "basic");
    if (!(componentType.equals("basic") || componentType.equals("mobile")))
      throw new NonstandardException("Unknown componentType: " + componentType);

    logger.finest(" execHost = " + execHost +
      " execDir = " + execDir +
      " execName = " + execName +
      " componentType = " + componentType +
      " sshHome = " + sshHome);
    try {
      // Create a GSH for this component, if it has not been provided already
      String componentHandle =
  properties.getString("componentHandle",
           HandleResolver.createGSH(instanceName));

      // retrieve the URL of the Handle Resolver
      String handleResolverURL = HandleResolver.getHandleResolverURL();

      // get the names for the stdOut and stdErr
      String stdOut = properties.getString("stdOut", "None");
      String stdErr = properties.getString("stdErr", "None");
      if (stdOut.equals("None"))
  stdOut = instanceName + ".out";
      if (stdErr.equals("None"))
  stdErr = instanceName + ".err";

      // check if the component has been migrated
      boolean isMigrated = properties.getBool("isMigrated", false);
 
      // construct the executable
      String command =
  "/bin/sh -c \"cd " + execDir + "; " + "./" + execName + " " +
  componentType + " " + instanceName + " " + className + " " +
  handleResolverURL + " " + builderGSH + " " + componentHandle +
  " " + isMigrated + " >> " + stdOut + " 2>> " + stdErr + "\"";
     
      // Launch this executable in a separate process
      String[] fullCommand = new String[] {sshHome, execHost, command};
      Runtime.getRuntime().exec(fullCommand);
    } catch (Exception e) {
      logger.severe("Can not launch remote component", e);
      throw new NonstandardException("Can not launch remote component", e);
    }

    // initialize XCATComponentIDClient with a null GSH
    XCATComponentID cid = null;
    if (componentType.equals("basic"))
      cid = new XCATComponentIDClientImpl(instanceName, null);
    else if (componentType.equals("mobile"))
      cid = new MobileComponentIDClientImpl(instanceName, null);
    else // shouldn't get here, since we have thrown this exception before
      throw new NonstandardException("Unknown componentType: " + componentType);
   
    // insert into the namedComponentIDs hashMap
    namedComponentIDs.put(instanceName, cid);

    synchronized(cid) {
      if (cid.getSerialization() == null)
  try {
    logger.finest("waiting to receive ComponentID");

    // wait to receive the ComponentID from remote component
    long timeout = properties.getLong("timeout", DEFAULT_TIMEOUT);
    logger.finest("received timeout: " + timeout);
    cid.wait(timeout);
 
    logger.finest("woken up after waiting to receive ComponentID");
  } catch (InterruptedException ie) {
    logger.severe(ie.toString(), ie);
  }
    }

    // check if the ComponentiD has been received
    if (cid.getSerialization() == null)
      throw new NonstandardException("Timed out while receiving ComponentID");

    // transfer the properties object to the component
    cid.setProperties(TypeUtil.toXML(properties));

    // return the ComponentID from the namedComponentIDs hashMap
View Full Code Here

TOP

Related Classes of xcat.exceptions.NonstandardException

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.