Inheritance: Cloneable, Serializable
 public PartialResolutionException(XRD xrd)
     : base(xrd.getStatus().getText())
 {
     PartialXRDS = new XRDS();
     PartialXRDS.add(xrd);
 }
Exemplo n.º 2
0
 /*
 ****************************************************************************
 * add()
 ****************************************************************************
 */
 /**
 * Adds an XRD element
 */
 public void add(XRD oDescriptor)
 {
     moXRDs.Add(oDescriptor);
 }
Exemplo n.º 3
0
        //throws UriFormatException, ParseException
        /**
        * Constructs XRD from a string
        */
        public static XRD parseXRD(string xmlStr, bool bKeepDOM)
        {
            XRD oXriD = null;

            try {
                XmlDocument oDOMDoc = new XmlDocument();
                oDOMDoc.LoadXml(xmlStr);

                // XRDS
                XmlElement oElement = oDOMDoc.DocumentElement;

                // Populate the cache and store the Descriptors from the response
                oXriD = new XRD(oElement, bKeepDOM);
            } catch (IOException oEx) {
                soLog.Error("IOException", oEx);
                throw new XRIParseException("IOException", oEx);
            } catch (XmlException oEx) {
                soLog.Error("XmlException", oEx);
                throw new XRIParseException("XmlException", oEx);
            }

            return oXriD;
        }
Exemplo n.º 4
0
    } // main()
    
    /*
    ****************************************************************************
    * process()
    ****************************************************************************
    */ /**
    * Executes the xrilookup command as indicated by the input args. See 
    * outputUsage for the forms of invocation and details about the program 
    * arguments.
    * 
    * @param sArgs - command line arguments (e.g., from main)
    * @param sOutput - program output (e.g., for stdout)
    * 
    * @return SUCCESS or FAILURE
    */
    public int process(StringBuilder sOutput, String[] sArgs) 
    {
        try 
        {
            // re-initialize variables so this may be called more than once
            sOutput.Length = 0;
            msTargetXRI = null;
            mbIsVerbose = false;
            msRootEqualsURI = ROOT_DEF_EQ_URI;
            msRootAtURI     = ROOT_DEF_AT_URI;
            msRootBangURI   = ROOT_DEF_BANG_URI;
            msProxyURI      = null;
            mbCheckRoots    = true;
            msRootFile      = null;

            try {
            	setTrustType(TRUST_TYPE);
            }
            catch (Exception e) {
				Logger.Error("setTrustType failed", e);
            }
            

            // exit with message if no arguments passed on the command line
            if (sArgs.Length == 0) 
            {
                outputPleaseTypeHelp(sOutput); 
                return FAILURE;
            }
            
            // this is the "help" form of invocation (usage 2)
            if (sArgs[0].Equals(CMD_HELP, StringComparison.OrdinalIgnoreCase))
            {
                outputUsage(sOutput);
                return SUCCESS;
            }
            
            // from here on, we're dealing with the "normal" form of invocation
            // (usage 1).
            // scan the args, setting member variables for options, rootURI, 
            // and resolve XRI
            int iResult = scanArgs(sOutput, sArgs);
            if (iResult == FAILURE)
            {
                return FAILURE;
            }
            
            // validate that the root uris are ok
            if (mbCheckRoots)
            {
                iResult = validateRootURIs(sOutput);
                if (iResult == FAILURE)
                {
                    return FAILURE;
                }
            }       
            
            
            // create and configure a resolver
            Resolver resolver = new Resolver();
            
            // populate the root with whatever trustType the user requested
            String trustParam = ";" + trustType.getParameterPair();
            
            XRD eqRoot = new XRD();
            Service eqAuthService = new Service();
            eqAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + trustParam, SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
            eqAuthService.addType(Tags.SERVICE_AUTH_RES);
            eqAuthService.addURI(msRootEqualsURI);
            eqRoot.addService(eqAuthService);
            
            XRD atRoot = new XRD();
            Service atAuthService = new Service();
            atAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + trustParam, SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
            atAuthService.addType(Tags.SERVICE_AUTH_RES);
            atAuthService.addURI(msRootAtURI);
            atRoot.addService(atAuthService);
            
            XRD bangRoot = new XRD();
            Service bangAuthService = new Service();
            bangAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + trustParam, SEPElement.MATCH_ATTR_CONTENT, Boolean.FALSE);
            bangAuthService.addType(Tags.SERVICE_AUTH_RES);
            bangAuthService.addURI(msRootBangURI);
            bangRoot.addService(bangAuthService);
            
            resolver.setAuthority("=", eqRoot);
            resolver.setAuthority("@", atRoot);
            resolver.setAuthority("!", bangRoot);
            
            if (msRootFile != null)
            {
                setRootsFromFile(resolver, msRootFile);
            }
              
            
            // invoke the tracert
            lookup(sOutput, resolver);
            
        }
        catch (Throwable oThrowable)
        {
            outputException(sOutput, oThrowable);
            return FAILURE;
        }
        return SUCCESS;
    }
Exemplo n.º 5
0
 /*
 ****************************************************************************
 * addXRIDescriptor()
 ****************************************************************************
 */
 /**
  * Adds the specified XRI Descriptor to the chain
  */
 public void addXRIDescriptor(XRD oXRID)
 {
     moXRIDescriptors.add(oXRID);
 }
Exemplo n.º 6
0
 public XRDErrorStatusException(XRD xrd)
     : base("XRD contains a non-SUCCESS status code")
 {
     XRD = xrd;
 }