Package org.openxri.xml

Examples of org.openxri.xml.Service


  }

  private XRD makeSampleXRD() {

    XRD xrd = new XRD();
    Service defaultService;

    try {

      defaultService = new DefaultService(new URI("http://www.openxri.org"));
      xrd.addService(defaultService);
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();
        if (append == null)
          append = SEPUri.APPEND_LOCAL;
View Full Code Here

     
      ///// Try each URI in each selected service in turn
      Exception savedException = null;
      Iterator srvIterator = selectedServices.iterator();
      while (srvIterator.hasNext()) {
        Service srv = (Service)srvIterator.next();
       
        Iterator uriIterator = srv.getPrioritizedURIs().iterator();
          ///// try each selected service URI in turn (skip only if nothing was read)
          while (uriIterator.hasNext()) {
            SEPUri sepURI = (SEPUri)uriIterator.next();
            URI uri = sepURI.getURI();
           
View Full Code Here

    ArrayList selectedServices = selectServices(services, type, path, mediaType);
    if (selectedServices == null || selectedServices.size() < 1)
      return uris;
   
    for (int i = 0; i < selectedServices.size(); i++) {
      Service s = (Service)selectedServices.get(i);
      uris.addAll(s.getPrioritizedURIs());
    }
    return uris;
  }
View Full Code Here

      return new ArrayList();
   
    // prioritization
    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

   
  public static void main (String[] args) {
    Resolver resolver = new Resolver();
   
        XRD eqRoot = new XRD();
        Service eqAuthService = new Service();
        eqAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none", SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
        eqAuthService.addType(Tags.SERVICE_AUTH_RES);
        //eqAuthService.addURI("http://equal.beta.xri.net");
        eqAuthService.addURI("http://equal.xri.net");
        eqRoot.addService(eqAuthService);
        // System.out.println(eqRoot.toString());
       
        XRD atRoot = new XRD();
        Service atAuthService = new Service();
        atAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none", SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
        atAuthService.addType(Tags.SERVICE_AUTH_RES);
        //atAuthService.addURI("http://at.beta.xri.net/cgi-bin/xri");
        atAuthService.addURI("http://at.xri.net");
        //atAuthService.addURI("http://xria.2idi.com/@");
        atRoot.addService(atAuthService);
        // System.out.println(atRoot.toString());

        XRD bangRoot = new XRD();
        Service bangAuthService = new Service();
        bangAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none", SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
        bangAuthService.addType(Tags.SERVICE_AUTH_RES);
        bangAuthService.addURI("http://bang.beta.xri.net/cgi-bin/xri");
        bangRoot.addService(bangAuthService);
        // System.out.println(bangRoot.toString());

        resolver.setAuthority("=", eqRoot);
        resolver.setAuthority("@", atRoot);
View Full Code Here

    * of the provided authority id.
    * @param sID - an authority id serviced by this store
    */
    protected Service constructAuthority(String sID)
    {
      Service oAuth = new Service();
        oAuth.setProviderID(sID);
        oAuth.addURI(
            fillURI(new StringBuffer(), oAuth.getProviderID(), "http")
                .toString());
        oAuth.addURI(
            fillURI(new StringBuffer(), oAuth.getProviderID(), "https")
                .toString());

        return oAuth;

    } // constructAuthority()
View Full Code Here

    * @throws URISyntaxException
    */
    protected Service getRootAuthority()
        throws URISyntaxException, XMLSecurityException
    {
        Service oAuthority = new Service();
        oAuthority.addURI(new SEPUri(ssRootURI + "?ns=at"));

        // Add encrypted Root URI
        oAuthority.addURI(new SEPUri(ssEncryptedRootURI + "?ns=at"));

        /* there is no more such concept as TrustedURIs
        oAuthority.getTrustedURIs().add(new URI(ssRootURI + "?ns=at"));
        oAuthority.getTrustedURIs().add(new URI(ssEncryptedRootURI + "?ns=at"));
        */
       
        oAuthority.setProviderId(moAuth.getAuthorityId());

        KeyInfo oKeyInfo = null;
        if (moCertChain != null)
        {
            Document oDoc = new DocumentImpl();
            oKeyInfo = new KeyInfo(oDoc);
            X509Data oData = new X509Data(oDoc);
            oData.addCertificate(moCertChain[0]);
            oKeyInfo.add(oData);
            oAuthority.setKeyInfo(oKeyInfo);
        }

        return oAuthority;

    } // getRootAuthority()
View Full Code Here

            // AuthorityID
            assertEquals(
                "urn:uuid:D5CFA9CB-F43B-228C-3CEE-C5E9F2D3CB15",
                oDesc.getProviderID().trim());

            Service authService = oDesc.getFirstServiceByType(Tags.SERVICE_AUTH_RES);
            // Authority
            assertNotNull(authService);

            // Authority/AuthorityID
            assertEquals(
                "urn:uuid:C5C9EECF-A3BC-4883-8852-8EECB54CE1D5",
                authService.getProviderID().trim());

            // Authority/URI(s)
            assertEquals(3, authService.getNumURIs());
            assertEquals(
                "http://test.epok.net/foo/bar",
                authService.getURIForScheme("http").getURI().toString());
            assertEquals(
                "https://test.epok.net/foo/bar",
                authService.getURIForScheme("https").getURI().toString());

            // Authority/URI(s)
            /*
            assertEquals(3, oDesc.getServiceForType(Tags.SERVICE_AUTH_TRUSTED).getNumURIs());
            assertEquals(
                "http://test.epok.net/foo/bar",
                oDesc.getXRIAuthority().getTrustedURIForScheme("http") + "");
                */
           
            // Authority/KeyInfo
            assertNotNull(authService.getKeyInfo());

            // Services
            Service oLA = oDesc.getServiceForType("xri:@epok/foo");
            assertTrue("Incorrect URI for Local Access", oLA.getNumURIs() == 0);

            oLA = oDesc.getServiceForType("xri:@epok/foo2");
            assertTrue(
                "Incorrect URI for Local Access2", oLA.getNumURIs() == 1);
            assertTrue(
                "Incorrect Value for Custom Data",
                oLA.getOtherTagValues("Custom") != null);
            assertTrue(
                "Incorrect Value for Custom Data2",
                oLA.getOtherTagValues("Custom2") != null);

            // Synonyms
            assertTrue(
                "Incorrect # for Internal", oDesc.getNumLocalids() == 1);
            assertTrue(
View Full Code Here

            // AuthorityID
            assertEquals(
                "urn:uuid:D5CFA9CB-F43B-228C-3CEE-C5E9F2D3CB15",
                oDesc.getProviderID().trim());

            Service authService = oDesc.getFirstServiceByType(Tags.SERVICE_AUTH_RES);
            // Authority
            assertNotNull(authService);

            // Authority/AuthorityID
            assertEquals(
                "urn:uuid:C5C9EECF-A3BC-4883-8852-8EECB54CE1D5",
                authService.getProviderId().trim());

            // Authority/URI(s)
            assertEquals(3, authService.getNumURIs());
            assertEquals(
                "http://test.epok.net/foo/bar",
                authService.getURIForScheme("http").getURI().toString());
            assertEquals(
                "https://test.epok.net/foo/bar",
                authService.getURIForScheme("https").getURI().toString());

            // Authority/URI(s)
            /*
            assertEquals(3, oDesc.getServiceForType(Tags.SERVICE_AUTH_TRUSTED).getNumURIs());
            assertEquals(
                "http://test.epok.net/foo/bar",
                oDesc.getXRIAuthority().getTrustedURIForScheme("http") + "");
                */
           
            // Authority/KeyInfo
            assertNotNull(authService.getKeyInfo());

            // Services
            Service oLA = oDesc.getServiceForType("xri:@epok/foo");
            assertTrue("Incorrect URI for Local Access", oLA.getNumURIs() == 0);

            oLA = oDesc.getServiceForType("xri:@epok/foo2");
            assertTrue(
                "Incorrect URI for Local Access2", oLA.getNumURIs() == 1);
            assertTrue(
                "Incorrect Value for Custom Data",
                oLA.getOtherTagValues("Custom") != null);
            assertTrue(
                "Incorrect Value for Custom Data2",
                oLA.getOtherTagValues("Custom2") != null);

            // Synonyms
            assertTrue(
                "Incorrect # for Internal", oDesc.getNumLocalids() == 1);
            assertTrue(
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.