/*
 * FlightRenderer.java 1.00 27-Feb-2001
 *
 * Copyright 2000-2001 by Oracle Corporation
 * 500 Oracle Parkway, Redwood Shores, California, 94065, U.S.A.
 * All rights reserved.
 */
package oracle.portal.sample.v2.devguide.externalApp;

import oracle.portal.provider.v2.*;
import oracle.portal.provider.v2.render.*;
import oracle.portal.provider.v2.render.http.*;
import oracle.portal.provider.v2.security.AccessControlException;
import java.io.*;

/**
 * This class is used by the Flights provider to render the portlet content
 *
 */
public class FlightRenderer extends BaseManagedRenderer
{
    /**
     *  Call FlightDispatch to render a portlet.
     *
     *  This routine does very little.  It simply calls the needed class / method to display
     *  a preexistant screen in the Flights of Fancy application.
     *
     *  @param  pr Is a PortletRenderRequest object which can be seen in the
     *  JPDK API documentation.
     *
     */
    public void renderBody(PortletRenderRequest pr)
        throws PortletException
    {
        ProviderInstance pi = pr.getProviderInstance();
        if(!(pi instanceof ExternalProvider))
        {
            throw new PortletException("FlightRenderer may only used within a provider instance of class " +
                                       ExternalProvider.class.getName());
        }
        try
        {
            ((ExternalProvider)pi).getDispatcher().process(pr);
        }
        catch(IOException ioe)
        {
            throw new PortletException(ioe);
        }
    }
}

