1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

HTML and comment cleanup. Small API refactors. Moved use of StringBuffer to StringBuilder.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@10865 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2008-11-03 16:28:57 +00:00 committed by matt
parent b927475caa
commit 334838d28e
32 changed files with 271 additions and 305 deletions

View file

@ -14,53 +14,19 @@
A:hover { A:hover {
text-decoration : none; 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 { TT {
font-family : courier new; font-family : courier new, monospace;
font-weight : bold; font-weight : bold;
color : #060; color : #060;
} }
PRE, CODE { PRE, CODE {
font-family : courier new; font-family : courier new, monospace;
font-size : 100%; font-size : 100%;
} }
.footer {
font-size : 0.8em;
color : #666;
text-align : center;
}
</style> </style>
</head> </head>
<body bgcolor="#ffffff"> <body>
<font size=4> <font size=4>
Smack Source Distribution<br> Smack Source Distribution<br>
@ -107,7 +73,7 @@ possible, instructions are provided for both Unix/Linux and Windows users.
corresponding file for your shell). corresponding file for your shell).
<li>Set the JAVA_HOME environment variable by adding the <li>Set the JAVA_HOME environment variable by adding the
following line to the file: following line to the file:
<p></font><code> <p><code>
export JAVA_HOME=/usr/local/jdk1.5 export JAVA_HOME=/usr/local/jdk1.5
</code><font face="verdana, arial, helvetica" size=2> </code><font face="verdana, arial, helvetica" size=2>
<p> <p>
@ -119,9 +85,10 @@ possible, instructions are provided for both Unix/Linux and Windows users.
source .profile source .profile
</code><font face="verdana, arial, helvetica" size=2> </code><font face="verdana, arial, helvetica" size=2>
<p> <p>
The JAVA_HOME variable should now be configured correctly. The JAVA_HOME variable should now be configured correctly.</font>
</ol> </ol>
<p> </li>
<p>
<li> Windows <li> Windows
<ol> <ol>
<li>Navigate to your desktop and right click on "My Computer"; <li>Navigate to your desktop and right click on "My Computer";
@ -151,20 +118,20 @@ the setup instructions for your operating system.
<ul> <ul>
Navigate into the subdirectory of this distribution named "build" via the command-line.<p> Navigate into the subdirectory of this distribution named "build" via the command-line.<p>
<table boder=0 cellpadding=2 cellspacing=0><td bgcolor="#EEEEEE"> <table border=0 cellpadding=2 cellspacing=0><td bgcolor="#EEEEEE">
<font face="verdana, arial, helvetica" size=2> <font face="verdana, arial, helvetica" size=2>
<font color="red">Linux/Unix users only:</font>You must make the ant script <font color="red">Linux/Unix users only:</font>You must make the ant script
executable. From the build directory, type: executable. From the build directory, type:
<p></font><code> <p></font><code>
chmod u+x ant chmod u+x ant
</code><font face="verdana, arial, helvetica" size=2> </code>
</td></table> </td></table>
<p> <p>
Now, invoke the build tool to compile the Smack source code Now, invoke the build tool to compile the Smack source code
<p> <p>
Windows:</font><code> ant <br> <font face="verdana, arial, helvetica" size=2> Windows:</font><code> ant <br>
</code><font face="verdana, arial, helvetica" size=2> </code><font face="verdana, arial, helvetica" size=2>
Unix/Linux:</font><code> ./ant Unix/Linux:</font><code> ./ant
</code><font face="verdana, arial, helvetica" size=2> </code><font face="verdana, arial, helvetica" size=2>
@ -172,7 +139,7 @@ Unix/Linux:</font><code> ./ant
If the build tool is invoked correctly and Smack compiles, you've correctly If the build tool is invoked correctly and Smack compiles, you've correctly
configured your copy of the Smack developer distribution. configured your copy of the Smack developer distribution.
</font>
</ul> </ul>
<p><b>Finished!</b><p> <p><b>Finished!</b><p>
@ -215,9 +182,9 @@ for each task are enclosed with braces.
<ul> <ul>
<i>Syntax:</i><p> <i>Syntax:</i><p>
</font><code> <code>
ant<br> ant<br>
</code><font face="verdana, arial, helvetica" size=2> </code>
<p><i>Description:</i></p> <p><i>Description:</i></p>
@ -231,9 +198,9 @@ Equivalent of calling "ant <a href="#jar">jar</a>".
<ul> <ul>
<i>Syntax:</i><p> <i>Syntax:</i><p>
</font><code> <code>
ant compile <br> ant compile <br>
</code><font face="verdana, arial, helvetica" size=2> </code>
<p><i>Description:</i></p> <p><i>Description:</i></p>
@ -249,9 +216,9 @@ The build directory is the "target/classes" directory under your Smack source di
<ul> <ul>
<i>Syntax:</i><p> <i>Syntax:</i><p>
</font><code> <code>
ant jar <br> ant jar <br>
</code><font face="verdana, arial, helvetica" size=2> </code>
<p><i>Description:</i></p> <p><i>Description:</i></p>
@ -267,9 +234,9 @@ into the classpath of an application server.
<ul> <ul>
<i>Syntax:</i><p> <i>Syntax:</i><p>
</font><code> <code>
ant javadoc <br> ant javadoc <br>
</code><font face="verdana, arial, helvetica" size=2> </code>
<p><i>Description:</i></p> <p><i>Description:</i></p>
@ -283,9 +250,9 @@ JavaDocs all Smack source code in the source directory.
<ul> <ul>
<i>Syntax:</i><p> <i>Syntax:</i><p>
</font><code> <code>
ant clean<br> ant clean<br>
</code><font face="verdana, arial, helvetica" size=2> </code>
<p><i>Description:</i></p> <p><i>Description:</i></p>
@ -296,4 +263,4 @@ smack.jar file and Javadoc files.<p>
</ul> </ul>
</body> </body>
</html> </html>

View file

