Revision 45832

View differences:

tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/IRunnableTask.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning;
25

  
26
/**
27
 * Interface implemented by those tasks that can be background-executed,
28
 * cancelled or any other thing.
29
 * 
30
 * @author jaume dominguez faus - jaume.dominguez@iver.es
31
 */
32
public interface IRunnableTask {
33
	/**
34
	 * Executes this task's operations.
35
	 */
36
	public void execute();
37
	
38
	/**
39
	 * Cancels the current execution, if any, of this task. Should have no
40
	 * effect if the task is not executing anything.
41
	 */
42
	public void cancel();
43
	
44
	/**
45
	 * Tells if the task is on execution.
46
	 * @return true if the task is busy, false otherwise.
47
	 */
48
	public boolean isRunning();
49
	
50
	/**
51
	 * Returns the timeout set to this task in milliseconds
52
	 * @return the amount of milliseconds to wait until the task
53
	 * 		   will be considered as unsuccessful, or 0 or less to
54
	 * 		   say that task can wait forever.
55
	 */
56
	public long getTaskTimeout();
57
}
0 58

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/FIFOTaskPlanner.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning;
25

  
26
/**
27
 * A simple FIFO task planner. The tasks returned by this planner are executed
28
 * enterely. It does not issue another task until the current is finished. 
29
 * @author jaume
30
 *
31
 */
32
public class FIFOTaskPlanner implements ITaskPlanner {
33
	IQueue queue;
34
	
35
	/**
36
	 * Creates a new instance of FIFOTaskPlanner that will work against the
37
	 * queue passed as paramenter 
38
	 * @param queue, the IQueue to be planned
39
	 */
40
	public FIFOTaskPlanner(IQueue queue) {
41
		this.queue = queue;
42
	}
43

  
44
	
45
	public IRunnableTask nextTask() {
46
		synchronized (this) {
47
			return (IRunnableTask) queue.getTasks().remove(0);
48
		}
49
	}
50
	/**
51
	 * FIFO plans have no previous tasks so, null is always returned.
52
	 */
53
	public IRunnableTask previousTask() {
54
		return null;
55
	}
56

  
57
}
0 58

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/ITaskPlanner.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning;
25

  
26
/**
27
 * <p>
28
 * ITaskPlanner provides an interface to program your own task planning. It gives
29
 * you operations for pick a task from the queue according on the criteria that
30
 * you designed.<br>
31
 * </p>
32
 * <p>
33
 * The simplest implementation of ITaskPlanner would be a FIFO task planner (see
34
 * FIFOTaskPlanner.java) which takes jobs from a task queue in the same order
35
 * they were put. But any kind of planner is possible (SJF, LIFO, RoundRobin, etc.). 
36
 * </p>
37
 * @author jaume dominguez faus - jaume.dominguez@iver.es
38
 *
39
 */
40
public interface ITaskPlanner {
41
	/**
42
	 * Takes the next task to be executed.
43
	 * @return IRunnableTask representing the next task to be executed
44
	 */
45
	public IRunnableTask nextTask();
46
	
47
	/**
48
	 * Takes the previous executed task. Notice that it may or may not have
49
	 * sense for specific implementations. For example, in a FIFO-like planner,
50
	 * the task is taken from the queue, executed until it is finished and 
51
	 * removed from the queue. So, there is no previous task.
52
	 * 
53
	 * @return IRunnableTask representing the previous executed task, or null
54
	 * if none.
55
	 * @deprecated (probably this is unuseful and i'll remove it)
56
	 */
57
	public IRunnableTask previousTask();
58
}
0 59

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/IQueue.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning;
25

  
26
import java.util.Vector;
27

  
28
/**
29
 *  <p>
30
 *  You should write your own concrete Queue implementation to hold the tasks in
31
 *  a specific kind of queue.<br>
32
 *  </p>
33
 *  <p>
34
 *  Following the contract, you should also write a task planner that does what 
35
 *  you desire. Task planners are a concrete class of the ITaskPlanner that would 
36
 *  plannify which is the next, the previous,.. task to be done. However, if
37
 *  you don't want to write anything special, just guess a simple FIFO queue<br>
38
 *  </p>
39
 *  
40
 *  @author jaume dominguez faus - jaume.dominguez@iver.es
41
 *  @see ITaskPlanner
42
 */
