本文整理汇总了Java中org.openntf.domino.utils.Factory类的典型用法代码示例。如果您正苦于以下问题:Java Factory类的具体用法?Java Factory怎么用?Java Factory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Factory类属于org.openntf.domino.utils包,在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFacesContext
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Override
public FacesContext getFacesContext(final Object context, final Object request, final Object response, final Lifecycle lifecycle)
throws FacesException {
FacesContext ctx = _delegate.getFacesContext(context, request, response, lifecycle);
try {
Class<?> vnClass = Class.forName("org.openntf.domino.xsp.helpers.OpenntfViewNavigatorEx");
} catch (ClassNotFoundException e) {
System.out.println("OpenntfFacesContextFactory unable to resolve ViewNavigatorEx either!");
}
try {
Factory.setClassLoader(Thread.currentThread().getContextClassLoader());
if (ctx instanceof com.ibm.xsp.context.FacesContextEx) {
((com.ibm.xsp.context.FacesContextEx) ctx).addRequestListener(this);
}
// System.out.println("Created OpenntfFacesContext and setup factory");
} catch (Throwable t) {
t.printStackTrace();
}
return ctx;
}
示例2: readExternal
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
//super.readExternal(in);
parent = Factory.getWrapperFactory();
int version = in.readInt();
if (version != EXTERNALVERSIONUID) {
throw new InvalidClassException("Cannot read dataversion " + version);
}
sessionType_ = (SessionType) in.readObject();
username_ = (String) in.readObject();
currentDatabaseApiPath_ = (String) in.readObject();
isAutoMime_ = (AutoMime) in.readObject();
fixes_ = (Set<Fixes>) in.readObject();
eventFactory_ = (IDominoEventFactory) in.readObject();
featureRestricted_ = in.readBoolean();
}
示例3: scan
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
/**
* Scans all databases on the specified server
*/
public void scan() {
Session session = Factory.getSession();
DbDirectory dir = session.getDbDirectory(getServerName());
dir.setDirectoryType(DbDirectory.Type.DATABASE);
for (Database db : dir) {
try {
if (!scanDatabase(db)) {
XotsScheduler.INSTANCE.unregisterTasklets(db.getApiPath());
}
} catch (Throwable t) {
t.printStackTrace();
}
}
setChanged();
notifyObservers(null);
}
示例4: createSession
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
private org.openntf.domino.Session createSession(final FacesContextEx ctx) {
org.openntf.domino.Session session = null;
String sessionKey = isAppGodMode(ctx) ? "session" : "opensession";
Map<String, Object> localMap = TypedUtil.getRequestMap(ctx.getExternalContext());
lotus.domino.Session rawSession = (lotus.domino.Session) localMap.get("session");
if (rawSession == null) {
rawSession = (lotus.domino.Session) ctx.getApplication().getVariableResolver().resolveVariable(ctx, "session");
}
if (rawSession != null) {
session = Factory.fromLotus(rawSession, org.openntf.domino.Session.class, null);
if (isAppAllFix(ctx)) {
for (Fixes fix : Fixes.values()) {
session.setFixEnable(fix, true);
}
}
if (isAppMimeFriendly(ctx))
session.setConvertMIME(false);
localMap.put(sessionKey, session);
} else {
System.out.println("Unable to locate 'session' through request map or variable resolver. Unable to auto-wrap.");
}
return session;
}
示例5: testViewNameConflict
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void testViewNameConflict() throws IOException, ClassNotFoundException {
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getDatabase("log.nsf");
View vw = db.getView("name1");
assertNotNull(
"you need 4 views for this test in your log.nsf: 'name1|sameAlias','name2|sameAlias', 'sameName|alias1', 'sameName|alias2'",
vw);
View ret = test(vw, true);
assertFalse(vw == ret);
vw = db.getView("name2");
ret = test(vw, true);
assertFalse(vw == ret);
vw = db.getView("alias1");
ret = test(vw, true);
assertFalse(vw == ret);
vw = db.getView("alias2");
ret = test(vw, true);
assertFalse(vw == ret);
}
示例6: publish
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Override
public synchronized void publish(final LogRecord record) {
if (publishing_.get() == Boolean.TRUE)
return;
publishing_.set(Boolean.TRUE);
try {
Session session = Factory.getSession_unchecked(SessionType.CURRENT);
if (session != null) {
_olGenerator.log(session, record, new LogRecordAdditionalInfo(record));
}
} catch (Exception e) {
System.err.println("Exception " + e.getClass().getName() + " in LogHandlerOpenLog.publish:");
e.printStackTrace();
} finally {
publishing_.set(Boolean.FALSE);
}
}
示例7: run
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Override
public void run() {
Factory.enableCounters(true, false);
try {
System.out.println("Currently supported functions");
List<Function> funcs = new ArrayList<Function>();
funcs.addAll(Formulas.getFunctionFactory().getFunctions().values());
Collections.sort(funcs, new Comparator<Function>() {
@Override
public int compare(final Function o1, final Function o2) {
return o1.toString().compareTo(o2.toString());
}
});
for (Function func : funcs) {
System.out.println(func);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: run
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Override
public void run() {
Factory.enableCounters(true, false);
try {
Session sess = Factory.getSession(SessionType.CURRENT);
lotus.domino.Session s = sess.getFactory().toLotus(sess);
lotus.domino.Database d1 = s.getDatabase("", "");
lotus.domino.Database d2 = s.getDatabase("", "");
//System.out.println("d1.cppId: " + Base.getLotusId(d1));
//System.out.println("d2.cppId: " + Base.getLotusId(d2));
d1.openWithFailover("", "names.nsf");
d2.openWithFailover("", "names.nsf");
//System.out.println("d1.cppId: " + Base.getLotusId(d1));
//System.out.println("d2.cppId: " + Base.getLotusId(d2));
System.out.println("D1:" + d1.getFilePath());
d1.recycle();
System.out.println("D2:" + d2.getFilePath());
d2.recycle();
} catch (NotesException e) {
e.printStackTrace();
}
}
示例9: testComputeWithForm
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void testComputeWithForm() throws NotesException {
System.out.println("Test: computeWithForm");
Database db = Factory.getSession(SessionType.CURRENT).getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
int sz = dc.size();
System.out.println(" getAllDocuments=" + sz);
if (sz == 0)
return;
int i = sz >>> 1;
Document found = null;
for (Document doc : dc)
if (i-- == 0) {
found = doc;
break;
}
boolean res = BackendBridge.computeWithForm(found, true, true);
System.out.println(" Result=" + res);
}
示例10: run
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Override
public void run() {
long testStartTime = System.nanoTime();
try {
Session session = Factory.getSession(SessionType.CURRENT);
Database db = session.getDatabase("", "events4.nsf");
DocumentCollection coll = db.getAllDocuments();
for (Document doc : coll) {
System.out.println("nid: " + doc.getNoteID());
}
long endTime = System.nanoTime();
} catch (Throwable t) {
t.printStackTrace();
}
}
示例11: testGetViewEntryByKeyWithOptions
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void testGetViewEntryByKeyWithOptions() throws NotesException {
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getCurrentDatabase();
Vector<View> views = db.getViews();
View dummyView = views.get(0);
try {
BackendBridge.getViewEntryByKeyWithOptions(dummyView, null, 42);
fail("BackendBridge.getViewEntryByKeyWithOptions did not throw expected exceptions");
} catch (BackendBridgeSanityCheckException allGood) {
}
Vector<String> key = new Vector<String>();
key.add("a");
Object e = BackendBridge.getViewEntryByKeyWithOptions(dummyView, key, 2243);
assertTrue(e instanceof org.openntf.domino.ViewEntry);
}
示例12: testSetNoRecycle
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void testSetNoRecycle() {
System.out.println("Test: setNoRecyle");
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
int sz = dc.size();
System.out.println(" getAllDocuments=" + sz);
if (sz == 0)
return;
int i = sz >>> 3;
Document found = null;
for (Document doc : dc)
if (i-- == 0) {
found = doc;
break;
}
BackendBridge.setNoRecycle(sess, found, true);
System.out.println(" Done.");
}
示例13: testForceRecycle
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void testForceRecycle() {
System.out.println("Test: forceRecyle");
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
int sz = dc.size();
System.out.println(" getAllDocuments=" + sz);
if (sz == 0)
return;
int i = sz >>> 4;
Document found = null;
for (Document doc : dc)
if (i-- == 0) {
found = doc;
break;
}
BackendBridge.forceRecycle(sess, found);
System.out.println(" Done.");
}
示例14: run
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
@Test
public void run() {
Session s = Factory.getSession(SessionType.CURRENT);
Database source = s.getDatabase("", TARGET, true);
View view = source.getView(VIEW);
System.out.println("-- START --");
long start = System.nanoTime();
int i = 0;
if (null != view) {
view.setAutoUpdate(false);
System.out.println(view.getEntryCount());
for (ViewEntry entry : view.getAllEntries()) {
i++;
}
/* */
view.setAutoUpdate(true);
}
System.out.println(i);
long elapsed = System.nanoTime() - start;
System.out.println("-- STOP --");
System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
}
示例15: TestNamedSession
import org.openntf.domino.utils.Factory; //导入依赖的package包/类
/**
* This test checks if we can create named sessions
*/
@Test(expected = UserAccessException.class)
public void TestNamedSession() {
Session sess = Factory.getNamedSession("CN=Tony Stark/O=Avengers", false);
assertFalse(sess.isTrustedSession());
assertFalse(sess.isAnonymous());
assertTrue(sess.isRestricted()); //- the XPage sessions is not restricted, the native named sessions are
System.out.println("Named Session User name " + sess.getUserName());
System.out.println("Named Session Effective name " + sess.getEffectiveUserName());
assertEquals("CN=Tony Stark/O=Avengers", sess.getEffectiveUserName());
// RPr TODO: Behavior inconsistent, see #testNativeSession
Database db = sess.getDatabase(TestEnv.SESSION_USER, "names.nsf"); // Throws UAC
assertNotNull(db);
}