Author: elecharny
Date: Thu Oct 25 21:53:21 2012
New Revision: 1402341

URL: http://svn.apache.org/viewvc?rev=1402341&view=rev
Log:
Updated some pages, fixing the title, removing HTML tags...

Modified:
    mina/site/trunk/content/mina/codec-repo.mdtext
    mina/site/trunk/content/mina/conferences.mdtext
    mina/site/trunk/content/mina/developper-guide.mdtext
    mina/site/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.mdtext
    mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-client.mdtext
    mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-server.mdtext
    mina/site/trunk/content/mina/userguide/ch3-service/acceptor.mdtext
    mina/site/trunk/content/special-thanks.mdtext
    mina/site/trunk/content/staticresources/images/mina/IoServiceConnector.png

Modified: mina/site/trunk/content/mina/codec-repo.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/codec-repo.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/codec-repo.mdtext (original)
+++ mina/site/trunk/content/mina/codec-repo.mdtext Thu Oct 25 21:53:21 2012
@@ -1,4 +1,4 @@
-Title: Code Repository
+Title: MINA Codec Repository
 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

Modified: mina/site/trunk/content/mina/conferences.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/conferences.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/conferences.mdtext (original)
+++ mina/site/trunk/content/mina/conferences.mdtext Thu Oct 25 21:53:21 2012
@@ -1,4 +1,4 @@
-Title: Presentation Materials
+Title: MINA Presentation Materials
 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

Modified: mina/site/trunk/content/mina/developper-guide.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/developper-guide.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/developper-guide.mdtext (original)
+++ mina/site/trunk/content/mina/developper-guide.mdtext Thu Oct 25 21:53:21 
2012
@@ -1,5 +1,20 @@
-Please read [the Developer Infrastructure 
Information](http://www.apache.org/dev/) if you haven't yet before you proceed.
+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>
 
 [TOC]
 
@@ -272,7 +287,7 @@ 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)
+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...

