Example #1
0
  /** Initialize statically. */
  private void initializeStatically() {
    bindingProcesor.initializeBindings();
    stopwatch.resetAndLog("Binding initialization");

    for (InjectorShell shell : shells) {
      shell.getInjector().index();
    }
    stopwatch.resetAndLog("Binding indexing");

    injectionRequestProcessor.process(shells);
    stopwatch.resetAndLog("Collecting injection requests");

    bindingProcesor.runCreationListeners();
    stopwatch.resetAndLog("Binding validation");

    injectionRequestProcessor.validate();
    stopwatch.resetAndLog("Static validation");

    initializer.validateOustandingInjections(errors);
    stopwatch.resetAndLog("Instance member validation");

    new LookupProcessor(errors).process(shells);
    for (InjectorShell shell : shells) {
      ((DeferredLookups) shell.getInjector().lookups).initialize(errors);
    }
    stopwatch.resetAndLog("Provider verification");

    for (InjectorShell shell : shells) {
      if (!shell.getElements().isEmpty()) {
        throw new AssertionError("Failed to execute " + shell.getElements());
      }
    }

    errors.throwCreationExceptionIfErrorsExist();
  }
 private void processNonBindingAssertions(BindingProcessor bindingProcessor)
     throws PolicyException {
   for (AssertionSet assertionSet : effectivePolicy) {
     for (PolicyAssertion assertion : assertionSet) {
       if (PolicyUtil.isBinding(assertion, spVersion)) {
         continue;
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((SupportingTokens) assertion);
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isSignedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((SignedSupportingTokens) assertion);
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isEndorsedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((EndorsingSupportingTokens) assertion);
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isSignedEndorsingSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((SignedEndorsingSupportingTokens) assertion);
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isSignedEncryptedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((SignedEncryptedSupportingTokens) assertion);
         isIssuedTokenAsEncryptedSupportingToken(
             bindingProcessor.isIssuedTokenAsEncryptedSupportingToken());
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isEncryptedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((EncryptedSupportingTokens) assertion);
         isIssuedTokenAsEncryptedSupportingToken(
             bindingProcessor.isIssuedTokenAsEncryptedSupportingToken());
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isEndorsingEncryptedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens((EndorsingEncryptedSupportingTokens) assertion);
         isIssuedTokenAsEncryptedSupportingToken(
             bindingProcessor.isIssuedTokenAsEncryptedSupportingToken());
       } else if (!ignoreST
           && shouldAddST()
           && PolicyUtil.isSignedEndorsingEncryptedSupportingToken(assertion, spVersion)) {
         bindingProcessor.processSupportingTokens(
             (SignedEndorsingEncryptedSupportingTokens) assertion);
         isIssuedTokenAsEncryptedSupportingToken(
             bindingProcessor.isIssuedTokenAsEncryptedSupportingToken());
       } else if (PolicyUtil.isWSS10(assertion, spVersion)) {
         wssAssertion = assertion;
       } else if (PolicyUtil.isWSS11(assertion, spVersion)) {
         wssAssertion = assertion;
       } else if (PolicyUtil.isTrust10(assertion, spVersion)) {
         trust10 = (Trust10) assertion;
       } else if (PolicyUtil.isTrust13(assertion, spVersion)) {
         trust13 = (Trust13) assertion;
       }
     }
   }
 }