Package xmlcomponents

Examples of xmlcomponents.Jode


  }
 
  public void run()
  {
    System.out.println("AutoLauncher:loading XML configuration file");
    Jode root = null;
    File file = new File(configFile_);
    if (file.isAbsolute()) {
      System.out.println("Absolute file path specified, loading config: " + file.getPath());
      root = Jocument.load(configFile_);
    } else {
      configFile_ = sketchPath_ + "/data/" + configFile_;
      System.out.println("Relative file path specified, loading config: " + configFile_);
      root = Jocument.load(configFile_);
    }
   
    System.out.println("AutoLauncher:loading XML configuration node");
    Jode config = root.single("configuration");
    System.out.println("AutoLauncher:loading XML processingPath node");
    String processingPath = config.first("config").attribute("processingPath").v;
    System.out.println("processingPath = "+processingPath);
    // launch each child process
    for(Jode child : config.children())
    {
      if (child.n.equals("process"))
      {
        if(!child.hasAttribute("rank"))
        {
View Full Code Here


    offsets_   = new int[2];
    windowLocation_ = new int[2];
   
    // set up the pipeline for reading XML
   
    Jode root = null;
    File file = new File(_file);
    if (file.isAbsolute()) {
      if(debug_)
        System.out.println("Configuration: loading config: " + file.getPath());
      root = Jocument.load(_file);
    } else {
      if(debug_)
        System.out.println("Configuration: loading config: " + _p.dataPath(_file));
      root = Jocument.load(_p.dataPath(_file));
    }
               
    // my DISPLAY identifier
    display_ = System.getenv("DISPLAY");
   
    if(System.getenv("RANK") != null)
      rank_ = Integer.valueOf(System.getenv("RANK"));
    else rank_ = -1; // head node in auto-start
   
    System.out.println("loading XML configuration node");
    Jode config = root.single("configuration");
    System.out.println("loading XML dimensions node");
    Jode dimensions = config.single("dimensions");
    System.out.println("loading XML dimensions node, screenWidth");
    tileRes_[0]   = Integer.parseInt(dimensions.attribute("screenWidth").v);
    tileRes_[1]   = Integer.parseInt(dimensions.attribute("screenHeight").v);
    numTiles_[0= Integer.parseInt(dimensions.attribute("numTilesWidth").v);
    numTiles_[1= Integer.parseInt(dimensions.attribute("numTilesHeight").v);
    bezels_[0]    = Integer.parseInt(dimensions.attribute("mullionWidth").v);
    System.out.println("loading XML dimensions node, mullionHeight");
    bezels_[1]    = Integer.parseInt(dimensions.attribute("mullionHeight").v);
    System.out.println("loading XML dimensions node, debug");
    debug_ = Integer.parseInt(dimensions.attribute("debug").v) == 1;
   
    numFollowers_ = config.children().getLength() - 3;
    System.out.println("numFollowers_ = " + numFollowers_);
    System.out.println("loading XML dimensions node, head");
    Jode head = config.first("head");
   
    if(head != null)
    {
      server_ = head.attribute("host").v;
      port_ = Integer.parseInt(head.attribute("port").v);
      if(debug_)
        System.out.println("Server: "+ server_ + ":" + Integer.toString(port_));
    }
    else
    {
      System.out.println("Couldn't get head! Setting default as localhost");
      server_ = "localhost";
    }
   
    // we are the head node
    if(rank_ == -1)
    {
      Jode headChild = head.first();
      localDim_[0] = Integer.parseInt(headChild.attribute("width").v);
      localDim_[1] = Integer.parseInt(headChild.attribute("height").v);
     
      masterDim_[0] = localDim_[0];
      masterDim_[1] = localDim_[1];
     
      // offsets
      offsets_[0] = 0;
      offsets_[1] = 0;
      isLeader_ = true;
      return;
    }
   
    Jode child = null;
   
    // find the entry for the correct host
    for(Jode configChild: config.children())
    {
      if(configChild.hasAttribute("rank"))
      {
        if(Integer.parseInt(configChild.attribute("rank").v) == rank_)
        {
          child = configChild;
          break; // we found our xml entry!
        }
      }
    }
   
    if(child == null)
    {
      System.out.println("ERROR: Couldn't find my entry in the configuration. Exiting.");
      System.exit(-1);
    }
   
    // child corresponds to entry with the correct hostName here
    Jode childi;
    childi = child.first();
    int mini = Integer.parseInt(childi.attribute("i").v);
    int maxi = Integer.parseInt(childi.attribute("i").v);
    int minj = Integer.parseInt(childi.attribute("j").v);
    int maxj = Integer.parseInt(childi.attribute("j").v);
   
   
    // note: this won't work generically -- only when addressing multiple screens in one display (ala xinerama) -- add tag for this?
    windowLocation_[0] = (mini)*tileRes_[0];
    windowLocation_[1] = 0;
   
    try
    {
      windowLocation_[0] = Integer.parseInt(childi.attribute("x").v);
      System.out.println("!!!! x: "+childi.attribute("x").v);
    }
    catch (Exception e)
    {
      if (debug_) System.out.println("no x attribute found for rank "+rank_);
    }
   
    try
    {
      windowLocation_[1] = Integer.parseInt(childi.attribute("y").v);
    }
    catch (Exception e)
    {
      if (debug_) System.out.println("no y attribute found for rank "+rank_);
    }
   
    for(int i = 0; i < child.children().getLength(); i++)
    {
      childi = child.children().get(i);
      if(Integer.parseInt(childi.attribute("i").v) < mini)
        mini = Integer.parseInt(childi.attribute("i").v);
      if(Integer.parseInt(childi.attribute("i").v) > maxi)
        maxi = Integer.parseInt(childi.attribute("i").v);
      if(Integer.parseInt(childi.attribute("j").v) < minj)
        minj = Integer.parseInt(childi.attribute("j").v);
      if(Integer.parseInt(childi.attribute("j").v) > maxj)
        maxj = Integer.parseInt(childi.attribute("j").v);
    }
   
    //windowLocation_[0] = 0;
    //windowLocation_[1] = 0;
   
View Full Code Here

TOP

Related Classes of xmlcomponents.Jode

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.