Search in sources :

Example 1 with ByteType

use of org.apache.cayenne.access.types.ByteType in project cayenne by apache.

the class SybaseAdapter method configureExtendedTypes.

/**
 * Installs appropriate ExtendedTypes as converters for passing values
 * between JDBC and Java layers.
 */
@Override
protected void configureExtendedTypes(ExtendedTypeMap map) {
    super.configureExtendedTypes(map);
    // create specially configured CharType handler
    map.registerType(new CharType(true, false));
    // create specially configured ByteArrayType handler
    map.registerType(new ByteArrayType(true, false));
    // address Sybase driver inability to handle java.lang.Short and
    // java.lang.Byte
    map.registerType(new ShortType(true));
    map.registerType(new ByteType(true));
}
Also used : ByteArrayType(org.apache.cayenne.access.types.ByteArrayType) ShortType(org.apache.cayenne.access.types.ShortType) CharType(org.apache.cayenne.access.types.CharType) ByteType(org.apache.cayenne.access.types.ByteType)

Example 2 with ByteType

use of org.apache.cayenne.access.types.ByteType 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));
    contributeProperties(binder).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY, String.valueOf(false));
    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).add(MariaDBSniffer.class);
    // installing Pk for adapters
    binder.bind(PkGeneratorFactoryProvider.class).to(PkGeneratorFactoryProvider.class);
    binder.bind(PkGenerator.class).to(JdbcPkGenerator.class);
    // set PkGenerators for current Adapters
    contributePkGenerators(binder).put(DB2Adapter.class.getName(), DB2PkGenerator.class).put(DerbyAdapter.class.getName(), DerbyPkGenerator.class).put(FrontBaseAdapter.class.getName(), FrontBasePkGenerator.class).put(H2Adapter.class.getName(), H2PkGenerator.class).put(IngresAdapter.class.getName(), IngresPkGenerator.class).put(MySQLAdapter.class.getName(), MySQLPkGenerator.class).put(OpenBaseAdapter.class.getName(), OpenBasePkGenerator.class).put(OracleAdapter.class.getName(), OraclePkGenerator.class).put(Oracle8Adapter.class.getName(), OraclePkGenerator.class).put(PostgresAdapter.class.getName(), PostgresPkGenerator.class).put(SQLServerAdapter.class.getName(), SybasePkGenerator.class).put(SybaseAdapter.class.getName(), SybasePkGenerator.class);
    // configure a filter chain with only one TransactionFilter as default
    contributeDomainFilters(binder);
    contributeDomainQueryFilters(binder);
    contributeDomainSyncFilters(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 DurationType()).add(new UtilDateType()).add(new CalendarType<>(GregorianCalendar.class)).add(new CalendarType<>(Calendar.class)).add(GeoJsonType.class).add(WktType.class);
    contributeUserTypes(binder);
    contributeTypeFactories(binder).add(new InternalUnsupportedTypeFactory());
    // Custom ValueObjects types contribution
    contributeValueObjectTypes(binder).add(BigIntegerValueType.class).add(BigDecimalValueType.class).add(UUIDValueType.class).add(LocalDateValueType.class).add(LocalTimeValueType.class).add(LocalDateTimeValueType.class).add(PeriodValueType.class).add(CharacterValueType.class);
    binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
    binder.bind(ValueComparisonStrategyFactory.class).to(DefaultValueComparisonStrategyFactory.class);
    // configure explicit configurations
    contributeProjectLocations(binder);
    binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
    binder.bind(EventManager.class).toProvider(EventManagerProvider.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();
    binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
    binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
}
Also used : SchemaUpdateStrategyFactory(org.apache.cayenne.access.dbsync.SchemaUpdateStrategyFactory) DefaultSchemaUpdateStrategyFactory(org.apache.cayenne.access.dbsync.DefaultSchemaUpdateStrategyFactory) QueryCache(org.apache.cayenne.cache.QueryCache) FrontBasePkGenerator(org.apache.cayenne.dba.frontbase.FrontBasePkGenerator) PeriodValueType(org.apache.cayenne.access.types.PeriodValueType) ValueComparisonStrategyFactory(org.apache.cayenne.reflect.generic.ValueComparisonStrategyFactory) DefaultValueComparisonStrategyFactory(org.apache.cayenne.reflect.generic.DefaultValueComparisonStrategyFactory) DefaultDataDomainFlushActionFactory(org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory) DataDomainFlushActionFactory(org.apache.cayenne.access.flush.DataDomainFlushActionFactory) EventBridge(org.apache.cayenne.event.EventBridge) ByteType(org.apache.cayenne.access.types.ByteType) FloatType(org.apache.cayenne.access.types.FloatType) DataChannelDescriptorMerger(org.apache.cayenne.configuration.DataChannelDescriptorMerger) DefaultDataChannelDescriptorMerger(org.apache.cayenne.configuration.DefaultDataChannelDescriptorMerger) XMLReaderProvider(org.apache.cayenne.configuration.xml.XMLReaderProvider) HandlerFactory(org.apache.cayenne.configuration.xml.HandlerFactory) DefaultHandlerFactory(org.apache.cayenne.configuration.xml.DefaultHandlerFactory) NoopDataChannelMetaData(org.apache.cayenne.configuration.xml.NoopDataChannelMetaData) DataChannelMetaData(org.apache.cayenne.configuration.xml.DataChannelMetaData) UtilDateType(org.apache.cayenne.access.types.UtilDateType) UtilDateType(org.apache.cayenne.access.types.UtilDateType) DateType(org.apache.cayenne.access.types.DateType) DB2PkGenerator(org.apache.cayenne.dba.db2.DB2PkGenerator) DefaultRuntimeProperties(org.apache.cayenne.configuration.DefaultRuntimeProperties) RuntimeProperties(org.apache.cayenne.configuration.RuntimeProperties) DataRowStoreFactory(org.apache.cayenne.access.DataRowStoreFactory) DefaultDataRowStoreFactory(org.apache.cayenne.access.DefaultDataRowStoreFactory) ResourceLocator(org.apache.cayenne.resource.ResourceLocator) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) DerbySniffer(org.apache.cayenne.dba.derby.DerbySniffer) OracleAdapter(org.apache.cayenne.dba.oracle.OracleAdapter) DataDomain(org.apache.cayenne.access.DataDomain) GeoJsonType(org.apache.cayenne.access.types.GeoJsonType) ShortType(org.apache.cayenne.access.types.ShortType) ObjectMapRetainStrategy(org.apache.cayenne.access.ObjectMapRetainStrategy) DefaultObjectMapRetainStrategy(org.apache.cayenne.access.DefaultObjectMapRetainStrategy) MySQLSniffer(org.apache.cayenne.dba.mysql.MySQLSniffer) DB2Sniffer(org.apache.cayenne.dba.db2.DB2Sniffer) ByteArrayType(org.apache.cayenne.access.types.ByteArrayType) TransactionManager(org.apache.cayenne.tx.TransactionManager) DefaultTransactionManager(org.apache.cayenne.tx.DefaultTransactionManager) DefaultTransactionFactory(org.apache.cayenne.tx.DefaultTransactionFactory) TransactionFactory(org.apache.cayenne.tx.TransactionFactory) XMLDataChannelDescriptorLoader(org.apache.cayenne.configuration.xml.XMLDataChannelDescriptorLoader) DataChannelDescriptorLoader(org.apache.cayenne.configuration.DataChannelDescriptorLoader) CharType(org.apache.cayenne.access.types.CharType) BigDecimalType(org.apache.cayenne.access.types.BigDecimalType) IngresSniffer(org.apache.cayenne.dba.ingres.IngresSniffer) VoidType(org.apache.cayenne.access.types.VoidType) DerbyAdapter(org.apache.cayenne.dba.derby.DerbyAdapter) LongType(org.apache.cayenne.access.types.LongType) IngresPkGenerator(org.apache.cayenne.dba.ingres.IngresPkGenerator) ObjectStoreFactory(org.apache.cayenne.configuration.ObjectStoreFactory) DefaultObjectStoreFactory(org.apache.cayenne.configuration.DefaultObjectStoreFactory) OraclePkGenerator(org.apache.cayenne.dba.oracle.OraclePkGenerator) DataMapLoader(org.apache.cayenne.configuration.DataMapLoader) XMLDataMapLoader(org.apache.cayenne.configuration.xml.XMLDataMapLoader) ValueObjectTypeRegistry(org.apache.cayenne.access.types.ValueObjectTypeRegistry) DefaultValueObjectTypeRegistry(org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry) DerbyPkGenerator(org.apache.cayenne.dba.derby.DerbyPkGenerator) OraclePkGenerator(org.apache.cayenne.dba.oracle.OraclePkGenerator) H2PkGenerator(org.apache.cayenne.dba.h2.H2PkGenerator) PostgresPkGenerator(org.apache.cayenne.dba.postgres.PostgresPkGenerator) OpenBasePkGenerator(org.apache.cayenne.dba.openbase.OpenBasePkGenerator) MySQLPkGenerator(org.apache.cayenne.dba.mysql.MySQLPkGenerator) IngresPkGenerator(org.apache.cayenne.dba.ingres.IngresPkGenerator) DB2PkGenerator(org.apache.cayenne.dba.db2.DB2PkGenerator) JdbcPkGenerator(org.apache.cayenne.dba.JdbcPkGenerator) PkGenerator(org.apache.cayenne.dba.PkGenerator) FrontBasePkGenerator(org.apache.cayenne.dba.frontbase.FrontBasePkGenerator) SybasePkGenerator(org.apache.cayenne.dba.sybase.SybasePkGenerator) BigIntegerValueType(org.apache.cayenne.access.types.BigIntegerValueType) TimeType(org.apache.cayenne.access.types.TimeType) UUIDValueType(org.apache.cayenne.access.types.UUIDValueType) AshwoodEntitySorter(org.apache.cayenne.ashwood.AshwoodEntitySorter) Slf4jJdbcEventLogger(org.apache.cayenne.log.Slf4jJdbcEventLogger) JdbcEventLogger(org.apache.cayenne.log.JdbcEventLogger) ConfigurationNameMapper(org.apache.cayenne.configuration.ConfigurationNameMapper) DefaultConfigurationNameMapper(org.apache.cayenne.configuration.DefaultConfigurationNameMapper) TimestampType(org.apache.cayenne.access.types.TimestampType) H2Adapter(org.apache.cayenne.dba.h2.H2Adapter) DefaultTemplateContextFactory(org.apache.cayenne.template.DefaultTemplateContextFactory) TemplateContextFactory(org.apache.cayenne.template.TemplateContextFactory) DurationType(org.apache.cayenne.access.types.DurationType) OpenBasePkGenerator(org.apache.cayenne.dba.openbase.OpenBasePkGenerator) InternalUnsupportedTypeFactory(org.apache.cayenne.access.types.InternalUnsupportedTypeFactory) EventManager(org.apache.cayenne.event.EventManager) LocalTimeValueType(org.apache.cayenne.access.types.LocalTimeValueType) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) BooleanType(org.apache.cayenne.access.types.BooleanType) RowReaderFactory(org.apache.cayenne.access.jdbc.reader.RowReaderFactory) DefaultRowReaderFactory(org.apache.cayenne.access.jdbc.reader.DefaultRowReaderFactory) DefaultDbRowOpSorter(org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter) DbRowOpSorter(org.apache.cayenne.access.flush.operation.DbRowOpSorter) PostgresAdapter(org.apache.cayenne.dba.postgres.PostgresAdapter) ObjectContextFactory(org.apache.cayenne.configuration.ObjectContextFactory) IntegerType(org.apache.cayenne.access.types.IntegerType) MySQLAdapter(org.apache.cayenne.dba.mysql.MySQLAdapter) DataChannel(org.apache.cayenne.DataChannel) OpenBaseSniffer(org.apache.cayenne.dba.openbase.OpenBaseSniffer) SybasePkGenerator(org.apache.cayenne.dba.sybase.SybasePkGenerator) SybaseAdapter(org.apache.cayenne.dba.sybase.SybaseAdapter) DoubleType(org.apache.cayenne.access.types.DoubleType) DefaultBatchTranslatorFactory(org.apache.cayenne.access.translator.batch.DefaultBatchTranslatorFactory) BatchTranslatorFactory(org.apache.cayenne.access.translator.batch.BatchTranslatorFactory) DefaultClassLoaderManager(org.apache.cayenne.di.spi.DefaultClassLoaderManager) ClassLoaderManager(org.apache.cayenne.di.ClassLoaderManager) CayenneSQLTemplateProcessor(org.apache.cayenne.template.CayenneSQLTemplateProcessor) SQLTemplateProcessor(org.apache.cayenne.access.jdbc.SQLTemplateProcessor) DefaultAdhocObjectFactory(org.apache.cayenne.di.spi.DefaultAdhocObjectFactory) AdhocObjectFactory(org.apache.cayenne.di.AdhocObjectFactory) OracleSniffer(org.apache.cayenne.dba.oracle.OracleSniffer) HSQLDBSniffer(org.apache.cayenne.dba.hsqldb.HSQLDBSniffer) CalendarType(org.apache.cayenne.access.types.CalendarType) DefaultSelectTranslatorFactory(org.apache.cayenne.access.translator.select.DefaultSelectTranslatorFactory) SelectTranslatorFactory(org.apache.cayenne.access.translator.select.SelectTranslatorFactory)

