Example usage for java.util Vector iterator

List of usage examples for java.util Vector iterator

Introduction

In this page you can find the example usage for java.util Vector iterator.

Prototype

public synchronized Iterator<E> iterator() 

Source Link

Document

Returns an iterator over the elements in this list in proper sequence.

Usage

From source file:org.ecoinformatics.seek.sms.AnnotationEngine.java

/**
 * helper function to find all class names
 * //  w ww  .j a v  a  2s .c o  m
 *@param classname
 *            Description of the Parameter
 *@param approx
 *            Description of the Parameter
 *@return The matchingClassNames value
 */
private Vector<OntClass> getMatchingClassNames(String classname, boolean approx) {
    Vector<OntClass> initResult = new Vector<OntClass>();
    // get all classes in ontology
    Iterator iter = ontModelOntology().listClasses();
    while (iter.hasNext()) {
        // find classes that have a similar name
        OntClass cls = (OntClass) iter.next();
        if (approx && approxMatch(cls.getLocalName(), classname)) {
            initResult.add(cls);
        } else if (!approx && classname.equals(cls.getLocalName())) {
            initResult.add(cls);
        }
    }
    Vector<OntClass> result = (Vector) initResult.clone();
    iter = initResult.iterator();
    while (iter.hasNext()) {
        // find all subclasses of direct classes
        OntClass cls = (OntClass) iter.next();
        Iterator clsIter = cls.listSubClasses(false);
        // direct = false
        while (clsIter.hasNext()) {
            OntClass subCls = (OntClass) clsIter.next();
            if (!result.contains(subCls)) {
                result.add(subCls);
            }
        }
    }
    return result;
}

From source file:org.apache.rampart.builder.AsymmetricBindingBuilder.java

