KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > transport > Transporter


1 /**
2  * PETALS: PETALS Services Platform
3  * Copyright (C) 2005 EBM WebSourcing
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): EBM WebSourcing
21  * --------------------------------------------------------------------------
22  * $Id: Transporter.java,v 0.3 2005/07/22 10:24:27 alouis Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.petals.jbi.transport;
27
28 import org.objectweb.petals.PetalsLifeCycle;
29 import org.objectweb.petals.jbi.messaging.MessageExchangeImpl;
30
31 /**
32  * The <code>Transporter</code> is used to send a <code>MessageExchange</code>
33  * from a Petals container to another one. <br>
34  * The local <code>Router</code> calls
35  * <code>send(exchange,distantContainer)</code> on this
36  * <code>Transporter</code> to send an exchange. <br>
37  * This <code>Transporter</code> sends the <code>MessageExchange</code> to
38  * the distant <code>Transporter</code>. <br>
39  * When the distant <code>Transporter</code> receives the
40  * <code>MessageExchange</code>, it has to call
41  * <code>receive(exchange)</code> on its local <code>Router</code>. <br>
42  * The localization of the distant container is in charge of the
43  * <code>Transporter</code>. <br>
44  * <br>
45  * <em>Note that the destination container can be the same than this one.</em>
46  *
47  * @version $Rev: 477 $ $Date: 2006-05-29 17:18:07 +0200 (lun., 29 mai 2006) $
48  * @since Petals 1.0
49  * @author alouis
50  */

51 public interface Transporter extends PetalsLifeCycle{
52
53     public final String JavaDoc PROPERTY_NOPERSISTANCE="org.objectweb.petals.transport.nonpersistent";
54     
55     /**
56      * Send the specified exchange to the specified container.
57      * If the "org.objectweb.petals.transport.nonpersistent" exchange
58      * property is set to true, the message is not persisted by
59      * the Transport layer, but it can be lost in case of problem.
60      * @param exchange
61      * the exchange to send. <b>MUST</b> be non null
62      * @param containerName
63      * the name of the distant container. <b>MUST</b> be non null
64      * and non empty
65      * @param timeToLive
66      * duration of the message life (in ms). 0 for no timeout
67      * @throws TransportException
68      * If the exchange is invalid, or can not be serialized. If the
69      * distant container can not be found.
70      */

71     void send(MessageExchangeImpl exchange, String JavaDoc containerName,
72         long timeToLive) throws TransportException;
73
74     /**
75      * Ask the Transporter to start listening for incoming messages. The
76      * Transporter MUST NOT listen for it before, as we need to wait that all
77      * system elements (components, service assemblies,...) are restarted before
78      * delivering them some messages.
79      *
80      * @throws TransportException
81      */

82     void startListening() throws TransportException;
83 }
84
Popular Tags