Java 类org.jivesoftware.smackx.PrivateDataManager 实例源码

项目:Fastpath-webchat    文件:Settings.java   
/**
 * 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;
}
项目:spark-svn-mirror    文件:SessionManager.java   
/**
 * 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());
}
项目:spark-svn-mirror    文件:Tasks.java   
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;
}
项目:spark-svn-mirror    文件:PrivateNotes.java   
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;
}
项目:spark-svn-mirror    文件:Tasks.java   
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);
    }
}
项目:spark-svn-mirror    文件:PrivateNotes.java   
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);
    }
}
项目:spark-svn-mirror    文件:TransportUtils.java   
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);
        }
    //}
}
项目:spark-svn-mirror    文件:TransportUtils.java   
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");
    }
}
项目:spark-svn-mirror    文件:UserSettings.java   
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);
    }
}
项目:EIM    文件:BookmarkManager.java   
/**
 * 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);
}
项目:androidPN-client.    文件:BookmarkManager.java   
/**
 * 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);
}
项目:xmppsupport_v2    文件:BookmarkManager.java   
/**
 * 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);
}
项目:java-bells    文件:BookmarkManager.java   
/**
 * 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);
}
项目:telegraph    文件:BookmarkManager.java   
/**
 * 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);
}
项目:NewCommunication-Android    文件:BookmarkManager.java   
/**
 * 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);
}
项目:spark-svn-mirror    文件:SessionManager.java   
/**
 * 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;
}