Package org.synchronoss.cpo.cassandra
Class CassandraCpoAdapter
java.lang.Object
org.synchronoss.cpo.core.cache.CpoAdapterCache
org.synchronoss.cpo.core.CpoBaseAdapter<ClusterDataSource>
org.synchronoss.cpo.cassandra.CassandraCpoAdapter
- All Implemented Interfaces:
Serializable,CpoAdapter
CassandraCpoAdapter is the Cassandra implementation of
CpoAdapter, a set of routines that
are responsible for managing value beans from a Cassandra datasource.- Author:
- dberry
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> longexistsBean(CpoQuery query, T bean) The CpoAdapter will check to see if this object exists in the datasource.getCpoAttributes(String expression) Get the cpo attributes for this expressiongetCpoMetaDescriptor returns the CpoMetaDescriptor associated with this CpoAdapterstatic CassandraCpoAdaptergetInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiTrx) Creates a CassandraCpoAdapter.static CassandraCpoAdaptergetInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiWrite, DataSourceInfo<ClusterDataSource> cdsiRead) Creates a CassandraCpoAdapter.Methods inherited from class org.synchronoss.cpo.core.CpoBaseAdapter
deleteBean, deleteBeans, executeBean, getBatchSize, getDataSourceName, getFetchSize, insertBean, insertBeans, newOrderBy, newOrderBy, newOrderBy, newOrderBy, newWhere, newWhere, newWhere, retrieveBean, retrieveBean, retrieveBeans, setBatchSize, setFetchSize, updateBean, updateBeans, upsertBean, upsertBeansMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.synchronoss.cpo.core.CpoAdapter
deleteBean, deleteBean, deleteBeans, deleteBeans, executeBean, executeBean, existsBean, existsBean, insertBean, insertBean, insertBeans, insertBeans, retrieveBean, retrieveBean, retrieveBeans, retrieveBeans, retrieveBeans, updateBean, updateBean, updateBeans, updateBeans, upsertBean, upsertBean, upsertBeans, upsertBeans
-
Method Details
-
getInstance
public static CassandraCpoAdapter getInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiTrx) throws CpoException Creates a CassandraCpoAdapter.- Parameters:
metaDescriptor- This datasource that identifies the cpo metadata datasourcecdsiTrx- The datasource that identifies the transaction database for read and write transactions.- Returns:
- The CassandraCpoAdapter
- Throws:
CpoException- An exception occurred
-
getInstance
public static CassandraCpoAdapter getInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiWrite, DataSourceInfo<ClusterDataSource> cdsiRead) throws CpoException Creates a CassandraCpoAdapter.- Parameters:
metaDescriptor- This datasource that identifies the cpo metadata datasourcecdsiWrite- The datasource that identifies the transaction database for write transactions.cdsiRead- The datasource that identifies the transaction database for read-only transactions.- Returns:
- The CassandraCpoAdapter
- Throws:
CpoException- An exception occurred
-
existsBean
Description copied from class:CpoBaseAdapterThe CpoAdapter will check to see if this object exists in the datasource.Example:
class SomeObject so = new SomeObject(); long count = 0; class CpoAdapter cpo = null; try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ CpoWhere where = cpo.newCpoWhere(Logical.NONE, id, Comparison.EQ); count = cpo.existsObject("SomeExistCheck",so, where); if (count>0) { // object exists } else { // object does not exist } } catch (CpoException ce) { // Handle the error } }- Specified by:
existsBeanin interfaceCpoAdapter- Specified by:
existsBeanin classCpoBaseAdapter<ClusterDataSource>- Type Parameters:
T- The type of the JavaBean- Parameters:
query- The function group and clauses to applybean- This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.- Returns:
- The number of objects that exist in the datasource that match the specified object
- Throws:
CpoException- Thrown if there are errors accessing the datasource
-
getCpoMetaDescriptor
getCpoMetaDescriptor returns the CpoMetaDescriptor associated with this CpoAdapter- Returns:
- The CpoMetaDescriptor
-
getCpoAttributes
Get the cpo attributes for this expression- Parameters:
expression- A string expression- Returns:
- A List of CpoAttribute
- Throws:
CpoException- An exception occurred
-