Package org.apache.roller.util

Examples of org.apache.roller.util.Technorati$Result


    }

    private Result scanResultsByExtension(String ns, String actionName, String pathPrefix,
            String resultCode, ActionContext actionContext) {
        Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(parentPackage);
        Result result = null;
        for (String ext : resultsByExtension.keySet()) {
            if (LOG.isTraceEnabled()) {
                String fqan = ns + "/" + actionName;
                LOG.trace("Trying to locate the correct result for the FQ action [#0]"
                        + " with an file extension of [#1] in the directory [#2] " + "and a result code of [#3]",
View Full Code Here


        PackageConfig pkg = configuration.getPackageConfig(actionConfig.getPackageName());
        String ns = pkg.getNamespace();
        String pathPrefix = determinePath(actionConfig, ns);

        Result result = scanResultsByExtension(ns, actionName, pathPrefix, resultCode, actionContext);

        if (result == null) {
            // Try /idx/action/index.jsp
            Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(pkg);
            for (String ext : resultsByExtension.keySet()) {
View Full Code Here

        ObjectFactory workingFactory = configuration.getContainer().getInstance(ObjectFactory.class);
        ConventionUnknownHandler uh = new ConventionUnknownHandler(configuration, workingFactory, context, mockContainer, "struts-default", null, "-");
        ActionContext actionContext = new ActionContext(Collections.EMPTY_MAP);

        Result result = uh.handleUnknownResult(actionContext, "foo", pkgConfig.getActionConfigs().get("foo"), "bar");
        assertNotNull(result);
        assertTrue(result instanceof ActionChainResult);
        ActionChainResult chainResult = (ActionChainResult) result;
        ActionChainResult chainResultToCompare = new ActionChainResult(null, "foo-bar", null);
        assertEquals(chainResultToCompare, chainResult);
View Full Code Here

    /**
     * Iterate over UnknownHandlers and return the result of the first one that can handle it
     */
    public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) {
        for (UnknownHandler unknownHandler : unknownHandlers) {
            Result result = unknownHandler.handleUnknownResult(actionContext, actionName, actionConfig, resultCode);
            if (result != null)
                return result;
        }

        return null;
View Full Code Here

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setContainer(container);
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);

        Result result = actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        Mock invMock = new Mock(ActionInvocation.class);
        ActionInvocation inv = (ActionInvocation) invMock.proxy();
        ActionContext ctx = ActionContext.getContext();
        ctx.put(ServletActionContext.HTTP_REQUEST, request);
        StrutsMockHttpServletResponse response = new StrutsMockHttpServletResponse();
        ctx.put(ServletActionContext.HTTP_RESPONSE, response);
        invMock.expectAndReturn("getInvocationContext", ctx);
        invMock.expectAndReturn("getStack", ctx.getValueStack());
        result.execute(inv);
        assertEquals("http://www.google.com", response.getRedirectURL());
        //TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setContainer(container);
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);
       

        Result result = actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        // TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here

            proxy.setMethod(method);
            request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack());

            // if the ActionMapping says to go straight to a result, do it!
            if (mapping.getResult() != null) {
                Result result = mapping.getResult();
                result.execute(proxy.getInvocation());
            } else {
                proxy.execute();
            }

            // If there was a previous value stack then set it back onto the request
View Full Code Here

                request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);

                ActionContext savedContext = savedInvocation.getInvocationContext();
                savedContext.getContextMap().put(ServletActionContext.HTTP_REQUEST, request);
                savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response);
                Result result = savedInvocation.getResult();

                if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
                    synchronized (context) {
                        result.execute(savedInvocation);
                    }
                }

                // turn off execution of this invocations result
                invocation.getProxy().setExecuteResult(false);
View Full Code Here

        int inboundlinks = -1;
        int inboundblogs = -1;
        if (form.getSiteUrl()!=null && form.getSiteUrl().trim().length() > 0) {
            try {
                PlanetConfigData config = planet.getConfiguration();
                Technorati technorati = null;
                if (config.getProxyHost()!=null && config.getProxyPort() > 0) {
                    technorati = new Technorati(
                            config.getProxyHost(), config.getProxyPort());
                } else {
                    technorati = new Technorati();
                }
                Technorati.Result result =
                        technorati.getBloginfo(form.getSiteUrl());
                technoratiTitle = result.getWeblog().getName();
                technoratiFeedUrl = result.getWeblog().getRssurl();
                form.setInboundlinks(result.getWeblog().getInboundlinks());
                form.setInboundblogs(result.getWeblog().getInboundblogs());
            } catch (Exception e) {
View Full Code Here

        int count = 0;
        int errorCount = 0;
        try {
            PlanetManager planet = roller.getPlanetManager();
            PlanetConfigData config = planet.getConfiguration();
            Technorati technorati = null;
            try {
                if (config.getProxyHost()!=null && config.getProxyPort() != -1) {
                    technorati = new Technorati(
                            config.getProxyHost(), config.getProxyPort());
                } else {
                    technorati = new Technorati();
                }
            } catch (IOException e) {
                logger.error("Aborting collection of Technorati rankings.\n"
                +"technorati.license not found at root of classpath.\n"
                +"Get license at http://technorati.com/developers/apikey.html\n"
                +"Put the license string in a file called technorati.license.\n"
                +"And place that file at the root of Roller's classpath.\n"
                +"For example, in the /WEB-INF/classes directory.");
                return;
            }
            UserManager userManager = roller.getUserManager();
            try {
                int limit = RollerConfig.getIntProperty(
                    "planet.aggregator.technorati.limit", 500);
                int userCount = planet.getSubscriptionCount();
                int mod = (userCount / limit) + 1;
               
                Calendar cal = Calendar.getInstance();
                cal.setTime(new Date());
                int day = cal.get(Calendar.DAY_OF_YEAR);
               
                int start = (day % mod) * limit;
                int end = start + limit;
                end = end > userCount ? userCount : end;
                logger.info("Updating subscriptions ["+start+":"+end+"]");
               
                Iterator subs = planet.getAllSubscriptions();
                while (subs.hasNext()) {
                    PlanetSubscriptionData sub =
                            (PlanetSubscriptionData)subs.next();
                    if (count >= start && count < end) {
                        try {
                            Technorati.Result result =
                                    technorati.getBloginfo(sub.getSiteUrl());
                            if (result != null && result.getWeblog() != null) {
                                sub.setInboundblogs(
                                        result.getWeblog().getInboundblogs());
                                sub.setInboundlinks(
                                        result.getWeblog().getInboundlinks());
View Full Code Here

TOP

Related Classes of org.apache.roller.util.Technorati$Result

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.