43
public interface IQueue {
44
	
45
	/**
46
	 * Adds a new task to the queue. The place where the new task will be put its
47
	 * left to the concrete implementation of this interface.
48
	 * @param IRunnableTask task
49
	 */
50
	IRunnableTask put(IRunnableTask task);
51
	
52
	/**
53
	 * Returns the next task by calling the task planner's nextTask() method.
54
	 * @return IRunnableTask with the next task to be executed.
55
	 */
56
	IRunnableTask take();
57
	
58
	/**
59
	 * Returns true if the Queue has no (more) jobs to do.
60
	 * @return
61
	 */
62
	boolean isEmpty();
63
	
64
	/**
65
	 * Returns the task planner currently defined by this queue.
66
	 * @return ITaskPlanner
67
	 */
68
	ITaskPlanner getTaskPlanner();
69
	
70
	/**
71
	 * Sets the TaskPlanner that will decide which of the tasks in the queue will
72
	 * be executed next. A null value should represent a FIFO planner. 
73
	 * @param planner
74
	 */
75
	void setTaskPlanner(ITaskPlanner planner);
76
	
77
	/**
78
	 * Causes the execution of this queue to be paused. The task currently in execution
79
	 * finishes and after it the planner will not issue more tasks until resume() is
80
	 * invoked.
81
	 */
82
	void pause();
83
	
84
	/**
85
	 * Causes the execution of this queue to be resumed. The execution will continue
86
	 * with the next task issued by the planner. It has no effect if the queue was not
87
	 * paused yet. 
88
	 */
89
	void resume();
90

  
91
	/**
92
	 * Returns the set of tasks in a Vector (thread-safe).
93
	 * @return Vector containing the tasks in this queue.
94
	 */
95
	Vector getTasks();
96
}
0 97

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/RequestManager.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26
import java.io.File;
27
import java.net.MalformedURLException;
28
import java.util.Hashtable;
29
import java.util.TreeMap;
30

  
31
import org.gvsig.remoteclient.taskplanning.IQueue;
32

  
33
/**
34
 * pa administrar les tasques (la hist?ria aquella
35
 *  de que hi haja una cola per a cada servidor)
36
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
37
 */
