Package org.openxri.xml

Examples of org.openxri.xml.Service


    // extract the host from the claimed id - this is the canonicalID
    // we expect in the site's XRD
    IdpIdentifier host = new IdpIdentifier(claimedId.getUrl().getHost());

    // find the <Service> element with type '.../describedby'
    Service service = getServiceForType(siteXrd.getXrd(), URI_TEMPLATE_TYPE);
    if (service == null) {
      throw new DiscoveryException("could not find service of type " +
          URI_TEMPLATE_TYPE + " in XRDS at location " +
          claimedId.getIdentifier());
    }
View Full Code Here


    appendLink(buffer, "http://webfinger.net/rel/profile-page", "http://xri2xrd.net/" + canonical, "text/html");
    appendLink(buffer, "describedby", "http://xri2xrd.net/" + canonical, "text/html");

    for (int i=0; i<xrd.getNumServices(); i++) {

      Service service = (Service) xrd.getServiceAt(i);

      if (service == null) continue;

      SEPMediaType mediaType = (service.getNumMediaTypes() > 0) ? service.getMediaTypeAt(0) : null;

      for (int ii=0; ii<service.getNumTypes(); ii++) {

        SEPType type = service.getTypeAt(ii);

        if (type == null || type.getValue() == null || type.getValue().trim().equals("")) continue;

        for (int iii=0; iii<service.getNumURIs(); iii++) {

          SEPUri uri = service.getURIAt(iii);

          if (uri == null || uri.getUriString() == null || uri.getUriString().trim().equals("")) continue;

          String xrdHref = uri.getUriString();
          if (SEPUri.APPEND_AUTHORITY.equals(uri.getAppend()) ||
View Full Code Here

    {
        Cache oCache = new Cache(1000);
        assertTrue("Initial cache not empty", oCache.getNumNodes() == 0);

        XRD oDesc = new XRD();
        Service atAuthService = new Service();
        atAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
        atAuthService.addType(Tags.SERVICE_AUTH_RES);
        atAuthService.addURI("http://gcs.epok.net/xri/resolve?ns=at");
        oDesc.addService(atAuthService);

        XRD oDummy = new XRD();
        Service dummyService = new Service();
        dummyService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
        dummyService.addType(Tags.SERVICE_AUTH_RES);
        dummyService.addURI("http://www.example.com/xri/resolve?id=1");
        oDummy.addService(dummyService);

        GCSAuthority oAuth = new GCSAuthority("@");
        oCache.stuff(oAuth, oDesc);
        assertTrue("Initial cache incorrect", oCache.getNumNodes() == 1);
View Full Code Here

        oCache.prune((XRIAuthority) AuthorityPath.buildAuthorityPath("@"));
        assertTrue("Initial cache not empty", oCache.getNumNodes() == 0);

       
        XRD oDesc = new XRD();
        Service atAuthService = new Service();
        atAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
        atAuthService.addType(Tags.SERVICE_AUTH_RES);
        atAuthService.addURI("http://gcs.epok.net/xri/resolve?ns=at");
        oDesc.addService(atAuthService);

        GCSAuthority oAuth = new GCSAuthority("@");
        oCache.stuff(oAuth, oDesc);
        assertTrue("Initial cache incorrect", oCache.getNumNodes() == 1);
View Full Code Here

        *
        */
        public void run()
        {
            XRD oDummy = new XRD();
            Service dummyService = new Service();
            dummyService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
            dummyService.addType(Tags.SERVICE_AUTH_RES);
            dummyService.addURI("http://www.example.com/xri/resolve?id=1");
            oDummy.addService(dummyService);

            String[] oCases =
                { "@!a1!b2!c3!d4", "@!x1!y2!z3", "@!a1!b2!c3", "@!a1!b2", "@!a1!b2!m3", "@!a1!o2!p3", "@!a1!o2!q3", "@!a1!b2!c3!d4!e5", "@!x1!y2" };

View Full Code Here

      assertTrue("The eighth child should be an XRDS element because it followed a Service-level Redirect", xrds.isXRDSAt(7));
      redirXRDS = xrds.getXRDSAt(7);
      assertTrue("Wrong redirect followed on the eighth child", redirXRDS.getRedirect().equals("http://auth.xrid.net/!332/"));
      assertTrue("Eighth child should have succeeded", redirXRDS.getFinalXRD().getStatusCode().equals(Status.SUCCESS));
      assertTrue("Should be one selected Service on eighth child", redirXRDS.getFinalXRD().getSelectedServices().getList().size() == 1);
      Service srv = (Service)redirXRDS.getFinalXRD().getSelectedServices().getList().get(0);
      assertTrue("In correct URI in selected service on eighth child", srv.getURIAt(0).getUriString().equals("http://my.blog.com"));
    }
    catch (Exception e) {
      e.printStackTrace();
      fail("Not expecting exception: " + e);
    }
View Full Code Here

 
  public static XRD createAuthRoot(String uri) {
    XRD xrd = new XRD();

    // construct an authority resolution service
    Service srv = new Service();
    TrustType tt = new TrustType(); // default trust type
    String authMediaType = Tags.CONTENT_TYPE_XRDS + ";"
        + tt.getParameterPair();
    srv.addMediaType(authMediaType, null, Boolean.FALSE);
    srv.addType(Tags.SERVICE_AUTH_RES);
    srv.addURI(uri);

    // add it to the XRD
    xrd.addService(srv);

    return xrd;
View Full Code Here

    List<String> jsonLocations = new ArrayList<String>();

    for (int i=0; i<xrd.getSelectedServices().getList().size(); i++) {

      Service service = (Service) xrd.getSelectedServices().getList().get(i);

      if (service == null) continue;

      for (int ii=0; ii<service.getNumURIs(); ii++) {

        SEPUri uri = service.getURIAt(ii);

        if (uri == null || uri.getUriString() == null || uri.getUriString().trim().equals("")) continue;

        String jsonLocation = uri.getUriString();
        if (SEPUri.APPEND_AUTHORITY.equals(uri.getAppend()) ||
View Full Code Here

    if (xrd.getSelectedServices().getList().size() < 1) {
      log.error("SEP Selection succeeded but no Service found!?");
      return new ArrayList();
    }

    Service topService = (Service) xrd.getSelectedServices().getList().get(0);

    ArrayList urisOut = new ArrayList();
    ArrayList uris = topService.getPrioritizedURIs();
    for (int i = 0; uris != null && i < uris.size(); i++) {
      SEPUri uri = (SEPUri) uris.get(i);
      String append = uri.getAppend();
      urisOut.add(constructURI(uri.getURI(), append, qxri));
    }
View Full Code Here

    ///// Try each URI in each selected service in turn
    Exception savedException = null;
    Iterator srvIterator = authResServices.iterator();
    while (srvIterator.hasNext()) {     
      Service srv = (Service) srvIterator.next();
      Iterator uriIterator = srv.getPrioritizedURIs().iterator();
     
      while (uriIterator.hasNext()) {
        SEPUri sepURI = (SEPUri) uriIterator.next();
        URI uri = sepURI.getURI();
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.