Search in sources :

Example 31 with JvmCoreException

use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.

the class ActiveJvm method refreshPid.

/**
     * Refreshes the PID.
     * 
     * @throws JvmCoreException
     */
private void refreshPid() throws JvmCoreException {
    //$NON-NLS-1$
    String[] elements = mBeanServer.getRuntimeName().split("@");
    if (elements == null || elements.length != 2) {
        throw new JvmCoreException(IStatus.ERROR, Messages.getPidFailedMsg, new Exception());
    }
    setPid(Integer.valueOf(elements[0]));
}
Also used : MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 32 with JvmCoreException

use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method reconstructCharts.

void reconstructCharts(IActiveJvm activeJvm, boolean connected) {
    if (chartsPage.isDisposed()) {
        return;
    }
    if (connected) {
        try {
            loadOverviewChartSet(activeJvm);
        } catch (JvmCoreException e) {
            Activator.log(Messages.configureMonitoredAttributesFailedMsg, e);
        }
    }
    List<IMonitoredMXBeanGroup> groups = activeJvm.getMBeanServer().getMonitoredAttributeGroups();
    if (groups.size() == 0) {
        return;
    }
    for (TimelineChart chart : charts) {
        chart.dispose();
    }
    charts.clear();
    if (chartComposite != null && !chartComposite.isDisposed()) {
        chartComposite.dispose();
    }
    chartComposite = new Composite(chartsPage, SWT.NONE);
    FormLayout chartLayout = new FormLayout();
    chartLayout.marginHeight = 0;
    chartLayout.marginWidth = 0;
    chartComposite.setLayout(chartLayout);
    FormData chartComData = new FormData();
    chartComData.top = new FormAttachment(0, 0);
    chartComData.bottom = new FormAttachment(100, 0);
    chartComData.left = new FormAttachment(0, 0);
    chartComData.right = new FormAttachment(100, 0);
    chartComposite.setLayoutData(chartComData);
    for (IMonitoredMXBeanGroup group : groups) {
        createSection(chartComposite, group);
    }
    createReportField(chartComposite);
    //      createInfoField(chartComposite);
    chartsPage.layout();
    chartsPage.setVisible(true);
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TimelineChart(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.TimelineChart) FormAttachment(org.eclipse.swt.layout.FormAttachment) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 33 with JvmCoreException

use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method createMessagePage.

private Composite createMessagePage(Composite parent) {
    messagePage = new Composite(parent, SWT.NONE);
    FormLayout messageLayout = new FormLayout();
    messageLayout.marginHeight = 0;
    messageLayout.marginWidth = 0;
    messagePage.setLayout(messageLayout);
    messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    FormToolkit toolkit = new FormToolkit(Display.getDefault());
    Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
    hyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent event) {
            try {
                new LoadChartAction(RuntimeGraphcsComposite.this).loadDefaultChartSet();
            } catch (JvmCoreException e) {
                Activator.log(Messages.loadChartSetFailedMsg, e);
            }
        }
    });
    return messagePage;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) LoadChartAction(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.LoadChartAction) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 34 with JvmCoreException

use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.

the class NewJvmConnectionWizard method addActiveJvm.

/**
     * Adds the active JVM.
     * 
     * @return The active JVM
     */
private IActiveJvm addActiveJvm() {
    final boolean isHostAndPortSelected = page.isHostAndPortSelected();
    final String hostName = page.getRemoteHost();
    final int port = page.getPort();
    final String userName = page.getUserName();
    final String password = page.getPassword();
    final String jmxUrl = page.getJmxUrl();
    try {
        final IActiveJvm[] result = new IActiveJvm[1];
        IRunnableWithProgress op = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
                    if (isHostAndPortSelected) {
                        IHost host = JvmModel.getInstance().addHost(hostName);
                        result[0] = host.addRemoteActiveJvm(port, userName, password, period);
                    } else {
                        result[0] = JvmModel.getInstance().addHostAndJvm(jmxUrl, userName, password, period);
                    }
                } catch (JvmCoreException e) {
                    throw new InvocationTargetException(e);
                }
            }
        };
        new ProgressMonitorDialog(getShell()).run(true, true, op);
        return result[0];
    } catch (InvocationTargetException e) {
        openErrorDialog(e);
        return null;
    } catch (InterruptedException e) {
        return null;
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IHost(org.talend.designer.runtime.visualization.IHost) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 35 with JvmCoreException

use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.

the class NewJvmConnectionWizard method performFinish.

/*
     * @see Wizard#performFinish()
     */
@Override
public boolean performFinish() {
    // add active JVM
    IActiveJvm jvm = addActiveJvm();
    if (jvm == null) {
        return false;
    }
    // select item on JVM explorer
    viewer.refresh();
    viewer.setSelection(new StructuredSelection(jvm));
    // connect to JVM
    try {
        int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
        jvm.connect(period);
    } catch (JvmCoreException e) {
        Activator.log(NLS.bind(Messages.connectJvmFailedMsg, jvm.getPid()), e);
    }
    page.storeDialogSettings();
    return true;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Aggregations

JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)64 IOException (java.io.IOException)16 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)14 Method (java.lang.reflect.Method)11 ObjectName (javax.management.ObjectName)10 IFileStore (org.eclipse.core.filesystem.IFileStore)6 CoreException (org.eclipse.core.runtime.CoreException)6 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)6 File (java.io.File)5 Properties (java.util.Properties)5 IPath (org.eclipse.core.runtime.IPath)5 OutputStream (java.io.OutputStream)4 JMException (javax.management.JMException)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IHost (org.talend.designer.runtime.visualization.IHost)4 JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)4 Date (java.util.Date)3 Timer (java.util.Timer)3 TimerTask (java.util.TimerTask)3 RGB (org.eclipse.swt.graphics.RGB)3