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 Exception {

    this.uris = this.properties.getProperty(PROPERTIES_KEY_URIS, "").split(" +");
    if (this.uris.length < 1) throw new StageException("Required property " + PROPERTIES_KEY_URIS + " not found or empty.");

    this.types = this.properties.getProperty(PROPERTIES_KEY_TYPES, "").split(" +");
    this.paths = this.properties.getProperty(PROPERTIES_KEY_PATHS, "").split(" +");
    this.mediaTypes = this.properties.getProperty(PROPERTIES_KEY_MEDIATYPES, "").split(" +");
  }
View Full Code Here

      try {

        uris.add(new SEPUri(uri, null, SEPUri.APPEND_NONE));
      } catch (URISyntaxException ex) {

        throw new StageException("Invalid URI: " + uri.toString());
      }
    }

    for (String type : this.types) types.add(new SEPType(type, null, Boolean.TRUE));
    for (String path : this.paths) paths.add(new SEPPath(path, null, Boolean.TRUE));
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 = this.serverConfig.getPipelineRegistry().getPipelineByName(pipeline);
  }
View Full Code Here

  }

  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;

    // can only create a ProviderID if the parent authority has a CanonicalID

    if (parentAuthority == null) return(xrd);
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

      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

  }

  public void init() throws Exception {

    String value = this.properties.getProperty(PROPERTIES_KEY_ATTRIBUTES);
    if (value == null) throw new StageException("Required property " + PROPERTIES_KEY_ATTRIBUTES + " not found.");

    this.attributes = value.split("[ ,;:]");
  }
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.