use of org.apache.cayenne.access.types.FloatType in project cayenne by apache.
the class ServerCaseModule method configure.
public void configure(Binder binder) {
// these are the objects injectable in unit tests that subclass from
// ServerCase. Note that ServerRuntimeProvider creates ServerRuntime
// instances complete with their own DI injectors, independent from the
// unit test injector. ServerRuntime injector contents are customized
// inside ServerRuntimeProvider.
binder.bindMap(String.class, UnitDbAdapterProvider.TEST_ADAPTERS_MAP).put(FirebirdAdapter.class.getName(), FirebirdUnitDbAdapter.class.getName()).put(OracleAdapter.class.getName(), OracleUnitDbAdapter.class.getName()).put(DerbyAdapter.class.getName(), DerbyUnitDbAdapter.class.getName()).put(Oracle8Adapter.class.getName(), OracleUnitDbAdapter.class.getName()).put(SybaseAdapter.class.getName(), SybaseUnitDbAdapter.class.getName()).put(MySQLAdapter.class.getName(), MySQLUnitDbAdapter.class.getName()).put(PostgresAdapter.class.getName(), PostgresUnitDbAdapter.class.getName()).put(OpenBaseAdapter.class.getName(), OpenBaseUnitDbAdapter.class.getName()).put(SQLServerAdapter.class.getName(), SQLServerUnitDbAdapter.class.getName()).put(DB2Adapter.class.getName(), DB2UnitDbAdapter.class.getName()).put(HSQLDBAdapter.class.getName(), HSQLDBUnitDbAdapter.class.getName()).put(H2Adapter.class.getName(), H2UnitDbAdapter.class.getName()).put(FrontBaseAdapter.class.getName(), FrontBaseUnitDbAdapter.class.getName()).put(IngresAdapter.class.getName(), IngresUnitDbAdapter.class.getName()).put(SQLiteAdapter.class.getName(), SQLiteUnitDbAdapter.class.getName());
ServerModule.contributeProperties(binder).put(Constants.SERVER_OBJECT_RETAIN_STRATEGY_PROPERTY, "soft");
// configure extended types
ServerModule.contributeDefaultTypes(binder).add(new VoidType()).add(new BigDecimalType()).add(new BooleanType()).add(new ByteArrayType(false, true)).add(new ByteType(false)).add(new CharType(false, true)).add(new DateType()).add(new DoubleType()).add(new FloatType()).add(new IntegerType()).add(new LongType()).add(new ShortType(false)).add(new TimeType()).add(new TimestampType()).add(new UtilDateType()).add(new CalendarType<>(GregorianCalendar.class)).add(new CalendarType<>(Calendar.class));
ServerModule.contributeUserTypes(binder);
ServerModule.contributeTypeFactories(binder);
ServerModule.contributeValueObjectTypes(binder).add(BigIntegerValueType.class).add(UUIDValueType.class).add(LocalDateValueType.class).add(LocalTimeValueType.class).add(LocalDateTimeValueType.class).add(CharacterValueType.class);
binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
binder.bind(SchemaBuilder.class).to(SchemaBuilder.class);
binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
binder.bind(ObjectMapRetainStrategy.class).to(DefaultObjectMapRetainStrategy.class);
// singleton objects
binder.bind(UnitTestLifecycleManager.class).toInstance(new ServerCaseLifecycleManager(testScope));
binder.bind(DataSourceInfo.class).toProvider(ServerCaseDataSourceInfoProvider.class);
binder.bind(DataSourceFactory.class).to(ServerCaseSharedDataSourceFactory.class);
binder.bind(DbAdapter.class).toProvider(ServerCaseDbAdapterProvider.class);
binder.bind(JdbcAdapter.class).toProvider(ServerCaseDbAdapterProvider.class);
binder.bind(UnitDbAdapter.class).toProvider(UnitDbAdapterProvider.class);
// this factory is a hack that allows to inject to DbAdapters loaded outside of
// server runtime... BatchQueryBuilderFactory is hardcoded and whatever is placed
// in the ServerModule is ignored
binder.bind(BatchTranslatorFactory.class).toProvider(ServerCaseBatchQueryBuilderFactoryProvider.class);
binder.bind(DataChannelInterceptor.class).to(ServerCaseDataChannelInterceptor.class);
binder.bind(SQLTemplateCustomizer.class).toProvider(SQLTemplateCustomizerProvider.class);
binder.bind(ServerCaseDataSourceFactory.class).to(ServerCaseDataSourceFactory.class);
binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
// test-scoped objects
binder.bind(EntityResolver.class).toProvider(ServerCaseEntityResolverProvider.class).in(testScope);
binder.bind(DataNode.class).toProvider(ServerCaseDataNodeProvider.class).in(testScope);
binder.bind(ServerCaseProperties.class).to(ServerCaseProperties.class).in(testScope);
binder.bind(ServerRuntime.class).toProvider(ServerRuntimeProvider.class).in(testScope);
binder.bind(ObjectContext.class).toProvider(ServerCaseObjectContextProvider.class).withoutScope();
binder.bind(DataContext.class).toProvider(ServerCaseDataContextProvider.class).withoutScope();
binder.bind(DBHelper.class).toProvider(FlavoredDBHelperProvider.class).in(testScope);
binder.bind(DBCleaner.class).toProvider(DBCleanerProvider.class).in(testScope);
}
use of org.apache.cayenne.access.types.FloatType in project cayenne by apache.
the class ServerModule method configure.
public void configure(Binder binder) {
// configure global stack properties
contributeProperties(binder).put(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, String.valueOf(DEFAULT_MAX_ID_QUALIFIER_SIZE));
binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
// configure known DbAdapter detectors in reverse order of popularity.
// Users can add their own to install custom adapters automatically
contributeAdapterDetectors(binder).add(FirebirdSniffer.class).add(OpenBaseSniffer.class).add(FrontBaseSniffer.class).add(IngresSniffer.class).add(SQLiteSniffer.class).add(DB2Sniffer.class).add(H2Sniffer.class).add(HSQLDBSniffer.class).add(SybaseSniffer.class).add(DerbySniffer.class).add(SQLServerSniffer.class).add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class);
// configure a filter chain with only one TransactionFilter as default
contributeDomainFilters(binder).add(TransactionFilter.class);
// init listener list
contributeDomainListeners(binder);
// configure extended types
contributeDefaultTypes(binder).add(new VoidType()).add(new BigDecimalType()).add(new BooleanType()).add(new ByteType(false)).add(new CharType(false, true)).add(new DoubleType()).add(new FloatType()).add(new IntegerType()).add(new LongType()).add(new ShortType(false)).add(new ByteArrayType(false, true)).add(new DateType()).add(new TimeType()).add(new TimestampType()).add(new UtilDateType()).add(new CalendarType<>(GregorianCalendar.class)).add(new CalendarType<>(Calendar.class));
contributeUserTypes(binder);
contributeTypeFactories(binder);
// Custom ValueObjects types contribution
contributeValueObjectTypes(binder).add(BigIntegerValueType.class).add(UUIDValueType.class).add(LocalDateValueType.class).add(LocalTimeValueType.class).add(LocalDateTimeValueType.class).add(CharacterValueType.class);
binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
// configure explicit configurations
ListBuilder<String> locationsListBuilder = contributeProjectLocations(binder);
binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
binder.bind(EventManager.class).to(DefaultEventManager.class);
binder.bind(QueryCache.class).toProvider(MapQueryCacheProvider.class);
binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
// a service to provide the main stack DataDomain
binder.bind(DataDomain.class).toProvider(DataDomainProvider.class);
binder.bind(DataNodeFactory.class).to(DefaultDataNodeFactory.class);
// will return DataDomain for request for a DataChannel
binder.bind(DataChannel.class).toProvider(DomainDataChannelProvider.class);
binder.bind(ObjectContextFactory.class).to(DataContextFactory.class);
binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
// a service to load project XML descriptors
binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
binder.bind(DataChannelDescriptorMerger.class).to(DefaultDataChannelDescriptorMerger.class);
// a service to load DataMap XML descriptors
binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
// a locator of resources, such as XML descriptors
binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
// a global properties object
binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
// a service to load DataSourceFactories. DelegatingDataSourceFactory
// will attempt to find the actual worker factory dynamically on each
// call depending on DataNodeDescriptor data and the environment
binder.bind(DataSourceFactory.class).to(DelegatingDataSourceFactory.class);
binder.bind(SchemaUpdateStrategyFactory.class).to(DefaultSchemaUpdateStrategyFactory.class);
// a default DBAdapterFactory used to load custom and automatic
// DbAdapters
binder.bind(DbAdapterFactory.class).to(DefaultDbAdapterFactory.class);
// binding AshwoodEntitySorter without scope, as this is a stateful
// object and is
// configured by the owning domain
binder.bind(EntitySorter.class).to(AshwoodEntitySorter.class).withoutScope();
binder.bind(BatchTranslatorFactory.class).to(DefaultBatchTranslatorFactory.class);
binder.bind(SelectTranslatorFactory.class).to(DefaultSelectTranslatorFactory.class);
// a default ObjectMapRetainStrategy used to create objects map for
// ObjectStore
binder.bind(ObjectMapRetainStrategy.class).to(DefaultObjectMapRetainStrategy.class);
// a default ObjectStoreFactory used to create ObjectStores for contexts
binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
binder.bind(RowReaderFactory.class).to(DefaultRowReaderFactory.class);
binder.bind(SQLTemplateProcessor.class).to(CayenneSQLTemplateProcessor.class);
binder.bind(TemplateContextFactory.class).to(DefaultTemplateContextFactory.class);
binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
}
Aggregations