View Javadoc

1   /*
2    * <cvs:source>$Source: /devel/astrogrid/filestore/common/src/java/org/astrogrid/filestore/common/transfer/TransferProperties.java,v $</cvs:source>
3    * <cvs:author>$Author: clq2 $</cvs:author>
4    * <cvs:date>$Date: 2005/01/28 10:44:00 $</cvs:date>
5    * <cvs:version>$Revision: 1.5 $</cvs:version>
6    * <cvs:log>
7    *   $Log: TransferProperties.java,v $
8    *   Revision 1.5  2005/01/28 10:44:00  clq2
9    *   dave_dev_200501141257 (filemanager)
10   *
11   *   Revision 1.4.10.1  2005/01/20 07:18:04  dave
12   *   Tided up tabs to spaces ..
13   *
14   *   Revision 1.4  2004/11/25 00:19:20  jdt
15   *   Merge from dave-dev-200410061224-200411221626
16   *
17   *   Revision 1.3.30.5  2004/11/17 19:06:30  dave
18   *   Updated server configuration ...
19   *
20   *   Revision 1.3.30.4  2004/11/06 12:17:36  dave
21   *   Modified getServiceIdent() to return full ivorn string.
22   *
23   *   Revision 1.3.30.3  2004/10/29 15:54:50  dave
24   *   Added exportInit to mock implementation ...
25   *   Added UrlGetRequest to pass into exportInit ...
26   *   Added test for exportInit and UrlGetRequest ...
27   *
28   *   Revision 1.3.30.2  2004/10/26 11:13:11  dave
29   *   Changed transfer properties 'source' to 'location', makes more sense for PUT transfers.
30   *
31   *   Revision 1.3.30.1  2004/10/21 21:00:13  dave
32   *   Added mock://xyz URL handler to enable testing of transfer.
33   *   Implemented importInit to the mock service and created transfer tests.
34   *
35   *   Revision 1.3  2004/09/02 10:25:41  dave
36   *   Updated FileStore and MySpace to handle mime type and file size.
37   *   Updated Community deployment script.
38   *
39   *   Revision 1.2.46.1  2004/09/01 02:58:07  dave
40   *   Updated to use external mime type for imported files.
41   *
42   *   Revision 1.2  2004/07/21 18:11:55  dave
43   *   Merged development branch, dave-dev-200407201059, into HEAD
44   *
45   *   Revision 1.1.2.1  2004/07/20 19:10:40  dave
46   *   Refactored to implement URL import
47   *
48   *   Revision 1.2  2004/07/14 13:50:29  dave
49   *   Merged development branch, dave-dev-200406301228, into HEAD
50   *
51   *   Revision 1.1.2.1  2004/07/05 04:50:29  dave
52   *   Created initial FileStore components
53   *
54   * </cvs:log>
55   *
56   */
57  package org.astrogrid.filestore.common.transfer ;
58  
59  import org.astrogrid.filestore.common.file.FileProperty;
60  import org.astrogrid.filestore.common.file.FileProperties;
61  
62  import org.astrogrid.filestore.common.FileStoreInputStream;
63  import org.astrogrid.filestore.common.FileStoreOutputStream;
64  
65  import org.astrogrid.filestore.common.identifier.UniqueIdentifier;
66  
67  /***
68   * An object to hold metadata about a data transfer.
69   *
70   */
71  public class TransferProperties
72      {
73  
74      /***
75       * Public constructor.
76       * Required for Axis to serialize this as a Bean.
77       *
78       */
79      public TransferProperties()
80          {
81          }
82  
83      /***
84       * Public constructor.
85       * @param ident A unique identifier for the transfer.
86       *
87       */
88      public TransferProperties(String ident)
89          {
90          this(
91              ident,
92              (FileProperty[]) null
93              ) ;
94          }
95  
96      /***
97       * Public constructor.
98       * @param properties The properties for the file to transfer
99       *
100      */
101     public TransferProperties(FileProperties properties)
102         {
103         this(
104             null,
105             (null != properties) ? properties.toArray() : (FileProperty[]) null
106             ) ;
107         }
108 
109     /***
110      * Public constructor.
111      * @param ident A unique identifier for the transfer.
112      * @param properties The properties for the file to transfer
113      *
114      */
115     public TransferProperties(String ident, FileProperties properties)
116         {
117         this(
118             ident,
119             (null != properties) ? properties.toArray() : (FileProperty[]) null
120             ) ;
121         }
122 
123     /***
124      * Public constructor.
125      * @param ident A unique identifier for the transfer.
126      * @param properties The properties for the file to transfer
127      *
128      */
129     public TransferProperties(String ident, FileProperty[] properties)
130         {
131         this.setIdent(
132             ident
133             ) ;
134         this.setFileProperties(
135             properties
136             ) ;
137         }
138 
139     /***
140      * The transfer identifier.
141      *
142      */
143     private String ident ;
144 
145     /***
146      * Access to our ident.
147      *
148      */
149     public String getIdent()
150         {
151         return this.ident ;
152         }
153 
154     /***
155      * Access to our ident.
156      *
157      */
158     public void setIdent(String value)
159         {
160         this.ident = value ;
161         }
162 
163     /***
164      * The transfer location (URL).
165      * eg http://host.domain/path/file
166      *
167      */
168     private String location ;
169 
170     /***
171      * Access to the transfer location (URL).
172      * eg http://host.domain/path/file
173      *
174      */
175     public String getLocation()
176         {
177         return this.location ;
178         }
179 
180     /***
181      * Access to the transfer location (URL).
182      * eg http://host.domain/path/file
183      * @param The transfer location (RL).
184      *
185      */
186     public void setLocation(String value)
187         {
188         this.location = value ;
189         }
190 
191     /***
192      * The transfer protocol.
193      * eg http, ftp
194      * @todo generate this from our URL ?
195      *
196      */
197     private String protocol ;
198 
199     /***
200      * Access to the transfer protocol.
201      * eg http, ftp
202      * @todo generate this from our URL ?
203      *
204      */
205     public String getProtocol()
206         {
207         return this.protocol ;
208         }
209 
210     /***
211      * Access to the transfer protocol.
212      * eg http, ftp
213      * @todo generate this from our URL ?
214      *
215      */
216     public void setProtocol(String value)
217         {
218         this.protocol = value ;
219         }
220 
221     /***
222      * The transfer method.
223      * eg GET, PUT, POST
224      *
225      */
226     private String method ;
227 
228     /***
229      * Access to the transfer method.
230      * eg GET, PUT, POST
231      *
232      */
233     public String getMethod()
234         {
235         return this.method ;
236         }
237 
238     /***
239      * Access to the transfer method.
240      * eg GET, PUT, POST
241      *
242      */
243     public void setMethod(String value)
244         {
245         this.method = value ;
246         }
247 
248     /***
249      * The file properties for the transferred data.
250      *
251      */
252     private FileProperty[] properties ;
253 
254     /***
255      * Access to our file properties.
256      *
257      */
258     public FileProperty[] getFileProperties()
259         {
260         return this.properties ;
261         }
262 
263     /***
264      * Set the transfer properties.
265      *
266      */
267     public void setFileProperties(FileProperties properties)
268         {
269         this.setFileProperties(
270             properties.toArray()
271             );
272         }
273 
274     /***
275      * Set the transfer properties.
276      *
277      */
278     public void setFileProperties(FileProperty[] properties)
279         {
280         this.properties = properties ;
281         }
282     }
283