package org.easycassandra.samples.javaee.rest.persistence;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import org.easycassandra.persistence.cassandra.CassandraFactory;
import org.easycassandra.persistence.cassandra.EasyCassandraManager;
import org.easycassandra.persistence.cassandra.Persistence;
import org.easycassandra.samples.javaee.rest.api.CostUnit;

@ApplicationScoped
public class PersistenceManager {

	
	@Produces
	private CassandraFactory cassandraFactory;
	
	@Produces
	private Persistence persistence;
	
	
	@Inject
	public void init(){
		EasyCassandraManager easyCassandraManager=new EasyCassandraManager("localhost", "javaee");
		easyCassandraManager.addFamilyObject(CostUnit.class);
		persistence=easyCassandraManager.getPersistence();
		cassandraFactory=easyCassandraManager;
		
	}
}

@@ -239,16 +239,83 @@
 actory;%0A
+import org.easycassandra.persistence.cassandra.ClusterInformation;%0A
 import o
@@ -375,16 +375,16 @@
 anager;%0A
-
 import o
@@ -551,16 +551,118 @@
 er %7B%0A%0A%09%0A
+%09private static final String HOST = %22localhost%22;%0A%0A%09private static final String KEY_SPACE = %22javaee%22;%0A%0A
 %09@Produc
@@ -789,16 +789,131 @@
 init()%7B%0A
+%09%09ClusterInformation clusterInformation = ClusterInformation.create()%0A%09%09%09%09.withKeySpace(KEY_SPACE).addHost(HOST);%0A%0A
 %09%09EasyCa
@@ -977,29 +977,26 @@
 ger(
-%22localhost%22, %22javaee%22
+clusterInformation
 );%0A%09

update factory