Package org.hibernate.ogm.datastore.spi

Examples of org.hibernate.ogm.datastore.spi.DatastoreProvider


      envProps.put( environmentVariableName, value );
    }
  }

  private CouchDBDatastore getDataStore(SessionFactory sessionFactory) {
    DatastoreProvider provider = ( (SessionFactoryImplementor) sessionFactory )
        .getServiceRegistry()
        .getService( DatastoreProvider.class );

    if ( !( provider instanceof CouchDBDatastoreProvider ) ) {
      throw new RuntimeException( "DatastoreProvider is not an instance of " + CouchDBDatastoreProvider.class );
View Full Code Here


    InfinispanDatastoreProvider castProvider = getProvider( sessionFactory );
    return castProvider.getCache( ENTITY_CACHE );
  }

  public static InfinispanDatastoreProvider getProvider(SessionFactory sessionFactory) {
    DatastoreProvider provider = ( (SessionFactoryImplementor) sessionFactory ).getServiceRegistry().getService( DatastoreProvider.class );
    if ( !( InfinispanDatastoreProvider.class.isInstance( provider ) ) ) {
      throw new RuntimeException( "Not testing with Infinispan, cannot extract underlying cache" );
    }
    return InfinispanDatastoreProvider.class.cast( provider );
  }
View Full Code Here

    return tuple;
  }

  private static EhcacheDatastoreProvider getProvider(SessionFactory sessionFactory) {
    DatastoreProvider provider = ( (SessionFactoryImplementor) sessionFactory ).getServiceRegistry()
        .getService( DatastoreProvider.class );
    if ( !( EhcacheDatastoreProvider.class.isInstance( provider ) ) ) {
      throw new RuntimeException( "Not testing with Ehcache, cannot extract underlying cache" );
    }
    return EhcacheDatastoreProvider.class.cast( provider );
View Full Code Here

  public boolean backendSupportsTransactions() {
    return false;
  }

  private static MongoDBDatastoreProvider getProvider(SessionFactory sessionFactory) {
    DatastoreProvider provider = ( (SessionFactoryImplementor) sessionFactory ).getServiceRegistry().getService(
        DatastoreProvider.class );
    if ( !( MongoDBDatastoreProvider.class.isInstance( provider ) ) ) {
      throw new RuntimeException( "Not testing with MongoDB, cannot extract underlying cache" );
    }
    return MongoDBDatastoreProvider.class.cast( provider );
View Full Code Here

    //FIXME check the version number as well and raise an optimistic lock exception if there is an issue JPA 2 spec: 3.4.4.2
  }

  private InfinispanDatastoreProvider getProvider(SessionImplementor session) {
    if ( provider == null ) {
      DatastoreProvider service = session.getFactory().getServiceRegistry().getService( DatastoreProvider.class );
      if ( service instanceof InfinispanDatastoreProvider ) {
        provider = InfinispanDatastoreProvider.class.cast( service );
      }
      else {
        log.unexpectedDatastoreProvider( service.getClass(), InfinispanDatastoreProvider.class );
      }
    }
    return provider;
  }
View Full Code Here

    return new JBossStandAloneJtaPlatform();
  }

  //TODO OGM-370 get rid of this!!!
  private boolean isNeo4j(Map configuration, ClassLoaderService classLoaderService) {
    DatastoreProvider configuredProvider = new ConfigurationPropertyReader( configuration, classLoaderService )
      .property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class )
      .instantiate()
      .withShortNameResolver( new DatastoreProviderInitiator.DatastoreProviderShortNameResolver() )
      .getValue();

    return configuredProvider != null &&
        configuredProvider.getClass().getName().equals(
            AvailableDatastoreProvider.NEO4J_EMBEDDED.getDatastoreProviderClassName() );
  }
View Full Code Here

    return SchemaDefiner.class;
  }

  @Override
  public SchemaDefiner initiateService(SessionFactoryImplementor sessionFactory, Configuration configuration, ServiceRegistryImplementor registry) {
    DatastoreProvider datastoreProvider = registry.getService( DatastoreProvider.class );
    Class<? extends SchemaDefiner> schemaInitializerType = datastoreProvider.getSchemaDefinerType();

    if ( schemaInitializerType != null ) {
      try {
        return schemaInitializerType.newInstance();
      }
View Full Code Here

  @Override
  public DatastoreProvider initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, registry.getService( ClassLoaderService.class ) );

    DatastoreProvider datastoreProvider = propertyReader.property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class )
        .instantiate()
        .withDefaultImplementation( DEFAULT_DATASTORE_PROVIDER )
        .withShortNameResolver( DatastoreProviderShortNameResolver.INSTANCE )
        .getValue();

    log.useDatastoreProvider( datastoreProvider.getClass().getName() );
    return datastoreProvider;
  }
View Full Code Here

    MapDatastoreProvider castProvider = getProvider( sessionFactory );
    return castProvider.getEntityMap();
  }

  private static MapDatastoreProvider getProvider(SessionFactory sessionFactory) {
    DatastoreProvider provider = ( (SessionFactoryImplementor) sessionFactory ).getServiceRegistry().getService( DatastoreProvider.class );
    if ( !( MapDatastoreProvider.class.isInstance( provider ) ) ) {
      throw new RuntimeException( "Not testing with MapDatastoreProvider, cannot extract underlying map" );
    }
    return MapDatastoreProvider.class.cast( provider );
  }
View Full Code Here

    // (Comment by Emmanuel)
  }

  protected final MapDatastoreProvider getProvider(SessionImplementor session) {
    if ( provider == null ) {
      DatastoreProvider service = session.getFactory().getServiceRegistry().getService( DatastoreProvider.class );
      if ( service instanceof MapDatastoreProvider ) {
        provider = (MapDatastoreProvider) service;
      }
      else {
        log.unexpectedDatastoreProvider( service.getClass(), MapDatastoreProvider.class );
      }
    }
    return provider;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.spi.DatastoreProvider

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.