Search in sources :

Example 6 with ActionSequenceResource

use of org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource in project pentaho-platform by pentaho.

the class SolutionURIResolver method resolveEntity.

public InputSource resolveEntity(final String publicId, final String systemId) {
    InputStream xslIS = null;
    try {
        if (systemId.toLowerCase().indexOf(".dtd") >= 0) {
            // $NON-NLS-1$
            return resolveDTDEntity(publicId, systemId);
        }
        IActionSequenceResource resource = new // $NON-NLS-1$ //$NON-NLS-2$
        ActionSequenceResource(// $NON-NLS-1$ //$NON-NLS-2$
        "", // $NON-NLS-1$ //$NON-NLS-2$
        IActionSequenceResource.SOLUTION_FILE_RESOURCE, // $NON-NLS-1$ //$NON-NLS-2$
        "text/xml", systemId);
        xslIS = resource.getInputStream(RepositoryFilePermission.READ, LocaleHelper.getLocale());
        return new InputSource(xslIS);
    } catch (IOException e) {
        Logger.error(this, e.getLocalizedMessage());
    }
    return null;
}
Also used : InputSource(org.xml.sax.InputSource) BufferedInputStream(java.io.BufferedInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) IActionSequenceResource(org.pentaho.platform.api.engine.IActionSequenceResource) ActionSequenceResource(org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource) IOException(java.io.IOException) IActionSequenceResource(org.pentaho.platform.api.engine.IActionSequenceResource)

Example 7 with ActionSequenceResource

use of org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource in project pentaho-platform by pentaho.

the class JFreeChartEngine method getImage.

/**
 * @param imageName
 *          String that contains a path to the image
 * @return the image
 */
public static Image getImage(final String imageName, final IPentahoSession session) {
    Image image = null;
    try {
        IActionSequenceResource resource = new // $NON-NLS-1$ //$NON-NLS-2$
        ActionSequenceResource(// $NON-NLS-1$ //$NON-NLS-2$
        "", // $NON-NLS-1$ //$NON-NLS-2$
        IActionSequenceResource.SOLUTION_FILE_RESOURCE, // $NON-NLS-1$ //$NON-NLS-2$
        "", imageName);
        InputStream is = resource.getInputStream(RepositoryFilePermission.READ, LocaleHelper.getLocale());
        image = ImageIO.read(is);
    } catch (IOException e) {
        JFreeChartEngine.log.error(null, e);
    }
    return image;
}
Also used : InputStream(java.io.InputStream) ActionSequenceResource(org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource) IActionSequenceResource(org.pentaho.platform.api.engine.IActionSequenceResource) IOException(java.io.IOException) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) IActionSequenceResource(org.pentaho.platform.api.engine.IActionSequenceResource)

Aggregations

IActionSequenceResource (org.pentaho.platform.api.engine.IActionSequenceResource)7 ActionSequenceResource (org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource)7 InputStream (java.io.InputStream)5 BufferedInputStream (java.io.BufferedInputStream)3 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3 Image (java.awt.Image)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 StreamSource (javax.xml.transform.stream.StreamSource)1 Document (org.dom4j.Document)1 Element (org.dom4j.Element)1 IPentahoRequestContext (org.pentaho.platform.api.engine.IPentahoRequestContext)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 SolutionURIResolver (org.pentaho.platform.engine.services.SolutionURIResolver)1 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)1 InputSource (org.xml.sax.InputSource)1