Modified: 
mina/site/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.mdtext 
(original)
+++ mina/site/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.mdtext 
Thu Oct 25 21:53:21 2012
@@ -28,40 +28,41 @@ We have seen the Client Architecture. Le
 
 We shall use [Sumup 
Client](http://mina.apache.org/report/trunk/xref/org/apache/mina/example/sumup/Client.html)
 as a reference implementation.
 
-We will remove boiler plate code and concentrate on the important constructs. 
Below the code for the Client
+We will remove boiler plate code and concentrate on the important constructs. 
Below the code for the Client :
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>public static void main(String[] args) throws Throwable {
-    NioSocketConnector connector = new NioSocketConnector();
-    connector.setConnectTimeoutMillis(CONNECT_TIMEOUT);
-    if (USE_CUSTOM_CODEC) {
-       connector.getFilterChain().addLast(&quot;codec&quot;,
-                                         new ProtocolCodecFilter(new 
SumUpProtocolCodecFactory(false)));
-    } else {
-       connector.getFilterChain().addLast(&quot;codec&quot;,
-                                         new ProtocolCodecFilter(new 
ObjectSerializationCodecFactory()));
-    }
-    connector.getFilterChain().addLast(&quot;logger&quot;, new 
LoggingFilter());
-    connector.setHandler(new ClientSessionHandler(values));
-    IoSession session;
-    for (;;) {
-        try {
-            ConnectFuture future = connector.connect(new 
InetSocketAddress(HOSTNAME, PORT));
-            future.awaitUninterruptibly();
-            session = future.getSession();
-            break;
-        } catch (RuntimeIoException e) {
-            System.err.println(&quot;Failed to connect.&quot;);
-            e.printStackTrace();
-            Thread.sleep(5000);
-        }
-    }
-    // wait until the summation is done
-    session.getCloseFuture().awaitUninterruptibly();
-    connector.dispose();
-}
-</PRE>
-</DIV></DIV>
+       public static void main(String[] args) throws Throwable {
+       NioSocketConnector connector = new NioSocketConnector();
+               connector.setConnectTimeoutMillis(CONNECT_TIMEOUT);
+
+               if (USE_CUSTOM_CODEC) {
+               connector.getFilterChain().addLast("codec",
+               new ProtocolCodecFilter(new SumUpProtocolCodecFactory(false)));
+               } else {
+                       connector.getFilterChain().addLast("codec",
+               new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
+       }
+               
+       connector.getFilterChain().addLast("logger", new LoggingFilter());
+       connector.setHandler(new ClientSessionHandler(values));
+               IoSession session;
+               
+               for (;;) {
+               try {
+               ConnectFuture future = connector.connect(new 
InetSocketAddress(HOSTNAME, PORT));
+                               future.awaitUninterruptibly();
+                               session = future.getSession();
+                               break;
+                       } catch (RuntimeIoException e) {
+                               System.err.println(&quot;Failed to 
connect.&quot;);
+                               e.printStackTrace();
+                               Thread.sleep(5000);
+                       }
+               }
+                       
+               // wait until the summation is done
+               session.getCloseFuture().awaitUninterruptibly();
+               connector.dispose();
+       }
 
 To construct a Client, we need to do following
 
@@ -74,59 +75,44 @@ Lets examine each one in detail
 
 ## Create a Connector
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-NioSocketConnector connector = new NioSocketConnector();
-</PRE>
-</DIV></DIV>
+       NioSocketConnector connector = new NioSocketConnector();
 
 Here we have created a NIO Socket connector
 
 ## Create a Filter Chain
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-if (USE_CUSTOM_CODEC) {
-   connector.getFilterChain().addLast("codec",
-                                      new ProtocolCodecFilter(new 
SumUpProtocolCodecFactory(false)));
-} else {
-   connector.getFilterChain().addLast("codec",
-                                      new ProtocolCodecFilter(new 
ObjectSerializationCodecFactory()));
-}
-</PRE>
-</DIV></DIV>
+       if (USE_CUSTOM_CODEC) {
+               connector.getFilterChain().addLast("codec",
+               new ProtocolCodecFilter(new SumUpProtocolCodecFactory(false)));
+       } else {
+               connector.getFilterChain().addLast("codec",
+               new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
+       }
 
 We add Filters to the Filter Chain for the Connector. Here we have added a 
ProtocolCodec, to the filter Chain.
 
 ## Create IOHandler
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-connector.setHandler(new ClientSessionHandler(values));
-</PRE>
-</DIV></DIV>
+       connector.setHandler(new ClientSessionHandler(values));
 
 Here we create an instance of 
[ClientSessionHandler](http://mina.apache.org/report/trunk/xref/org/apache/mina/example/sumup/ClientSessionHandler.html)
 and set it as a handler for the Connector.
 
 ## Bind to Server
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-IoSession session;
-for (;;) {
-    try {
-        ConnectFuture future = connector.connect(new 
InetSocketAddress(HOSTNAME, PORT));
-        future.awaitUninterruptibly();
-        session = future.getSession();
-        break;
-    } catch (RuntimeIoException e) {
-        System.err.println("Failed to connect.");
-        e.printStackTrace();
-        Thread.sleep(5000);
-    }
-}
-</PRE>
-</DIV></DIV>
+       IoSession session;
+       
+       for (;;) {
+       try {
+               ConnectFuture future = connector.connect(new 
InetSocketAddress(HOSTNAME, PORT));
+                       future.awaitUninterruptibly();
+                       session = future.getSession();
+                       break;
+               } catch (RuntimeIoException e) {
+               System.err.println("Failed to connect.");
+                       e.printStackTrace();
+                       Thread.sleep(5000);
+               }
+       }
 
 Here is the most important stuff. We connect to remote Server. Since, connect 
is an async task, we use the 
[ConnectFuture](http://mina.apache.org/report/trunk/xref/org/apache/mina/core/future/ConnectFuture.html)
 class to know the when the connection is complete.
 Once the connection is complete, we get the associated 
[IoSession](http://mina.apache.org/report/trunk/xref/org/apache/mina/core/session/IoSession.html).
 To send any message to the Server, we shall have to write to the session. All 
responses/messages from server shall traverse the Filter chain and finally be 
handled in IoHandler.

Modified: 
mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-client.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-client.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-client.mdtext 
(original)
+++ mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-client.mdtext 
Thu Oct 25 21:53:21 2012
@@ -59,9 +59,7 @@ Here we create a NioDatagramConnector, s
 
 Here we add a listener to the ConnectFuture object and when we receive a 
callback that the client has connected, we will start to write data. The 
writing of data to the server will be handled by a method called sendData. This 
method is shown below:
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-private void sendData() throws InterruptedException {
+       private void sendData() throws InterruptedException {
         for (int i = 0; i < 30; i++) {
             long free = Runtime.getRuntime().freeMemory();
             IoBuffer buffer = IoBuffer.allocate(8);
@@ -75,9 +73,7 @@ private void sendData() throws Interrupt
                 throw new InterruptedException(e.getMessage());
             }
         }
-}
-</PRE>
-</DIV></DIV>
+       }
 
 This method will write the amount of free memory to the server once a second 
for 30 seconds. Here you can see that we allocate a IoBuffer large enough to 
hold a long variable and then place the amount of free memory in the buffer. 
This buffer is then flipped and written to the server.
 

Modified: 
mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-server.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-server.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-server.mdtext 
(original)
+++ mina/site/trunk/content/mina/userguide/ch2-basics/sample-udp-server.mdtext 
Thu Oct 25 21:53:21 2012
@@ -33,30 +33,18 @@ To construct the server, we shall have t
 
 Here is the first snippet that addresses Point# 1:
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
-acceptor.setHandler(new MemoryMonitorHandler(this));
-</PRE>
-</DIV></DIV>
+       NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
+       acceptor.setHandler(new MemoryMonitorHandler(this));
 
 Here, we create a NioDatagramAcceptor to listen for incoming Client requests, 
and set the IoHandler.The variable 'PORT' is just an int. The next step is to 
add a logging filter to the filter chain that this DatagramAcceptor will use. 
LoggingFilter is a very nice way to see MINA in Action. It generate log 
statements at various stages, providing an insight into how MINA works.
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
-chain.addLast("logger", new LoggingFilter());
-</PRE>
-</DIV></DIV>
+       DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
+       chain.addLast("logger", new LoggingFilter());
 
 Next we get into some more specific code for the UDP traffic. We will set the 
acceptor to reuse the address
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-DatagramSessionConfig dcfg = acceptor.getSessionConfig();
-dcfg.setReuseAddress(true);acceptor.bind(new InetSocketAddress(PORT));
-</PRE>
-</DIV></DIV>
+       DatagramSessionConfig dcfg = acceptor.getSessionConfig();
+       dcfg.setReuseAddress(true);acceptor.bind(new InetSocketAddress(PORT));
 
 Of course the last thing that is required here is to call bind().
 
@@ -72,46 +60,34 @@ Lets look at each of them in detail
 
 ### Session Created Event
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-@Override
-public void sessionCreated(IoSession session) throws Exception {
-     SocketAddress remoteAddress = session.getRemoteAddress();
-     server.addClient(remoteAddress);
-} 
-</PRE>
-</DIV></DIV> 
+       @Override
+       public void sessionCreated(IoSession session) throws Exception {
+       SocketAddress remoteAddress = session.getRemoteAddress();
+               server.addClient(remoteAddress);
+       } 
 
 In the session creation event, we just call addClient() function, which 
internally adds a Tab to the UI
 
 ### Message Received Event
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-@Override
- public void messageReceived(IoSession session, Object message) throws 
Exception {
+       @Override
+       public void messageReceived(IoSession session, Object message) throws 
Exception {
         if (message instanceof IoBuffer) {
             IoBuffer buffer = (IoBuffer) message;
             SocketAddress remoteAddress = session.getRemoteAddress();
             server.recvUpdate(remoteAddress, buffer.getLong());
         }
- }
-</PRE>
-</DIV></DIV>
+        }
 
 In the message received event, we just dump the data received in the message. 
Applications that need to send responses, can process message and write the 
responses onto session in this function.
 
 ### Session Closed Event
 
-<DIV class="preformatted panel" style="border-width: 1px;"><DIV 
class="preformattedContent panelContent">
-<PRE>
-@Override
-public void sessionClosed(IoSession session) throws Exception {
-    System.out.println("Session closed...");
-    SocketAddress remoteAddress = session.getRemoteAddress();
-    server.removeClient(remoteAddress);
-}
-</PRE>
-</DIV></DIV>
+       @Override
+       public void sessionClosed(IoSession session) throws Exception {
+       System.out.println("Session closed...");
+               SocketAddress remoteAddress = session.getRemoteAddress();
+               server.removeClient(remoteAddress);
+       }
 
 In the Session Closed, event we just remove the Client tab from the UI

Modified: mina/site/trunk/content/mina/userguide/ch3-service/acceptor.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch3-service/acceptor.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch3-service/acceptor.mdtext 
(original)
+++ mina/site/trunk/content/mina/userguide/ch3-service/acceptor.mdtext Thu Oct 
25 21:53:21 2012
@@ -24,11 +24,11 @@ Notice:    Licensed to the Apache Softwa
 
 # Chapter 8 - Acceptor
 
-In order to build a server, you need to select an implementation of the 
IoAcceptor interface.
+In order to build a server, you need to select an implementation of the 
_IoAcceptor_ interface.
 
 ## IoAcceptor
 
-Basically, this interface is named because of the accept() method, responsible 
for the creation of new connection between a client and the server. The server 
accepts incoming connection request.
+Basically, this interface is named because of the _accept()_ method, 
responsible for the creation of new connection between a client and the server. 
The server accepts incoming connection request.
 
 At some point, we could have named this interface 'Server'.
 
@@ -36,13 +36,57 @@ As we may deal with more than one kind o
 
 We have many of those implementing classes
 
-* __NioSocketAcceptor__ : the non-blocking Socket transport Acceptor
-* __NioDatagramAcceptor__ : the non-blocking UDP transport Acceptor
-* __AprSocketAcceptor__ : the blocking Socket transport Acceptor, based on APR
-* __VmPipeSocketAcceptor__ : the in-VM Acceptor
+* __NioSocketAcceptor__ : the non-blocking Socket transport _IoAcceptor_
+* __NioDatagramAcceptor__ : the non-blocking UDP transport _IoAcceptor_
+* __AprSocketAcceptor__ : the blocking Socket transport _IoAcceptor_, based on 
APR
+* __VmPipeSocketAcceptor__ : the in-VM _IoAcceptor_
 
 Just pick the one that fit your need.
 
-Here is the class diagram for the IoAcceptor interfaces and classes :
+Here is the class diagram for the _IoAcceptor_ interfaces and classes :
 
 ![](../../../staticresources/images/mina/IoServiceAcceptor.png)
+
+## Creation
+
+You first have to select the type of _IoAcceptor_ you want to instanciate. 
This is a choice you will made early in the process, as it all boils down to 
which network protocol you will use. Let's see with an example how it works :
+
+    public TcpServer() throws IOException {
+               // Create a TCP acceptor
+        IoAcceptor acceptor = new NioSocketAcceptor();
+
+               // Associate the acceptor to an IoHandler instance (your 
application)
+        acceptor.setHandler(this);
+
+               // Bind : this will start the server...
+        acceptor.bind(new InetSocketAddress(PORT));
+
+        System.out.println("Server started...");
+    }
+
+That's it ! You have created a TCP server. If you want to start an UDP server, 
simply replace the first line of code :
+
+               ...
+               // Create an UDP acceptor
+               IoAcceptor acceptor = new NioDatagramAcceptor();
+               ...
+       
+## Disposal
+
+The service can be stopped by calling the _dispose()_ method. The service will 
be stopped only when all the pending sessions have been processed :
+
+       // Stop the service, waiting for the pending sessions to be inactive
+       acceptor.dispose();
+       
+You can also wait for every thread being executed to be properly completed by 
passing a boolean parameter to this method :
+
+       // Stop the service, waiting for the processing session to be properly 
completed
+       acceptor.dispose( true );
+       
+## Status
+
+You can get the _IoService_ status by calling one of the following methods :
+
+* _isActive()_ : true if the service can accept incoming requests
+* _isDisposing()_ : true if the _dispose()_ method has been called. It does 
not tell if the service is actually stopped (some sessions might be processed)
+* _isDisposed()_ : true if the _dispose(boolean)_ method has been called, and 
the executing threads have been completed.

Modified: mina/site/trunk/content/special-thanks.mdtext
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/special-thanks.mdtext?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
--- mina/site/trunk/content/special-thanks.mdtext (original)
+++ mina/site/trunk/content/special-thanks.mdtext Thu Oct 25 21:53:21 2012
@@ -1,4 +1,4 @@
-Title: Apache MINA - Contributors
+Title: Apache MINA - Special Thanks
 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

Modified: 
mina/site/trunk/content/staticresources/images/mina/IoServiceConnector.png
URL: 
http://svn.apache.org/viewvc/mina/site/trunk/content/staticresources/images/mina/IoServiceConnector.png?rev=1402341&r1=1402340&r2=1402341&view=diff
==============================================================================
Binary files - no diff available.


Reply via email to