|
Lines 17-23
Link Here
|
| 17 |
import java.util.ArrayList; |
17 |
import java.util.ArrayList; |
| 18 |
import java.util.Hashtable; |
18 |
import java.util.Hashtable; |
| 19 |
|
19 |
|
|
|
20 |
import org.eclipse.core.filesystem.EFS; |
| 21 |
import org.eclipse.core.filesystem.IFileStore; |
| 22 |
import org.eclipse.core.runtime.IPath; |
| 20 |
import org.eclipse.core.runtime.IStatus; |
23 |
import org.eclipse.core.runtime.IStatus; |
|
|
24 |
import org.eclipse.core.runtime.Platform; |
| 21 |
import org.eclipse.hyades.internal.execution.local.common.CustomCommand; |
25 |
import org.eclipse.hyades.internal.execution.local.common.CustomCommand; |
| 22 |
import org.eclipse.hyades.internal.execution.local.common.DataProcessor; |
26 |
import org.eclipse.hyades.internal.execution.local.common.DataProcessor; |
| 23 |
import org.eclipse.hyades.internal.execution.local.control.Agent; |
27 |
import org.eclipse.hyades.internal.execution.local.control.Agent; |
|
Lines 26-35
Link Here
|
| 26 |
import org.eclipse.hyades.internal.execution.local.control.InactiveAgentException; |
30 |
import org.eclipse.hyades.internal.execution.local.control.InactiveAgentException; |
| 27 |
import org.eclipse.hyades.internal.execution.local.control.InactiveProcessException; |
31 |
import org.eclipse.hyades.internal.execution.local.control.InactiveProcessException; |
| 28 |
import org.eclipse.hyades.internal.execution.local.control.Process; |
32 |
import org.eclipse.hyades.internal.execution.local.control.Process; |
|
|
33 |
import org.eclipse.swt.widgets.Display; |
| 29 |
import org.eclipse.tptp.monitoring.managedagent.ManagedAgentPlugin; |
34 |
import org.eclipse.tptp.monitoring.managedagent.ManagedAgentPlugin; |
| 30 |
import org.eclipse.tptp.monitoring.managedagent.internal.Constants; |
35 |
import org.eclipse.tptp.monitoring.managedagent.internal.Constants; |
| 31 |
import org.eclipse.tptp.monitoring.managedagent.provisional.commands.CommandSerializer; |
36 |
import org.eclipse.tptp.monitoring.managedagent.provisional.commands.CommandSerializer; |
| 32 |
import org.eclipse.tptp.monitoring.managedagent.provisional.commands.CommandWrapper; |
37 |
import org.eclipse.tptp.monitoring.managedagent.provisional.commands.CommandWrapper; |
|
|
38 |
import org.eclipse.ui.IWorkbenchPage; |
| 39 |
import org.eclipse.ui.IWorkbenchWindow; |
| 40 |
import org.eclipse.ui.PartInitException; |
| 41 |
import org.eclipse.ui.PlatformUI; |
| 42 |
import org.eclipse.ui.ide.IDE; |
| 33 |
|
43 |
|
| 34 |
/** |
44 |
/** |
| 35 |
* An abstract class that implements the TPTP Agent interface and allows follows the custom command API defined for managed agents. |
45 |
* An abstract class that implements the TPTP Agent interface and allows follows the custom command API defined for managed agents. |
|
Lines 451-460
Link Here
|
| 451 |
sendResponse(_command); |
461 |
sendResponse(_command); |
| 452 |
}catch(Exception ex){ |
462 |
}catch(Exception ex){ |
| 453 |
throwException(ex); |
463 |
throwException(ex); |
|
|
464 |
openErrorLog(ex); |
| 454 |
} |
465 |
} |
| 455 |
}catch(Exception e){ |
466 |
}catch(Exception e){ |
| 456 |
ManagedAgentPlugin.getDefault().log(Messages.getString("ManagedResourceAgent.CANT_SERICE_CUSTOM_COMMAND.ERROR."), e, IStatus.ERROR); //$NON-NLS-1$ |
467 |
ManagedAgentPlugin.getDefault().log(Messages.getString("ManagedResourceAgent.CANT_SERICE_CUSTOM_COMMAND.ERROR."), e, IStatus.ERROR); //$NON-NLS-1$ |
| 457 |
setActive(false); |
468 |
setActive(false); |
| 458 |
} |
469 |
} |
| 459 |
} |
470 |
} |
|
|
471 |
|
| 472 |
private void openErrorLog(Exception ex) |
| 473 |
{ |
| 474 |
if(ignoreError(ex)) |
| 475 |
return; |
| 476 |
IPath logPath = Platform.getLogFileLocation(); |
| 477 |
final IFileStore fileStore = EFS.getLocalFileSystem().getStore(logPath); |
| 478 |
if(!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) |
| 479 |
{ |
| 480 |
Display display = PlatformUI.getWorkbench().getDisplay(); |
| 481 |
display.asyncExec(new Runnable(){ |
| 482 |
|
| 483 |
public void run() { |
| 484 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
| 485 |
IWorkbenchPage page = window.getActivePage(); |
| 486 |
try |
| 487 |
{ |
| 488 |
IDE.openEditorOnFileStore(page, fileStore); |
| 489 |
} |
| 490 |
catch(PartInitException _ex) |
| 491 |
{ |
| 492 |
_ex.printStackTrace(); |
| 493 |
} |
| 494 |
}}); |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
protected boolean ignoreError(Exception ex) |
| 499 |
{ |
| 500 |
// Ignore the warning message "IWAT0753I Found and instantiated Apache Muse Runtime WSDM runtime" |
| 501 |
boolean museFoundMessage = ex.getMessage()!=null && ex.getMessage().indexOf("IWAT0753I")!=-1; |
| 502 |
// Ignore the warning message "IWAT0761I This resource is not a service group" |
| 503 |
boolean noSgMessage = ex.getMessage()!=null && (ex.getMessage().indexOf("IWAT0761I")!=-1 || ex.getMessage().indexOf("IWAT0762E")!=-1); |
| 504 |
// Ignore the warning message "IWAT0725E Cannot get relationships" |
| 505 |
boolean noRelationshipMessage = ex.getMessage()!=null && ex.getMessage().indexOf("IWAT0725E")!=-1; |
| 506 |
if(museFoundMessage || noSgMessage || noRelationshipMessage) |
| 507 |
return true; |
| 508 |
return false; |
| 509 |
} |
| 460 |
} |
510 |
} |