org.jivesoftware.smackx.iqprivate.PrivateDataManager Java Examples

The following examples show how to use org.jivesoftware.smackx.iqprivate.PrivateDataManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionManager.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes session.
 *
 * @param connection the XMPPConnection used in this session.
 * @param username   the agents username.
 * @param password   the agents password.
 */
public void initializeSession( AbstractXMPPConnection connection, String username, String password) {
    this.connection = connection;
    this.username = username;
    this.password = password;
    this.userBareAddress = connection.getUser().asEntityBareJid();

    // create workgroup session
    personalDataManager = PrivateDataManager.getInstanceFor( getConnection() );

    // Discover items
    discoverItems();


    ProviderManager.addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider());
}
 
Example #2
Source File: PrivateNotes.java    From Spark with Apache License 2.0 6 votes vote down vote up
public static PrivateNotes getPrivateNotes() {
    PrivateDataManager manager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());

    PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());

    PrivateNotes notes = null;

    try {
        notes = (PrivateNotes)manager.getPrivateData("scratchpad", "scratchpad:notes");
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error(e);
    }

    if(notes.getNotes() != null )
    	{
    		String note=notes.getNotes().replaceAll("&","&");
    		notes.setMyNotes(note);
    	}
    
    return notes;
}
 
Example #3
Source File: SessionManager.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
public void initializeSession(AbstractXMPPConnection conn) {
	connection = conn;
    personalDataManager = PrivateDataManager.getInstanceFor(conn);

    discoverItems();

    List<DiscoverItems.Item> it = discoverItems.getItems();//

 for (DiscoverItems.Item item : it) {	     	
 	DebugUtil.debug(item.getEntityID()+item.getName());
  }
}
 
Example #4
Source File: Tasks.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void saveTasks(Tasks tasks, XMPPConnection con) {
    PrivateDataManager manager = PrivateDataManager.getInstanceFor( con );

    PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:tasks", new Tasks.Provider());
    try {
        manager.setPrivateData(tasks);
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error(e);
    }
}
 
Example #5
Source File: Tasks.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static Tasks getTaskList(XMPPConnection con) {
    PrivateDataManager manager = PrivateDataManager.getInstanceFor( con );

    Tasks tasks = null;
    try {
        tasks = (Tasks)manager.getPrivateData("scratchpad", "scratchpad:tasks");
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error(e);
    }

    return tasks;
}
 
Example #6
Source File: PrivateNotes.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void savePrivateNotes(PrivateNotes notes) {
    PrivateDataManager manager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());

    PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());
    try {
        manager.setPrivateData(notes);
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error(e);
    }
}
 
Example #7
Source File: TransportUtils.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void setAutoJoin(DomainBareJid serviceName, boolean autoJoin) {
	if (gatewayPreferences != null) {
		gatewayPreferences.addService(serviceName, autoJoin);
		PrivateDataManager pdm = SparkManager.getSessionManager().getPersonalDataManager();
		try {
			pdm.setPrivateData(gatewayPreferences);
		}
		catch (XMPPException | SmackException | InterruptedException e) {
			Log.error(e);
		}
	} else {
		Log.warning("Cannot set privacy data as gatewayPreferences is NULL");
	}
}
 
Example #8
Source File: UserSettings.java    From Spark with Apache License 2.0 5 votes vote down vote up
private UserSettings() {
    privateDataManager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());
    PrivateDataManager.addPrivateDataProvider("personal_settings", "jive:user:settings", new SettingsDataProvider());

    try {
        settingsData = (SettingsData)privateDataManager.getPrivateData("personal_settings", "jive:user:settings");
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error("Error in User Settings", e);
    }
}
 
Example #9
Source File: SessionManager.java    From xyTalk-pc with GNU Affero General Public License v3.0 4 votes vote down vote up
public PrivateDataManager getPersonalDataManager() {
    return personalDataManager;
}
 
Example #10
Source File: BookmarkManager.java    From Smack with Apache License 2.0 2 votes vote down vote up
/**
 * 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.
 */
private BookmarkManager(XMPPConnection connection) {
    privateDataManager = PrivateDataManager.getInstanceFor(connection);
}
 
Example #11
Source File: SessionManager.java    From Spark with Apache License 2.0 2 votes vote down vote up
/**
 * 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;
}