@ -1,6 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true" type="JAVA_MODULE"> <module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="ModuleRootManager" /> <component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/../../sample/conf/WEB-INF/web.xml" optional="false" version="2.5" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/../../sample/conf" relative="/" />
</webroots>
<building>
<setting name="EXPLODED_URL" value="file://" />
<setting name="EXPLODED_ENABLED" value="false" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
<setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
<setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
<setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
<setting name="RUN_JASPER_VALIDATION" value="true" />
<setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
</building>
<packaging>
<containerElement type="module" name="Smack">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
</packaging>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../classes" /> <output url="file://$MODULE_DIR$/../../classes" />
<exclude-output /> <exclude-output />
@ -59,6 +87,15 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/javaee.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntryProperties /> <orderEntryProperties />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true"> <project relativePaths="true" version="4">
<component name="AntConfiguration"> <component name="AntConfiguration">
<defaultAnt bundledAnt="true" /> <defaultAnt bundledAnt="true" />
<buildFile url="file://$PROJECT_DIR$/../build.xml"> <buildFile url="file://$PROJECT_DIR$/../build.xml">
@ -30,6 +30,15 @@
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" /> <option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
<option name="RIGHT_MARGIN" value="100" /> <option name="RIGHT_MARGIN" value="100" />
<ADDITIONAL_INDENT_OPTIONS fileType="js">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
</value> </value>
</option> </option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
@ -53,11 +62,12 @@
<entry name="?*.jpg" /> <entry name="?*.jpg" />
</wildcardResourcePatterns> </wildcardResourcePatterns>
</component> </component>
<component name="DataSourceManagerImpl" />
<component name="DependenciesAnalyzeManager"> <component name="DependenciesAnalyzeManager">
<option name="myForwardDirection" value="false" /> <option name="myForwardDirection" value="false" />
</component> </component>
<component name="DependencyValidationManager" /> <component name="DependencyValidationManager">
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</component>
<component name="EclipseCompilerSettings"> <component name="EclipseCompilerSettings">
<option name="DEBUGGING_INFO" value="true" /> <option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="true" /> <option name="GENERATE_NO_WARNINGS" value="true" />
@ -73,14 +83,13 @@
<option name="MAXIMUM_HEAP_SIZE" value="128" /> <option name="MAXIMUM_HEAP_SIZE" value="128" />
</component> </component>
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<entry_points /> <entry_points version="2.0" />
</component> </component>
<component name="ExportToHTMLSettings"> <component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" /> <option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" /> <option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" /> <option name="OUTPUT_DIRECTORY" />
</component> </component>
<component name="GUI Designer component loader factory" />
<component name="IdProvider" IDEtalkID="A0560E1D64D0B56EB83CBCB1C84992E6" /> <component name="IdProvider" IDEtalkID="A0560E1D64D0B56EB83CBCB1C84992E6" />
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<option name="PROJECT_PROFILE" value="Project Default" /> <option name="PROJECT_PROFILE" value="Project Default" />
@ -90,38 +99,26 @@
<profile version="1.0" is_locked="false"> <profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<option name="myLocal" value="false" /> <option name="myLocal" value="false" />
<used_levels>
<error>
<option name="myName" value="ERROR" />
<option name="myVal" value="400" />
</error>
<warning>
<option name="myName" value="WARNING" />
<option name="myVal" value="300" />
</warning>
<information>
<option name="myName" value="INFO" />
<option name="myVal" value="200" />
</information>
<server>
<option name="myName" value="SERVER PROBLEM" />
<option name="myVal" value="100" />
</server>
</used_levels>
<inspection_tool class="CloneCallsSuperClone" level="WARNING" enabled="false" /> <inspection_tool class="CloneCallsSuperClone" level="WARNING" enabled="false" />
<inspection_tool class="ForCanBeForeach" level="WARNING" enabled="false" /> <inspection_tool class="ForCanBeForeach" level="WARNING" enabled="false">
<option name="REPORT_INDEXED_LOOP" value="true" />
</inspection_tool>
<inspection_tool class="UnnecessaryBoxing" level="WARNING" enabled="false" /> <inspection_tool class="UnnecessaryBoxing" level="WARNING" enabled="false" />
<inspection_tool class="UnnecessaryUnboxing" level="WARNING" enabled="false" /> <inspection_tool class="UnnecessaryUnboxing" level="WARNING" enabled="false" />
<inspection_tool class="WhileCanBeForeach" level="WARNING" enabled="false" /> <inspection_tool class="WhileCanBeForeach" level="WARNING" enabled="false" />
<inspection_tool class="SuspiciousMethodCalls" level="WARNING" enabled="false" /> <inspection_tool class="SuspiciousMethodCalls" level="WARNING" enabled="false">
<option name="REPORT_CONVERTIBLE_METHOD_CALLS" value="true" />
</inspection_tool>
<inspection_tool class="ConstantConditions" level="WARNING" enabled="false"> <inspection_tool class="ConstantConditions" level="WARNING" enabled="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" /> <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool> </inspection_tool>
<inspection_tool class="PointlessBooleanExpression" level="WARNING" enabled="false"> <inspection_tool class="PointlessBooleanExpression" level="WARNING" enabled="false">
<option name="m_ignoreExpressionsContainingConstants" value="false" /> <option name="m_ignoreExpressionsContainingConstants" value="false" />
</inspection_tool> </inspection_tool>
</profile> </profile>
</profiles> </profiles>
<list size="0" />
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" /> <option name="DEBUGGING_INFO" value="true" />
@ -282,6 +279,7 @@
</item> </item>
</group> </group>
</component> </component>
<component name="ProjectFileVersion" converted="true" />
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/../../jingle/extension/build/projects/JingleExtension.iml" filepath="$PROJECT_DIR$/../../jingle/extension/build/projects/JingleExtension.iml" /> <module fileurl="file://$PROJECT_DIR$/../../jingle/extension/build/projects/JingleExtension.iml" filepath="$PROJECT_DIR$/../../jingle/extension/build/projects/JingleExtension.iml" />
@ -303,10 +301,13 @@
<option name="VM_PARAMETERS" value="" /> <option name="VM_PARAMETERS" value="" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="ADDITIONAL_CLASS_PATH" /> <option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE"> <option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" /> <value defaultName="singleModule" />
</option> </option>
<envs />
<RunnerSettings RunnerId="Debug"> <RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="4533" /> <option name="DEBUG_PORT" value="4533" />
<option name="TRANSPORT" value="0" /> <option name="TRANSPORT" value="0" />
@ -317,7 +318,9 @@
<option name="JVMPI" value="false" /> <option name="JVMPI" value="false" />
<option name="INTERPRETED" value="false" /> <option name="INTERPRETED" value="false" />
</RunnerSettings> </RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" /> <ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method> <method>
<option name="Make" value="true" /> <option name="Make" value="true" />
</method> </method>
@ -330,8 +333,14 @@
<option name="GENERATE_IIOP_STUBS" value="false" /> <option name="GENERATE_IIOP_STUBS" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" /> <option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component> </component>
<component name="StarteamVcsAdapter" /> <component name="SvnBranchConfigurationManager">
<component name="VssVcs" /> <option name="myVersion" value="123" />
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$/../.." vcs="svn" />
</component>
<component name="WebServicesPlugin" addRequiredLibraries="true" />
<component name="com.intellij.jsf.UserDefinedFacesConfigs"> <component name="com.intellij.jsf.UserDefinedFacesConfigs">
<option name="USER_DEFINED_CONFIGS"> <option name="USER_DEFINED_CONFIGS">
<value> <value>
@ -353,6 +362,5 @@
<option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" /> <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
<option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" /> <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
</component> </component>
<UsedPathMacros />
</project> </project>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true" type="JAVA_MODULE"> <module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="ModuleRootManager" />
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../classes" /> <output url="file://$MODULE_DIR$/../../classes" />
<exclude-output /> <exclude-output />

