diff --git a/build/README.html b/build/README.html index 0f3256316..88f0eafde 100644 --- a/build/README.html +++ b/build/README.html @@ -14,53 +14,19 @@ A:hover { text-decoration : none; } - .pageheader { - font-family : arial, helvetica, sans-serif; - font-size : 14pt; - font-weight: bold; - } - .header { - font-family : arial, helvetica, sans-serif; - font-size : 12pt; - font-weight: bold; - } - .subheader { - font-weight: bold; - color: #600; - } - .path { - color : #3333cc; - } - .question { - font-style : italic; - } - .answer { - padding-left : 15px; - } - .code { - font-family : courier new; - border : 1px #ccc solid; - padding : 6px; - margin : 5px 20px 5px 20px; - } TT { - font-family : courier new; + font-family : courier new, monospace; font-weight : bold; color : #060; } PRE, CODE { - font-family : courier new; + font-family : courier new, monospace; font-size : 100%; } - .footer { - font-size : 0.8em; - color : #666; - text-align : center; - } - + Smack Source Distribution
@@ -107,7 +73,7 @@ possible, instructions are provided for both Unix/Linux and Windows users. corresponding file for your shell).
  • Set the JAVA_HOME environment variable by adding the following line to the file: -

    +

    export JAVA_HOME=/usr/local/jdk1.5

    @@ -119,9 +85,10 @@ possible, instructions are provided for both Unix/Linux and Windows users. source .profile

    - The JAVA_HOME variable should now be configured correctly. + The JAVA_HOME variable should now be configured correctly. -

    +

  • +

  • Windows
    1. Navigate to your desktop and right click on "My Computer"; @@ -151,20 +118,20 @@ the setup instructions for your operating system.
        Navigate into the subdirectory of this distribution named "build" via the command-line.

        -
        +
        Linux/Unix users only:You must make the ant script executable. From the build directory, type:

        chmod u+x ant - +

        Now, invoke the build tool to compile the Smack source code

        -Windows: ant
        + Windows: ant
        Unix/Linux: ./ant @@ -172,7 +139,7 @@ Unix/Linux: ./ant If the build tool is invoked correctly and Smack compiles, you've correctly configured your copy of the Smack developer distribution. - +

        Finished!

        @@ -215,9 +182,9 @@ for each task are enclosed with braces.

          Syntax:

          - + ant
          -
          +

          Description:

          @@ -231,9 +198,9 @@ Equivalent of calling "ant jar".
            Syntax:

            - + ant compile
            -
            +

            Description:

            @@ -249,9 +216,9 @@ The build directory is the "target/classes" directory under your Smack source di
              Syntax:

              - + ant jar
              -
              +

              Description:

              @@ -267,9 +234,9 @@ into the classpath of an application server.
                Syntax:

                - + ant javadoc
                -
                +

                Description:

                @@ -283,9 +250,9 @@ JavaDocs all Smack source code in the source directory.
                  Syntax:

                  - + ant clean
                  -
                  +

                  Description:

                  @@ -296,4 +263,4 @@ smack.jar file and Javadoc files.

                - + \ No newline at end of file diff --git a/build/projects/Smack.iml b/build/projects/Smack.iml index ed746d8a8..4e92d06eb 100644 --- a/build/projects/Smack.iml +++ b/build/projects/Smack.iml @@ -1,6 +1,34 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -59,6 +87,15 @@ + + + + + + + + + diff --git a/build/projects/Smack.ipr b/build/projects/Smack.ipr index 51eb13f8f..55f7e8c5c 100644 --- a/build/projects/Smack.ipr +++ b/build/projects/Smack.ipr @@ -1,5 +1,5 @@ - + @@ -30,6 +30,15 @@ - - + + - + - + @@ -303,10 +301,13 @@ + + + @@ -330,8 +333,14 @@ - - + + + + + + + - diff --git a/build/projects/SmackUnitTest.iml b/build/projects/SmackUnitTest.iml index 195964750..8ceaa4a3f 100644 --- a/build/projects/SmackUnitTest.iml +++ b/build/projects/SmackUnitTest.iml @@ -1,6 +1,5 @@ - - + diff --git a/build/resources/releasedocs/README.html b/build/resources/releasedocs/README.html index 7d86134c0..de92dbc8f 100644 --- a/build/resources/releasedocs/README.html +++ b/build/resources/releasedocs/README.html @@ -42,9 +42,6 @@ pre, tt, code { #pageBody { margin: 0 18px 0 20px; } - - - /* anchors */ a:link { color: #11568c; @@ -59,9 +56,6 @@ a:hover { a:active { color: #7a1d42; } - - - /* page header elements (logo and navigation) */ .navigation { display: block; @@ -84,9 +78,6 @@ a:active { .navigation a:visited { color: #ffffff; } .navigation a:hover { color: #ffffff; } .navigation a:active { color: #ffffff; } - - - /* headings */ h1 { display: block; diff --git a/build/resources/releasedocs/changelog.html b/build/resources/releasedocs/changelog.html index 3d44e4f33..cde3f7f0f 100644 --- a/build/resources/releasedocs/changelog.html +++ b/build/resources/releasedocs/changelog.html @@ -8,15 +8,15 @@ body { font-size : 100%; background-color : #d3d6d9; - padding: 0px; - margin: 0px 0px 30px 0px; + padding: 0; + margin: 0 0 30px 0; } body, td, th { font-family : arial, helvetica, sans-serif; font-size : 10pt; } pre, tt, code { - font-family : courier new, monospaced; + font-family : courier new, monospace; font-size : 9pt; } #pageContainer { @@ -36,15 +36,12 @@ pre, tt, code { background-color: #e7eaee; border: 1px solid #cccccc; border-bottom: none; - -moz-border-radius: 5px 5px 0px 0px; - margin: 10px 0px 0px 0px; + -moz-border-radius: 5px 5px 0 0; + margin: 10px 0 0 0; } #pageBody { - margin: 0px 18px 0px 20px; + margin: 0 18px 0 20px; } - - - /* anchors */ a:link { color: #11568c; @@ -59,9 +56,6 @@ a:hover { a:active { color: #7a1d42; } - - - /* page header elements (logo and navigation) */ .navigation { display: block; @@ -73,20 +67,17 @@ a:active { color: #ffffff; font-size: 11px; line-height: 18px; - padding: 0px 0px 0px 0px; - margin: 0px 0px 25px 0px; + padding: 0 0 0 0; + margin: 0 0 25px 0; overflow: hidden; } .navigation a { - margin: 0px 20px 0px 20px; + margin: 0 20px 0 20px; } .navigation a:link { color: #ffffff; } .navigation a:visited { color: #ffffff; } .navigation a:hover { color: #ffffff; } .navigation a:active { color: #ffffff; } - - - /* headings */ h1 { display: block; @@ -94,37 +85,37 @@ h1 { font-size : 1.7em; font-weight : bold; color: #670e15; - padding: 0px; - margin: 30px 0px 0px 20px; + padding: 0; + margin: 30px 0 0 20px; } h2 { font-size : 1.3em; font-weight : bold; - margin: 40px 0px 6px 0px; - padding: 0px; + margin: 40px 0 6px 0; + padding: 0; color: #335588; } h3 { font-size : 1.0em; font-weight : bold; - margin: 25px 0px 3px 0px; - padding: 0px; + margin: 25px 0 3px 0; + padding: 0; color: #334466; } /* general elements */ p { - margin: 0px 0px 15px 0px; + margin: 0 0 15px 0; } ul { - margin: 5px 0px 15px 15px; + margin: 5px 0 15px 15px; } li { padding-bottom : 4px; } tt { - font-family : courier new; + font-family : courier new, monospace; font-weight : bold; color : #060; } @@ -133,16 +124,7 @@ hr { height: 1px; background-color: #999999; border: none; - margin: 40px 0px 20px 0px; -} - -.footer { - font-size : 8pt; - color : #666; - text-align : center; - margin-top : 2em; - padding-top : 0.5em; - border-top : 1px #CCC solid; + margin: 40px 0 20px 0; } @@ -343,7 +325,7 @@ hr {
              diff --git a/documentation/debugging.html b/documentation/debugging.html index b5e6e4bbe..5d12acba4 100644 --- a/documentation/debugging.html +++ b/documentation/debugging.html @@ -109,7 +109,7 @@ to the system clipboard or to clear the contents of the pane.


              diff --git a/documentation/gettingstarted.html b/documentation/gettingstarted.html index 6e29bf08c..b797e9487 100644 --- a/documentation/gettingstarted.html +++ b/documentation/gettingstarted.html @@ -115,7 +115,7 @@ XMPPConnection instance.

              diff --git a/documentation/index.html b/documentation/index.html index 4fba6b56c..34b67f810 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -28,7 +28,7 @@
            diff --git a/documentation/messaging.html b/documentation/messaging.html index ddc2063a9..99ea0698a 100644 --- a/documentation/messaging.html +++ b/documentation/messaging.html @@ -87,7 +87,7 @@ newChat.sendMessage(newMessage);


            diff --git a/documentation/overview.html b/documentation/overview.html index ac33e9ad9..27f66d723 100644 --- a/documentation/overview.html +++ b/documentation/overview.html @@ -72,7 +72,7 @@ use that as a reference while reading through this documentation.


            diff --git a/documentation/privacy.html b/documentation/privacy.html index 0d6d2335e..9e0f76d35 100644 --- a/documentation/privacy.html +++ b/documentation/privacy.html @@ -160,7 +160,7 @@ The listener becomes notified after performing:


            diff --git a/documentation/processing.html b/documentation/processing.html index 671255b2f..918791605 100644 --- a/documentation/processing.html +++ b/documentation/processing.html @@ -80,7 +80,7 @@ to the PacketFilter interface. The default set of filters includes:


            diff --git a/documentation/properties.html b/documentation/properties.html index 8da6038bb..04095a8a1 100644 --- a/documentation/properties.html +++ b/documentation/properties.html @@ -1,7 +1,7 @@ Smack: Packet Properties - Jive Software - @@ -32,9 +32,9 @@ demonstrates how to set properties:
             Message message = chat.createMessage();
            -// Add a Color object as a property.
            +// Add a Color object as a property.
             message.setProperty("favoriteColor", new Color(0, 0, 255));
            -// Add an int as a property.
            +// Add an int as a property.
             message.setProperty("favoriteNumber", 4);
             chat.sendMessage(message);
             
            @@ -45,9 +45,9 @@ Getting those same properties would use the following code:
             Message message = chat.nextMessage();
            -// Get a Color object property.
            +// Get a Color object property.
             Color favoriteColor = (Color)message.getProperty("favoriteColor");
            -// Get an int property. Note that properties are always returned as
            +// Get an int property. Note that properties are always returned as
             // Objects, so we must cast the value to an Integer, then convert
             // it to an int.
             int favoriteNumber = ((Integer)message.getProperty("favoriteNumber")).intValue();
            @@ -112,7 +112,7 @@ The currently supported types are: integer, long, float
             
             
             
             
            diff --git a/documentation/providers.html b/documentation/providers.html
            index fb7e5e586..229df7f8b 100644
            --- a/documentation/providers.html
            +++ b/documentation/providers.html
            @@ -114,7 +114,7 @@ sub-packet in DefaultPacketExtension object and then attach it to the packet.
             


            diff --git a/documentation/roster.html b/documentation/roster.html index bd27a0a0d..e75a38b7b 100644 --- a/documentation/roster.html +++ b/documentation/roster.html @@ -116,7 +116,7 @@ should be registered that listens for Presence packets that have a type of


            diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java index ac30ffb5a..d2101a5d7 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java @@ -1045,7 +1045,7 @@ public class JingleManagerTest extends SmackTestCase { } public String getChildElementXML() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(s); return buf.toString(); } diff --git a/jingle/extension/test/org/jivesoftware/smackx/provider/JingleProviderTest.java b/jingle/extension/test/org/jivesoftware/smackx/provider/JingleProviderTest.java index 64a7267dc..bce314a19 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/provider/JingleProviderTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/provider/JingleProviderTest.java @@ -98,7 +98,7 @@ public class JingleProviderTest extends SmackTestCase { } public String getChildElementXML() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(s); return buf.toString(); } diff --git a/source/org/jivesoftware/smack/packet/Privacy.java b/source/org/jivesoftware/smack/packet/Privacy.java index e3c97b9b4..57162cb13 100644 --- a/source/org/jivesoftware/smack/packet/Privacy.java +++ b/source/org/jivesoftware/smack/packet/Privacy.java @@ -274,7 +274,7 @@ public class Privacy extends IQ { } public String getChildElementXML() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(""); // Add the active tag diff --git a/source/org/jivesoftware/smack/packet/PrivacyItem.java b/source/org/jivesoftware/smack/packet/PrivacyItem.java index 3f35c03b4..57767082e 100644 --- a/source/org/jivesoftware/smack/packet/PrivacyItem.java +++ b/source/org/jivesoftware/smack/packet/PrivacyItem.java @@ -251,7 +251,7 @@ public class PrivacyItem { * @return the text xml representation. */ public String toXML() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(""); stanza.append(""); @@ -59,7 +59,7 @@ public class SASLAnonymous extends SASLMechanism { public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text - StringBuffer stanza = new StringBuffer(); + StringBuilder stanza = new StringBuilder(); stanza.append(""); stanza.append("="); stanza.append(""); diff --git a/source/org/jivesoftware/smack/sasl/SASLMechanism.java b/source/org/jivesoftware/smack/sasl/SASLMechanism.java index 6704a4682..b41c23b1f 100644 --- a/source/org/jivesoftware/smack/sasl/SASLMechanism.java +++ b/source/org/jivesoftware/smack/sasl/SASLMechanism.java @@ -110,7 +110,7 @@ public abstract class SASLMechanism implements CallbackHandler { } protected void authenticate() throws IOException, XMPPException { - StringBuffer stanza = new StringBuffer(); + StringBuilder stanza = new StringBuilder(); stanza.append(""); try { @@ -140,7 +140,7 @@ public abstract class SASLMechanism implements CallbackHandler { */ public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text - StringBuffer stanza = new StringBuffer(); + StringBuilder stanza = new StringBuilder(); byte response[]; if(challenge != null) { diff --git a/source/org/jivesoftware/smack/util/collections/AbstractHashedMap.java b/source/org/jivesoftware/smack/util/collections/AbstractHashedMap.java index 85740f3fc..f6fb34aa4 100644 --- a/source/org/jivesoftware/smack/util/collections/AbstractHashedMap.java +++ b/source/org/jivesoftware/smack/util/collections/AbstractHashedMap.java @@ -1071,7 +1071,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab } public String toString() { - return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); + return new StringBuilder().append(getKey()).append('=').append(getValue()).toString(); } } @@ -1316,7 +1316,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab if (size() == 0) { return "{}"; } - StringBuffer buf = new StringBuffer(32 * size()); + StringBuilder buf = new StringBuilder(32 * size()); buf.append('{'); MapIterator it = mapIterator(); diff --git a/source/org/jivesoftware/smack/util/collections/AbstractKeyValue.java b/source/org/jivesoftware/smack/util/collections/AbstractKeyValue.java index d06452af6..decc342b9 100644 --- a/source/org/jivesoftware/smack/util/collections/AbstractKeyValue.java +++ b/source/org/jivesoftware/smack/util/collections/AbstractKeyValue.java @@ -74,7 +74,7 @@ public abstract class AbstractKeyValue implements KeyValue { * @return a String view of the entry */ public String toString() { - return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); + return new StringBuilder().append(getKey()).append('=').append(getValue()).toString(); } } diff --git a/source/org/jivesoftware/smackx/commands/AdHocCommand.java b/source/org/jivesoftware/smackx/commands/AdHocCommand.java index d1827b9e8..9c082a2ba 100755 --- a/source/org/jivesoftware/smackx/commands/AdHocCommand.java +++ b/source/org/jivesoftware/smackx/commands/AdHocCommand.java @@ -69,11 +69,11 @@ import java.util.List; * */ public abstract class AdHocCommand { - // TODO Analize the redesign of command by having an ExecutionResponse as a - // result to the execution of every action. That result should have all the - // information related to the execution, e.g. the form to fill. Maybe this - // design is more intuitive and simpler than the current one that has all in - // one class. + // TODO: Analize the redesign of command by having an ExecutionResponse as a + // TODO: result to the execution of every action. That result should have all the + // TODO: information related to the execution, e.g. the form to fill. Maybe this + // TODO: design is more intuitive and simpler than the current one that has all in + // TODO: one class. private AdHocCommandData data; @@ -83,17 +83,15 @@ public abstract class AdHocCommand { } /** - * Returns the specific condition of the error or null if the + * Returns the specific condition of the error or null if the * error doesn't have any. * - * @param error - * the error the get the specific condition from + * @param error the error the get the specific condition from. * @return the specific condition of this error, or null if it doesn't have * any. */ - public static SpecificErrorCondition getSpecificErrorConditionFrom( - XMPPError error) { - // This method is implemented to provied an easy way of getting a packet + public static SpecificErrorCondition getSpecificErrorCondition(XMPPError error) { + // This method is implemented to provide an easy way of getting a packet // extension of the XMPPError. for (SpecificErrorCondition condition : SpecificErrorCondition.values()) { if (error.getExtension(condition.toString(), @@ -127,8 +125,7 @@ public abstract class AdHocCommand { * Sets the unique identifier of the command. This value must be unique for * the OwnerJID. * - * @param node - * the unique identifier of the command + * @param node the unique identifier of the command. */ public void setNode(String node) { data.setNode(node); @@ -138,14 +135,14 @@ public abstract class AdHocCommand { * Returns the unique identifier of the command. It is unique for the * OwnerJID. * - * @return the unique identifier of the command + * @return the unique identifier of the command. */ public String getNode() { return data.getNode(); } /** - * Gets the full JID of the owner of this command. This JID is the "to" of a + * Returns the full JID of the owner of this command. This JID is the "to" of a * execution request. * * @return the owner JID. @@ -164,7 +161,7 @@ public abstract class AdHocCommand { /** * Adds a note to the current stage. This should be used when setting a * response to the execution of an action. All the notes added here are - * returned by the getNotes method during the current stage. + * returned by the {@link #getNotes} method during the current stage. * Once the stage changes all the notes are discarded. * * @param note the note. @@ -186,7 +183,8 @@ public abstract class AdHocCommand { public Form getForm() { if (data.getForm() == null) { return null; - } else { + } + else { return new Form(data.getForm()); } } @@ -196,9 +194,8 @@ public abstract class AdHocCommand { * response. It could be a form to fill out the information needed to go to * the next stage or the result of an execution. * - * @param form - * the form of the current stage to fill out or the result of the - * execution. + * @param form the form of the current stage to fill out or the result of the + * execution. */ protected void setForm(Form form) { data.setForm(form.getDataFormToSend()); @@ -209,22 +206,19 @@ public abstract class AdHocCommand { * command. It is invoked on every command. If there is a problem executing * the command it throws an XMPPException. * - * @throws XMPPException - * if there is a problem executing the command. + * @throws XMPPException if there is a problem executing the command. */ public abstract void execute() throws XMPPException; /** * Executes the next action of the command with the information provided in * the response. This form must be the answer form of the - * previous stage. This method will be only invoked for commands that have 1 + * previous stage. This method will be only invoked for commands that have one * or more stages. If there is a problem executing the command it throws an * XMPPException. * - * @param response - * the form answer of the previous stage. - * @throws XMPPException - * if there is a problem executing the command. + * @param response the form answer of the previous stage. + * @throws XMPPException if there is a problem executing the command. */ public abstract void next(Form response) throws XMPPException; @@ -235,10 +229,8 @@ public abstract class AdHocCommand { * or more stages. If there is a problem executing the command it throws an * XMPPException. * - * @param response - * the form answer of the previous stage. - * @throws XMPPException - * if there is a problem executing the command. + * @param response the form answer of the previous stage. + * @throws XMPPException if there is a problem executing the command. */ public abstract void complete(Form response) throws XMPPException; @@ -248,8 +240,7 @@ public abstract class AdHocCommand { * the previous one. If there is a problem executing the command it throws * an XMPPException. * - * @throws XMPPException - * if there is a problem executing the command. + * @throws XMPPException if there is a problem executing the command. */ public abstract void prev() throws XMPPException; @@ -258,19 +249,18 @@ public abstract class AdHocCommand { * the execution. If there is a problem executing the command it throws an * XMPPException. * - * @throws XMPPException - * if there is a problem executing the command. + * @throws XMPPException if there is a problem executing the command. */ public abstract void cancel() throws XMPPException; /** - * Returns a collection with the allowed actions based on the current stage - * Possible actions are: prev, next and - * complete. This method will be only invoked for commands that - * have 1 or more stages. + * Returns a collection with the allowed actions based on the current stage. + * Possible actions are: {@link Action#prev prev}, {@link Action#next next} and + * {@link Action#complete complete}. This method will be only invoked for commands that + * have one or more stages. * * @return a collection with the allowed actions based on the current stage - * as defined in the SessionData. + * as defined in the SessionData. */ protected List getActions() { return data.getActions(); @@ -287,14 +277,14 @@ public abstract class AdHocCommand { } /** - * Returns which of the actions available for the current stage is + * Returns the action available for the current stage which is * considered the equivalent to "execute". When the requester sends his * reply, if no action was defined in the command then the action will be * assumed "execute" thus assuming the action returned by this method. This * method will never be invoked for commands that have no stages. * - * @return which of the actions available for the current stage is - * considered the equivalent to "execute". + * @return the action available for the current stage which is considered + * the equivalent to "execute". */ protected Action getExecuteAction() { return data.getExecuteAction(); @@ -341,8 +331,8 @@ public abstract class AdHocCommand { } /** - * Returns if the action is available in the current stage. - * The Action.cancel is always allowed. To define the + * Returns true if the action is available in the current stage. + * The {@link Action#cancel cancel} action is always allowed. To define the * available actions use the addActionAvailable method. * * @param action @@ -353,6 +343,9 @@ public abstract class AdHocCommand { return getActions().contains(action) || Action.cancel.equals(action); } + /** + * The status of the stage in the adhoc command. + */ public enum Status { /** @@ -411,58 +404,43 @@ public abstract class AdHocCommand { /** * The responding JID cannot accept the specified action. */ - badAction, + badAction("bad-action"), /** * The responding JID does not understand the specified action. */ - malformedAction, + malformedAction("malformed-action"), /** * The responding JID cannot accept the specified language/locale. */ - badLocale, + badLocale("bad-locale"), /** * The responding JID cannot accept the specified payload (e.g. the data * form did not provide one or more required fields). */ - badPayload, + badPayload("bad-payload"), /** * The responding JID cannot accept the specified sessionid. */ - badSessionid, + badSessionid("bad-sessionid"), /** * The requesting JID specified a sessionid that is no longer active * (either because it was completed, canceled, or timed out). */ - sessionExpired; + sessionExpired("session-expired"); + + private String value; + + SpecificErrorCondition(String value) { + this.value = value; + } public String toString() { - String result = null; - switch (this) { - case badAction: - result = "bad-action"; - break; - case malformedAction: - result = "malformed-action"; - break; - case badLocale: - result = "bad-locale"; - break; - case badPayload: - result = "bad-payload"; - break; - case badSessionid: - result = "bad-sessionid"; - break; - case sessionExpired: - result = "session-expired"; - break; - } - return result; + return value; } } -} +} \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/commands/AdHocCommandManager.java b/source/org/jivesoftware/smackx/commands/AdHocCommandManager.java index 0bfad97e6..297825333 100755 --- a/source/org/jivesoftware/smackx/commands/AdHocCommandManager.java +++ b/source/org/jivesoftware/smackx/commands/AdHocCommandManager.java @@ -326,7 +326,7 @@ public class AdHocCommandManager { // processed packet. We must check if it still in the // map. if (command != null) { - long creationStamp = command.getCreationStamp(); + long creationStamp = command.getCreationDate(); // Check if the Session data has expired (default is // 10 minutes) // To remove it from the session list it waits for @@ -443,7 +443,7 @@ public class AdHocCommandManager { // Increase the state number, so the command knows in witch // stage it is - command.increaseStage(); + command.incrementStage(); // Executes the command command.execute(); @@ -496,7 +496,7 @@ public class AdHocCommandManager { } // Check if the Session data has expired (default is 10 minutes) - long creationStamp = command.getCreationStamp(); + long creationStamp = command.getCreationDate(); if (System.currentTimeMillis() - creationStamp > SESSION_TIMEOUT * 1000) { // Remove the expired session executingCommands.remove(sessionId); @@ -549,7 +549,7 @@ public class AdHocCommandManager { command.setData(response); if (Action.next.equals(action)) { - command.increaseStage(); + command.incrementStage(); command.next(new Form(requestData.getForm())); if (command.isLastStage()) { // If it is the last stage then the command is @@ -562,14 +562,14 @@ public class AdHocCommandManager { } } else if (Action.complete.equals(action)) { - command.increaseStage(); + command.incrementStage(); command.complete(new Form(requestData.getForm())); response.setStatus(Status.completed); // Remove the completed session executingCommands.remove(sessionId); } else if (Action.prev.equals(action)) { - command.decreaseStage(); + command.decrementStage(); command.prev(); } else if (Action.cancel.equals(action)) { diff --git a/source/org/jivesoftware/smackx/commands/AdHocCommandNote.java b/source/org/jivesoftware/smackx/commands/AdHocCommandNote.java index 2175a9d00..d3f487f99 100755 --- a/source/org/jivesoftware/smackx/commands/AdHocCommandNote.java +++ b/source/org/jivesoftware/smackx/commands/AdHocCommandNote.java @@ -21,18 +21,21 @@ package org.jivesoftware.smackx.commands; /** - * Notes can be added to a command execution response. A note has to attributes, - * one is the value or message an the other is the type of the note. + * Notes can be added to a command execution response. A note has a type and value. * * @author Gabriel Guardincerri - * */ public class AdHocCommandNote { private Type type; - private String value; + /** + * Creates a new adhoc command note with the specified type and value. + * + * @param type the type of the note. + * @param value the value of the note. + */ public AdHocCommandNote(Type type, String value) { this.type = type; this.value = value; @@ -57,10 +60,7 @@ public class AdHocCommandNote { } /** - * The types of the notes. - * - * @author Gabriel Guardincerri - * + * Represents a note type. */ public enum Type { @@ -74,7 +74,7 @@ public class AdHocCommandNote { * The note indicates a warning. Possibly due to illogical (yet valid) * data. */ - warm, + warn, /** * The note indicates an error. The text should indicate the reason for @@ -83,4 +83,4 @@ public class AdHocCommandNote { error } -} +} \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/commands/LocalCommand.java b/source/org/jivesoftware/smackx/commands/LocalCommand.java index 6ec3e203a..132d474bb 100755 --- a/source/org/jivesoftware/smackx/commands/LocalCommand.java +++ b/source/org/jivesoftware/smackx/commands/LocalCommand.java @@ -46,7 +46,7 @@ public abstract class LocalCommand extends AdHocCommand { /** * The time stamp of first invokation of the command. Used to implement the session timeout. */ - private long creationStamp; + private long creationDate; /** * The unique ID of the execution of the command. @@ -65,7 +65,7 @@ public abstract class LocalCommand extends AdHocCommand { public LocalCommand() { super(); - this.creationStamp = System.currentTimeMillis(); + this.creationDate = System.currentTimeMillis(); currenStage = -1; } @@ -106,13 +106,12 @@ public abstract class LocalCommand extends AdHocCommand { } /** - * Returns the time in milliseconds since this command was executed for - * first time. + * Returns the date the command was created. * - * @return the time in milliseconds since the command was executed for the first time. + * @return the date the command was created. */ - public long getCreationStamp() { - return creationStamp; + public long getCreationDate() { + return creationDate; } @Override @@ -122,7 +121,7 @@ public abstract class LocalCommand extends AdHocCommand { } /** - * Returns if the current stage is the last one. If it is, then the + * Returns true if the current stage is the last one. If it is then the * execution of some action will complete the execution of the command. * * @return true if the command is in the last stage. @@ -134,7 +133,7 @@ public abstract class LocalCommand extends AdHocCommand { * not be called. * */ - void increaseStage() { + void incrementStage() { currenStage++; } @@ -143,13 +142,13 @@ public abstract class LocalCommand extends AdHocCommand { * not be called. * */ - void decreaseStage() { + void decrementStage() { currenStage--; } /** * Returns the currently executing stage number. The first stage number is - * 0. So during the execution of the first action this method will answer 0. + * 0. During the execution of the first action this method will answer 0. * * @return the current stage number. */ @@ -158,7 +157,7 @@ public abstract class LocalCommand extends AdHocCommand { } /** - * Returns if the specified requester has permission to execute all the + * Returns true if the specified requester has permission to execute all the * stages of this action. This is checked when the first request is received, * if the permission is grant then the requester will be able to execute * all the stages of the command. It is not checked again during the diff --git a/source/org/jivesoftware/smackx/commands/RemoteCommand.java b/source/org/jivesoftware/smackx/commands/RemoteCommand.java index 37c9ce7ec..5001a5cd6 100755 --- a/source/org/jivesoftware/smackx/commands/RemoteCommand.java +++ b/source/org/jivesoftware/smackx/commands/RemoteCommand.java @@ -32,7 +32,9 @@ import org.jivesoftware.smackx.packet.AdHocCommandData; /** * Represents a command that is in a remote location. Invoking one of the - * execute, next, prev, cancel or complete methods results in executing that + * {@link AdHocCommand.Action#execute execute}, {@link AdHocCommand.Action#next next}, + * {@link AdHocCommand.Action#prev prev}, {@link AdHocCommand.Action#cancel cancel} or + * {@link AdHocCommand.Action#complete complete} actions results in executing that * action in the remote location. In response to that action the internal state * of the this command instance will change. For example, if the command is a * single stage command, then invoking the execute action will execute this @@ -64,12 +66,9 @@ public class RemoteCommand extends AdHocCommand { * command identified by node in the host identified by * jid * - * @param connection - * the connection to use for the execution. - * @param node - * the identifier of the command. - * @param jid - * the JID of the host. + * @param connection the connection to use for the execution. + * @param node the identifier of the command. + * @param jid the JID of the host. */ protected RemoteCommand(XMPPConnection connection, String node, String jid) { super(); @@ -99,7 +98,7 @@ public class RemoteCommand extends AdHocCommand { * there is a problem executing the command it throws an XMPPException. * * @param form the form anwser of the previous stage. - * @throws XMPPException + * @throws XMPPException if an error occurs. */ public void execute(Form form) throws XMPPException { executeAction(Action.execute, form); @@ -122,15 +121,16 @@ public class RemoteCommand extends AdHocCommand { /** * Executes the action with the form. * The action could be any of the available actions. The form must - * be the anwser of the previous stage. It can be null if it is the first stage. + * be the anwser of the previous stage. It can be null if it is the first stage. + * * @param action the action to execute * @param form the form with the information * @throws XMPPException if there is a problem executing the command. */ private void executeAction(Action action, Form form) throws XMPPException { - // TODO Check that all the requiered fields of the form were filled, if - // not throw the corresponding exeption. This will make a faster response, - // since the request is stoped before it's sended. + // TODO: Check that all the required fields of the form were filled, if + // TODO: not throw the corresponding exeption. This will make a faster response, + // TODO: since the request is stoped before it's sent. AdHocCommandData data = new AdHocCommandData(); data.setType(IQ.Type.SET); data.setTo(getOwnerJID()); @@ -142,13 +142,12 @@ public class RemoteCommand extends AdHocCommand { data.setForm(form.getDataFormToSend()); } - PacketCollector collector = connection - .createPacketCollector(new PacketIDFilter(data.getPacketID())); + PacketCollector collector = connection.createPacketCollector( + new PacketIDFilter(data.getPacketID())); connection.sendPacket(data); - Packet response = collector.nextResult(SmackConfiguration - .getPacketReplyTimeout()); + Packet response = collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); @@ -168,4 +167,4 @@ public class RemoteCommand extends AdHocCommand { public String getOwnerJID() { return jid; } -} +} \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/packet/AdHocCommandData.java b/source/org/jivesoftware/smackx/packet/AdHocCommandData.java index 0b41019b8..d0b49af00 100755 --- a/source/org/jivesoftware/smackx/packet/AdHocCommandData.java +++ b/source/org/jivesoftware/smackx/packet/AdHocCommandData.java @@ -3,7 +3,7 @@ * $Revision: $ * $Date: $ * - * Copyright 2005-2007 Jive Software. + * Copyright 2005-2008 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. @@ -31,10 +31,9 @@ import java.util.ArrayList; import java.util.List; /** - * Represents the state and the request of the execution of a command. + * Represents the state and the request of the execution of an adhoc command. * * @author Gabriel Guardincerri - * */ public class AdHocCommandData extends IQ { @@ -121,7 +120,7 @@ public class AdHocCommandData extends IQ { buf.append(""); } - // TODO ERRORES + // TODO ERRORS // if (getError() != null) { // buf.append(getError().toXML()); // } @@ -271,12 +270,10 @@ public class AdHocCommandData extends IQ { } public String toXML() { - StringBuffer sb = new StringBuffer(); - sb.append("<").append(getElementName()); - sb.append(" xmlns=\"").append(getNamespace()).append("\"/>"); - return sb.toString(); + StringBuilder buf = new StringBuilder(); + buf.append("<").append(getElementName()); + buf.append(" xmlns=\"").append(getNamespace()).append("\"/>"); + return buf.toString(); } } - - -} +} \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/provider/AdHocCommandDataProvider.java b/source/org/jivesoftware/smackx/provider/AdHocCommandDataProvider.java index 3f0f3ecf6..8d046eddf 100755 --- a/source/org/jivesoftware/smackx/provider/AdHocCommandDataProvider.java +++ b/source/org/jivesoftware/smackx/provider/AdHocCommandDataProvider.java @@ -38,7 +38,6 @@ import org.xmlpull.v1.XmlPullParser; * * @author Gabriel Guardincerri */ - public class AdHocCommandDataProvider implements IQProvider { public IQ parseIQ(XmlPullParser parser) throws Exception { @@ -56,9 +55,11 @@ public class AdHocCommandDataProvider implements IQProvider { String status = parser.getAttributeValue("", "status"); if (AdHocCommand.Status.executing.toString().equalsIgnoreCase(status)) { adHocCommandData.setStatus(AdHocCommand.Status.executing); - } else if (AdHocCommand.Status.completed.toString().equalsIgnoreCase(status)) { + } + else if (AdHocCommand.Status.completed.toString().equalsIgnoreCase(status)) { adHocCommandData.setStatus(AdHocCommand.Status.completed); - } else if (AdHocCommand.Status.canceled.toString().equalsIgnoreCase(status)) { + } + else if (AdHocCommand.Status.canceled.toString().equalsIgnoreCase(status)) { adHocCommandData.setStatus(AdHocCommand.Status.canceled); } @@ -68,7 +69,8 @@ public class AdHocCommandDataProvider implements IQProvider { Action realAction = AdHocCommand.Action.valueOf(action); if (realAction == null || realAction.equals(Action.unknown)) { adHocCommandData.setAction(Action.unknown); - } else { + } + else { adHocCommandData.setAction(realAction); } } @@ -82,24 +84,31 @@ public class AdHocCommandDataProvider implements IQProvider { if (execute != null) { adHocCommandData.setExecuteAction(AdHocCommand.Action.valueOf(execute)); } - } else if (parser.getName().equals("next")) { + } + else if (parser.getName().equals("next")) { adHocCommandData.addAction(AdHocCommand.Action.next); - } else if (parser.getName().equals("complete")) { + } + else if (parser.getName().equals("complete")) { adHocCommandData.addAction(AdHocCommand.Action.complete); - } else if (parser.getName().equals("prev")) { + } + else if (parser.getName().equals("prev")) { adHocCommandData.addAction(AdHocCommand.Action.prev); - } else if (elementName.equals("x") && namespace.equals("jabber:x:data")) { + } + else if (elementName.equals("x") && namespace.equals("jabber:x:data")) { adHocCommandData.setForm((DataForm) dataFormProvider.parseExtension(parser)); - } else if (parser.getName().equals("note")) { - AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(parser - .getAttributeValue("", "type")); + } + else if (parser.getName().equals("note")) { + AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf( + parser.getAttributeValue("", "type")); String value = parser.nextText(); adHocCommandData.addNote(new AdHocCommandNote(type, value)); - } else if (parser.getName().equals("error")) { + } + else if (parser.getName().equals("error")) { XMPPError error = PacketParserUtils.parseError(parser); adHocCommandData.setError(error); } - } else if (eventType == XmlPullParser.END_TAG) { + } + else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("command")) { done = true; }