public class TestBOLoader extends java.lang.Object implements BOLoaderI, ExpiringTokenStorageProviderI
BOQueryLoaderI.InternalHelperrootPaneToLockOnConnectionInterrupt| Constructor and Description |
|---|
TestBOLoader(SchemaI _schema) |
TestBOLoader(java.lang.String schemaPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
addQueryInterceptor(java.lang.String query,
TestQueryInterceptorI qi)
Adds a Queryinterceptor to this BOLoader, which allows to explicitly execute
certain code to calculate the response to this query.
|
void |
clearQueryInterceptors()
Clears the list of interceptable Queries
|
java.lang.String |
createExpiringToken(java.lang.String serviceName,
byte[] value,
long expiryms)
Works like @see #createExpiringToken(String,String,byte[],long), but creates a non-conflicting tokenName
within the store, stores the value and returns the chosen tokenName.
|
void |
createExpiringToken(java.lang.String serviceName,
java.lang.String tokenName,
byte[] value,
long expiryms)
ExpiringTokenStorageProviderI (copy of the minimal code from DBMan)
|
TestTransaction |
createInstrumentedTransaction() |
TestTransaction |
createInstrumentedTransaction(java.lang.String description) |
TestTransaction |
createInstrumentedTransaction(java.lang.String description,
TemporaryIdSupplierI tempIdSupplier) |
TestTransaction |
createTransaction()
Creates and returns a new Transaction of type TestTransaction.
|
TestTransaction |
createTransaction(java.lang.String description) |
TestTransaction |
createTransaction(java.lang.String description,
TemporaryIdSupplierI tempIdSupplier) |
TestTransaction |
createTransactionDescWithInitialDataFor(java.lang.String txDescription,
java.lang.Object[] namesOrClasses) |
TestTransaction |
createTransactionWithInitialDataFor(java.lang.Object[] namesOrClasses)
Creates or returns a cached transaction with the provided names or classes.
|
byte[] |
destroyExpiringToken(java.lang.String serviceName,
java.lang.String tokenName)
Destroys a time limited token immediately
|
void |
drain()
If this BOLoader has a cache, we request it to empty it.
|
void |
execute(BatchedBackendRequestI[] srs) |
boolean |
exists(java.lang.Long $44)
wrapper for exists(id, null).
|
boolean |
exists(java.lang.Long $42,
java.lang.Class<? extends BOI> $43)
Returns true if a BO with the given id exists.
|
BO |
frapFromCache(BO bo)
Put a BO instance to further use in this BOLoader, cloning it in case it's unknown,
giving back a cached instance in case it's cached,
in any way returning an instance without making further reloads (which would make
the effort of caching it useless).
|
byte[] |
getBLOB(java.lang.Long boid)
get the BLOB belonging to BO[id].
|
long |
getBLOB(java.lang.Long $31,
java.io.DataOutput $32)
Writes the BLOB belonging to BO[id] to the passed DataOutput.
|
long |
getBLOB(java.lang.Long $33,
java.io.DataOutput $34,
boolean $35)
Writes the BLOB belonging to BO[id] to the passed DataOutput.
|
long |
getBLOB(java.lang.Long $36,
java.io.DataOutput $37,
boolean $38,
java.lang.Long $39)
Writes the BLOB belonging to BO[id] to the passed DataOutput.
|
byte[] |
getBLOB(java.lang.Long boid,
java.lang.Long backuppingBPId)
get the BLOB belonging to BO[id].
|
long |
getBLOB(java.lang.Long $22,
java.io.OutputStream $23)
Writes the BLOB belonging to BO[id] to the passed OutputStream.
|
long |
getBLOB(java.lang.Long $24,
java.io.OutputStream $25,
boolean $26)
Writes the BLOB belonging to BO[id] to the passed OutputStream.
|
long |
getBLOB(java.lang.Long $27,
java.io.OutputStream $28,
boolean $29,
java.lang.Long $30)
Writes the BLOB belonging to BO[id] to the passed OutputStream.
|
VFile |
getBLOBInfo(java.lang.Long id)
gathers information about the BLOB belonging to BO[i].
|
VFile |
getBLOBInfo(java.lang.Long id,
java.lang.Long backuppingBPId)
gathers information about the BLOB belonging to BO[i].
|
BO |
getBO(java.lang.Long id)
wrapper for getBO(id, null).
|
BO |
getBO(java.lang.Long id,
java.lang.Class<? extends BOI> classtip)
Returns the BO with the given id.
|
BO[] |
getBOs(long[] ids)
wrapper for getBOs(ids, null)
|
BO[] |
getBOs(java.lang.Long[] ids)
wrapper for getBOs(ids, null)
|
BO[] |
getBOs(long[] ids,
java.lang.Class<? extends BOI> classtip)
returns the BOs with the given ids.
|
BO[] |
getBOs(java.lang.Long[] ids,
java.lang.Class<? extends BOI> classtip)
returns the BOs with the given ids.
|
BOT |
getBOT(java.lang.Class<? extends BOI> $47) |
BO |
getBOUncached(java.lang.Long id) |
BO |
getBOUncached(java.lang.Long id,
java.lang.Class<? extends BOI> classtip)
Loads and returns the BO with this Id with a non caching BOLoader.
|
CryptoHandlerI |
getCryptoHandler()
get a reference to the CryptoHandler used.
|
DBManEventProviderI |
getEventProvider()
Returns the DBManEventProviderI of this BOLoader, if any.
|
FeatureManagerI |
getFeatureManager() |
FileVaultI |
getFileVault() |
java.lang.Long |
getNextId()
get a unique Long id from the backend.
|
BOLoaderI |
getParentLoader()
returns the BOLoader which this BOLoader uses to load its objects.
|
BO[] |
getRelationBOs(java.lang.Long id,
java.lang.Class<? extends BOI> classtip,
java.lang.String attributeName)
this method is used by the lazy loading map/list implementation to load related
objects when needed.
|
BOLoaderI |
getRootLoader()
Returns the root BOLoader of this BOLoader or this if there is no more parent loader.
|
SchemaI |
getSchema()
gets a reference to the schema which is used by this BOLoader.
|
java.lang.String |
getTraceQueryOnEntity() |
TestTransaction |
getTx() |
boolean |
hasBLOB(java.lang.Long id) |
boolean |
hasBLOB(java.lang.Long id,
java.lang.Long backuppingBPId) |
void |
injectAdditionalPersistentBOs(java.util.Collection<BO> bos)
Adds the given
BO instances to the set of "persistent" BOs known to this loader (which is the
set of BOs known to the most recently created Transaction with this loader). |
boolean |
isCaching()
If true, then this BOLoaderI uses an internal cache, holding all BOs hat were loaded or frapped into it.
|
java.lang.Boolean |
isLoggedIn(Benutzer $40)
Tells if the given Benutzer is currently logged in.
|
boolean |
isLoggedInNN(Benutzer $41)
Tells if the given Benutzer is currently logged in.
|
boolean |
isRecording()
Returns true if this BOLoaderI records changes.
|
boolean |
isTesting()
Returns true if this BOLoaderI is for testing only, i.e. used in JUnit testing environments only.
|
static CBOSchema |
loadSchema(java.lang.String schemaPath) |
static void |
main(java.lang.String[] args) |
static TestBOLoader |
of(java.lang.String projectPath)
Builder for a new TestBOLoader based on a mix from a package or file path.
|
java.util.List<BO> |
parseQueryAndFetchBOs(java.lang.String query)
Try to parse and anwser this query (generic method).
|
java.util.List<BO> |
parseQueryAndFetchBOs(java.lang.String query,
java.lang.Object[] pvals) |
BatchedBackendRequestI |
prepareQuery(java.lang.String s) |
BatchedBackendRequestI |
prepareQuery(java.lang.String s,
java.lang.Object[] o) |
de.ipcon.db.core.QueryResultsI |
query(BOQuery _eq)
query objects in an iterative way to hide backend processing time.
|
de.ipcon.db.core.QueryResultsI |
query(java.lang.String query)
wrapper for query(t, Object[0])
|
de.ipcon.db.core.QueryResultsI |
query(java.lang.String query,
java.lang.Object[] pvals)
query objects in an iterative way to hide backend processing time.
|
java.util.List |
queryBO(BOQuery _eq)
query objects and block until all objects are transferred, returns Objects as a List.
|
java.util.List<BO> |
queryBO(java.lang.String query)
wrapper for queryBO(String, Object[0])
|
java.util.List<BO> |
queryBO(java.lang.String query,
java.lang.Object[] pvals)
query objects and block until all objects are transferred, returns Objects as a List.
|
de.ipcon.db.core.QueryResultsI |
queryRelation(long $48,
java.lang.Class<? extends BOI> $49,
java.lang.String $50)
does the same as @see #getRelationBOs, but returns a QueryResultsI like @see #query.
|
TestQueryInterceptorI |
removeQueryInterceptor(java.lang.String query)
Removes the Interceptor that handles this query from the list of possible Interceptors
and returns it.
|
byte[] |
retrieveExpiringToken(java.lang.String serviceName,
java.lang.String tokenName)
Retrieves a time limited token
|
void |
setSchema(SchemaI $51) |
void |
setTraceQueryOnEntity(java.lang.String $53) |
void |
setTx(TestTransaction $52) |
java.lang.Long |
testAuth(Anmeldung $45)
Tests wether given credentials can be verified.
|
boolean |
testAuth(de.ipcon.db.core.PasswortUeberpruefung $46)
Tests wether given credentials can be verified.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfrapBOArrayFromCache, frapBOIArrayFromCache, frapBOsFromCache, frapFromCache, isAncestorOf, isRootLoader, isServerSide, prepareQueryhaveBLOB, haveBLOB, haveBLOBgetBOByAttr, getBOByAttr, getBOByAttr, getBOByAttrs, getBOByAttrs, getBOByAttrs, getBOsByAttrs, getBOsByAttrs, getBOsByAttrs, getBOsByAttrs, getOneBOByAttr, getUniqueBOByAttrpublic TestBOLoader(java.lang.String schemaPath)
public TestBOLoader(SchemaI _schema)
public static void main(java.lang.String[] args)
public boolean isTesting()
BOLoaderIpublic void injectAdditionalPersistentBOs(java.util.Collection<BO> bos)
BO instances to the set of "persistent" BOs known to this loader (which is the
set of BOs known to the most recently created Transaction with this loader).public static TestBOLoader of(java.lang.String projectPath)
TestBOLoader.of('@PRJPACK@')
TestBOLoader.of('@PRJPACK@', '/schema/schema.xml')TestBOLoader.of('@PRJPACK@/schema', '/schema.xml')TestBOLoader.of('com.myproject')
TestBOLoader.of('com/myproject', '/schema/schema.xml')TestBOLoader.of('com('com.myproject', 'schema.schema.xml')schemaPath - the path to the schema file itself. Defaults to '/schema/schema.xml'public static CBOSchema loadSchema(java.lang.String schemaPath)
public java.lang.Long getNextId()
BOLoaderIpublic TestTransaction createTransaction()
description - description for the TX, if null a default description will be generatedtempIdSupplier - FIXME! 2022-05-11: Ignored, not usedpublic TestTransaction createTransaction(java.lang.String description)
public TestTransaction createTransaction(java.lang.String description, TemporaryIdSupplierI tempIdSupplier)
public TestTransaction createTransactionWithInitialDataFor(java.lang.Object[] namesOrClasses)
public TestTransaction createTransactionDescWithInitialDataFor(java.lang.String txDescription, java.lang.Object[] namesOrClasses)
public TestTransaction createInstrumentedTransaction()
public TestTransaction createInstrumentedTransaction(java.lang.String description)
public TestTransaction createInstrumentedTransaction(java.lang.String description, TemporaryIdSupplierI tempIdSupplier)
public BO getBO(java.lang.Long id) throws ObjectNotPersistentException
BOLoaderIgetBO in interface BOLoaderIObjectNotPersistentExceptionBOLoaderI.getBO(Long, Class)public BO getBO(java.lang.Long id, java.lang.Class<? extends BOI> classtip) throws ObjectNotPersistentException
BOLoaderIgetBO in interface BOLoaderIid - the id of the BOclasstip - a guess which class the object has. May be null.ObjectNotPersistentExceptionpublic BO[] getBOs(java.lang.Long[] ids, java.lang.Class<? extends BOI> classtip)
BOLoaderIgetBOs in interface BOLoaderIids - array of Longs with ids for the requested BOs.classtip - guess for classes which the BOs belong to, may be null.Transactionpublic BO[] getBOs(java.lang.Long[] ids)
BOLoaderIgetBOs in interface BOLoaderIBOLoaderI.getBOs(Long[],Class)public BO[] getBOs(long[] ids, java.lang.Class<? extends BOI> classtip)
BOLoaderIgetBOs in interface BOLoaderIids - array of longs with ids for the requested BOs.classtip - guess for classes which the BOs belong to, may be null.Transactionpublic BO[] getBOs(long[] ids)
BOLoaderIgetBOs in interface BOLoaderIBOLoaderI.getBOs(long[],Class)public BO getBOUncached(java.lang.Long id)
getBOUncached in interface BOLoaderIpublic BO getBOUncached(java.lang.Long id, java.lang.Class<? extends BOI> classtip)
BOLoaderIBOLoaderI.isCaching() BOLoaderI instances.getBOUncached in interface BOLoaderIpublic BO[] getRelationBOs(java.lang.Long id, java.lang.Class<? extends BOI> classtip, java.lang.String attributeName)
BOLoaderIgetRelationBOs in interface BOLoaderIid - id of the BO which the requested BOs has a relation toclasstip - common superclass of the requested bosattributeName - name of the relation from the BO to the requested onespublic de.ipcon.db.core.QueryResultsI query(java.lang.String query)
BOLoaderIquery in interface BOLoaderIquery in interface BOQueryLoaderIBOLoaderI.query(String, Object[])public de.ipcon.db.core.QueryResultsI query(java.lang.String query,
java.lang.Object[] pvals)
BOLoaderIThis sample shows how to query bla BOs though this method
do
it = bol.query("bla from pack.bo bla where not Ldel limit 2")
loop while it.hasNext()
bo = BO it.getCurrentObject() -- hopefully this IS a BO, depends on the query.
-- do whatever you have to do with the bo
finally
it.close()
end
The finally clause is very important to free up database and backend resources,
so please don't forget this step!query in interface BOLoaderIquery in interface BOQueryLoaderIquery in interface GrooqlBOLoaderIquery - the query to fetch, written in OQLpvals - an object array corresponding with $n entries, $1 is pvals[0] and so forth. Must not be null.public de.ipcon.db.core.QueryResultsI query(BOQuery _eq)
BOLoaderIpublic java.util.List<BO> queryBO(java.lang.String query)
BOLoaderIqueryBO in interface BOLoaderIqueryBO in interface BOQueryLoaderIBOLoaderI.queryBO(String, Object[])public java.util.List<BO> queryBO(java.lang.String query, java.lang.Object[] pvals)
BOLoaderIqueryBO in interface BOLoaderIqueryBO in interface BOQueryLoaderIqueryBO in interface GrooqlBOLoaderIquery - the query to fetch, written in OQLpvals - an object array corresponding with $n entries, $1 is pvals[0] and so forth. Must not be null.BOLoaderI.query(String, Object[])public java.util.List<BO> parseQueryAndFetchBOs(java.lang.String query)
public java.util.List<BO> parseQueryAndFetchBOs(java.lang.String query, java.lang.Object[] pvals)
public java.util.List queryBO(BOQuery _eq)
BOLoaderIpublic BO frapFromCache(BO bo)
BOLoaderIfrapFromCache in interface BOLoaderIpublic BOLoaderI getRootLoader()
BOLoaderIgetRootLoader in interface BOLoaderIpublic BatchedBackendRequestI prepareQuery(java.lang.String s, java.lang.Object[] o)
prepareQuery in interface BOLoaderIpublic BatchedBackendRequestI prepareQuery(java.lang.String s)
prepareQuery in interface BOLoaderIpublic void execute(BatchedBackendRequestI[] srs)
public CryptoHandlerI getCryptoHandler()
BOLoaderIgetCryptoHandler in interface BOLoaderIpublic void addQueryInterceptor(java.lang.String query,
TestQueryInterceptorI qi)
query - the exact query that should be intercepted, nonnull (unique)qi - the interceptor that handles this query, nonnull.public TestQueryInterceptorI removeQueryInterceptor(java.lang.String query)
query - the query that should no longer be intercepted, nonnullpublic FileVaultI getFileVault()
getFileVault in interface BOLoaderIpublic void clearQueryInterceptors()
public void createExpiringToken(java.lang.String serviceName,
java.lang.String tokenName,
byte[] value,
long expiryms)
createExpiringToken in interface ExpiringTokenStorageProviderIserviceName - name (fqn) of the service who provided the valuetokenName - name of the token variable which in conjunction with the service name provides a key to the valuevalue - the actual value, as byte arrayexpiryms - the time the value will be valid. After that time, the value is removed from the storepublic java.lang.String createExpiringToken(java.lang.String serviceName,
byte[] value,
long expiryms)
ExpiringTokenStorageProviderIcreateExpiringToken in interface ExpiringTokenStorageProviderIserviceName - name (fqn) of the service who provided the valuevalue - the actual value, as byte arrayexpiryms - the time the value will be valid. After that time, the value is removed from the storepublic byte[] retrieveExpiringToken(java.lang.String serviceName,
java.lang.String tokenName)
ExpiringTokenStorageProviderIretrieveExpiringToken in interface ExpiringTokenStorageProviderIserviceName - name (fqn) of the service who provided the valuetokenName - name of the token variable which in conjunction with the service name provides a key to the valuepublic byte[] destroyExpiringToken(java.lang.String serviceName,
java.lang.String tokenName)
ExpiringTokenStorageProviderIdestroyExpiringToken in interface ExpiringTokenStorageProviderIserviceName - name (fqn) of the service who provided the valuetokenName - name of the token variable which in conjunction with the service name provides a key to the valuepublic boolean hasBLOB(java.lang.Long id)
hasBLOB in interface BLOBLoaderIid - the id of the BO the check for existence of a BLOB on the server.public boolean hasBLOB(java.lang.Long id,
java.lang.Long backuppingBPId)
hasBLOB in interface BLOBLoaderIid - the id of the BO the check for existence of a BLOB on the server.backuppingBPId - instead of the current BLOB get the VFile for
the backup-BLOB that was stored because of this BP-Id from
the backup-dirpublic byte[] getBLOB(java.lang.Long boid)
BLOBLoaderIgetBLOB in interface BLOBLoaderIboid - the id of the BO the BLOB belongs to.public byte[] getBLOB(java.lang.Long boid,
java.lang.Long backuppingBPId)
BLOBLoaderIgetBLOB in interface BLOBLoaderIboid - the id of the BO the BLOB belongs to.backuppingBPId - instead of the current BLOB get and stream
the backup-BLOB that was stored because of this BP-Id from the backup-dirpublic VFile getBLOBInfo(java.lang.Long id)
BLOBLoaderIgetBLOBInfo in interface BLOBLoaderIid - the id of the BO the BLOB-info belongs to.public VFile getBLOBInfo(java.lang.Long id, java.lang.Long backuppingBPId)
BLOBLoaderIgetBLOBInfo in interface BLOBLoaderIid - the id of the BO the BLOB-info belongs to.backuppingBPId - instead of the current BLOB get the VFile for
the backup-BLOB that was stored because of this BP-Id from the backup-dirpublic long getBLOB(java.lang.Long $22,
java.io.OutputStream $23)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$22 - the id of the BO the BLOB belongs to$23 - the OutputStream to write the BLOB-bytes topublic long getBLOB(java.lang.Long $24,
java.io.OutputStream $25,
boolean $26)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$24 - the id of the BO the BLOB belongs to$25 - the OutputStream to write the BLOB-bytes to$26 - a boolean designating if the OutputStream shall be closed afterwards or not.public long getBLOB(java.lang.Long $27,
java.io.OutputStream $28,
boolean $29,
java.lang.Long $30)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$27 - the id of the BO the BLOB belongs to$28 - the OutputStream to write the BLOB-bytes to$29 - a boolean designating if the OutputStream shall be closed afterwards or not.$30 - instead of the current BLOB get and stream
the backup-BLOB that was stored because of this BP-Id from the backup-dirpublic long getBLOB(java.lang.Long $31,
java.io.DataOutput $32)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$31 - the id of the BO the BLOB belongs to$32 - the DataOutput to write the BLOB-bytes topublic long getBLOB(java.lang.Long $33,
java.io.DataOutput $34,
boolean $35)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$33 - the id of the BO the BLOB belongs to$34 - the DataOutput to write the BLOB-bytes to$35 - a boolean designating if the DataOutput shall be closed afterwards or not.public long getBLOB(java.lang.Long $36,
java.io.DataOutput $37,
boolean $38,
java.lang.Long $39)
BLOBLoaderIgetBLOB in interface BLOBLoaderI$36 - the id of the BO the BLOB belongs to$37 - the DataOutput to write the BLOB-bytes to$38 - a boolean designating if the DataOutput shall be closed afterwards or not.$39 - instead of the current BLOB get and stream
the backup-BLOB that was stored because of this BP-Id from the backup-dirpublic java.lang.Boolean isLoggedIn(Benutzer $40)
BOLoaderIisLoggedIn in interface BOLoaderI$40 - the Benutzer for which the logged in state should be checkedpublic boolean isLoggedInNN(Benutzer $41)
BOLoaderIisLoggedInNN in interface BOLoaderI$41 - the Benutzer for which the logged in state should be checkedpublic boolean exists(java.lang.Long $42,
java.lang.Class<? extends BOI> $43)
BOLoaderIpublic boolean exists(java.lang.Long $44)
BOLoaderIexists in interface BOLoaderIBOLoaderI.exists(Long, Class)public java.lang.Long testAuth(Anmeldung $45)
BOLoaderIpublic boolean testAuth(de.ipcon.db.core.PasswortUeberpruefung $46)
BOLoaderIpublic de.ipcon.db.core.QueryResultsI queryRelation(long $48,
java.lang.Class<? extends BOI> $49,
java.lang.String $50)
BOLoaderIqueryRelation in interface BOLoaderIpublic boolean isCaching()
BOLoaderIpublic boolean isRecording()
BOLoaderIisRecording in interface BOLoaderIpublic FeatureManagerI getFeatureManager()
getFeatureManager in interface BOLoaderIpublic BOLoaderI getParentLoader()
BOLoaderIgetParentLoader in interface BOLoaderIpublic void drain()
BOLoaderIBOLoaderI.isCaching() returns false, this is a nop.public DBManEventProviderI getEventProvider()
BOLoaderIgetEventProvider in interface BOLoaderIpublic SchemaI getSchema()
BOLoaderIgetSchema in interface BOLoaderIgetSchema in interface SchemaProviderIpublic void setSchema(SchemaI $51)
public TestTransaction getTx()
public void setTx(TestTransaction $52)
public java.lang.String getTraceQueryOnEntity()
public void setTraceQueryOnEntity(java.lang.String $53)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.