public class SynchronizationStorageAdapter extends Object implements IStorageAdapter
| Constructor and Description |
|---|
SynchronizationStorageAdapter(SpaceEngine engine,
SpaceDataSource spaceDataSource,
SpaceSynchronizationEndpoint synchronizationEndpointInterceptor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIndexes(String typeName,
SpaceIndex[] indexes) |
void |
commit(ServerTransaction xtn,
boolean anyUpdates)
Performs commit to transaction- delete taken entries, commit new entries.
|
int |
count(ITemplateHolder template,
String[] subClasses)
Returns the number of entries that match the template.
|
Class<?> |
getDataClass() |
Map<String,IEntryHolder> |
getEntries(Context context,
Object[] ids,
String typeName,
IEntryHolder[] templates)
Gets a map of entries from the storage adapter
|
IEntryHolder |
getEntry(Context context,
Object uid,
String typeName,
IEntryHolder template)
Gets an entry object from the storage adapter.
|
SpaceSynchronizationEndpoint |
getSynchronizationInterceptor() |
void |
initialize()
Initializes the SA for work (first API called by engine) If initMode is WARM : SA is
required to set its internal working tables and environment to the state recorded in its
persistent storage, and verify that all the SA space-related data is in consistent state.
|
ISAdapterIterator<?> |
initialLoad(Context context,
ITemplateHolder template) |
void |
insertEntry(Context context,
IEntryHolder entryHolder,
boolean origin,
boolean shouldReplicate)
Inserts a new entry to the SA storage.
|
void |
introduceDataType(ITypeDesc typeDesc) |
boolean |
isReadOnly()
If returns true - then the storage adapter is read-only and can't be written to.
|
ISAdapterIterator<IEntryHolder> |
makeEntriesIter(ITemplateHolder template,
long SCNFilter,
long leaseFilter,
IServerTypeDesc[] subTypes)
Returns an iterator with entries that match the template, and the other parameters.
|
void |
prepare(Context context,
ServerTransaction xtn,
ArrayList<IEntryHolder> pLocked,
boolean singleParticipant,
Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo,
boolean shouldReplicate)
Performs prepare to transaction- write to SA all new entries under the xtn, mark taken
entries under the xtn
|
void |
removeEntry(Context context,
IEntryHolder entryHolder,
boolean origin,
boolean fromLeaseExpiration,
boolean shouldReplicate)
Removes an entry from the SA storage.
|
void |
rollback(ServerTransaction xtn,
boolean anyUpdates)
Performs rollback to transaction- rewrite taken entries, remove new entries.
|
void |
shutDown()
called by the engine after all connections have been closed.
|
boolean |
supportsExternalDB() |
boolean |
supportsGetEntries()
Denotes whether the implementing class has an implementation for
|
boolean |
supportsPartialUpdate() |
void |
updateEntry(Context context,
IEntryHolder updatedEntry,
boolean updateRedoLog,
boolean origin,
boolean[] partialUpdateValuesIndicators)
updates an entry.
|
public SynchronizationStorageAdapter(SpaceEngine engine, SpaceDataSource spaceDataSource, SpaceSynchronizationEndpoint synchronizationEndpointInterceptor) throws ClassNotFoundException, IllegalAccessException, InstantiationException
public void initialize()
throws SAException
IStorageAdapterinitialize in interface IStorageAdapterSAException - - In case a SQL error occurred.public ISAdapterIterator<?> initialLoad(Context context, ITemplateHolder template) throws SAException
initialLoad in interface IStorageAdapterSAExceptionpublic void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException
IStorageAdapterinsertEntry in interface IStorageAdapterentryHolder - entry to insertSAExceptionpublic void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException
IStorageAdapterupdateEntry in interface IStorageAdapterupdatedEntry - new content, same UID and classSAExceptionpublic void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException
IStorageAdapterremoveEntry in interface IStorageAdapterentryHolder - entry to removeSAExceptionpublic void prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> pLocked, boolean singleParticipant, Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAException
IStorageAdapterprepare in interface IStorageAdapterxtn - transaction to preparepLocked - a vector of all entries locked (written or taken) under the xtnsingleParticipant - - if true, a transactional SA needs to do all the transaction
related operations in one DB transaction and the prepare is actually
the commit (no other transaction related APIs will be called for
this xtn)SAExceptionpublic void rollback(ServerTransaction xtn, boolean anyUpdates) throws SAException
IStorageAdapterrollback in interface IStorageAdapterxtn - transaction to roll-backanyUpdates - true if any updates performed under tjis xtnSAExceptionpublic boolean supportsGetEntries()
IStorageAdaptersupportsGetEntries in interface IStorageAdapterpublic Map<String,IEntryHolder> getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) throws SAException
IStorageAdaptergetEntries in interface IStorageAdapterids - the ids of the entries to gettypeName - type of the entries to gettemplates - templates matching the ids of the entries to getSAExceptionpublic IEntryHolder getEntry(Context context, Object uid, String typeName, IEntryHolder template) throws SAException
IStorageAdaptergetEntry in interface IStorageAdapteruid - ID of the entry to gettypeName - class of the entry to gettemplate - selection template,may be null, currently used by cacheload/cachestore in
order to pass primery key fields when GS uid is not saved in an external DBSAExceptionpublic ISAdapterIterator<IEntryHolder> makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subTypes) throws SAException
IStorageAdaptermakeEntriesIter in interface IStorageAdaptertemplate - - the entries should match that template.SCNFilter - - if != 0 gets only templates that are <= from SCNFilter.leaseFilter - if != 0 gets only templates that have expiration_time >= leaseFilter.subTypes - - array of sub classes of the template, the entries should belong to a
subcalss.SAExceptionpublic void commit(ServerTransaction xtn, boolean anyUpdates) throws SAException
IStorageAdaptercommit in interface IStorageAdapterxtn - transaction to commitanyUpdates - true if any updates performed under tjis xtnSAExceptionpublic int count(ITemplateHolder template, String[] subClasses) throws SAException
IStorageAdaptercount in interface IStorageAdaptertemplate - - the entries should match the template.subClasses - - subclassesof the template, the entries can be in one of them.SAExceptionpublic void shutDown()
throws SAException
IStorageAdaptershutDown in interface IStorageAdapterSAExceptionpublic boolean isReadOnly()
IStorageAdapterisReadOnly in interface IStorageAdapterpublic boolean supportsExternalDB()
supportsExternalDB in interface IStorageAdapterpublic boolean supportsPartialUpdate()
supportsPartialUpdate in interface IStorageAdapterpublic void introduceDataType(ITypeDesc typeDesc)
introduceDataType in interface IStorageAdapterpublic void addIndexes(String typeName, SpaceIndex[] indexes)
addIndexes in interface IStorageAdapterpublic SpaceSynchronizationEndpoint getSynchronizationInterceptor()
getSynchronizationInterceptor in interface IStorageAdapterpublic Class<?> getDataClass()
getDataClass in interface IStorageAdapterCopyright © GigaSpaces.