Package com.alibaba.citrus.service.pull

Examples of com.alibaba.citrus.service.pull.PullContext


     * ȡ��template context��
     */
    private TemplateContext getTemplateContext() {
        if (templateContext == null) {
            PullService pullService = getPullService();
            PullContext pullContext = null;

            if (pullService != null) {
                pullContext = pullService.getContext();
            }

View Full Code Here


    private Context parent;
    private Context context;

    @Before
    public void init() {
        PullContext pullContext = createMock(PullContext.class);

        expect(pullContext.pull("pull1")).andReturn(111).anyTimes();
        expect(pullContext.pull("pull2")).andReturn(222).anyTimes();

        Set<String> names = createHashSet(Arrays.asList("pull1", "pull2"));
        expect(pullContext.getToolNames()).andReturn(names).anyTimes();

        expect(pullContext.pull(org.easymock.EasyMock.<String>anyObject())).andReturn(null).anyTimes();

        replay(pullContext);

        parent = new PullableMappedContext(pullContext);
        parent.put("parent", 333);
View Full Code Here

            attrs = RequestContextHolder.currentRequestAttributes();
        } catch (IllegalStateException e) {
            getLogger().debug("Getting pull context in non-WEB environment: {}", e.getMessage());
        }

        PullContext context;

        if (attrs == null) {
            context = new PullContextImpl();
        } else {
            context = (PullContext) attrs.getAttribute(contextKey, SCOPE_REQUEST);
View Full Code Here

    /** 取得template context。 */
    private TemplateContext getTemplateContext() {
        if (templateContext == null) {
            PullService pullService = getPullService();
            PullContext pullContext = null;

            if (pullService != null) {
                pullContext = pullService.getContext();
            }

View Full Code Here

    public PullToolsVisitor(RequestHandlerContext context, ExplorerVisitor v, PullService tools) {
        super(context, v);
        this.tools = tools;
        this.rootEntry = new Entry(null);

        PullContext pullContext = tools.getContext();
        boolean parentEntry = false;

        String[] names = pullContext.getQualifiedToolNames().toArray(EMPTY_STRING_ARRAY);

        Arrays.sort(names, new Comparator<String>() {
            public int compare(String o1, String o2) {
                int p1 = o1.startsWith("/_parent/") ? 1 : 0;
                int p2 = o2.startsWith("/_parent/") ? 1 : 0;

                if (p1 == p2) {
                    return o1.compareTo(o2);
                } else {
                    return p1 - p2;
                }
            }
        });

        for (String path : names) {
            Entry entry = rootEntry;
            String[] pathsegs = split(path, "/");
            String name = null;

            for (String pathseg : pathsegs) {
                name = pathseg;
                Entry subEntry = entry.subEntries.get(name);

                if (subEntry == null) {
                    subEntry = new Entry(name);
                    entry.subEntries.put(name, subEntry);
                }

                entry = subEntry;

                if (!parentEntry) {
                    if ("_parent".equals(entry.name)) {
                        parentEntry = true;
                    }
                }

                entry.parentEntry = parentEntry;
            }

            try {
                entry.value = pullContext.pull(name);
            } catch (Exception e) {
                entry.value = e;
            }
        }
    }
View Full Code Here

    public PullToolsVisitor(RequestHandlerContext context, ExplorerVisitor v, PullService tools) {
        super(context, v);
        this.tools = tools;
        this.rootEntry = new Entry(null);

        PullContext pullContext = tools.getContext();
        boolean parentEntry = false;

        String[] names = pullContext.getQualifiedToolNames().toArray(EMPTY_STRING_ARRAY);

        Arrays.sort(names, new Comparator<String>() {
            public int compare(String o1, String o2) {
                int p1 = o1.startsWith("/_parent/") ? 1 : 0;
                int p2 = o2.startsWith("/_parent/") ? 1 : 0;

                if (p1 == p2) {
                    return o1.compareTo(o2);
                } else {
                    return p1 - p2;
                }
            }
        });

        for (String path : names) {
            Entry entry = rootEntry;
            String[] pathsegs = split(path, "/");
            String name = null;

            for (String pathseg : pathsegs) {
                name = pathseg;
                Entry subEntry = entry.subEntries.get(name);

                if (subEntry == null) {
                    subEntry = new Entry(name);
                    entry.subEntries.put(name, subEntry);
                }

                entry = subEntry;

                if (!parentEntry) {
                    if ("_parent".equals(entry.name)) {
                        parentEntry = true;
                    }
                }

                entry.parentEntry = parentEntry;
            }

            try {
                entry.value = pullContext.pull(name);
            } catch (Exception e) {
                entry.value = e;
            }
        }
    }
View Full Code Here

            attrs = RequestContextHolder.currentRequestAttributes();
        } catch (IllegalStateException e) {
            getLogger().debug("Getting pull context in non-WEB environment: {}", e.getMessage());
        }

        PullContext context;

        if (attrs == null) {
            context = new PullContextImpl();
        } else {
            context = (PullContext) attrs.getAttribute(contextKey, SCOPE_REQUEST);
View Full Code Here

     * ȡ��template context��
     */
    private TemplateContext getTemplateContext() {
        if (templateContext == null) {
            PullService pullService = getPullService();
            PullContext pullContext = null;

            if (pullService != null) {
                pullContext = pullService.getContext();
            }

View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.pull.PullContext

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.