Package org.openxri.store

Examples of org.openxri.store.Authority


      final Store openXRIStore = ((OpenXRIAdminApplication) this.getApplication()).getOpenXRIStore();

      // find the authority

      Authority authority;

      try {

        XRI xri = new XRI(this.xri);
        XRIAuthority xriAuthority = ((XRIAuthority) xri.getAuthorityPath());
View Full Code Here


      try {

        SubSegment rootSubSegment = openXRIStore.createRootSubSegment(this.namespace, new XRD());

        CanonicalID canonicalID;
        Authority authority;

        try {

          authority = openXRIStore.getSubSegmentAuthority(rootSubSegment);

          XRDS xrds = resolver.resolveAuthority(new XRI(this.namespace), new ResolverFlags(), new ResolverState());
          XRD xrd = (xrds != null) ? xrds.getFinalXRD() : null;
          canonicalID = (xrd != null) ? xrd.getCanonicalID() : null;
        } catch (Exception ex) {

          log.warn("Cannot find corresponding i-number");
          canonicalID = null;
          authority = null;
        }

        if (canonicalID != null && authority != null && ! canonicalID.getValue().equals(this.namespace)) {

          XRD xrd = authority.getXrd();
          xrd.setCanonicalID(new CanonicalID(canonicalID.getValue()));

          ((StoreEditable) openXRIStore).setXrd(authority, xrd);
          openXRIStore.registerSubsegment(null, canonicalID.getValue(), authority);
        }
View Full Code Here

    try {

      if (store instanceof StoreResettable) ((StoreResettable) store).resetStore();

      SubSegment rootSubSegment1 = store.createRootSubSegment("=example", new XRD());
      Authority rootAuthority1 = store.getSubSegmentAuthority(rootSubSegment1);
      SubSegment subSegment1 = store.registerSubsegment(rootAuthority1, "*name1", makeSampleXRD());
      SubSegment subSegment2 = store.registerSubsegment(rootAuthority1, "*name2", makeSampleXRD());

      SubSegment rootSubSegment2 = store.createRootSubSegment("@example", new XRD());
      Authority rootAuthority2 = store.getSubSegmentAuthority(rootSubSegment2);
      SubSegment subSegment3 = store.registerSubsegment(rootAuthority2, "*name3", makeSampleXRD());
      Authority authority3 = store.getSubSegmentAuthority(subSegment3);
      SubSegment subSegment4 = store.registerSubsegment(authority3, "*name4", makeSampleXRD());

    } catch (StoreException ex) {

      ex.printStackTrace();
View Full Code Here

  {
    if (soLog.isDebugEnabled()) soLog.debug("lookupById(" + authorityId + "," + segment.toString() + ")");

    // find the authority object for this id

    Authority parent;
    try {

      parent = moStore.findAuthority(authorityId);
    } catch (StoreNotFoundException ex) {
View Full Code Here

  {
    if (soLog.isDebugEnabled()) soLog.debug("lookupByNamespace(" + namespace + "," + segment.toString() + ")");

    // find the authority object for this namespace

    Authority parent;

    try {

      parent = moStore.findRootAuthority(namespace);
    } catch (StoreNotFoundException ex) {
View Full Code Here

          ServerNotFoundException ex2 = new ServerNotFoundException("Cannot find subsegment: " + subSegmentName, ex);
          soLog.warn(ex2);
          throw ex2;
        }

        Authority authority = moStore.getSubSegmentAuthority(subSegment);

        // look up Refs and Services from the store, as well as LocalIDs if the store supports it

        Ref[] refs = moStore.getAuthorityRefs(authority);
        Service[] services = moStore.getAuthorityServices(authority);
        LocalID[] localIds;

        if (moStore instanceof StoreBetterLookup) {

          localIds = ((StoreBetterLookup) moStore).getSubSegmentLocalIds(subSegment);
        } else {

          localIds = new LocalID[0];
        }

        // fill it with information we got from the store

        for (int ii=0; ii<refs.length; ii++) xrd.addRef(refs[ii]);
        for (int ii=0; ii<services.length; ii++) xrd.addService(services[ii]);
        for (int ii=0; ii<localIds.length; ii++) xrd.addLocalID(localIds[ii]);

        // do we want a local authority resolution service for this authority?
        // this piece of information comes from the store, but we actually create
        // the service, since this requires knowledge of the server configuration

        if (authority.getLocalAuthService().equals(Boolean.TRUE)) {

          URI[] uris;

          try {

            uris = new URI[2];
            uris[0] = fillURI(authority.getAuthorityId(), "http");
            uris[1] = fillURI(authority.getAuthorityId(), "https");
          } catch(URISyntaxException ex) {

            throw new ServerInternalException("Invalid URI for authority resolution service.", ex);
          }

          xrd.addService(new AuthorityResolutionService(uris, authority.getAuthorityId()));
        }

        // let our subclasses finish the XRD before we append it to the XRDS

        this.finishXRD(
View Full Code Here

      throw ex2;
    }

    XRIAuthority authorityPath = new GCSAuthority(utf8Namespace);

    Authority namespaceAuthority;

    try {

      namespaceAuthority = this.store.localLookup(authorityPath);
    } catch (StoreException ex) {
View Full Code Here

      throw ex2;
    }

    XRIAuthority authorityPath = new GCSAuthority(utf8Namespace);

    Authority parentAuthority;

    try {

      parentAuthority = this.store.localLookup(authorityPath);

      if (parentAuthority == null) throw new ServerNotFoundException("Namespace authority " + namespace + " not found.");
    } catch (StoreException ex) {

      ServerException ex2 = new ServerInternalException("Error while finding namespace authority " + namespace + ": " + ex.getMessage(), ex);
      log.warn(ex2);
      throw ex2;
    }

    // the big goal is to make an XRDS, consisting of one or more XRDs

    XRDS xrds = new XRDS();
    boolean ret;

    // give subclasses a chance to init the XRDS before we begin

    ret = this.initXRDS(
        xrds,
        query,
        signed);

    // if a subclass returned true, it doesn't want us to do any more work

    if (ret == true) {

      log.debug("Subclass handled XRDS completely. Returning it without any more work.");
      return(xrds);
    }

    // generate XRDs for all subsegments in the request

    String utf8Query;

    try {

      utf8Query = IRIUtils.IRItoXRI(IRIUtils.URItoIRI(query));
    } catch (Exception ex) {

      ServerException ex2 = new ServerInternalException("Unsupported encoding in query: " + ex.getMessage(), ex);
      log.warn(ex2);
      throw ex2;
    }

    XRISegment segment = new XRISegment(utf8Query);

    for (int i=0; i<segment.getNumSubSegments(); i++) {

      String subSegmentName = segment.getSubSegmentAt(i).toString();

      try {

        // create a fresh XRD

        XRD xrd = new XRD();

        // using the parent authority and subsegment name, find the subsegment and the authority we are describing now
        // we must be prepared to have null values here, since not all pipeline configurations
        // may use objects from the store

        SubSegment subSegment = null;
        Authority authority = null;

        if (parentAuthority != null) subSegment = this.store.findSubSegment(parentAuthority, subSegmentName);
        if (subSegment != null) authority = this.store.getSubSegmentAuthority(subSegment);

        // give subclasses a chance to init the XRD
View Full Code Here

        XRD xrd = new XRD();

        // get the current authority from the list

        Authority authority = authorities[i];

        // give subclasses a chance to init the XRD

        ret = this.initXRD(
            xrd,
View Full Code Here

    protected void onSubmit() {

      final Store openXRIStore = ((OpenXRIAdminApplication) this.getApplication()).getOpenXRIStore();

      SubSegment subSegment;
      Authority authority;
     
      try {

        XRD xrd = new XRD();
       
View Full Code Here

TOP

Related Classes of org.openxri.store.Authority

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.