38
public class RequestManager {
39
	private boolean debug = true;
40
    
41
	private static RequestManager instance;
42
	private TreeMap serversTable = new TreeMap();
43
	private RequestManager() {} // Avoid public instantiation
44
	 
45
	public static RequestManager getInstance() {
46
		if (instance == null)
47
			instance = new RequestManager();
48
		return instance;
49
	}
50
	
51
	
52
	public URLRetrieveTask addURLRequest(URLRequest request, RetrieveListener listener) {
53
		try {
54
			
55
			// TODO canviar per a quetorne el Request antic, que la request guarde el
56
			// seu estat aix? com la llista de listeners
57
			File f = getPreviousDownloadedURLRequest(request);
58
			
59
			if (f!=null) {
60
				// The file was already requested and it is in the cache or
61
				// the download is in process
62
				
63
				// Overwrite the file name with the file in the cache's one.
64
				request.setFileName(f.getAbsolutePath());
65
				System.out.println(request.getUrl()+" is cached at '"+f.getAbsolutePath()+"'");
66
				
67

  
68
				// get this server's task queue
69
				RetrieveQueue serverQueue = (RetrieveQueue) getQueue(request.getHost());
70
				
71
				// Look up the previous cached jobs
72
				
73
				URLRetrieveTask workingTask = serverQueue.getURLPreviousRequest(request);
74
				if (workingTask == null) {
75
					// Task already done. Notify listener
76
					if (debug)
77
						System.err.println("done job found: "+request.getUrl());
78
					RetrieveEvent event = new RetrieveEvent();
79
					event.setType(RetrieveEvent.REQUEST_FINISHED);
80
					listener.transferEventReceived(event);
81
					
82
				} else {
83
					// The task is working yet, will register the listener
84
					
85
					// TODO no va b?... perqu? la cola va buidant-se molt r?pidament
86
					// per a fer que vaja tamb? hi hauria que registrar en cache
87
					// lo que s'est? baixant al principi de l'execute();
88
					if (debug)
89
						System.err.println("working job found: "+request.getUrl());
90
					workingTask.addRetrieveListener(listener);
91
					
92
				}
93
			} else {
94
				// Pick an unrepeatable fileName
95
				String host = request.getHost();
96
				String fileName = request.getFileName();
97
				File tempDir = new File(tempDirectoryPath);
98
				if (!tempDir.exists())
99
					tempDir.mkdir();
100
				String fileNamePrefix = tempDirectoryPath + 
101
											File.separator + host + 
102
											"-" ;
103
				if (fileName.startsWith(fileNamePrefix))
104
					fileName = fileName.substring(fileNamePrefix.length(), fileName.length());
105
				
106
				// get this server's task queue
107
				RetrieveQueue serverQueue = (RetrieveQueue) getQueue(request.getHost());
108
				
109
				
110
				fileName = fileNamePrefix + fileName;
111
				
112
				request.setFileName(fileName);
113
				
114
				// TODO
115
				// jo ac? comprovaria quin protocol, m?tode, host, etc... i crearia un
116
				// objecte que tractara la desc?rrega segons el m?tode que li toca.
117
				// algo en plan Strategy's
118
				//
119
				// per exemple si fem URLRetrieveTask una abstracta i tenim
120
				// 
121
				// GET de tota la vida
122
				// serverQueue.put(new HTTPGetRetrieveTask(request, listener));
123
				//
124
				// POST
125
				// serverQueue.put(new HTTPPostRetrieveTask(request, listener));
126
				//
127
				// FTP
128
				// serverQueue.put(new FTPRetrieveTask(request, listener));
129
				//
130
				// ????Xarxa local?????
131
				// serverQueue.put(new SMBRetrieveTask(request, listener));
132
				
133
				// Enqueue the request and the listener will be notified when done.
134
				URLRetrieveTask task = new URLRetrieveTask(request, listener);
135
				return (URLRetrieveTask) serverQueue.put(task);
136
			}
137
		} catch (MalformedURLException e) {
138
			e.printStackTrace();
139
		}
140
		return null;
141
	}
142
	
143
	private IQueue getQueue(String hostName) {
144
		RetrieveQueue queue = null;
145
		if (serversTable.containsKey(hostName))
146
			queue = (RetrieveQueue) serversTable.get(hostName);
147
		else {
148
			// crea la cola
149
			queue = new RetrieveQueue(hostName);
150
			// pone la cola del server en marcha.
151
		}
152
		return queue;
153
	}
154

  
155

  
156
	private Hashtable downloadedFiles;
157
	private final String tempDirectoryPath = System.getProperty("java.io.tmpdir")+"tmp-andami";
158
	/**
159
     * Remove an URL from the system cache. The file will remain in the file
160
     * system for further eventual uses.
161
     * @param request
162
     */
163
	public void removeURLRequest(URLRequest request) {
164
		if (downloadedFiles != null && downloadedFiles.containsKey(request))
165
			downloadedFiles.remove(request);
166
	}
167
	/**
168
     * Adds an URL to the table of downloaded files for further uses. If the URL
169
     * already exists in the table its filePath value is updated to the new one and
170
     * the old file itself is removed from the file system.
171
     * 
172
     * @param url
173
     * @param filePath
174
     */
175
    protected void addDownloadedURLRequest(URLRequest request, String filePath){
176
        if (downloadedFiles==null)
177
            downloadedFiles = new Hashtable();
178
        String fileName = (String) downloadedFiles.put(request, filePath);
179
        if (fileName!=null){
180
            File f = new File(fileName);
181
            if (f.exists())
182
                f.delete();
183
        }
184
    }
185
    /**
186
     * Returns the content of this URL as a file from the file system.<br>
187
     * <p>
188
     * If the URL has been already downloaded in this session and notified 
189
     * to the system using the static <b>Utilities.addDownloadedURL(URL)</b>
190
     * method, it can be restored faster from the file system avoiding to
191
     * download it again.
192
     * </p>
193
     * @param url
194
     * @return File containing this URL's content or null if no file was found.
195
     */
196
    private File getPreviousDownloadedURLRequest(URLRequest request){
197
        File f = null;
198
        if (downloadedFiles!=null && downloadedFiles.containsKey(request)){
199
            String filePath = (String) downloadedFiles.get(request);
200
            f = new File(filePath);
201
        }
202
        return f;
203
    }
204
    
205
}
0 206

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/RetrieveEvent.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26
/**
27
 * @author jaume dominguez faus - jaume.dominguez@iver.es
28
 * Luis W. Sevilla (sevilla_lui@gva.es)
29
 */
