KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > Source


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
20 package sync4j.framework.core;
21
22 /**
23  * This class represents to the <Source> s defined by the SyncML
24  * representation specifications
25  *
26  * @author Stefano Fornari @ Funambol
27  *
28  * @version $Id: Source.java,v 1.3 2005/03/02 20:57:37 harrie Exp $
29  */

30 public final class Source
31 implements java.io.Serializable JavaDoc {
32     // ------------------------------------------------------------ Private data
33

34     /**
35      * Specifies the source specific URI
36      */

37     private String JavaDoc locURI;
38     
39     /**
40      * Specifies the display name for the source address
41      */

42     private String JavaDoc locName;
43     
44     // ------------------------------------------------------------ Constructors
45

46     /**
47      * For serialization purposes
48      */

49     protected Source() {}
50     
51     /**
52      * Creates a new Source object given its URI and display name.
53      *
54      * @param locURI the source URI - NOT NULL
55      * @param locName the source display name - NULL ALLOWED
56      *
57      * @throws IllegalArgumentException if logURI is null.
58      */

59     public Source(final String JavaDoc locURI, final String JavaDoc locName) {
60         setLocURI(locURI);
61         this.locName = locName;
62     }
63     
64     /**
65      * Creates a new Source object given its URI
66      *
67      * @param locURI the source URI - NOT NULL
68      *
69      * @throws IllegalArgumentException if logURI is null.
70      */

71     public Source(final String JavaDoc locURI) {
72         this(locURI, null);
73     }
74         
75     // ------------------------------------------------------ Public methods
76

77     /**
78      * Returns the source URI value
79      *
80      * @return the source URI value
81      */

82     public String JavaDoc getLocURI() {
83         return locURI;
84     }
85     
86     /**
87      * Sets the source URI
88      *
89      * @param locURI the source URI - NOT NULL
90      *
91      * @throws IllegalArgumentException if locURI is null
92      */

93     public void setLocURI(final String JavaDoc locURI) {
94         if (locURI == null) {
95             throw new IllegalArgumentException JavaDoc("locURI cannot be null");
96         }
97         this.locURI = locURI;
98     }
99     
100     /**
101      * Returns the source display name
102      *
103      * @return the source display name
104      *
105      */

106     public String JavaDoc getLocName() {
107         return locName;
108     }
109     
110     /**
111      * Sets the local name property
112      *
113      * @param locName the local name property
114      *
115      */

116     public void setLocName(String JavaDoc locName) {
117         this.locName = locName;
118     }
119 }
Popular Tags