private void doEncryptBeforeSig(RampartMessageData rmd) throws RampartException {

    long t0 = 0, t1 = 0, t2 = 0;
    if (tlog.isDebugEnabled()) {
        t0 = System.currentTimeMillis();
    }/*  w w  w  . j av a2s  .com*/
    RampartPolicyData rpd = rmd.getPolicyData();
    Document doc = rmd.getDocument();
    RampartConfig config = rpd.getRampartConfig();

    /*
     * We need to hold on to these two element to use them as refence in the
     * case of encypting the signature
     */
    Element encrDKTokenElem = null;
    WSSecEncrypt encr = null;
    Element refList = null;
    WSSecDKEncrypt dkEncr = null;

    /*
     * We MUST use keys derived from the same token
     */
    Token encryptionToken = null;
    if (rmd.isInitiator()) {
        encryptionToken = rpd.getRecipientToken();
    } else {
        encryptionToken = rpd.getInitiatorToken();
    }
    Vector encrParts = RampartUtil.getEncryptedParts(rmd);

    //Signed parts are determined before encryption because encrypted signed  headers
    //will not be included otherwise
    this.sigParts = RampartUtil.getSignedParts(rmd);

    if (encryptionToken == null && encrParts.size() > 0) {
        throw new RampartException("encryptionTokenMissing");
    }

    if (encryptionToken != null && encrParts.size() > 0) {

        //Check for RampartConfig assertion
        if (rpd.getRampartConfig() == null) {
            //We'er missing the extra info rampart needs
            throw new RampartException("rampartConigMissing");
        }

        if (encryptionToken.isDerivedKeys()) {
            try {
                this.setupEncryptedKey(rmd, encryptionToken);
                // Create the DK encryption builder
                dkEncr = new WSSecDKEncrypt();
                dkEncr.setParts(encrParts);
                dkEncr.setExternalKey(this.encryptedKeyValue, this.encryptedKeyId);
                dkEncr.setDerivedKeyLength(rpd.getAlgorithmSuite().getEncryptionDerivedKeyLength() / 8);
                dkEncr.prepare(doc);

                // Get and add the DKT element
                this.encrDKTElement = dkEncr.getdktElement();
                encrDKTokenElem = RampartUtil.appendChildToSecHeader(rmd, this.encrDKTElement);

                refList = dkEncr.encryptForExternalRef(null, encrParts);

            } catch (WSSecurityException e) {
                throw new RampartException("errorCreatingEncryptedKey", e);
            } catch (ConversationException e) {
                throw new RampartException("errorInDKEncr", e);
            }
        } else {
            try {
                encr = new WSSecEncrypt();
                encr.setParts(encrParts);
                encr.setWsConfig(rmd.getConfig());
                encr.setDocument(doc);
                RampartUtil.setEncryptionUser(rmd, encr);
                encr.setSymmetricEncAlgorithm(rpd.getAlgorithmSuite().getEncryption());
                RampartUtil.setKeyIdentifierType(rmd, encr, encryptionToken);
                encr.setKeyEncAlgo(rpd.getAlgorithmSuite().getAsymmetricKeyWrap());
                encr.prepare(doc, RampartUtil.getEncryptionCrypto(config, rmd.getCustomClassLoader()));

                Element bstElem = encr.getBinarySecurityTokenElement();
                if (bstElem != null) {
                    RampartUtil.appendChildToSecHeader(rmd, bstElem);
                }

                this.encrTokenElement = encr.getEncryptedKeyElement();
                this.encrTokenElement = RampartUtil.appendChildToSecHeader(rmd, encrTokenElement);

                refList = encr.encryptForExternalRef(null, encrParts);

            } catch (WSSecurityException e) {
                throw new RampartException("errorInEncryption", e);
            }
        }

        RampartUtil.appendChildToSecHeader(rmd, refList);

        if (tlog.isDebugEnabled()) {
            t1 = System.currentTimeMillis();
        }

        this.setInsertionLocation(encrTokenElement);

        RampartUtil.handleEncryptedSignedHeaders(encrParts, this.sigParts, doc);

        HashMap sigSuppTokMap = null;
        HashMap endSuppTokMap = null;
        HashMap sgndEndSuppTokMap = null;
        HashMap sgndEncSuppTokMap = null;
        HashMap endEncSuppTokMap = null;
        HashMap sgndEndEncSuppTokMap = null;

        if (this.timestampElement != null) {
            sigParts.add(
                    new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement) this.timestampElement)));
        }

        if (rmd.isInitiator()) {

            // Now add the supporting tokens
            SupportingToken sgndSuppTokens = rpd.getSignedSupportingTokens();
            sigSuppTokMap = this.handleSupportingTokens(rmd, sgndSuppTokens);

            SupportingToken endSuppTokens = rpd.getEndorsingSupportingTokens();
            endSuppTokMap = this.handleSupportingTokens(rmd, endSuppTokens);

            SupportingToken sgndEndSuppTokens = rpd.getSignedEndorsingSupportingTokens();
            sgndEndSuppTokMap = this.handleSupportingTokens(rmd, sgndEndSuppTokens);

            SupportingToken sgndEncryptedSuppTokens = rpd.getSignedEncryptedSupportingTokens();
            sgndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEncryptedSuppTokens);

            SupportingToken endorsingEncryptedSuppTokens = rpd.getEndorsingEncryptedSupportingTokens();
            endEncSuppTokMap = this.handleSupportingTokens(rmd, endorsingEncryptedSuppTokens);

            SupportingToken sgndEndEncSuppTokens = rpd.getSignedEndorsingEncryptedSupportingTokens();
            sgndEndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEndEncSuppTokens);

            Vector supportingToks = rpd.getSupportingTokensList();
            for (int i = 0; i < supportingToks.size(); i++) {
                this.handleSupportingTokens(rmd, (SupportingToken) supportingToks.get(i));
            }

            SupportingToken encryptedSupportingToks = rpd.getEncryptedSupportingTokens();
            this.handleSupportingTokens(rmd, encryptedSupportingToks);

            //Setup signature parts
            sigParts = addSignatureParts(sigSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEncSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEndSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEndEncSuppTokMap, sigParts);

        } else {
            addSignatureConfirmation(rmd, sigParts);
        }

        if ((sigParts.size() > 0 && rmd.isInitiator() && rpd.getInitiatorToken() != null)
                || (!rmd.isInitiator() && rpd.getRecipientToken() != null)) {
            if (rpd.getInitiatorToken() instanceof IssuedToken) {
                String sigTokId = rmd.getIssuedSignatureTokenId();
                org.apache.rahas.Token sigTok = null;
                Element sigTokElem = null;
                sigToken = rpd.getInitiatorToken();
                if (!(sigToken instanceof KerberosToken)) {
                    sigTok = getToken(rmd, sigTokId);
                    if (5 == sigToken.getInclusion() || 2 == sigToken.getInclusion()
                            || rmd.isInitiator() && 3 == sigToken.getInclusion())
                        sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken());
                    else if (rmd.isInitiator() && (sigToken instanceof X509Token)
                            || (sigToken instanceof SecureConversationToken))
                        sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken());
                }
                if (sigTokElem != null)
                    setInsertionLocation(sigTokElem);
                doSymmSignature(rmd, rpd.getInitiatorToken(), sigTok, sigParts);
            } else {
                doSignature(rmd);
            }

        }

        if (rmd.isInitiator()) {

            endSuppTokMap.putAll(endEncSuppTokMap);
            // Do endorsed signatures
            Vector endSigVals = this.doEndorsedSignatures(rmd, endSuppTokMap);
            for (Iterator iter = endSigVals.iterator(); iter.hasNext();) {
                signatureValues.add(iter.next());
            }

            sgndEndSuppTokMap.putAll(sgndEndEncSuppTokMap);
            // Do signed endorsing signatures
            Vector sigEndSigVals = this.doEndorsedSignatures(rmd, sgndEndSuppTokMap);
            for (Iterator iter = sigEndSigVals.iterator(); iter.hasNext();) {
                signatureValues.add(iter.next());
            }
        }

        if (tlog.isDebugEnabled()) {
            t2 = System.currentTimeMillis();
            tlog.debug("Encryption took :" + (t1 - t0) + ", Signature tool :" + (t2 - t1));
        }

        // Check for signature protection
        if (rpd.isSignatureProtection() && this.mainSigId != null) {
            long t3 = 0, t4 = 0;
            if (tlog.isDebugEnabled()) {
                t3 = System.currentTimeMillis();
            }
            Vector secondEncrParts = new Vector();

            // Now encrypt the signature using the above token
            secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element"));

            if (rmd.isInitiator()) {
                for (int i = 0; i < encryptedTokensIdList.size(); i++) {
                    secondEncrParts.add(new WSEncryptionPart((String) encryptedTokensIdList.get(i), "Element"));
                }
            }

            Element secondRefList = null;

            if (encryptionToken.isDerivedKeys()) {
                try {

                    secondRefList = dkEncr.encryptForExternalRef(null, secondEncrParts);
                    RampartUtil.insertSiblingAfter(rmd, encrDKTokenElem, secondRefList);

                } catch (WSSecurityException e) {
                    throw new RampartException("errorCreatingEncryptedKey", e);
                }
            } else {
                try {
                    // Encrypt, get hold of the ref list and add it
                    secondRefList = encr.encryptForExternalRef(null, secondEncrParts);

                    // Insert the ref list after the encrypted key elem
                    this.setInsertionLocation(
                            RampartUtil.insertSiblingAfter(rmd, encrTokenElement, secondRefList));
                } catch (WSSecurityException e) {
                    throw new RampartException("errorInEncryption", e);
                }
            }
            if (tlog.isDebugEnabled()) {
                t4 = System.currentTimeMillis();
                tlog.debug("Signature protection took :" + (t4 - t3));
            }
        }
    }

}

From source file:org.apache.rampart.builder.AsymmetricBindingBuilder.java

