KickJava   Java API By Example, From Geeks To Geeks.

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


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 is a base implementation of a <i>SyncOperationStatus</i>
28  *
29  * @author Stefano Fornari @ Funambol
30  * @version $Id: SyncOperationStatusImpl.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
31  *
32  */

33 public abstract class SyncOperationStatusImpl implements SyncOperationStatus {
34     
35     // -------------------------------------------------------------- Properties
36

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

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

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

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

59     public SyncSource getSyncSource() {
60         return syncSource;
61     }
62         
63     
64     // ------------------------------------------------------------- Contructors
65

66     /**
67      * Creates a new instance of SyncOperationStatus
68      *
69      * @param operation the operation - NOT NULL
70      * @param syncSource the source - NOT NULL
71      *
72      * @throws IllegalArgumentException in case operation is null
73      */

74     public SyncOperationStatusImpl(SyncOperation operation, SyncSource syncSource) {
75         if (operation == null) {
76             throw new IllegalArgumentException JavaDoc("operation cannnot be null");
77         }
78         if (syncSource == null) {
79             throw new IllegalArgumentException JavaDoc("syncSource cannnot be null");
80         }
81         
82         this.operation = operation ;
83         this.syncSource = syncSource;
84     }
85        
86     // ---------------------------------------------------------- Public methods
87

88     public String JavaDoc toString() {
89         return new ToStringBuilder(this).
90             append("operation", operation.toString() ).
91             append("syncSource", syncSource.toString()).
92             toString();
93     }
94     
95     /** The operation status code
96      * @return the operation status code
97      *
98      */

99     abstract public int getStatusCode();
100     
101 }
Popular Tags