Package it.eng.spagobi.services.datasource.bo

Examples of it.eng.spagobi.services.datasource.bo.SpagoBiDataSource


    queryCatalogue = new QueryCatalogue();
    queryCatalogue.addQuery(new Query());
   
       
    it.eng.spagobi.tools.datasource.bo.IDataSource dataSrc = (it.eng.spagobi.tools.datasource.bo.IDataSource)env.get( EngineConstants.ENV_DATASOURCE );
    SpagoBiDataSource ds = dataSrc.toSpagoBiDataSource();
   
    ConnectionDescriptor connection = new ConnectionDescriptor();     
    connection.setName( ds.getLabel() );
    connection.setDialect( ds.getHibDialectClass() );     
    connection.setJndiName( ds.getJndiName() );     
    connection.setDriverClass( ds.getDriver() );     
    connection.setPassword( ds.getPassword() );
    connection.setUrl( ds.getUrl() );
    connection.setUsername( ds.getUser() );     
   
    Map<String, Object> dataSourceProperties = new HashMap<String, Object>();
    dataSourceProperties.put("connection", connection);
    dataSourceProperties.put("dblinkMap", template.getDbLinkMap());
   
View Full Code Here


     * @return the data source
     */
    public SpagoBiDataSource getDataSource(String documentId) {
  logger.debug("IN.documentId:" + documentId);

  SpagoBiDataSource sbds = null;
  if (documentId == null)
      return null;

  // gets data source data from database
  try {
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(Integer.valueOf(documentId));
      if (obj == null) {
    logger.error("The object with id " + documentId + " is not found on the database.");
    return null;
      }
      Integer dsId = null;
      if (obj.getDataSourceId() != null) {
        dsId = obj.getDataSourceId();
        logger.debug("Using document datasource id = " + dsId);
      } else {
        Engine engine = obj.getEngine();
        dsId = engine.getDataSourceId();
        logger.debug("Using document's engine datasource id = " + dsId);
      }
      if (dsId == null) {
        logger.error("Data source is not configured neither for document nor for its engine.");
        return null;
      }
      IDataSource ds = DAOFactory.getDataSourceDAO().loadDataSourceByID(dsId);
      if (ds == null) {
    logger.error("The data source with id " + obj.getDataSourceId() + " is not found on the database.");
    return null;
      }
     
      Domain dialectHB = DAOFactory.getDomainDAO().loadDomainById(ds.getDialectId());
      if (ds == null) {
    logger.error("The data source with id " + obj.getDataSourceId() + " is not found on the database.");
    return null;
      }     
      sbds = new SpagoBiDataSource();
      sbds.setLabel(ds.getLabel());
      sbds.setJndiName(ds.getJndi());
      sbds.setUrl(ds.getUrlConnection());
      sbds.setUser(ds.getUser());
      sbds.setPassword(ds.getPwd());
      sbds.setDriver(ds.getDriver());
      sbds.setHibDialectName(dialectHB.getValueName());
//change
//      sbds.setHibDialectClass(dialectHB.getValueDescription());
      sbds.setHibDialectClass(dialectHB.getValueCd());
      logger.info("read DS: Label="+sbds.getLabel()+" Jndi="+sbds.getJndiName()+" HIB="+sbds.getHibDialectClass());
     
      //gets dialect informations
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      Domain doDialect = domaindao.loadDomainById(ds.getDialectId());
      sbds.setHibDialectClass(doDialect.getValueCd());
      sbds.setHibDialectName(doDialect.getValueName());
      sbds.setMultiSchema(ds.getMultiSchema());
      sbds.setSchemaAttribute(ds.getSchemaAttribute());

  } catch (Exception e) {
      logger.error("The data source is not correctly returned", e);
      sbds=null;

View Full Code Here

     *
     * @return the data source by label
     */
    public SpagoBiDataSource getDataSourceByLabel(String dsLabel) {
  logger.debug("IN");
  SpagoBiDataSource sbds = new SpagoBiDataSource();

  // gets data source data from database
  try {
      IDataSource ds = DAOFactory.getDataSourceDAO().loadDataSourceByLabel(dsLabel);
      if (ds == null) {
    logger.warn("The data source with label " + dsLabel + " is not found on the database.");
    return null;
      }
      sbds.setLabel(ds.getLabel());
      sbds.setJndiName(ds.getJndi());
      sbds.setUrl(ds.getUrlConnection());
      sbds.setUser(ds.getUser());
      sbds.setPassword(ds.getPwd());
      sbds.setDriver(ds.getDriver());
      sbds.setMultiSchema(ds.getMultiSchema());
      sbds.setSchemaAttribute(ds.getSchemaAttribute());
     
    //gets dialect informations
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      Domain doDialect = domaindao.loadDomainById(ds.getDialectId());
      sbds.setHibDialectClass(doDialect.getValueCd());
      sbds.setHibDialectName(doDialect.getValueName());
     
  } catch (Exception e) {
      logger.error("The data source is not correctly returned", e);
  }
  logger.debug("OUT");
View Full Code Here

      }

      Iterator dsIt = lstDs.iterator();
      while (dsIt.hasNext()) {
    IDataSource ds = (IDataSource) dsIt.next();
    SpagoBiDataSource sbds = new SpagoBiDataSource();
    sbds.setJndiName(ds.getJndi());
    sbds.setUrl(ds.getUrlConnection());
    sbds.setUser(ds.getUser());
    sbds.setPassword(ds.getPwd());
    sbds.setDriver(ds.getDriver());
    //gets dialect informations
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      Domain doDialect = domaindao.loadDomainById(ds.getDialectId());
      sbds.setHibDialectClass(doDialect.getValueCd());
      sbds.setHibDialectName(doDialect.getValueName());
      sbds.setMultiSchema(ds.getMultiSchema());
      sbds.setSchemaAttribute(ds.getSchemaAttribute());
     
    tmpList.add(sbds);
      }
  } catch (Exception e) {
      logger.error("The data sources are not correctly returned", e);
View Full Code Here

    return databaseDialect;
  }

  private void setDataSourceDialect() {
    DataSourceSupplier supplierDS = new DataSourceSupplier();   
    SpagoBiDataSource ds = supplierDS.getDataSourceByLabel(dataSource);
    if(ds != null){
      databaseDialect = ds.getHibDialectClass();
      if (databaseDialect.equalsIgnoreCase(DIALECT_MYSQL)) {
        ALIAS_DELIMITER = "`";
      } else if (databaseDialect.equalsIgnoreCase(DIALECT_HSQL)) {
        ALIAS_DELIMITER = "\"";
      } else if (databaseDialect.equalsIgnoreCase(DIALECT_INGRES)) {
View Full Code Here

 
  public void testDataSet() throws Exception {
    SpagoBiDataSet dataSetConfig = new SpagoBiDataSet();
    dataSetConfig.setQuery("SELECT fullname as 'Full Name' FROM CUSTOMER LIMIT 10");
   
    SpagoBiDataSource dataSourceConfig = new SpagoBiDataSource();
    dataSourceConfig.setDriver(TestCaseConstants.CONNECTION_DRIVER);
    dataSourceConfig.setHibDialectClass(TestCaseConstants.CONNECTION_DIALECT);
    dataSourceConfig.setHibDialectName(TestCaseConstants.CONNECTION_DIALECT);
    dataSourceConfig.setMultiSchema(false);
    dataSourceConfig.setUser(TestCaseConstants.CONNECTION_USER);
    dataSourceConfig.setPassword(TestCaseConstants.CONNECTION_PWD);
    dataSourceConfig.setUrl(TestCaseConstants.CONNECTION_URL);
   
    dataSetConfig.setDataSource(dataSourceConfig);
   
    IDataSet dataset = new JDBCDataSet(dataSetConfig);
    dataset.loadData();
View Full Code Here

     *
     * @return SpagoBiDataSource object
     */
    public IDataSource getDataSource(String documentId) {
      IDataSource dataSource = null;
      SpagoBiDataSource dataSourceConfig = null;
   
      logger.debug("IN.documentId="+documentId);
    if (documentId==null || documentId.length()==0){
        logger.error("documentId is NULL");
        return null;
View Full Code Here

     *
     * @return SpagoBiDataSource object
     */
    public IDataSource getDataSourceByLabel(String label) {
      IDataSource dataSource = null;
      SpagoBiDataSource dataSourceConfig = null;
   
     
      logger.debug("IN.label="+label);
    if (label==null || label.length()==0){
        logger.error("label is NULL");
View Full Code Here

 
  /* (non-Javadoc)
   * @see it.eng.spagobi.tools.datasource.bo.IDataSource#toSpagoBiDataSource()
   */
  public SpagoBiDataSource toSpagoBiDataSource(){
    SpagoBiDataSource sbd = new SpagoBiDataSource();
    sbd.setId(dsId);
    sbd.setDriver(driver);
    sbd.setHibDialectClass("");
    sbd.setHibDialectName("");
    sbd.setJndiName(jndi);
    sbd.setLabel(label);
    sbd.setPassword(pwd);
    sbd.setUrl(urlConnection);
    sbd.setUser(user);
    sbd.setHibDialectClass(hibDialectClass);
    sbd.setHibDialectName(hibDialectName);
    sbd.setMultiSchema(multiSchema);
    sbd.setSchemaAttribute(schemaAttribute);
    return sbd;
  }
View Full Code Here

  public Connection getConnection(RequestContainer requestContainer,String dsLabel) {
    Connection connection =  null;
    //calls implementation for gets data source object
   
    DataSourceSupplier supplierDS = new DataSourceSupplier();   
    SpagoBiDataSource ds = supplierDS.getDataSourceByLabel(dsLabel);
    logger.debug("Schema Attributes:"+ ds.getSchemaAttribute());
    String schema=UserUtilities.getSchema(ds.getSchemaAttribute(),requestContainer);
    logger.debug("Schema:"+ schema);
   
    try {
      connection = ds.readConnection(schema);
    } catch (NamingException e) {
      logger.error("JNDI error", e);
    } catch (SQLException e) {
      logger.error("Cannot retrive connection", e);
    } catch (ClassNotFoundException e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.services.datasource.bo.SpagoBiDataSource

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.