Example 3 with ByteType

use of org.apache.cayenne.access.types.ByteType 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");
    ServerModule.contributeDomainFilters(binder);
    ServerModule.contributeDomainSyncFilters(binder);
    ServerModule.contributeDomainQueryFilters(binder);
    binder.bind(PkGeneratorFactoryProvider.class).to(PkGeneratorFactoryProvider.class);
    binder.bind(PkGenerator.class).to(JdbcPkGenerator.class);
    ServerModule.contributePkGenerators(binder).put(DB2Adapter.class.getName(), DB2PkGenerator.class).put(DerbyAdapter.class.getName(), DerbyPkGenerator.class).put(FrontBaseAdapter.class.getName(), FrontBasePkGenerator.class).put(H2Adapter.class.getName(), H2PkGenerator.class).put(IngresAdapter.class.getName(), IngresPkGenerator.class).put(MySQLAdapter.class.getName(), MySQLPkGenerator.class).put(OpenBaseAdapter.class.getName(), OpenBasePkGenerator.class).put(OracleAdapter.class.getName(), OraclePkGenerator.class).put(Oracle8Adapter.class.getName(), OraclePkGenerator.class).put(PostgresAdapter.class.getName(), PostgresPkGenerator.class).put(SQLServerAdapter.class.getName(), SybasePkGenerator.class).put(SybaseAdapter.class.getName(), SybasePkGenerator.class);
    // 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)).add(new DurationType());
    ServerModule.contributeUserTypes(binder);
    ServerModule.contributeTypeFactories(binder).add(new InternalUnsupportedTypeFactory());
    ServerModule.contributeValueObjectTypes(binder).add(BigIntegerValueType.class).add(BigDecimalValueType.class).add(UUIDValueType.class).add(LocalDateValueType.class).add(LocalTimeValueType.class).add(LocalDateTimeValueType.class).add(PeriodValueType.class).add(CharacterValueType.class);
    binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
    binder.bind(ValueComparisonStrategyFactory.class).to(DefaultValueComparisonStrategyFactory.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.bindMap(TestContainerProvider.class).put("mysql", MysqlContainerProvider.class).put("mariadb", MariaDbContainerProvider.class).put("postgres", PostgresContainerProvider.class).put("sqlserver", SqlServerContainerProvider.class).put("oracle", OracleContainerProvider.class).put("db2", Db2ContainerProvider.class);
    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);
}
Also used : SQLServerUnitDbAdapter(org.apache.cayenne.unit.SQLServerUnitDbAdapter) JdbcAdapter(org.apache.cayenne.dba.JdbcAdapter) SQLiteUnitDbAdapter(org.apache.cayenne.unit.SQLiteUnitDbAdapter) FrontBasePkGenerator(org.apache.cayenne.dba.frontbase.FrontBasePkGenerator) PeriodValueType(org.apache.cayenne.access.types.PeriodValueType) ValueComparisonStrategyFactory(org.apache.cayenne.reflect.generic.ValueComparisonStrategyFactory) DefaultValueComparisonStrategyFactory(org.apache.cayenne.reflect.generic.DefaultValueComparisonStrategyFactory) ByteType(org.apache.cayenne.access.types.ByteType) FloatType(org.apache.cayenne.access.types.FloatType) DataSourceInfo(org.apache.cayenne.conn.DataSourceInfo) XMLReaderProvider(org.apache.cayenne.configuration.xml.XMLReaderProvider) SQLTemplateCustomizer(org.apache.cayenne.unit.util.SQLTemplateCustomizer) HandlerFactory(org.apache.cayenne.configuration.xml.HandlerFactory) DefaultHandlerFactory(org.apache.cayenne.configuration.xml.DefaultHandlerFactory) NoopDataChannelMetaData(org.apache.cayenne.configuration.xml.NoopDataChannelMetaData) DataChannelMetaData(org.apache.cayenne.configuration.xml.DataChannelMetaData) UtilDateType(org.apache.cayenne.access.types.UtilDateType) MysqlContainerProvider(org.apache.cayenne.unit.testcontainers.MysqlContainerProvider) UtilDateType(org.apache.cayenne.access.types.UtilDateType) DateType(org.apache.cayenne.access.types.DateType) OracleContainerProvider(org.apache.cayenne.unit.testcontainers.OracleContainerProvider) DB2PkGenerator(org.apache.cayenne.dba.db2.DB2PkGenerator) DefaultRuntimeProperties(org.apache.cayenne.configuration.DefaultRuntimeProperties) RuntimeProperties(org.apache.cayenne.configuration.RuntimeProperties) ResourceLocator(org.apache.cayenne.resource.ResourceLocator) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) OracleAdapter(org.apache.cayenne.dba.oracle.OracleAdapter) PkGeneratorFactoryProvider(org.apache.cayenne.configuration.server.PkGeneratorFactoryProvider) ShortType(org.apache.cayenne.access.types.ShortType) GregorianCalendar(java.util.GregorianCalendar) ObjectMapRetainStrategy(org.apache.cayenne.access.ObjectMapRetainStrategy) DefaultObjectMapRetainStrategy(org.apache.cayenne.access.DefaultObjectMapRetainStrategy) SQLiteAdapter(org.apache.cayenne.dba.sqlite.SQLiteAdapter) ByteArrayType(org.apache.cayenne.access.types.ByteArrayType) HSQLDBAdapter(org.apache.cayenne.dba.hsqldb.HSQLDBAdapter) PostgresUnitDbAdapter(org.apache.cayenne.unit.PostgresUnitDbAdapter) FirebirdUnitDbAdapter(org.apache.cayenne.unit.FirebirdUnitDbAdapter) CharType(org.apache.cayenne.access.types.CharType) BigDecimalType(org.apache.cayenne.access.types.BigDecimalType) VoidType(org.apache.cayenne.access.types.VoidType) DerbyAdapter(org.apache.cayenne.dba.derby.DerbyAdapter) SQLServerAdapter(org.apache.cayenne.dba.sqlserver.SQLServerAdapter) LongType(org.apache.cayenne.access.types.LongType) DataSourceFactory(org.apache.cayenne.configuration.server.DataSourceFactory) IngresPkGenerator(org.apache.cayenne.dba.ingres.IngresPkGenerator) ObjectStoreFactory(org.apache.cayenne.configuration.ObjectStoreFactory) DefaultObjectStoreFactory(org.apache.cayenne.configuration.DefaultObjectStoreFactory) OraclePkGenerator(org.apache.cayenne.dba.oracle.OraclePkGenerator) DataMapLoader(org.apache.cayenne.configuration.DataMapLoader) XMLDataMapLoader(org.apache.cayenne.configuration.xml.XMLDataMapLoader) SybaseUnitDbAdapter(org.apache.cayenne.unit.SybaseUnitDbAdapter) ValueObjectTypeRegistry(org.apache.cayenne.access.types.ValueObjectTypeRegistry) DefaultValueObjectTypeRegistry(org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry) FrontBaseUnitDbAdapter(org.apache.cayenne.unit.FrontBaseUnitDbAdapter) DerbyPkGenerator(org.apache.cayenne.dba.derby.DerbyPkGenerator) OraclePkGenerator(org.apache.cayenne.dba.oracle.OraclePkGenerator) H2PkGenerator(org.apache.cayenne.dba.h2.H2PkGenerator) PostgresPkGenerator(org.apache.cayenne.dba.postgres.PostgresPkGenerator) OpenBasePkGenerator(org.apache.cayenne.dba.openbase.OpenBasePkGenerator) MySQLPkGenerator(org.apache.cayenne.dba.mysql.MySQLPkGenerator) IngresPkGenerator(org.apache.cayenne.dba.ingres.IngresPkGenerator) DB2PkGenerator(org.apache.cayenne.dba.db2.DB2PkGenerator) JdbcPkGenerator(org.apache.cayenne.dba.JdbcPkGenerator) PkGenerator(org.apache.cayenne.dba.PkGenerator) FrontBasePkGenerator(org.apache.cayenne.dba.frontbase.FrontBasePkGenerator) SybasePkGenerator(org.apache.cayenne.dba.sybase.SybasePkGenerator) BigIntegerValueType(org.apache.cayenne.access.types.BigIntegerValueType) TimeType(org.apache.cayenne.access.types.TimeType) UnitTestLifecycleManager(org.apache.cayenne.unit.di.UnitTestLifecycleManager) PostgresContainerProvider(org.apache.cayenne.unit.testcontainers.PostgresContainerProvider) UUIDValueType(org.apache.cayenne.access.types.UUIDValueType) FrontBaseUnitDbAdapter(org.apache.cayenne.unit.FrontBaseUnitDbAdapter) UnitDbAdapter(org.apache.cayenne.unit.UnitDbAdapter) SybaseUnitDbAdapter(org.apache.cayenne.unit.SybaseUnitDbAdapter) PostgresUnitDbAdapter(org.apache.cayenne.unit.PostgresUnitDbAdapter) HSQLDBUnitDbAdapter(org.apache.cayenne.unit.HSQLDBUnitDbAdapter) DbAdapter(org.apache.cayenne.dba.DbAdapter) MySQLUnitDbAdapter(org.apache.cayenne.unit.MySQLUnitDbAdapter) IngresUnitDbAdapter(org.apache.cayenne.unit.IngresUnitDbAdapter) SQLiteUnitDbAdapter(org.apache.cayenne.unit.SQLiteUnitDbAdapter) SQLServerUnitDbAdapter(org.apache.cayenne.unit.SQLServerUnitDbAdapter) H2UnitDbAdapter(org.apache.cayenne.unit.H2UnitDbAdapter) FirebirdUnitDbAdapter(org.apache.cayenne.unit.FirebirdUnitDbAdapter) DerbyUnitDbAdapter(org.apache.cayenne.unit.DerbyUnitDbAdapter) OpenBaseUnitDbAdapter(org.apache.cayenne.unit.OpenBaseUnitDbAdapter) OracleUnitDbAdapter(org.apache.cayenne.unit.OracleUnitDbAdapter) DB2UnitDbAdapter(org.apache.cayenne.unit.DB2UnitDbAdapter) Slf4jJdbcEventLogger(org.apache.cayenne.log.Slf4jJdbcEventLogger) JdbcEventLogger(org.apache.cayenne.log.JdbcEventLogger) ConfigurationNameMapper(org.apache.cayenne.configuration.ConfigurationNameMapper) DefaultConfigurationNameMapper(org.apache.cayenne.configuration.DefaultConfigurationNameMapper) DerbyUnitDbAdapter(org.apache.cayenne.unit.DerbyUnitDbAdapter) TimestampType(org.apache.cayenne.access.types.TimestampType) H2Adapter(org.apache.cayenne.dba.h2.H2Adapter) FrontBaseUnitDbAdapter(org.apache.cayenne.unit.FrontBaseUnitDbAdapter) UnitDbAdapter(org.apache.cayenne.unit.UnitDbAdapter) SybaseUnitDbAdapter(org.apache.cayenne.unit.SybaseUnitDbAdapter) PostgresUnitDbAdapter(org.apache.cayenne.unit.PostgresUnitDbAdapter) HSQLDBUnitDbAdapter(org.apache.cayenne.unit.HSQLDBUnitDbAdapter) MySQLUnitDbAdapter(org.apache.cayenne.unit.MySQLUnitDbAdapter) IngresUnitDbAdapter(org.apache.cayenne.unit.IngresUnitDbAdapter) SQLiteUnitDbAdapter(org.apache.cayenne.unit.SQLiteUnitDbAdapter) SQLServerUnitDbAdapter(org.apache.cayenne.unit.SQLServerUnitDbAdapter) H2UnitDbAdapter(org.apache.cayenne.unit.H2UnitDbAdapter) FirebirdUnitDbAdapter(org.apache.cayenne.unit.FirebirdUnitDbAdapter) DerbyUnitDbAdapter(org.apache.cayenne.unit.DerbyUnitDbAdapter) OpenBaseUnitDbAdapter(org.apache.cayenne.unit.OpenBaseUnitDbAdapter) OracleUnitDbAdapter(org.apache.cayenne.unit.OracleUnitDbAdapter) DB2UnitDbAdapter(org.apache.cayenne.unit.DB2UnitDbAdapter) DurationType(org.apache.cayenne.access.types.DurationType) OpenBasePkGenerator(org.apache.cayenne.dba.openbase.OpenBasePkGenerator) HSQLDBUnitDbAdapter(org.apache.cayenne.unit.HSQLDBUnitDbAdapter) FrontBaseAdapter(org.apache.cayenne.dba.frontbase.FrontBaseAdapter) InternalUnsupportedTypeFactory(org.apache.cayenne.access.types.InternalUnsupportedTypeFactory) FirebirdAdapter(org.apache.cayenne.dba.firebird.FirebirdAdapter) LocalTimeValueType(org.apache.cayenne.access.types.LocalTimeValueType) BooleanType(org.apache.cayenne.access.types.BooleanType) DataChannelInterceptor(org.apache.cayenne.unit.di.DataChannelInterceptor) PostgresAdapter(org.apache.cayenne.dba.postgres.PostgresAdapter) IntegerType(org.apache.cayenne.access.types.IntegerType) MySQLAdapter(org.apache.cayenne.dba.mysql.MySQLAdapter) SybaseAdapter(org.apache.cayenne.dba.sybase.SybaseAdapter) SybasePkGenerator(org.apache.cayenne.dba.sybase.SybasePkGenerator) DoubleType(org.apache.cayenne.access.types.DoubleType) BatchTranslatorFactory(org.apache.cayenne.access.translator.batch.BatchTranslatorFactory) DefaultClassLoaderManager(org.apache.cayenne.di.spi.DefaultClassLoaderManager) ClassLoaderManager(org.apache.cayenne.di.ClassLoaderManager) DefaultAdhocObjectFactory(org.apache.cayenne.di.spi.DefaultAdhocObjectFactory) AdhocObjectFactory(org.apache.cayenne.di.AdhocObjectFactory) CalendarType(org.apache.cayenne.access.types.CalendarType)

