use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class D_DiagnosticUtil method diag_containerid_to_conglomid.
public static long diag_containerid_to_conglomid(Object module, long containerid) {
String ret_string = null;
AccessFactory store_module = null;
long conglom_id = Long.MIN_VALUE;
// Find the AccessFactory
store_module = (AccessFactory) getServiceModule(module, AccessFactory.MODULE);
if (store_module != null) {
try {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
conglom_id = tc.findConglomid(containerid);
} catch (Throwable t) {
t.printStackTrace();
// on error just return the initialized bad value conglom_id
}
} else {
// during access boot this does not exist, assume for now that
// is why we got here. RESOLVE - it would be nice if we could
// actuallly figure that is why we failed.
/*
System.out.println(
"Could not find module for module: " + module);
*/
}
return (conglom_id);
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class D_DiagnosticUtil method diag_conglomid_to_containerid.
public static long diag_conglomid_to_containerid(Object module, long conglomid) {
String ret_string = null;
AccessFactory store_module = null;
long container_id = Long.MIN_VALUE;
// Find the AccessFactory
store_module = (AccessFactory) getServiceModule(module, AccessFactory.MODULE);
if (store_module != null) {
try {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
container_id = tc.findContainerid(conglomid);
} catch (Throwable t) {
t.printStackTrace();
// on error just return the initialized bad value conglom_id
}
} else {
// during access boot this does not exist, assume for now that
// is why we got here. RESOLVE - it would be nice if we could
// actuallly figure that is why we failed.
/*
System.out.println(
"Could not find module for module: " + module);
*/
}
return (container_id);
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class T_Heap method runTests.
/**
* @exception T_Fail test failed.
*/
protected void runTests() throws T_Fail {
AccessFactory store = null;
TransactionController tc = null;
boolean pass = false;
out.println("executing heap test");
// don't automatic boot this service if it gets left around
if (startParams == null) {
startParams = new Properties();
}
startParams.put(Property.NO_AUTO_BOOT, Boolean.TRUE.toString());
// remove the service directory to ensure a clean run
startParams.put(Property.DELETE_ON_CREATE, Boolean.TRUE.toString());
// see if we are testing encryption
startParams = T_Util.setEncryptionParam(startParams);
try {
store = (AccessFactory) createPersistentService(getModuleToTestProtocolName(), testService, startParams);
} catch (StandardException mse) {
throw T_Fail.exceptionFail(mse);
}
if (store == null) {
throw T_Fail.testFailMsg(getModuleToTestProtocolName() + " service not started.");
}
REPORT("(unitTestMain) Testing " + testService);
try {
tc = store.getTransaction(getContextService().getCurrentContextManager());
if (t_001(tc)) {
pass = true;
}
tc.commit();
tc.destroy();
} catch (StandardException e) {
System.out.println("got an exception.");
String msg = e.getMessage();
if (msg == null)
msg = e.getClass().getName();
REPORT(msg);
throw T_Fail.exceptionFail(e);
}
if (!pass)
throw T_Fail.testFailMsg("T_Heap test failed");
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class T_CreateConglomRet method runTestSet.
/**
* Driver routine for the btree secondary index tests.
* <p>
*
* @exception T_Fail Throws T_Fail on any test failure.
*/
protected void runTestSet() throws T_Fail {
AccessFactory store = null;
TransactionController tc = null;
boolean pass = false;
out.println("executing b2i test");
store = (AccessFactory) store_module;
if (store == null) {
throw T_Fail.testFailMsg(getModuleToTestProtocolName() + " service not started.");
}
ContextManager cm1 = contextService.newContextManager();
contextService.setCurrentContextManager(cm1);
REPORT("(unitTestMain) Testing " + testService);
try {
tc = store.getTransaction(cm1);
pass = true;
if (t_005(tc) && t_001(tc) && t_003(tc) && t_004(tc) && t_005(tc) && t_006(tc) && t_009(tc) && t_010(tc) && t_011(tc) && t_012(tc) && t_013(tc) && t_014(tc) && t_017(tc) && t_018(tc) && t_019(tc) && t_020(tc) && t_021(tc)) {
pass = true;
if (SanityManager.DEBUG) {
pass = false;
if (t_002(tc) && t_007(tc) && t_008(tc) && t_015(tc) && t_016(tc))
pass = true;
}
}
tc.commit();
tc.destroy();
} catch (StandardException e) {
String msg = e.getMessage();
if (msg == null)
msg = e.getClass().getName();
REPORT(msg);
e.printStackTrace(out.getPrintWriter());
cm1.cleanupOnError(e, isdbActive());
pass = false;
} catch (Throwable t) {
String msg = t.getMessage();
if (msg == null)
msg = t.getClass().getName();
REPORT(msg);
t.printStackTrace(out.getPrintWriter());
cm1.cleanupOnError(t, isdbActive());
pass = false;
} finally {
contextService.resetCurrentContextManager(cm1);
}
if (!pass)
throw T_Fail.testFailMsg("");
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class LogToFile method enableLogArchiveMode.
// enable the log archive mode
public void enableLogArchiveMode() throws StandardException {
// if the log archive mode is already enabled; thre is nothing to do
if (!logArchived) {
logArchived = true;
AccessFactory af = (AccessFactory) getServiceModule(this, AccessFactory.MODULE);
if (af != null) {
TransactionController tc = null;
tc = af.getTransaction(getContextService().getCurrentContextManager());
tc.setProperty(Property.LOG_ARCHIVE_MODE, "true", true);
}
}
}
Aggregations