Package org.openxri.exceptions

Examples of org.openxri.exceptions.StageException


    this.attributeValues = attributeValues.toArray(new String[attributeValues.size()]);
  }

  public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {

    if (! (store instanceof StoreAttributable)) throw new StageException("Cannot use this store implementation.");
    StoreAttributable storeAttributable = (StoreAttributable) store;

    Element xrdElement = xrd.getDOM();
    Document document = xrdElement.getOwnerDocument();

    // create new element

    Element element;

    if (this.elementNamespace != null) {

      element = document.createElementNS(this.elementNamespace, this.elementName);
    } else {

      element = document.createElement(this.elementName);
    }

    if (this.elementValue != null) {

      Text text = document.createTextNode(this.elementValue);
      element.appendChild(text);
    }

    for (int i=0; i<this.attributeNames.length; i++) {

      Attr attr = document.createAttribute(this.attributeNames[i]);
      attr.setNodeValue(this.attributeValues[i]);
      element.setAttributeNode(attr);
    }

    // insert element into XRD

    try {

      xrdElement.appendChild(element);
      xrd = new XRD(xrdElement, false);
    } catch (Exception ex) {

      throw new StageException("Unable to parse modified XRD.", ex);
    }

    // done

    return(xrd);
View Full Code Here


  }

  public void init() throws StageException {

    String pipeline = this.properties.getProperty(PROPERTIES_KEY_PIPELINE);
    if (pipeline == null) throw new StageException("Required property " + PROPERTIES_KEY_PIPELINE + " not found.");
    this.pipeline = ServerConfigFactory.getSingleton().getPipelineRegistry().getPipelineByName(pipeline);
  }
View Full Code Here

      try {

        store.registerSubsegment(parentAuthority, localCanonicalIDString, authority);
      } catch (StoreException ex) {

        throw new StageException("Cannot register subsegment for CanonicalID.");
      }
    }

    // done
View Full Code Here

    this.date = DateFormat.getInstance().parse(date);
  }

  public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {

    if (this.date == null) throw new StageException("Not initialized.");

    // add an <Expires> tag to the XRD

    xrd.setExpires(this.date);
View Full Code Here

    this.seconds = new Long(seconds);
  }

  public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {

    if (this.seconds == null) throw new StageException("Not initialized.");

    // add an <Expires> tag to the XRD

    xrd.setExpires(new Date(new Date().getTime() + this.seconds.longValue() * 1000));

 
View Full Code Here

    this.text = text;
  }

  public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {

    if (this.code == null || this.text == null) throw new StageException("Not initialized.");

    // add a <ServerStatus> tag to the XRD

    xrd.setServerStatus(new ServerStatus(this.code, this.text));
View Full Code Here

    this.text = text;
  }

  public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {

    if (this.code == null || this.text == null) throw new StageException("Not initialized.");

    // add a <Status> tag to the XRD

    xrd.setStatus(new Status(this.code, this.text));
View Full Code Here

      double millis = (Math.random() + 2) * 1000;
      Thread.sleep((long) millis);
    } catch (InterruptedException ex) {

      throw new StageException(ex);
    }

    // done

    return(xrd);
View Full Code Here

TOP

Related Classes of org.openxri.exceptions.StageException

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.