Search in sources :

Example 1 with LocalizingDynamicSchemaProcessor

use of mondrian.i18n.LocalizingDynamicSchemaProcessor in project pentaho-platform by pentaho.

the class MondrianCatalogHelper method docAtUrlToString.

protected String docAtUrlToString(final String urlStr, final IPentahoSession pentahoSession) {
    // String relPath = getSolutionRepositoryRelativePath(urlStr, pentahoSession);
    String res = null;
    InputStream in = null;
    try {
        LocalizingDynamicSchemaProcessor schemaProcessor = new LocalizingDynamicSchemaProcessor();
        PropertyList localeInfo = new PropertyList();
        // $NON-NLS-1$
        localeInfo.put("Locale", getLocale().toString());
        FileSystemManager fsManager = VFS.getManager();
        FileObject mondrianDS = fsManager.resolveFile(urlStr);
        in = mondrianDS.getContent().getInputStream();
        res = schemaProcessor.filter(null, localeInfo, in);
    } catch (FileNotFoundException fnfe) {
        throw new MondrianCatalogServiceException(Messages.getInstance().getErrorString("MondrianCatalogHelper.ERROR_0007_FILE_NOT_FOUND"), // $NON-NLS-1$
        fnfe);
    } catch (Exception e) {
        throw new MondrianCatalogServiceException(Messages.getInstance().getErrorString("MondrianCatalogHelper.ERROR_0006_IO_PROBLEM"), // $NON-NLS-1$
        e);
    } finally {
        IOUtils.closeQuietly(in);
    }
    return res;
}
Also used : LocalizingDynamicSchemaProcessor(mondrian.i18n.LocalizingDynamicSchemaProcessor) PropertyList(mondrian.olap.Util.PropertyList) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) FileObject(org.apache.commons.vfs2.FileObject) DefaultFileSystemManager(org.apache.commons.vfs2.impl.DefaultFileSystemManager) FileSystemManager(org.apache.commons.vfs2.FileSystemManager) XOMException(org.eigenbase.xom.XOMException) FileSystemException(org.apache.commons.vfs2.FileSystemException) FileNotFoundException(java.io.FileNotFoundException) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) XmlParseException(org.pentaho.platform.api.util.XmlParseException) SAXException(org.xml.sax.SAXException) MondrianException(mondrian.olap.MondrianException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) DBDatasourceServiceException(org.pentaho.platform.api.data.DBDatasourceServiceException) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Aggregations

FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 LocalizingDynamicSchemaProcessor (mondrian.i18n.LocalizingDynamicSchemaProcessor)1 MondrianException (mondrian.olap.MondrianException)1 PropertyList (mondrian.olap.Util.PropertyList)1 FileObject (org.apache.commons.vfs2.FileObject)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 FileSystemManager (org.apache.commons.vfs2.FileSystemManager)1 DefaultFileSystemManager (org.apache.commons.vfs2.impl.DefaultFileSystemManager)1 XOMException (org.eigenbase.xom.XOMException)1 DBDatasourceServiceException (org.pentaho.platform.api.data.DBDatasourceServiceException)1 ObjectFactoryException (org.pentaho.platform.api.engine.ObjectFactoryException)1 XmlParseException (org.pentaho.platform.api.util.XmlParseException)1 SAXException (org.xml.sax.SAXException)1 SAXParseException (org.xml.sax.SAXParseException)1