Package org.openxri.xml

Examples of org.openxri.xml.Service


  public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
  throws HibernateException, SQLException {

    log.trace("nullSafeGet()");

    Service service;
    String str = rs.getString(names[0]);

    try {

      if (str != null) {

        Document document = this.builder.parse(new ByteArrayInputStream(str.getBytes()));
        Element element = document.getDocumentElement();

        try {

          service = new Service(element);
        } catch (Exception ex) {

          log.error(ex);
          throw(ex);
        }
View Full Code Here


  public void nullSafeSet(PreparedStatement st, Object value, int index)
  throws HibernateException, SQLException {

    log.trace("nullSafeSet()");

    Service service = (Service) value;

    try {

      if (service != null) {

        Document doc = this.builder.newDocument();
        Node element;

        try {

          element = service.toDOM(doc);
        } catch (Exception ex) {

          log.error(ex);
          throw(ex);
        }
View Full Code Here

    log.trace("replace()");

    if (original == null) return(null);

    Service service = (Service) original;

    try {

      return (service.clone());
    } catch (CloneNotSupportedException e) {

      throw new HibernateException("Cannot clone service.");
    }
  }
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

      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

                        sOutput, CMD_CREATE_ROOT_AUTHORITY);
                    return FAILURE;
                }

                String sNamespace = sSubcommandArgs[0];
                Service oAuthority = oAdmin.createRootAuthority(sNamespace);
                if (mbOutputAuthIDOnly)
                {
                    sOutput.append(oAuthority.getProviderID());
                }
                else
                {
                    sOutput.append(oAuthority.dump());
                }
            }

            else if (msSubcommand.equalsIgnoreCase(CMD_DELETE_ROOT_AUTHORITY))
            {
                sOutput.append(
                    CMD_DELETE_ROOT_AUTHORITY +
                    ": CURRENTLY NOT IMPLEMENTED.\n");
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_FIND_ROOT_AUTHORITY))
            {
                // args:  namespace [-output_auth_id_only]
                if (iLength != 1)
                {
                    outputSubcommandArgError(sOutput, CMD_FIND_ROOT_AUTHORITY);
                    return FAILURE;
                }

                // we'll do special error handling here, because we don't want to
                // treat 'not found' as a FAILURE condition -- else caller could
                // not distinguish between that and bad argument error
                try
                {
                    String sNamespace = sSubcommandArgs[0];
                    Service oAuthority = oAdmin.findRootAuthority(sNamespace);
                    sOutput.append(
                        mbOutputAuthIDOnly ? oAuthority.getProviderID()
                                           : oAuthority.toString());
                }
                catch (StoreException oEx)
                {
                    // we intepret the following as not-found namespace
                    if (
                        (oEx.getExMessage() != null) &&
                        (oEx.getExMessage().indexOf("namespace") != -1))
                    {
                        sOutput.setLength(0); // not needed -- just for illustration
                    }
                    else
                    {
                        throw oEx;
                    }
                }
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_LIST_ROOT_AUTHORITIES))
            {
                sOutput.append(
                    CMD_LIST_ROOT_AUTHORITIES +
                    ": CURRENTLY NOT IMPLEMENTED.\n");
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_CREATE_AUTHORITY))
            {
                sOutput.append(
                    CMD_CREATE_AUTHORITY + ": CURRENTLY NOT IMPLEMENTED.\n");
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_DELETE_AUTHORITY))
            {
                sOutput.append(
                    CMD_DELETE_AUTHORITY + ": CURRENTLY NOT IMPLEMENTED.\n");
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_REG_LOCAL_AUTHORITY))
            {
                sOutput.append(
                    CMD_REG_LOCAL_AUTHORITY + ": CURRENTLY NOT IMPLEMENTED.\n");
            }
            else if (msSubcommand.equalsIgnoreCase(CMD_REG_SUBSEGMENT))
            {
                // args:  parent_id subsegment auth_id auth_uri
                //        [-auth_type <type>] [-add_uri <uri>] [-service <service>]
                //        [-internal <synonym>] [-external <synonym]
                //
                // all optional args may have 0..n, except auth_type which is 0..1.
                if (iLength != 4)
                {
                    outputSubcommandArgError(sOutput, CMD_REG_SUBSEGMENT);
                    return FAILURE;
                }

                String sParentID = sSubcommandArgs[0];
                String sSubsegment = sSubcommandArgs[1];
                String sAuthID = sSubcommandArgs[2];
                String sAuthURI = sSubcommandArgs[3];

                // set up the uris. the non-optional one goes first, then append
                // the optional ones
                String[] sAuthURIs = new String[moAuthURIs.size() + 1];
                sAuthURIs[0] = sAuthURI;
                for (int i = 1; i < sAuthURIs.length; i++)
                {
                    sAuthURIs[i] = (String) moAuthURIs.get(i - 1);
                }

                // set up the authority object
                Service oChildAuthority = new Service();
                oChildAuthority.setProviderID(sAuthID);
                oChildAuthority.setType(msAuthType);
                for (int i = 0; i < sAuthURIs.length; i++)
                {
                    oChildAuthority.addURI(sAuthURIs[i]);
                }

                // invoke the command on the server. TODO: currently the services and
                // synonyms are not supported
                oAdmin.registerSubsegment(
View Full Code Here

    log.debug("assemble()");

    if (cached == null) return(null);

    Service service;
    String serviceText = (String) cached;

    try {

      Document document = this.builder.parse(serviceText);
      Element element = document.getDocumentElement();
      service = new Service(element);
    } catch (Exception ex) {

      throw new HibernateException("Cannot assemble service.", ex);
    }
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.