Search in sources :

Example 11 with IContentGenerator

use of org.pentaho.platform.api.engine.IContentGenerator in project pentaho-platform by pentaho.

the class RepositoryResource method getContentGeneratorResponse.

protected Response getContentGeneratorResponse(CGFactory fac) {
    // $NON-NLS-1$
    rsc("Is [{0}] a content generator ID?", fac.getContentGeneratorId());
    final IContentGenerator contentGenerator;
    try {
        contentGenerator = fac.create();
    } catch (NoSuchBeanDefinitionException e) {
        // $NON-NLS-1$
        rsc("Nope, [{0}] is not a content generator ID.", fac.getContentGeneratorId());
        return null;
    }
    if (contentGenerator == null) {
        // $NON-NLS-1$
        rsc("Nope, [{0}] is not a content generator ID.", fac.getContentGeneratorId());
        return null;
    }
    rsc("Yep, [{0}] is a content generator ID. Executing (where command path is {1})..", fac.getContentGeneratorId(), // $NON-NLS-1$
    fac.getCommand());
    GeneratorStreamingOutput gso = fac.getStreamingOutput(contentGenerator);
    return Response.ok(gso).build();
}
Also used : IContentGenerator(org.pentaho.platform.api.engine.IContentGenerator) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException)

Aggregations

IContentGenerator (org.pentaho.platform.api.engine.IContentGenerator)11 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 StyledHtmlAxisServiceLister (org.pentaho.platform.plugin.services.webservices.content.StyledHtmlAxisServiceLister)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 HashMap (java.util.HashMap)3 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)3 SimpleParameterProvider (org.pentaho.platform.engine.core.solution.SimpleParameterProvider)3 IOException (java.io.IOException)2 List (java.util.List)2 Document (org.dom4j.Document)2 Element (org.dom4j.Element)2 IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)2 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)2 MockServletContext (com.mockrunner.mock.web.MockServletContext)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1