KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > engine > SyncStatus


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.engine;
20
21 import sync4j.framework.engine.SyncOperation;
22 import sync4j.framework.engine.source.SyncSource;
23
24 import org.apache.commons.lang.builder.ToStringBuilder;
25
26 /**
27  * This class represents the status of a Sync operation on a SyncSource.
28  *
29  * @author Stefano Fornari @ Funambol
30  * @version $Id: SyncStatus.java,v 1.3 2005/03/02 20:57:37 harrie Exp $
31  *
32  */

33 public class SyncStatus {
34     
35     // -------------------------------------------------------------- Properties
36

37     /**
38      * The status code
39      */

40     protected int statusCode;
41     
42     /**
43      * Getter for property statusCode.
44      * @return Value of property syncSource.
45      *
46      */

47     public int getStatusCode() {
48         return statusCode;
49     }
50     
51     /**
52      * Sets the operation status code
53      *
54      * @param statusCode the new statusCode
55      */

56     public void setStatusCode(int statusCode) {
57         this.statusCode = statusCode;
58     }
59     
60     /**
61      * An optional status description
62      */

63     private String JavaDoc message;
64     
65     /**
66      * Getter for property message.
67      * @return Value of property message.
68      *
69      */

70     public String JavaDoc getMessage() {
71         return message;
72     }
73     
74     /**
75      * Sets the operation message code
76      *
77      * @param message the new message
78      */

79     public void setMessage(String JavaDoc message) {
80         this.message = message;
81     }
82     
83     /**
84      * The source the operation was executed on
85      */

86     protected SyncSource syncSource;
87     
88     /** Getter for property syncSource.
89      * @return Value of property syncSource.
90      *
91      */

92     public SyncSource getSyncSource() {
93         return syncSource;
94     }
95         
96     
97     // ------------------------------------------------------------- Contructors
98

99     /**
100      * Just for sbclasses
101      */

102     protected SyncStatus() {
103         syncSource = null;
104         statusCode = -1;
105     }
106     
107     /**
108      * Creates a new instance of SyncStatus
109      *
110      * @param syncSource the source - NOT NULL
111      * @param statusCode the statusCode
112      *
113      * @throws IllegalArgumentException in case operation is null
114      */

115     public SyncStatus(SyncSource syncSource, int statusCode, String JavaDoc message) {
116         if (syncSource == null) {
117             throw new IllegalArgumentException JavaDoc("syncSource cannnot be null");
118         }
119         
120         this.syncSource = syncSource;
121         this.statusCode = statusCode;
122         this.message = message ;
123     }
124     
125     /**
126      * Creates a new instance of SyncStatus with an unknown status code
127      *
128      * @param syncSource the source - NOT NULL
129      *
130      * @throws IllegalArgumentException in case operation is null
131      */

132     public SyncStatus(SyncSource syncSource) {
133         this(syncSource, -1, "");
134     }
135        
136     // ---------------------------------------------------------- Public methods
137

138 }
139
Popular Tags