View file

@ -42,9 +42,6 @@ pre, tt, code {
#pageBody { #pageBody {
margin: 0 18px 0 20px; margin: 0 18px 0 20px;
} }
/* anchors */ /* anchors */
a:link { a:link {
color: #11568c; color: #11568c;
@ -59,9 +56,6 @@ a:hover {
a:active { a:active {
color: #7a1d42; color: #7a1d42;
} }
/* page header elements (logo and navigation) */ /* page header elements (logo and navigation) */
.navigation { .navigation {
display: block; display: block;
@ -84,9 +78,6 @@ a:active {
.navigation a:visited { color: #ffffff; } .navigation a:visited { color: #ffffff; }
.navigation a:hover { color: #ffffff; } .navigation a:hover { color: #ffffff; }
.navigation a:active { color: #ffffff; } .navigation a:active { color: #ffffff; }
/* headings */ /* headings */
h1 { h1 {
display: block; display: block;

View file

@ -8,15 +8,15 @@
body { body {
font-size : 100%; font-size : 100%;
background-color : #d3d6d9; background-color : #d3d6d9;
padding: 0px; padding: 0;
margin: 0px 0px 30px 0px; margin: 0 0 30px 0;
} }
body, td, th { body, td, th {
font-family : arial, helvetica, sans-serif; font-family : arial, helvetica, sans-serif;
font-size : 10pt; font-size : 10pt;
} }
pre, tt, code { pre, tt, code {
font-family : courier new, monospaced; font-family : courier new, monospace;
font-size : 9pt; font-size : 9pt;
} }
#pageContainer { #pageContainer {
@ -36,15 +36,12 @@ pre, tt, code {
background-color: #e7eaee; background-color: #e7eaee;
border: 1px solid #cccccc; border: 1px solid #cccccc;
border-bottom: none; border-bottom: none;
-moz-border-radius: 5px 5px 0px 0px; -moz-border-radius: 5px 5px 0 0;
margin: 10px 0px 0px 0px; margin: 10px 0 0 0;
} }
#pageBody { #pageBody {
margin: 0px 18px 0px 20px; margin: 0 18px 0 20px;
} }
/* anchors */ /* anchors */
a:link { a:link {
color: #11568c; color: #11568c;
@ -59,9 +56,6 @@ a:hover {
a:active { a:active {
color: #7a1d42; color: #7a1d42;
} }
/* page header elements (logo and navigation) */ /* page header elements (logo and navigation) */
.navigation { .navigation {
display: block; display: block;
@ -73,20 +67,17 @@ a:active {
color: #ffffff; color: #ffffff;
font-size: 11px; font-size: 11px;
line-height: 18px; line-height: 18px;
padding: 0px 0px 0px 0px; padding: 0 0 0 0;
margin: 0px 0px 25px 0px; margin: 0 0 25px 0;
overflow: hidden; overflow: hidden;
} }
.navigation a { .navigation a {
margin: 0px 20px 0px 20px; margin: 0 20px 0 20px;
} }
.navigation a:link { color: #ffffff; } .navigation a:link { color: #ffffff; }
.navigation a:visited { color: #ffffff; } .navigation a:visited { color: #ffffff; }
.navigation a:hover { color: #ffffff; } .navigation a:hover { color: #ffffff; }
.navigation a:active { color: #ffffff; } .navigation a:active { color: #ffffff; }
/* headings */ /* headings */
h1 { h1 {
display: block; display: block;
@ -94,37 +85,37 @@ h1 {
font-size : 1.7em; font-size : 1.7em;
font-weight : bold; font-weight : bold;
color: #670e15; color: #670e15;
padding: 0px; padding: 0;
margin: 30px 0px 0px 20px; margin: 30px 0 0 20px;
} }
h2 { h2 {
font-size : 1.3em; font-size : 1.3em;
font-weight : bold; font-weight : bold;
margin: 40px 0px 6px 0px; margin: 40px 0 6px 0;
padding: 0px; padding: 0;
color: #335588; color: #335588;
} }
h3 { h3 {
font-size : 1.0em; font-size : 1.0em;
font-weight : bold; font-weight : bold;
margin: 25px 0px 3px 0px; margin: 25px 0 3px 0;
padding: 0px; padding: 0;
color: #334466; color: #334466;
} }
/* general elements */ /* general elements */
p { p {
margin: 0px 0px 15px 0px; margin: 0 0 15px 0;
} }
ul { ul {
margin: 5px 0px 15px 15px; margin: 5px 0 15px 15px;
} }
li { li {
padding-bottom : 4px; padding-bottom : 4px;
} }
tt { tt {
font-family : courier new; font-family : courier new, monospace;
font-weight : bold; font-weight : bold;
color : #060; color : #060;
} }
@ -133,16 +124,7 @@ hr {
height: 1px; height: 1px;
background-color: #999999; background-color: #999999;
border: none; border: none;
margin: 40px 0px 20px 0px; margin: 40px 0 20px 0;
}
.footer {
font-size : 8pt;
color : #666;
text-align : center;
margin-top : 2em;
padding-top : 0.5em;
border-top : 1px #CCC solid;
} }
</style> </style>
</head> </head>
@ -343,7 +325,7 @@ hr {
</ul> </ul>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software, 2004-2007 Copyright &copy; Jive Software, 2004-2008
</div> </div>
</div> </div>

View file

@ -109,7 +109,7 @@ to the system clipboard or to clear the contents of the pane.
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2005 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -115,7 +115,7 @@ XMPPConnection instance.
<p><div class="footer"> <p><div class="footer">
Copyright &copy; Jive Software 2002-2007 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -28,7 +28,7 @@
</ul> </ul>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2007 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -87,7 +87,7 @@ newChat.sendMessage(newMessage);
<br clear="all"/><br><br> <br clear="all"/><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2007 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -72,7 +72,7 @@ use that as a reference while reading through this documentation.
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2007 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -160,7 +160,7 @@ The listener becomes notified after performing:
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2006 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -80,7 +80,7 @@ to the <tt>PacketFilter</tt> interface. The default set of filters includes:
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2005 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<title>Smack: Packet Properties - Jive Software</title> <title>Smack: Packet Properties - Jive Software</title>
<link rel="stylesheet" type="text/css" href="style.css" / <link rel="stylesheet" type="text/css" href="style.css" />
</head> </head>
<body> <body>
@ -32,9 +32,9 @@ demonstrates how to set properties:
<div class="code"><pre> <div class="code"><pre>
Message message = chat.createMessage(); Message message = chat.createMessage();
<font color="gray"></i>// Add a Color object as a property.</i></font> <font color="gray"><i>// Add a Color object as a property.</i></font>
message.setProperty(<font color="blue">"favoriteColor"</font>, new Color(0, 0, 255)); message.setProperty(<font color="blue">"favoriteColor"</font>, new Color(0, 0, 255));
<font color="gray"></i>// Add an int as a property.</i></font> <font color="gray"><i>// Add an int as a property.</i></font>
message.setProperty(<font color="blue">"favoriteNumber"</font>, 4); message.setProperty(<font color="blue">"favoriteNumber"</font>, 4);
chat.sendMessage(message); chat.sendMessage(message);
</pre></div> </pre></div>
@ -45,9 +45,9 @@ Getting those same properties would use the following code:
<div class="code"><pre> <div class="code"><pre>
Message message = chat.nextMessage(); Message message = chat.nextMessage();
<font color="gray"></i>// Get a Color object property.</i></font> <font color="gray"><i>// Get a Color object property.</i></font>
Color favoriteColor = (Color)message.getProperty(<font color="blue">"favoriteColor"</font>); Color favoriteColor = (Color)message.getProperty(<font color="blue">"favoriteColor"</font>);
<font color="gray"></i>// Get an int property. Note that properties are always returned as <font color="gray"><i>// Get an int property. Note that properties are always returned as
// Objects, so we must cast the value to an Integer, then convert // Objects, so we must cast the value to an Integer, then convert
// it to an int.</i></font> // it to an int.</i></font>
int favoriteNumber = ((Integer)message.getProperty(<font color="blue">"favoriteNumber"</font>)).intValue(); int favoriteNumber = ((Integer)message.getProperty(<font color="blue">"favoriteNumber"</font>)).intValue();
@ -112,7 +112,7 @@ The currently supported types are: <tt>integer</tt>, <tt>long</tt>, <tt>float</t
</p> </p>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2004 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -114,7 +114,7 @@ sub-packet in DefaultPacketExtension object and then attach it to the packet.
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2004 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -116,7 +116,7 @@ should be registered that listens for Presence packets that have a type of
<br clear="all" /><br><br> <br clear="all" /><br><br>
<div class="footer"> <div class="footer">
Copyright &copy; Jive Software 2002-2007 Copyright &copy; Jive Software 2002-2008
</div> </div>
</body> </body>

View file

@ -1045,7 +1045,7 @@ public class JingleManagerTest extends SmackTestCase {
} }
public String getChildElementXML() { public String getChildElementXML() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append(s); buf.append(s);
return buf.toString(); return buf.toString();
} }

View file

@ -98,7 +98,7 @@ public class JingleProviderTest extends SmackTestCase {
} }
public String getChildElementXML() { public String getChildElementXML() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append(s); buf.append(s);
return buf.toString(); return buf.toString();
} }

View file

@ -274,7 +274,7 @@ public class Privacy extends IQ {
} }
public String getChildElementXML() { public String getChildElementXML() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("<query xmlns=\"jabber:iq:privacy\">"); buf.append("<query xmlns=\"jabber:iq:privacy\">");
// Add the active tag // Add the active tag

View file

@ -251,7 +251,7 @@ public class PrivacyItem {
* @return the text xml representation. * @return the text xml representation.
*/ */
public String toXML() { public String toXML() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("<item"); buf.append("<item");
if (this.isAllow()) { if (this.isAllow()) {
buf.append(" action=\"allow\""); buf.append(" action=\"allow\"");

View file

@ -198,7 +198,7 @@ public class XMPPError {
* @return the error as XML. * @return the error as XML.
*/ */
public String toXML() { public String toXML() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("<error code=\"").append(code).append("\""); buf.append("<error code=\"").append(code).append("\"");
if (type != null) { if (type != null) {
buf.append(" type=\""); buf.append(" type=\"");
@ -223,7 +223,7 @@ public class XMPPError {
} }
public String toString() { public String toString() {
StringBuffer txt = new StringBuffer(); StringBuilder txt = new StringBuilder();
if (condition != null) { if (condition != null) {
txt.append(condition); txt.append(condition);
} }

View file

@ -48,7 +48,7 @@ public class SASLAnonymous extends SASLMechanism {
} }
protected void authenticate() throws IOException { protected void authenticate() throws IOException {
StringBuffer stanza = new StringBuffer(); StringBuilder stanza = new StringBuilder();
stanza.append("<auth mechanism=\"").append(getName()); stanza.append("<auth mechanism=\"").append(getName());
stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append("</auth>"); stanza.append("</auth>");
@ -59,7 +59,7 @@ public class SASLAnonymous extends SASLMechanism {
public void challengeReceived(String challenge) throws IOException { public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text // Build the challenge response stanza encoding the response text
StringBuffer stanza = new StringBuffer(); StringBuilder stanza = new StringBuilder();
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append("="); stanza.append("=");
stanza.append("</response>"); stanza.append("</response>");

View file

@ -110,7 +110,7 @@ public abstract class SASLMechanism implements CallbackHandler {
} }
protected void authenticate() throws IOException, XMPPException { protected void authenticate() throws IOException, XMPPException {
StringBuffer stanza = new StringBuffer(); StringBuilder stanza = new StringBuilder();
stanza.append("<auth mechanism=\"").append(getName()); stanza.append("<auth mechanism=\"").append(getName());
stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
try { try {
@ -140,7 +140,7 @@ public abstract class SASLMechanism implements CallbackHandler {
*/ */
public void challengeReceived(String challenge) throws IOException { public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text // Build the challenge response stanza encoding the response text
StringBuffer stanza = new StringBuffer(); StringBuilder stanza = new StringBuilder();
byte response[]; byte response[];
if(challenge != null) { if(challenge != null) {

View file

@ -1071,7 +1071,7 @@ public class AbstractHashedMap <K,V> extends AbstractMap<K, V> implements Iterab
} }
public String toString() { 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 <K,V> extends AbstractMap<K, V> implements Iterab
if (size() == 0) { if (size() == 0) {
return "{}"; return "{}";
} }
StringBuffer buf = new StringBuffer(32 * size()); StringBuilder buf = new StringBuilder(32 * size());
buf.append('{'); buf.append('{');
MapIterator it = mapIterator(); MapIterator it = mapIterator();

View file

@ -74,7 +74,7 @@ public abstract class AbstractKeyValue <K,V> implements KeyValue<K, V> {
* @return a String view of the entry * @return a String view of the entry
*/ */
public String toString() { public String toString() {
return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); return new StringBuilder().append(getKey()).append('=').append(getValue()).toString();
} }
} }

View file

@ -69,11 +69,11 @@ import java.util.List;
* *
*/ */
public abstract class AdHocCommand { public abstract class AdHocCommand {
// TODO Analize the redesign of command by having an ExecutionResponse as a // 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 // TODO: 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 // TODO: 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 // TODO: design is more intuitive and simpler than the current one that has all in
// one class. // TODO: one class.
private AdHocCommandData data; private AdHocCommandData data;
@ -83,17 +83,15 @@ public abstract class AdHocCommand {
} }
/** /**
* Returns the specific condition of the <code>error</code> or null if the * Returns the specific condition of the <code>error</code> or <tt>null</tt> if the
* error doesn't have any. * error doesn't have any.
* *
* @param error * @param error the error the get the specific condition from.
* the error the get the specific condition from
* @return the specific condition of this error, or null if it doesn't have * @return the specific condition of this error, or null if it doesn't have
* any. * any.
*/ */
public static SpecificErrorCondition getSpecificErrorConditionFrom( public static SpecificErrorCondition getSpecificErrorCondition(XMPPError error) {
XMPPError error) { // This method is implemented to provide an easy way of getting a packet
// This method is implemented to provied an easy way of getting a packet
// extension of the XMPPError. // extension of the XMPPError.
for (SpecificErrorCondition condition : SpecificErrorCondition.values()) { for (SpecificErrorCondition condition : SpecificErrorCondition.values()) {
if (error.getExtension(condition.toString(), 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 * Sets the unique identifier of the command. This value must be unique for
* the <code>OwnerJID</code>. * the <code>OwnerJID</code>.
* *
* @param node * @param node the unique identifier of the command.
* the unique identifier of the command
*/ */
public void setNode(String node) { public void setNode(String node) {
data.setNode(node); data.setNode(node);
@ -138,14 +135,14 @@ public abstract class AdHocCommand {
* Returns the unique identifier of the command. It is unique for the * Returns the unique identifier of the command. It is unique for the
* <code>OwnerJID</code>. * <code>OwnerJID</code>.
* *
* @return the unique identifier of the command * @return the unique identifier of the command.
*/ */
public String getNode() { public String getNode() {
return data.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. * execution request.
* *
* @return the owner JID. * @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 * 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 * response to the execution of an action. All the notes added here are
* returned by the <code>getNotes</code> method during the current stage. * returned by the {@link #getNotes} method during the current stage.
* Once the stage changes all the notes are discarded. * Once the stage changes all the notes are discarded.
* *
* @param note the note. * @param note the note.
@ -186,7 +183,8 @@ public abstract class AdHocCommand {
public Form getForm() { public Form getForm() {
if (data.getForm() == null) { if (data.getForm() == null) {
return null; return null;
} else { }
else {
return new Form(data.getForm()); 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 * response. It could be a form to fill out the information needed to go to
* the next stage or the result of an execution. * the next stage or the result of an execution.
* *
* @param form * @param form the form of the current stage to fill out or the result of the
* the form of the current stage to fill out or the result of the * execution.
* execution.
*/ */
protected void setForm(Form form) { protected void setForm(Form form) {
data.setForm(form.getDataFormToSend()); 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 * command. It is invoked on every command. If there is a problem executing
* the command it throws an XMPPException. * the command it throws an XMPPException.
* *
* @throws XMPPException * @throws XMPPException if there is a problem executing the command.
* if there is a problem executing the command.
*/ */
public abstract void execute() throws XMPPException; public abstract void execute() throws XMPPException;
/** /**
* Executes the next action of the command with the information provided in * Executes the next action of the command with the information provided in
* the <code>response</code>. This form must be the answer form of the * the <code>response</code>. 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 * or more stages. If there is a problem executing the command it throws an
* XMPPException. * XMPPException.
* *
* @param response * @param response the form answer of the previous stage.
* the form answer of the previous stage. * @throws XMPPException if there is a problem executing the command.
* @throws XMPPException
* if there is a problem executing the command.
*/ */
public abstract void next(Form response) throws XMPPException; 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 * or more stages. If there is a problem executing the command it throws an
* XMPPException. * XMPPException.
* *
* @param response * @param response the form answer of the previous stage.
* the form answer of the previous stage. * @throws XMPPException if there is a problem executing the command.
* @throws XMPPException
* if there is a problem executing the command.
*/ */
public abstract void complete(Form response) throws XMPPException; 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 * the previous one. If there is a problem executing the command it throws
* an XMPPException. * an XMPPException.
* *
* @throws XMPPException * @throws XMPPException if there is a problem executing the command.
* if there is a problem executing the command.
*/ */
public abstract void prev() throws XMPPException; 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 * the execution. If there is a problem executing the command it throws an
* XMPPException. * XMPPException.
* *
* @throws XMPPException * @throws XMPPException if there is a problem executing the command.
* if there is a problem executing the command.
*/ */
public abstract void cancel() throws XMPPException; public abstract void cancel() throws XMPPException;
/** /**
* Returns a collection with the allowed actions based on the current stage * Returns a collection with the allowed actions based on the current stage.
* Possible actions are: <tt>prev</tt>, <tt>next</tt> and * Possible actions are: {@link Action#prev prev}, {@link Action#next next} and
* <tt>complete</tt>. This method will be only invoked for commands that * {@link Action#complete complete}. This method will be only invoked for commands that
* have 1 or more stages. * have one or more stages.
* *
* @return a collection with the allowed actions based on the current stage * @return a collection with the allowed actions based on the current stage
* as defined in the SessionData. * as defined in the SessionData.
*/ */
protected List<Action> getActions() { protected List<Action> getActions() {
return data.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 * considered the equivalent to "execute". When the requester sends his
* reply, if no action was defined in the command then the action will be * 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 * assumed "execute" thus assuming the action returned by this method. This
* method will never be invoked for commands that have no stages. * method will never be invoked for commands that have no stages.
* *
* @return which of the actions available for the current stage is * @return the action available for the current stage which is considered
* considered the equivalent to "execute". * the equivalent to "execute".
*/ */
protected Action getExecuteAction() { protected Action getExecuteAction() {
return data.getExecuteAction(); return data.getExecuteAction();
@ -341,8 +331,8 @@ public abstract class AdHocCommand {
} }
/** /**
* Returns if the <code>action</code> is available in the current stage. * Returns true if the <code>action</code> is available in the current stage.
* The <code>Action.cancel</code> is always allowed. To define the * The {@link Action#cancel cancel} action is always allowed. To define the
* available actions use the <code>addActionAvailable</code> method. * available actions use the <code>addActionAvailable</code> method.
* *
* @param action * @param action
@ -353,6 +343,9 @@ public abstract class AdHocCommand {
return getActions().contains(action) || Action.cancel.equals(action); return getActions().contains(action) || Action.cancel.equals(action);
} }
/**
* The status of the stage in the adhoc command.
*/
public enum Status { public enum Status {
/** /**
@ -411,58 +404,43 @@ public abstract class AdHocCommand {
/** /**
* The responding JID cannot accept the specified action. * The responding JID cannot accept the specified action.
*/ */
badAction, badAction("bad-action"),
/** /**
* The responding JID does not understand the specified action. * The responding JID does not understand the specified action.
*/ */
malformedAction, malformedAction("malformed-action"),
/** /**
* The responding JID cannot accept the specified language/locale. * 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 * The responding JID cannot accept the specified payload (e.g. the data
* form did not provide one or more required fields). * form did not provide one or more required fields).
*/ */
badPayload, badPayload("bad-payload"),
/** /**
* The responding JID cannot accept the specified sessionid. * The responding JID cannot accept the specified sessionid.
*/ */
badSessionid, badSessionid("bad-sessionid"),
/** /**
* The requesting JID specified a sessionid that is no longer active * The requesting JID specified a sessionid that is no longer active
* (either because it was completed, canceled, or timed out). * (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() { public String toString() {
String result = null; return value;
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;
} }
} }
} }

View file

@ -326,7 +326,7 @@ public class AdHocCommandManager {
// processed packet. We must check if it still in the // processed packet. We must check if it still in the
// map. // map.
if (command != null) { if (command != null) {
long creationStamp = command.getCreationStamp(); long creationStamp = command.getCreationDate();
// Check if the Session data has expired (default is // Check if the Session data has expired (default is
// 10 minutes) // 10 minutes)
// To remove it from the session list it waits for // 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 // Increase the state number, so the command knows in witch
// stage it is // stage it is
command.increaseStage(); command.incrementStage();
// Executes the command // Executes the command
command.execute(); command.execute();
@ -496,7 +496,7 @@ public class AdHocCommandManager {
} }
// Check if the Session data has expired (default is 10 minutes) // 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) { if (System.currentTimeMillis() - creationStamp > SESSION_TIMEOUT * 1000) {
// Remove the expired session // Remove the expired session
executingCommands.remove(sessionId); executingCommands.remove(sessionId);
@ -549,7 +549,7 @@ public class AdHocCommandManager {
command.setData(response); command.setData(response);
if (Action.next.equals(action)) { if (Action.next.equals(action)) {
command.increaseStage(); command.incrementStage();
command.next(new Form(requestData.getForm())); command.next(new Form(requestData.getForm()));
if (command.isLastStage()) { if (command.isLastStage()) {
// If it is the last stage then the command is // If it is the last stage then the command is
@ -562,14 +562,14 @@ public class AdHocCommandManager {
} }
} }
else if (Action.complete.equals(action)) { else if (Action.complete.equals(action)) {
command.increaseStage(); command.incrementStage();
command.complete(new Form(requestData.getForm())); command.complete(new Form(requestData.getForm()));
response.setStatus(Status.completed); response.setStatus(Status.completed);
// Remove the completed session // Remove the completed session
executingCommands.remove(sessionId); executingCommands.remove(sessionId);
} }
else if (Action.prev.equals(action)) { else if (Action.prev.equals(action)) {
command.decreaseStage(); command.decrementStage();
command.prev(); command.prev();
} }
else if (Action.cancel.equals(action)) { else if (Action.cancel.equals(action)) {

View file

@ -21,18 +21,21 @@
package org.jivesoftware.smackx.commands; package org.jivesoftware.smackx.commands;
/** /**
* Notes can be added to a command execution response. A note has to attributes, * Notes can be added to a command execution response. A note has a type and value.
* one is the value or message an the other is the type of the note.
* *
* @author Gabriel Guardincerri * @author Gabriel Guardincerri
*
*/ */
public class AdHocCommandNote { public class AdHocCommandNote {
private Type type; private Type type;
private String value; 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) { public AdHocCommandNote(Type type, String value) {
this.type = type; this.type = type;
this.value = value; this.value = value;
@ -57,10 +60,7 @@ public class AdHocCommandNote {
} }
/** /**
* The types of the notes. * Represents a note type.
*
* @author Gabriel Guardincerri
*
*/ */
public enum Type { public enum Type {
@ -74,7 +74,7 @@ public class AdHocCommandNote {
* The note indicates a warning. Possibly due to illogical (yet valid) * The note indicates a warning. Possibly due to illogical (yet valid)
* data. * data.
*/ */
warm, warn,
/** /**
* The note indicates an error. The text should indicate the reason for * The note indicates an error. The text should indicate the reason for
@ -83,4 +83,4 @@ public class AdHocCommandNote {
error error
} }
} }

View file

@ -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. * 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. * The unique ID of the execution of the command.
@ -65,7 +65,7 @@ public abstract class LocalCommand extends AdHocCommand {
public LocalCommand() { public LocalCommand() {
super(); super();
this.creationStamp = System.currentTimeMillis(); this.creationDate = System.currentTimeMillis();
currenStage = -1; currenStage = -1;
} }
@ -106,13 +106,12 @@ public abstract class LocalCommand extends AdHocCommand {
} }
/** /**
* Returns the time in milliseconds since this command was executed for * Returns the date the command was created.
* first time.
* *
* @return the time in milliseconds since the command was executed for the first time. * @return the date the command was created.
*/ */
public long getCreationStamp() { public long getCreationDate() {
return creationStamp; return creationDate;
} }
@Override @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. * execution of some action will complete the execution of the command.
* *
* @return true if the command is in the last stage. * @return true if the command is in the last stage.
@ -134,7 +133,7 @@ public abstract class LocalCommand extends AdHocCommand {
* not be called. * not be called.
* *
*/ */
void increaseStage() { void incrementStage() {
currenStage++; currenStage++;
} }
@ -143,13 +142,13 @@ public abstract class LocalCommand extends AdHocCommand {
* not be called. * not be called.
* *
*/ */
void decreaseStage() { void decrementStage() {
currenStage--; currenStage--;
} }
/** /**
* Returns the currently executing stage number. The first stage number is * 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. * @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, * 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 * 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 * all the stages of the command. It is not checked again during the

View file

@ -32,7 +32,9 @@ import org.jivesoftware.smackx.packet.AdHocCommandData;
/** /**
* Represents a command that is in a remote location. Invoking one of the * 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 * 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 * 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 * single stage command, then invoking the execute action will execute this
@ -64,12 +66,9 @@ public class RemoteCommand extends AdHocCommand {
* command identified by <code>node</code> in the host identified by * command identified by <code>node</code> in the host identified by
* <code>jid</code> * <code>jid</code>
* *
* @param connection * @param connection the connection to use for the execution.
* the connection to use for the execution. * @param node the identifier of the command.
* @param node * @param jid the JID of the host.
* the identifier of the command.
* @param jid
* the JID of the host.
*/ */
protected RemoteCommand(XMPPConnection connection, String node, String jid) { protected RemoteCommand(XMPPConnection connection, String node, String jid) {
super(); super();
@ -99,7 +98,7 @@ public class RemoteCommand extends AdHocCommand {
* there is a problem executing the command it throws an XMPPException. * there is a problem executing the command it throws an XMPPException.
* *
* @param form the form anwser of the previous stage. * @param form the form anwser of the previous stage.
* @throws XMPPException * @throws XMPPException if an error occurs.
*/ */
public void execute(Form form) throws XMPPException { public void execute(Form form) throws XMPPException {
executeAction(Action.execute, form); executeAction(Action.execute, form);
@ -122,15 +121,16 @@ public class RemoteCommand extends AdHocCommand {
/** /**
* Executes the <code>action</codo> with the <code>form</code>. * Executes the <code>action</codo> with the <code>form</code>.
* The action could be any of the available actions. The form must * 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 <tt>null</tt> if it is the first stage.
*
* @param action the action to execute * @param action the action to execute
* @param form the form with the information * @param form the form with the information
* @throws XMPPException if there is a problem executing the command. * @throws XMPPException if there is a problem executing the command.
*/ */
private void executeAction(Action action, Form form) throws XMPPException { private void executeAction(Action action, Form form) throws XMPPException {
// TODO Check that all the requiered fields of the form were filled, if // TODO: Check that all the required fields of the form were filled, if
// not throw the corresponding exeption. This will make a faster response, // TODO: not throw the corresponding exeption. This will make a faster response,
// since the request is stoped before it's sended. // TODO: since the request is stoped before it's sent.
AdHocCommandData data = new AdHocCommandData(); AdHocCommandData data = new AdHocCommandData();
data.setType(IQ.Type.SET); data.setType(IQ.Type.SET);
data.setTo(getOwnerJID()); data.setTo(getOwnerJID());
@ -142,13 +142,12 @@ public class RemoteCommand extends AdHocCommand {
data.setForm(form.getDataFormToSend()); data.setForm(form.getDataFormToSend());
} }
PacketCollector collector = connection PacketCollector collector = connection.createPacketCollector(
.createPacketCollector(new PacketIDFilter(data.getPacketID())); new PacketIDFilter(data.getPacketID()));
connection.sendPacket(data); connection.sendPacket(data);
Packet response = collector.nextResult(SmackConfiguration Packet response = collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
.getPacketReplyTimeout());
// Cancel the collector. // Cancel the collector.
collector.cancel(); collector.cancel();
@ -168,4 +167,4 @@ public class RemoteCommand extends AdHocCommand {
public String getOwnerJID() { public String getOwnerJID() {
return jid; return jid;
} }
} }

View file

@ -3,7 +3,7 @@
* $Revision: $ * $Revision: $
* $Date: $ * $Date: $
* *
* Copyright 2005-2007 Jive Software. * Copyright 2005-2008 Jive Software.
* *
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); * 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 not use this file except in compliance with the License.
@ -31,10 +31,9 @@ import java.util.ArrayList;
import java.util.List; 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 * @author Gabriel Guardincerri
*
*/ */
public class AdHocCommandData extends IQ { public class AdHocCommandData extends IQ {
@ -121,7 +120,7 @@ public class AdHocCommandData extends IQ {
buf.append("</note>"); buf.append("</note>");
} }
// TODO ERRORES // TODO ERRORS
// if (getError() != null) { // if (getError() != null) {
// buf.append(getError().toXML()); // buf.append(getError().toXML());
// } // }
@ -271,12 +270,10 @@ public class AdHocCommandData extends IQ {
} }
public String toXML() { public String toXML() {
StringBuffer sb = new StringBuffer(); StringBuilder buf = new StringBuilder();
sb.append("<").append(getElementName()); buf.append("<").append(getElementName());
sb.append(" xmlns=\"").append(getNamespace()).append("\"/>"); buf.append(" xmlns=\"").append(getNamespace()).append("\"/>");
return sb.toString(); return buf.toString();
} }
} }
}
}

View file

@ -38,7 +38,6 @@ import org.xmlpull.v1.XmlPullParser;
* *
* @author Gabriel Guardincerri * @author Gabriel Guardincerri
*/ */
public class AdHocCommandDataProvider implements IQProvider { public class AdHocCommandDataProvider implements IQProvider {
public IQ parseIQ(XmlPullParser parser) throws Exception { public IQ parseIQ(XmlPullParser parser) throws Exception {
@ -56,9 +55,11 @@ public class AdHocCommandDataProvider implements IQProvider {
String status = parser.getAttributeValue("", "status"); String status = parser.getAttributeValue("", "status");
if (AdHocCommand.Status.executing.toString().equalsIgnoreCase(status)) { if (AdHocCommand.Status.executing.toString().equalsIgnoreCase(status)) {
adHocCommandData.setStatus(AdHocCommand.Status.executing); 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); 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); adHocCommandData.setStatus(AdHocCommand.Status.canceled);
} }
@ -68,7 +69,8 @@ public class AdHocCommandDataProvider implements IQProvider {
Action realAction = AdHocCommand.Action.valueOf(action); Action realAction = AdHocCommand.Action.valueOf(action);
if (realAction == null || realAction.equals(Action.unknown)) { if (realAction == null || realAction.equals(Action.unknown)) {
adHocCommandData.setAction(Action.unknown); adHocCommandData.setAction(Action.unknown);
} else { }
else {
adHocCommandData.setAction(realAction); adHocCommandData.setAction(realAction);
} }
} }
@ -82,24 +84,31 @@ public class AdHocCommandDataProvider implements IQProvider {
if (execute != null) { if (execute != null) {
adHocCommandData.setExecuteAction(AdHocCommand.Action.valueOf(execute)); adHocCommandData.setExecuteAction(AdHocCommand.Action.valueOf(execute));
} }
} else if (parser.getName().equals("next")) { }
else if (parser.getName().equals("next")) {
adHocCommandData.addAction(AdHocCommand.Action.next); adHocCommandData.addAction(AdHocCommand.Action.next);
} else if (parser.getName().equals("complete")) { }
else if (parser.getName().equals("complete")) {
adHocCommandData.addAction(AdHocCommand.Action.complete); adHocCommandData.addAction(AdHocCommand.Action.complete);
} else if (parser.getName().equals("prev")) { }
else if (parser.getName().equals("prev")) {
adHocCommandData.addAction(AdHocCommand.Action.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)); adHocCommandData.setForm((DataForm) dataFormProvider.parseExtension(parser));
} else if (parser.getName().equals("note")) { }
AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(parser else if (parser.getName().equals("note")) {
.getAttributeValue("", "type")); AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(
parser.getAttributeValue("", "type"));
String value = parser.nextText(); String value = parser.nextText();
adHocCommandData.addNote(new AdHocCommandNote(type, value)); adHocCommandData.addNote(new AdHocCommandNote(type, value));
} else if (parser.getName().equals("error")) { }
else if (parser.getName().equals("error")) {
XMPPError error = PacketParserUtils.parseError(parser); XMPPError error = PacketParserUtils.parseError(parser);
adHocCommandData.setError(error); adHocCommandData.setError(error);
} }
} else if (eventType == XmlPullParser.END_TAG) { }
else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("command")) { if (parser.getName().equals("command")) {
done = true; done = true;
} }