30
public class RetrieveEvent {
31
	public static final int NOT_STARTED = 0;
32
	public static final int CONNECTING = 1;
33
	public static final int TRANSFERRING = 2;
34
	public static final int REQUEST_FINISHED = 3;
35
	public static final int REQUEST_FAILED = 4;
36
	public static final int REQUEST_CANCELLED = 5;
37
	public static final int POSTPROCESSING = 6;
38
	
39
	/**
40
	 * redundant; use REQUEST_FAILED
41
	 * @deprecated ?
42
	 */
43
	public static final int ERROR = 11;
44
	
45
	private int eventType;
46
	
47
	public void setType(int type) {
48
		eventType = type;
49
	}
50

  
51
	public int getType() {
52
		return eventType;
53
	}
54
}
0 55

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/RetrieveQueue.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26
import java.util.Date;
27
import java.util.Vector;
28

  
29
import org.gvsig.remoteclient.taskplanning.FIFOTaskPlanner;
30
import org.gvsig.remoteclient.taskplanning.IQueue;
31
import org.gvsig.remoteclient.taskplanning.IRunnableTask;
32
import org.gvsig.remoteclient.taskplanning.ITaskPlanner;
33

  
34
/**
35
 * @author jaume dominguez faus - jaume.dominguez@iver.es
36
 * 		   Luis W. Sevilla (sevilla_lui@gva.es)
37
 */
38
public class RetrieveQueue implements IQueue {
39
	private String hostName;
40
	private Date startTime;
41
	private Vector tasks = new Vector();
42
	private boolean waiting;
43
	private ITaskPlanner taskPlanner;
44
	private Worker worker;
45
	
46
	/**
47
	 * 
48
	 */
49
	public RetrieveQueue(String hName) {
50
		hostName = hName;
51
		startTime = new Date();
52
		worker = new Worker();
53
		new Thread(worker).start();
54
	}
55
	
56
	
57
	public IRunnableTask put(IRunnableTask task) {
58
		tasks.add(task);
59
		if (waiting) {
60
			synchronized (this) {
61
				notifyAll();
62
			}
63
		}
64
		return task;
65
	}
66
	
67
	public IRunnableTask take() {
68
		if (tasks.isEmpty()) {
69
			synchronized (this) {
70
				waiting = true;
71
				try {
72
					wait();
73
				} catch (InterruptedException ie) {
74
					waiting = false;
75
				}
76
			}
77
		}
78
		return getTaskPlanner().nextTask() ;
79
	}
80
	
81
	
82
	
83
	public boolean isEmpty() {
84
		synchronized (this) {
85
			return tasks.isEmpty() && !worker.r.isRunning();
86
		}
87
	}
88
	
89
	
90

  
91
	public ITaskPlanner getTaskPlanner() {
92
		if (taskPlanner == null) {
93
			taskPlanner = new FIFOTaskPlanner(this);
94
		}
95
		return taskPlanner;
96
	}
97

  
98

  
99
	public void setTaskPlanner(ITaskPlanner planner) {
100
		taskPlanner = planner;
101
	}
102

  
103

  
104
	public void pause() {
105
		waiting = true;
106
	}
107

  
108

  
109
	public void resume() {
110
		waiting = false;
111
	}
112

  
113

  
114
	public Vector getTasks() {
115
		return tasks;
116
	}
117

  
118
	private class Worker implements Runnable {
119
		URLRetrieveTask r;
120
		int i = 0; 
121
		public void run() {
122
			while (true) {
123
				r = (URLRetrieveTask) take();
124
				r.execute();
125
			}
126
		}
127
	}
128

  
129
	protected URLRetrieveTask getURLPreviousRequest(URLRequest request) {
130
		// Is the one currently running?
131
		/*URLRetrieveTask aux = (URLRetrieveTask) worker.r;
132
		if (request.equals(aux.getRequest())) {
133
				return aux;
134
		}*/	
135
		// Is one of those in the queue?
136
		for (int i = 0; i < tasks.size(); i++) {
137
			URLRetrieveTask task = (URLRetrieveTask) tasks.get(i);
138
			URLRequest aWorkingRequest = task.getRequest();
139
			if (aWorkingRequest.equals(request)) {
140
				return task;
141
			}
142
		}
143
		return null;
144
	}
145
}
0 146

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/RetrieveListener.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26

  
27
/**
28
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
29
 */
30
public interface RetrieveListener {
31
	public void transferEventReceived(RetrieveEvent event);
32
}
0 33

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/URLRequest.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26
import java.net.MalformedURLException;
27
import java.net.URL;
28

  
29
/**
30
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
31
 */
32
public class URLRequest{
33
	public static final String HTTP = "http";
34
	private volatile int hashCode = 0;
35
	public static final int GET = 1;
36
	public static final int POST = 2;
37
	
38
	private int requestType = GET;
39
	private String protocol;
40
	private String host;
41
	private int port = -1;
42
	private String file;
43
	private String fileName;
44
	
45
	public URL getUrl() throws MalformedURLException {
46
		String u = protocol;
47
		u += "://"+host;
48
		if (port != -1)
49
			u += ":"+port;
50
		u += "/"+file;
51
		return new URL(u);
52
	}
53
	/**
54
	 * @return Returns the fileName.
55
	 */
56
	public String getFileName() {
57
		return fileName;
58
	}
59
	/**
60
	 * @param fileName The fileName to set.
61
	 */
62
	public void setFileName(String fileName) {
63
		this.fileName = fileName;
64
	}
65
	/**
66
	 * @return Returns the host.
67
	 */
68
	public String getHost() {
69
		return host;
70
	}
71
	/**
72
	 * @param host The host to set.
73
	 */
74
	public void setHost(String host) {
75
		this.host = host;
76
	}
77
	/**
78
	 * @return Returns the file.
79
	 */
80
	public String getFile() {
81
		return file;
82
	}
83
	/**
84
	 * @param page The file to set.
85
	 */
86
	public void setFile(String page) {
87
		this.file = page;
88
	}
89
	/**
90
	 * @return Returns the protocol.
91
	 */
92
	public String getProtocol() {
93
		return protocol;
94
	}
95
	/**
96
	 * @param protocol The protocol to set.
97
	 */
98
	public void setProtocol(String protocol) {
99
		this.protocol = protocol;
100
	}
101
	/**
102
	 * @return Returns the requestType.
103
	 */
104
	public int getRequestType() {
105
		return requestType;
106
	}
107
	/**
108
	 * @param requestType The requestType to set.
109
	 */
110
	public void setRequestType(int requestType) {
111
		this.requestType = requestType;
112
	}
113
	/**
114
	 * @return Returns the port.
115
	 */
116
	public int getPort() {
117
		return port;
118
	}
119
	/**
120
	 * @param port The port to set.
121
	 */
122
	public void setPort(int port) {
123
		this.port = port;
124
	}
125

  
126
	public int hashCode() {
127
		if (hashCode == 0) {
128
			int result = 17;
129
			String[] stringFields = new String[] {
130
					fileName,
131
					host,
132
					file,
133
					protocol
134
			};
135
			for (int i = 0; i < stringFields.length; i++) {
136
				if (stringFields[i] != null)
137
					for (int j = 0; j < stringFields[i].length(); j++) 
138
						result = 37*result + (int) stringFields[i].charAt(j);
139
				
140
			}
141
			result = 37*result + port;
142
			result = 37*result + requestType;
143
		}
144
		return hashCode;
145
	}
146
	
147
	public boolean equals(Object o) {
148
		if (this == o)
149
			return true;
150
		if (!(o instanceof URLRequest))
151
			return false;
152

  
153
		URLRequest other = (URLRequest) o;
154
		
155
		String[] stringFields = new String[] {
156
				// this.fileName, NO!!! Do not check file name
157
				this.host,
158
				this.file,
159
				this.protocol
160
		};
161
		String[] othersStringField = new String[] {
162
				// other.fileName, NO!!! Do not check file name
163
				other.host,
164
				other.file,
165
				other.protocol
166
		};
167
		for (int i = 0; i < stringFields.length; i++) {
168
			if (stringFields[i] == null && othersStringField[i]!=null) return false;
169
			if (stringFields[i] == null && othersStringField[i]!=null) return false;
170
			if (stringFields[i] != null && othersStringField[i]!=null) 
171
				if (!stringFields[i].equals(othersStringField[i])) return false;
172
		}
173
		
174
		if (this.port != other.port) return false;
175
		if (this.requestType != other.requestType) return false;
176
		return true;
177
	}
178
}
0 179

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/URLRetrieveTask.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.taskplanning.retrieving;
25

  
26
/*
27
 * Based on portions of code from EarthFlicks
28
 * http://today.java.net/lpt/a/212
29
 */
30

  
31
import java.io.BufferedOutputStream;
32
import java.io.DataOutputStream;
33
import java.io.File;
34
import java.io.FileOutputStream;
35
import java.io.IOException;
36
import java.io.InputStream;
37
import java.net.MalformedURLException;
38
import java.net.URL;
39
import java.util.Iterator;
40
import java.util.Vector;
41

  
42
import org.gvsig.remoteclient.taskplanning.IRunnableTask;
43

  
44
/**
45
 * Clase para bajar ficheros en un thread independiente.
46
 */
47
public class URLRetrieveTask  implements IRunnableTask {
48
	
49
	private boolean running, cancelled;
50
	private URLRequest request;
51
	private Vector listeners = new Vector();
52
	private RetrieveEvent event = new RetrieveEvent();
53
	private InputStream is;
54
	
55
	/**
56
	 * 
57
	 */
58
	public URLRetrieveTask(URLRequest request, RetrieveListener listener) {
59
		this.request = request;
60
		addRetrieveListener(listener);
61
		running = cancelled = false;
62
	}
63
	
64

  
65
	public void execute() {
66
		event.setType(RetrieveEvent.NOT_STARTED);
67
		fireEvent();
68
		cancelled = false;
69
		running= true;
70
		
71
		long t = System.currentTimeMillis();
72
		File f = new File(request.getFileName()+System.currentTimeMillis());
73
		while (f.exists()) {
74
			t++;
75
			f = new File(request.getFileName()+t);
76
		}
77
		URL url;
78
		try {
79
			event.setType(RetrieveEvent.CONNECTING);
80
			fireEvent();
81
			url = request.getUrl();
82
			request.setFileName(f.getAbsolutePath());
83
			System.out.println("downloading '"+url+"' to: "+f.getAbsolutePath());
84
			
85
			DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(f)));
86
			byte[] buffer = new byte[1024*256];
87
			fireEvent();
88
			is = url.openStream();
89
			event.setType(RetrieveEvent.TRANSFERRING);
90
			fireEvent();
91
			if (!cancelled) {
92
				long readed = 0;
93
				for (int i = is.read(buffer); !cancelled && i>0; i = is.read(buffer)){
94
					dos.write(buffer, 0, i);
95
					readed += i;
96
				}
97
				
98
				dos.close();
99
			}
100
			
101
			if (cancelled) {
102
				// Bad incomplete file, delete it.
103
				System.out.println("download cancelled ("+url+")");
104
				f.delete();
105
			} else {
106
				// register job in the cache
107
				// TODO aix? deuria d'estar al principi per a poder capturar
108
				// treballs que s'estan fent per? que encara no s'han acabat
109
				synchronized (this) {
110
					RequestManager.getInstance().addDownloadedURLRequest(request, f.getAbsolutePath());
111
				}
112
			}
113
			
114
			running = false;
115
			if (cancelled)
116
				event.setType(RetrieveEvent.REQUEST_CANCELLED);
117
			else
118
				event.setType(RetrieveEvent.REQUEST_FINISHED);
119
			
120
		} catch (MalformedURLException e) {
121
			e.printStackTrace();
122
			event.setType(RetrieveEvent.REQUEST_FAILED);
123
		} catch (IOException e) {
124
			e.printStackTrace();
125
			event.setType(RetrieveEvent.REQUEST_FAILED);
126
		}
127
		fireEvent();
128
	}
129

  
130
	private void fireEvent() {
131
		Iterator it = listeners.iterator();
132
		while (it.hasNext()) {
133
			RetrieveListener listener = (RetrieveListener) it.next();
134
			listener.transferEventReceived(event);		
135
		}
136
	}
137

  
138
	public void addRetrieveListener(RetrieveListener l) {
139
		if (l!=null)
140
			listeners.add(l);
141
	}
142

  
143
	public void cancel() {
144
		cancelled = true;
145
		try {
146
			if (is != null) {
147
				is.close();
148
				is = null;
149
			}
150
		} catch (IOException e) {
151
			e.printStackTrace();
152
		}
153
	}
154

  
155
	public boolean isRunning() {
156
		return running && !cancelled;
157
	}
158

  
159

  
160
	public URLRequest getRequest() {
161
		return request;
162
	}
163

  
164

  
165
	public Vector getListeners() {
166
		return listeners;
167
	}
168

  
169

  
170
	public long getTaskTimeout() {
171
		return 30*1000;
172
	}
