Search in sources :

Example 1 with ServletContextCatalogLocator

use of mondrian.spi.impl.ServletContextCatalogLocator in project pentaho-platform by pentaho.

the class PentahoXmlaServlet method makeCatalogLocator.

@Override
protected CatalogLocator makeCatalogLocator(ServletConfig servletConfig) {
    return new ServletContextCatalogLocator(servletConfig.getServletContext()) {

        @Override
        public String locate(String catalogPath) {
            if (catalogPath.startsWith("mondrian:")) {
                // $NON-NLS-1$
                try {
                    FileSystemManager fsManager = VFS.getManager();
                    SolutionRepositoryVfsFileObject catalog = (SolutionRepositoryVfsFileObject) fsManager.resolveFile(catalogPath);
                    catalogPath = "solution:" + catalog.getFileRef();
                } catch (FileSystemException e) {
                    logger.error(e.getMessage());
                }
            } else {
                catalogPath = super.locate(catalogPath);
            }
            return catalogPath;
        }
    };
}
Also used : FileSystemException(org.apache.commons.vfs2.FileSystemException) ServletContextCatalogLocator(mondrian.spi.impl.ServletContextCatalogLocator) DefaultFileSystemManager(org.apache.commons.vfs2.impl.DefaultFileSystemManager) FileSystemManager(org.apache.commons.vfs2.FileSystemManager) SolutionRepositoryVfsFileObject(org.pentaho.platform.repository.solution.filebased.SolutionRepositoryVfsFileObject)

Example 2 with ServletContextCatalogLocator

use of mondrian.spi.impl.ServletContextCatalogLocator in project mondrian by pentaho.

the class MdxQueryServlet method init.

/**
 * Initializes the servlet.
 */
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    connectString = config.getInitParameter("connectString");
    Enumeration initParameterNames = config.getInitParameterNames();
    while (initParameterNames.hasMoreElements()) {
        String name = (String) initParameterNames.nextElement();
        String value = config.getInitParameter(name);
        MondrianProperties.instance().setProperty(name, value);
    }
    locator = new ServletContextCatalogLocator(config.getServletContext());
}
Also used : Enumeration(java.util.Enumeration) ServletContextCatalogLocator(mondrian.spi.impl.ServletContextCatalogLocator)

Aggregations

ServletContextCatalogLocator (mondrian.spi.impl.ServletContextCatalogLocator)2 Enumeration (java.util.Enumeration)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 FileSystemManager (org.apache.commons.vfs2.FileSystemManager)1 DefaultFileSystemManager (org.apache.commons.vfs2.impl.DefaultFileSystemManager)1 SolutionRepositoryVfsFileObject (org.pentaho.platform.repository.solution.filebased.SolutionRepositoryVfsFileObject)1