|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.s60tools.hticonnection.services.ftpservice; |
|
19 |
|
20 import com.nokia.HTI.BaseService; |
|
21 import com.nokia.HTI.IService; |
|
22 import com.nokia.s60tools.hticonnection.core.AbstractRequest; |
|
23 import com.nokia.s60tools.hticonnection.core.RequestResult; |
|
24 |
|
25 /** |
|
26 * Callable object that can be used to wait for request to complete. |
|
27 */ |
|
28 public class ListDirsRequest extends AbstractRequest{ |
|
29 |
|
30 /** |
|
31 * Name used for request. |
|
32 */ |
|
33 private static final String REQUEST_NAME = "List dirs"; //$NON-NLS-1$ |
|
34 |
|
35 // Settings for list dirs request |
|
36 private final String remoteDir; |
|
37 private final long timeout; |
|
38 |
|
39 /** |
|
40 * List directories in given directory |
|
41 * @param remoteDir Directory |
|
42 * @param timeout Timeout for request |
|
43 */ |
|
44 public ListDirsRequest(String remoteDir, long timeout){ |
|
45 super(REQUEST_NAME); |
|
46 this.remoteDir = remoteDir; |
|
47 this.timeout = timeout; |
|
48 } |
|
49 |
|
50 /* (non-Javadoc) |
|
51 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#createService() |
|
52 */ |
|
53 public BaseService createService(){ |
|
54 return new com.nokia.HTI.FTPService.FTPService(); |
|
55 } |
|
56 |
|
57 /* (non-Javadoc) |
|
58 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#invokeService(com.nokia.HTI.IService) |
|
59 */ |
|
60 public RequestResult invokeService(IService service) throws Exception{ |
|
61 String[] result = ((com.nokia.HTI.FTPService.FTPService)service) |
|
62 .listDirs(remoteDir, timeout); |
|
63 return new RequestResult(result); |
|
64 } |
|
65 } |