Package org.pentaho.platform.api.data

Examples of org.pentaho.platform.api.data.IDBDatasourceService


    String jndiName = reportSpec.getReportSpecChoice().getJndiSource();
    IPentahoConnection connection = null;
    if ( reportSpec.getIsMDX() ) {
      // did this ever work??
      String connectStr = ""; //$NON-NLS-1$
      IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
      String dsName = datasourceService.getDSBoundName( jndiName );
      if ( dsName != null ) {
        connectStr = "dataSource=" + dsName + "; Catalog=mondrian"; //$NON-NLS-1$ //$NON-NLS-2$
      } else {
        error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0005_INVALID_CONNECTION" ) ); //$NON-NLS-1$
        return null;
View Full Code Here


    String catName = mondrianSchema.getName();
    String[] roleNames = mondrianSchema.getRoleNames();

    // verify JNDI
    try {
      IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
      datasourceService.getDSBoundName( jndiName );
    } catch ( ObjectFactoryException objface ) {
      Logger
        .error(
          "MondrianCatalogHelper", Messages.getInstance()
          .getErrorString( "MondrianCatalogPublisher.ERROR_0006_UNABLE_TO_FACTORY_OBJECT", jndiName ),
View Full Code Here

  public void initialize() {

    if ( !initialized ) {
      try {
        IDBDatasourceService datasourceService = getDBDatasourceService();
        auditDs = datasourceService.getDataSource( AuditConnection.AUDIT_JNDI );
        if ( auditDs != null ) {
          AuditConnection.logger.debug( Messages.getInstance().getString(
              "AUDCONN.DEBUG_LOOKUP_FOUND_CLASS", auditDs.getClass().getName() ) ); //$NON-NLS-1$
        }
      } catch ( Exception dsException ) {
View Full Code Here

    // Marc - BISERVER-2004
    //
    if ( !useNewDatasourceService ) {
      return new JndiDatasourceService();
    } else {
      IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
      return datasourceService;
    }
  }
View Full Code Here

  private static final Log logger =
    LogFactory.getLog( PentahoDataSourceResolver.class );

  public DataSource lookup( String dataSourceName ) throws Exception {
    try {
      IDBDatasourceService datasourceSvc =
          PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, PentahoSessionHolder.getSession() );
      javax.sql.DataSource datasource = datasourceSvc.getDataSource( datasourceSvc.getDSUnboundName( dataSourceName ) );
      return datasource;
    } catch ( ObjectFactoryException e ) {
      logger.error( Messages.getInstance().getErrorString( "PentahoXmlaServlet.ERROR_0002_UNABLE_TO_INSTANTIATE" ), e ); //$NON-NLS-1$
      throw e;
    } catch ( DBDatasourceServiceException e ) {
View Full Code Here

          String connectStr = null;
          if ( jdbcStr != null ) {
            connectStr = jdbcStr + "; Catalog=" + catalog; //$NON-NLS-1$
          } else if ( jndiStr != null ) {

            IDBDatasourceService datasourceService =
                PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
            if ( datasourceService.getDataSource( jndiStr ) == null ) {
              error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0005_INVALID_CONNECTION" ) ); //$NON-NLS-1$
              return null;
            }

            connectStr = "dataSource=" + jndiStr + "; Catalog=" + catalog; //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

  protected static void hookupProvider() {
    DataSourceProviderFactory.setDataSourceProviderInterface( instance );
  }

  public DataSource getNamedDataSource( String dataSourceName ) throws DataSourceNamingException {
    IDBDatasourceService datasourceService =
        (IDBDatasourceService) PentahoSystem.get( IDBDatasourceService.class, null );
    if ( datasourceService != null ) {
      try {
        return datasourceService.getDataSource( dataSourceName );
      } catch ( DBDatasourceServiceException ex ) {
        throw new DataSourceNamingException( ex );
      }
    }
    return null;
View Full Code Here

  protected void initWithJNDI( final String jndiName ) {
    // bump();
    // myCtr = connectionCtr;
    try {
      IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
      DataSource dataSource = datasourceService.getDataSource( jndiName );
      if ( dataSource != null ) {
        nativeConnection = captureConnection( dataSource.getConnection() );
        if ( nativeConnection == null ) {
          logger.error( Messages.getInstance()
              .getErrorString( "ConnectFactory.ERROR_0001_INVALID_CONNECTION", jndiName ) ); //$NON-NLS-1$
          // clear datasource cache
          datasourceService.clearDataSource( jndiName );
        } else {
          enhanceConnection( nativeConnection );
        }
      } else {
        logger
            .error( Messages.getInstance().getErrorString( "ConnectFactory.ERROR_0001_INVALID_CONNECTION",
              jndiName ) ); //$NON-NLS-1$
        // clear datasource cache
        datasourceService.clearDataSource( jndiName );
      }
    } catch ( Exception e ) {
      logger.error(
          Messages.getInstance().getErrorString( "ConnectFactory.ERROR_0001_INVALID_CONNECTION", jndiName ), e ); //$NON-NLS-1$
      close(); // do not allow connection to be used as it might not be enhanced
      // clear datasource cache
      try {
        IDBDatasourceService datasourceService =
            PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
        datasourceService.clearDataSource( jndiName );
      } catch ( ObjectFactoryException objface ) {
        logger.error( Messages.getInstance().getErrorString(
          "ConnectFactory.ERROR_0002_UNABLE_TO_FACTORY_OBJECT=Unable to factory object", jndiName ), e ); //$NON-NLS-1$
      }
    }
View Full Code Here

    String jndiName = reportSpec.getReportSpecChoice().getJndiSource();
    IPentahoConnection connection = null;
    if ( reportSpec.getIsMDX() ) {
      // did this ever work??
      String connectStr = ""; //$NON-NLS-1$
      IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null );
      String dsName = datasourceService.getDSBoundName( jndiName );
      if ( dsName != null ) {
        connectStr = "dataSource=" + dsName + "; Catalog=mondrian"; //$NON-NLS-1$ //$NON-NLS-2$
      } else {
        error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0005_INVALID_CONNECTION" ) ); //$NON-NLS-1$
        return null;
View Full Code Here

        HibernateUtil.configuration.configure();
      }
      String dsName = HibernateUtil.configuration.getProperty( "connection.datasource" ); //$NON-NLS-1$
      if ( ( dsName != null ) && dsName.toUpperCase().endsWith( "HIBERNATE" ) ) { //$NON-NLS-1$
        // IDBDatasourceService datasourceService =  (IDBDatasourceService) PentahoSystem.getObjectFactory().getObject("IDBDatasourceService",null);     //$NON-NLS-1$
        IDBDatasourceService datasourceService = getDatasourceService();
        String actualDSName = datasourceService.getDSBoundName( "Hibernate" ); //$NON-NLS-1$
        HibernateUtil.configuration.setProperty( "hibernate.connection.datasource", actualDSName ); //$NON-NLS-1$
      }

      HibernateUtil.dialect = HibernateUtil.configuration.getProperty( "dialect" ); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.data.IDBDatasourceService

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.