1
/** BEGIN COPYRIGHT BLOCK
2
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
3
* Copyright (C) 2005 Red Hat, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
* END COPYRIGHT BLOCK **/
20
package com.netscape.admin.dirserv.task;
22
import java.util.Hashtable;
24
import javax.swing.JFrame;
25
import com.netscape.management.client.util.Debug;
26
import com.netscape.management.client.console.ConsoleInfo;
27
import com.netscape.admin.dirserv.IEntryChangeListener;
28
import com.netscape.admin.dirserv.IDSModel;
29
import com.netscape.admin.dirserv.DSUtil;
32
* Runnable shell for executing a CGI task as a thread.
37
* @see com.netscape.admin.dirserv.DSAdmin
38
* @see com.netscape.admin.dirserv.task.CGITask
40
public class CGIThread implements Runnable {
41
public CGIThread( String cmd, IDSModel model, String section ) {
43
URL url = new URL( cmd );
44
_task = new CGIReportTask( url, model.getServerInfo() );
45
} catch ( Exception ex ) {
46
Debug.println( "CGIThread: " + ex );
52
public CGIThread( String cmd, Hashtable args, IDSModel model, String section ) {
53
this(cmd, model, section);
54
_task.setArguments(args);
58
if ( _task == null ) {
61
_model.setWaitCursor( true );
63
int execStatus = _task.exec();
64
_status = ( (execStatus == 0) && (_task.getStatus() == 0) );
65
Debug.println( "CGIThread.run: execStatus = " + execStatus +
66
", taskStatus = " + _task.getStatus() );
67
if ( _listener != null ) {
68
_listener.entryChanged( null );
70
} catch ( Exception ex ) {
71
Debug.println( "CGIThread.run: " + ex );
73
_model.setWaitCursor( false );
76
public void addEntryChangeListener( IEntryChangeListener listener ) {
78
if ( _task != null ) {
79
_task.addEntryChangeListener( listener );
82
public boolean getStatus() {
85
CGIReportTask getTask() {
89
private IEntryChangeListener _listener = null;
90
private CGIReportTask _task = null;
91
private boolean _status = false;
92
private String _section;
93
private IDSModel _model;