Commit 0453069d authored by Matt Tucker's avatar Matt Tucker Committed by matt

Pubsub fixes, improved compatability of pubsub database tables: JM-639, JM-640, JM-641.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3763 b35dd754-fafc-0310-a699-88a17e54d16e
parent 051f80f3
-- $Revision: $
-- $Date: $
-- Drop old columns of pubSubNode
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
-- Add new pubsub tables
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
// $Revision: $
// $Date: $
// Drop old columns of pubSubNode
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
// Add new pubsub tables
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
# $Revision: $
# $Date: $
# Drop old columns of pubSubNode
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
# Add new pubsub tables
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(255) NOT NULL,
associationType VARCHAR(20) NOT NULL,
PRIMARY KEY (serviceID, nodeID, jid(70))
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL,
INDEX pubsubNodeGroups_idx (serviceID, nodeID)
);
UPDATE jiveVersion set version=8 where name = 'wildfire';
REM // $Revision: $
REM // $Date: $
REM // Drop old columns of pubSubNode
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
REM // Add new pubsub tables
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR2(100) NOT NULL,
nodeID VARCHAR2(100) NOT NULL,
jid VARCHAR2(1024) NOT NULL,
associationType VARCHAR2(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR2(100) NOT NULL,
nodeID VARCHAR2(100) NOT NULL,
rosterGroup VARCHAR2(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
-- $Revision: $
-- $Date: $
-- Drop old columns of pubSubNode
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
-- Add new pubsub tables
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
/* $Revision: $ */
/* $Date: $ */
/* Drop old columns of pubSubNode */
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
/* Reduce columns size to avoid warnings */
ALTER TABLE pubsubNode ALTER COLUMN creator NVARCHAR(255) NOT NULL;
/* Reduce columns size to avoid warnings */
ALTER TABLE pubsubAffiliation DROP CONSTRAINT pubsubAffil_pk;
ALTER TABLE pubsubAffiliation ALTER COLUMN jid NVARCHAR(250) NOT NULL;
ALTER TABLE pubsubAffiliation ADD CONSTRAINT pubsubAffil_pk PRIMARY KEY (serviceID, nodeID, jid);
/* Add new pubsub tables */
CREATE TABLE pubsubNodeJIDs (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
jid NVARCHAR(250) NOT NULL,
associationType NVARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
rosterGroup NVARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
/* $Revision: $ */
/* $Date: $ */
/* Drop old columns of pubSubNode */
ALTER TABLE pubsubNode DROP COLUMN contacts;
ALTER TABLE pubsubNode DROP COLUMN rosterGroups;
ALTER TABLE pubsubNode DROP COLUMN replyRooms;
ALTER TABLE pubsubNode DROP COLUMN replyTo;
ALTER TABLE pubsubNode DROP COLUMN associationTrusted;
/* Add new pubsub tables */
CREATE TABLE pubsubNodeJIDs (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
jid NVARCHAR(1024) NOT NULL,
associationType NVARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
rosterGroup NVARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
UPDATE jiveVersion set version=8 where name = 'wildfire';
......@@ -224,8 +224,6 @@ CREATE TABLE pubsubNode (
publisherModel VARCHAR(15) NOT NULL,
subscriptionEnabled INTEGER NOT NULL,
configSubscription INTEGER NOT NULL,
contacts VARCHAR(4000) NULL,
rosterGroups VARCHAR(4000) NULL,
accessModel VARCHAR(10) NOT NULL,
payloadType VARCHAR(100) NULL,
bodyXSLT VARCHAR(100) NULL,
......@@ -235,14 +233,26 @@ CREATE TABLE pubsubNode (
language VARCHAR(255) NULL,
name VARCHAR(50) NULL,
replyPolicy VARCHAR(15) NULL,
replyRooms VARCHAR(4000) NULL,
replyTo VARCHAR(1024) NULL,
associationPolicy VARCHAR(15) NULL,
associationTrusted VARCHAR(4000) NULL,
maxLeafNodes INTEGER NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
......
......@@ -223,8 +223,6 @@ CREATE TABLE pubsubNode (
publisherModel VARCHAR(15) NOT NULL,
subscriptionEnabled INTEGER NOT NULL,
configSubscription INTEGER NOT NULL,
contacts VARCHAR(4000) NULL,
rosterGroups VARCHAR(4000) NULL,
accessModel VARCHAR(10) NOT NULL,
payloadType VARCHAR(100) NULL,
bodyXSLT VARCHAR(100) NULL,
......@@ -234,14 +232,26 @@ CREATE TABLE pubsubNode (
language VARCHAR(255) NULL,
name VARCHAR(50) NULL,
replyPolicy VARCHAR(15) NULL,
replyRooms VARCHAR(4000) NULL,
replyTo VARCHAR(1024) NULL,
associationPolicy VARCHAR(15) NULL,
associationTrusted VARCHAR(4000) NULL,
maxLeafNodes INTEGER NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
......
......@@ -211,29 +211,39 @@ CREATE TABLE pubsubNode (
publisherModel VARCHAR(15) NOT NULL,
subscriptionEnabled TINYINT NOT NULL,
configSubscription TINYINT NOT NULL,
contacts VARCHAR(4000) NULL,
rosterGroups VARCHAR(4000) NULL,
accessModel VARCHAR(10) NOT NULL,
payloadType VARCHAR(100) NULL,
bodyXSLT VARCHAR(100) NULL,
dataformXSLT VARCHAR(100) NULL,
creator VARCHAR(1024) NOT NULL,
creator VARCHAR(255) NOT NULL,
description VARCHAR(255) NULL,
language VARCHAR(255) NULL,
name VARCHAR(50) NULL,
replyPolicy VARCHAR(15) NULL,
replyRooms VARCHAR(4000) NULL,
replyTo VARCHAR(1024) NULL,
associationPolicy VARCHAR(15) NULL,
associationTrusted VARCHAR(4000) NULL,
maxLeafNodes INTEGER NULL,
PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(255) NOT NULL,
associationType VARCHAR(20) NOT NULL,
PRIMARY KEY (serviceID, nodeID, jid(70))
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL,
INDEX pubsubNodeGroups_idx (serviceID, nodeID)
);
CREATE TABLE pubsubAffiliation (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
jid VARCHAR(255) NOT NULL,
affiliation VARCHAR(10) NOT NULL,
PRIMARY KEY (serviceID, nodeID, jid(70))
);
......@@ -242,7 +252,7 @@ CREATE TABLE pubsubItem (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
id VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
jid VARCHAR(255) NOT NULL,
creationDate CHAR(15) NOT NULL,
payload TEXT NULL,
PRIMARY KEY (serviceID, nodeID, id)
......@@ -252,15 +262,15 @@ CREATE TABLE pubsubSubscription (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
id VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
owner VARCHAR(1024) NOT NULL,
jid VARCHAR(255) NOT NULL,
owner VARCHAR(255) NOT NULL,
state VARCHAR(15) NOT NULL,
deliver TINYINT NOT NULL,
digest TINYINT NOT NULL,
digest_frequency TINYINT NOT NULL,
expire CHAR(15) NULL,
includeBody TINYINT NOT NULL,
showValues VARCHAR(30) NOT NULL,
showValues VARCHAR(30) NULL,
subscriptionType VARCHAR(10) NOT NULL,
subscriptionDepth TINYINT NOT NULL,
keyword VARCHAR(200) NULL,
......
......@@ -217,8 +217,6 @@ CREATE TABLE pubsubNode (
publisherModel VARCHAR2(15) NOT NULL,
subscriptionEnabled INTEGER NOT NULL,
configSubscription INTEGER NOT NULL,
contacts VARCHAR2(4000) NULL,
rosterGroups VARCHAR2(4000) NULL,
accessModel VARCHAR2(10) NOT NULL,
payloadType VARCHAR2(100) NULL,
bodyXSLT VARCHAR2(100) NULL,
......@@ -228,14 +226,26 @@ CREATE TABLE pubsubNode (
language VARCHAR2(255) NULL,
name VARCHAR2(50) NULL,
replyPolicy VARCHAR2(15) NULL,
replyRooms VARCHAR2(4000) NULL,
replyTo VARCHAR2(1024) NULL,
associationPolicy VARCHAR2(15) NULL,
associationTrusted VARCHAR2(4000) NULL,
maxLeafNodes INTEGER NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR2(100) NOT NULL,
nodeID VARCHAR2(100) NOT NULL,
jid VARCHAR2(1024) NOT NULL,
associationType VARCHAR2(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR2(100) NOT NULL,
nodeID VARCHAR2(100) NOT NULL,
rosterGroup VARCHAR2(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID VARCHAR2(100) NOT NULL,
nodeID VARCHAR2(100) NOT NULL,
......
......@@ -226,8 +226,6 @@ CREATE TABLE pubsubNode (
publisherModel VARCHAR(15) NOT NULL,
subscriptionEnabled INTEGER NOT NULL,
configSubscription INTEGER NOT NULL,
contacts VARCHAR(4000) NULL,
rosterGroups VARCHAR(4000) NULL,
accessModel VARCHAR(10) NOT NULL,
payloadType VARCHAR(100) NULL,
bodyXSLT VARCHAR(100) NULL,
......@@ -237,14 +235,26 @@ CREATE TABLE pubsubNode (
language VARCHAR(255) NULL,
name VARCHAR(50) NULL,
replyPolicy VARCHAR(15) NULL,
replyRooms VARCHAR(4000) NULL,
replyTo VARCHAR(1024) NULL,
associationPolicy VARCHAR(15) NULL,
associationTrusted VARCHAR(4000) NULL,
maxLeafNodes INTEGER NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
jid VARCHAR(1024) NOT NULL,
associationType VARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
rosterGroup VARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID VARCHAR(100) NOT NULL,
nodeID VARCHAR(100) NOT NULL,
......
......@@ -224,29 +224,39 @@ CREATE TABLE pubsubNode (
publisherModel NVARCHAR(15) NOT NULL,
subscriptionEnabled INT NOT NULL,
configSubscription INT NOT NULL,
contacts NVARCHAR(4000) NULL,
rosterGroups NVARCHAR(4000) NULL,
accessModel NVARCHAR(10) NOT NULL,
payloadType NVARCHAR(100) NULL,
bodyXSLT NVARCHAR(100) NULL,
dataformXSLT NVARCHAR(100) NULL,
creator NVARCHAR(1024) NOT NULL,
creator NVARCHAR(255) NOT NULL,
description NVARCHAR(255) NULL,
language NVARCHAR(255) NULL,
name NVARCHAR(50) NULL,
replyPolicy NVARCHAR(15) NULL,
replyRooms NVARCHAR(4000) NULL,
replyTo NVARCHAR(1024) NULL,
associationPolicy NVARCHAR(15) NULL,
associationTrusted NVARCHAR(4000) NULL,
maxLeafNodes INT NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
jid NVARCHAR(250) NOT NULL,
associationType NVARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
rosterGroup NVARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
jid NVARCHAR(1024) NOT NULL,
jid NVARCHAR(250) NOT NULL,
affiliation NVARCHAR(10) NOT NULL,
CONSTRAINT pubsubAffil_pk PRIMARY KEY (serviceID, nodeID, jid)
);
......
......@@ -224,8 +224,6 @@ CREATE TABLE pubsubNode (
publisherModel NVARCHAR(15) NOT NULL,
subscriptionEnabled INT NOT NULL,
configSubscription INT NOT NULL,
contacts NVARCHAR(4000) NULL,
rosterGroups NVARCHAR(4000) NULL,
accessModel NVARCHAR(10) NOT NULL,
payloadType NVARCHAR(100) NULL,
bodyXSLT NVARCHAR(100) NULL,
......@@ -235,14 +233,26 @@ CREATE TABLE pubsubNode (
language NVARCHAR(255) NULL,
name NVARCHAR(50) NULL,
replyPolicy NVARCHAR(15) NULL,
replyRooms NVARCHAR(4000) NULL,
replyTo NVARCHAR(1024) NULL,
associationPolicy NVARCHAR(15) NULL,
associationTrusted NVARCHAR(4000) NULL,
maxLeafNodes INT NULL,
CONSTRAINT pubsubNode_pk PRIMARY KEY (serviceID, nodeID)
);
CREATE TABLE pubsubNodeJIDs (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
jid NVARCHAR(1024) NOT NULL,
associationType NVARCHAR(20) NOT NULL,
CONSTRAINT pubsubJID_pk PRIMARY KEY (serviceID, nodeID, jid)
);
CREATE TABLE pubsubNodeGroups (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
rosterGroup NVARCHAR(100) NOT NULL
);
CREATE INDEX pubsubNodeGroups_idx ON pubsubNodeGroups (serviceID, nodeID);
CREATE TABLE pubsubAffiliation (
serviceID NVARCHAR(100) NOT NULL,
nodeID NVARCHAR(100) NOT NULL,
......
......@@ -41,7 +41,7 @@ public class DbConnectionManager {
/**
* Database schema version.
*/
private static final int DATABASE_VERSION = 7;
private static final int DATABASE_VERSION = 8;
private static ConnectionProvider connectionProvider;
......
......@@ -73,7 +73,7 @@ public class CollectionNode extends Node {
associationTrusted = new ArrayList<JID>();
for (String value : field.getValues()) {
try {
associationTrusted.add(new JID(value));
addAssociationTrusted(new JID(value));
}
catch (Exception e) {
// Do nothing
......@@ -276,7 +276,18 @@ public class CollectionNode extends Node {
* @return the users that are allowed to associate leaf nodes with this collection node.
*/
public Collection<JID> getAssociationTrusted() {
return associationTrusted;
return Collections.unmodifiableCollection(associationTrusted);
}
/**
* Adds a new trusted user that is allowed to associate leaf nodes with this collection node.
* The new user is not going to be added to the database. Instead it is just kept in memory.
*
* @param user the new trusted user that is allowed to associate leaf nodes with this
* collection node.
*/
void addAssociationTrusted(JID user) {
associationTrusted.add(user);
}
/**
......
......@@ -435,7 +435,8 @@ public class LeafNode extends Node {
synchronized (publishedItems) {
if (publishedItems.size() > 1) {
// Remove all items except the last one
toDelete = publishedItems.subList(0, publishedItems.size() - 1);
toDelete = new ArrayList<PublishedItem>(
publishedItems.subList(0, publishedItems.size() - 1));
// Remove items to delete from memory
publishedItems.removeAll(toDelete);
// Update fast look up cache of published items
......
......@@ -562,7 +562,7 @@ public abstract class Node {
// Get the new list of roster group(s) allowed to subscribe and retrieve items
rosterGroupsAllowed = new ArrayList<String>();
for (String value : field.getValues()) {
rosterGroupsAllowed.add(value);
addAllowedRosterGroup(value);
}
}
else if ("pubsub#contact".equals(field.getVariable())) {
......@@ -570,7 +570,7 @@ public abstract class Node {
contacts = new ArrayList<JID>();
for (String value : field.getValues()) {
try {
contacts.add(new JID(value));
addContact(new JID(value));
}
catch (Exception e) {
// Do nothing
......@@ -600,7 +600,7 @@ public abstract class Node {
replyRooms = new ArrayList<JID>();
for (String value : field.getValues()) {
try {
replyRooms.add(new JID(value));
addReplyRoom(new JID(value));
}
catch (Exception e) {
// Do nothing
......@@ -612,7 +612,7 @@ public abstract class Node {
replyTo = new ArrayList<JID>();
for (String value : field.getValues()) {
try {
replyTo.add(new JID(value));
addReplyTo(new JID(value));
}
catch (Exception e) {
// Do nothing
......@@ -1312,15 +1312,34 @@ public abstract class Node {
* @return the roster group(s) allowed to subscribe and retrieve items.
*/
public Collection<String> getRosterGroupsAllowed() {
return rosterGroupsAllowed;
return Collections.unmodifiableCollection(rosterGroupsAllowed);
}
/**
* Adds a new roster group that is allowed to subscribe and retrieve items.
* The new roster group is not going to be added to the database. Instead it is just
* kept in memory.
*
* @param groupName the new roster group that is allowed to subscribe and retrieve items.
*/
void addAllowedRosterGroup(String groupName) {
rosterGroupsAllowed.add(groupName);
}
public Collection<JID> getReplyRooms() {
return replyRooms;
return Collections.unmodifiableCollection(replyRooms);
}
void addReplyRoom(JID roomJID) {
replyRooms.add(roomJID);
}
public Collection<JID> getReplyTo() {
return replyTo;
return Collections.unmodifiableCollection(replyTo);
}
void addReplyTo(JID entity) {
replyTo.add(entity);
}
/**
......@@ -1410,7 +1429,16 @@ public abstract class Node {
* @return the JIDs of those to contact with questions.
*/
public Collection<JID> getContacts() {
return contacts;
return Collections.unmodifiableCollection(contacts);
}
/**
* Adds a new user as a candidate to answer questions about the node.
*
* @param user the JID of the new user.
*/
void addContact(JID user) {
contacts.add(user);
}
/**
......
......@@ -246,6 +246,7 @@ public class PubSubEngine {
// Process ad-hoc command
IQ reply = manager.process(iq);
router.route(reply);
return true;
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment