本文整理汇总了Java中lotus.domino.Database.getFilePath方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getFilePath方法的具体用法?Java Database.getFilePath怎么用?Java Database.getFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Database
的用法示例。
在下文中一共展示了Database.getFilePath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLocalDatabaseReplica
import lotus.domino.Database; //导入方法依赖的package包/类
public static String createLocalDatabaseReplica(Database db, String destDbName) throws Throwable {
Database newDb = null;
String newDbPath = null;
try {
// Make a replica of the database
newDb = db.createReplica(null, destDbName);
newDbPath = newDb.getFilePath();
} finally {
if (newDb != null) {
try {
// Ensure db is flushed to disk
newDb.recycle();
// Add a pause for safety, just in case another thread handles the flush
Thread.sleep(1000);
} catch (NotesException e) {
if (BluemixLogger.BLUEMIX_LOGGER.isErrorEnabled()) {
BluemixLogger.BLUEMIX_LOGGER.errorp(null, "createLocalDatabaseReplica", e, "Failed to recycle newDb"); // $NON-NLS-1$ $NLE-BluemixUtil.FailedtorecyclenewDb.1-2$
}
}
}
}
return newDbPath;
}
示例2: createLocalDatabaseCopy
import lotus.domino.Database; //导入方法依赖的package包/类
public static String createLocalDatabaseCopy(Database db, String destDbName) throws Throwable {
Database newDb = null;
String newDbPath = null;
try {
// Make a copy of the database
newDb = db.createCopy(null, destDbName);
newDbPath = newDb.getFilePath();
// Copy all the docs
DocumentCollection col = db.getAllDocuments();
Document doc = col.getFirstDocument();
while (doc != null) {
doc.copyToDatabase(newDb);
doc = col.getNextDocument();
}
// Copy the profile docs
col = db.getProfileDocCollection(null);
doc = col.getFirstDocument();
while (doc != null) {
doc.copyToDatabase(newDb);
doc = col.getNextDocument();
}
} finally {
if (newDb != null) {
try {
// Ensure db is flushed to disk
newDb.recycle();
// Add a pause for safety, just in case another thread handles the flush
Thread.sleep(1000);
} catch (NotesException e) {
if (BluemixLogger.BLUEMIX_LOGGER.isErrorEnabled()) {
BluemixLogger.BLUEMIX_LOGGER.errorp(null, "createLocalDatabaseCopy", e, "Failed to recycle newDb"); // $NON-NLS-1$ $NLE-BluemixUtil.FailedtorecyclenewDb-2$
}
}
}
}
return newDbPath;
}
示例3: setImpl
import lotus.domino.Database; //导入方法依赖的package包/类
protected void setImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't modify the owner's access
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, delegate.getName(), owner);
// Can't modify a delegate that's not there
Vector[] vectors = loadVectors(profile);
Name name = session.createName(delegate.getName());
if ( !delegateExists(vectors, name.getCanonical()) ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
}
// Update the right vector(s)
delegateRemove(vectors, name.getCanonical());
delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
// Send the adminp request
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],
null, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例4: addImpl
import lotus.domino.Database; //导入方法依赖的package包/类
protected void addImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't add the owner as a delegate
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, delegate.getName(), owner);
// Can't add someone that's already there
Vector[] vectors = loadVectors(profile);
Name name = session.createName(delegate.getName());
if ( delegateExists(vectors, name.getCanonical()) ) {
throw new ModelException("A delegate of that name already exists", ModelException.ERR_CONFLICT); // $NON-NLS-1$
}
// Add the delegate to the right vector(s)
delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
// Send the adminp request
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],
null, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例5: deleteImpl
import lotus.domino.Database; //导入方法依赖的package包/类
protected void deleteImpl(Database database, String name, Document profile) throws ModelException, NotesException {
AdministrationProcess adminp = null;
try {
Session session = database.getParent();
// Can't remove the owner
String owner = profile.getItemValueString(OWNER_ITEM);
verifyDelegateNotOwner(session, name, owner);
// Can't remove a delegate that's not there
Vector[] vectors = loadVectors(profile);
Name no = session.createName(name);
if ( !delegateExists(vectors, no.getCanonical()) ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
}
// Send the adminp request
Vector removeList = new Vector();
removeList.add(no.getCanonical());
String mailFile = database.getFilePath();
String server = session.getServerName();
adminp = session.createAdministrationProcess(null);
String unid = adminp.delegateMailFile(owner,
null, null, null, null, null, null,
removeList, mailFile, server);
}
finally {
BackendUtil.safeRecycle(adminp);
}
}
示例6: NABDb
import lotus.domino.Database; //导入方法依赖的package包/类
NABDb(Database db) throws NotesException {
this(db.getFilePath(),db.getTitle());
this.publicNab = db.isPublicAddressBook();
this.privateNab = db.isPrivateAddressBook();
}
示例7: localFileExists
import lotus.domino.Database; //导入方法依赖的package包/类
private boolean localFileExists(Session session, String filepath) throws NotesException {
boolean exists = false;
DbDirectory dbdir = null;
Database localDb = null;
try {
try {
// Optimistically attempt to open the database
localDb = session.getDatabase(null, filepath, false);
if ( localDb != null ) {
exists = true;
}
}
catch (NotesException e) {
if ( e.id == NotesError.NOTES_ERR_DBNOACCESS ) {
// An access error proves the database exists
exists = true;
}
else {
// Ignore other errors and fall into the exhaustive search below.
}
}
if ( !exists) {
// Exhaustive search of database directory
dbdir = session.getDbDirectory(null);
Database database = dbdir.getFirstDatabase(DbDirectory.DATABASE);
while ( database != null ) {
String path = database.getFilePath();
if ( filepath.equals(path) ) {
// TODO: Make sure this is database is really a replica of the user's mail file.
// Usually replicas have the same name, but it's not guaranteed.
exists = true;
break;
}
Database next = dbdir.getNextDatabase();
BackendUtil.safeRecycle(database);
database = next;
}
}
}
finally {
BackendUtil.safeRecycle(localDb);
BackendUtil.safeRecycle(dbdir);
}
return exists;
}