From 5a57e2390aa2fd60d34b1fe702733ca2cc05181c Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Sun, 7 Jan 2007 23:03:16 +0000 Subject: [PATCH] Javadoc fixes, builds now go to target directory. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6616 b35dd754-fafc-0310-a699-88a17e54d16e --- build/build.xml | 8 +-- build/projects/Smack.iml | 2 +- build/release.xml | 8 +-- .../org/jivesoftware/smack/PacketReader.java | 2 +- .../smack/PrivacyListListener.java | 21 ++++++- .../smack/PrivacyListManager.java | 48 +++++++++++++--- source/org/jivesoftware/smack/Roster.java | 6 +- .../org/jivesoftware/smack/RosterEntry.java | 2 +- .../jivesoftware/smack/XMPPConnection.java | 2 +- .../jivesoftware/smack/packet/Privacy.java | 57 ++++++++++++------- .../smack/packet/RosterPacket.java | 55 ++---------------- .../smack/provider/PrivacyProvider.java | 2 +- 12 files changed, 119 insertions(+), 94 deletions(-) diff --git a/build/build.xml b/build/build.xml index 37c1e1886..0074984c5 100644 --- a/build/build.xml +++ b/build/build.xml @@ -32,10 +32,10 @@ - - - - + + + + diff --git a/build/projects/Smack.iml b/build/projects/Smack.iml index 7496ded77..cd2b163b3 100644 --- a/build/projects/Smack.iml +++ b/build/projects/Smack.iml @@ -9,7 +9,7 @@ - + diff --git a/build/release.xml b/build/release.xml index 53005e411..b118ea097 100644 --- a/build/release.xml +++ b/build/release.xml @@ -42,8 +42,8 @@ - - + + @@ -71,10 +71,10 @@ - + - + diff --git a/source/org/jivesoftware/smack/PacketReader.java b/source/org/jivesoftware/smack/PacketReader.java index cf190755a..8b90913ed 100644 --- a/source/org/jivesoftware/smack/PacketReader.java +++ b/source/org/jivesoftware/smack/PacketReader.java @@ -706,7 +706,7 @@ class PacketReader { item.setItemStatus(status); // Set type. String subscription = parser.getAttributeValue("", "subscription"); - RosterPacket.ItemType type = RosterPacket.ItemType.fromString(subscription); + RosterPacket.ItemType type = RosterPacket.ItemType.valueOf(subscription); item.setItemType(type); } if (parser.getName().equals("group") && item!= null) { diff --git a/source/org/jivesoftware/smack/PrivacyListListener.java b/source/org/jivesoftware/smack/PrivacyListListener.java index 1700c3777..5644ed7e2 100644 --- a/source/org/jivesoftware/smack/PrivacyListListener.java +++ b/source/org/jivesoftware/smack/PrivacyListListener.java @@ -1,3 +1,22 @@ +/** + * $Revision$ + * $Date$ + * + * Copyright 2006-2007 Jive Software. + * + * 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.jivesoftware.smack; import org.jivesoftware.smack.packet.PrivacyItem; @@ -8,7 +27,7 @@ import java.util.List; * Interface to implement classes to listen for server events about privacy communication. * Listeners are registered with the {@link PrivacyListManager}. * - * @see {@link PrivacyListManager#addListener} + * @see PrivacyListManager#addListener * * @author Francisco Vives */ diff --git a/source/org/jivesoftware/smack/PrivacyListManager.java b/source/org/jivesoftware/smack/PrivacyListManager.java index f0c5678e9..2bde9b1f7 100644 --- a/source/org/jivesoftware/smack/PrivacyListManager.java +++ b/source/org/jivesoftware/smack/PrivacyListManager.java @@ -1,3 +1,22 @@ +/** + * $Revision$ + * $Date$ + * + * Copyright 2006-2007 Jive Software. + * + * 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.jivesoftware.smack; import org.jivesoftware.smack.filter.*; @@ -224,6 +243,7 @@ public class PrivacyListManager { * Answer a privacy containing the list structre without {@link PrivacyItem}. * * @return a Privacy with the list names. + * @throws XMPPException if an error occurs. */ private Privacy getPrivacyWithListNames() throws XMPPException { @@ -237,7 +257,8 @@ public class PrivacyListManager { /** * Answer the active privacy list. * - * @return the {@see PrivacyList} of the active list. + * @return the privacy list of the active list. + * @throws XMPPException if an error occurs. */ public PrivacyList getActiveList() throws XMPPException { Privacy privacyAnswer = this.getPrivacyWithListNames(); @@ -252,7 +273,8 @@ public class PrivacyListManager { /** * Answer the default privacy list. * - * @return the {@see PrivacyList} of the default list. + * @return the privacy list of the default list. + * @throws XMPPException if an error occurs. */ public PrivacyList getDefaultList() throws XMPPException { Privacy privacyAnswer = this.getPrivacyWithListNames(); @@ -268,7 +290,8 @@ public class PrivacyListManager { * Answer the privacy list items under listName with the allowed and blocked permissions. * * @param listName the name of the list to get the allowed and blocked permissions. - * @return a list of {@link PrivacyItem} under the list listName. + * @return a list of privacy items under the list listName. + * @throws XMPPException if an error occurs. */ private List getPrivacyListItems(String listName) throws XMPPException { @@ -286,7 +309,8 @@ public class PrivacyListManager { * Answer the privacy list items under listName with the allowed and blocked permissions. * * @param listName the name of the list to get the allowed and blocked permissions. - * @return a {@link PrivacyList} under the list listName. + * @return a privacy list under the list listName. + * @throws XMPPException if an error occurs. */ public PrivacyList getPrivacyList(String listName) throws XMPPException { @@ -296,7 +320,8 @@ public class PrivacyListManager { /** * Answer every privacy list with the allowed and blocked permissions. * - * @return a List of {@link PrivacyList}. + * @return an array of privacy lists. + * @throws XMPPException if an error occurs. */ public PrivacyList[] getPrivacyLists() throws XMPPException { Privacy privacyAnswer = this.getPrivacyWithListNames(); @@ -334,6 +359,8 @@ public class PrivacyListManager { /** * Client declines the use of active lists. + * + * @throws XMPPException if an error occurs. */ public void declineActiveList() throws XMPPException { @@ -363,6 +390,8 @@ public class PrivacyListManager { /** * Client declines the use of default lists. + * + * @throws XMPPException if an error occurs. */ public void declineDefaultList() throws XMPPException { @@ -378,7 +407,8 @@ public class PrivacyListManager { * The client has created a new list. It send the new one to the server. * * @param listName the list that has changed its content. - * @param privacyItems a List with every {@link PrivacyItem} in the list. + * @param privacyItems a List with every privacy item in the list. + * @throws XMPPException if an error occurs. */ public void createPrivacyList(String listName, List privacyItems) throws XMPPException { @@ -387,11 +417,12 @@ public class PrivacyListManager { /** * The client has edited an existing list. It updates the server content with the resulting - * list of {@link PrivacyItem}. The {@link PrivacyItem} list MUST contain all elements in the + * list of privacy items. The {@link PrivacyItem} list MUST contain all elements in the * list (not the "delta"). * * @param listName the list that has changed its content. - * @param privacyItems a List with every {@link PrivacyItem} in the list. + * @param privacyItems a List with every privacy item in the list. + * @throws XMPPException if an error occurs. */ public void updatePrivacyList(String listName, List privacyItems) throws XMPPException { @@ -407,6 +438,7 @@ public class PrivacyListManager { * Remove a privacy list. * * @param listName the list that has changed its content. + * @throws XMPPException if an error occurs. */ public void deletePrivacyList(String listName) throws XMPPException { diff --git a/source/org/jivesoftware/smack/Roster.java b/source/org/jivesoftware/smack/Roster.java index 3ac08e29e..6b2fc3567 100644 --- a/source/org/jivesoftware/smack/Roster.java +++ b/source/org/jivesoftware/smack/Roster.java @@ -256,7 +256,7 @@ public class Roster implements ConnectionListener { packet.setType(IQ.Type.SET); RosterPacket.Item item = RosterEntry.toRosterItem(entry); // Set the item type as REMOVE so that the server will delete the entry - item.setItemType(RosterPacket.ItemType.REMOVE); + item.setItemType(RosterPacket.ItemType.remove); packet.addRosterItem(item); PacketCollector collector = connection.createPacketCollector( new PacketIDFilter(packet.getPacketID())); @@ -669,7 +669,7 @@ public class Roster implements ConnectionListener { item.getItemType(), item.getItemStatus(), connection); // If the packet is of the type REMOVE then remove the entry - if (RosterPacket.ItemType.REMOVE.equals(item.getItemType())) { + if (RosterPacket.ItemType.remove.equals(item.getItemType())) { // Remove the entry from the entry list. if (entries.contains(entry)) { entries.remove(entry); @@ -721,7 +721,7 @@ public class Roster implements ConnectionListener { } // If the packet is not of the type REMOVE then add the entry to the groups - if (!RosterPacket.ItemType.REMOVE.equals(item.getItemType())) { + if (!RosterPacket.ItemType.remove.equals(item.getItemType())) { // Create the new list of groups the user belongs to. List newGroupNames = new ArrayList(); for (String groupName : item.getGroupNames()) { diff --git a/source/org/jivesoftware/smack/RosterEntry.java b/source/org/jivesoftware/smack/RosterEntry.java index bb60bc261..e2933e42f 100644 --- a/source/org/jivesoftware/smack/RosterEntry.java +++ b/source/org/jivesoftware/smack/RosterEntry.java @@ -124,7 +124,7 @@ public class RosterEntry { /** * Returns the roster subscription type of the entry. When the type is - * {@link RosterPacket.ItemType#NONE} or {@link RosterPacket.ItemType#FROM}, + * {@link RosterPacket.ItemType#none} or {@link RosterPacket.ItemType#from}, * refer to {@link RosterEntry getStatus()} to see if a subscription request * is pending. * diff --git a/source/org/jivesoftware/smack/XMPPConnection.java b/source/org/jivesoftware/smack/XMPPConnection.java index 11458edb7..81c5514ab 100644 --- a/source/org/jivesoftware/smack/XMPPConnection.java +++ b/source/org/jivesoftware/smack/XMPPConnection.java @@ -543,7 +543,7 @@ public class XMPPConnection { * Closes the connection by setting presence to unavailable then closing the stream to * the XMPP server. The shutdown logic will be used during a planned disconnection or when * dealing with an unexpected disconnection. Unlike {@link #disconnect()} the connection's - * {@link PacketReader}, {@link PacketWriter} and {@link Roster} will not be removed thus + * packet reader, packet writer, and {@link Roster} will not be removed; thus * connection's state is kept. */ protected void shutdown() { diff --git a/source/org/jivesoftware/smack/packet/Privacy.java b/source/org/jivesoftware/smack/packet/Privacy.java index 7550deaaf..ce9019401 100644 --- a/source/org/jivesoftware/smack/packet/Privacy.java +++ b/source/org/jivesoftware/smack/packet/Privacy.java @@ -1,12 +1,32 @@ +/** + * $Revision$ + * $Date$ + * + * Copyright 2006-2007 Jive Software. + * + * 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.jivesoftware.smack.packet; import java.util.*; /** - * A Privacy IQ Packet, is used by the {@see PrivacyListManager} and {@see PrivacyProvider} to allow - * and block communications from other users. It contains the appropriate structure to suit - * user-defined privacy lists. Different configured Privacy packages are used in the Server – - * Manager communication in order to: + * A Privacy IQ Packet, is used by the {@link org.jivesoftware.smack.PrivacyListManager} + * and {@link org.jivesoftware.smack.provider.PrivacyProvider} to allow and block + * communications from other users. It contains the appropriate structure to suit + * user-defined privacy lists. Different configured Privacy packages are used in the + * Server – Manager communication in order to: *
    *
  • Retrieving one's privacy lists. *
  • Adding, removing, and editing one's privacy lists. @@ -14,11 +34,10 @@ import java.util.*; *
  • Setting, changing, or declining the default list (i.e., the list that is active by default). *
* Privacy Items can handle different kind of blocking communications based on JID, group, - * subscription type or globally {@see PrivacyItem} + * subscription type or globally {@link PrivacyItem} * * @author Francisco Vives */ - public class Privacy extends IQ { /** declineActiveList is true when the user declines the use of the active list **/ private boolean declineActiveList=false; @@ -33,7 +52,7 @@ public class Privacy extends IQ { private Map> itemLists = new HashMap>(); /** - * Set or update a privacy list with {@link PrivacyItem}. + * Set or update a privacy list with privacy items. * * @param listName the name of the new privacy list. * @param listItem the {@link PrivacyItem} that rules the list. @@ -113,6 +132,7 @@ public class Privacy extends IQ { /** * Returns the privacy item in the specified order. * + * @param listName the name of the privacy list. * @param order the order of the element. * @return a List with {@link PrivacyItem} */ @@ -128,7 +148,6 @@ public class Privacy extends IQ { return itemFound; } - /** * Sets a given privacy list as the new user default list. * @@ -143,21 +162,19 @@ public class Privacy extends IQ { return false; } } - - - /** - * Remove the list. - * - * @param listName name of the list to remove. - */ + + /** + * Remove the list. + * + * @param listName name of the list to remove. + */ public void deleteList(String listName) { this.getItemLists().remove(listName); } - - + /** * Returns the name associated with the active list set for the session. Communications - * will be verified against the active list.

+ * will be verified against the active list. * * @return the name of the active list. */ @@ -167,7 +184,7 @@ public class Privacy extends IQ { /** * Sets the name associated with the active list set for the session. Communications - * will be verified against the active list.

+ * will be verified against the active list. * * @param activeName is the name of the active list. */ @@ -303,4 +320,4 @@ public class Privacy extends IQ { return buf.toString(); } -} +} \ No newline at end of file diff --git a/source/org/jivesoftware/smack/packet/RosterPacket.java b/source/org/jivesoftware/smack/packet/RosterPacket.java index fff1c9946..b15289ee7 100644 --- a/source/org/jivesoftware/smack/packet/RosterPacket.java +++ b/source/org/jivesoftware/smack/packet/RosterPacket.java @@ -265,74 +265,31 @@ public class RosterPacket extends IQ { } } - /** - * The subscription type of a roster item. - */ - public static class ItemType { + public static enum ItemType { /** * The user and subscriber have no interest in each other's presence. */ - public static final ItemType NONE = new ItemType("none"); + none, /** * The user is interested in receiving presence updates from the subscriber. */ - public static final ItemType TO = new ItemType("to"); + to, /** * The subscriber is interested in receiving presence updates from the user. */ - public static final ItemType FROM = new ItemType("from"); + from, /** * The user and subscriber have a mutual interest in each other's presence. */ - public static final ItemType BOTH = new ItemType("both"); + both, /** * The user wishes to stop receiving presence updates from the subscriber. */ - public static final ItemType REMOVE = new ItemType("remove"); - - public static ItemType fromString(String value) { - if (value == null) { - return null; - } - value = value.toLowerCase(); - if ("none".equals(value)) { - return NONE; - } - else if ("to".equals(value)) { - return TO; - } - else if ("from".equals(value)) { - return FROM; - } - else if ("both".equals(value)) { - return BOTH; - } - else if ("remove".equals(value)) { - return REMOVE; - } - else { - return null; - } - } - - private String value; - - /** - * Returns the item type associated with the specified string. - * - * @param value the item type. - */ - public ItemType(String value) { - this.value = value; - } - - public String toString() { - return value; - } + remove } } \ No newline at end of file diff --git a/source/org/jivesoftware/smack/provider/PrivacyProvider.java b/source/org/jivesoftware/smack/provider/PrivacyProvider.java index b8e8be4be..a99539959 100644 --- a/source/org/jivesoftware/smack/provider/PrivacyProvider.java +++ b/source/org/jivesoftware/smack/provider/PrivacyProvider.java @@ -12,7 +12,7 @@ import java.util.ArrayList; * The PrivacyProvider parses {@link Privacy} packets. {@link Privacy} * Parses the query sub-document and creates an instance of {@link Privacy}. * For each item in the list element, it creates an instance - * of {@link PrivacyItem} and {@link PrivacyRule}. + * of {@link PrivacyItem} and {@link org.jivesoftware.smack.packet.PrivacyItem.PrivacyRule}. * * @author Francisco Vives */