本文整理汇总了Java中org.jivesoftware.database.DbConnectionManager类的典型用法代码示例。如果您正苦于以下问题:Java DbConnectionManager类的具体用法?Java DbConnectionManager怎么用?Java DbConnectionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbConnectionManager类属于org.jivesoftware.database包,在下文中一共展示了DbConnectionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteBookmark
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Deletes a bookmark with the specified bookmark ID.
*
* @param bookmarkID the ID of the bookmark to remove from the database.
*/
public static void deleteBookmark(long bookmarkID) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_BOOKMARK);
pstmt.setLong(1, bookmarkID);
pstmt.execute();
}
catch (SQLException e) {
Log.error(e.getMessage(), e);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:23,代码来源:BookmarkManager.java
示例2: insertIntoDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Inserts a new bookmark into the database.
*/
private void insertIntoDb() throws SQLException {
this.bookmarkID = SequenceManager.nextID(this);
Connection con = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
PreparedStatement pstmt = con.prepareStatement(INSERT_BOOKMARK);
pstmt.setLong(1, bookmarkID);
pstmt.setString(2, type.toString());
pstmt.setString(3, name);
pstmt.setString(4, value);
pstmt.setInt(5, global ? 1 : 0);
pstmt.executeUpdate();
pstmt.close();
}
catch (SQLException sqle) {
abortTransaction = true;
throw sqle;
}
finally {
DbConnectionManager.closeTransactionConnection(con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:27,代码来源:Bookmark.java
示例3: insertBookmarkPermission
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
private void insertBookmarkPermission(int type, String name) throws SQLException {
Connection con = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
PreparedStatement pstmt = con.prepareStatement(INSERT_BOOKMARK_PERMISSIONS);
pstmt.setLong(1, bookmarkID);
pstmt.setInt(2, type);
pstmt.setString(3, name);
pstmt.executeUpdate();
pstmt.close();
}
catch (SQLException sqle) {
abortTransaction = true;
throw sqle;
}
finally {
DbConnectionManager.closeTransactionConnection(con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:21,代码来源:Bookmark.java
示例4: deleteBookmarkPermissions
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
private void deleteBookmarkPermissions() throws SQLException {
Connection con = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
PreparedStatement pstmt = con.prepareStatement(DELETE_BOOKMARK_PERMISSIONS);
pstmt.setLong(1, bookmarkID);
pstmt.executeUpdate();
pstmt.close();
}
catch (SQLException sqle) {
abortTransaction = true;
throw sqle;
}
finally {
DbConnectionManager.closeTransactionConnection(con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:19,代码来源:Bookmark.java
示例5: saveToDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Saves a bookmark to the database.
*/
private void saveToDb() {
Connection con = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
PreparedStatement pstmt = con.prepareStatement(SAVE_BOOKMARK);
pstmt.setString(1, type.toString());
pstmt.setString(2, name);
pstmt.setString(3, value);
pstmt.setInt(4, global ? 1 : 0);
pstmt.setLong(5, bookmarkID);
pstmt.executeUpdate();
pstmt.close();
}
catch (SQLException sqle) {
abortTransaction = true;
Log.error(sqle.getMessage(), sqle);
}
finally {
DbConnectionManager.closeTransactionConnection(con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:26,代码来源:Bookmark.java
示例6: loadPropertiesFromDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Loads properties from the database.
*/
private synchronized void loadPropertiesFromDb() {
this.properties = new Hashtable<String, String>();
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_PROPERTIES);
pstmt.setLong(1, bookmarkID);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String name = rs.getString(1);
String value = rs.getString(2);
properties.put(name, value);
}
rs.close();
}
catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:27,代码来源:Bookmark.java
示例7: insertPropertyIntoDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Inserts a new property into the datatabase.
*/
private void insertPropertyIntoDb(String name, String value) {
Connection con = null;
PreparedStatement pstmt = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
pstmt = con.prepareStatement(INSERT_PROPERTY);
pstmt.setLong(1, bookmarkID);
pstmt.setString(2, name);
pstmt.setString(3, value);
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
abortTransaction = true;
}
finally {
DbConnectionManager.closeTransactionConnection(pstmt, con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:24,代码来源:Bookmark.java
示例8: updatePropertyInDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Updates a property value in the database.
*/
private void updatePropertyInDb(String name, String value) {
Connection con = null;
PreparedStatement pstmt = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
pstmt = con.prepareStatement(UPDATE_PROPERTY);
pstmt.setString(1, value);
pstmt.setString(2, name);
pstmt.setLong(3, bookmarkID);
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
abortTransaction = true;
}
finally {
DbConnectionManager.closeTransactionConnection(pstmt, con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:24,代码来源:Bookmark.java
示例9: deletePropertyFromDb
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Deletes a property from the db.
*/
private synchronized void deletePropertyFromDb(String name) {
Connection con = null;
PreparedStatement pstmt = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
pstmt = con.prepareStatement(DELETE_PROPERTY);
pstmt.setLong(1, bookmarkID);
pstmt.setString(2, name);
pstmt.execute();
}
catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
abortTransaction = true;
}
finally {
DbConnectionManager.closeTransactionConnection(pstmt, con, abortTransaction);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:23,代码来源:Bookmark.java
示例10: remove
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
public static void remove(SipAccount sipAccount) {
String sql = "DELETE FROM ofSipUser WHERE username = ?";
Connection con = null;
PreparedStatement psmt = null;
try {
con = DbConnectionManager.getConnection();
psmt = con.prepareStatement(sql);
psmt.setString(1, sipAccount.getUsername());
psmt.executeUpdate();
psmt.close();
} catch (SQLException e) {
Log.error(e.getMessage(), e);
} finally {
DbConnectionManager.closeConnection(psmt, con);
}
}
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:23,代码来源:SipAccountDAO.java
示例11: getPublishedItemCount
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
public static int getPublishedItemCount(LeafNode node, Date since) {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int count = 0;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_ITEMS_COUNT);
pstmt.setString(1, node.getService().getServiceID());
pstmt.setString(2, encodeNodeID(node.getNodeID()));
pstmt.setString(3, StringUtils.dateToMillis(since));
rs = pstmt.executeQuery();
while (rs.next()) {
count = rs.getInt(1);
}
} catch (Exception sqle) {
LOGGER.error(sqle.getMessage(), sqle);
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
return count;
}
开发者ID:magnetsystems,项目名称:message-server,代码行数:23,代码来源:PubSubPersistenceManagerExt.java
示例12: storeGroupList
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Stores a list of groups as having access to the transport in question.
*
* @param groups list of groups who should have access.
*/
public void storeGroupList(ArrayList<Group> groups) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_ALL_GROUPS);
pstmt.setString(1, transportType.toString());
pstmt.executeUpdate();
pstmt.close();
pstmt = con.prepareStatement(ADD_NEW_GROUP);
pstmt.setString(1, transportType.toString());
for (Group group : groups) {
pstmt.setString(2, group.getName());
pstmt.executeUpdate();
}
pstmt.close();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:31,代码来源:PermissionManager.java
示例13: removeSubscription
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Removes the subscription of the user from the DB.
*
* @param service The pubsub service that is hosting the node.
* @param node The node where the user was subscribed to.
* @param subscription The existing subsription of the user to the node.
*/
public static void removeSubscription(PubSubService service, Node node,
NodeSubscription subscription) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
// Remove the affiliate from the table of node affiliates
pstmt = con.prepareStatement(DELETE_SUBSCRIPTION);
pstmt.setString(1, service.getServiceID());
pstmt.setString(2, encodeNodeID(node.getNodeID()));
pstmt.setString(3, subscription.getID());
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:28,代码来源:PubSubPersistenceManager.java
示例14: getGroupNames
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
public Collection<String> getGroupNames() {
List<String> groupNames = new ArrayList<String>();
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(ALL_GROUPS);
rs = pstmt.executeQuery();
while (rs.next()) {
groupNames.add(rs.getString(1));
}
}
catch (SQLException e) {
Log.error(e.getMessage(), e);
}
finally {
DbConnectionManager.closeConnection(rs, pstmt, con); }
return groupNames;
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:21,代码来源:DefaultGroupProvider.java
示例15: getNumberOfRegistrations
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
public int getNumberOfRegistrations() {
int result = 0;
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(GET_SESSION_COUNT);
ResultSet rs = pstmt.executeQuery();
rs.next();
result = rs.getInt(1);
} catch (SQLException sqle) {
Log.error(sqle);
} finally {
DbConnectionManager.closeConnection(pstmt, con);
}
return result;
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:18,代码来源:DatabaseManager.java
示例16: setLastLogin
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Sets the data that the user last logged into the transport.
*
* @param lastLogin the last login date.
*/
public void setLastLogin(Date lastLogin) {
this.lastLogin = lastLogin;
if (disconnectedMode) { return; }
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(SET_LAST_LOGIN);
pstmt.setLong(1, lastLogin.getTime());
pstmt.setLong(2, registrationID);
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:25,代码来源:Registration.java
示例17: updateProperty
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
private void updateProperty(String propName, String propValue) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(UPDATE_PROPERTY);
pstmt.setString(1, propValue);
pstmt.setString(2, propName);
pstmt.setString(3, username);
pstmt.executeUpdate();
}
catch (SQLException e) {
Log.error(e.getMessage(), e);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:19,代码来源:User.java
示例18: loadServiceSubdomain
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Gets a specific subdomain by a service's ID number.
* @param serviceID ID to retrieve subdomain for.
* @return Subdomain of service.
*/
private String loadServiceSubdomain(Long serviceID) {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String subdomain = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_SUBDOMAIN);
pstmt.setLong(1, serviceID);
rs = pstmt.executeQuery();
if (rs.next()) {
subdomain = rs.getString(1);
}
else {
throw new Exception("Unable to locate subdomain for service ID "+serviceID);
}
}
catch (Exception e) {
// No problem, considering this as a "not found".
}
finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
return subdomain;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:MultiUserChatManager.java
示例19: updateProperty
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
private void updateProperty(String data) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement("UPDATE " + tableName + " set propValue=? WHERE ownerID=? AND name=?");
pstmt.setString(1, properties.get(data));
pstmt.setLong(2, id);
DbConnectionManager.setLargeTextField(pstmt, 3, data);
pstmt.executeUpdate();
}
catch (SQLException ex) {
Log.error(ex.getMessage(), ex);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:JiveLiveProperties.java
示例20: deleteService
import org.jivesoftware.database.DbConnectionManager; //导入依赖的package包/类
/**
* Deletes a service based on service ID.
* @param serviceID ID of the service to delete.
*/
private void deleteService(Long serviceID) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_SERVICE);
pstmt.setLong(1, serviceID);
pstmt.executeUpdate();
}
catch (SQLException e) {
Log.error(e.getMessage(), e);
}
finally {
DbConnectionManager.closeConnection(pstmt, con);
}
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:MultiUserChatManager.java
注:本文中的org.jivesoftware.database.DbConnectionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论