options.java

来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,690 行 · 第 1/5 页

JAVA
1,690
字号
    }

    /**
     * This method checks to see if additional work needs to be
     * done in order to complete the object reconstitution.
     * Some parts of the object restored from the readExternal()
     * cannot be completed until we have a configurationContext
     * from the active engine. The configurationContext is used
     * to help this object to plug back into the engine's
     * configuration and deployment objects.
     *
     * @param cc The configuration context object representing the active configuration
     */
    public void activate(ConfigurationContext cc) {
        // see if there's any work to do
        if (!needsToBeReconciled) {
            // return quick
            return;
        }

        String logCorrelationIDString = getLogCorrelationIDString();
        // use the supplied configuration context

        // get the axis configuration
        AxisConfiguration axisConfig = cc.getAxisConfiguration();

        // We previously saved metaTransportIn; restore it
        if (metaTransportIn != null) {
            QName qin = metaTransportIn.getQName();
            TransportInDescription tmpIn = null;
            try {
                tmpIn = axisConfig.getTransportIn(qin.getLocalPart());
            }
            catch (Exception exin) {
                // if a fault is thrown, log it and continue
                log.trace(logCorrelationIDString +
                        "activate():  exception caught when getting the TransportInDescription [" +
                        qin.toString() + "]  from the AxisConfiguration [" +
                        exin.getClass().getName() + " : " + exin.getMessage() + "]");
            }

            if (tmpIn != null) {
                transportIn = tmpIn;
            } else {
                log.trace(logCorrelationIDString +
                        "activate():  No TransportInDescription found for [" + qin.toString() +
                        "]");

                transportIn = null;
            }
        } else {
            log.trace(logCorrelationIDString + "activate():  No TransportInDescription ");

            transportIn = null;
        }

        // We previously saved metaTransportOut; restore it
        if (metaTransportOut != null) {
            QName qout = metaTransportOut.getQName();
            TransportOutDescription tmpOut = null;
            try {
                tmpOut = axisConfig.getTransportOut(qout.getLocalPart());
            }
            catch (Exception exout) {
                // if a fault is thrown, log it and continue
                log.trace(logCorrelationIDString +
                        "activate():  exception caught when getting the TransportOutDescription [" +
                        qout.toString() + "]  from the AxisConfiguration [" +
                        exout.getClass().getName() + " : " + exout.getMessage() + "]");
            }

            if (tmpOut != null) {
                transportOut = tmpOut;
            } else {
                log.trace(logCorrelationIDString +
                        "activate():  No TransportOutDescription found for [" + qout.toString() +
                        "]");

                transportOut = null;
            }
        } else {
            log.trace(logCorrelationIDString + "activate():  No TransportOutDescription ");

            transportOut = null;
        }

        // We previously saved metaListener; restore it
        if (metaListener != null) {
            // see if we can find an existing object
            String listenerClass = metaListener.getClassName();
            log.trace(logCorrelationIDString + "activate():  TransportListener found for [" +
                    listenerClass + "] ");
        } else {
            listener = null;

            log.trace(logCorrelationIDString + "activate():  No TransportListener ");
        }

        //-------------------------------------------------------
        // done, reset the flag
        //-------------------------------------------------------
        needsToBeReconciled = false;
    }


    /**
     * Compares key parts of the state from the current instance of
     * this class with the specified instance to see if they are
     * equivalent.
     * <p/>
     * This differs from the java.lang.Object.equals() method in
     * that the equals() method generally looks at both the
     * object identity (location in memory) and the object state
     * (data).
     * <p/>
     *
     * @param obj The object to compare with
     * @return TRUE if this object is equivalent with the specified object
     *         that is, key fields match
     *         FALSE, otherwise
     */
    public boolean isEquivalent(Options obj) {
        // NOTE: the input object is expected to exist (ie, be non-null)

        if (this.timeOutInMilliSeconds != obj.getTimeOutInMilliSeconds()) {
            return false;
        }

        if (this.isExceptionToBeThrownOnSOAPFault.booleanValue() !=
                obj.isExceptionToBeThrownOnSOAPFault()) {
            return false;
        }

        if (this.useSeparateListener.booleanValue() != obj.isUseSeparateListener()) {
            return false;
        }

        if (this.manageSession != obj.isManageSession()) {
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.soapVersionURI != null) && (obj.getSoapVersionURI() != null)) {
            if (!this.soapVersionURI.equals(obj.getSoapVersionURI())) {
                return false;
            }
        } else if ((this.soapVersionURI == null) && (obj.getSoapVersionURI() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.action != null) && (obj.getAction() != null)) {
            if (!this.action.equals(obj.getAction())) {
                return false;
            }
        } else if ((this.action == null) && (obj.getAction() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.transportInProtocol != null) && (obj.getTransportInProtocol() != null)) {
            if (!this.transportInProtocol.equals(obj.getTransportInProtocol())) {
                return false;
            }
        } else if ((this.transportInProtocol == null) && (obj.getTransportInProtocol() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.messageId != null) && (obj.getMessageId() != null)) {
            if (!this.messageId.equals(obj.getMessageId())) {
                return false;
            }
        } else if ((this.messageId == null) && (obj.getMessageId() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.faultTo != null) && (obj.getFaultTo() != null)) {
            if (!this.faultTo.isEquivalent(obj.getFaultTo())) {
                return false;
            }
        } else if ((this.faultTo == null) && (obj.getFaultTo() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.from != null) && (obj.getFrom() != null)) {
            if (!this.from.isEquivalent(obj.getFrom())) {
                return false;
            }
        } else if ((this.from == null) && (obj.getFrom() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.replyTo != null) && (obj.getReplyTo() != null)) {
            if (!this.replyTo.isEquivalent(obj.getReplyTo())) {
                return false;
            }
        } else if ((this.replyTo == null) && (obj.getReplyTo() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.to != null) && (obj.getTo() != null)) {
            if (!this.to.isEquivalent(obj.getTo())) {
                return false;
            }
        } else if ((this.to == null) && (obj.getTo() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        if ((this.properties != null) && (obj.getProperties() != null)) {
            if (!this.properties.equals(obj.getProperties())) {
                // This is a strict test.
                // Returns true if the given object is also a map
                // and the two maps represent the same mappings.
                return false;
            }
        } else if ((this.properties == null) && (obj.getProperties() == null)) {
            // continue
        } else {
            // mismatch
            return false;
        }

        // --------------------------------------------------------------------

        // TODO: consider checking the following objects for equivalency
        //        List relationships;
        //        ArrayList referenceParameters;
        //        TransportListener listener;
        //        TransportInDescription transportIn;
        //        TransportOutDescription transportOut;

        // TODO: consider checking the parent objects for equivalency


        return true;
    }


    /**
     * Get the ID associated with this object instance.
     *
     * @return A string that can be output to a log file as an identifier
     *         for this object instance.  It is suitable for matching related log
     *         entries.
     */
    public String getLogCorrelationIDString() {
        if (logCorrelationIDString == null) {
            logCorrelationIDString = myClassName + "@" + UUIDGenerator.getUUID();
        }
        return logCorrelationIDString;
    }


    /**
     * Trace a warning message, if needed, indicating that this
     * object needs to be activated before accessing certain fields.
     *
     * @param methodname The method where the warning occurs
     */
    private void checkActivateWarning(String methodname) {
        if (needsToBeReconciled) {
            log.warn(getLogCorrelationIDString() + ":" + methodname + "(): ****WARNING**** " +
                    myClassName + ".activate(configurationContext) needs to be invoked.");
        }
    }


    public boolean isCallTransportCleanup() {
        return callTransportCleanup;
    }

    public void setCallTransportCleanup(boolean callTransportCleanup) {
        this.callTransportCleanup = callTransportCleanup;
    }


    public String getUserName() {
        if (userName == null && parent != null) {
            return parent.getUserName();
        }
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        if (password == null && parent != null) {
            return parent.getPassword();
        }
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?