コード例 #1
0
 public DatasourceFactory parse(
     DatasourceFactoryDto dto, DatasourceEncryptionStrategy encryptionStrategy)
     throws NoSuchDatasourceFactoryException {
   if (dto == null) throw new IllegalArgumentException("dto cannot be null");
   for (DatasourceFactoryDtoParser parser : parsers) {
     if (parser.canParse(dto)) {
       return parser.parse(dto, encryptionStrategy);
     }
   }
   DatasourceFactory factory = new NullDatasourceFactory();
   factory.setName(dto.getName());
   return factory;
 }
コード例 #2
0
 @Nonnull
 @Override
 protected DatasourceFactory internalParse(DatasourceFactoryDto dto) {
   DatabaseSessionFactoryProvider sessionFactoryProvider = null;
   HibernateDatasourceFactoryDto factoryDto =
       dto.getExtension(HibernateDatasourceFactoryDto.params);
   if (factoryDto.getKey()) {
     sessionFactoryProvider =
         new DatabaseSessionFactoryProvider(
             identifiersTableService.getDatasourceName(),
             databaseRegistry,
             databaseRegistry.getIdentifiersDatabase().getName());
   } else {
     // fallback to default settings
     String database = factoryDto.hasDatabase() ? factoryDto.getDatabase() : "opal-data";
     sessionFactoryProvider =
         new DatabaseSessionFactoryProvider(dto.getName(), databaseRegistry, database);
   }
   HibernateDatasourceFactory factory = new HibernateDatasourceFactory();
   factory.setSessionFactoryProvider(sessionFactoryProvider);
   factory.setName(dto.getName());
   return factory;
 }