Search in sources :

Example 1 with ExtendedTypeFactory

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

the class PerAdapterProviderTest method before.

@Before
public void before() {
    ResourceLocator locator = new ClassLoaderResourceLocator(new DefaultClassLoaderManager());
    RuntimeProperties runtimeProperties = mock(RuntimeProperties.class);
    ValueObjectTypeRegistry valueObjectTypeRegistry = mock(ValueObjectTypeRegistry.class);
    this.oracleAdapter = new OracleAdapter(runtimeProperties, Collections.<ExtendedType>emptyList(), Collections.<ExtendedType>emptyList(), Collections.<ExtendedTypeFactory>emptyList(), locator, valueObjectTypeRegistry);
    this.derbyAdapter = new DerbyAdapter(runtimeProperties, Collections.<ExtendedType>emptyList(), Collections.<ExtendedType>emptyList(), Collections.<ExtendedTypeFactory>emptyList(), locator, valueObjectTypeRegistry);
    this.autoDerbyAdapter = new AutoAdapter(new Provider<DbAdapter>() {

        @Override
        public DbAdapter get() throws DIRuntimeException {
            return derbyAdapter;
        }
    }, new Slf4jJdbcEventLogger(runtimeProperties));
}
Also used : OracleAdapter(org.apache.cayenne.dba.oracle.OracleAdapter) DerbyAdapter(org.apache.cayenne.dba.derby.DerbyAdapter) Slf4jJdbcEventLogger(org.apache.cayenne.log.Slf4jJdbcEventLogger) ExtendedTypeFactory(org.apache.cayenne.access.types.ExtendedTypeFactory) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) ValueObjectTypeRegistry(org.apache.cayenne.access.types.ValueObjectTypeRegistry) ExtendedType(org.apache.cayenne.access.types.ExtendedType) DefaultClassLoaderManager(org.apache.cayenne.di.spi.DefaultClassLoaderManager) RuntimeProperties(org.apache.cayenne.configuration.RuntimeProperties) ResourceLocator(org.apache.cayenne.resource.ResourceLocator) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) Provider(org.apache.cayenne.di.Provider) Before(org.junit.Before)

Example 2 with ExtendedTypeFactory

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

the class JdbcAdapter method initExtendedTypes.

/**
 * @since 3.1
 */
protected void initExtendedTypes(List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) {
    for (ExtendedType type : defaultExtendedTypes) {
        extendedTypes.registerType(type);
    }
    // loading adapter specific extended types
    configureExtendedTypes(extendedTypes);
    for (ExtendedType type : userExtendedTypes) {
        extendedTypes.registerType(type);
    }
    for (ExtendedTypeFactory typeFactory : extendedTypeFactories) {
        extendedTypes.addFactory(typeFactory);
    }
    extendedTypes.addFactory(new ValueObjectTypeFactory(extendedTypes, valueObjectTypeRegistry));
}
Also used : ExtendedTypeFactory(org.apache.cayenne.access.types.ExtendedTypeFactory) ValueObjectTypeFactory(org.apache.cayenne.access.types.ValueObjectTypeFactory) ExtendedType(org.apache.cayenne.access.types.ExtendedType)

Aggregations

ExtendedType (org.apache.cayenne.access.types.ExtendedType)2 ExtendedTypeFactory (org.apache.cayenne.access.types.ExtendedTypeFactory)2 ValueObjectTypeFactory (org.apache.cayenne.access.types.ValueObjectTypeFactory)1 ValueObjectTypeRegistry (org.apache.cayenne.access.types.ValueObjectTypeRegistry)1 RuntimeProperties (org.apache.cayenne.configuration.RuntimeProperties)1 DerbyAdapter (org.apache.cayenne.dba.derby.DerbyAdapter)1 OracleAdapter (org.apache.cayenne.dba.oracle.OracleAdapter)1 Provider (org.apache.cayenne.di.Provider)1 DefaultClassLoaderManager (org.apache.cayenne.di.spi.DefaultClassLoaderManager)1 Slf4jJdbcEventLogger (org.apache.cayenne.log.Slf4jJdbcEventLogger)1 ClassLoaderResourceLocator (org.apache.cayenne.resource.ClassLoaderResourceLocator)1 ResourceLocator (org.apache.cayenne.resource.ResourceLocator)1 Before (org.junit.Before)1