use of org.springframework.data.cassandra.SessionFactory in project spring-data-cassandra by spring-projects.
the class AbstractRoutingSessionFactory method afterPropertiesSet.
// -------------------------------------------------------------------------
// Implementation hooks and helper methods
// -------------------------------------------------------------------------
@Override
public void afterPropertiesSet() {
Assert.notNull(this.targetSessionFactories, "Property targetSessionFactories is required");
this.resolvedSessionFactories = new HashMap<>(this.targetSessionFactories.size());
for (Map.Entry<Object, Object> entry : this.targetSessionFactories.entrySet()) {
Object lookupKey = resolveSpecifiedLookupKey(entry.getKey());
SessionFactory sessionFactory = resolveSpecifiedSessionFactory(entry.getValue());
this.resolvedSessionFactories.put(lookupKey, sessionFactory);
}
if (this.defaultTargetSessionFactory != null) {
this.resolvedDefaultSessionFactory = resolveSpecifiedSessionFactory(this.defaultTargetSessionFactory);
}
}
use of org.springframework.data.cassandra.SessionFactory in project spring-data-cassandra by spring-projects.
the class MapSessionFactoryLookup method getSessionFactory.
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.session.lookup.SessionFactoryLookup#getSessionFactory(java.lang.String)
*/
@Override
public SessionFactory getSessionFactory(String sessionFactoryName) throws SessionFactoryLookupFailureException {
Assert.notNull(sessionFactoryName, "SessionFactory name must not be null");
SessionFactory sessionFactory = this.sessionFactories.get(sessionFactoryName);
if (sessionFactory == null) {
throw new SessionFactoryLookupFailureException(String.format("No SessionFactory with name [%s] registered", sessionFactoryName));
}
return sessionFactory;
}
Aggregations