use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class MBeanServer method setAttribute.
/*
* @see IMBeanServer#setAttribute(ObjectName, Attribute)
*/
@Override
public void setAttribute(ObjectName objectName, Attribute attribute) throws JvmCoreException {
Assert.isNotNull(objectName);
Assert.isNotNull(attribute);
if (!checkReachability()) {
return;
}
try {
connection.setAttribute(objectName, attribute);
} catch (JMException e) {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.setAttributeFailedMsg, attribute.getName()), e);
} catch (IOException e) {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.setAttributeFailedMsg, attribute.getName()), e);
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class ShowInTimelineAction method performShowInTimeline.
/**
* Performs showing a new chart with attributes in Timeline tab.
*
* @param chartTitle The chart title
* @param axisUnit The axis unit
* @param attributes The attributes
*/
private void performShowInTimeline(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes) {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return;
}
IMonitoredMXBeanGroup group = jvm.getMBeanServer().addMonitoredAttributeGroup(chartTitle, axisUnit);
for (MBeanAttribute attribute : attributes) {
ObjectName objectName = attribute.getObjectName();
String attributeName = attribute.getAttributeName();
RGB rgb = attribute.getRgb();
try {
group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
} catch (JvmCoreException e) {
Activator.log(NLS.bind(Messages.addAttributeFailedMsg, attributeName), e);
}
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class MBeanServer method connectToMBeanServer.
/**
* Connects to the MBean server in the given VM.
*
* @param url The JMX service URL
* @return The MBean server connection
* @throws JvmCoreException
*/
private MBeanServerConnection connectToMBeanServer(JMXServiceURL url) throws JvmCoreException {
JMXConnector jmxc;
try {
if (jvm.getUserName() != null && jvm.getPassword() != null) {
Map<String, String[]> env = new HashMap<String, String[]>();
env.put(JMXConnector.CREDENTIALS, new String[] { jvm.getUserName(), jvm.getPassword() });
jmxc = JMXConnectorFactory.connect(url, env);
} else {
jmxc = JMXConnectorFactory.connect(url);
}
return jmxc.getMBeanServerConnection();
} catch (IOException e) {
IHost host = jvm.getHost();
if (host != null && host.getActiveJvms().contains(jvm)) {
host.removeJvm(jvm.getPid());
}
throw new JvmCoreException(IStatus.INFO, Messages.connectToMBeanServerFailedMsg, e);
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class MBeanServer method invoke.
/*
* @see IMBeanServer#invoke(ObjectName, String, String[], String[])
*/
@Override
public Object invoke(ObjectName objectName, String method, Object[] params, String[] signatures) throws JvmCoreException {
Assert.isNotNull(objectName);
Assert.isNotNull(method);
if (!checkReachability()) {
return null;
}
try {
return connection.invoke(objectName, method, params, signatures);
} catch (JMException e) {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.mBeanOperationFailedMsg, method), e);
} catch (IOException e) {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.mBeanOperationFailedMsg, method), e);
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class AbstractJvm method getBaseDirectory.
/**
* Gets the base directory.
*
* @return The base directory
* @throws JvmCoreException
*/
public IPath getBaseDirectory() throws JvmCoreException {
IPath stateLocation = Activator.getDefault().getStateLocation();
IPath dirPath = stateLocation.append(File.separator + host.getName() + Host.DIR_SUFFIX + File.separator + pid + IJvm.DIR_SUFFIX);
if (!dirPath.toFile().exists() && !dirPath.toFile().mkdir()) {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.createDirectoryFailedMsg, dirPath.toFile().getName()), null);
}
return dirPath;
}
Aggregations