Package com.alibaba.citrus.service.uribroker.uri

Examples of com.alibaba.citrus.service.uribroker.uri.URIBroker$BaseURI


        uriName = assertNotNull(trimToNull(uriName), "no uriName");

        URIBrokerService uris = (URIBrokerService) getCurrentComponent().getApplicationContext().getBean(
                "uriBrokerService", URIBrokerService.class);

        URIBroker uri = assertNotNull(uris.getURIBroker(uriName), "could not find uri broker named \"%s\"", uriName);

        setRedirectLocation(uri);

        return new RedirectParametersImpl(uriName, uri);
    }
View Full Code Here


    /**
     * ȡ��ָ�����Ƶ�URI broker��
     */
    public URIBroker getURIBroker(String name) {
        URIBroker broker = brokers.get(name);
        return broker == null ? null : broker.fork();
    }
View Full Code Here

        // ����name��broker��ӳ��
        Map<String, URIBrokerInfo> brokerInfoMap = createLinkedHashMap();

        for (URIBrokerInfo brokerInfo : brokerInfos) {
            URIBroker broker = assertNotNull(brokerInfo == null ? null : brokerInfo.broker, "broker");

            brokerInfo.name = assertNotNull(trimToNull(brokerInfo.name), "broker ID");
            brokerInfo.parentName = trimToNull(brokerInfo.parentName);

            assertTrue(!brokerInfoMap.containsKey(brokerInfo.name), "duplicated broker ID: %s", brokerInfo.name);

            brokerInfoMap.put(brokerInfo.name, brokerInfo);
            brokers.put(brokerInfo.name, broker);
            names.add(brokerInfo.name);

            if (brokerInfo.exposed) {
                exposedNames.add(brokerInfo.name);
            }

            // ���ö���uri��Ĭ��ֵ������������requestAware�����򱣳�broker�е�Ĭ��ֵ
            if (requestAware != null && brokerInfo.parentName == null) {
                broker.setRequestAwareDefault(requestAware);
            }

            // ���ö���uri��Ĭ��ֵ������������defaultCharset�����򱣳�Ĭ�ϵ�broker charset��
            if (defaultCharset != null && brokerInfo.parentName == null && broker.getCharset() == null) {
                broker.setCharset(defaultCharset);
            }

            broker.setRequest(request);
        }

        brokerInfos = null;

        // import uris
        if (!isEmptyArray(importUris)) {
            for (URIBrokerService importUriBrokerService : importUris) {
                Set<String> exposedImportNames = createHashSet(importUriBrokerService.getExposedNames());

                for (String name : importUriBrokerService.getNames()) {
                    // ����ǰ�ļ��е�uri����parent�е�ͬ��uri��
                    if (brokers.containsKey(name)) {
                        continue;
                    }

                    URIBroker uri = importUriBrokerService.getURIBroker(name);

                    if (uri.isAutoReset() && uri.getParent() != null && !uri.getParent().isAutoReset()) {
                        uri = uri.getParent();
                    } else {
                        uri = uri.fork(false);
                    }

                    brokers.put(name, uri);
                    names.add(name);

                    if (exposedImportNames.contains(name)) {
                        exposedNames.add(name);
                    }
                }
            }
        }

        // ����parent brokers��ȷ��parent broker��������Ҳ�Ǹ����ͬ�࣬ͬʱȷ��û�еݹ�����
        for (Map.Entry<String, URIBrokerInfo> entry : brokerInfoMap.entrySet()) {
            String name = entry.getKey();
            URIBrokerInfo brokerInfo = entry.getValue();
            String parentName = brokerInfo.parentName;

            // ���̳�����ȷ��û�еݹ�
            checkCyclic(brokerInfoMap, name, parentName);

            if (parentName != null) {
                URIBroker parentBroker = assertNotNull(brokers.get(parentName),
                        "parent \"%s\" not found for broker \"%s\"", parentName, brokerInfo.name);
                URIBroker thisBroker = brokerInfo.broker;

                thisBroker.setParent(parentBroker);
            }
        }

        // �ݹ鸴��parent�е���Ϣ
        for (URIBroker broker : brokers.values()) {
View Full Code Here

        int classWidth = 0;
        int keyWidth = 0;

        for (Map.Entry<String, URIBroker> entry : brokers.entrySet()) {
            String name = entry.getKey();
            URIBroker broker = entry.getValue();
            String className = broker.getClass().getSimpleName();

            if (className.length() > classWidth) {
                classWidth = className.length();
            }

            if (name.length() > keyWidth) {
                keyWidth = name.length();
            }
        }

        for (Map.Entry<String, URIBroker> entry : brokers.entrySet()) {
            String name = entry.getKey();
            URIBroker broker = entry.getValue();

            broker = broker.fork();

            StringBuilder format = new StringBuilder();

            if (exposedNames.contains(name)) {
                format.append("* ");
            } else {
                format.append("  ");
            }

            format.append("%-").append(classWidth + 2).append("s %-").append(keyWidth).append("s= %s%n");

            out.printf(format.toString(), "(" + broker.getClass().getSimpleName() + ")", name, broker);
        }

        out.flush();
    }
View Full Code Here

        /**
         * ����ģ��ʹ�õķ�����ȡ��ָ�����Ƶ�broker��
         */
        public URIBroker get(String name) {
            URIBroker broker = cache.get(name);

            if (broker == null) {
                broker = brokers.getURIBroker(name);

                if (broker == null) {
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.uribroker.uri.URIBroker$BaseURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.