Package org.apache.jetspeed.aggregator

Examples of org.apache.jetspeed.aggregator.RenderingJob


     */
    public void renderNow( ContentFragment fragment, RequestContext requestContext, boolean spawned )
    {
        try
        {
            RenderingJob rJob = createRenderingJob(fragment, requestContext);
            if (rJob != null)
            {
                if (spawned)
                {
                    ArrayList<RenderingJob> jobs = new ArrayList<RenderingJob>();
                    jobs.add(rJob);
                    processRenderingJob(rJob, true);
                    waitForRenderingJobs(jobs);
                }
                else
                {
                    rJob.execute();
                }
            }
        }
        catch (PortletAccessDeniedException e)
        {
View Full Code Here


     * @throws RuntimeException
     */
    public RenderingJob createRenderingJob(ContentFragment fragment, RequestContext requestContext)
    throws PortletAccessDeniedException
    {
        RenderingJob job = null;
        try
        {
            PortletWindow portletWindow = requestContext.getPortletWindow(fragment);
            if (!portletWindow.isValid())
            {
View Full Code Here

                                              long timeoutMetadata)
    {
        int expirationCache = getExpirationCache(portletDefinition);
        PortletContent portletContent= createPortletContent(requestContext, portletWindow, expirationCache);

        RenderingJob rJob = null;
              
        portletWindow.getFragment().setPortletContent(portletContent);
       
        rJob = new RenderingJobImpl(container, this, portletDefinition,
                                    requestContext.getRequest(), requestContext.getResponse(), requestContext, portletWindow,
View Full Code Here

        // backlog job to this worker, else reset job count and put
        // it on the idle queue.

        long jobTimeout = 0;

        RenderingJob oldJob = (RenderingJob) worker.getJob();
        if (oldJob != null)
        {
            jobTimeout = oldJob.getTimeout();
        }

        synchronized (worker)
        {
            RenderingJob job = null;
           
            if (worker.getJobCount() < this.maxJobsPerWorker)
            {
                job = (RenderingJob) queue.pop();
               
                if (job != null)
                {
                    AccessControlContext context = (AccessControlContext) job.getWorkerAttribute(ACCESS_CONTROL_CONTEXT_WORKER_ATTR);
                    worker.setJob(job, context);
                    runningJobs--;
                    return;
                }
            }
View Full Code Here

                    synchronized (workersMonitored)
                    {
                        for (WorkerImpl worker : workersMonitored)
                        {
                            RenderingJob job = (RenderingJob) worker.getJob();
                           
                            if ((null != job) && (job.isTimeout()))
                            {
                                timeoutWorkers.add(worker);
                            }
                        }
                    }

                    // Now, we can kill the timeout worker(s).
                    for (WorkerImpl worker : timeoutWorkers)
                    {
                        RenderingJob job = (RenderingJob) worker.getJob();

                        // If the job is just completed, then do not kill the worker.
                        if ((null != job) && (job.isTimeout()))
                        {
                            killJob(worker, job);
                        }
                    }
                }
View Full Code Here

                if (!"hidden".equals(f.getState()))
                {
                    if (child.getType().equals(ContentFragment.PORTLET))
                    {
                        // create and store the portlet rendering job into the jobs lists.
                        RenderingJob job = renderer.createRenderingJob(child, context);

                        // The returned job can be null for some reason, such as invalid portlet entity.
                        if (job != null)
                        {
                            if (job.getTimeout() > 0)
                                parallelJobs.add(job);
                            else
                                sequentialJobs.add(job);
                        }
                    }
                    else
                    {
                        // walk thru layout
                        // and store the layout rendering job into the layout jobs list.
                        aggregateAndRender(child, context, page, false, sequentialJobs, parallelJobs, layoutFragments);
                        layoutFragments.add(child);
                    }
                }
            }
        }

        // If the fragment is not root, skip the following.
        if (!isRoot)
            return;
       
        int parallelJobCount = parallelJobs.size();
        int sequentialJobCount = sequentialJobs.size();
       
        if (log.isInfoEnabled())
        {
            log.info("Aggregating " + page.getPath() + ". Parallel: " + parallelJobCount + ", Sequential: " + sequentialJobCount);
        }
       
        CurrentWorkerContext.setParallelRenderingMode(parallelJobCount > 0);

        // kick off the parallel rendering jobs
        Iterator iter = parallelJobs.iterator();
        while (iter.hasNext())
        {
            RenderingJob job = (RenderingJob) iter.next();
            renderer.processRenderingJob(job);
        }

        // kick off the sequential rendering jobs
        iter = sequentialJobs.iterator();
        while (iter.hasNext())
        {
            RenderingJob job = (RenderingJob) iter.next();
            renderer.processRenderingJob(job);
        }

        // synchronize on completion of all jobs
        renderer.waitForRenderingJobs(parallelJobs);
View Full Code Here

            {
                dispatcher = createDispatcher(requestContext, fragment, expirationCache);
            }
            servletRequest = requestContext.getRequestForWindow(portletWindow);
            servletResponse = dispatcher.getResponseForWindow(portletWindow, requestContext);
            RenderingJob rJob =
                buildRenderingJob(portletWindow, fragment, servletRequest, servletResponse,
                                  requestContext, false, portletDefinition, dispatcher, null,
                                  expirationCache, contentIsCached, timeoutMetadata);
            rJob.execute();
            addTitleToHeader( portletWindow, fragment, servletRequest, servletResponse, dispatcher, contentIsCached);
        }
        catch (PortletAccessDeniedException e)
        {
            fragment.overrideRenderedContent(e.getLocalizedMessage());                       
View Full Code Here

     *
     * @return the asynchronous portlet rendering job to synchronize
     */
    public RenderingJob render( ContentFragment fragment, RequestContext requestContext )
    {
        RenderingJob job = null;

        try
        {
            job = createRenderingJob(fragment, requestContext);
        }
View Full Code Here

     * @throws UnknownPortletDefinitionException
     * @throws PortletAccessDeniedException
     */
    public RenderingJob createRenderingJob(ContentFragment fragment, RequestContext requestContext)
    {
        RenderingJob job = null;
        boolean contentIsCached = false;      
        try
        {
            PortletWindow portletWindow = getPortletWindow(fragment);
            PortletDefinitionComposite portletDefinition =
View Full Code Here

                                              ContentDispatcherCtrl dispatcher,
                                              PortletContent portletContent,
                                              int expirationCache, boolean contentIsCached, long timeoutMetadata)
             throws PortletAccessDeniedException, FailedToRetrievePortletWindow, PortletEntityNotStoredException
   {   
        RenderingJob rJob = null;
              
        request.setAttribute(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
        request.setAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
        request.setAttribute(PortalReservedParameters.CONTENT_DISPATCHER_ATTRIBUTE, dispatcher);
        request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, requestContext);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.aggregator.RenderingJob

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.