Search in sources :

Example 1 with DeploymentStatus

use of org.netxms.ui.eclipse.agentmanager.views.helpers.DeploymentStatus in project netxms by netxms.

the class PackageDeploymentMonitor method redeployPackages.

private void redeployPackages() {
    final Set<Long> objects = new HashSet<Long>();
    Collection<DeploymentStatus> array = statusList.values();
    for (DeploymentStatus obj : array) {
        if (// status failed
        obj.getStatus() == 4) {
            objects.add(obj.getNodeObject().getObjectId());
        }
    }
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    ConsoleJob job = new ConsoleJob(Messages.get().PackageManager_DeployAgentPackage, null, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            session.deployPackage(packageId, objects.toArray(new Long[objects.size()]), new PackageDeploymentListener() {

                @Override
                public void statusUpdate(long nodeId, int status, String message) {
                    viewStatusUpdate(nodeId, status, message);
                }

                @Override
                public void deploymentStarted() {
                }

                @Override
                public void deploymentComplete() {
                    runInUIThread(new Runnable() {

                        @Override
                        public void run() {
                            MessageDialogHelper.openInformation(getSite().getShell(), Messages.get().PackageManager_Information, Messages.get().PackageManager_PkgDepCompleted);
                        }
                    });
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            return Messages.get().PackageManager_DepStartError;
        }
    };
    job.setUser(false);
    job.start();
}
Also used : NXCSession(org.netxms.client.NXCSession) PackageDeploymentListener(org.netxms.client.packages.PackageDeploymentListener) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) DeploymentStatus(org.netxms.ui.eclipse.agentmanager.views.helpers.DeploymentStatus) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NXCSession (org.netxms.client.NXCSession)1 PackageDeploymentListener (org.netxms.client.packages.PackageDeploymentListener)1 DeploymentStatus (org.netxms.ui.eclipse.agentmanager.views.helpers.DeploymentStatus)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1