KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > transport > http > SyncHolder


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package sync4j.framework.transport.http;
19
20 import java.util.Map JavaDoc;
21
22 import javax.servlet.http.*;
23
24 import sync4j.framework.server.SyncResponse;
25 import sync4j.framework.core.Sync4jException;
26 import sync4j.framework.server.error.ServerException;
27 import sync4j.framework.server.error.NotImplementedException;
28 import sync4j.framework.protocol.ProtocolException;
29
30
31 /**
32  * This is an interface of sync holder. A sync holder hides the implementation
33  * of the real service provider. Thus the provider can be developed as a local
34  * EJB, a remote EJB or a simple local object.
35  *
36  * @author Stefano Fornari @ Funambol
37  * @version $Id: SyncHolder.java,v 1.8 2005/03/02 20:57:38 harrie Exp $
38  */

39 public interface SyncHolder {
40     // --------------------------------------------------------------- Constants
41

42     // ---------------------------------------------------------- Public methods
43

44     public void setSessionId(String JavaDoc sessionId) throws Sync4jException;
45     
46     public String JavaDoc getSessionId();
47     
48     /** Processes an incoming XML message.
49      *
50      * @param msg the SyncML request as stream of bytes
51      * @param parameters SyncML request parameters
52      * @param headers SyncML request headers
53      *
54      * @return the SyncML response as a <i>ISyncResponse</i> object
55      *
56      * @throws ServerException in case of a server error
57      *
58      */

59     public SyncResponse processXMLMessage(final byte[] msg ,
60                                           final Map JavaDoc parameters ,
61                                           final Map JavaDoc headers )
62     throws NotImplementedException, ProtocolException, ServerException;
63     
64     /** Processes an incoming WBXML message.
65      *
66      * @param msg the SyncML request as stream of bytes
67      * @param parameters SyncML request parameters
68      * @param headers SyncML request headers
69      *
70      * @return the SyncML response as a <i>ISyncResponse</i> object
71      *
72      * @throws ServerException in case of a server error
73      *
74      */

75     public SyncResponse processWBXMLMessage(final byte[] msg ,
76                                             final Map JavaDoc parameters ,
77                                             final Map JavaDoc headers )
78     throws NotImplementedException, ProtocolException, ServerException;
79     
80     /**
81      * Called when the SyncHolder is not required any more. It gives the holder
82      * an opportunity to do clean up and releaseing of resources.
83      *
84      * @throws java.lang.Exception in case of error. The real exception is stored
85      * in the cause.
86      */

87     public void close() throws Exception JavaDoc;
88     
89     /**
90      * Returns the creation timestamp (in milliseconds since midnight, January
91      * 1, 1970 UTC).
92      */

93     public long getCreationTimestamp();
94 }
Popular Tags