クラス CqlSessionFactoryBean

java.lang.ObjectSE
org.springframework.data.cassandra.config.CqlSessionFactoryBean
実装されたすべてのインターフェース:
org.springframework.beans.factory.DisposableBeanorg.springframework.beans.factory.FactoryBean<com.datastax.oss.driver.api.core.CqlSession>org.springframework.beans.factory.InitializingBeanorg.springframework.dao.support.PersistenceExceptionTranslator
既知の直属サブクラス
CassandraCqlSessionFactoryBeanCassandraSessionFactoryBean

public class CqlSessionFactoryBean extends ObjectSE implements org.springframework.beans.factory.FactoryBean<com.datastax.oss.driver.api.core.CqlSession>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.dao.support.PersistenceExceptionTranslator
スレッドセーフなシングルトンである Cassandra CqlSession を作成および構成するためのファクトリ。そのため、アプリケーションとキースペースごとに 1 つの CqlSession があれば十分です。
導入:
3.0
作成者:
Alex Shvid, Matthew T. Adams, John Blum, Mark Paluch, Tomasz Lelek, Ammar Khaku
  • フィールドの詳細

  • コンストラクターの詳細

    • CqlSessionFactoryBean

      public CqlSessionFactoryBean()
  • メソッドの詳細

    • isConnected

      public boolean isConnected()
      Cassandra CqlSession が接続されているかどうかを判断するための Null セーフ操作。
      戻り値:
      Cassandra CqlSession が接続されているかどうかを示すブール値。
      関連事項:
    • setContactPoints

      public void setContactPoints(StringSE contactPoints)
      接続するコンタクトポイント (ホスト) のコンマ区切りの文字列を設定します。デフォルトは localhost です。DEFAULT_CONTACT_POINTS を参照してください。コンタクトポイントは、host:port 形式を使用することも、構成された port を使用する単純な host 形式を使用することもできます。
      パラメーター:
      contactPoints - 新しいクラスターによって使用される連絡先ポイントは null であってはなりません。
    • setContactPoints

      public void setContactPoints(CollectionSE<InetSocketAddressSE> contactPoints)
      接続する連絡先 (ホスト) のコレクションを設定します。デフォルトは localhost です。DEFAULT_CONTACT_POINTS を参照してください。
      パラメーター:
      contactPoints - 新しいクラスターが使用するコンタクトポイントは null であってはなりません。ホスト名の解決をドライバーに委譲するには、unresolved addressesSE を使用します。
      導入:
      3.1
    • setLocalDatacenter

      public void setLocalDatacenter(@Nullable StringSE localDatacenter)
      ローカルデータセンターの名前を設定します。
      パラメーター:
      localDatacenter - ローカルデータセンターの名前を示す文字列。
    • setPort

      public void setPort(int port)
      接点のポートを設定します。デフォルトは 9042 です。DEFAULT_PORT を参照してください。
      パラメーター:
      port - 新しいクラスターで使用されるポート。
    • setUsername

      public void setUsername(StringSE username)
      使用するユーザー名を設定します。
      パラメーター:
      username - 設定するユーザー名。
    • setPassword

      public void setPassword(StringSE password)
      使用するパスワードを設定します。
      パラメーター:
      password - 設定するパスワード。
    • setConverter

      @DeprecatedSE public void setConverter(CassandraConverter converter)
      使用すべきではありません。
      代わりに SessionFactoryFactoryBeanSessionFactoryFactoryBean.setConverter(CassandraConverter) と一緒に使用してください。
      使用する CassandraConverter を設定します。スキーマアクションは、converter 内の CassandraMappingContext からテーブルとユーザー型情報を取得します。
      パラメーター:
      converter - null であってはなりません。
    • getConverter

      @Nullable public CassandraConverter getConverter()
      戻り値:
      構成された CassandraConverter
    • setKeyspaceActions

      public void setKeyspaceActions(ListSE<KeyspaceActions> keyspaceActions)
      初期化時に実行される ListSE または KeyspaceActions を設定します。キースペースアクションには、作成および削除の仕様が含まれる場合があります。
      パラメーター:
      keyspaceActions - KeyspaceActionsListSE
    • getKeyspaceActions

      public ListSE<KeyspaceActions> getKeyspaceActions()
      戻り値:
      KeyspaceActionsListSE
    • setKeyspaceAlterations

      public void setKeyspaceAlterations(ListSE<AlterKeyspaceSpecification> specifications)
      このファクトリが initialized の場合に実行される alter keyspace specificationsListSE を設定します。Alter keyspace specifications は、setStartupScripts(List) を実行する前に、キースペースが設定されていないシステムセッションで実行されます。
      パラメーター:
      specifications - create keyspace specificationsListSE
    • setKeyspaceCreations

      public void setKeyspaceCreations(ListSE<CreateKeyspaceSpecification> specifications)
      このファクトリが initialized の場合に実行される create keyspace specificationsListSE を設定します。Create keyspace specifications は、setStartupScripts(List) を実行する前に、キースペースが設定されていないシステムセッションで実行されます。
      パラメーター:
      specifications - create keyspace specificationsListSE
    • setKeyspaceDrops

      public void setKeyspaceDrops(ListSE<DropKeyspaceSpecification> specifications)
      このファクトリが destroyed の場合に実行される drop keyspace specificationsListSE を設定します。Drop keyspace specifications は、setShutdownScripts(List) を実行する前に、キースペースが設定されていないシステムセッションで実行されます。
      パラメーター:
      specifications - drop keyspace specificationsListSE
    • setKeyspaceName

      public void setKeyspaceName(@Nullable StringSE keyspaceName)
      接続する Cassandra キースペースの名前を設定します。null を渡すと、Cassandra システムキースペースが使用されます。
      パラメーター:
      keyspaceName - 接続するキースペースの名前を示す文字列。
      関連事項:
    • getKeyspaceName

      @Nullable protected StringSE getKeyspaceName()
      接続する Cassandra キースペースの名前を取得します。
      戻り値:
      接続する Cassandra キースペースの名前 (文字列)。
      関連事項:
    • setKeyspaceSpecifications

      public void setKeyspaceSpecifications(ListSE<? extends KeyspaceActionSpecification> keyspaceSpecifications)
      パラメーター:
      keyspaceSpecifications - 設定する KeyspaceActionSpecification
    • getKeyspaceSpecifications

      public SetSE<KeyspaceActionSpecification> getKeyspaceSpecifications()
      戻り値:
      このファクトリに関連付けられた KeyspaceActionSpecification
    • setKeyspaceStartupScripts

      public void setKeyspaceStartupScripts(ListSE<StringSE> scripts)
      このファクトリが initialized の場合、システムキースペースのスコープ内で実行される生の CQL statementsSEListSE を設定します。スクリプトは、setKeyspaceCreations(List) を実行した後、キースペースが設定されていないシステムセッションで実行されます。
      パラメーター:
      scripts - 起動時に実行するスクリプト
    • setKeyspaceShutdownScripts

      public void setKeyspaceShutdownScripts(ListSE<StringSE> scripts)
      このファクトリが destroyed の場合、システムキースペースのスコープ内で実行される生の CQL statementsSEListSE を設定します。Drop keyspace specifications は、setKeyspaceDrops(List) の実行後に、キースペースが設定されていないシステムセッションで実行されます。
      パラメーター:
      scripts - シャットダウン時に実行するスクリプト
    • getMappingContext

      protected CassandraMappingContext getMappingContext()
      戻り値:
      CassandraMappingContext
    • setSchemaAction

      @DeprecatedSE public void setSchemaAction(SchemaAction schemaAction)
      使用すべきではありません。
      代わりに SessionFactoryFactoryBeanSessionFactoryFactoryBean.setSchemaAction(SchemaAction) と一緒に使用してください。
      SchemaAction を設定してください。
      パラメーター:
      schemaAction - null であってはなりません。
    • getSchemaAction

      public SchemaAction getSchemaAction()
      戻り値:
      SchemaAction
    • setSuspendLifecycleSchemaRefresh

      public void setSuspendLifecycleSchemaRefresh(boolean suspendLifecycleSchemaRefresh)
      afterPropertiesSet() および destroy() ライフサイクルコールバック中にスキーマリフレッシュ設定を一時停止するかどうかを設定します。セッション構成のスキーマメタデータ設定を使用するために、デフォルトでは無効になっています。有効にすると ( true に設定)、ライフサイクルメソッド中のスキーマリフレッシュは、各 DDL ステートメントの定期的なスキーマリフレッシュを回避するために、スキーマアクションが終了するまで一時停止されます。

      スキーマのリフレッシュを一時停止すると、スキーマ全体が作成されるまでスキーマの合意を遅らせるのに役立ちます。スキーマのリフレッシュを無効にすると、スキーマのアクションが妨げられる可能性があることに注意してください。SchemaAction.RECREATE_DROP_UNUSED およびマッピングベースのスキーマ作成は、スキーマメタデータに依存します。

      パラメーター:
      suspendLifecycleSchemaRefresh - ライフサイクルコールバック中にスキーマのリフレッシュを一時停止するには true を使用します。それ以外の場合は、セッションスキーマのリフレッシュ構成を保持するには false を使用します。
      導入:
      2.7
    • getSession

      protected com.datastax.oss.driver.api.core.CqlSession getSession()
      接続された Cassandra CqlSession への参照を返します。
      戻り値:
      接続された Cassandra CqlSession への参照。
      例外:
      IllegalStateExceptionSE - Cassandra CqlSession が適切に初期化されなかった場合。
      関連事項:
      • CqlSession
    • setSessionBuilderConfigurer

      public void setSessionBuilderConfigurer(@Nullable SessionBuilderConfigurer sessionBuilderConfigurer)
      SessionBuilderConfigurer を設定して SessionBuilder を構成します。
      パラメーター:
      sessionBuilderConfigurer -
    • setStartupScripts

      @DeprecatedSE public void setStartupScripts(@Nullable ListSE<StringSE> scripts)
      使用すべきではありません。
      代わりに、KeyspacePopulator と一緒に SessionFactoryInitializer または SessionFactoryFactoryBean を使用してください。
      セッションが接続された直後に実行される CQL スクリプトを設定します。
    • getStartupScripts

      @DeprecatedSE public ListSE<StringSE> getStartupScripts()
      使用すべきではありません。
      代わりに、KeyspacePopulator と一緒に SessionFactoryInitializer または SessionFactoryFactoryBean を使用してください。
      変更不可能な起動スクリプトのリストを返します。
    • setShutdownScripts

      @DeprecatedSE public void setShutdownScripts(@Nullable ListSE<StringSE> scripts)
      使用すべきではありません。
      代わりに、KeyspacePopulator と一緒に SessionFactoryInitializer または SessionFactoryFactoryBean を使用してください。
      セッションがシャットダウンされる直前に実行される CQL スクリプトを設定します。
    • getShutdownScripts

      @DeprecatedSE public ListSE<StringSE> getShutdownScripts()
      使用すべきではありません。
      代わりに、KeyspacePopulator と一緒に SessionFactoryInitializer または SessionFactoryFactoryBean を使用してください。
      変更不可能なシャットダウンスクリプトのリストを返します。
    • afterPropertiesSet

      public void afterPropertiesSet()
      次で指定:
      インターフェース org.springframework.beans.factory.InitializingBeanafterPropertiesSet 
    • buildBuilder

      protected com.datastax.oss.driver.api.core.CqlSessionBuilder buildBuilder()
    • buildSystemSession

      protected com.datastax.oss.driver.api.core.CqlSession buildSystemSession(com.datastax.oss.driver.api.core.CqlSessionBuilder sessionBuilder)
      Cassandra System Session を組み立てます。
      パラメーター:
      sessionBuilder - CqlSessionBuilder は Cassandra CqlSession を構築するために使用されます。
      戻り値:
      組み立てられた Cassandra System Session
      関連事項:
      • CqlSessionBuilder
      • CqlSession
    • buildSession

      protected com.datastax.oss.driver.api.core.CqlSession buildSession(com.datastax.oss.driver.api.core.CqlSessionBuilder sessionBuilder)
      ユーザーが nameSE でキースペースを指定しなかった場合は、ユーザー定義のキースペースまたはデフォルトのキースペースに Session を構築します。
      パラメーター:
      sessionBuilder - CqlSessionBuilder は Cassandra CqlSession を構築するために使用されます。
      戻り値:
      構築された CqlSession をユーザー定義のキースペースに追加します。
      関連事項:
      • CqlSessionBuilder
      • CqlSession
    • performSchemaAction

      protected void performSchemaAction()
      CassandraMappingContext メタデータを使用して構成された SchemaAction を実行します。
    • createTables

      protected void createTables(boolean drop, boolean dropUnused, boolean ifNotExists)
      スキーマアクションを実行します。
      パラメーター:
      drop - 型 / テーブルを削除する場合は true です。
      dropUnused - 未使用の型 / テーブル(つまり、CassandraMappingContext によって使用されることが知られていない型 / テーブル)を削除する場合は true です。
      ifNotExists - 各作成ステートメントに IF NOT EXISTS を追加してフェイルセーフ作成を実行する場合は true です。
    • getObject

      public com.datastax.oss.driver.api.core.CqlSession getObject()
      次で指定:
      インターフェース org.springframework.beans.factory.FactoryBean<com.datastax.oss.driver.api.core.CqlSession>getObject 
    • getObjectType

      public ClassSE<? extends com.datastax.oss.driver.api.core.CqlSession> getObjectType()
      次で指定:
      インターフェース org.springframework.beans.factory.FactoryBean<com.datastax.oss.driver.api.core.CqlSession>getObjectType 
    • translateExceptionIfPossible

      @Nullable public org.springframework.dao.DataAccessException translateExceptionIfPossible(RuntimeExceptionSE e)
      次で指定:
      インターフェース org.springframework.dao.support.PersistenceExceptionTranslatortranslateExceptionIfPossible 
    • destroy

      public void destroy()
      次で指定:
      インターフェース org.springframework.beans.factory.DisposableBeandestroy 
    • closeSession

      protected void closeSession()
      通常のセッションオブジェクトを閉じます。
    • closeSystemSession

      protected void closeSystemSession()
      システムセッションオブジェクトを閉じます。