@ParametersAreNonnullByDefault public final class VirtualDB extends java.lang.Object implements DataSource, MemoryHandler
Modifier and Type | Class and Description |
---|---|
static class |
VirtualDB.SignatureValidationResult
http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
We can't have hyphens either.
|
MemoryHandler.Cost
Modifier and Type | Field and Description |
---|---|
LayerData |
BLANK_FINAL_LAYER
a common final blank layer
|
LayerData |
BLANK_LAYER
the blank layer
|
static int |
DEFAULT_FIELD_VALUE_STATS_ROWS
the default number of rows if the statistics value is missing and we
have less than the max number of statistics entries
|
static boolean |
DISABLE_FIELD_RECYCLER
Is the field recycling disabled ?
|
static java.util.concurrent.atomic.AtomicBoolean |
DISABLE_JMS_FILTER
disabled the JMS filter
|
int |
id
The layer id
|
static int |
MAX_SEGMENT_KEY
The maximum size of a key field that we can grantee to be able to load and decode
from the varchar(255) in the index table.
|
static int |
MAX_TRANSACTION_HINT |
VirtualDB |
parentDb
The extended layer
|
static java.lang.String |
PROPERTY_DISABLE_FIELD_RECYCLER
The property to disable the field recycling.
|
static java.lang.String |
PROPERTY_DISABLE_JMS_FILTER
The property to disabled the JMS filter.
|
TransactionWindow |
transactionWindow
the transaction window.
|
Modifier and Type | Method and Description |
---|---|
void |
addDBClassListener(DBClass dbClass,
DBClassListener listener) |
void |
addDBClassListener(java.lang.String className,
DBClassListener listener)
add a listener for any records of this class.
|
void |
buildDB(java.lang.String ownerFirstName,
java.lang.String ownerLastName,
java.lang.String ownerLogin,
java.lang.String ownerPassword,
java.lang.String phoneNumber,
java.lang.String email)
create a layer
|
void |
checkIndexies()
check the indexes
|
void |
checkLicense() |
void |
checkMaxLogin(DBObject login)
Returns the maximum number of concurrent logins allowed for this VirtualDB.
We limit the number of concurrent users for commercial reasons. |
static int |
checkSignature(java.lang.String signature)
Returns a database id by it's signature.
|
static void |
checkSuppressedIssue() |
void |
checkSuspended() |
void |
clearCache(DBClass dbClass)
When an object is created/deleted/cleared clear all possible full lists.
|
java.lang.String |
clearCachedValueDB(java.lang.String flg)
clear the cache value.
|
static void |
clearDB(int id)
Clears the VirtualDB from the cache.
|
void |
correctEstimateClassRows(DBClass dbClass)
correct the estimates for Class
|
int |
countLogin(DBObject currentLogin)
Returns the number of concurrent users active in this VirtualDB
|
DBObject |
create(DBClass dbClass)
Create always throws a ReadOnlyException.
|
DBObject |
create(GlobalId classGid)
Create always throws a ReadOnlyException.
|
DBObject |
create(java.lang.String className)
Create always throws a ReadOnlyException.
|
java.lang.String |
currentEncryptionCode()
get the current encryption code for all new field values
|
java.lang.String |
decrypt(java.lang.String code,
java.lang.String value)
decrypt a value using a decryption code stored in the master DB
|
java.lang.String |
encrypt(java.lang.String code,
java.lang.String value)
encrypt a value using a encryption code stored in the master DB
|
PossibleRowsHolder |
fetchFullPR(DBClass dbClass)
Return the full list of objects has been loaded for this class.
|
TransHeader |
fetchTransHeader(long transId)
Fetch the transaction header for this layer and id.
|
static VirtualDB |
find(int id)
Returns a VirtualDB by it's ID.
|
static VirtualDB |
find(java.lang.String signature)
Returns a VirtualDB by it's signature.
|
PossibleRowsHolder |
findCacheClause(DBClass dbClass,
DBPathClause pc)
Cache of clauses.
|
TransHeader |
findCreatedTransHeader(long rowId)
find the transaction that created this record.
|
DBClass |
findDBClass(GlobalId classId)
Find the class definition.
|
DBClass |
findDBClass(java.lang.String name)
Find the class definition.
|
DBClassAbstract |
findDBClassAbstract(GlobalId classId)
Find the class definition.
|
DBClassAbstract |
findDBClassAbstract(java.lang.String name)
Find the class definition.
|
PossibleRowsHolder |
findFullPR(DBClass dbClass,
boolean lock)
Return the full list of objects for this class.
|
DBObject |
findKey(GlobalId valueId,
GlobalId classId)
Finds a DBObject with the GlobalID.
|
DBObject |
findKey(GlobalId id,
java.lang.String defName)
Finds a new DBObject by its primary integer key
|
DBObject |
findKey(GlobalKey gKey)
Finds a DBObject for the passed key.
|
DBObject |
findKey(java.lang.String value,
java.lang.String defName)
Finds a unique DBObject based on supplied key value
|
TransHeader |
findMaxTransHeader(java.util.Date asOfDate)
Find the maximum transaction for this date.
|
static VirtualDB |
findNoCheck(int id)
Find the layer without checking the version number.
|
RecentLink |
findRecentLink(java.lang.String fieldKey)
Find the recent list for this field.
|
DBObject |
findRow(long rowId,
DBClassConcrete dbClass,
Hint hint)
Finds a DBObject by it's rowId
|
TransHeader |
findTransHeader(long transId)
Fetch the transaction header for this layer and id.
|
TransHeader |
findTransHeader(long transId,
long[] hint)
Find the transaction header for this layer and id.
|
void |
fireObjectCreated(DBData data,
Hint hint)
When a new object is created for this VirtualDB and its dependents
Clear the "Not Found" cache for this global key Check this object is in the full list Check the searchable fields cache for the current values THREADS: Don't synchronize this method because it calls each child database you can get into a deadlock situation. |
void |
fireObjectDeleted(DBData data,
Hint hint)
When an object is DELETED for this VirtualDB and its dependents
Don't do anything, deleted objects will be filtered out later. |
void |
fireObjectModified(DBData data)
When an object is MODIFIED for this VirtualDB and its dependents
Check the searchable fields cache for the current values THREADS: Don't synchronize this method because it calls each child database you can get into a deadlock situation. |
TransHeader |
forceLoadTransHeader(long transId,
long[] hint) |
long |
freeMemory(double percentage)
Free memory at this level and below.
|
void |
generateStats()
Generate the statistics
|
void |
generateStats(boolean quick)
Generate the statistics
|
void |
generateStats(boolean quick,
java.lang.String classes)
Generate the statistics
|
static VirtualDB |
get(int id)
get the layer if in memory
|
Login |
getAccessLevelLogin(java.lang.String accessLevel) |
DBCriteria |
getACLCriteria(Login login,
DBClassConcrete dbClass,
java.lang.String accessTypeField)
Builds a constraint based on the Access Controls that apply to this login
the specified DBClass and the access control type, i.e Read, Modify, etc
Access Controls are store by Access Group for each class.
|
java.lang.Object |
getAttribute(java.lang.String name)
Gets a general purpose attribute
|
java.lang.String |
getCachedValueDB(java.lang.String name) |
java.lang.String |
getCachedValueDB(java.lang.String name,
java.lang.String defaultValue) |
java.lang.Object |
getCacheObject(java.lang.String key)
NO USER CACHE FOR THE VIRTUAL DB
|
VirtualDB[] |
getChildren()
Get the children of this VirtualDB.
|
MemoryHandler.Cost |
getCost()
The cost level for this MemoryHandler.
|
DataSource |
getCurrentDataSource()
get the current data source, if from VurtualDB then the thread local version
Current login used to store the login used for access controls within
this thread
This allows checking of objects loaded from VirtualDB with privileges
allocated based on a login
|
VirtualDB |
getDataBase()
Fills in the DataSource required method of getting the underlying VirtualDB
in this can it's a very simple method. |
DataSource |
getDataBaseReadOnly()
Fills in the DataSource required method of getting the underlying VirtualDB
in this can it's a very simple method. |
java.util.HashMap |
getDBModuleMap()
return a HashMap of DBModule codes
|
java.lang.String |
getDisplayID()
Returns a IP address style version of the virtualDB's ID
|
java.lang.String |
getDocMgrURL()
The document storage URL for this database.
|
long |
getEstimatedAverageFieldRowsPerValue(DBClass baseClass,
DBField dbField)
estimated average rows per field per value
|
long |
getEstimatedClassRows(DBClass dbClass)
The estimated rows for a class
|
long |
getEstimatedFieldRows(DBField dbField,
DBClass baseClass,
java.lang.String value)
estimated rows for a field/value
|
long |
getEstimatedSize()
The estimated size of data held by this memory handler
|
Globals |
getGlobalObject()
Get the global object Each VirtualDB will have exactly ONE Global DBObject.
|
Login |
getGuestLogin()
Returns the guest or public login for this VirtualDB
|
java.lang.String |
getHexID()
The hex version of the ID
|
DBResult |
getInwardLinkage(DBClass sourceClass,
DBField sourceField,
DBObject target,
HintField hint)
Get the cached DBResult set for the linkage passed
If this is an incoming link and the base object is new then don't check the database for records as there will not/should not be any records. |
java.lang.Integer |
getKey()
The ID of this virtualDB as an object, useful for keys of maps
|
long |
getLastAccessed()
The last time this memory handle was accessed
|
LayerField |
getLayerFieldRecycle(DBField fld,
LayerField lf)
Recycle the layer field.
|
LayerFieldRecycler |
getLayerFieldRecycler(DBField fld)
Recycle the layer field.
|
java.util.Date |
getLicenseKeyExpiryDate() |
Login |
getLogin()
The login for this DataSource.
|
long |
getMaxStartTransaction()
The maximum transaction number for this layer when the server was started
|
Login |
getOwnerLogin()
Returns the Owner Login for this VirtualDB
|
DBQueryHandler |
getQueryHandler(DBClass searchClass)
makes a Query handler for simple virtual db.
|
DataBase |
getRawDB()
returns the physical WRITE database for this virtualDB
|
Login |
getRealLogin()
The login for this DataSource.
|
RootClassHolder |
getRootHolder(DBClass dbClass)
internal only
|
Session |
getSession()
Get the current session
|
java.lang.String |
getSignature()
Returns one of the signatures for this virtualDB
|
java.util.Date |
getSuspended() |
static DataSource |
getThreadDataSource()
get the current data source
|
java.util.TimeZone |
getTimeZone()
Because VirtualDB is not based on a Login, just return GMT time zone.
|
Person |
getUser()
Returns the User for this DataSource.  In the case of a VirtualDB it is always NULL.
|
MasterDB |
getWriteMasterDB()
The "write" master DB.
|
boolean |
hasChild(DBClass mapClass,
DBField parentField,
DBObject parentObject,
DBField childField,
DBObject childObject)
does this map table contain a mapping for the parent to child.
|
boolean |
hasChildViewedFrom(DBClass mapClass,
DBField parentField,
DBObject parentObject,
DBField childField,
DBObject childObject,
DataSource viewedFrom)
does this map table contain a mapping for the parent to child.
|
boolean |
hasDBClassListener(DBClass dbClass)
has a listener for records of this class.
|
boolean |
hasExcludedGroups()
are any contacts excluded ?
|
void |
hint(DBClass dbClass,
long[] rows)
add to the global hint for this class.
|
void |
hint(DBClass dbClass,
PossibleRowsHolder pr)
add to the global hint for this class.
|
void |
hint(java.lang.String className,
long row)
add to the global hint for this class.
|
void |
hint(java.lang.String className,
long[] rows)
add to the global hint for this class.
|
int |
hintCount(GlobalKeyId rootId)
How many rows are in the hint for this class
|
void |
holdHardCacheLink(DBClass classToHold)
keep a hold on the cache
|
boolean |
isaAcessLevelLogin(Login login) |
boolean |
isAncestorOrSelf(int ancestorLayerID)
Is this virtualDB in the family of the passed ID.
|
boolean |
isDescendant(VirtualDB descendantLayer)
Is this Virtual DB viewable from another.
|
boolean |
isExcludeFromGroup(ContactGroup group,
Person person)
is the contact excluded from the group.
|
boolean |
isIndexed(DBClass baseClass,
DBField field)
Is the index for the passed field reliable ? When a field definition is changed to be
searchable or different type or whatever a background task starts to re-index the effected objects until this task finishes the field's index is marked as not reliable. |
boolean |
isPrivateDB()
Are we using private database ?
|
boolean |
isValueCached(DBClass dbClass,
DBField field,
java.lang.String searchValue) |
boolean |
isValueCached(java.lang.String dbClassName,
java.lang.String fieldName,
java.lang.String searchValue) |
java.util.Date |
lastBackedUp()
When was this layer last backed up.
|
static VirtualDB[] |
listInMemoryLayers()
list of in memory Layers
|
void |
loadStats()
load the previously generated statistics
|
void |
loadStatsIfRequired() |
TransHeader |
loadTransHeader(long transId,
long[] hint)
Find the transaction header for this layer and id.
|
javax.crypto.Cipher |
makeCipher(java.lang.String code,
int mode) |
DataLoader |
makeDataResult(GlobalKeyId rootDBClassId,
long[] rowsToLoad)
The data loader for this datasource
|
DALQuery |
makeQuery(java.lang.String className) |
long[] |
makeRowsToLoad(GlobalKeyId rootId,
long rowId,
Hint hint)
make the row list to load from the database.
|
java.lang.String |
makeTable(DBClass dbClass,
java.lang.String tablePrefix)
make a table for this class.
|
boolean |
needToLoad(GlobalKeyId rootId)
need to load this class
|
boolean |
needToLoad(GlobalKeyId rootId,
long checkRow,
HashLongMap globalHintMap,
long transactionNr)
Do we need to load this record ?
|
long |
nextNumber(java.lang.String key)
A dummy nextNumber always returns zero.
|
long |
nextNumber(java.lang.String key,
int cacheSize)
A dummy nextNumber always returns zero.
|
long |
panicFreeMemory()
Clear all memory ASAP.
|
void |
placeRow(boolean createIfMissing,
FieldValuesHolder values,
DBClass rootClass,
DBField field,
java.lang.Object rawValue,
FieldCacheHolderTracker tracker,
long rowUID,
boolean maxCheck)
internal use only.
|
long |
queuedFreeMemory(double percentage)
This method should implement the freeing of the method and maybe synchronized.
|
void |
reIndex(java.lang.String classes,
java.lang.String excludeClasses) |
void |
releaseHardCacheLink(DBClass classToHold)
release a hold on the cache
|
void |
removeDBClassListener(DBClass dbClass,
DBClassListener listener)
remove a listener for records of this class.
|
void |
reset()
reset the cache document manager cache.
|
void |
setCachedValueDB(java.lang.String flg,
java.lang.String value)
set the cache value in the database
|
void |
setCacheObject(java.lang.String key,
java.lang.Object obj)
Set the data source's cache
|
static DataSource |
setCurrentDataSource(DataSource ds)
set the current data source
|
void |
setKnownClassRows(DBClass dbClass,
long rows) |
static void |
simulateHeavyLoad(long sleepMS)
simulate heavy load by sleeping in select spots.
|
static void |
stats(StatsCollector collector)
collect the statistics
|
MutableDataSource |
sudoSystem()
obtain system level access.
|
MutableDataSource |
sudoSystem(DataSource ds)
obtain system level access.
|
MutableDataSource |
sudoSystem(Login realLogin)
obtain system level access.
|
long |
tidyUp()
Tidy up the memory handler
|
java.lang.String |
toString() |
void |
transactionKnownToExist(long transId)
This transaction is known to exist
|
static VirtualDB.SignatureValidationResult |
validateSignature(java.lang.String signature,
boolean createMode) |
public final int id
public final VirtualDB parentDb
public final TransactionWindow transactionWindow
public final LayerData BLANK_LAYER
public final LayerData BLANK_FINAL_LAYER
public static final int DEFAULT_FIELD_VALUE_STATS_ROWS
public static final java.lang.String PROPERTY_DISABLE_FIELD_RECYCLER
public static final boolean DISABLE_FIELD_RECYCLER
public static final java.util.concurrent.atomic.AtomicBoolean DISABLE_JMS_FILTER
public static final java.lang.String PROPERTY_DISABLE_JMS_FILTER
public static final int MAX_TRANSACTION_HINT
public static final int MAX_SEGMENT_KEY
public static void checkSuppressedIssue() throws java.lang.Exception
java.lang.Exception
public static void simulateHeavyLoad(@Nonnegative long sleepMS)
sleepMS
- number of milliseconds to sleep@Nonnull public static VirtualDB.SignatureValidationResult validateSignature(@Nonnull java.lang.String signature, boolean createMode)
signature
- the signature to check.createMode
- check if already exists.@CheckReturnValue @Nonnull public static VirtualDB[] listInMemoryLayers()
public static void stats(@Nonnull StatsCollector collector)
collector
- the collector@CheckReturnValue @Nullable public LayerFieldRecycler getLayerFieldRecycler(@Nonnull DBField fld)
fld
- the field@CheckReturnValue @Nonnull public LayerField getLayerFieldRecycle(@Nonnull DBField fld, @Nonnull LayerField lf)
fld
- the fieldlf
- the layer field.@CheckReturnValue public boolean isExcludeFromGroup(@Nonnull ContactGroup group, @Nonnull Person person)
isExcludeFromGroup
in interface DataSource
person
- the person to check.group
- the group to check if the contact is excluded.@CheckReturnValue public boolean hasExcludedGroups()
hasExcludedGroups
in interface DataSource
@CheckReturnValue public boolean isIndexed(@Nonnull DBClass baseClass, @Nonnull DBField field)
baseClass
- the base class.field
- The field's index to check.@CheckReturnValue public boolean hasChild(DBClass mapClass, DBField parentField, DBObject parentObject, DBField childField, DBObject childObject) throws java.lang.Exception
hasChild
in interface DataSource
mapClass
- The map classparentField
- the parent linkparentObject
- the parent objectchildField
- the child linkchildObject
- the child objectjava.lang.Exception
- a serious problem@CheckReturnValue public boolean hasChildViewedFrom(DBClass mapClass, DBField parentField, DBObject parentObject, @Nonnull DBField childField, @Nonnull DBObject childObject, DataSource viewedFrom) throws java.lang.Exception
viewedFrom
- layer that it's viewed frommapClass
- The map classparentField
- the parent linkparentObject
- the parent objectchildField
- the child linkchildObject
- the child objectjava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public DataSource getCurrentDataSource()
getCurrentDataSource
in interface DataSource
@Nullable public static DataSource setCurrentDataSource(@Nullable DataSource ds)
ds
- the database@CheckReturnValue @Nullable public static DataSource getThreadDataSource()
@CheckReturnValue @Nonnull public java.lang.String decrypt(@Nonnull java.lang.String code, @Nonnull java.lang.String value) throws java.lang.Exception
code
- The master DB decryption code.value
- the value to decryptjava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public javax.crypto.Cipher makeCipher(@Nonnull java.lang.String code, int mode) throws java.lang.Exception
code
- mode
- java.lang.Exception
- A serious problem@CheckReturnValue @Nonnull public java.lang.String encrypt(@Nonnull java.lang.String code, @Nonnull java.lang.String value) throws java.lang.Exception
code
- The master DB encryption code.value
- the value to encryptjava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public java.lang.String currentEncryptionCode() throws java.lang.Exception
java.lang.Exception
- a serious problem@CheckReturnValue @Nullable public Session getSession()
getSession
in interface DataSource
@CheckReturnValue @Nullable public java.util.Date lastBackedUp() throws java.lang.Exception
java.lang.Exception
- a error occurred.@CheckReturnValue @Nonnull public TransHeader findMaxTransHeader(@Nonnull java.util.Date asOfDate) throws java.lang.Exception
asOfDate
- The date to checkjava.lang.Exception
- A serious problem@CheckReturnValue @Nullable public TransHeader fetchTransHeader(long transId) throws NotFoundException
transId
- The transaction to findNotFoundException
- The transaction was not found@CheckReturnValue @Nonnull public TransHeader findCreatedTransHeader(long rowId) throws NotFoundException, java.sql.SQLException
rowId
- the row to findNotFoundException
- the transaction was not found.java.sql.SQLException
@CheckReturnValue @Nonnull public TransHeader findTransHeader(long transId) throws NotFoundException
transId
- The transaction id to fetchNotFoundException
- The transaction number was not foundloadTransHeader
@CheckReturnValue @Nonnull public TransHeader loadTransHeader(long transId, long[] hint) throws NotFoundException
hint
- what other rows should be loaded.transId
- the transaction idNotFoundException
- The transaction could not be found.@CheckReturnValue @Nonnull public TransHeader forceLoadTransHeader(long transId, long[] hint) throws NotFoundException
NotFoundException
public void transactionKnownToExist(long transId)
transId
- the transId@CheckReturnValue @Nonnull public TransHeader findTransHeader(long transId, @Nullable long[] hint) throws NotFoundException
hint
- what other rows should be loaded.transId
- the transaction idNotFoundException
- The transaction could not be found.loadTransHeader
@CheckReturnValue @Nonnull public DALQuery makeQuery(java.lang.String className)
@CheckReturnValue public boolean isaAcessLevelLogin(@Nonnull Login login)
@CheckReturnValue @Nonnull public DBCriteria getACLCriteria(@Nonnull Login login, @Nonnull DBClassConcrete dbClass, @Nonnull java.lang.String accessTypeField) throws java.lang.Exception
login
- the user logindbClass
- the base classaccessTypeField
- java.lang.Exception
- A serious problempublic void correctEstimateClassRows(@Nonnull DBClass dbClass) throws java.lang.Exception
dbClass
- the classjava.lang.Exception
- a serious problempublic void setKnownClassRows(@Nullable DBClass dbClass, @Nonnegative long rows) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue @Nonnegative public long getEstimatedClassRows(@Nullable DBClass dbClass)
dbClass
- the class to estimate@CheckReturnValue @Nonnegative public long getEstimatedAverageFieldRowsPerValue(@Nonnull DBClass baseClass, @Nonnull DBField dbField)
baseClass
- the base classdbField
- the base field@CheckReturnValue @Nonnegative public long getEstimatedFieldRows(@Nonnull DBField dbField, @Nonnull DBClass baseClass, @Nullable java.lang.String value)
value
- the value to estimatebaseClass
- the base classdbField
- the base fieldpublic void generateStats() throws java.lang.Exception
java.lang.Exception
- a serious problempublic void generateStats(boolean quick) throws java.lang.Exception
quick
- quickly generate statistics that don't exist.java.lang.Exception
- a serious problempublic void generateStats(boolean quick, @Nullable java.lang.String classes) throws java.lang.Exception
quick
- quickly generate statistics that don't exist.classes
- the limited set of classes to scan.java.lang.Exception
- a serious problempublic void loadStatsIfRequired() throws java.lang.Exception
java.lang.Exception
public void loadStats() throws java.lang.Exception
java.lang.Exception
- a serious problem.@CheckReturnValue @Nonnull public VirtualDB getDataBase()
getDataBase
in interface DataSource
@CheckReturnValue @Nonnull public DataSource getDataBaseReadOnly()
getDataBaseReadOnly
in interface DataSource
@CheckReturnValue @Nonnull public Login getLogin()
getLogin
in interface DataSource
@CheckReturnValue @Nonnull public Login getRealLogin()
getRealLogin
in interface DataSource
@CheckReturnValue @Nullable public Person getUser()
getUser
in interface DataSource
@CheckReturnValue @Nonnull public java.util.TimeZone getTimeZone()
getTimeZone
in interface DataSource
@CheckReturnValue @Nonnull public Globals getGlobalObject() throws java.lang.Exception
getGlobalObject
in interface DataSource
java.lang.Exception
- A serious problem occurred.@CheckReturnValue @Nonnull public java.util.HashMap getDBModuleMap()
public void checkMaxLogin(@Nonnull DBObject login) throws java.lang.Exception
login
- Omit this login from the count ( because it's the one that is trying to login)java.lang.Exception
- Too many concurrent users for this VirtualDB@CheckReturnValue public int countLogin(@Nullable DBObject currentLogin) throws java.lang.Exception
currentLogin
- Omit the current Loginjava.lang.Exception
- A serious problem occurred@CheckReturnValue @Nonnull public MutableDataSource sudoSystem()
@CheckReturnValue @Nonnull public MutableDataSource sudoSystem(@Nullable DataSource ds)
ds
- the data source to obtain the login/timezone@CheckReturnValue @Nonnull public MutableDataSource sudoSystem(@Nonnull Login realLogin)
realLogin
- the real login@CheckReturnValue @Nullable public Login getOwnerLogin()
@CheckReturnValue @Nonnull public Login getAccessLevelLogin(@Nonnull java.lang.String accessLevel)
@CheckReturnValue @Nonnull public MasterDB getWriteMasterDB()
@CheckReturnValue @Nonnull public java.lang.String getDocMgrURL() throws java.lang.Exception
java.lang.Exception
- A serious problem@CheckReturnValue @Nonnull public Login getGuestLogin()
@CheckReturnValue @Nonnull public DBObject create(@Nonnull java.lang.String className) throws java.lang.Exception
create
in interface DataSource
className
- The class to be createdjava.lang.Exception
- Read Only Exception@CheckReturnValue @Nonnull public DBObject create(@Nonnull DBClass dbClass) throws java.lang.Exception
create
in interface DataSource
dbClass
- The class to be createdjava.lang.Exception
- Read Only Exception@CheckReturnValue @Nonnull public DBObject create(@Nonnull GlobalId classGid) throws java.lang.Exception
create
in interface DataSource
classGid
- The class to be createdjava.lang.Exception
- Read Only Exception@CheckReturnValue @Nonnull public DBClassAbstract findDBClassAbstract(@Nonnull GlobalId classId) throws NotFoundException
findDBClassAbstract
in interface DataSource
classId
- The class to findNotFoundException
- The class wasn't found@CheckReturnValue @Nonnull public DBClass findDBClass(@Nonnull GlobalId classId) throws NotFoundException
findDBClass
in interface DataSource
classId
- The class to findNotFoundException
- The class wasn't found@CheckReturnValue @Nonnull public DBClassAbstract findDBClassAbstract(@Nonnull java.lang.String name) throws NotFoundException
findDBClassAbstract
in interface DataSource
name
- The class to findNotFoundException
- The class wasn't found@CheckReturnValue @Nonnull public DBClass findDBClass(@Nonnull java.lang.String name) throws NotFoundException
findDBClass
in interface DataSource
name
- The class to findNotFoundException
- The class wasn't found@CheckReturnValue @Nonnull public DBObject findRow(long rowId, @Nonnull DBClassConcrete dbClass, Hint hint) throws NotFoundException
findRow
in interface DataSource
rowId
- The row id to finddbClass
- The class for this rowhint
- If we are to fetch this row id from the DB also check these row IDsNotFoundException
- The row wasn't found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalId id, @Nonnull java.lang.String defName) throws NotFoundException
findKey
in interface DataSource
id
- The iddefName
- The Class nameNotFoundException
- The DBObject was not found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalId valueId, @Nonnull GlobalId classId) throws NotFoundException
findKey
in interface DataSource
valueId
- The value ID ( first half of a global key)classId
- The class ID ( second half of a global key)NotFoundException
- The key wasn't found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalKey gKey) throws NotFoundException
findKey
in interface DataSource
gKey
- The Global keyNotFoundException
- The global key wasn't found.@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull java.lang.String value, @Nonnull java.lang.String defName) throws NotFoundException, TooManyRowsException, java.lang.Exception
findKey
in interface DataSource
value
- The value to finddefName
- The class namejava.lang.Exception
- a serious problemNotFoundException
- The key was not foundTooManyRowsException
- The key was not found@CheckReturnValue @Nonnull public boolean needToLoad(@Nonnull GlobalKeyId rootId)
rootId
- root class@CheckReturnValue public long nextNumber(@Nonnull java.lang.String key, int cacheSize)
nextNumber
in interface DataSource
key
- The next number key.cacheSize
- The cache size of the numbers@CheckReturnValue public long nextNumber(@Nonnull java.lang.String key)
nextNumber
in interface DataSource
key
- The next number key.@CheckReturnValue @Nonnull public static VirtualDB find(@Nonnull java.lang.String signature) throws VirtualDBNotFoundException, DBVersionException, VirtualDBExpiredException
Thread Safe: |
This method doesn't need to be synchronized as two parallel threads on the first attempt will only result in SELECTING the ID twice |
signature
- The name of the virtualDB to find.VirtualDBExpiredException
- The layer has expiredDBVersionException
- The database is the wrong version.VirtualDBNotFoundException
- The virtualDB was not found@CheckReturnValue public static int checkSignature(@Nullable java.lang.String signature) throws VirtualDBNotFoundException
Thread Safe: |
This method doesn't need to be synchronized as two parallel threads on the first attempt will only result in SELECTING the ID twice |
signature
- The name of the virtualDB to find.VirtualDBNotFoundException
- The virtualDB was not found@CheckReturnValue @Nonnull public static VirtualDB find(int id) throws VirtualDBNotFoundException, DBVersionException, VirtualDBExpiredException
Thread Safe: |
We rely that we only ever have one V-irtualDB for an ID in memory. We do a DCL (Double Check Lock) but we use a HashTable to give us the synchronization we require. |
id
- The id of the VirtualDBVirtualDBExpiredException
- The layer has expiredDBVersionException
- The database is an out of date version.VirtualDBNotFoundException
- The id is invalid.@CheckReturnValue @Nonnull public static VirtualDB findNoCheck(int id) throws VirtualDBNotFoundException
id
- The layer id.VirtualDBNotFoundException
- Could not find the layer.@CheckReturnValue @Nullable public static VirtualDB get(int id)
id
- The layer id.public void fireObjectCreated(@Nonnull DBData data, @Nullable Hint hint)
data
- The raw data for the record that has been created ( first load)hint
- What other records will be checked.public void fireObjectModified(@Nonnull DBData data)
data
- The raw data for the record that has been created ( first load)public void placeRow(boolean createIfMissing, FieldValuesHolder values, DBClass rootClass, DBField field, java.lang.Object rawValue, FieldCacheHolderTracker tracker, long rowUID, boolean maxCheck) throws java.lang.Exception
createIfMissing
- create the row if missing.values
- The values.rootClass
- the root class.field
- The fieldrawValue
- the valuetracker
- the list of new holders.rowUID
- the row UID.maxCheck
- check maxjava.lang.Exception
- a exceptionpublic void fireObjectDeleted(@Nonnull DBData data, Hint hint)
data
- The raw data for the record that has been created ( first load)hint
- What other records will be checked.public PossibleRowsHolder fetchFullPR(@Nonnull DBClass dbClass)
dbClass
- The full list for this class@CheckReturnValue @Nonnull public PossibleRowsHolder findFullPR(@Nonnull DBClass dbClass, boolean lock) throws java.lang.Exception
Thread Safe: |
We store an Object array after putting the array into a table Select if the first element is null. Two parallel threads on the first pass would just cause the list to be load twice. |
lock
- should we lock the list?dbClass
- The class to get the full list.java.lang.Exception
- A serious problempublic void holdHardCacheLink(@Nonnull DBClass classToHold) throws java.lang.Exception
classToHold
- The class to holdjava.lang.Exception
- a serious problempublic void releaseHardCacheLink(@Nonnull DBClass classToHold) throws java.lang.Exception
classToHold
- The class to holdjava.lang.Exception
- a serious problempublic RootClassHolder getRootHolder(@Nonnull DBClass dbClass) throws java.lang.InterruptedException
dbClass
- The class.java.lang.InterruptedException
public boolean isValueCached(@Nonnull java.lang.String dbClassName, @Nonnull java.lang.String fieldName, @Nonnull java.lang.String searchValue) throws java.lang.InterruptedException
dbClassName
- fieldName
- searchValue
- java.lang.InterruptedException
@CheckReturnValue public boolean isValueCached(@Nonnull DBClass dbClass, @Nonnull DBField field, @Nonnull java.lang.String searchValue) throws java.lang.InterruptedException
dbClass
- the classfield
- The fieldsearchValue
- java.lang.InterruptedException
- was interrupted.@CheckReturnValue @Nonnull public PossibleRowsHolder findCacheClause(@Nonnull DBClass dbClass, @Nonnull DBPathClause pc) throws java.lang.Exception
dbClass
- the classpc
- the clausejava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public java.lang.Integer getKey()
@CheckReturnValue @Nonnull public DataBase getRawDB()
@CheckReturnValue @Nonnull public java.lang.String getHexID()
@CheckReturnValue @Nonnull public java.lang.String getSignature()
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
@CheckReturnValue @Nonnull public java.lang.String getDisplayID()
public void buildDB(java.lang.String ownerFirstName, java.lang.String ownerLastName, java.lang.String ownerLogin, java.lang.String ownerPassword, java.lang.String phoneNumber, java.lang.String email) throws java.lang.Exception
ownerFirstName
- first nameownerLastName
- last nameownerLogin
- loginownerPassword
- passwordphoneNumber
- phone numberemail
- emailjava.lang.Exception
- a serious problem.@CheckReturnValue public long getMaxStartTransaction()
@CheckReturnValue @Nonnull public DBResult getInwardLinkage(@Nonnull DBClass sourceClass, @Nonnull DBField sourceField, @Nullable DBObject target, @Nullable HintField hint) throws java.lang.Exception
getInwardLinkage
in interface DataSource
sourceClass
- the source class ( required for fields in interfaces)sourceField
- The source field for the linkhint
- the other objects that will be searchedtarget
- The target objectjava.lang.Exception
- a serious problem@CheckReturnValue public boolean isDescendant(@Nonnull VirtualDB descendantLayer)
descendantLayer
- The virtualDB@CheckReturnValue public boolean isAncestorOrSelf(int ancestorLayerID)
ancestorLayerID
- The virtualDB ID@CheckReturnValue @Nonnull public DataLoader makeDataResult(GlobalKeyId rootDBClassId, long[] rowsToLoad) throws java.lang.Exception
rootDBClassId
- rowsToLoad
- java.lang.Exception
- a serious problem.public void hint(@Nonnull java.lang.String className, long[] rows)
className
- the class to add the hint forrows
- the hint of rows to loadpublic void hint(@Nonnull java.lang.String className, long row)
className
- the class to add the hint forrow
- the hint of row to loadpublic void hint(@Nonnull DBClass dbClass, @Nullable PossibleRowsHolder pr)
dbClass
- the class to add the hint forpr
- possible rowspublic void hint(@Nonnull DBClass dbClass, @Nullable long[] rows)
dbClass
- the class to add the hint forrows
- the hint of rows to load@CheckReturnValue public int hintCount(@Nonnull GlobalKeyId rootId)
rootId
- the root class id@CheckReturnValue @Nonnull public long[] makeRowsToLoad(@Nonnull GlobalKeyId rootId, long rowId, @Nullable Hint hint)
rowId
- The row that we will loadrootId
- The root class to loadhint
- The locally defined hint@CheckReturnValue @Nonnull public java.lang.String makeTable(@Nonnull DBClass dbClass, @Nonnull java.lang.String tablePrefix) throws java.sql.SQLException
dbClass
- The classtablePrefix
- The table prefixjava.sql.SQLException
- A serious problempublic void checkIndexies() throws java.lang.Exception
java.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public VirtualDB[] getChildren()
@CheckReturnValue @Nonnull public DBQueryHandler getQueryHandler(@Nonnull DBClass searchClass)
getQueryHandler
in interface DataSource
searchClass
- The class to search.@CheckReturnValue @Nonnull public RecentLink findRecentLink(java.lang.String fieldKey)
fieldKey
- The field.public void reIndex(@Nullable java.lang.String classes, @Nullable java.lang.String excludeClasses) throws java.lang.Exception
classes
- excludeClasses
- java.lang.Exception
- A serious problempublic void clearCache(@Nonnull DBClass dbClass)
dbClass
- The class to be clearedpublic static void clearDB(int id)
id
- The layer id@CheckReturnValue public boolean isPrivateDB()
@CheckReturnValue @Nullable public java.util.Date getSuspended() throws VirtualDBNotFoundException, RedirectException
VirtualDBNotFoundException
RedirectException
@CheckReturnValue @Nullable public java.util.Date getLicenseKeyExpiryDate()
public void checkSuspended() throws VirtualDBNotFoundException, VirtualDBExpiredException, RedirectException
VirtualDBNotFoundException
VirtualDBExpiredException
RedirectException
- redirect to a new URLpublic void checkLicense() throws VirtualDBExpiredException
VirtualDBExpiredException
public void setCacheObject(java.lang.String key, java.lang.Object obj)
DataSource
setCacheObject
in interface DataSource
key
- The keyobj
- @CheckReturnValue @Nullable public java.lang.Object getCacheObject(java.lang.String key)
getCacheObject
in interface DataSource
key
- The key@CheckReturnValue @Nullable public java.lang.Object getAttribute(@Nonnull java.lang.String name)
getAttribute
in interface DataSource
name
- the name of the attributepublic void addDBClassListener(@Nonnull java.lang.String className, @Nonnull DBClassListener listener)
className
- listener
- The listener.public void addDBClassListener(@Nonnull DBClass dbClass, @Nonnull DBClassListener listener)
dbClass
- the classlistener
- @CheckReturnValue public boolean hasDBClassListener(@Nonnull DBClass dbClass)
dbClass
- The class to remove.public void removeDBClassListener(@Nonnull DBClass dbClass, @Nonnull DBClassListener listener)
dbClass
- The class to remove.listener
- The listener.@CheckReturnValue @Nullable public java.lang.String getCachedValueDB(@Nonnull java.lang.String name, @Nullable java.lang.String defaultValue)
name
- defaultValue
- the class@CheckReturnValue @Nullable public java.lang.String getCachedValueDB(@Nonnull java.lang.String name)
name
- @Nullable public java.lang.String clearCachedValueDB(@Nonnull java.lang.String flg)
flg
- the name of the parameterpublic void setCachedValueDB(@Nonnull java.lang.String flg, @Nonnull java.lang.String value)
flg
- the key valuevalue
- the valuepublic long freeMemory(double percentage)
MemoryHandler
freeMemory
in interface MemoryHandler
percentage
- @CheckReturnValue @Nonnull public MemoryHandler.Cost getCost()
MemoryHandler
getCost
in interface MemoryHandler
@CheckReturnValue @Nonnegative public long getEstimatedSize()
MemoryHandler
getEstimatedSize
in interface MemoryHandler
@CheckReturnValue public long getLastAccessed()
MemoryHandler
getLastAccessed
in interface MemoryHandler
public long queuedFreeMemory(double percentage)
MemoryHandler
queuedFreeMemory
in interface MemoryHandler
percentage
- public long panicFreeMemory()
panicFreeMemory
in interface MemoryHandler
public long tidyUp()
MemoryHandler
tidyUp
in interface MemoryHandler
public void reset()
@CheckReturnValue public boolean needToLoad(@Nonnull GlobalKeyId rootId, long checkRow, @Nullable HashLongMap globalHintMap, long transactionNr)
rootId
- the class idcheckRow
- the row to checkglobalHintMap
- The global hinttransactionNr
- the known transactionstSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.