labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r657582 - in /labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster: ./ persistence/
Date Sun, 18 May 2008 16:39:07 GMT
Author: berndf
Date: Sun May 18 09:39:06 2008
New Revision: 657582

URL: http://svn.apache.org/viewvc?rev=657582&view=rev
Log:
[vysper] first revision of roster classes

Added:
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/Roster.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterGroup.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterItem.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/SubscriptionType.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/MemoryRosterPersistenceManager.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/RosterPersistenceManager.java

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/Roster.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/Roster.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/Roster.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/Roster.java Sun May 18
09:39:06 2008
@@ -0,0 +1,32 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ */
+public class Roster {
+    private final List<RosterItem> items = new ArrayList<RosterItem>();
+    
+    public Iterator<RosterItem> itemsIterator() {
+        return items.iterator();
+    }
+    
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterGroup.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterGroup.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterGroup.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterGroup.java Sun May
18 09:39:06 2008
@@ -0,0 +1,32 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster;
+
+/**
+ */
+public class RosterGroup {
+
+    protected String name;
+
+    public RosterGroup(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterItem.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterItem.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterItem.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterItem.java Sun May
18 09:39:06 2008
@@ -0,0 +1,59 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster;
+
+import org.apache.vysper.xmpp.addressing.Entity;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ */
+public class RosterItem {
+    
+    private Entity jid;
+    private String name;
+    private final List<RosterGroup> groups = new ArrayList<RosterGroup>();
+    private SubscriptionType subscriptionType;
+
+    public RosterItem(Entity jid, SubscriptionType subscriptionType) {
+        this(jid, null, subscriptionType);
+    }
+
+    public RosterItem(Entity jid, String name, SubscriptionType subscriptionType) {
+        this.jid = jid;
+        this.name = name;
+        this.subscriptionType = subscriptionType;
+    }
+
+    public Entity getJid() {
+        return jid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<RosterGroup> getGroups() {
+        return Collections.unmodifiableList(groups);
+    }
+
+    public SubscriptionType getSubscriptionType() {
+        return subscriptionType;
+    }
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/SubscriptionType.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/SubscriptionType.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/SubscriptionType.java
(added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/SubscriptionType.java
Sun May 18 09:39:06 2008
@@ -0,0 +1,39 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster;
+
+/**
+ */
+public enum SubscriptionType {
+
+    BOTH("both"),  
+    FROM("from"),  
+    NONE("none"),  
+    REMOVE("remove"),  
+    TO("to");  
+
+    private final String value;
+
+    SubscriptionType(String value) {
+        this.value = value;
+    }
+
+    public String value() {
+        return value;
+    }
+
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/MemoryRosterPersistenceManager.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/MemoryRosterPersistenceManager.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/MemoryRosterPersistenceManager.java
(added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/MemoryRosterPersistenceManager.java
Sun May 18 09:39:06 2008
@@ -0,0 +1,43 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster.persistence;
+
+import org.apache.vysper.xmpp.addressing.Entity;
+import org.apache.vysper.xmpp.modules.roster.Roster;
+import org.apache.vysper.xmpp.modules.roster.RosterItem;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * manages rosters in memory (and if the application ends, they are lost)
+ */
+public class MemoryRosterPersistenceManager implements RosterPersistenceManager {
+
+    private Map<Entity, Roster> rosterMap = new HashMap<Entity, Roster>();
+    
+
+    public Roster retrieve(Entity jid) {
+        if (!rosterMap.containsKey(jid)) rosterMap.put(jid, new Roster());
+        return rosterMap.get(jid);
+    }
+
+    public void addContact(Entity jid, RosterItem rosterItem) {
+        throw new RuntimeException("not yet implemented");
+    }
+
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/RosterPersistenceManager.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/RosterPersistenceManager.java?rev=657582&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/RosterPersistenceManager.java
(added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/persistence/RosterPersistenceManager.java
Sun May 18 09:39:06 2008
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2006-2007 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.modules.roster.persistence;
+
+import org.apache.vysper.xmpp.modules.roster.Roster;
+import org.apache.vysper.xmpp.modules.roster.RosterItem;
+import org.apache.vysper.xmpp.addressing.Entity;
+
+/**
+ */
+public interface RosterPersistenceManager {
+    Roster retrieve(Entity jid);
+
+    void addContact(Entity jid, RosterItem rosterItem);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message