Example 4 with ByteType

use of org.apache.cayenne.access.types.ByteType in project cayenne by apache.

the class DerbyAdapter method configureExtendedTypes.

/**
 * Installs appropriate ExtendedTypes as converters for passing values between JDBC
 * and Java layers.
 */
@Override
protected void configureExtendedTypes(ExtendedTypeMap map) {
    super.configureExtendedTypes(map);
    // create specially configured CharType handler
    CharType charType = new CharType(true, true);
    map.registerType(charType);
    // address Derby driver inability to handle java.lang.Short and java.lang.Byte
    map.registerType(new ShortType(true));
    map.registerType(new ByteType(true));
    map.registerType(new JsonType(charType, true));
}
Also used : JsonType(org.apache.cayenne.access.types.JsonType) ShortType(org.apache.cayenne.access.types.ShortType) CharType(org.apache.cayenne.access.types.CharType) ByteType(org.apache.cayenne.access.types.ByteType)

Example 5 with ByteType

use of org.apache.cayenne.access.types.ByteType in project cayenne by apache.

the class OracleAdapter method configureExtendedTypes.

/**
 * Installs appropriate ExtendedTypes as converters for passing values
 * between JDBC and Java layers.
 */
@Override
protected void configureExtendedTypes(ExtendedTypeMap map) {
    super.configureExtendedTypes(map);
    // create specially configured CharType handler
    map.registerType(new OracleCharType());
    // create specially configured ByteArrayType handler
    map.registerType(new OracleByteArrayType());
    // override date handler with Oracle handler
    map.registerType(new OracleUtilDateType());
    // At least on MacOS X, driver does not handle Short and Byte properly
    map.registerType(new ShortType(true));
    map.registerType(new ByteType(true));
    map.registerType(new OracleBooleanType());
}
Also used : ShortType(org.apache.cayenne.access.types.ShortType) ByteType(org.apache.cayenne.access.types.ByteType)

Aggregations

ByteType (org.apache.cayenne.access.types.ByteType)5 ShortType (org.apache.cayenne.access.types.ShortType)5 CharType (org.apache.cayenne.access.types.CharType)4 ByteArrayType (org.apache.cayenne.access.types.ByteArrayType)3 GregorianCalendar (java.util.GregorianCalendar)2 DefaultObjectMapRetainStrategy (org.apache.cayenne.access.DefaultObjectMapRetainStrategy)2 ObjectMapRetainStrategy (org.apache.cayenne.access.ObjectMapRetainStrategy)2 BatchTranslatorFactory (org.apache.cayenne.access.translator.batch.BatchTranslatorFactory)2 BigDecimalType (org.apache.cayenne.access.types.BigDecimalType)2 BigIntegerValueType (org.apache.cayenne.access.types.BigIntegerValueType)2 BooleanType (org.apache.cayenne.access.types.BooleanType)2 CalendarType (org.apache.cayenne.access.types.CalendarType)2 DateType (org.apache.cayenne.access.types.DateType)2 DefaultValueObjectTypeRegistry (org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry)2 DoubleType (org.apache.cayenne.access.types.DoubleType)2 DurationType (org.apache.cayenne.access.types.DurationType)2 FloatType (org.apache.cayenne.access.types.FloatType)2 IntegerType (org.apache.cayenne.access.types.IntegerType)2 InternalUnsupportedTypeFactory (org.apache.cayenne.access.types.InternalUnsupportedTypeFactory)2 LocalTimeValueType (org.apache.cayenne.access.types.LocalTimeValueType)2