Package org.pentaho.platform.plugin.action.mondrian.catalog

Examples of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog


  @Test
  public void testReadRolesInSchema() throws Exception {
    final MondrianCatalogHelper helper = (MondrianCatalogHelper) PentahoSystem.get( IMondrianCatalogService.class );
    Assert.assertNotNull( helper );
    MondrianCatalog mc = SecurityHelper.getInstance().runAsUser( "admin", new Callable<MondrianCatalog>() {
      @Override
      public MondrianCatalog call() throws Exception {
        return helper.getCatalog( "SteelWheelsRoles", PentahoSessionHolder.getSession() );
      }
    } );

    Assert.assertNotNull( mc );
    MondrianSchema ms = mc.getSchema();
    Assert.assertNotNull( ms );
    String[] roleNames = ms.getRoleNames();
    Assert.assertNotNull( roleNames );
    Assert.assertEquals( 2, roleNames.length );
    Assert.assertEquals( "Role1", roleNames[0] );
View Full Code Here


          //the XMLA servlet shares the same MondrianServer instance as the rest
          //of the platform
          IMondrianCatalogService mcs =
              PentahoSystem.get( IMondrianCatalogService.class );

          MondrianCatalog mc =
              mcs.getCatalog( catalogName, PentahoSessionHolder.getSession() );

          if ( mc == null ) {
            throw new XmlaException(
                CLIENT_FAULT_FC,
                HSB_BAD_RESTRICTION_LIST_CODE,
                HSB_BAD_RESTRICTION_LIST_FAULT_FS,
                new MondrianException(
                    "No such catalog: " + catalogName )
            );
          }

          Connection con =
              DriverManager.getConnection(
                  mc.getDataSourceInfo() + ";Catalog=" + mc.getDefinition(),
                  makeCatalogLocator( servletConfig ) );

          try {
            final MondrianServer server = MondrianServer.forConnection( con );
View Full Code Here

    MdxConnectionAction connAction = (MdxConnectionAction) getActionDefinition();
    String catalogName = connAction.getCatalog().getStringValue();
    IMondrianCatalogService mondrianCatalogService =
        PentahoSystem.get( IMondrianCatalogService.class, "IMondrianCatalogService", PentahoSessionHolder.getSession() ); //$NON-NLS-1$
    MondrianCatalog catalog = mondrianCatalogService.getCatalog( catalogName, PentahoSessionHolder.getSession() );

    if ( catalog == null ) {
      return getConnectionOrig();
    }

    Util.PropertyList connectProperties = Util.parseConnectString( catalog.getDataSourceInfo() );

    Properties properties = new Properties();

    Iterator<Pair<String, String>> iter = connectProperties.iterator();
    while ( iter.hasNext() ) {
      Pair<String, String> pair = iter.next();
      properties.put( pair.getKey(), pair.getValue() );
    }

    properties.put( "Catalog", catalog.getDefinition() );
    properties.put( "Provider", "mondrian" );
    properties.put( "PoolNeeded", "false" );
    properties.put( RolapConnectionProperties.Locale.name(), LocaleHelper.getLocale().toString() );

    debug( "Mondrian Connection Properties: " + properties.toString() );
View Full Code Here

              return null;
            }

            connectStr = "dataSource=" + jndiStr + "; Catalog=" + catalog; //$NON-NLS-1$ //$NON-NLS-2$
            // Add extra definitions from platform mondrian metadata
            MondrianCatalog mc =
                org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogHelper.getInstance().getCatalog(
                  catalog, getSession() );
            try {
              connectStr += ";" + mc.getDataSourceInfo();
            } catch ( Exception e ) {
              // Just swallow the exception
            }
          }
          if ( role != null ) {
View Full Code Here

    String[] rtn = null;
    // Get the catalog service
    IMondrianCatalogService catalogService = PentahoSystem.get( IMondrianCatalogService.class );
    if ( catalogService != null ) {
      // Get the catalog by name
      MondrianCatalog catalog = catalogService.getCatalog( context, userSession );
      if ( catalog != null ) {
        // The roles are in the schema object
        MondrianSchema schema = catalog.getSchema();
        if ( schema != null ) {
          // Ask the schema for the role names array
          String[] roleNames = schema.getRoleNames();
          if ( ( roleNames != null ) && ( roleNames.length > 0 ) ) {
            // Return the roles from the schema
View Full Code Here

    if ( domainId == null ) {
      throw new PlatformImportException( "Bundle missing required domain-id property" );
    }
    try {
      MondrianCatalog catalog = this.createCatalogObject( domainId, xmla, bundle );
      mondrianRepositoryImporter.addCatalog( bundle.getInputStream(), catalog, overwriteInRepossitory,
          PentahoSessionHolder.getSession() );
    } catch ( MondrianCatalogServiceException mse ) {
      int statusCode = convertExceptionToStatus( mse );
      throw new PlatformImportException( mse.getMessage(), statusCode );
View Full Code Here

        sb.append( parameter.getValue() );
        sb.append( "\"" );
      }
    }

    MondrianCatalog catalog =
        new MondrianCatalog( catName, sb.toString(), provider + ":" + RepositoryFile.SEPARATOR + catName, null, null );

    return catalog;
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.