Package org.openxri.store

Examples of org.openxri.store.StoreAttributable


  }

  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
View Full Code Here


        PipelineRegistry pipelineRegistry = (serverConfig == null) ? null : serverConfig.getPipelineRegistry();
        Pipeline lookupPipeline = null;

        if (this.store instanceof StoreAttributable) {

          StoreAttributable storeAttributable = (StoreAttributable) this.store;

          String pipelineName = storeAttributable.getAuthorityAttributes(namespaceAuthority).get(Pipeline.ATTRIBUTE_OVERRIDE_LOOKUP_PIPELINE);
          if (pipelineRegistry != null && pipelineName != null) lookupPipeline = pipelineRegistry.getPipelineByName(pipelineName);
        }

        if (pipelineRegistry != null && lookupPipeline == null) lookupPipeline = pipelineRegistry.getDefaultLookupPipeline();
View Full Code Here

        PipelineRegistry pipelineRegistry = (serverConfig == null) ? null : serverConfig.getPipelineRegistry();
        Pipeline lookupPipeline = null;

        if (this.store instanceof StoreAttributable) {

          StoreAttributable storeAttributable = (StoreAttributable) this.store;

          String pipelineName = storeAttributable.getAuthorityAttributes(parentAuthority).get(Pipeline.ATTRIBUTE_OVERRIDE_LOOKUP_PIPELINE);
          if (pipelineRegistry != null && pipelineName != null) lookupPipeline = pipelineRegistry.getPipelineByName(pipelineName);
        }

        if (pipelineRegistry != null && lookupPipeline == null) lookupPipeline = pipelineRegistry.getDefaultLookupPipeline();
View Full Code Here

        PipelineRegistry pipelineRegistry = (serverConfig == null) ? null : serverConfig.getPipelineRegistry();
        Pipeline lookupPipeline = null;

        if (this.store instanceof StoreAttributable) {

          StoreAttributable storeAttributable = (StoreAttributable) this.store;

          String pipelineName = storeAttributable.getAuthorityAttributes(authority).get(Pipeline.ATTRIBUTE_OVERRIDE_LOOKUP_PIPELINE);
          if (pipelineRegistry != null && pipelineName != null) lookupPipeline = pipelineRegistry.getPipelineByName(pipelineName);
        }

        if (pipelineRegistry != null && lookupPipeline == null) lookupPipeline = pipelineRegistry.getDefaultLookupPipeline();
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);
    if (parentAuthority.getXrd().getNumCanonicalids() < 1) return(xrd);
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;

    // copy all attributes from the parent authority to the child authority

    for (String attribute : this.attributes) {

      try {

        Map<String, String> attributes = storeAttributable.getAuthorityAttributes(parentAuthority);
        storeAttributable.setAuthorityAttributes(authority, attributes);
      } catch (StoreException ex) {

        throw new StageException("Cannot set attribute for authority.");
      }
    }
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 CanonicalID if the parent authority has one

    if (parentAuthority == null) return(xrd);
    if (parentAuthority.getXrd().getNumCanonicalids() < 1) return(xrd);

    // special case: if the new subsegment already is an i-number, we don't generate anything
   
    boolean isINumber = false;
   
    if (subSegmentName.startsWith("!")) isINumber = true;

    // create a new CanonicalID (read from authority attribute, increment by 1, write back as authority attribute)

    String canonicalIDString = null;
    int canonicalIDValue = -1;

    if (! isINumber) {

      try {
 
        canonicalIDString = storeAttributable.getAuthorityAttributes(parentAuthority).get(ATTRIBUTES_KEY_LAST_CANONICALID);
        canonicalIDValue = Integer.parseInt(canonicalIDString);
        canonicalIDValue++;
      } catch (StoreException ex) {
 
        throw new StageException("Cannot read authority attribute from store.", ex);
      } catch (NullPointerException ex) {    // if the attribute does not yet exist on that authority
 
        canonicalIDValue = 0;
      } catch (NumberFormatException ex) {  // if the attribute did not contain a valid integer value
 
        canonicalIDValue = 0;
      }
    }

    String localCanonicalIDString = isINumber ? subSegmentName : ("!" + Integer.toString(canonicalIDValue));
    canonicalIDString = parentAuthority.getXrd().getCanonicalidAt(0).getValue() + localCanonicalIDString;

    CanonicalID canonicalID = new CanonicalID(canonicalIDString);

    // write incremented authority attribute back to store
   
    if (! isINumber) {
   
      try {
 
        Map<String, String> attributes = storeAttributable.getAuthorityAttributes(parentAuthority);
        attributes.put(ATTRIBUTES_KEY_LAST_CANONICALID, Integer.toString(canonicalIDValue));
 
        storeAttributable.setAuthorityAttributes(parentAuthority, attributes);
      } catch (StoreException ex) {
 
        throw new StageException("Cannot write authority attribute to store.", ex);
      }
    }
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;

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

    // create new element
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);
    if (parentAuthority.getXrd().getNumCanonicalids() < 1) return(xrd);
View Full Code Here

        PipelineRegistry pipelineRegistry = (this.serverConfig == null) ? null : this.serverConfig.getPipelineRegistry();
        Pipeline lookupPipeline = null;

        if (this.store instanceof StoreAttributable) {

          StoreAttributable storeAttributable = (StoreAttributable) this.store;

          String pipelineName = storeAttributable.getAuthorityAttributes(namespaceAuthority).get(Pipeline.ATTRIBUTE_OVERRIDE_LOOKUP_PIPELINE);
          if (pipelineRegistry != null && pipelineName != null) lookupPipeline = pipelineRegistry.getPipelineByName(pipelineName);
        }

        if (pipelineRegistry != null && lookupPipeline == null) lookupPipeline = pipelineRegistry.getDefaultLookupPipeline();
View Full Code Here

TOP

Related Classes of org.openxri.store.StoreAttributable

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.