private void doSignBeforeEncrypt(RampartMessageData rmd) throws RampartException {

    long t0 = 0, t1 = 0, t2 = 0;

    RampartPolicyData rpd = rmd.getPolicyData();
    Document doc = rmd.getDocument();

    HashMap sigSuppTokMap = null;
    HashMap endSuppTokMap = null;
    HashMap sgndEndSuppTokMap = null;
    HashMap sgndEncSuppTokMap = null;
    HashMap endEncSuppTokMap = null;
    HashMap sgndEndEncSuppTokMap = null;

    sigParts = RampartUtil.getSignedParts(rmd);

    //Add timestamp
    if (this.timestampElement != null) {
        sigParts.add(new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement) this.timestampElement)));
    } else {//  w w  w. j a  va2 s  . c om
        this.setInsertionLocation(null);
    }

    if (tlog.isDebugEnabled()) {
        t0 = System.currentTimeMillis();
    }

    if (rmd.isInitiator()) {

        //      Now add the supporting tokens
        SupportingToken sgndSuppTokens = rpd.getSignedSupportingTokens();
        sigSuppTokMap = this.handleSupportingTokens(rmd, sgndSuppTokens);

        SupportingToken endSuppTokens = rpd.getEndorsingSupportingTokens();
        endSuppTokMap = this.handleSupportingTokens(rmd, endSuppTokens);

        SupportingToken sgndEndSuppTokens = rpd.getSignedEndorsingSupportingTokens();
        sgndEndSuppTokMap = this.handleSupportingTokens(rmd, sgndEndSuppTokens);

        SupportingToken sgndEncryptedSuppTokens = rpd.getSignedEncryptedSupportingTokens();
        sgndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEncryptedSuppTokens);

        SupportingToken endorsingEncryptedSuppTokens = rpd.getEndorsingEncryptedSupportingTokens();
        endEncSuppTokMap = this.handleSupportingTokens(rmd, endorsingEncryptedSuppTokens);

        SupportingToken sgndEndEncSuppTokens = rpd.getSignedEndorsingEncryptedSupportingTokens();
        sgndEndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEndEncSuppTokens);

        Vector supportingToks = rpd.getSupportingTokensList();
        for (int i = 0; i < supportingToks.size(); i++) {
            this.handleSupportingTokens(rmd, (SupportingToken) supportingToks.get(i));
        }

        SupportingToken encryptedSupportingToks = rpd.getEncryptedSupportingTokens();
        this.handleSupportingTokens(rmd, encryptedSupportingToks);

        //Setup signature parts
        sigParts = addSignatureParts(sigSuppTokMap, sigParts);
        sigParts = addSignatureParts(sgndEncSuppTokMap, sigParts);
        sigParts = addSignatureParts(sgndEndSuppTokMap, sigParts);
        sigParts = addSignatureParts(sgndEndEncSuppTokMap, sigParts);

    } else {
        addSignatureConfirmation(rmd, sigParts);
    }

    if (sigParts.size() > 0 && ((rmd.isInitiator() && rpd.getInitiatorToken() != null)
            || (!rmd.isInitiator() && rpd.getRecipientToken() != null))) {
        if (rpd.getInitiatorToken() instanceof IssuedToken && rmd.isInitiator()) {
            String sigTokId = rmd.getIssuedSignatureTokenId();
            org.apache.rahas.Token sigTok = null;
            Element sigTokElem = null;
            sigToken = rpd.getInitiatorToken();
            if (!(sigToken instanceof KerberosToken)) {
                sigTok = getToken(rmd, sigTokId);
                if (5 == sigToken.getInclusion() || 2 == sigToken.getInclusion()
                        || rmd.isInitiator() && 3 == sigToken.getInclusion())
                    sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken());
                else if (rmd.isInitiator() && (sigToken instanceof X509Token)
                        || (sigToken instanceof SecureConversationToken))
                    sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken());
            }
            if (sigTokElem != null)
                setInsertionLocation(sigTokElem);
            doSymmSignature(rmd, rpd.getInitiatorToken(), sigTok, sigParts);
        } else {
            doSignature(rmd);
        }
    }

    Vector supportingToks = rpd.getSupportingPolicyData();
    for (int i = 0; i < supportingToks.size(); i++) {
        SupportingPolicyData policyData = null;
        if (supportingToks.get(i) != null) {
            policyData = (SupportingPolicyData) supportingToks.get(i);
            Vector supportingSigParts = RampartUtil.getSupportingSignedParts(rmd, policyData);

            if (supportingSigParts.size() > 0 && ((rmd.isInitiator() && rpd.getInitiatorToken() != null)
                    || (!rmd.isInitiator() && rpd.getRecipientToken() != null))) {
                // Do signature for policies defined under SupportingToken.
                this.doSupportingSignature(rmd, supportingSigParts, policyData);
            }
        }
    }

    //Do endorsed signature

    if (rmd.isInitiator()) {

        // Adding the endorsing encrypted supporting tokens to endorsing supporting tokens
        endSuppTokMap.putAll(endEncSuppTokMap);
        // Do endorsed signatures
        Vector endSigVals = this.doEndorsedSignatures(rmd, endSuppTokMap);
        for (Iterator iter = endSigVals.iterator(); iter.hasNext();) {
            signatureValues.add(iter.next());
        }

        //Adding the signed endorsed encrypted tokens to signed endorsed supporting tokens
        sgndEndSuppTokMap.putAll(sgndEndEncSuppTokMap);
        // Do signed endorsing signatures
        Vector sigEndSigVals = this.doEndorsedSignatures(rmd, sgndEndSuppTokMap);
        for (Iterator iter = sigEndSigVals.iterator(); iter.hasNext();) {
            signatureValues.add(iter.next());
        }
    }

    if (tlog.isDebugEnabled()) {
        t1 = System.currentTimeMillis();
    }

    Vector encrParts = RampartUtil.getEncryptedParts(rmd);

    //Check for signature protection
    if (rpd.isSignatureProtection() && this.mainSigId != null) {
        encrParts.add(new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement) this.signatureElement),
                "Element"));
    }

    if (rmd.isInitiator()) {
        for (int i = 0; i < encryptedTokensIdList.size(); i++) {
            encrParts.add(new WSEncryptionPart((String) encryptedTokensIdList.get(i), "Element"));
        }
    }

    //Do encryption
    Token encrToken;
    if (rmd.isInitiator()) {
        encrToken = rpd.getRecipientToken();
    } else {
        encrToken = rpd.getInitiatorToken();
    }

    if (encrToken != null && encrParts.size() > 0) {
        Element refList = null;
        AlgorithmSuite algorithmSuite = rpd.getAlgorithmSuite();
        if (encrToken.isDerivedKeys()) {

            try {
                WSSecDKEncrypt dkEncr = new WSSecDKEncrypt();

                if (this.encrKey == null) {
                    this.setupEncryptedKey(rmd, encrToken);
                }

                dkEncr.setExternalKey(this.encryptedKeyValue, this.encryptedKeyId);
                dkEncr.setCustomValueType(WSConstants.SOAPMESSAGE_NS11 + "#" + WSConstants.ENC_KEY_VALUE_TYPE);
                dkEncr.setSymmetricEncAlgorithm(algorithmSuite.getEncryption());
                dkEncr.setDerivedKeyLength(algorithmSuite.getEncryptionDerivedKeyLength() / 8);
                dkEncr.prepare(doc);

                if (this.encrTokenElement != null) {
                    this.encrDKTElement = RampartUtil.insertSiblingAfter(rmd, this.encrTokenElement,
                            dkEncr.getdktElement());
                } else {
                    this.encrDKTElement = RampartUtil.insertSiblingBefore(rmd, this.sigDKTElement,
                            dkEncr.getdktElement());
                }

                refList = dkEncr.encryptForExternalRef(null, encrParts);

                RampartUtil.insertSiblingAfter(rmd, this.encrDKTElement, refList);

            } catch (WSSecurityException e) {
                throw new RampartException("errorInDKEncr", e);
            } catch (ConversationException e) {
                throw new RampartException("errorInDKEncr", e);
            }
        } else {
            try {

                WSSecEncrypt encr = new WSSecEncrypt();

                RampartUtil.setKeyIdentifierType(rmd, encr, encrToken);

                encr.setWsConfig(rmd.getConfig());

                encr.setDocument(doc);
                RampartUtil.setEncryptionUser(rmd, encr);
                encr.setSymmetricEncAlgorithm(algorithmSuite.getEncryption());
                encr.setKeyEncAlgo(algorithmSuite.getAsymmetricKeyWrap());
                encr.prepare(doc,
                        RampartUtil.getEncryptionCrypto(rpd.getRampartConfig(), rmd.getCustomClassLoader()));

                if (this.timestampElement != null) {
                    this.setInsertionLocation(this.timestampElement);
                } else {
                    this.setInsertionLocation(null);
                }

                if (encr.getBSTTokenId() != null) {
                    this.setInsertionLocation(RampartUtil.insertSiblingAfterOrPrepend(rmd,
                            this.getInsertionLocation(), encr.getBinarySecurityTokenElement()));
                }

                Element encryptedKeyElement = encr.getEncryptedKeyElement();

                //Encrypt, get hold of the ref list and add it
                refList = encr.encryptForInternalRef(null, encrParts);

                //Add internal refs
                encryptedKeyElement.appendChild(refList);

                this.setInsertionLocation(RampartUtil.insertSiblingAfterOrPrepend(rmd,
                        this.getInsertionLocation(), encryptedKeyElement));

                //                    RampartUtil.insertSiblingAfter(rmd,
                //                                                    this.getInsertionLocation(),
                //                                                    refList);
            } catch (WSSecurityException e) {
                throw new RampartException("errorInEncryption", e);
            }
        }
    }

    Vector supportingTokens = rpd.getSupportingPolicyData();
    for (int i = 0; i < supportingTokens.size(); i++) {
        SupportingPolicyData policyData = null;
        if (supportingTokens.get(i) != null) {
            policyData = (SupportingPolicyData) supportingTokens.get(i);
            Token supportingEncrToken = policyData.getEncryptionToken();
            Vector supoortingEncrParts = RampartUtil.getSupportingEncryptedParts(rmd, policyData);

            if (supportingEncrToken != null && supoortingEncrParts.size() > 0) {
                doEncryptionWithSupportingToken(rpd, rmd, supportingEncrToken, doc, supoortingEncrParts);
            }
        }
    }

    if (tlog.isDebugEnabled()) {
        t2 = System.currentTimeMillis();
        tlog.debug("Signature took :" + (t1 - t0) + ", Encryption took :" + (t2 - t1));
    }

}

