public Session getAdminSession()

in src/main/java/org/apache/fineract/cn/cassandra/core/CassandraSessionProvider.java [86:108]


  public Session getAdminSession() {
    if (this.adminClusterName == null
        || this.adminContactPoints == null
        || this.adminKeyspace == null) {
      throw new IllegalStateException("Cluster name, contact points, and keyspace must be set to retrieve an admin session.");
    }

    try {
      return this.getSession(this.adminClusterName, this.adminContactPoints, this.adminKeyspace);
    } catch (final KeyspaceDoesntExistYet ignored) {
      final Cluster cluster = this.clusterCache.get(adminClusterName);
      try (final Session session = cluster.newSession()) {
        session.execute("CREATE KEYSPACE " + this.adminKeyspace + " WITH REPLICATION = " +
            ReplicationStrategyResolver.replicationStrategy(
                env.getProperty(CassandraConnectorConstants.DEFAULT_REPLICATION_TYPE,
                    CassandraConnectorConstants.DEFAULT_REPLICATION_TYPE_DEFAULT),
                env.getProperty(CassandraConnectorConstants.DEFAULT_REPLICATION_REPLICAS,
                    CassandraConnectorConstants.DEFAULT_REPLICATION_REPLICAS_DEFAULT)));

        return this.getSession(this.adminClusterName, this.adminContactPoints, this.adminKeyspace);
      }
    }
  }