本文整理汇总了Java中org.jivesoftware.smackx.PrivateDataManager类的典型用法代码示例。如果您正苦于以下问题:Java PrivateDataManager类的具体用法?Java PrivateDataManager怎么用?Java PrivateDataManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrivateDataManager类属于org.jivesoftware.smackx包,在下文中一共展示了PrivateDataManager类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSettings
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
/**
* Returns the specified settings for a Workgroup.
* @param con the XMPPConnection to use.
* @param workgroup the name of the workgroup.
* @param setting the setting to retrieve.
* @return a map of found settings. If no settings have been found, it will
* return null.
*/
public static Map getSettings(XMPPConnection con, String workgroup, String setting) {
try {
PrivateDataManager personalPDM = new PrivateDataManager(con, workgroup);
String namespace = "workgroup:" + workgroup + ":settings:" + setting;
String elementName = "workgroup_settings";
PrivateDataManager.addPrivateDataProvider(elementName, namespace, new SettingsDataProvider());
SettingsPrivateData data = (SettingsPrivateData) personalPDM.getPrivateData(elementName, namespace);
Map map = data.getMap();
return map;
}
catch (XMPPException e) {
WebLog.logError("Could not load private data:", e);
}
return null;
}
示例2: initializeSession
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
/**
* Initializes session.
*
* @param connection the XMPPConnection used in this session.
* @param username the agents username.
* @param password the agents password.
*/
public void initializeSession(XMPPConnection connection, String username, String password) {
this.connection = connection;
this.username = username;
this.password = password;
this.userBareAddress = StringUtils.parseBareAddress(connection.getUser());
// create workgroup session
personalDataManager = new PrivateDataManager(getConnection());
// Discover items
discoverItems();
ProviderManager.getInstance().addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider());
}
示例3: getTaskList
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public static Tasks getTaskList(XMPPConnection con) {
PrivateDataManager manager = new PrivateDataManager(con);
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:tasks", new Tasks.Provider());
Tasks tasks = null;
try {
tasks = (Tasks)manager.getPrivateData("scratchpad", "scratchpad:tasks");
}
catch (XMPPException e) {
Log.error(e);
}
return tasks;
}
示例4: getPrivateNotes
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public static PrivateNotes getPrivateNotes() {
PrivateDataManager manager = new PrivateDataManager(SparkManager.getConnection());
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());
PrivateNotes notes = null;
try {
notes = (PrivateNotes)manager.getPrivateData("scratchpad", "scratchpad:notes");
}
catch (XMPPException e) {
Log.error(e);
}
return notes;
}
示例5: saveTasks
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public static void saveTasks(Tasks tasks, XMPPConnection con) {
PrivateDataManager manager = new PrivateDataManager(con);
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:tasks", new Tasks.Provider());
try {
manager.setPrivateData(tasks);
}
catch (XMPPException e) {
Log.error(e);
}
}
示例6: savePrivateNotes
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public static void savePrivateNotes(PrivateNotes notes) {
PrivateDataManager manager = new PrivateDataManager(SparkManager.getConnection());
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());
try {
manager.setPrivateData(notes);
}
catch (XMPPException e) {
Log.error(e);
}
}
示例7: run
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public void run() {
PrivateDataManager pdm = SparkManager.getSessionManager().getPersonalDataManager();
gatewayPreferences = null;
//Re: SPARK-1483 comment the loop as it causes Out Of Memory (infinite loop) if preferences not found
//If really necessary to try more times, a Thread Pool may be used: java ScheduledThreadPoolExecutor for example
//while (gatewayPreferences == null){
try {
gatewayPreferences = (GatewayPrivateData)pdm.getPrivateData(GatewayPrivateData.ELEMENT, GatewayPrivateData.NAMESPACE);
}
catch (XMPPException e) {
Log.error("Unable to load private data for Gateways", e);
}
//}
}
示例8: setAutoJoin
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
public static void setAutoJoin(String serviceName, boolean autoJoin) {
if (gatewayPreferences != null) {
gatewayPreferences.addService(serviceName, autoJoin);
PrivateDataManager pdm = SparkManager.getSessionManager().getPersonalDataManager();
try {
pdm.setPrivateData(gatewayPreferences);
}
catch (XMPPException e) {
Log.error(e);
}
} else {
Log.warning("Cannot set privacy data as gatewayPreferences is NULL");
}
}
示例9: UserSettings
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
private UserSettings() {
privateDataManager = new PrivateDataManager(SparkManager.getConnection());
PrivateDataManager.addPrivateDataProvider("personal_settings", "jive:user:settings", new SettingsDataProvider());
try {
settingsData = (SettingsData)privateDataManager.getPrivateData("personal_settings", "jive:user:settings");
}
catch (XMPPException e) {
Log.error("Error in User Settings", e);
}
}
示例10: BookmarkManager
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
/**
* Default constructor. Registers the data provider with the private data manager in the
* storage:bookmarks namespace.
*
* @param connection the connection for persisting and retrieving bookmarks.
* @throws XMPPException thrown when the connection is null or has not been authenticated.
*/
private BookmarkManager(Connection connection) throws XMPPException {
if(connection == null || !connection.isAuthenticated()) {
throw new XMPPException("Invalid connection.");
}
this.privateDataManager = new PrivateDataManager(connection);
}
示例11: BookmarkManager
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
/**
* Default constructor. Registers the data provider with the private data
* manager in the storage:bookmarks namespace.
*
* @param connection
* the connection for persisting and retrieving bookmarks.
* @throws XMPPException
* thrown when the connection is null or has not been
* authenticated.
*/
private BookmarkManager(Connection connection) throws XMPPException {
if (connection == null || !connection.isAuthenticated()) {
throw new XMPPException("Invalid connection.");
}
this.privateDataManager = new PrivateDataManager(connection);
}
示例12: getPersonalDataManager
import org.jivesoftware.smackx.PrivateDataManager; //导入依赖的package包/类
/**
* Returns the PrivateDataManager responsible for handling all private data for individual
* agents.
*
* @return the PrivateDataManager responsible for handling all private data for individual
* agents.
*/
public PrivateDataManager getPersonalDataManager() {
return personalDataManager;
}