KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > server > Sync4jSource


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
19 package sync4j.framework.server;
20
21 import org.apache.commons.lang.builder.ToStringBuilder;
22
23 /**
24  * This class represent an addressable SyncML source registered to Sync4j.
25  * It is not intended to store specific SyncSource information.
26  *
27  * @author Stefano Fornari @ Funambol
28  *
29  * @version $Id: Sync4jSource.java,v 1.5 2005/03/02 20:57:38 harrie Exp $
30  */

31 public class Sync4jSource {
32
33     private String JavaDoc uri; // the source uri
34
private String JavaDoc config; // the source configuration file
35
private String JavaDoc sourceTypeId; // the source type id
36
private String JavaDoc sourceName; //the source name
37

38     /** Creates a new instance of Sync4jSyncSource */
39     public Sync4jSource() {
40         this(null, null, null, null);
41     }
42
43     public Sync4jSource(String JavaDoc uri) {
44         this(uri, null, null, null);
45     }
46
47     public Sync4jSource(String JavaDoc uri, String JavaDoc config) {
48         this(uri,config, null, null);
49     }
50
51     public Sync4jSource(String JavaDoc uri ,
52                         String JavaDoc config ,
53                         String JavaDoc sourceTypeId,
54                         String JavaDoc sourceName ) {
55         this.uri = uri ;
56         this.config = config;
57         this.sourceTypeId = sourceTypeId;
58         this.sourceName = sourceName;
59     }
60
61     /** Getter for property uri.
62      * @return Value of property uri.
63      *
64      */

65     public String JavaDoc getUri() {
66         return uri;
67     }
68
69     /** Setter for property uri.
70      * @param uri New value of property uri.
71      *
72      */

73     public void setUri(String JavaDoc uri) {
74         int qMark = uri.indexOf('?');
75         if (qMark == -1) {
76             this.uri = uri;
77         } else {
78             this.uri = uri.substring(0, qMark);
79         }
80     }
81
82     /** Getter for property config.
83      * @return Value of property config.
84      *
85      */

86     public String JavaDoc getConfig() {
87         return config;
88     }
89
90     /** Setter for property config.
91      * @param config New value of property config.
92      *
93      */

94     public void setConfig(String JavaDoc config) {
95         this.config = config;
96     }
97
98     /** Getter for property sourceTypeId.
99      * @return Value of property sourceTypeId.
100      *
101      */

102     public String JavaDoc getSourceTypeId() {
103         return sourceTypeId;
104     }
105
106     /** Setter for property sourceTypeId.
107      * @param sourceTypeId New value of property sourceTypeId.
108      *
109      */

110     public void setSourceTypeId(String JavaDoc sourceTypeId) {
111         this.sourceTypeId = sourceTypeId;
112     }
113
114     /** Getter for property sourceName.
115      * @return Value of property sourceName.
116      *
117      */

118     public String JavaDoc getSourceName() {
119         return sourceName;
120     }
121
122     /** Setter for property sourceName.
123      * @param sourceName New value of property sourceName.
124      *
125      */

126     public void setSourceName(String JavaDoc sourceName) {
127         this.sourceName = sourceName;
128     }
129
130     public String JavaDoc toString() {
131         ToStringBuilder sb = new ToStringBuilder(this);
132
133          sb.append("uri", uri );
134          sb.append("config", config);
135          sb.append("sourceTypeId", sourceTypeId);
136          sb.append("sourceName", sourceName);
137
138          return sb.toString();
139     }
140
141 }
142
Popular Tags