You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2012/10/26 13:52:33 UTC
svn commit: r1402474 [1/2] - in /mina/site/trunk/content: ./ css/ mina/
mina/userguide/ mina/userguide/ch1-getting-started/
mina/userguide/ch12-logging-filter/ mina/userguide/ch14-state-machine/
mina/userguide/ch6-transports/ mina/userguide/ch8-iobuffe...
Author: elecharny
Date: Fri Oct 26 11:52:31 2012
New Revision: 1402474
URL: http://svn.apache.org/viewvc?rev=1402474&view=rev
Log:
Added some icons, replaced the HTML code by a simple DIV for note/info...
Added:
mina/site/trunk/content/mina/userguide/ch14-state-machine/ch14-state-machine.mdtext
mina/site/trunk/content/staticresources/icons/forbidden.gif (with props)
Removed:
mina/site/trunk/content/mina/userguide/ch14-state-machine/ch16-state-machine.mdtext
Modified:
mina/site/trunk/content/css/common.css
mina/site/trunk/content/downloads-mina.mdtext
mina/site/trunk/content/mina/codec-repo.mdtext
mina/site/trunk/content/mina/developper-guide.mdtext
mina/site/trunk/content/mina/downloads.mdtext
mina/site/trunk/content/mina/related-projects.mdtext
mina/site/trunk/content/mina/sources.mdtext
mina/site/trunk/content/mina/userguide/ch1-getting-started/first-steps.mdtext
mina/site/trunk/content/mina/userguide/ch1-getting-started/nio-overview.mdtext
mina/site/trunk/content/mina/userguide/ch12-logging-filter/ch12-logging-filter.mdtext
mina/site/trunk/content/mina/userguide/ch6-transports/apr-transport.mdtext
mina/site/trunk/content/mina/userguide/ch6-transports/serial-transport.mdtext
mina/site/trunk/content/mina/userguide/ch8-iobuffer/ch8-iobuffer.mdtext
mina/site/trunk/content/mina/userguide/codec-repo.mdtext
mina/site/trunk/content/vysper/server_to_server_comm.mdtext
mina/site/trunk/content/vysper/socks5.mdtext
mina/site/trunk/content/vysper/websocket_endpoint.mdtext
Modified: mina/site/trunk/content/css/common.css
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/css/common.css?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/css/common.css (original)
+++ mina/site/trunk/content/css/common.css Fri Oct 26 11:52:31 2012
@@ -364,39 +364,44 @@ th.confluenceTh
text-align: center;
}
-.noteMacro
+.note
{
border: 1px solid #f0c000;
- background-color: #ffffce;
+ background: #ffffce url('../staticresources/icons/warning.gif') no-repeat 5px 5px;
+ text-align: left;
margin-top: 5px;
- margin-bottom: 5px
+ margin-bottom: 5px;
+ padding: 5px 5px 5px 28px;
}
-.warningMacro
+.warning
{
- border: 1px solid #c00;
- background-color: #fcc;
+ border: 1px solid #f0c000;
+ background: #ffffce url('../staticresources/icons/forbidden.gif') no-repeat 5px 5px;
text-align: left;
margin-top: 5px;
- margin-bottom: 5px
+ margin-bottom: 5px;
+ padding: 5px 5px 5px 28px;
}
-.infoMacro
+.info
{
border: 1px solid #3c78b5;
- background-color: #D8E4F1;
+ background: #D8E4F1 url('../staticresources/icons/information.gif') no-repeat 5px 5px;
text-align: left;
margin-top: 5px;
- margin-bottom: 5px
+ margin-bottom: 5px;
+ padding: 5px 5px 5px 28px;
}
-.tipMacro
+.tip
{
border: 1px solid #090;
- background-color: #dfd;
+ background: #dfd url('../staticresources/icons/check.gif') no-repeat 5px 5px;
text-align: left;
margin-top: 5px;
- margin-bottom: 5px
+ margin-bottom: 5px;
+ padding: 5px 5px 5px 28px;
}
.code
Modified: mina/site/trunk/content/downloads-mina.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/downloads-mina.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/downloads-mina.mdtext (original)
+++ mina/site/trunk/content/downloads-mina.mdtext Fri Oct 26 11:52:31 2012
@@ -18,19 +18,9 @@ Notice: Licensed to the Apache Softwa
# Latest MINA Releases
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top"><IMG src="./staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD>
- <TD>
- <B>Be Careful</B><BR>
- The links will redirect you to a list of the nearest mirrors, if a mirror hasn't got the latest version yet due to propagation delay you can try another one.
- </TD>
- </TR>
- </TABLE>
+<DIV class="warning" markdown="1">
+ <B>Be Careful</B><BR>
+ The links will redirect you to a list of the nearest mirrors, if a mirror hasn't got the latest version yet due to propagation delay you can try another one.
</DIV>
## Apache MINA 2.0.7 <FONT color="green">stable</FONT> (Java 5+)
@@ -47,14 +37,18 @@ Notice: Licensed to the Apache Softwa
* .src.tar.bz2 archive [mina-2.0.7](http://mina.apache.org/dyn/closer.cgi/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2) (signatures : [MD5](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.md5) [SHA1](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.sha1) [ASC](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.asc)
* .src.zip archive [mina-2.0.7](http://mina.apache.org/dyn/closer.cgi/mina/2.0.7/apache-mina-2.0.7-src.zip) (signatures : [MD5](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.md5) [SHA1](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.sha1) [ASC](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.asc)
-<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>For people wanting to use the <B>serial</B> package, we don't include the <B>rxtx.jar</B> library in the releases, as it's under a LGPL license. Please download it from <A href="http://rxtx.qbang.org/wiki/index.php/Download" class="external-link" rel="nofollow">http://rxtx.qbang.org/wiki/index.php/Download</A> or add the associated dependency in your maven pom.xml :
+<DIV class="note" markdown="1">
+ For people wanting to use the <B>serial</B> package, we don't include the <B>rxtx.jar</B> library in the releases, as it's under a LGPL license. Please download it from <A href="http://rxtx.qbang.org/wiki/index.php/Download" class="external-link" rel="nofollow">http://rxtx.qbang.org/wiki/index.php/Download</A> or add the associated dependency in your maven pom.xml :
-<P><dependency><BR>
- <groupId>org.rxtx</groupId><BR>
- <artifactId>rxtx</artifactId><BR>
- <version>2.1.7</version><BR>
- <scope>provided</scope><BR>
-</dependency></P></TD></TR></TABLE></DIV>
+ <P>
+ <dependency><BR>
+ <groupId>org.rxtx</groupId><BR>
+ <artifactId>rxtx</artifactId><BR>
+ <version>2.1.7</version><BR>
+ <scope>provided</scope><BR>
+ </dependency>
+ </P>
+</DIV>
<P><FONT color="green"><B>Older versions can be found <A href="http://archive.apache.org/dist/mina/" class="external-link" rel="nofollow">here</A></B></FONT></P>
@@ -62,26 +56,18 @@ Notice: Licensed to the Apache Softwa
The PGP signatures can be verified using PGP or GPG. First download the [KEYS](https://svn.apache.org/repos/asf/mina/KEYS) as well as the asc signature file for the relevant distribution. Then verify the signatures using:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ pgpk -a KEYS
-$ pgpv mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
+ $ pgpk -a KEYS
+ $ pgpv mina-1.2.3.tar.gz.asc
+
<P>or</P>
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ pgp -ka KEYS
-$ pgp mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
+
+ $ pgp -ka KEYS
+ $ pgp mina-1.2.3.tar.gz.asc
+
<P>or</P>
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ gpg --import KEYS
-$ gpg --verify mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
+
+ $ gpg --import KEYS
+ $ gpg --verify mina-1.2.3.tar.gz.asc
# Latest Pre-release Snapshots
@@ -95,7 +81,9 @@ The previous releases can be found [here
The version number of MINA has the following form:
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="./staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><TT><major>.<minor>.<micro>[-M<milestone number> or -RC<release candidate number>]</TT></TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ <TT><major>.<minor>.<micro>[-milestone number> or -RC<release candidate number>]
+</DIV>
This scheme has three number components:
@@ -113,6 +101,8 @@ MINA is not a stand-alone software, so '
Here's an example that illustrates how MINA version number increases:
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="./staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>2.0.0-M1 -> 2.0.0-M3 -> 2.0.0-M3 -> 2.0.0-M4 - 2.0.0-RC1 -> 2.0.0-RC2 -> 2.0.0-RC3 - <B>2.0.0</B> -> 2.0.1 -> 2.0.2 -> 2.1.0-M1 ...</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ 2.0.0-M1 -> 2.0.0-M3 -> 2.0.0-M3 -> 2.0.0-M4 -> 2.0.0-RC1 -> 2.0.0-RC2 -> 2.0.0-RC3 - <B>2.0.0</B> -> 2.0.1 ->; 2.0.2 ->; 2.1.0-M1 ...
+</DIV>
Please note that we always specify the micro number, even if it's zero.
Modified: mina/site/trunk/content/mina/codec-repo.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/codec-repo.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/codec-repo.mdtext (original)
+++ mina/site/trunk/content/mina/codec-repo.mdtext Fri Oct 26 11:52:31 2012
@@ -20,7 +20,9 @@ Notice: Licensed to the Apache Softwa
This page captures known MINA Codecs available. These codecs may not be part of Apache MINA project. The Codecs are for reference purpose only.
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>The Codecs listed here may not be part of Apache MINA project. The information is for MINA Users for reference implementation available over the web</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ The Codecs listed here may not be part of Apache MINA project. The information is for MINA Users for reference implementation available over the web
+</DIV>
## Protocol Codecs
Modified: mina/site/trunk/content/mina/developper-guide.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/developper-guide.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/developper-guide.mdtext (original)
+++ mina/site/trunk/content/mina/developper-guide.mdtext Fri Oct 26 11:52:31 2012
@@ -1,19 +1,7 @@
Please read if you haven't yet before you proceed.
-<div class="panelMacro">
- <table class="noteMacro">
- <colgroup><col width="24"><col></colgroup>
- <tbody>
- <tr>
- <td valign="top">
- <img src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" alt="" align="absmiddle" border="0" height="16" width="16">
- </td>
- <td>
- Please read <a href="http://www.apache.org/dev/" class="external-link" rel="nofollow">the Developer Infrastructure Information</a> if you haven't yet before you proceed.
- </td>
- </tr>
- </tbody>
- </table>
+<DIV class="note" markdown="1">
+ Please read <a href="http://www.apache.org/dev/" class="external-link" rel="nofollow">the Developer Infrastructure Information</a> if you haven't yet before you proceed.
</div>
[TOC]
@@ -177,22 +165,23 @@ run the following commands :
Answer to maven questions :
"What is the release version for "Apache MINA"? (org.apache.mina:mina-parent) 2.0.7-<version>: :"
- <either use the default version as suggested, or type in the version you'd like to be used>
+ <either use the default version as suggested, or type in the version you@qot;d like to be used>
[..]
-*Warning !*
-
-Just after the last module, maven will ask you about the SCM tag :
+<DIV class="info" markdown="1">
+ Just after the last module, maven will ask you about the SCM tag :
What is SCM release tag or label for "Apache MINA"? (org.apache.mina:mina-parent) mina-parent-2.0.7: : 2.0.7
-Do *not* type <enter> to select the default value. Instead, type the correct version.
+ Do *not* type <enter> to select the default value. Instead, type the correct version.
+</DIV>
Then some other questions will be asked, about the next version to use. The default values should be fine.
-{note:title=Be Careful}
-Make sure the change made by the release plugin is correct! (pom.xml, tags created)
-{note}
+<DIV class="info" markdown="1">
+ <B>Be Careful>/B>
+ Make sure the change made by the release plugin is correct! (pom.xml, tags created)
+<DIV>
### Step 3 : Processing with the real release
When the dry run is successful, then you can do in real with the following commands:
@@ -287,10 +276,10 @@ The last step before launching a vote is
Done !
### Step 5 : closing the staging release on nexus
+
Now, you have to close the staged project on nexus. In order to do that you *must* have exported your PGP key to a PGP public server [see](http://www.apache.org/dev/openpgp.html)
-Connect to the Nexus server (https://repository.apache.org), login, and select the MINA staging repository you just created, then click on the
-'close' button. You are home...
+Connect to the Nexus server (https://repository.apache.org), login, and select the MINA staging repository you just created, then click on the 'close' button. You are home...
It's time to launch a vote !
@@ -342,6 +331,7 @@ The vote will be open for 72 hours. Once
### Step 2 : Close the vote
You can officially close the vote now. There are some more steps to fulfill :
+
* Release the project on https://repository.apache.org
* Copy the tarballs and heir signature in people.apache.org /www/www.apache.org/dist/mina
Modified: mina/site/trunk/content/mina/downloads.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/downloads.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/downloads.mdtext (original)
+++ mina/site/trunk/content/mina/downloads.mdtext Fri Oct 26 11:52:31 2012
@@ -18,7 +18,10 @@ Notice: Licensed to the Apache Softwa
# Latest MINA Releases
-<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Be Careful</B><BR>The links will redirect you to a list of the nearest mirrors, if a mirror hasn't got the latest version yet due to propagation delay you can try another one.</TD></TR></TABLE></DIV>
+<DIV class="note" markdown="1">
+ <B>Be Careful</B><BR>
+ The links will redirect you to a list of the nearest mirrors, if a mirror hasn't got the latest version yet due to propagation delay you can try another one.
+</DIV>
## Apache MINA 2.0.7 <FONT color="green">stable</FONT> (Java 5+)
@@ -34,14 +37,16 @@ Notice: Licensed to the Apache Softwa
* .src.tar.bz2 archive [mina-2.0.7](http://mina.apache.org/dyn/closer.cgi/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2) (signatures : [MD5](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.md5) [SHA1](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.sha1) [ASC](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.tar.bz2.asc)
* .src.zip archive [mina-2.0.7](http://mina.apache.org/dyn/closer.cgi/mina/2.0.7/apache-mina-2.0.7-src.zip) (signatures : [MD5](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.md5) [SHA1](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.sha1) [ASC](http://www.apache.org/dist/mina/2.0.7/apache-mina-2.0.7-src.zip.asc)
-<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>For people wanting to use the <B>serial</B> package, we don't include the <B>rxtx.jar</B> library in the releases, as it's under a LGPL license. Please download it from <A href="http://rxtx.qbang.org/wiki/index.php/Download" class="external-link" rel="nofollow">http://rxtx.qbang.org/wiki/index.php/Download</A> or add the associated dependency in your maven pom.xml :
+<DIV class="note" markdown="1">
+ For people wanting to use the <B>serial</B> package, we don't include the <B>rxtx.jar</B> library in the releases, as it's under a LGPL license. Please download it from <A href="http://rxtx.qbang.org/wiki/index.php/Download" class="external-link" rel="nofollow">http://rxtx.qbang.org/wiki/index.php/Download</A> or add the associated dependency in your maven pom.xml :
-<P><dependency><BR>
- <groupId>org.rxtx</groupId><BR>
- <artifactId>rxtx</artifactId><BR>
- <version>2.1.7</version><BR>
- <scope>provided</scope><BR>
-</dependency></P></TD></TR></TABLE></DIV>
+ <dependency>
+ <groupId>org.rxtx</groupId>
+ <artifactId>rxtx</artifactId>
+ <version>2.1.7</version>
+ <scope>provided<scope>
+ </dependency>
+</DIV>
<P><FONT color="green"><B>Older versions can be found <A href="http://archive.apache.org/dist/mina/" class="external-link" rel="nofollow">here</A></B></FONT></P>
@@ -49,26 +54,18 @@ Notice: Licensed to the Apache Softwa
The PGP signatures can be verified using PGP or GPG. First download the [KEYS](https://svn.apache.org/repos/asf/mina/KEYS) as well as the asc signature file for the relevant distribution. Then verify the signatures using:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ pgpk -a KEYS
-$ pgpv mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
-<P>or</P>
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ pgp -ka KEYS
-$ pgp mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
-<P>or</P>
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-none">
-$ gpg --import KEYS
-$ gpg --verify mina-1.2.3.tar.gz.asc
-</PRE>
-</DIV></DIV>
+ $ pgpk -a KEYS
+ $ pgpv mina-1.2.3.tar.gz.asc
+
+or
+
+ $ pgp -ka KEYS
+ $ pgp mina-1.2.3.tar.gz.asc
+
+or
+
+ $ gpg --import KEYS
+ $ gpg --verify mina-1.2.3.tar.gz.asc
# Latest Pre-release Snapshots
@@ -82,7 +79,9 @@ The previous releases can be found [here
The version number of MINA has the following form:
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><TT><major>.<minor>.<micro>[-M<milestone number> or -RC<release candidate number>]</TT></TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ <major>.<minor>.<micro> \[-M<milestone number> or -RC<release candidate number>]
+</DIV>
This scheme has three number components:
@@ -100,6 +99,8 @@ MINA is not a stand-alone software, so '
Here's an example that illustrates how MINA version number increases:
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>2.0.0-M1 -> 2.0.0-M3 -> 2.0.0-M3 -> 2.0.0-M4 - 2.0.0-RC1 -> 2.0.0-RC2 -> 2.0.0-RC3 - <B>2.0.0</B> -> 2.0.1 -> 2.0.2 -> 2.1.0-M1 ...</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ 2.0.0-M1 -> 2.0.0-M3 -> 2.0.0-M3 -> 2.0.0-M4 -> 2.0.0-RC1 -> 2.0.0-RC2 -> 2.0.0-RC3 -> <B>2.0.0</B> -> 2.0.1 -> 2.0.2 -> 2.1.0-M1 ...
+</DIV>
Please note that we always specify the micro number, even if it's zero.
Modified: mina/site/trunk/content/mina/related-projects.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/related-projects.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/related-projects.mdtext (original)
+++ mina/site/trunk/content/mina/related-projects.mdtext Fri Oct 26 11:52:31 2012
@@ -18,36 +18,13 @@ Notice: Licensed to the Apache Softwa
This page lists the projects which use Apache MINA as its networking layer. Please contact us if you are using MINA and you want to add a link to this page. You could also read the users' testimonials. To compare MINA to other network application frameworks, please refer to the 'Other network application frameworks' section below.
-## <a name="toc" />Table of Contents
-
-* [Table of Contents](#toc)
-* [Other network application frameworks](#Othernetworkapplicationframeworks)
- * [Grizzly](#Grizzly)
- * [Netty 3](#Netty3)
- * [NIO Framework](#NIOFramework)
- * [QuickServer](#QuickServer)
- * [xSocket](#xSocket)
-* [Messaging](#Messaging)
- * [Apache Camel](#ApacheCamel)
- * [Apache Qpid (incubating)](#ApacheQpid)
- * [Avis](#Avis)
- * [MailsterSMTP](#MailsterSMTP)
-* [Instant Messaging](#InstantMessaging)
- * [Jive Software Openfire](#JiveSoftwareOpenfire)
-* [Media Storage & Streaming](#MediaStorageStreaming)
- * [OpenLSD](#OpenLSD)
- * [Red5](#Red5)
-* [Finance](#Finance)
- * [QuickFIX/J](#QuickFIXJ)
-* [Miscellaneous](#Miscellaneous)
- * [Apache Directory Project](#ApacheDirectoryProject)
- * [Beep4j](#Beep4j)
- * [VFS FTPServer Bridge](#VFSFTPServerBridge)
- * [HDFS over FTP](#HDFSoverFTP)
+[TOC]
## <a name="Othernetworkapplicationframeworks" />Other network application frameworks
-<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>The projects referred in this section 'Other network application frameworks' are <B>not</B> based on MINA but are their own network application frameworks. These links are provided for users who want to compare MINA to other network application frameworks.</TD></TR></TABLE></DIV>
+<DIV class="note" markdown="1">
+ The projects referred in this section 'Other network application frameworks' are <B>not</B> based on MINA but are their own network application frameworks. These links are provided for users who want to compare MINA to other network application frameworks.
+</DIV>
### <a name="Grizzly"/>[Grizzly](https://grizzly.dev.java.net/)
Modified: mina/site/trunk/content/mina/sources.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/sources.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/sources.mdtext (original)
+++ mina/site/trunk/content/mina/sources.mdtext Fri Oct 26 11:52:31 2012
@@ -34,33 +34,15 @@ Again, anyone can do this. Use a command
### For MINA
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- svn checkout http://svn.apache.org/repos/asf/mina/mina/trunk
- </PRE>
- </DIV>
-</DIV>
+ svn checkout http://svn.apache.org/repos/asf/mina/mina/trunk
### For FtpServer
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- svn checkout http://svn.apache.org/repos/asf/mina/ftpserver/trunk
- </PRE>
- </DIV>
-</DIV>
+ svn checkout http://svn.apache.org/repos/asf/mina/ftpserver/trunk
### For AsyncWeb
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- svn checkout http://svn.apache.org/repos/asf/mina/asyncweb/trunk
- </PRE>
- </DIV>
-</DIV>
+ svn checkout http://svn.apache.org/repos/asf/mina/asyncweb/trunk
# Building MINA
@@ -147,54 +129,23 @@ Any __MINA__ committer should have a she
Once your password is set, you can use a command like this to commit:
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- svn commit
- </PRE>
- </DIV>
-</DIV>
+ svn commit
If Subversion can't figure out your username, you can tell it explicitly:
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- svn --username you commit
- </PRE>
- </DIV>
-</DIV>
+ svn --username you commit
Subversion will prompt you for a password, and once you enter it once, it will remember it for you. Note this is the password you configured with svnpasswd, not your shell or other password.
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"/>
- <COL/>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"/>
- </TD>
- <TD>
- For committers to be able to commit modification, they should have had checked out the project files using <B>https</B> instead of <B>http</B>.
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ For committers to be able to commit modification, they should have had checked out the project files using <B>https</B> instead of <B>http</B>.
</DIV>
## Access from behind a firewall
For those users who are stuck behind a corporate firewall which is blocking http access to the Subversion repository, you can try to access it via the developer connection:
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- $ svn checkout https://svn.apache.org/repos/asf/mina/mina/tags/2.0.5 mina-2.0.5
- </PRE>
- </DIV>
-</DIV>
+ $ svn checkout https://svn.apache.org/repos/asf/mina/mina/tags/2.0.5 mina-2.0.5
## Access through a proxy
@@ -204,12 +155,6 @@ There are comments in the file explainin
Example : Edit the 'servers' file and add something like :
-<DIV class="preformatted panel" style="border-width: 1px;">
- <DIV class="preformattedContent panelContent">
- <PRE>
- [global]
- http-proxy-host = your.proxy.name
- http-proxy-port = 3128
- </PRE>
- </DIV>
-</DIV>
+ [global]
+ http-proxy-host = your.proxy.name
+ http-proxy-port = 3128
Modified: mina/site/trunk/content/mina/userguide/ch1-getting-started/first-steps.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch1-getting-started/first-steps.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch1-getting-started/first-steps.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch1-getting-started/first-steps.mdtext Fri Oct 26 11:52:31 2012
@@ -76,28 +76,15 @@ Put the following jars in the classpath
* slf4j-log4j12-1.6.6.jar
* log4j-1.2.17.jar
-<DIV class="panelMacro">
- <TABLE class="tipMacro">
- <COLGROUP>
- <COL width="24">
- <COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- <B>Logging Tip</B><BR>
- Log4J 1.2 users: slf4j-api.jar, slf4j-log4j12.jar, and Log4J 1.2.x<BR>
- Log4J 1.3 users: slf4j-api.jar, slf4j-log4j13.jar, and Log4J 1.3.x<BR>
- java.util.logging users: slf4j-api.jar and slf4j-jdk14.jar<BR>
- IMPORTANT: Please make sure you are using the right slf4j-*.jar that matches to your logging framework.<BR>
- For instance, slf4j-log4j12.jar and log4j-1.3.x.jar can not be used together, and will malfunction.<BR>
- If you don't need a logging framework you can use slf4j-nop.jar for no logging or slf4j-simple.jar for<BR>
- very basic logging.
- </TD>
- </TR>
- </TABLE>
+<DIV class="tip" markdown="1">
+ <B>Logging Tip</B><BR>
+ * Log4J 1.2 users: slf4j-api.jar, slf4j-log4j12.jar, and Log4J 1.2.x<BR/>
+ * Log4J 1.3 users: slf4j-api.jar, slf4j-log4j13.jar, and Log4J 1.3.x<BR/>
+ * java.util.logging users: slf4j-api.jar and slf4j-jdk14.jar<BR/>
+ IMPORTANT: Please make sure you are using the right slf4j-*.jar that matches to your logging framework.<BR>
+ For instance, slf4j-log4j12.jar and log4j-1.3.x.jar can not be used together, and will malfunction.<BR>
+ If you don't need a logging framework you can use slf4j-nop.jar for no logging or slf4j-simple.jar for<BR>
+ very basic logging.
</DIV>
On the command prompt, issue the following command :
Modified: mina/site/trunk/content/mina/userguide/ch1-getting-started/nio-overview.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch1-getting-started/nio-overview.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch1-getting-started/nio-overview.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch1-getting-started/nio-overview.mdtext Fri Oct 26 11:52:31 2012
@@ -24,36 +24,12 @@ Notice: Licensed to the Apache Softwa
**NIO** _API_'s were introduced in **Java 1.4** and had since been used for wide number of applications. **NIO** _API_'s allows **IO** non-blocking operations.
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- First of all, it's good to know that **MINA** is written on top of **NIO 1**. A new version has been designed in **Java 7**, **NIO-2**, we don't yet benefit from the added features this version is carrying.
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ First of all, it's good to know that **MINA** is written on top of **NIO 1**. A new version has been designed in **Java 7**, **NIO-2**, we don't yet benefit from the added features this version is carrying.
</DIV>
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- It's also important to know that the **N** in **NIO** means **New**, but we will use the **Non-Blocking** term in many places. **NIO-2** should be seen as a **New** **New** **I/O**...
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ It's also important to know that the **N** in **NIO** means **New**, but we will use the **Non-Blocking** term in many places. **NIO-2** should be seen as a **New** **New** **I/O**...
</DIV>
The `java.nio.*` package contains following key constructs
Modified: mina/site/trunk/content/mina/userguide/ch12-logging-filter/ch12-logging-filter.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch12-logging-filter/ch12-logging-filter.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch12-logging-filter/ch12-logging-filter.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch12-logging-filter/ch12-logging-filter.mdtext Fri Oct 26 11:52:31 2012
@@ -90,7 +90,9 @@ For this example we will use the log4j l
This file will be placed in the src directory of our project. If you are using an IDE, you essentially want the configuration file to be in the classpath for the JVM when you are testing your code.
-<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Although this shows you how to set up an <TT>IoAcceptor</TT> to use logging, understand that the SLF4J API may be used anywhere in your program in order to generate proper logging information suitable to your needs.</TD></TR></TABLE></DIV>
+<DIV class="note" markdown="1">
+ Although this shows you how to set up an <TT>IoAcceptor</TT> to use logging, understand that the SLF4J API may be used anywhere in your program in order to generate proper logging information suitable to your needs.
+</DIV>
Next we will set up a simple example server in order to generate some logs. Here we have taken the EchoServer example project and added logging to the class:
Added: mina/site/trunk/content/mina/userguide/ch14-state-machine/ch14-state-machine.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch14-state-machine/ch14-state-machine.mdtext?rev=1402474&view=auto
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch14-state-machine/ch14-state-machine.mdtext (added)
+++ mina/site/trunk/content/mina/userguide/ch14-state-machine/ch14-state-machine.mdtext Fri Oct 26 11:52:31 2012
@@ -0,0 +1,533 @@
+Title: Chapter 14 - State Machine
+NavUp: ../user-guide-toc.html
+NavUpText: User Guide
+NavPrev: ../ch13-debugging/ch13-debugging.html
+NavPrevText: Chapter 13 - Debugging
+NavNext: ../ch15-proxy/ch15-proxy.html
+NavNextText: Chapter 15 - Proxy
+Notice: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ .
+ http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+# Chapter 14 - State Machine
+
+If you are using MINA to develop an application with complex network interactions you may at some point find yourself reaching for the good old [State pattern](http://home.earthlink.net/~huston2/dp/state.html) to try to sort out some of that complexity. However, before you do that you might want to checkout mina-statemachine which tries to address some of the shortcomings of the State pattern.
+
+[TOC]
+
+## A simple example
+
+Let's demonstrate how mina-statemachine works with a simple example. The picture below shows a state machine for a typical tape deck. The ellipsis are the states while the arrows are the transitions. Each transition is labeled with an event name which triggers that transition.
+
+
+
+Initially, the tape deck is in the __Empty__ state. When a tape is inserted the __load__ event is fired and the tape deck moves to the __Loaded__ state. In __Loaded__ the __eject__ event will trigger a move back to __Empty__ while the __play__ event will trigger a move to the __Playing__ state. And so on... I think you can work out the rest on your own.
+
+Now let's write some code. The outside world (the code interfacing with the tape deck) will only see the TapeDeck interface:
+
+ public interface TapeDeck {
+ void load(String nameOfTape);
+ void eject();
+ void start();
+ void pause();
+ void stop();
+ }
+
+Next we will write the class which contains the actual code executed when a transition occurs in the state machine. First we will define the states. The states are all defined as constant String objects and are annotated using the @State annotation:
+
+ public class TapeDeckHandler {
+ @State public static final String EMPTY = "Empty";
+ @State public static final String LOADED = "Loaded";
+ @State public static final String PLAYING = "Playing";
+ @State public static final String PAUSED = "Paused";
+ }
+
+Now when we have the states defined we can set up the code corresponding to each transition. Each transition will correspond to a method in TapeDeckHandler. Each transition method is annotated using the @Transition annotation which defines the event id which triggers the transition (on), the start state of the transition (in) and the end state of the transition (next):
+
+ public class TapeDeckHandler {
+ @State public static final String EMPTY = "Empty";
+ @State public static final String LOADED = "Loaded";
+ @State public static final String PLAYING = "Playing";
+ @State public static final String PAUSED = "Paused";
+
+ @Transition(on = "load", in = EMPTY, next = LOADED)
+ public void loadTape(String nameOfTape) {
+ System.out.println("Tape '" + nameOfTape + "' loaded");
+ }
+
+ @Transitions({
+ @Transition(on = "play", in = LOADED, next = PLAYING),
+ @Transition(on = "play", in = PAUSED, next = PLAYING)
+ })
+ public void playTape() {
+ System.out.println("Playing tape");
+ }
+
+ @Transition(on = "pause", in = PLAYING, next = PAUSED)
+ public void pauseTape() {
+ System.out.println("Tape paused");
+ }
+
+ @Transition(on = "stop", in = PLAYING, next = LOADED)
+ public void stopTape() {
+ System.out.println("Tape stopped");
+ }
+
+ @Transition(on = "eject", in = LOADED, next = EMPTY)
+ public void ejectTape() {
+ System.out.println("Tape ejected");
+ }
+ }
+
+Please note that the TapeDeckHandler class does not implement the TapeDeck interface. That's intentional.
+
+Now, let's have a closer look at some of this code. The @Transition annotation on the loadTape method
+
+ @Transition(on = "load", in = EMPTY, next = LOADED)
+ public void loadTape(String nameOfTape) {
+
+specifies that when the tape deck is in the EMPTY state and the load event occurs the loadTape method will be invoked and then the tape deck will move on to the LOADED state. The @Transition annotations on the pauseTape, stopTape and ejectTape methods should not require any further explanation. The annotation on the playTape method looks slightly different though. As can be seen in the diagram above, when the tape deck is in either the LOADED or in the PAUSED state the play event will play the tape. To have the same method called for multiple transitions the @Transitions annotation has to be used:
+
+ @Transitions({
+ @Transition(on = "play", in = LOADED, next = PLAYING),
+ @Transition(on = "play", in = PAUSED, next = PLAYING)
+ })
+ public void playTape() {
+
+The @Transitions annotation simply lists multiple transitions for which the annotated method will be called.
+
+<DIV class="info" markdown="1">
+ <B>More about the @Transition parameters</B><BR>
+ <UL>
+ <LI>If you omit the <TT>on</TT> parameter it will default to "*" which will match any event.</LI>
+ <LI>If you omit the <TT>next</TT> parameter it will default to "_<EM>self</EM>_" which is an alias for the current state. To create a loop transition in your state machine all you have to do is to omit the <TT>next</TT> parameter.</LI>
+ <LI>The <TT>weight</TT> parameter can be used to define in what order transitions will be searched. Transitions for a particular state will be ordered in ascending order according to their <TT>weight</TT> value. <TT>weight</TT> is 0 by default.</LI>
+ </UL>
+</DIV>
+
+Now the final step is to create a StateMachine object from the annotated class and use it to create a proxy object which implements TapeDeck:
+
+ public static void main(String[] args) {
+ TapeDeckHandler handler = new TapeDeckHandler();
+ StateMachine sm = StateMachineFactory.getInstance(Transition.class).create(TapeDeckHandler.EMPTY, handler);
+ TapeDeck deck = new StateMachineProxyBuilder().create(TapeDeck.class, sm);
+
+ deck.load("The Knife - Silent Shout");
+ deck.play();
+ deck.pause();
+ deck.play();
+ deck.stop();
+ deck.eject();
+ }
+
+The lines
+
+ TapeDeckHandler handler = new TapeDeckHandler();
+ StateMachine sm = StateMachineFactory.getInstance(Transition.class).create(TapeDeckHandler.EMPTY, handler);
+
+creates the StateMachine instance from an instance of TapeDeckHandler. The Transition.class in the call to StateMachineFactory.getInstance(...) tells the factory that we've used the @Transition annotation to build the state machine. We specify EMPTY as the start state. A StateMachine is basically a directed graph. State objects correspond to nodes in the graph while Transition objects correspond to edges. Each @Transition annotation we used in the TapeDeckHandler will correspond to a Transition instance.
+
+<DIV class="info" markdown="1">
+ <B>Uhhm, what's the difference between @Transition and Transition?</B><BR>
+ <TT>@Transition</TT> is the annotation you use to mark a method which should be used when a transition between states occur. Behind the scenes <TT>mina-statemachine</TT> will create instances of the <TT>MethodTransition</TT> class for each <TT>@Transition</TT> annotated method. <TT>MethodTransition</TT> implements the <TT>Transition</TT> interface. As a <TT>mina-statemachine</TT> user you will never use the <TT>Transition</TT> or <TT>MethodTransition</TT> types directly.
+</DIV>
+
+The TapeDeck instance is created by calling StateMachineProxyBuilder:
+
+ TapeDeck deck = new StateMachineProxyBuilder().create(TapeDeck.class, sm);
+
+The StateMachineProxyBuilder.create() method takes the interfaces the returned proxy object should implement and the StateMachine instance which will receive the events generated by the method calls on the proxy.
+
+When the code is executed the output should be:
+
+ Tape 'The Knife - Silent Shout' loaded
+ Playing tape
+ Tape paused
+ Playing tape
+ Tape stopped
+ Tape ejected
+
+<DIV class="info" markdown="1">
+ <B>What does all this have to do with MINA?</B><BR>
+ As you might have noticed there's nothing MINA specific about this example. But don't be alarmed. Later on we will see how to create state machines for MINA's <TT>IoHandler</TT> interface.
+</DIV>
+
+# How does it work?
+
+Let's walk through what happens when a method is called on the proxy.
+
+## Lookup a StateContext object
+
+The StateContext object is important because it holds the current State. When a method is called on the proxy it will ask a StateContextLookup instance to get the StateContext from the method's arguments. Normally, the StateContextLookup implementation will loop through the method arguments and look for a particular type of object and use it to retrieve a StateContext object. If no StateContext has been assigned yet the StateContextLookup will create one and store it in the object.
+
+When proxying MINA's IoHandler we will use a IoSessoinStateContextLookup instance which looks for an IoSession in the method arguments. It will use the IoSession's attributes to store a separate instance of StateContext for each MINA session. That way the same state machine can be used for all MINA sessions without them interfering with each other.
+
+<DIV class="note" markdown="1">
+ In the example above we never specified what <TT>StateContextLookup</TT> implementation to use when we created the proxy using <TT>StateMachineProxyBuilder</TT>. If not specified a <TT>SingletonStateContextLookup</TT> will be used. <TT>SingletonStateContextLookup</TT> totally disregards the method arguments passed to it – it'll always return the same <TT>StateContext</TT> object. Obviously this won't be very useful when the same state machine is used concurrently by many clients as will be the case when we proxy <TT>IoHandler</TT> later on.
+</DIV>
+
+## Convert the method invocation into an Event object
+
+All method invocations on the proxy object will be translated into Event objects by the proxy. An Event has an id and zero or more arguments. The id corresponds to the name of the method and the event arguments correspond to the method arguments. The method call deck.load("The Knife - Silent Shout") corresponds to the event {id = "load", arguments = ["The Knife - Silent Shout"]}. The Event object also contains a reference to the StateContext object looked up previously.
+
+## Invoke the StateMachine
+
+Once the Event object has been created the proxy will call StateMachine.handle(Event). StateMachine.handle(Event) loops through the Transition objects of the current State in search for a Transition instance which accepts the current Event. This process will stop after a Transition has been found. The Transition objects will be searched in order of weight (typically specified by the @Transition annotation).
+
+## Execute the Transition
+
+The final step is to call Transition.execute(Event) on the Transition which matched the Event. After the Transition has been executed the StateMachine will update the current State with the end state defined by the Transition.
+
+<DIV class="info" markdown="1">
+ <TT>Transition</TT> is an interface. Every time you use the <TT>@Transition</TT> annotation a <TT>MethodTransition</TT> object will be created.
+</DIV>
+
+# MethodTransition
+
+MethodTransition is very important and requires some further explanation. MethodTransition matches an Event if the event's id matches the on parameter of the @Transition annotation and the annotated method's arguments are assignment compatible with a subset of the event's arguments.
+
+So, if the Event looks like {id = "foo", arguments = [a, b, c]} the method
+
+ @Transition(on = "foo")
+ public void someMethod(One one, Two two, Three three) { ... }
+
+matches if and only if ((a instanceof One && b instanceof Two && c instanceof Three) == true). On match the method will be called with the matching event arguments bound to the method's arguments:
+
+ someMethod(a, b, c);
+
+<DIV class="info" markdown="1">
+ <TT>Integer</TT>, <TT>Double</TT>, <TT>Float</TT>, etc also match their primitive counterparts <TT>int</TT>, <TT>double</TT>, <TT>float</TT>, etc.
+</DIV>
+
+As stated above also a subset would match:
+
+ @Transition(on = "foo")
+ public void someMethod(Two two) { ... }
+
+matches if ((a instanceof Two || b instanceof Two || c instanceof Two) == true). In this case the first matching event argument will be bound to the method argument named two when someMethod is called.
+
+A method which takes no arguments always matches if the event id matches:
+
+ @Transition(on = "foo")
+ public void someMethod() { ... }
+
+To make things even more complicated the first two method arguments also matches against the Event class and the StateContext interface. This means that
+
+ @Transition(on = "foo")
+ public void someMethod(Event event, StateContext context, One one, Two two, Three three) { ... }
+ @Transition(on = "foo")
+ public void someMethod(Event event, One one, Two two, Three three) { ... }
+ @Transition(on = "foo")
+ public void someMethod(StateContext context, One one, Two two, Three three) { ... }
+
+also matches the Event {id = "foo", arguments = [a, b, c]} if ((a instanceof One && b instanceof Two && c instanceof Three) == true). The current Event object will be bound to the event method argument and the current StateContext will be bound to context when someMethod is invoked.
+
+As before a subset of the event arguments can be used. Also, a specific StateContext implementation may be specified instead of using the generic interface:
+
+ @Transition(on = "foo")
+ public void someMethod(MyStateContext context, Two two) { ... }
+
+<DIV class="note" markdown="1">
+ The order of the method arguments is important. If the method needs access to the current <TT>Event</TT> it must be specified as the first method argument. <TT>StateContext</TT> has to be the either the second arguments if the first is <TT>Event</TT> or the first argument. The event arguments also have to match in the correct order. <TT>MethodTransition</TT> will not try to reorder the event's arguments in search for a match.
+</DIV>
+
+If you've made it this far, congratulations! I realize that the section above might be a little hard to digest. Hopefully some examples could make things clearer:
+
+Consider the Event {id = "messageReceived", arguments = [ArrayList a = [...], Integer b = 1024]}. The following methods match this Event:
+
+ // All method arguments matches all event arguments directly
+ @Transition(on = "messageReceived")
+ public void messageReceived(ArrayList l, Integer i) { ... }
+
+ // Matches since ((a instanceof List && b instanceof Number) == true)
+ @Transition(on = "messageReceived")
+ public void messageReceived(List l, Number n) { ... }
+
+ // Matches since ((b instanceof Number) == true)
+ @Transition(on = "messageReceived")
+ public void messageReceived(Number n) { ... }
+
+ // Methods with no arguments always matches
+ @Transition(on = "messageReceived")
+ public void messageReceived() { ... }
+
+ // Methods only interested in the current Event or StateContext always matches
+ @Transition(on = "messageReceived")
+ public void messageReceived(StateContext context) { ... }
+
+ // Matches since ((a instanceof Collection) == true)
+ @Transition(on = "messageReceived")
+ public void messageReceived(Event event, Collection c) { ... }
+
+The following would not match:
+
+ // Incorrect ordering
+ @Transition(on = "messageReceived")
+ public void messageReceived(Integer i, List l) { ... }
+
+ // ((a instanceof LinkedList) == false)
+ @Transition(on = "messageReceived")
+ public void messageReceived(LinkedList l, Number n) { ... }
+
+ // Event must be first argument
+ @Transition(on = "messageReceived")
+ public void messageReceived(ArrayList l, Event event) { ... }
+
+ // StateContext must be second argument if Event is used
+ @Transition(on = "messageReceived")
+ public void messageReceived(Event event, ArrayList l, StateContext context) { ... }
+
+ // Event must come before StateContext
+ @Transition(on = "messageReceived")
+ public void messageReceived(StateContext context, Event event) { ... }
+
+## State inheritance
+
+State instances may have a parent State. If StateMachine.handle(Event) cannot find a Transition matching the current Event in the current State it will search the parent State. If no match is found there either the parent's parent will be searched and so on.
+
+This feature is useful when you want to add some generic code to all states without having to specify @Transition annotations for each state. Here's how you create a hierarchy of states using the @State annotation:
+
+ @State public static final String A = "A";
+ @State(A) public static final String B = "A->B";
+ @State(A) public static final String C = "A->C";
+ @State(B) public static final String D = "A->B->D";
+ @State(C) public static final String E = "A->C->E";
+
+## Error handling using state inheritance
+
+Let's go back to the TapeDeck example. What happens if you call deck.play() when there's no tape in the deck? Let's try:
+
+ public static void main(String[] args) {
+ ...
+ deck.load("The Knife - Silent Shout");
+ deck.play();
+ deck.pause();
+ deck.play();
+ deck.stop();
+ deck.eject();
+ deck.play();
+ }
+
+ ...
+ Tape stopped
+ Tape ejected
+ Exception in thread "main" o.a.m.sm.event.UnhandledEventException:
+ Unhandled event: org.apache.mina.statemachine.event.Event@15eb0a9[id=play,...]
+ at org.apache.mina.statemachine.StateMachine.handle(StateMachine.java:285)
+ at org.apache.mina.statemachine.StateMachine.processEvents(StateMachine.java:142)
+ ...
+
+Oops! We get an UnhandledEventException because when we're in the Empty state there's no transition which handles the play event. We could add a special transition to all states which handles unmatched Event objects:
+
+ @Transitions({
+ @Transition(on = "*", in = EMPTY, weight = 100),
+ @Transition(on = "*", in = LOADED, weight = 100),
+ @Transition(on = "*", in = PLAYING, weight = 100),
+ @Transition(on = "*", in = PAUSED, weight = 100)
+ })
+ public void error(Event event) {
+ System.out.println("Cannot '" + event.getId() + "' at this time");
+ }
+
+Now when you run the main() method above you won't get an exception. The output should be:
+
+ ...
+ Tape stopped
+ Tape ejected
+ Cannot 'play' at this time.
+
+Now this seems to work very well, right? But what if we had 30 states instead of only 4? Then we would need 30 @Transition annotations on the error() method. Not good. Let's use state inheritance instead:
+
+ public static class TapeDeckHandler {
+ @State public static final String ROOT = "Root";
+ @State(ROOT) public static final String EMPTY = "Empty";
+ @State(ROOT) public static final String LOADED = "Loaded";
+ @State(ROOT) public static final String PLAYING = "Playing";
+ @State(ROOT) public static final String PAUSED = "Paused";
+
+ ...
+
+ @Transition(on = "*", in = ROOT)
+ public void error(Event event) {
+ System.out.println("Cannot '" + event.getId() + "' at this time");
+ }
+ }
+
+The result will be the same but things will be much easier to maintain whith this last approach.
+
+## mina-statemachine with IoHandler
+
+Now we're going to convert our tape deck into a TCP server and extend it with some more functionality. The server will receive commands like load <tape>, play, stop, etc. The responses will either be positive + <message> or negative - <message>. The protocol is text based, all commands and responses are lines of UTF-8 text terminated by CRLF (i.e. \r\n in Java). Here's an example session:
+
+ telnet localhost 12345
+ S: + Greetings from your tape deck!
+ C: list
+ S: + (1: "The Knife - Silent Shout", 2: "Kings of convenience - Riot on an empty street")
+ C: load 1
+ S: + "The Knife - Silent Shout" loaded
+ C: play
+ S: + Playing "The Knife - Silent Shout"
+ C: pause
+ S: + "The Knife - Silent Shout" paused
+ C: play
+ S: + Playing "The Knife - Silent Shout"
+ C: info
+ S: + Tape deck is playing. Current tape: "The Knife - Silent Shout"
+ C: eject
+ S: - Cannot eject while playing
+ C: stop
+ S: + "The Knife - Silent Shout" stopped
+ C: eject
+ S: + "The Knife - Silent Shout" ejected
+ C: quit
+ S: + Bye! Please come back!
+
+The complete code for the TapeDeckServer described in this section is available in the org.apache.mina.example.tapedeck package in the mina-example module in the Subversion repository. The code uses a MINA ProtocolCodecFilter to convert bytes from/to Command objects. There is one Command implementation for each type of request the server recognizes. We will not describe the codec implementation here in any detail.
+
+Now, let's have a look at how this server works. The important class which implements the state machine is the TapeDeckServer class. The first thing we do is to define the states:
+
+ @State public static final String ROOT = "Root";
+ @State(ROOT) public static final String EMPTY = "Empty";
+ @State(ROOT) public static final String LOADED = "Loaded";
+ @State(ROOT) public static final String PLAYING = "Playing";
+ @State(ROOT) public static final String PAUSED = "Paused";
+
+Nothing new there. However, the methods which handle the events now look different. Let's look at the playTape method:
+
+ @IoHandlerTransitions({
+ @IoHandlerTransition(on = MESSAGE_RECEIVED, in = LOADED, next = PLAYING),
+ @IoHandlerTransition(on = MESSAGE_RECEIVED, in = PAUSED, next = PLAYING)
+ })
+ public void playTape(TapeDeckContext context, IoSession session, PlayCommand cmd) {
+ session.write("+ Playing \"" + context.tapeName + "\"");
+ }
+
+This code doesn't use the general @Transition and @Transitions annotations used previously but rather the MINA specific @IoHandlerTransition and @IoHandlerTransitions annotations. This are preferred when creating state machines for MINA's IoHandler interface as they let you use a Java enum for the event ids instead of strings as we used before. There are also corresponding annotations for MINA's IoFilter interface.
+
+We're now using MESSAGE_RECEIVED instead of "play" for the event name (the on attribute in @IoHandlerTransition). This constant is defined in org.apache.mina.statemachine.event.IoHandlerEvents and has the value "messageReceived" which of course corresponds to the messageReceived() method in MINA's IoHandler interface. Thanks to Java5's static imports we don't have to write out the name of the class holding the constant. We just need to put the
+
+ import static org.apache.mina.statemachine.event.IoHandlerEvents.*;
+
+statement in the imports section.
+
+Another thing that has changed is that we're using a custom StateContext implementation, TapeDeckContext. This class is used to keep track of the name of the current tape:
+
+ static class TapeDeckContext extends AbstractStateContext {
+ public String tapeName;
+ }
+
+<DIV class="info" markdown="1">
+ <B>Why not store tape name in IoSession?</B><BR>
+ We could have stored the name of the tape as an attribute in the <TT>IoSession</TT> but using a custom <TT>StateContext</TT> is recommended since it provides type safety.
+</DIV>
+
+The last thing to note about the playTape() method is that it takes a PlayCommand as its last argument. The last argument corresponds to the message argument of IoHandler's messageReceived(IoSession session, Object message) method. This means that playTape() method will only be called if the bytes sent by the client can be decoded as a PlayCommand.
+
+Before the tape deck can play anything a tape has to be loaded. When a LoadCommand is received from the client the supplied tape number will be used to get the name of the tape to load from the tapes array of available tapes:
+
+ @IoHandlerTransition(on = MESSAGE_RECEIVED, in = EMPTY, next = LOADED)
+ public void loadTape(TapeDeckContext context, IoSession session, LoadCommand cmd) {
+ if (cmd.getTapeNumber() < 1 || cmd.getTapeNumber() > tapes.length) {
+ session.write("- Unknown tape number: " + cmd.getTapeNumber());
+ StateControl.breakAndGotoNext(EMPTY);
+ } else {
+ context.tapeName = tapes[cmd.getTapeNumber() - 1];
+ session.write("+ \"" + context.tapeName + "\" loaded");
+ }
+ }
+
+This code uses the StateControl class to override the next state. If the user specify an unknown tape number we shouldn't move to the LOADED state but instead remain in EMPTY which is what the
+
+ StateControl.breakAndGotoNext(EMPTY);
+
+line does. The StateControl class is described more in a later section.
+
+The connect() method will always be called at the start of a session when MINA calls sessionOpened() on the IoHandler:
+
+ @IoHandlerTransition(on = SESSION_OPENED, in = EMPTY)
+ public void connect(IoSession session) {
+ session.write("+ Greetings from your tape deck!");
+ }
+
+All it does is to write the greeting to the client. The state machine will remain in the EMPTY state.
+
+The pauseTape(), stopTape() and ejectTape() methods are very similar to playTape() and won't be described in any detail. The listTapes(), info() and quit() methods should be simple enough to understand by now, too. Please note how these last three methods are used for the ROOT state. This means that the list, info and quit commands can be issued in any state.
+
+Now let's have a look at error handling. The error() method will be called when the client sends a Command which isn't legal in the current state:
+
+ @IoHandlerTransition(on = MESSAGE_RECEIVED, in = ROOT, weight = 10)
+ public void error(Event event, StateContext context, IoSession session, Command cmd) {
+ session.write("- Cannot " + cmd.getName() + " while "
+ + context.getCurrentState().getId().toLowerCase());
+ }
+
+error() has been given a higher weight than listTapes(), info() and quit() to prevent it to be called for any of those commands. Notice how error() uses the StateContext object to get hold of the id of the current state. The values of the String constants which are annotated with the @State annotation (Empty, Loaded etc) will be used by mina-statemachine as state id.
+
+The commandSyntaxError() method will be called when a CommandSyntaxException has been thrown by our ProtocolDecoder. It simply prints out that the line sent by the client couldn't be converted into a Command.
+
+The exceptionCaught() will be called for any thrown exception except CommandSyntaxException (it has a higher weight than the commandSyntaxError() method). It closes the session immediately.
+
+The last @IoHandlerTransition method is unhandledEvent() which will be called if none of the other @IoHandlerTransition methods match the Event. We need this since we don't have @IoHandlerTransition annotations for all possible types of events in all states (e.g., we never handle messageSent events). Without this mina-statemachine throws an exception if an Event is handled by the state machine.
+
+The last piece of code we're going to have a look at is the code which creates the IoHandler proxy and the main() method:
+
+ private static IoHandler createIoHandler() {
+ StateMachine sm = StateMachineFactory.getInstance(IoHandlerTransition.class).create(EMPTY, new TapeDeckServer());
+
+ return new StateMachineProxyBuilder().setStateContextLookup(
+ new IoSessionStateContextLookup(new StateContextFactory() {
+ public StateContext create() {
+ return new TapeDeckContext();
+ }
+ })).create(IoHandler.class, sm);
+ }
+
+ // This code will work with MINA 1.0/1.1:
+ public static void main(String[] args) throws Exception {
+ SocketAcceptor acceptor = new SocketAcceptor();
+ SocketAcceptorConfig config = new SocketAcceptorConfig();
+ config.setReuseAddress(true);
+ ProtocolCodecFilter pcf = new ProtocolCodecFilter(
+ new TextLineEncoder(), new CommandDecoder());
+ config.getFilterChain().addLast("codec", pcf);
+ acceptor.bind(new InetSocketAddress(12345), createIoHandler(), config);
+ }
+
+ // This code will work with MINA trunk:
+ public static void main(String[] args) throws Exception {
+ SocketAcceptor acceptor = new NioSocketAcceptor();
+ acceptor.setReuseAddress(true);
+ ProtocolCodecFilter pcf = new ProtocolCodecFilter(
+ new TextLineEncoder(), new CommandDecoder());
+ acceptor.getFilterChain().addLast("codec", pcf);
+ acceptor.setHandler(createIoHandler());
+ acceptor.setLocalAddress(new InetSocketAddress(PORT));
+ acceptor.bind();
+ }
+
+createIoHandler() creates a StateMachine just like we did before except that we specify IoHandlerTransition.class instead of Transition.class in the call to StateMachineFactory.getInstance(...). This is necessary since we're now using the @IoHandlerTransition annotation. Also, this time we use IoSessionStateContextLookup and a custom StateContextFactory when we create the IoHandler proxy. If we didn't use IoSessionStateContextLookup all clients would share the same state machine which isn't desirable.
+
+The main() method creates the SocketAcceptor and attaches a ProtocolCodecFilter which decodes/encodes Command objects to its filter chain. Finally, it binds to port 12345 using an IoHandler instance created by the createIoHandler() method.
+
+# Advanced topics
+
+## Changing state programmatically
+
+To be written...
+
+## Calling the state machine recursively
+
+To be written...
Modified: mina/site/trunk/content/mina/userguide/ch6-transports/apr-transport.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch6-transports/apr-transport.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch6-transports/apr-transport.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch6-transports/apr-transport.mdtext Fri Oct 26 11:52:31 2012
@@ -28,11 +28,12 @@ Notice: Licensed to the Apache Softwa
## Pre-requisite
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../../../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>APR transport depends following components<BR>
-APR library - Download/install appropriate library for the platform from <A href="http://www.apache.org/dist/tomcat/tomcat-connectors/native/" class="external-link" rel="nofollow">http://www.apache.org/dist/tomcat/tomcat-connectors/native/</A><BR>
-JNI wrapper (tomcat-apr-5.5.23.jar) The jar is shipped with release
-
-<P>Put the native library in PATH</P></TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ APR transport depends following components<BR>
+ APR library - Download/install appropriate library for the platform from <A href="http://www.apache.org/dist/tomcat/tomcat-connectors/native/" class="external-link" rel="nofollow">http://www.apache.org/dist/tomcat/tomcat-connectors/native/</A><BR>
+ JNI wrapper (tomcat-apr-5.5.23.jar) The jar is shipped with release
+ <P>Put the native library in PATH</P>
+</DIV>
## Using APR Transport
Modified: mina/site/trunk/content/mina/userguide/ch6-transports/serial-transport.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch6-transports/serial-transport.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch6-transports/serial-transport.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch6-transports/serial-transport.mdtext Fri Oct 26 11:52:31 2012
@@ -32,10 +32,16 @@ If you prefer to build the code from the
## Prerequisite
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../../../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Useful Information</B><BR>Before accessing serial port from a Java program you need a native library (.DLL or .so depending of your OS). MINA use the one from RXTX.org : <A href="ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip" class="external-link" rel="nofollow">ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip</A>. <BR>
-Just put the good .dll or .so in the jre/lib/i386/ path of your JDK/JRE or use the -Djava.library.path= argument for specify where you placed the native libraries</TD></TR></TABLE></DIV>
-
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../../../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Useful Information</B><BR>The <B>mina-transport-serial</B> jar is not included in the full distribution. You can download it from <A href="http://repo1.maven.org/maven2/org/apache/mina/mina-transport-serial/2.0.2/" class="external-link" rel="nofollow">here</A></TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ <B>Useful Information</B><BR>
+ Before accessing serial port from a Java program you need a native library (.DLL or .so depending of your OS). MINA use the one from RXTX.org : <A href="ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip" class="external-link" rel="nofollow">ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip</A>. <BR>
+ Just put the good .dll or .so in the jre/lib/i386/ path of your JDK/JRE or use the -Djava.library.path= argument for specify where you placed the native libraries
+</DIV>
+
+<DIV class="info" markdown="1">
+ <B>Useful Information</B><BR>
+ The <B>mina-transport-serial</B> jar is not included in the full distribution. You can download it from <A href="http://repo1.maven.org/maven2/org/apache/mina/mina-transport-serial/2.0.2/" class="external-link" rel="nofollow">here</A>
+</DIV>
## Connecting to a serial port
Modified: mina/site/trunk/content/mina/userguide/ch8-iobuffer/ch8-iobuffer.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch8-iobuffer/ch8-iobuffer.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch8-iobuffer/ch8-iobuffer.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch8-iobuffer/ch8-iobuffer.mdtext Fri Oct 26 11:52:31 2012
@@ -31,24 +31,12 @@ This is a replacement for [ByteBuffer](h
* It doesn't provide useful getters and putters such as fill, get/putString, and get/putAsciiInt() .
* It is difficult to write variable-length data due to its fixed capacity
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- This will change in MINA 3. The main reason why MINA has its own wrapper on top of nio ByteBuffer is to have extensible buffers. This was a very bad decision. Buffers are just buffers : a temporary place to store temporary data, before it is used. Many other solutions exist, like defining a wrapper which relies on a list of NIO ByteBuffers, instead of copying the existing buffer to a bigger one just because we want to extend the buffer capacity.
-
- <P>It might also be more comfortable to use an InputStream instead of a byte buffer all along the filters, as it does not imply anything about the nature of the stored data : it can be a byte array, strings, messages...</P>
-
- <P>Last, not least, the current implementation defeat one of the target : zero-copy strategy (ie, once we have read the data from the socket, we want to avoid a copy being done later). As we use extensible byte buffers, we will most certainly copy those data if we have to manage big messages. Assuming that the MINA ByteBuffer is just a wrapper on top of NIO ByteBuffer, this can be a real problem when using direct buffers.</P>
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ This will change in MINA 3. The main reason why MINA has its own wrapper on top of nio ByteBuffer is to have extensible buffers. This was a very bad decision. Buffers are just buffers : a temporary place to store temporary data, before it is used. Many other solutions exist, like defining a wrapper which relies on a list of NIO ByteBuffers, instead of copying the existing buffer to a bigger one just because we want to extend the buffer capacity.
+
+ <P>It might also be more comfortable to use an InputStream instead of a byte buffer all along the filters, as it does not imply anything about the nature of the stored data : it can be a byte array, strings, messages...</P>
+
+ <P>Last, not least, the current implementation defeat one of the target : zero-copy strategy (ie, once we have read the data from the socket, we want to avoid a copy being done later). As we use extensible byte buffers, we will most certainly copy those data if we have to manage big messages. Assuming that the MINA ByteBuffer is just a wrapper on top of NIO ByteBuffer, this can be a real problem when using direct buffers.</P>
</DIV>
## IoBuffer Operations
@@ -93,20 +81,8 @@ Lets see how to create an auto expanding
The underlying ByteBuffer is reallocated by IoBuffer behind the scene if the encoded data is larger than 8 bytes in the example above. Its capacity will double, and its limit will increase to the last position the string is written. This behavior is very similar to the way StringBuffer class works.
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- This mechanism is very likely to be removed from MINA 3.0, as it's not really the best way to handle increased buffer size. It should be replaced by something like a InputStream hiding a list or an array of fixed sized ByteBuffers.
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ This mechanism is very likely to be removed from MINA 3.0, as it's not really the best way to handle increased buffer size. It should be replaced by something like a InputStream hiding a list or an array of fixed sized ByteBuffers.
</DIV>
## Creating Auto Shrinking Buffer
@@ -142,20 +118,8 @@ Lets take a break and analyze the output
* After incrementing capacity to 32, the capacity becomes 32
* Call to shrink(), reduces the capacity to 16, thereby eliminating extra storage
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- Again, this mechanism should be a default one, without needing to explicitely tells the buffer that it can shrink.
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ Again, this mechanism should be a default one, without needing to explicitely tells the buffer that it can shrink.
</DIV>
## Buffer Allocation
@@ -167,20 +131,8 @@ MINA ships with following implementation
* __SimpleBufferAllocator (default)__ - Create a new buffer every time
* __CachedBufferAllocator__ - caches the buffer which are likely to be reused during expansion
-<DIV class="panelMacro">
- <TABLE class="noteMacro">
- <COLGROUP>
- <COL width="24"><COL>
- </COLGROUP>
- <TR>
- <TD valign="top">
- <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
- </TD>
- <TD>
- With the new available JVM, using cached IoBuffer is very unlikely to improve performances.
- </TD>
- </TR>
- </TABLE>
+<DIV class="note" markdown="1">
+ With the new available JVM, using cached IoBuffer is very unlikely to improve performances.
</DIV>
You can implement you own implementation of IoBufferAllocator and call setAllocator() on IoBuffer to use the same.
Modified: mina/site/trunk/content/mina/userguide/codec-repo.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/codec-repo.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/codec-repo.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/codec-repo.mdtext Fri Oct 26 11:52:31 2012
@@ -20,7 +20,9 @@ Notice: Licensed to the Apache Softwa
This page captures known MINA Codecs available. These codecs may not be part of Apache MINA project. The Codecs are for reference purpose only.
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>The Codecs listed here may not be part of Apache MINA project. The information is for MINA Users for reference implementation available over the web</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ The Codecs listed here may not be part of Apache MINA project. The information is for MINA Users for reference implementation available over the web
+</DIV>
## Protocol Codecs
Added: mina/site/trunk/content/staticresources/icons/forbidden.gif
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/staticresources/icons/forbidden.gif?rev=1402474&view=auto
==============================================================================
Binary file - no diff available.
Propchange: mina/site/trunk/content/staticresources/icons/forbidden.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: mina/site/trunk/content/vysper/server_to_server_comm.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/vysper/server_to_server_comm.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/vysper/server_to_server_comm.mdtext (original)
+++ mina/site/trunk/content/vysper/server_to_server_comm.mdtext Fri Oct 26 11:52:31 2012
@@ -19,7 +19,9 @@ Notice: Licensed to the Apache Softwa
# Server-to-server
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResourcs/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Available since version 0.7.</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ Available since version 0.7.
+</DIV>
XMPP servers like Apache Vysper work in federated networks much like SMTP servers. Users connect to their own server, and when communicating with users on a different domain, the two servers will connect to each other and exchange XMPP stanzas. Server-to-server (S2S) connections differ from client-to-server (C2) connections in that stanzas for multiple users might be sent over the same connection. S2S connections are similar to C2S connections from the point that one of the servers serves as an initiator, like a client. To exchanges stanzas in both directions between servers, two connections are established.
@@ -29,43 +31,28 @@ To set up server-to-server functionality
Server-to-server federation is by default disabled in Vysper. To enable sending stanzas to other servers, federations must be enabled:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-XMPPServer server = <SPAN class="code-keyword">new</SPAN> XMPPServer(<SPAN class="code-quote">"vysper.org"</SPAN>);
-
-<SPAN class="code-comment">// other initialization
-</SPAN>
-server.start();
-
-<SPAN class="code-comment">// must be done after the server has been started
-</SPAN>server.getServerRuntimeContext().getServerFeatures().setRelayingToFederationServers(<SPAN class="code-keyword">true</SPAN>);
-</PRE>
-</DIV></DIV>
+ XMPPServer server = new XMPPServer("vysper.org");
+
+ // other initialization
+ server.start();
+
+ // must be done after the server has been started
+ server.getServerRuntimeContext().getServerFeatures().setRelayingToFederationServers(true);
## Server-to-server endpoint
Next, an endpoint for incoming S2S connections must be added:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-XMPPServer server = <SPAN class="code-keyword">new</SPAN> XMPPServer(<SPAN class="code-quote">"vysper.org"</SPAN>);
-
-server.addEndpoint(<SPAN class="code-keyword">new</SPAN> S2SEndpoint());
-
-<SPAN class="code-comment">// other initialization
-</SPAN>
-server.start();
-
-<SPAN class="code-comment">// must be done after the server has been started
-</SPAN>server.getServerRuntimeContext().getServerFeatures().setRelayingToFederationServers(<SPAN class="code-keyword">true</SPAN>);
-</PRE>
-</DIV></DIV>
+ XMPPServer server = new XMPPServer("vysper.org");
+
+ server.addEndpoint(new S2SEndpoint());
+
+ // other initialization
+ server.start();
+
+ // must be done after the server has been started
+ server.getServerRuntimeContext().getServerFeatures().setRelayingToFederationServers(true);
Thatâs all that needs to be done. If SSL/TLS should be enabled between servers (will be negotiated during the S2S connection handshake), a keystore and keystore password must be configured:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-server.setTLSCertificateInfo(<SPAN class="code-keyword">new</SPAN> File(<SPAN class="code-quote">"keystore.jks"</SPAN>), <SPAN class="code-quote">"sekrit"</SPAN>);
-
-</PRE>
-</DIV></DIV>
+ server.setTLSCertificateInfo(new File("keystore.jks"), "sekrit");
Modified: mina/site/trunk/content/vysper/socks5.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/vysper/socks5.mdtext?rev=1402474&r1=1402473&r2=1402474&view=diff
==============================================================================
--- mina/site/trunk/content/vysper/socks5.mdtext (original)
+++ mina/site/trunk/content/vysper/socks5.mdtext Fri Oct 26 11:52:31 2012
@@ -19,54 +19,39 @@ Notice: Licensed to the Apache Softwa
# SOCKS5 bytestream module
-<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="../staticResources/icons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Available since version 0.7.</TD></TR></TABLE></DIV>
+<DIV class="info" markdown="1">
+ Available since version 0.7.
+</DIV>
The Vysper SOCKS5 Bytestream module implements mediated connections from XEP-0065 SOCKS5 Bytestream. Direct connections requires no support from the server and thus works without this module. For mediated connections, this module will supply a SOCKS5 proxy that transfers data between the requestor and target clients. The module also provides all the required service discovery support used to negotiate the address of the SOCKS5 proxy.
The example below shows how to add the module using the API:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-XMPPServer server = <SPAN class="code-keyword">new</SPAN> XMPPServer(“vysper.org”);
-server.addEndpoint(<SPAN class="code-keyword">new</SPAN> TCPEndpoint());
-
-<SPAN class="code-comment">// other initialization
-</SPAN>
-server.addModule(<SPAN class="code-keyword">new</SPAN> Socks5Module());
-
-server.start();
-</PRE>
-</DIV></DIV>
+ XMPPServer server = new XMPPServer(“vysper.org”);
+ server.addEndpoint(new TCPEndpoint());
+
+ // other initialization
+ server.addModule(new Socks5Module());
+
+ server.start();
This will enable the SOCKS5 component on socks.vysper.org and start a proxy on port 5777. Make sure socks.vysper.org resolves to the server running Vysper.
To configure the subdomain name, provide the subdomain in the constructor:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-server.addModule(<SPAN class="code-keyword">new</SPAN> Socks5Module(“proxy”));
-</PRE>
-</DIV></DIV>
+ server.addModule(new Socks5Module("proxy"));
In this case, the SOCKS5 component would be available on proxy.vysper.org.
It is also possible to supply a socket address on which the proxy will be listening. This can be used to configure the port for the proxy, or the local address to bind the proxy to. For example:
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-server.addModule(<SPAN class="code-keyword">new</SPAN> Socks5Module(“proxy”, <SPAN class="code-keyword">new</SPAN> InetSocketAddress(“foo.vysper.org”, 18100)));
-</PRE>
-</DIV></DIV>
+ server.addModule(new Socks5Module("proxy", new InetSocketAddress("foo.vysper.org", 18100)));
With this code, the proxy will use the JID proxy.vysper.org, the hostname foo.vysper.org and the port 18100. It will only listen on the network interface for foo.vysper.org.
-<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
-<PRE class="code-java">
-server.addModule(<SPAN class="code-keyword">new</SPAN> Socks5Module(“proxy”, <SPAN class="code-keyword">new</SPAN> InetSocketAddress(18100)));
-</PRE>
-</DIV></DIV>
+server.addModule(new Socks5Module("proxy";, new> InetSocketAddress(18100)));
-n this case, the proxy will use the JID and hostname proxy.vysper.org and the port 18100. It will listen on all network interfaces.
+In this case, the proxy will use the JID and hostname proxy.vysper.org and the port 18100. It will listen on all network interfaces.
## Limitations