From source file:org.apache.rampart.builder.SymmetricBindingBuilder.java

private void doEncryptBeforeSig(RampartMessageData rmd) throws RampartException {

    long t0 = 0, t1 = 0, t2 = 0;

    RampartPolicyData rpd = rmd.getPolicyData();

    Vector signatureValues = new Vector();

    if (tlog.isDebugEnabled()) {
        t0 = System.currentTimeMillis();
    }//w  w  w .j  a v a 2s  . c om

    Token encryptionToken = rpd.getEncryptionToken();
    Vector encrParts = RampartUtil.getEncryptedParts(rmd);

    Vector sigParts = RampartUtil.getSignedParts(rmd);

    if (encryptionToken == null && encrParts.size() > 0) {
        throw new RampartException("encryptionTokenMissing");
    }

    if (encryptionToken != null && encrParts.size() > 0) {
        // The encryption token can be an IssuedToken or a
        // SecureConversationToken
        String tokenId = null;
        org.apache.rahas.Token tok = null;

        if (encryptionToken instanceof IssuedToken) {
            tokenId = rmd.getIssuedEncryptionTokenId();
            if (log.isDebugEnabled()) {
                log.debug("Issued EncryptionToken Id : " + tokenId);
            }
        } else if (encryptionToken instanceof SecureConversationToken) {
            tokenId = rmd.getSecConvTokenId();
            if (log.isDebugEnabled()) {
                log.debug("SCT Id : " + tokenId);
            }
        } else if (encryptionToken instanceof X509Token) {
            if (rmd.isInitiator()) {
                tokenId = setupEncryptedKey(rmd, encryptionToken);
            } else {
                tokenId = getEncryptedKey(rmd);
            }
        } // TODO SAMLToken

        if (tokenId == null || tokenId.length() == 0) {
            throw new RampartException("noSecurityToken");
        }

        // Hack to handle reference id issues
        // TODO Need a better fix
        if (tokenId.startsWith("#")) {
            tokenId = tokenId.substring(1);
        }

        /*
         * Get hold of the token from the token storage
         */
        tok = this.getToken(rmd, tokenId);

        /*
         * Attach the token into the message based on token inclusion values
         */
        boolean attached = false;
        Element encrTokenElement = null;
        Element refList = null;
        WSSecDKEncrypt dkEncr = null;
        WSSecEncrypt encr = null;
        Element encrDKTokenElem = null;

        if (SPConstants.INCLUDE_TOEKN_ALWAYS == encryptionToken.getInclusion()
                || SPConstants.INCLUDE_TOKEN_ONCE == encryptionToken.getInclusion() || (rmd.isInitiator()
                        && SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT == encryptionToken.getInclusion())) {
            encrTokenElement = RampartUtil.appendChildToSecHeader(rmd, tok.getToken());
            attached = true;
        } else if (encryptionToken instanceof X509Token && rmd.isInitiator()) {
            encrTokenElement = RampartUtil.appendChildToSecHeader(rmd, tok.getToken());
        }

        Document doc = rmd.getDocument();

        AlgorithmSuite algorithmSuite = rpd.getAlgorithmSuite();
        if (encryptionToken.isDerivedKeys()) {
            log.debug("Use drived keys");

            dkEncr = new WSSecDKEncrypt();

            if (attached && tok.getAttachedReference() != null) {

                dkEncr.setExternalKey(tok.getSecret(),
                        (Element) doc.importNode((Element) tok.getAttachedReference(), true));

            } else if (tok.getUnattachedReference() != null) {
                dkEncr.setExternalKey(tok.getSecret(),
                        (Element) doc.importNode((Element) tok.getUnattachedReference(), true));
            } else {
                dkEncr.setExternalKey(tok.getSecret(), tok.getId());
            }
            try {
                dkEncr.setSymmetricEncAlgorithm(algorithmSuite.getEncryption());
                dkEncr.setDerivedKeyLength(algorithmSuite.getEncryptionDerivedKeyLength() / 8);
                dkEncr.prepare(doc);
                encrDKTokenElem = dkEncr.getdktElement();
                RampartUtil.appendChildToSecHeader(rmd, encrDKTokenElem);

                refList = dkEncr.encryptForExternalRef(null, encrParts);

            } catch (WSSecurityException e) {
                throw new RampartException("errorInDKEncr");
            } catch (ConversationException e) {
                throw new RampartException("errorInDKEncr");
            }
        } else {
            log.debug("NO derived keys, use the shared secret");
            encr = new WSSecEncrypt();

            encr.setWsConfig(rmd.getConfig());
            encr.setEncKeyId(tokenId);
            RampartUtil.setEncryptionUser(rmd, encr);
            encr.setEphemeralKey(tok.getSecret());
            encr.setDocument(doc);
            encr.setSymmetricEncAlgorithm(algorithmSuite.getEncryption());
            // SymmKey is already encrypted, no need to do it again
            encr.setEncryptSymmKey(false);
            if (!rmd.isInitiator() && tok instanceof EncryptedKeyToken) {
                encr.setUseKeyIdentifier(true);
                encr.setCustomReferenceValue(((EncryptedKeyToken) tok).getSHA1());
                encr.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
            }

            try {

                encr.prepare(doc,
                        RampartUtil.getEncryptionCrypto(rpd.getRampartConfig(), rmd.getCustomClassLoader()));
                // Encrypt, get hold of the ref list and add it
                refList = encr.encryptForExternalRef(null, encrParts);
            } catch (WSSecurityException e) {
                throw new RampartException("errorInEncryption", e);
            }
        }

        this.mainRefListElement = RampartUtil.appendChildToSecHeader(rmd, refList);

        if (tlog.isDebugEnabled()) {
            t1 = System.currentTimeMillis();
        }

        // Sometimes encryption token is not included in the the message
        if (encrTokenElement != null) {
            this.setInsertionLocation(encrTokenElement);
        } else if (timestampElement != null) {
            this.setInsertionLocation(timestampElement);
        }

        RampartUtil.handleEncryptedSignedHeaders(encrParts, sigParts, doc);

        HashMap sigSuppTokMap = null;
        HashMap endSuppTokMap = null;
        HashMap sgndEndSuppTokMap = null;
        HashMap sgndEncSuppTokMap = null;
        HashMap endEncSuppTokMap = null;
        HashMap sgndEndEncSuppTokMap = null;

        if (this.timestampElement != null) {
            sigParts.add(
                    new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement) this.timestampElement)));
        }

        if (rmd.isInitiator()) {

            // Now add the supporting tokens
            SupportingToken sgndSuppTokens = rpd.getSignedSupportingTokens();
            sigSuppTokMap = this.handleSupportingTokens(rmd, sgndSuppTokens);

            SupportingToken endSuppTokens = rpd.getEndorsingSupportingTokens();
            endSuppTokMap = this.handleSupportingTokens(rmd, endSuppTokens);

            SupportingToken sgndEndSuppTokens = rpd.getSignedEndorsingSupportingTokens();
            sgndEndSuppTokMap = this.handleSupportingTokens(rmd, sgndEndSuppTokens);

            SupportingToken sgndEncryptedSuppTokens = rpd.getSignedEncryptedSupportingTokens();
            sgndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEncryptedSuppTokens);

            SupportingToken endorsingEncryptedSuppTokens = rpd.getEndorsingEncryptedSupportingTokens();
            endEncSuppTokMap = this.handleSupportingTokens(rmd, endorsingEncryptedSuppTokens);

            SupportingToken sgndEndEncSuppTokens = rpd.getSignedEndorsingEncryptedSupportingTokens();
            sgndEndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEndEncSuppTokens);

            Vector supportingToks = rpd.getSupportingTokensList();
            for (int i = 0; i < supportingToks.size(); i++) {
                this.handleSupportingTokens(rmd, (SupportingToken) supportingToks.get(i));
            }

            SupportingToken encryptedSupportingToks = rpd.getEncryptedSupportingTokens();
            this.handleSupportingTokens(rmd, encryptedSupportingToks);

            // Setup signature parts
            sigParts = addSignatureParts(sigSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEncSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEndSuppTokMap, sigParts);
            sigParts = addSignatureParts(sgndEndEncSuppTokMap, sigParts);

        } else {
            addSignatureConfirmation(rmd, sigParts);
        }

        // Sign the message
        // We should use the same key in the case of EncryptBeforeSig
        if (sigParts.size() > 0) {
            signatureValues.add(this.doSymmSignature(rmd, encryptionToken, tok, sigParts));
            this.mainSigId = RampartUtil.addWsuIdToElement((OMElement) this.getInsertionLocation());
        }

        if (rmd.isInitiator()) {

            endSuppTokMap.putAll(endEncSuppTokMap);
            // Do endorsed signatures
            Vector endSigVals = this.doEndorsedSignatures(rmd, endSuppTokMap);
            for (Iterator iter = endSigVals.iterator(); iter.hasNext();) {
                signatureValues.add(iter.next());
            }

            sgndEndSuppTokMap.putAll(sgndEndEncSuppTokMap);
            // Do signed endorsing signatures
            Vector sigEndSigVals = this.doEndorsedSignatures(rmd, sgndEndSuppTokMap);
            for (Iterator iter = sigEndSigVals.iterator(); iter.hasNext();) {
                signatureValues.add(iter.next());
            }
        }

        if (tlog.isDebugEnabled()) {
            t2 = System.currentTimeMillis();
            tlog.debug("Encryption took :" + (t1 - t0) + ", Signature tool :" + (t2 - t1));
        }

        // Check for signature protection and encryption of UsernameToken
        if (rpd.isSignatureProtection() && this.mainSigId != null
                || encryptedTokensIdList.size() > 0 && rmd.isInitiator()) {
            long t3 = 0, t4 = 0;
            if (tlog.isDebugEnabled()) {
                t3 = System.currentTimeMillis();
            }
            log.debug("Signature protection");
            Vector secondEncrParts = new Vector();

            // Now encrypt the signature using the above token
            if (rpd.isSignatureProtection()) {
                secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element"));
            }

            if (rmd.isInitiator()) {
                for (int i = 0; i < encryptedTokensIdList.size(); i++) {
                    secondEncrParts.add(new WSEncryptionPart((String) encryptedTokensIdList.get(i), "Element"));
                }
            }

            Element secondRefList = null;

            if (encryptionToken.isDerivedKeys()) {
                try {
                    secondRefList = dkEncr.encryptForExternalRef(null, secondEncrParts);
                    RampartUtil.insertSiblingAfter(rmd, encrDKTokenElem, secondRefList);
                } catch (WSSecurityException e) {
                    throw new RampartException("errorInDKEncr");
                }
            } else {
                try {
                    // Encrypt, get hold of the ref list and add it
                    secondRefList = encr.encryptForExternalRef(null, encrParts);
                    RampartUtil.insertSiblingAfter(rmd, encrTokenElement, secondRefList);
                } catch (WSSecurityException e) {
                    throw new RampartException("errorInEncryption", e);
                }
            }
            if (tlog.isDebugEnabled()) {
                t4 = System.currentTimeMillis();
                tlog.debug("Signature protection took :" + (t4 - t3));
            }
        }

    } else {
        throw new RampartException("encryptionTokenMissing");
    }
}