173
}
174

  
175

  
176
//static private String makeSuffix(String contentType) {
177
//	contentType = contentType.toLowerCase();
178
//    if (contentType.indexOf("png") >= 0)
179
//        return ".png";
180
//
181
//    if (contentType.indexOf("xml") >= 0)
182
//        return ".xml";
183
//
184
//    if (contentType.indexOf("gif") >= 0)
185
//        return ".gif";
186
//
187
//    if (contentType.indexOf("tif") >= 0)
188
//        return ".tif";
189
//
190
//    if (contentType.indexOf("jpg") >= 0
191
//        || contentType.indexOf("jpeg") >= 0)
192
//        return ".jpg";
193
//
194
//    if (contentType.indexOf("html") >= 0)
195
//        return ".html";
196
//
197
//    return "";
198
//}
199
///**
200
// * 
201
// */
202
//private void end() {
203
//}
204
//
205
///**
206
// * 
207
// */
208
//private void inThreadEnd() {
209
//}
210
//
211
///**
212
// * 
213
// */
214
//private void update() {
215
//}
216
//
217
///**
218
// * 
219
// */
220
//private void begin() {
221
//}
222

  
223
//public void start() {
224
//// this.reset();
225
//this.thread = new Thread(this);
226
//this.thread.start();
227
//}
228

  
229
/* (non-Javadoc)
230
* @see java.lang.Runnable#run()
231
* /
232
public void run() {
233
try {
234
	URL url = request.getUrl();
235
	this.status = Status.CONNECTING;
236
	this.begin();
237
	
238
    {
239
        // Retrieve the contents.
240
        int numBytesRead = 0;
241
//        System.out.println("File being retrieved. " + this.getUrl().toString());
242
        java.net.URLConnection connection = url.openConnection();
243
        connection.setAllowUserInteraction(true);
244
        java.io.InputStream incoming = connection.getInputStream();
245
        this.contentLength = connection.getContentLength();
246
        this.contentType = connection.getContentType();
247

  
248
        java.io.File destFile = java.io.File.createTempFile("Cq_", makeSuffix(this.contentType));
249
        destFile.deleteOnExit(); // It's copied later if it's to be persisted.
250
        this.destination = destFile.getPath();
251
        java.io.FileOutputStream outgoing = new java.io.FileOutputStream(destFile);
252

  
253
        this.status = Status.RETRIEVING;
254

  
255
        byte[] buffer = new byte[4096];
256

  
257
        try {
258
            while (!Thread.currentThread().isInterrupted() && numBytesRead >= 0) {
259
                numBytesRead = incoming.read(buffer);
260
                if (numBytesRead > 0) {
261
                    this.bytesRead += numBytesRead;
262
                    outgoing.write(buffer, 0, numBytesRead);
263
                    this.update();
264
                }
265
            }
266
        } finally {
267
            if (incoming != null)
268
                try {incoming.close();} catch (java.io.IOException e) {}; // TODO: log it maybe
269
            if (outgoing != null)
270
                try {outgoing.close();} catch (java.io.IOException e) {}; // TODO: log it maybe
271
        }
272
        this.status = Status.POSTPROCESSING;
273
    }
274
} catch (Exception e) {
275
    this.status = Status.ERROR;
276
    this.error = e;
277
    e.printStackTrace();
278
} finally {
279
    if (Thread.currentThread().isInterrupted())
280
        this.status = Status.INTERRUPTED;
281
    this.update();
282
    this.inThreadEnd();
283
    if (this.status == Status.POSTPROCESSING)
284
        this.status = Status.DONE;
285
    this.end();
286
}
287
}*/
288

  
289
//File tempDirectory = new File(tempDirectoryPath);
290
//if (!tempDirectory.exists())
291
//tempDirectory.mkdir();
292
//
293
//f = new File(tempDirectoryPath+"/"+name+System.currentTimeMillis());
294
//if (cancelled)
295
//throw new TaskCancelledException(); 
296
//addDownloadedURL(url, f.getAbsolutePath());
297
//try {
298
//URL url = request.getUrl();
299
//System.out.println(url);
300
//this.status = Status.CONNECTING;
301
//this.begin();
302
//
303
//{
304
//// Retrieve the contents.
305
//int numBytesRead = 0;
306
////System.out.println("File being retrieved. " + this.getUrl().toString());
307
//java.net.URLConnection connection = url.openConnection();
308
//connection.setAllowUserInteraction(true);
309
//java.io.InputStream incoming = connection.getInputStream();
310
//this.contentLength = connection.getContentLength();
311
//this.contentType = connection.getContentType();
312
//
313
//java.io.File destFile = java.io.File.createTempFile("Cq_", makeSuffix(this.contentType));
314
//System.out.println(destFile.getAbsolutePath());
315
////destFile.deleteOnExit(); // It's copied later if it's to be persisted.
316
//this.destination = destFile.getPath();
317
//java.io.FileOutputStream outgoing = new java.io.FileOutputStream(destFile);
318
//
319
//this.status = Status.RETRIEVING;
320
//
321
//byte[] buffer = new byte[4096];
322
//
323
//try {
324
//while (!Thread.currentThread().isInterrupted() && numBytesRead >= 0) {
325
//numBytesRead = incoming.read(buffer);
326
//if (numBytesRead > 0) {
327
//this.bytesRead += numBytesRead;
328
//outgoing.write(buffer, 0, numBytesRead);
329
//this.update();
330
//}
331
//}
332
//} finally {
333
//if (incoming != null)
334
//try {incoming.close();} catch (java.io.IOException e) {}; // TODO: log it maybe
335
//if (outgoing != null)
336
//try {outgoing.close();} catch (java.io.IOException e) {}; // TODO: log it maybe
337
//}
338
//this.status = Status.POSTPROCESSING;
339
//}
340
//} catch (Exception e) {
341
//this.status = Status.ERROR;
342
//this.error = e;
343
//e.printStackTrace();
344
//} finally {
345
//if (Thread.currentThread().isInterrupted())
346
//this.status = Status.INTERRUPTED;
347
//this.update();
348
//this.inThreadEnd();
349
//if (this.status == Status.POSTPROCESSING)
350
//this.status = Status.DONE;
351
//this.end();
352
//}
353

  
0 354

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/taskplanning/retrieving/package.html
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<body>
27
<h4>Gestor de downloads multihilo</h4>
28
<p>Permite mantener en threads separados las peticiones a servidores remotos
29
(http, ftp, etc), de manera que el flujo normal de ejecuci?n del programa
30
no se quede detenido cuando se realiza una petici?n.</p>
31

  
32
<p>RetrieveManager es el gestor de peticiones. Tiene una tabla de colas
33
 de petici?n que son las que atienden esas peticiones. Se crea una cola
