Package it.eng.qbe.datasource.configuration

Examples of it.eng.qbe.datasource.configuration.CompositeDataSourceConfiguration


    IDataSource dataSource;
   
    // = getNamingStartegy().getDataSourceName(dataMartNames, connection);
    //dataSource = getDataSourceCache().getDataSource(dataSourceName);
   
    CompositeDataSourceConfiguration compositeConfiguration = new CompositeDataSourceConfiguration();
    Iterator<String> it = dataSourceProperties.keySet().iterator();
    while(it.hasNext()) {
      String propertyName = it.next();
      compositeConfiguration.loadDataSourceProperties().put(propertyName, dataSourceProperties.get(propertyName));
    }
   
 
    boolean isJPA = false;
    File modelJarFile;
    FileDataSourceConfiguration c;
     
    JarFileRetriever jarFileRetriever = new JarFileRetriever(QbeEngineConfig.getInstance().getQbeDataMartDir());
    List<File> modelJarFiles = new ArrayList<File>();
    for(int i = 0; i < dataMartNames.size(); i++) {
      modelJarFile = jarFileRetriever.loadDatamartJarFile(dataMartNames.get(i));
      modelJarFiles.add(modelJarFile);
      c = new FileDataSourceConfiguration(dataMartNames.get(i), modelJarFile);
      compositeConfiguration.addSubConfiguration(c);
    }
   
    isJPA = jarFileRetriever.isAJPADatamartJarFile(modelJarFiles.get(0));
    if(modelJarFiles.size() > 1) {
      for(int i = 1; i < modelJarFiles.size(); i++) {
View Full Code Here


    dataMartModelAccessModality = new AbstractModelAccessModality();

    // validate & set configuration
    if(configuration instanceof FileDataSourceConfiguration) {
      FileDataSourceConfiguration subConf = (FileDataSourceConfiguration)configuration;
      CompositeDataSourceConfiguration c = new CompositeDataSourceConfiguration(subConf.getModelName());
      c.addSubConfiguration(subConf);
      Iterator<String> it = subConf.loadDataSourceProperties().keySet().iterator();
      while(it.hasNext()) {
        String propertyName = it.next();
        c.loadDataSourceProperties().put(propertyName, subConf.loadDataSourceProperties().get(propertyName));
      }
      this.configuration = c;
    } else if(configuration instanceof CompositeDataSourceConfiguration) {
      CompositeDataSourceConfiguration c = (CompositeDataSourceConfiguration)configuration;
      if(c.getSubConfigurations() == null || c.getSubConfigurations().size() < 1) {
        throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Datasource sub-configurations not defined");
      }
      for(int i = 0; i < c.getSubConfigurations().size(); i++) {       
        if( !(c.getSubConfigurations().get(i) instanceof FileDataSourceConfiguration) ) {
          throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Unable to manage sub-configuration of type [" + c.getSubConfigurations().get(i).getClass().getName() + "]");
        }
      }
      this.configuration = configuration;
    } else {
      throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Unable to manage configuration of type [" + configuration.getClass().getName() + "]");
View Full Code Here

   */
  public String getDataSourceName(IDataSourceConfiguration configuration) {
    ConnectionDescriptor connection = (ConnectionDescriptor)configuration.loadDataSourceProperties().get("connection");
    List<String> modelNames = new ArrayList<String>();
    if(configuration instanceof CompositeDataSourceConfiguration){
      CompositeDataSourceConfiguration cc = (CompositeDataSourceConfiguration)configuration;
      Iterator<IDataSourceConfiguration> it = cc.getSubConfigurations().iterator();
      while(it.hasNext()) modelNames.add(it.next().getModelName());
    } else {
      modelNames.add(configuration.getModelName());
    }
    String datasourceName = getDatasourceUnqualifiedName(modelNames, connection);
View Full Code Here

        dataSourceProperties.put("connection", connection);
        dataSourceProperties.put("dblinkMap", new HashMap());

      File modelJarFile = null;
      List<File> modelJarFiles = new ArrayList<File>();
      CompositeDataSourceConfiguration compositeConfiguration = new CompositeDataSourceConfiguration();
      compositeConfiguration.loadDataSourceProperties().putAll( dataSourceProperties);
     
      String resourcePath = getResourcePath();
      modelJarFile = new File(resourcePath+File.separator+"qbe" + File.separator + "datamarts" + File.separator + modelNames.get(0)+File.separator+"datamart.jar");
      modelJarFiles.add(modelJarFile);
      compositeConfiguration.addSubConfiguration(new FileDataSourceConfiguration(modelNames.get(0), modelJarFile));
 
      logger.debug("OUT: Finish to load the data source for the model names "+modelNames+"..");
      return DriverManager.getDataSource(getDriverName(modelJarFile), compositeConfiguration);
  }
View Full Code Here

TOP

Related Classes of it.eng.qbe.datasource.configuration.CompositeDataSourceConfiguration

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.