1 | package fr.mael.jiwigo.transverse.session; |
---|
2 | |
---|
3 | import java.io.IOException; |
---|
4 | import java.io.InputStream; |
---|
5 | import java.io.UnsupportedEncodingException; |
---|
6 | |
---|
7 | import org.apache.http.client.ClientProtocolException; |
---|
8 | import org.w3c.dom.Document; |
---|
9 | |
---|
10 | import fr.mael.jiwigo.transverse.exception.JiwigoException; |
---|
11 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; |
---|
12 | |
---|
13 | public interface SessionManager { |
---|
14 | /** |
---|
15 | * Connection method |
---|
16 | * |
---|
17 | * @return 0 if Ok, 1 if not Ok (reason not specified), 2 if proxy error |
---|
18 | * @throws JiwigoException |
---|
19 | * |
---|
20 | * |
---|
21 | */ |
---|
22 | public int processLogin() throws JiwigoException; |
---|
23 | |
---|
24 | /** |
---|
25 | * Executes a method on the webservice and returns the result as a string |
---|
26 | * @param methode the method to execute |
---|
27 | * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value |
---|
28 | * @return the result |
---|
29 | * @throws UnsupportedEncodingException |
---|
30 | * @throws ProxyAuthenticationException |
---|
31 | * @throws JiwigoException |
---|
32 | * @throws IOException |
---|
33 | * @throws ClientProtocolException |
---|
34 | */ |
---|
35 | public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException, |
---|
36 | ProxyAuthenticationException, JiwigoException, ClientProtocolException, IOException; |
---|
37 | |
---|
38 | /** |
---|
39 | * Executes a method on the webservice and returns the result as a Dom document |
---|
40 | * @param methode the method to execute |
---|
41 | * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value |
---|
42 | * @return the result |
---|
43 | * @throws IOException |
---|
44 | * @throws ProxyAuthenticationException |
---|
45 | * @throws JiwigoException |
---|
46 | */ |
---|
47 | public Document executeReturnDocument(String methode, String... parametres) throws JiwigoException; |
---|
48 | |
---|
49 | /** |
---|
50 | * Executes a method on the webservice and returns the result as a Dom document |
---|
51 | * @param methode the method to execute |
---|
52 | * @return the result |
---|
53 | * @throws ProxyAuthenticationException |
---|
54 | */ |
---|
55 | public Document executeReturnDocument(String methode) throws JiwigoException; |
---|
56 | |
---|
57 | /** |
---|
58 | * Getter of the login |
---|
59 | * @return the login |
---|
60 | */ |
---|
61 | public String getLogin(); |
---|
62 | |
---|
63 | /** |
---|
64 | * Setter of the login |
---|
65 | * @param login |
---|
66 | */ |
---|
67 | public void setLogin(String login); |
---|
68 | |
---|
69 | /** |
---|
70 | * Setter of the user agent |
---|
71 | * @param userAgent |
---|
72 | */ |
---|
73 | public void setUserAgent(String userAgent); |
---|
74 | |
---|
75 | /** |
---|
76 | * Setter of the password to access piwigo |
---|
77 | * @param password |
---|
78 | */ |
---|
79 | public void setPassword(String password); |
---|
80 | |
---|
81 | /** |
---|
82 | * Setter of the proxy login |
---|
83 | * @param loginProxy |
---|
84 | */ |
---|
85 | public void setLoginProxy(String loginProxy); |
---|
86 | |
---|
87 | /** |
---|
88 | * Setter of the proxy port |
---|
89 | * @param port |
---|
90 | */ |
---|
91 | public void setPortProxy(int port); |
---|
92 | |
---|
93 | /** |
---|
94 | * Setter of the proxy url |
---|
95 | * @param urlProxy |
---|
96 | */ |
---|
97 | public void setUrlProxy(String urlProxy); |
---|
98 | |
---|
99 | /** |
---|
100 | * Setter of the proxy pass |
---|
101 | * @param proxyPass |
---|
102 | */ |
---|
103 | public void setPassProxy(String proxyPass); |
---|
104 | |
---|
105 | /** |
---|
106 | * Setter of the proxy url |
---|
107 | * @param url |
---|
108 | */ |
---|
109 | public void setUrl(String url); |
---|
110 | |
---|
111 | /** |
---|
112 | * Setter of the boolean that tells to use a proxy or not |
---|
113 | * @param usesProxy |
---|
114 | */ |
---|
115 | public void setUsesProxy(boolean usesProxy); |
---|
116 | |
---|
117 | /** |
---|
118 | * Function that returns true if there is a proxy error |
---|
119 | * @return |
---|
120 | */ |
---|
121 | public boolean isProxyError(); |
---|
122 | |
---|
123 | /** |
---|
124 | * @param url |
---|
125 | * @return |
---|
126 | * @throws Exception |
---|
127 | */ |
---|
128 | public InputStream getInputStreamFromUrl(String url) throws Exception; |
---|
129 | } |
---|