KickJava   Java API By Example, From Geeks To Geeks.

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


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 a <i>SyncOperation</i> status.
28  *
29  * @author Stefano Fornari @ Funambol
30  *
31  * @version $Id: SyncOperationStatus.java,v 1.7 2005/03/02 20:57:37 harrie Exp $
32  *
33  */

34 public class SyncOperationStatus {
35     
36     // -------------------------------------------------------------- Properties
37

38     /**
39      * The operation this object represents the execution for
40      */

41     private SyncOperation operation;
42     
43     /** Getter for property operation.
44      * @return Value of property operation.
45      *
46      */

47     public SyncOperation getOperation() {
48         return operation;
49     }
50     
51     /**
52      * The source the operation was executed on
53      */

54     private SyncSource syncSource;
55     
56     /** Getter for property syncSource.
57      * @return Value of property syncSource.
58      *
59      */

60     public SyncSource getSyncSource() {
61         return syncSource;
62     }
63     
64     /**
65      * The status code
66      */

67     private int statusCode;
68     
69     /**
70      * Getter for property statusCode.
71      * @return Value of property syncSource.
72      *
73      */

74     public int getStatusCode() {
75         return statusCode;
76     }
77         
78     
79     // ------------------------------------------------------------- Contructors
80

81     /**
82      * Creates a new instance of SyncOperationStatus
83      *
84      * @param operation the operation - NOT NULL
85      * @param syncSource the source - NOT NULL
86      * @param statusCode the status code
87      *
88      * @throws IllegalArgumentException in case operation is null
89      */

90     public SyncOperationStatus( SyncOperation operation ,
91                                 SyncSource syncSource ,
92                                 int statusCode ) {
93         if (operation == null) {
94             throw new IllegalArgumentException JavaDoc("operation cannnot be null");
95         }
96         if (syncSource == null) {
97             throw new IllegalArgumentException JavaDoc("syncSource cannnot be null");
98         }
99         
100         this.operation = operation ;
101         this.syncSource = syncSource;
102         this.statusCode = statusCode;
103     }
104     
105     /**
106      * Creates a new instance of SyncOperationStatus
107      *
108      * @param operation the operation - NOT NULL
109      * @param syncSource the source - NOT NULL
110      *
111      * @throws IllegalArgumentException in case operation is null
112      */

113     public SyncOperationStatus( SyncOperation operation ,
114                                 SyncSource syncSource ) {
115         this(operation, syncSource, -1);
116     }
117        
118     // ---------------------------------------------------------- Public methods
119

120     public String JavaDoc toString() {
121         return new ToStringBuilder(this).
122             append("operation", operation.toString() ).
123             append("syncSource", syncSource.toString()).
124             append("statusCode", statusCode).
125             toString();
126     }
127     
128 }
Popular Tags