View Javadoc

1   /**
2    * $Id: ServerSocketConsumer.java 39 2006-10-26 04:51:28Z maldito_orco $
3    * $Revision: 39 $
4    * $Date: 2006-10-26 01:51:28 -0300 (Thu, 26 Oct 2006) $
5    *
6    * =========================================================================
7    *
8    * Copyright 2005 Tubo
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   */
22  package org.tubo.resource.consumer.serversocket;
23  
24  //log
25  import org.apache.commons.logging.Log;
26  import org.apache.commons.logging.LogFactory;
27  //tubo
28  import org.tubo.resource.consumer.BaseConsumerImpl;
29  import org.tubo.exception.TuboConsumerException;
30  //net
31  import java.net.Socket;
32  //io
33  import java.io.*;
34  
35  /**
36   * Created: Sep 4, 2006, 1:33:26 AM
37   * Last Modification Date: $Date: 2006-10-26 01:51:28 -0300 (Thu, 26 Oct 2006) $
38   *
39   * @author maldito_orco (maldito_orco@users.sourceforge.net)
40   * @version $Revision: 39 $
41   */
42  public class ServerSocketConsumer extends BaseConsumerImpl {
43      public static final String RCS_ID = "$Id: ServerSocketConsumer.java 39 2006-10-26 04:51:28Z maldito_orco $";
44      private static Log log = LogFactory.getLog(ServerSocketConsumer.class);
45  
46      public static final String NEW_CONNECTION_EVENT = "NEW_CONNECTION_EVENT";
47  
48      /**
49       * <p>
50       * This method is executed from ServerSocketConsumerWorker. Is used like
51       * entry point to consumer.
52       *
53       * The socket is closed on worker.
54       * </p>
55       *
56       * @param socket A new socket open from client
57       * @throws TuboConsumerException
58       */
59      public void process(Socket socket) throws TuboConsumerException {
60          try {
61              doConsumerLifeCycle(NEW_CONNECTION_EVENT,socket);
62          } catch (Exception e) {
63              throw getResourceManager().getExceptionManager().getException(3500,e);
64          }
65      }
66  }