1 package org.opensync.engine.server;
2
3 import java.io.*;
4
5 /***
6 * The default implementation of the protocol interface
7 */
8
9 abstract public class DefaultProtocol implements Protocol,Serializable {
10 /***
11 * The name of the protocol (eg: win_file, ftp, ...)
12 *
13 *
14 */
15 protected String name;
16 /***
17 * The folder use by the protocol to get and put files
18 *
19 */
20 protected String folder;
21 /***
22 * The connector used by the protocol to get information to connect to the source
23 *
24 */
25 protected Connector connector;
26 /***
27 * The file must be rename when cleaned
28 *
29 */
30 protected boolean renameFile;
31 /***
32 * The file must be rename when cleaned
33 *
34 *
35 */
36 protected boolean removeFile;
37
38 /***
39 * Construct a DefaultProtocol
40 *
41 */
42 public DefaultProtocol() {
43 }
44 /***
45 * Set the name of the protocol (eg: win_file, ftp, ...)
46 *
47 * @param name the name of the protocol
48 */
49 public void setName(String name) {
50 this.name = name;
51 }
52 /***
53 * Get the name of the protocol
54 *
55 */
56 public String getName() {
57 return name;
58 }
59 /***
60 * Set the folder use by the protocol to get and put files
61 *
62 * @param folder the folder of the protocol
63 */
64 public void setFolder(String folder) {
65 this.folder = folder;
66 }
67 /***
68 * Get the folder use by the protocol to get and put files
69 *
70 */
71 public String getFolder() {
72 return folder;
73 }
74 /***
75 * Set the connector used by the protocol to get information to connect to the source
76 *
77 * @param connector the connector of the protocol
78 * @see Connector
79 */
80 public void setConnector(Connector connector) {
81 this.connector = connector;
82 }
83 /***
84 * Get the connector used by the protocol to get information to connect to the source
85 *
86 */
87 public Connector getConnector() {
88 return connector;
89 }
90
91 /***
92 *
93 * @param
94 * @throws OpenSyncException
95 * @throws IOException
96 */
97 public void init() {
98 }
99 /***
100 * Clean files (rename or remove files when finished)
101 *
102 * @param fileName the file name
103 * @exception OpenSyncException
104 * @exception IOException
105 */
106 public void clean(String fileName)throws OpenSyncException,IOException{
107 }
108 /***
109 * The file must be rename when clean
110 *
111 * @param renameFile
112 */
113 public void setRenameFile(boolean renameFile) {
114 this.renameFile = renameFile;
115 }
116 /***
117 * The file must be rename when clean
118 *
119 */
120 public boolean isRenameFile() {
121 return renameFile;
122 }
123 /***
124 * The file must be remove when clean
125 *
126 * @param removeFile
127 */
128 public void setRemoveFile(boolean removeFile) {
129 this.removeFile = removeFile;
130 }
131 /***
132 * The file must be remove when clean
133 *
134 */
135 public boolean isRemoveFile() {
136 return removeFile;
137 }
138 /***
139 * Used only for debugging
140 *
141 */
142 public String toString(){
143 StringBuffer buffer = new StringBuffer();
144 buffer.append("DefaultProtocol{\n");
145 buffer.append("\tname : ").append(name).append("\n");
146 buffer.append("\tfolder : ").append(folder).append("\n");
147 buffer.append("}\n");
148 return buffer.toString();
149 }
150 }