/// <summary>
        /// Create a ValidationPolicyCommandInterest with default Options.
        /// </summary>
        ///
        /// <param name="innerPolicy"></param>
        /// <exception cref="System.AssertionError">if innerPolicy is null.</exception>
        public ValidationPolicyCommandInterest(ValidationPolicy innerPolicy)
        {
            this.container_             = new ArrayList <LastTimestampRecord>();
            this.nowOffsetMilliseconds_ = 0;
            options_ = new ValidationPolicyCommandInterest.Options();

            if (innerPolicy == null)
            {
                throw new AssertionError("inner policy is missing");
            }

            setInnerPolicy(innerPolicy);
        }
예제 #2
0
        /// <summary>
        /// Create a Validator with the policy. Use a CertificateFetcherOffline
        /// (assuming that the validation policy doesn't need to fetch certificates).
        /// </summary>
        ///
        /// <param name="policy">The validation policy to be associated with this validator.</param>
        public Validator(ValidationPolicy policy)
        {
            policy_             = policy;
            certificateFetcher_ = new CertificateFetcherOffline();
            maxDepth_           = 25;

            if (policy_ == null)
            {
                throw new ArgumentException("The policy is null");
            }

            policy_.setValidator(this);
            certificateFetcher_.setCertificateStorage(this);
        }
예제 #3
0
        /// <summary>
        /// Create a Validator with the policy and fetcher.
        /// </summary>
        ///
        /// <param name="policy">The validation policy to be associated with this validator.</param>
        /// <param name="certificateFetcher">The certificate fetcher implementation.</param>
        public Validator(ValidationPolicy policy,
                         CertificateFetcher certificateFetcher)
        {
            policy_             = policy;
            certificateFetcher_ = certificateFetcher;
            maxDepth_           = 25;

            if (policy_ == null)
            {
                throw new ArgumentException("The policy is null");
            }
            if (certificateFetcher_ == null)
            {
                throw new ArgumentException("The certificateFetcher is null");
            }

            policy_.setValidator(this);
            certificateFetcher_.setCertificateStorage(this);
        }
        /// <summary>
        /// Create a ValidationPolicyCommandInterest.
        /// </summary>
        ///
        /// <param name="innerPolicy"></param>
        /// <param name="options">The stop-and-wait command Interest validation options.</param>
        /// <exception cref="System.AssertionError">if innerPolicy is null.</exception>
        public ValidationPolicyCommandInterest(ValidationPolicy innerPolicy,
                                               ValidationPolicyCommandInterest.Options options)
        {
            this.container_             = new ArrayList <LastTimestampRecord>();
            this.nowOffsetMilliseconds_ = 0;
            // Copy the Options.
            options_ = new ValidationPolicyCommandInterest.Options(options);

            if (innerPolicy == null)
            {
                throw new AssertionError("inner policy is missing");
            }

            setInnerPolicy(innerPolicy);

            if (options_.gracePeriod_ < 0.0d)
            {
                options_.gracePeriod_ = 0.0d;
            }
        }
예제 #5
0
        /// <summary>
        /// Set the inner policy.
        /// Multiple assignments of the inner policy will create a "chain" of linked
        /// policies. The inner policy from the latest invocation of setInnerPolicy
        /// will be at the bottom of the policy list.
        /// For example, the sequence `this.setInnerPolicy(policy1)` and
        /// `this.setInnerPolicy(policy2)`, will result in
        /// `this.innerPolicy_ == policy1`,
        /// this.innerPolicy_.innerPolicy_ == policy2', and
        /// `this.innerPolicy_.innerPolicy_.innerPolicy_ == null`.
        /// </summary>
        ///
        /// <exception cref="System.ArgumentException">if the innerPolicy is null.</exception>
        public void setInnerPolicy(ValidationPolicy innerPolicy)
        {
            if (innerPolicy == null)
            {
                throw new ArgumentException(
                          "The innerPolicy argument cannot be null");
            }

            if (validator_ != null)
            {
                innerPolicy.setValidator(validator_);
            }

            if (innerPolicy_ == null)
            {
                innerPolicy_ = innerPolicy;
            }
            else
            {
                innerPolicy_.setInnerPolicy(innerPolicy);
            }
        }