View Javadoc

1   package org.opensync.engine.server;
2   
3   import java.io.*;
4   import java.sql.*;
5   
6   /***
7    * The default implementation of the connector interface
8    *
9    * @version	1.0
10   * @author	smalbequ
11   */
12  
13  abstract public class DefaultConnector implements Connector,Serializable {
14    /***
15     * The type of the connector (eg: bd, file, ...)
16     *
17     */
18    protected String type;
19    /***
20     * The adapter used by the connector to adapt the data format of the source to the OpenSync format
21     *
22     *
23     */
24    protected Adapter adapter;
25    /***
26     * The protocol used by the connector to connect to the source
27     *
28     */
29    protected Protocol protocol;
30    /***
31     * The url of the source
32     *
33     */
34    protected String url;
35  
36    /***
37    * Incremental synchronization flag.
38    */
39    protected boolean incremental = false;
40  
41    /***
42     * Construct a DefaultConnector
43     *
44     */
45    public DefaultConnector() {
46    }
47  
48    /***
49     *
50     * @param type
51     */
52     public void validate() throws OpenSyncException {
53       this.getAdapter().validate();
54     }
55  
56     /***
57      *
58      * @param type
59      */
60     public void release() throws SQLException {
61     }
62  
63     /***
64      *
65      * @param type
66      */
67     public void releaseWithException() throws SQLException {
68     }
69  
70  
71    /***
72     * Set the name of the connector (eg: bd, file, ...)
73     *
74     * @param	type the type of the connector
75     */
76    public void setType(String type) {
77      this.type = type;
78    }
79    /***
80     * Get the type of the connector (eg: bd, file, ...)
81     *
82     */
83    public String getType() {
84      return type;
85    }
86    /***
87     * Used only for debugging
88     *
89     */
90    public String toString(){
91      StringBuffer buffer = new StringBuffer();
92      buffer.append("DefaultConnector{\n");
93      buffer.append("\ttype : ").append(type).append("\n");
94      buffer.append("}\n");
95      return buffer.toString();
96    }
97    /***
98     * Set the adapter used by the connector to adapt the data format of the source to the OpenSync format
99     *
100    * @param	adapter the adapter of the connector
101    */
102   public void setAdapter(Adapter adapter) {
103     this.adapter = adapter;
104   }
105   /***
106    * Get the adapter used by the connector to adapt the data format of the source to the OpenSync format
107    *
108    */
109   public Adapter getAdapter() {
110     return adapter;
111   }
112   /***
113    * Set the protocol used by the connector to connect to the source
114    *
115    * @param	protocol the protocol of the connector
116    */
117   public void setProtocol(Protocol protocol) {
118     this.protocol = protocol;
119   }
120   /***
121    * Get the protocol used by the connector to connect to the source
122    *
123    */
124   public Protocol getProtocol() {
125     return protocol;
126   }
127   /***
128    * Set the url of the source
129    *
130    * @param	url the url of the source
131    */
132   public void setUrl(String url) {
133     this.url = url;
134   }
135   /***
136    * Get the url of the source
137    *
138    */
139   public String getUrl() {
140     return url;
141   }
142 
143   public void setIncremental(boolean incremental) {
144     this.incremental = incremental;
145   }
146   public boolean getIncremental() {
147     return this.incremental;
148   }
149 
150 }