From source file:com.vsquaresystem.safedeals.location.LocationService.java

public boolean saveExcelToDatabase() throws IOException {
    Vector dataHolder = read();
    dataHolder.remove(0);/*from  ww w  .j  a va  2 s .c o m*/
    Location location = new Location();
    String id = "";
    String name = "";
    String description = "";
    String cityId = "";
    String locationTypeId = "";
    String locationCategories = "";
    String safedealZoneId = "";
    String majorApproachRoad = "";
    String advantage = "";
    String disadvantage = "";
    String population = "";
    String latitude = "";
    String longitude = "";
    String sourceOfWater = "";
    String publicTransport = "";
    String migrationRate = "";
    String distanceCenterCity = "";
    String isCommercialCenter = "";
    String distanceCommercialCenter = "";
    String imageUrl = "";

    System.out.println("line1785SAVE sop" + dataHolder);
    DataFormatter formatter = new DataFormatter();
    for (Iterator iterator = dataHolder.iterator(); iterator.hasNext();) {
        List list = (List) iterator.next();
        name = list.get(0).toString();
        description = list.get(1).toString();
        cityId = list.get(2).toString();
        locationTypeId = list.get(3).toString();
        locationCategories = list.get(4).toString();
        safedealZoneId = list.get(5).toString();
        majorApproachRoad = list.get(6).toString();
        advantage = list.get(7).toString();
        disadvantage = list.get(8).toString();
        population = list.get(9).toString();
        latitude = list.get(10).toString();
        longitude = list.get(11).toString();
        sourceOfWater = list.get(12).toString();
        publicTransport = list.get(13).toString();
        migrationRate = list.get(14).toString();
        distanceCenterCity = list.get(15).toString();
        isCommercialCenter = list.get(16).toString();
        distanceCommercialCenter = list.get(17).toString();
        imageUrl = list.get(18).toString();
        List<String> strList = new ArrayList<String>(Arrays.asList(locationCategories.split(",")));
        List<Integer> numberList = new ArrayList<Integer>();
        for (String number : strList) {
            numberList.add(Integer.parseInt(number));
        }
        try {
            location.setName(name);
            location.setDescription(description);
            location.setCityId(Integer.parseInt(cityId));
            location.setLocationTypeId(Integer.parseInt(locationTypeId));
            location.setLocationCategories(numberList);
            location.setSafedealZoneId(Integer.parseInt(safedealZoneId));
            location.setMajorApproachRoad(majorApproachRoad);
            location.setAdvantage(advantage);
            location.setDisadvantage(disadvantage);
            location.setPopulation(Integer.parseInt(population));
            location.setLatitude(Double.parseDouble(latitude));
            location.setLongitude(Double.parseDouble(longitude));
            location.setMigrationRatePerAnnum(MigrationRatePerAnnum.valueOf(migrationRate));
            location.setDistanceFromCentreOfCity(Double.parseDouble(distanceCenterCity));
            location.setDistanceFromCommercialCenter(Double.parseDouble(distanceCommercialCenter));
            location.setIsCommercialCenter(Boolean.valueOf(isCommercialCenter));
            location.setImageUrl(imageUrl);

            System.out.println("location line167 CHECKcheck" + location);
            System.out.println("numberList" + numberList);
            locationDAL.insert(location);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    File excelFile = attachmentUtils.getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.LOCATION);
    FileUtils.cleanDirectory(excelFile);
    return true;

}

From source file:de.escidoc.core.test.aa.UserGroupTestBase.java

/**
 * Get the XML taskParam for the method removeSelectors.
 *
 * @param lastModificationDate The timestamp of the resource.
 * @return Returns the created task param xml.
 * @throws Exception Thrown if anything fails.
 *//*w  w  w  .  j  av  a 2 s .  c  om*/
public String getRemoveSelectorsTaskParam(final Vector<String> selectorIds, final String lastModificationDate)
        throws Exception {

    String param = "<param last-modification-date=\"" + lastModificationDate + "\" ";
    param += " xmlns:user-group=\"http://www.escidoc.de/schemas/usergroup/0.6\" >";
    Iterator<String> iterator = selectorIds.iterator();
    while (iterator.hasNext()) {
        String selectorId = iterator.next();

        param += "<id>" + selectorId + "</id>";

    }
    param += "</param>";
    return param;
}

From source file:org.kepler.sms.NamedOntModel.java

/**
 * @return The root classes, i.e., without a named superclass, for this
 *         ontology./*from w w  w .j a  v  a 2 s  .co  m*/
 */
public Iterator<NamedOntClass> getRootClasses(boolean sorted) {
    // get all the classesg
    Vector<OWLClass> classes = new Vector(_ontology.getReferencedClasses());
    Vector<NamedOntClass> results = new Vector();
    boolean foundResult = true;
    // check each class to see if a root
    for (OWLClass c : _ontology.getReferencedClasses()) { // TODO: Is this an appropriate replacement for listNamedClasses()?
        for (OWLDescription superClassAxiom : c.getSuperClasses(_ontology)) {

            if (!superClassAxiom.isAnonymous()) {
                OWLClass s = superClassAxiom.asOWLClass();
                if (classes.contains(s)) {
                    foundResult = false;
                    break;
                }
            }
        }

        if (foundResult) {
            results.add(new NamedOntClass(c, _ontology));
        }
        foundResult = true;
    }
    if (sorted)
        Collections.sort(results);
    return results.iterator();
}

From source file:com.bright.assetbank.application.servlet.ApplicationActionServlet.java

public void init()/*     */ throws ServletException
/*     */ {//w  w w. j a  v a 2s. c om
    /*     */ try
    /*     */ {
        /*  82 */ setupGlobalSettings();
        /*     */ }
    /*     */ catch (Throwable te)
    /*     */ {
        /*  87 */ System.out.println("ApplicationActionServlet.init: Bn2Exception: " + te.getMessage());
        /*     */ }
    /*     */
    /*  91 */ String[] noStoreActions = getServletConfig().getInitParameter("noStoreGetActions")
            .split("[,\t\n ]+");
    /*  92 */ this.m_noStoreActionSet = new HashSet((int) ((noStoreActions.length + 1) * 1.5D));
    /*  93 */ this.m_noStoreActionSet.addAll(Arrays.asList(noStoreActions));
    /*     */
    /*  95 */ boolean bSuspendLicenseValidation = false;
    /*  96 */ boolean bLicenseValid = false;
    /*  97 */ boolean bLicenseException = false;
    /*  98 */ int iLicenseDaysLeft = 0;
    /*  99 */ String sLicenseDate = "";
    /* 100 */ String sLicenseType = "";
    /* 101 */ boolean bLicenseNeverExpires = false;
    /* 102 */ boolean bLicenseIPUnbound = false;
    /* 103 */ boolean bLicenseWebappUnbound = false;
    /*     */
    /* 106 */ String sLicenseIPs = "";
    /*     */
    /* 109 */ String sLicenseWebapps = "";
    /*     */ try
    /*     */ {
        /* 114 */ LicenseManager licManager = LicenseManager.getInstance();
        /* 115 */ bLicenseValid = licManager.isValid();
        /* 116 */ iLicenseDaysLeft = licManager.daysLeft();
        /* 117 */ sLicenseIPs = licManager.getFeature("IP");
        /* 118 */ sLicenseWebapps = licManager.getFeature("Webapp");
        /* 119 */ sLicenseDate = licManager.getFeature("Expiration");
        /* 120 */ sLicenseType = licManager.getFeature("Type");
        /*     */ }
    /*     */ catch (Throwable e)
    /*     */ {
        /* 124 */ bLicenseValid = false;
        /* 125 */ bLicenseException = true;
        /*     */ }
    /*     */
    /* 128 */ bLicenseNeverExpires = (iLicenseDaysLeft == 0) && ((sLicenseDate == null)
            || (sLicenseDate.length() == 0) || (sLicenseDate.compareToIgnoreCase("never") == 0));
    /* 129 */ bLicenseIPUnbound = (sLicenseIPs == null) || (sLicenseIPs.length() == 0);
    /* 130 */ bLicenseWebappUnbound = (sLicenseWebapps == null) || (sLicenseWebapps.length() == 0);
    /*     */
    /* 133 */ boolean bIPValid = false;
    /* 134 */ boolean bIPException = false;
    /* 135 */ String sLocalIPs = "";
    /* 136 */ Vector vecLocalIPs = new Vector();
    /* 137 */ String sValidIP = "";
    /*     */
    /* 139 */ if (bLicenseIPUnbound)
    /*     */ {
        /* 141 */ bIPValid = true;
        /*     */ }
    /*     */ else
    /*     */ {
        /*     */ try
        /*     */ {
            /* 148 */ Vector vecLicensedIPs = StringUtil.convertToVector(sLicenseIPs, ",");
            /*     */
            /* 151 */ InetAddress ipLocalhost = InetAddress.getLocalHost();
            /* 152 */ InetAddress[] arrAddress = InetAddress.getAllByName(ipLocalhost.getHostName());
            /* 153 */ for (int i = 0; i < arrAddress.length; i++)
            /*     */ {
                /* 158 */ String sIP = arrAddress[i].getHostAddress().trim();
                /* 159 */ vecLocalIPs.add(sIP);
                /* 160 */ sLocalIPs = sLocalIPs + sIP + ", ";
                /*     */ }
            /*     */
            /* 164 */ Iterator it = vecLicensedIPs.iterator();
            /* 165 */ while (it.hasNext())
            /*     */ {
                /* 167 */ String sLicensedIP = (String) it.next();
                /*     */
                /* 169 */ Iterator itLocal = vecLocalIPs.iterator();
                /* 170 */ while (itLocal.hasNext())
                /*     */ {
                    /* 172 */ String sLocalIP = (String) itLocal.next();
                    /*     */
                    /* 174 */ if (sLicensedIP.trim().compareToIgnoreCase(sLocalIP) == 0)
                    /*     */ {
                        /* 176 */ bIPValid = true;
                        /* 177 */ sValidIP = sLocalIP;
                        /* 178 */ break;
                        /*     */ }
                    /*     */ }
                /*     */
                /* 182 */ if (bIPValid)
                /*     */ {
                    /*     */ break;
                    /*     */ }
                /*     */ }
            /*     */
            /*     */ }
        /*     */ catch (UnknownHostException e)
        /*     */ {
            /* 191 */ bIPValid = false;
            /* 192 */ bIPException = true;
            /*     */ }
        /*     */
        /*     */ }
    /*     */
    /* 197 */ boolean bWebappValid = false;
    /* 198 */ String sLocalWebapp = "";
    /*     */
    /* 200 */ if (bLicenseWebappUnbound)
    /*     */ {
        /* 202 */ bWebappValid = true;
        /*     */ }
    /*     */ else
    /*     */ {
        /* 207 */ Vector vecLicensedWebapps = StringUtil.convertToVector(sLicenseWebapps, ",");
        /*     */
        /* 210 */ String sApplicationPath = getServletContext().getRealPath("");
        /* 211 */ File dir = new File(sApplicationPath);
        /* 212 */ sLocalWebapp = dir.getName();
        /*     */
        /* 215 */ Iterator it = vecLicensedWebapps.iterator();
        /* 216 */ while (it.hasNext())
        /*     */ {
            /* 218 */ String sLicensedWebapp = (String) it.next();
            /*     */
            /* 220 */ if (sLicensedWebapp.trim().compareToIgnoreCase(sLocalWebapp) == 0)
            /*     */ {
                /* 222 */ bWebappValid = true;
                /* 223 */ break;
                /*     */ }
            /*     */ }
        /*     */
        /*     */ }
    /*     */
    /* 229 */ boolean bTypeValid = false;
    /*     */
    /* 231 */ bTypeValid = checkLicenseType(sLicenseType);
    /*     */
    /* 234 */ if (((!bLicenseValid) || (!bIPValid) || (!bWebappValid) || (!bTypeValid))
            && (!bSuspendLicenseValidation))
    /*     */ {
        /* 236 */ GlobalApplication.getInstance().suspendWebsite();
        /*     */ }
    /*     */
    /* 240 */ if (AssetBankSettings.isApplicationUpdateInProgress())
    /*     */ {
        /* 243 */ GlobalApplication.getInstance().setSkipStartups(true);
        /*     */ }
    /*     */
    /* 247 */ if (AssetBankSettings.getRequiresEndorsedLibs())
    /*     */ {
        /* 249 */ addEndorsedLibToSystemProperties();
        /*     */ }
    /*     */
    /* 253 */ super.init();
    /*     */
    /* 256 */ if (!bLicenseValid)
    /*     */ {
        /* 258 */ GlobalApplication.getInstance().getLogger()
                .error("ApplicationActionServlet.init: License validation failed.");
        /*     */ }
    /* 260 */ if (bLicenseException)
    /*     */ {
        /* 262 */ GlobalApplication.getInstance().getLogger().error(
                "ApplicationActionServlet.init: Error in license validation is most likely due to missing license file. Check under WEB-INF/classes.");
        /*     */ }
    /* 264 */ if (!bTypeValid)
    /*     */ {
        /* 266 */ GlobalApplication.getInstance().getLogger().info(
                "ApplicationActionServlet.init: License validation failed: License is of the incorrect type");
        /*     */ }
    /* 268 */ if (bIPValid)
    /*     */ {
        /* 270 */ GlobalApplication.getInstance().getLogger()
                .info("ApplicationActionServlet.init: License valid for IP address: " + sValidIP);
        /*     */ }
    /*     */ else
    /*     */ {
        /* 274 */ GlobalApplication.getInstance().getLogger()
                .error("ApplicationActionServlet.init: License validation failed: IP address " + sLocalIPs
                        + " not in permitted range: " + sLicenseIPs);
        /*     */ }
    /* 276 */ if (bIPException)
    /*     */ {
        /* 278 */ GlobalApplication.getInstance().getLogger()
                .error("ApplicationActionServlet.init: Error in reading IP address of local host server.");
        /*     */ }
    /* 280 */ if (bWebappValid)
    /*     */ {
        /* 282 */ GlobalApplication.getInstance().getLogger()
                .info("ApplicationActionServlet.init: License valid for webapp: " + sLocalWebapp);
        /*     */ }
    /*     */ else
    /*     */ {
        /* 286 */ GlobalApplication.getInstance().getLogger()
                .error("ApplicationActionServlet.init: License validation failed: webapp " + sLocalWebapp
                        + " not in permitted range: " + sLicenseWebapps);
        /*     */ }
    /*     */
    /* 289 */ if ((bLicenseNeverExpires) && (bLicenseValid))
    /*     */ {
        /* 291 */ GlobalApplication.getInstance().getLogger()
                .info("ApplicationActionServlet.init: License never expires.");
        /*     */ }
    /*     */ else
    /*     */ {
        /* 295 */ if (iLicenseDaysLeft < 0)
        /*     */ {
            /* 297 */ GlobalApplication.getInstance().getLogger()
                    .error("ApplicationActionServlet.init: License expired!");
            /*     */ }
        /* 299 */ GlobalApplication.getInstance().getLogger()
                .info("ApplicationActionServlet.init: License days left: " + iLicenseDaysLeft);
        /*     */ }
    /*     */
    /* 303 */ GlobalApplication.getInstance().getLogger().info(
            "ApplicationActionServlet.init: Application Version: " + AssetBankSettings.getApplicationVersion());
    /*     */
    /* 307 */ ABUserProfile.setUserProfileFactory(new ABUserProfileFactory());
    /*     */
    /* 312 */ HTTPUtil.setProxySettings();
    /*     */ }

From source file:com.silverwrist.dynamo.app.ApplicationContainer.java

public void postUpdate(DynamicUpdateEvent event) {
    if (logger.isDebugEnabled())
        logger.debug("PostDynamicUpdate: posting an event of type " + event.getClass().getName());
    Class klass = event.getClass();
    for (;;) { // get the event listeners
        Vector vec = (Vector) (m_update_listeners.get(klass));
        if (vec != null) { // call the event handlers
            Iterator it = vec.iterator();
            while (it.hasNext())
                ((DynamicUpdateListener) (it.next())).updateReceived(event);

        } // end if

        if (klass == DynamicUpdateEvent.class)
            break;

        klass = klass.getSuperclass();//  w  ww  . j a v a2 s  .co  m

    } // end for (ever)

}

From source file:org.ptg.cep.SQLParserGenerator.java

public String handleCustom(ZExpression ze, int depth, Map<String, ZFromItem> frms) {
    // System.out.println("Custom operator");
    String str = "";
    boolean second = false;
    Vector<ZExp> operands = ze.getOperands();
    Iterator<ZExp> opi = operands.iterator();
    ZExp op = null;/* ww  w. j a v  a2 s .  c  om*/
    List<ZConstant> params = new ArrayList<ZConstant>();
    while (opi.hasNext()) {
        op = opi.next();
        if (op instanceof ZConstant) {
            ZConstant zc = (ZConstant) op;
            params.add(zc);
        } else {
            throw new IllegalArgumentException("Parameter cannot be anything else then ZCOnstant");
        }
    }
    pop();
    return "(" + printCustomMatchExpr(depth, ze.getOperator(), frms, params.toArray(new ZConstant[0])) + ")";
}