Package org.openxri.xml

Examples of org.openxri.xml.Service


      s.setText("Requested service endpoint not found");
      throw new PartialResolutionException(xrdsOut);
    }

    // check if first Service has Redirect of Ref
    Service srv = (Service)selectedSvcs.get(0);
    if (srv.getNumRedirects() > 0) {
      // try to follow each redirect (which will recurse back into this method if the XRDS was fetched successfully.)
      selectedSvcs = processServiceRedirects(xrdsOut, srv, xrd, qxri, sepType, sepMediaType, flags, state);
    }
    else if (srv.getNumRefs() > 0) {
      selectedSvcs = processServiceRefs(xrdsOut, srv, xrd, qxri, sepType, sepMediaType, flags, state);
    }

    return selectedSvcs;
  }
View Full Code Here


    if (selectedServices == null || selectedServices.size() == 0)
      return new ArrayList();

    PrioritizedList list = new PrioritizedList();
    for (int i = 0; i < selectedServices.size(); i++) {
      Service s = (Service) selectedServices.get(i);
      String priority = (s.getPriority() == null) ? PrioritizedList.PRIORITY_NULL
          : s.getPriority().toString();
      list.addObject(priority, s);
    }

    return list.getList();
  }
View Full Code Here

   
    log.debug("constructURIinXRD()");
   
    while (it.hasNext()) {
      log.debug("constructURIinXRD() got selected service");
      Service sep = (Service)it.next();
      List uris = sep.getURIs();
      Iterator itURI = uris.iterator();
      while (itURI.hasNext()) {
        SEPUri uri = (SEPUri)itURI.next();
        String append = uri.getAppend();
        if (append != null) {
          String r = constructURI(uri.getURI(), uri.getAppend(), qxri);
          try {
            uri.setURI(new URI(r));
            uri.setAppend(null);
          } catch (URISyntaxException e) {}
        }
      }
    }

    for (int i = 0; i < finalXRD.getNumServices(); i++) {
      log.debug("constructURIinXRD() got service");
      Service sep = (Service)finalXRD.getServiceAt(i);
      List uris = sep.getURIs();
      Iterator itURI = uris.iterator();
      while (itURI.hasNext()) {
        SEPUri uri = (SEPUri)itURI.next();
        String append = uri.getAppend();
        if (append != null) {
View Full Code Here

    * Parses the query to obtain the authority id that is being resolved.
    */
    protected String getAuthorityIDFromNS(String sNS)
    {
        // Lookup the root authority id for the given namespace
      Service oAuth = null;
        try
        {
            oAuth = moStore.findRootAuthority(sNS);
            return (oAuth == null) ? null : oAuth.getProviderID();
        }
        catch (StoreException oEx)
        {
            // Nothing to do
            soLog.warn(
View Full Code Here

      String serviceText = FileStore.readLine(fileService);

      Document document = this.builder.parse(serviceText);
      Element element = document.getDocumentElement();
      services.add(new Service(element));
    }

    // done

    return(services);
View Full Code Here

    */
    public Service createAuthority()
        throws StoreException
    {
        // don't store anything in memory
      Service oAuth = super.constructAuthority(getUUID());

        return oAuth;

    } // createAuthority()
View Full Code Here

        {
            throw new StoreException(
                Util.KEY_NOTFOUND, "The specified namespace was not found");
        }

        Service oAuth = null;

        synchronized (oSync)
        {
            // Attempt to retrieve the namespace
            try
            {
                oAuth = findRootAuthority(sNamespace);
            }
            catch (StoreException oEx)
            {
                // The namespace doesn't exist, continue
            }

            // Ensure that the namespace doesn't already exist
            if (oAuth != null)
            {
                throw new StoreException(
                    Util.KEY_DUPNAME, "Namespace already exists");
            }

            oAuth = createAuthority();

            oNSIDMap.put(sNamespace, oAuth.getProviderID());

            Map oAuthMap = new HashMap();
            oAuthMap.put("AuthorityObject", oAuth);

            oIDAuthMap.put(oAuth.getProviderID(), oAuthMap);

        } // synchronized

        return oAuth;
View Full Code Here

        {
            throw new StoreException(
                Util.KEY_NOTFOUND, "The specified namespace was not found");
        }

        Service oAuth = null;

        synchronized (oSync)
        {
            String sID = (String) oNSIDMap.get(sNamespace);
View Full Code Here

    public Service registerLocalAuthority(
        String sParentID, String sSubsegment, Service[] oServices,
        String[] oInternals, String[] oExternals)
        throws StoreException
    {
      Service oAuth = null;

        synchronized (oSync)
        {
            if (subsegmentExists(sParentID, sSubsegment))
            {
                throw new StoreException(
                    Util.KEY_DUPNAME, "XRI Already exists");
            }

            // Okay to register the subsegment
            Map oAuthMap = (Map) oIDAuthMap.get(sParentID);

            if (oAuthMap == null)
            {
                // XXX what to do?
                throw new StoreException(
                    Util.KEY_NOTFOUND,
                    "XRI authority for id '" + sParentID + "' not found");
            }

            Map oSubsegmentMap = (Map) oAuthMap.get("Subsegments");

            if (oSubsegmentMap == null)
            {
                // No subsegments registered, yet
                oSubsegmentMap = new HashMap();
                oAuthMap.put("Subsegments", oSubsegmentMap);
            }

            Map oSubsegmentPartMap = new HashMap();
            oSubsegmentMap.put(sSubsegment, oSubsegmentPartMap);

            oAuth = createAuthority();

            // Define the parts of the subsegment
            oSubsegmentPartMap.put("LocalAuthority", oAuth.getProviderID());
            oSubsegmentPartMap.put(
                "Date", new Long(System.currentTimeMillis() / 1000));
            oSubsegmentPartMap.put(
                ssServicesPart,
                Util.makeServices(new StringBuffer(), oServices).toString());
            oSubsegmentPartMap.put(
                ssInternalsPart,
                Util.makeInternals(new StringBuffer(), oInternals).toString());
            oSubsegmentPartMap.put(
                ssExternalsPart,
                Util.makeExternals(new StringBuffer(), oExternals).toString());

            // Put the authority in the IDAuthMap
            Map oNewAuthMap = new HashMap();
            oNewAuthMap.put("AuthorityObject", oAuth);

//            oNewAuthMap.put(
//                "Authority",
//                Util.makeAuthority(new StringBuffer(), oAuth).toString());
            oIDAuthMap.put(oAuth.getProviderID(), oNewAuthMap);

        } // synchronized

        return oAuth;
View Full Code Here

        }

        synchronized (oSync)
        {
            // will throw if not found
          Service oAuth = findRootAuthority(sNamespace);
            oNSIDMap.remove(sNamespace);

        } // synchronized

    } // deleteRootAuthority()
View Full Code Here

TOP

Related Classes of org.openxri.xml.Service

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.