org.usergrid.persistence.cassandra
Class EntityManagerFactoryImpl

java.lang.Object
  extended by org.usergrid.persistence.cassandra.EntityManagerFactoryImpl
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, EntityManagerFactory

public class EntityManagerFactoryImpl
extends Object
implements EntityManagerFactory, org.springframework.context.ApplicationContextAware

Cassandra-specific implementation of Datastore

Author:
edanuff

Field Summary
static Class<DynamicEntity> APPLICATION_ENTITY_CLASS
           
static me.prettyprint.cassandra.serializers.BytesArraySerializer bae
           
static me.prettyprint.cassandra.serializers.ByteBufferSerializer be
           
static me.prettyprint.cassandra.serializers.DynamicCompositeSerializer dce
           
static String IMPLEMENTATION_DESCRIPTION
           
static me.prettyprint.cassandra.serializers.LongSerializer le
           
static me.prettyprint.cassandra.serializers.StringSerializer se
           
static me.prettyprint.cassandra.serializers.UUIDSerializer ue
           
 
Constructor Summary
EntityManagerFactoryImpl(CassandraService cass, CounterUtils counterUtils, boolean skipAggregateCounters)
          Must be constructed with a CassandraClientPool.
 
Method Summary
 UUID createApplication(String organization, String name)
          Creates a new application.
 UUID createApplication(String organizationName, String name, Map<String,Object> properties)
          Creates a Application entity.
 boolean deleteServiceProperty(String name)
           
 Application getApplication(String name)
          Gets the application.
 org.springframework.context.ApplicationContext getApplicationContext()
           
 Map<String,UUID> getApplications()
          Returns all the applications in the system.
 EntityManager getEntityManager(UUID applicationId)
          Gets the entity manager.
 String getImpementationDescription()
          A string description provided by the implementing class.
 Map<String,String> getServiceProperties()
           
 Setup getSetup()
          Gets the setup.
 UUID importApplication(String organizationName, UUID applicationId, String name, Map<String,Object> properties)
           
 UUID initializeApplication(String organizationName, UUID applicationId, String name, Map<String,Object> properties)
           
 UUID lookupApplication(String name)
          Returns the application id for the application name.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setCounterUtils(CounterUtils counterUtils)
           
 boolean setServiceProperty(String name, String value)
           
 void setup()
           
 boolean updateServiceProperties(Map<String,String> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPLEMENTATION_DESCRIPTION

public static String IMPLEMENTATION_DESCRIPTION

APPLICATION_ENTITY_CLASS

public static final Class<DynamicEntity> APPLICATION_ENTITY_CLASS

se

public static final me.prettyprint.cassandra.serializers.StringSerializer se

be

public static final me.prettyprint.cassandra.serializers.ByteBufferSerializer be

ue

public static final me.prettyprint.cassandra.serializers.UUIDSerializer ue

bae

public static final me.prettyprint.cassandra.serializers.BytesArraySerializer bae

dce

public static final me.prettyprint.cassandra.serializers.DynamicCompositeSerializer dce

le

public static final me.prettyprint.cassandra.serializers.LongSerializer le
Constructor Detail

EntityManagerFactoryImpl

public EntityManagerFactoryImpl(CassandraService cass,
                                CounterUtils counterUtils,
                                boolean skipAggregateCounters)
Must be constructed with a CassandraClientPool.

Parameters:
cass - the cassandraService instance
Method Detail

getImpementationDescription

public String getImpementationDescription()
Description copied from interface: EntityManagerFactory
A string description provided by the implementing class.

Specified by:
getImpementationDescription in interface EntityManagerFactory
Returns:
description text

getEntityManager

public EntityManager getEntityManager(UUID applicationId)
Description copied from interface: EntityManagerFactory
Gets the entity manager.

Specified by:
getEntityManager in interface EntityManagerFactory
Parameters:
applicationId - the application id
Returns:
EntityDao for the specfied parameters

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()

getSetup

public Setup getSetup()
Gets the setup.

Returns:
Setup helper

setup

public void setup()
           throws Exception
Specified by:
setup in interface EntityManagerFactory
Throws:
Exception

createApplication

public UUID createApplication(String organization,
                              String name)
                       throws Exception
Description copied from interface: EntityManagerFactory
Creates a new application.

Specified by:
createApplication in interface EntityManagerFactory
name - a unique application name.
Returns:
the newly created application id.
Throws:
Exception - the exception

createApplication

public UUID createApplication(String organizationName,
                              String name,
                              Map<String,Object> properties)
                       throws Exception
Description copied from interface: EntityManagerFactory
Creates a Application entity. All entities except for applications must be attached to a Application.

Specified by:
createApplication in interface EntityManagerFactory
name - the name of the application to create.
properties - property values to create in the new entity or null.
Returns:
the newly created application id.
Throws:
Exception - the exception

initializeApplication

public UUID initializeApplication(String organizationName,
                                  UUID applicationId,
                                  String name,
                                  Map<String,Object> properties)
                           throws Exception
Throws:
Exception

importApplication

public UUID importApplication(String organizationName,
                              UUID applicationId,
                              String name,
                              Map<String,Object> properties)
                       throws Exception
Specified by:
importApplication in interface EntityManagerFactory
Throws:
Exception

lookupApplication

public UUID lookupApplication(String name)
                       throws Exception
Description copied from interface: EntityManagerFactory
Returns the application id for the application name.

Specified by:
lookupApplication in interface EntityManagerFactory
Parameters:
name - a unique application name.
Returns:
the Application id or null.
Throws:
Exception - the exception

getApplication

public Application getApplication(String name)
                           throws Exception
Gets the application.

Parameters:
name - the name
Returns:
application for name
Throws:
Exception - the exception

getApplications

public Map<String,UUID> getApplications()
                                 throws Exception
Description copied from interface: EntityManagerFactory
Returns all the applications in the system.

Specified by:
getApplications in interface EntityManagerFactory
Returns:
all the applications.
Throws:
Exception - the exception

setServiceProperty

public boolean setServiceProperty(String name,
                                  String value)
Specified by:
setServiceProperty in interface EntityManagerFactory

deleteServiceProperty

public boolean deleteServiceProperty(String name)
Specified by:
deleteServiceProperty in interface EntityManagerFactory

updateServiceProperties

public boolean updateServiceProperties(Map<String,String> properties)
Specified by:
updateServiceProperties in interface EntityManagerFactory

getServiceProperties

public Map<String,String> getServiceProperties()
Specified by:
getServiceProperties in interface EntityManagerFactory

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setCounterUtils

public void setCounterUtils(CounterUtils counterUtils)


Copyright © 2013. All Rights Reserved.