Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 185625 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/monitoring/managedagent/provisional/ManagedResourceAgent.java (+50 lines)
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
}
(-)META-INF/MANIFEST.MF (-1 / +3 lines)
Lines 13-19 Link Here
13
Require-Bundle: org.eclipse.tptp.platform.models;visibility:=reexport,
13
Require-Bundle: org.eclipse.tptp.platform.models;visibility:=reexport,
14
 org.eclipse.hyades.execution;visibility:=reexport,
14
 org.eclipse.hyades.execution;visibility:=reexport,
15
 org.eclipse.hyades.trace.ui;visibility:=reexport,
15
 org.eclipse.hyades.trace.ui;visibility:=reexport,
16
 org.eclipse.ui;visibility:=reexport
16
 org.eclipse.ui;visibility:=reexport,
17
 org.eclipse.core.filesystem,
18
 org.eclipse.ui.ide
17
Eclipse-LazyStart: true
19
Eclipse-LazyStart: true
18
Bundle-Vendor: %plugin.provider
20
Bundle-Vendor: %plugin.provider
19
Bundle-Activator: org.eclipse.tptp.monitoring.managedagent.ManagedAgentPlugin
21
Bundle-Activator: org.eclipse.tptp.monitoring.managedagent.ManagedAgentPlugin
(-)src/org/eclipse/tptp/monitoring/managedagent/wsdm/provisional/agents/WSDMAgent.java (-1 / +2 lines)
Lines 116-122 Link Here
116
		}catch(Exception e){
116
		}catch(Exception e){
117
			Activator.getDefault().log(Messages.getString("WSDMAgent.CANT_INIT_AGENT.ERROR."), e, IStatus.ERROR); //$NON-NLS-1$
117
			Activator.getDefault().log(Messages.getString("WSDMAgent.CANT_INIT_AGENT.ERROR."), e, IStatus.ERROR); //$NON-NLS-1$
118
			setActive(false);
118
			setActive(false);
119
			return false;
119
			throw e;
120
			//return false;
120
		}
121
		}
121
	}
122
	}
122
	
123
	
(-)src/org/eclipse/tptp/monitoring/managedagent/wsdm/internal/muse/MuseRuntime.java (-2 / +6 lines)
Lines 21-26 Link Here
21
import org.apache.muse.util.xml.XmlUtils;
21
import org.apache.muse.util.xml.XmlUtils;
22
import org.apache.muse.ws.addressing.EndpointReference;
22
import org.apache.muse.ws.addressing.EndpointReference;
23
import org.apache.muse.ws.notification.WsnConstants;
23
import org.apache.muse.ws.notification.WsnConstants;
24
import org.apache.muse.ws.resource.properties.WsrpConstants;
24
import org.apache.muse.ws.resource.remote.WsResourceClient;
25
import org.apache.muse.ws.resource.remote.WsResourceClient;
25
import org.apache.muse.ws.resource.sg.WssgConstants;
26
import org.apache.muse.ws.resource.sg.WssgConstants;
26
import org.eclipse.core.runtime.IStatus;
27
import org.eclipse.core.runtime.IStatus;
Lines 192-200 Link Here
192
		return result;
193
		return result;
193
	}
194
	}
194
195
195
	public Object[] getResourceProperty(String propQName) throws Exception {
196
	public Object[] getResourceProperty(String qnameStr) throws Exception {
196
		// smashing of values into one string happens in UI controller
197
		// smashing of values into one string happens in UI controller
197
		Element[] results = _resource.getResourceProperty(CommonUtils.deserializeFromString(propQName));
198
		QName propQName = CommonUtils.deserializeFromString(qnameStr);
199
		if(propQName.getNamespaceURI().equals(WsrpConstants.NAMESPACE_URI))
200
			propQName = new QName(propQName.getNamespaceURI(), propQName.getLocalPart(), WsrpConstants.PREFIX);
201
		Element[] results = _resource.getResourceProperty(propQName);
198
		String[] ret = new String[results.length];
202
		String[] ret = new String[results.length];
199
		for (int i = 0; i < results.length; i++) {
203
		for (int i = 0; i < results.length; i++) {
200
			ret[i] = XmlUtils.extractText(results[i]);
204
			ret[i] = XmlUtils.extractText(results[i]);

Return to bug 185625