34
 para cada server que se invoque, y esta es la que gestionar? las
35
 peticiones que se realicen a ese server, hasta el fin de la ejecuci?n
36
 del programa.</p>
37
 
38
<p>RetrieveQueue es la clase que realiza las peticiones. Mantiene las
39
prioridades, resuelve los timeouts, etc. Solo mantiene una petici?n
40
'activa' simultaneamente. Las dem?s esperan a que esta termine.</p>
41

  
42
<p>Retriever es la clase 'petici?n' propiamente dicha. Habla con el server,
43
se baja los datos, y le comunica al listener lo que est? pasando</p>
44

  
45
<p>RetrieveRequest es la clase que contiene los datos de la conexi?n. En
46
principio permite GET y POST sobre HTTP, pero se puede extender si hace
47
falta algo distinto</p>
48

  
49
<p>RetrieveListener es el interface que implementa el objeto que vaya a
50
monitorizar el progreso del Retriever, y el que deber? actuar en consecuencia.</p>
51

  
52
<p>RetrieveEvent es la clase mediante la que se notifica al Listener
53
la evoluci?n de la petici?n.</p>
54

  
55
<p>RetrieveException excepci?n gen?rica de este package.</p>
56
</body>
0 57

  
tags/org.gvsig.desktop-2.0.330/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/RemoteClient.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.remoteclient;
26

  
27
import org.gvsig.compat.net.ICancellable;
28

  
29

  
30
/**
31
 * <p></p>
32
 *
33
 */
34
public abstract class RemoteClient {
35

  
36
/**
37
 * <p>Represents ...</p>
38
 *
39
 */
40
    protected String hostName;
41

  
42
/**
43
 * <p>Represents ...</p>
44
 *
45
 */
46
    protected int port;
47

  
48
/**
49
 * <p>Represents ...</p>
50
 *
51
 */
52
    protected String serviceName;
53

  
54
/**
55
 * <p>Represents ...</p>
56
 *
57
 */
58
    private String type;
59

  
60
/**
61
 * <p>Represents ...</p>
62
 *
63
 */
64
    private String subtype;
65

  
66
/**
67
 * <p>Represents ...</p>
68
 *
69
 *
70
 * @return
71
 */
72
    public String getHost() {
73
        return hostName;
74
    }
75

  
76
/**
77
 * <p>Represents ...</p>
78
 *
79
 *
80
 * @param _hostName
81
 */
82
    public void setHost(String _hostName) {
83
        hostName = _hostName;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff