summaryrefslogtreecommitdiffstats
path: root/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/gui/app/Configuration.java
blob: 3db67c536aad6ae4b752121357bddf814759945c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
package org.openecomp.config.gui.app;


import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import org.openecomp.config.api.ConfigurationManager;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.CardLayout;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Choice;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.event.ItemEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javax.management.JMX;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;


/**
 * The type Configuration.
 */
public class Configuration extends Frame {

  /**
   * The Vm.
   */
  VirtualMachine vm = null;
  private TextField host;
  private TextField port;
  private TextField user;
  private Choice pid;
  private TextField password;
  private CheckboxGroup getUpdateList;
  private CheckboxGroup localRemote;
  private Choice tenantChoice;
  private Choice namespaceChoice;
  private Choice keyChoice;
  private Checkbox latest;
  private Checkbox lookup;
  private Checkbox fallback;
  private Checkbox nodeSpecific;
  private Checkbox nodeSpecificForList;
  private Checkbox latestForList;
  private Checkbox lookupForList;
  private Checkbox fallbackForList;
  private Checkbox nodeOverride;
  private TextArea getValue = new TextArea(1, 50);
  private TextArea updateValue = new TextArea(1, 50);
  private Panel table;
  private CardLayout cards;
  private Panel cardPanel;
  private JMXConnector connector;
  private ConfigurationManager manager;
  private Frame container;
  private Button getKeysButton;

  /**
   * Instantiates a new Configuration.
   *
   * @param title the title
   */
  public Configuration(String title) {
    super(title);
    setSize(300, 300);
    setLayout(new GridLayout(2, 1));
    Panel firstRowPanel = new Panel();
    firstRowPanel.setLayout(new GridLayout(0, 1));
    firstRowPanel.add(
        buildHostPortPanel(host = new TextField("127.0.0.1"), port = new TextField("9999"),
            pid = new Choice(), localRemote = new CheckboxGroup()));
    firstRowPanel
        .add(buildUserPasswordPanel(user = new TextField(""), password = new TextField("")));
    firstRowPanel.add(buildGetUpdatelistPanel(getUpdateList = new CheckboxGroup()));
    firstRowPanel.add(
        buildTenantNamespacePanel(tenantChoice = new Choice(), namespaceChoice = new Choice()));
    firstRowPanel.add(buildKeyPanel(keyChoice = new Choice()));
    add(firstRowPanel);
    add(cardPanel = buildCards(cards = new CardLayout()));
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent windowEvent) {
        close();
        System.exit(0);
      }
    });
    pack();
    setVisible(true);
    container = this;
    centreWindow(this);
    Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(() -> {
      this.populateAvailablePids();
      validate();
    }, 30, 30, TimeUnit.SECONDS);
  }

  /**
   * The entry point of application.
   *
   * @param args the input arguments
   */
  public static void main(String[] args) {
    Configuration configuration = new Configuration("Configuration Management App");

  }

  private void toggleLocalRemote(ItemEvent ie) {
    if (ie.getStateChange() == ItemEvent.SELECTED) {
      String usecase = (ie.getSource() instanceof Checkbox) ? ((Checkbox) ie.getSource()).getLabel()
          : ((Checkbox) ie.getItem()).getLabel();
      pid.setEnabled(usecase.equals("Local"));
      host.setEnabled(!usecase.equals("Local"));
      port.setEnabled(!usecase.equals("Local"));
    }
  }

  private Panel buildHostPortPanel(TextField host, TextField port, Choice pid,
                                   CheckboxGroup group) {
    populateAvailablePids();
    Panel panel = new Panel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = gbc.HORIZONTAL;
    gbc.weightx = 0;
    Checkbox checkbox = null;
    panel.add(checkbox = new Checkbox("Local", group, pid.getItemCount() > 0), gbc);
    checkbox.addItemListener(this::toggleLocalRemote);
    gbc.weightx = 0;
    panel.add(checkbox = new Checkbox("Remote", group, pid.getItemCount() == 0), gbc);
    checkbox.addItemListener(this::toggleLocalRemote);
    gbc.weightx = 0;
    panel.add(new Label("PID:"), gbc);
    gbc.weightx = 1;
    panel.add(pid, gbc);
    gbc.weightx = 0;
    panel.add(new Label("Host:"), gbc);
    gbc.weightx = 1;
    panel.add(host, gbc);
    gbc.weightx = 0;
    panel.add(new Label("Port:"), gbc);
    gbc.weightx = 1;
    panel.add(port, gbc);
    host.setEnabled(pid.getItemCount() == 0);
    port.setEnabled(pid.getItemCount() == 0);
    pid.setEnabled(pid.getItemCount() > 0);
    return panel;
  }

  private Panel buildUserPasswordPanel(TextField user, TextField password) {
    Panel panel = new Panel();
    password.setEchoChar('*');
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = gbc.HORIZONTAL;
    gbc.weightx = 0;
    panel.add(new Label("User : "), gbc);
    gbc.weightx = 1;
    panel.add(user, gbc);
    gbc.weightx = 0;
    panel.add(new Label("Password : "), gbc);
    gbc.weightx = 1;
    panel.add(password, gbc);
    gbc.weightx = 0;
    Button button = null;
    panel.add(button = new Button("Connect"), gbc);
    button.addActionListener((actionListener) -> connect());
    return panel;
  }

  /**
   * Build get updatelist panel panel.
   *
   * @param getUpdtaeList the get updtae list
   * @return the panel
   */
  public Panel buildGetUpdatelistPanel(CheckboxGroup getUpdtaeList) {
    Panel panel = new Panel();
    Checkbox checkbox = null;
    panel.setLayout(new GridLayout(1, 3));
    panel.add(checkbox = new Checkbox("Get", getUpdtaeList, true));
    checkbox.addItemListener(this::showCard);
    panel.add(checkbox = new Checkbox("List", getUpdtaeList, false));
    checkbox.addItemListener(this::showCard);
    panel.add(checkbox = new Checkbox("Update", getUpdtaeList, false));
    checkbox.addItemListener(this::showCard);
    return panel;
  }

  /**
   * Build tenant namespace panel panel.
   *
   * @param tenant    the tenant
   * @param namespace the namespace
   * @return the panel
   */
  public Panel buildTenantNamespacePanel(Choice tenant, Choice namespace) {
    Panel panel = new Panel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = gbc.HORIZONTAL;
    gbc.weightx = 0;
    panel.add(new Label("Tenant"), gbc);
    gbc.weightx = 1;
    panel.add(tenant, gbc);
    gbc.weightx = 0;
    panel.add(new Label("Namespace"), gbc);
    gbc.weightx = 1;
    panel.add(namespace, gbc);
    gbc.weightx = 0;
    panel.add(getKeysButton = new Button("Get Keys"), gbc);
    getKeysButton.addActionListener((actionListener) -> populateKeys(
        manager.getKeys(tenantChoice.getSelectedItem(), namespaceChoice.getSelectedItem())));
    tenantChoice.addItemListener((itemListener) -> keyChoice.removeAll());
    namespaceChoice.addItemListener((itemListener) -> keyChoice.removeAll());
    return panel;
  }

  private Panel buildConnectPanel() {
    Button button = null;
    Panel panel = new Panel();
    panel.setLayout(new GridLayout(1, 3));
    panel.add(new Label());
    panel.add(button = new Button("Connect"));
    panel.add(new Label());
    button.addActionListener((actionListener) -> connect());
    return panel;
  }

  /**
   * Build key panel panel.
   *
   * @param keyChoice the key choice
   * @return the panel
   */
  public Panel buildKeyPanel(Choice keyChoice) {
    Panel panel = new Panel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = gbc.HORIZONTAL;
    gbc.weightx = 0;
    panel.add(new Label("Keys : "), gbc);
    gbc.weightx = 1;
    panel.add(keyChoice, gbc);
    return panel;
  }

  /**
   * Build cards panel.
   *
   * @param cards the cards
   * @return the panel
   */
  public Panel buildCards(CardLayout cards) {
    Panel panel = new Panel();
    panel.setLayout(cards);
    panel.add(buildCardGetPanel(latest = new Checkbox("Latest"),
        fallback = new Checkbox("Fallback"),
        lookup = new Checkbox("External Lookup"), nodeSpecific = new Checkbox("Node Specific"),
        getValue), "Get");
    panel.add(buildCardUpdatePanel(nodeOverride = new Checkbox("NodeOverride"),
        updateValue), "Update");
    panel.add(buildCardListPanel(table = new Panel(), latestForList = new Checkbox("Latest"),
        fallbackForList = new Checkbox("Fallback"), lookupForList = new Checkbox("External Lookup"),
        nodeSpecificForList = new Checkbox("Node Specific")), "List");
    return panel;
  }

  /**
   * Build card get panel panel.
   *
   * @param latest       the latest
   * @param fallback     the fallback
   * @param lookup       the lookup
   * @param nodeSpecific the node specific
   * @param value        the value
   * @return the panel
   */
  public Panel buildCardGetPanel(Checkbox latest, Checkbox fallback, Checkbox lookup,
                                 Checkbox nodeSpecific, TextArea value) {
    Panel panel = new Panel();

    panel.setLayout(new BorderLayout());
    Panel p1 = new Panel();
    p1.setLayout(new GridLayout(1, 4));
    p1.add(latest);
    p1.add(fallback);
    p1.add(nodeSpecific);
    p1.add(lookup);
    panel.add(p1, BorderLayout.NORTH);
    panel.add(value, BorderLayout.CENTER);
    Panel bottom = new Panel();
    bottom.setLayout(new GridLayout(1, 5));
    bottom.add(new Label());
    Button button = null;
    bottom.add(button = new Button("GET"));
    button.addActionListener((actionListener) -> value.setText(manager
        .getConfigurationValue(buildMap("org.openecomp.config.type.ConfigurationQuery", value))));
    bottom.add(new Label());
    bottom.add(button = new Button("CLOSE"));
    bottom.add(new Label());
    panel.add(bottom, BorderLayout.SOUTH);
    button.addActionListener((actionListener) -> {
      close();
      System.exit(0);
    });
    return panel;
  }

  private Map<String, Object> buildMap(String implClass, TextArea value) {
    Map<String, Object> input = new HashMap<>();
    input.put("ImplClass", implClass);//:);
    input.put("externalLookup", value != null ? lookup.getState() : lookupForList.getState());
    input.put("nodeOverride", nodeOverride.getState());
    input.put("latest", value != null ? latest.getState() : latestForList.getState());
    input.put("fallback", value != null ? fallback.getState() : fallbackForList.getState());
    input.put("nodeSpecific",
        value != null ? nodeSpecific.getState() : nodeSpecificForList.getState());
    input.put("tenant", tenantChoice.getSelectedItem());
    input.put("namespace", namespaceChoice.getSelectedItem());
    if (keyChoice.getItemCount() == 0) {
      message("Error", "Key is missing.");
      throw new RuntimeException("Error");
    }
    input.put("key", keyChoice.getSelectedItem());
    input.put("value", value == null ? "" : value.getText());
    return input;
  }

  /**
   * Build card update panel panel.
   *
   * @param nodeOverride the node override
   * @param value        the value
   * @return the panel
   */
  public Panel buildCardUpdatePanel(Checkbox nodeOverride, TextArea value) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Panel p1 = new Panel();
    p1.setLayout(new GridLayout(1, 1));
    p1.add(nodeOverride);
    panel.add(p1, BorderLayout.NORTH);
    panel.add(value, BorderLayout.CENTER);
    Panel bottom = new Panel();
    bottom.setLayout(new GridLayout(1, 5));
    bottom.add(new Label());
    Button button = null;
    bottom.add(button = new Button("UPDATE"));
    button.addActionListener((actionListener) -> {
      manager
          .updateConfigurationValue(buildMap("org.openecomp.config.type.ConfigurationUpdate", value));
      message("Info", "Success");
    });
    bottom.add(new Label());
    bottom.add(button = new Button("CLOSE"));
    bottom.add(new Label());
    panel.add(bottom, BorderLayout.SOUTH);
    button.addActionListener((actionListener) -> {
      close();
      System.exit(0);
    });
    return panel;
  }

  /**
   * Build card list panel panel.
   *
   * @param table        the table
   * @param latest       the latest
   * @param fallback     the fallback
   * @param nodeSpecific the node specific
   * @param lookup       the lookup
   * @return the panel
   */
  public Panel buildCardListPanel(Panel table, Checkbox latest, Checkbox fallback,
                                  Checkbox nodeSpecific, Checkbox lookup) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    table.setLayout(new GridLayout(0, 2));
    ScrollPane sp = new ScrollPane();
    sp.add(table);
    panel.add(sp, BorderLayout.CENTER);
    Panel p1 = new Panel();
    p1.setLayout(new GridLayout(1, 4));
    p1.add(latest);
    p1.add(fallback);
    p1.add(lookup);
    p1.add(nodeSpecific);
    panel.add(p1, BorderLayout.NORTH);
    Panel bottom = new Panel();
    bottom.setLayout(new GridLayout(1, 5));
    bottom.add(new Label());
    Button button = null;
    bottom.add(button = new Button("List"));
    button.addActionListener((actionListener) -> populateKeyValue(
        manager.listConfiguration(buildMap("org.openecomp.config.type.ConfigurationQuery", null))));
    bottom.add(new Label());
    bottom.add(button = new Button("CLOSE"));
    bottom.add(new Label());
    panel.add(bottom, BorderLayout.SOUTH);
    button.addActionListener((actionListener) -> {
      close();
      System.exit(0);
    });
    return panel;
  }

  private void populateKeyValue(Map<String, String> collection) {
    table.removeAll();
    Set<String> keys = collection.keySet();
    for (String key : keys) {
      table.add(new Label(key));
      table.add(new Label(collection.get(key)));
    }
    table.validate();
  }

  private void showCard(ItemEvent ie) {
    if (ie.getStateChange() == ItemEvent.SELECTED) {
      String usecase = (ie.getSource() instanceof Checkbox) ? ((Checkbox) ie.getSource()).getLabel()
          : ((Checkbox) ie.getItem()).getLabel();
      cards.show(cardPanel, usecase);
      if (usecase.equals("List")) {
        keyChoice.removeAll();
      }
      keyChoice.setEnabled(!usecase.equals("List"));
      getKeysButton.setEnabled(!usecase.equals("List"));
    }
  }

  private void close() {
    try {
      if (connector != null) {
        connector.close();
        connector = null;
        vm.detach();
      }
    } catch (Exception exception) {
      //Do nothing
    }
  }

  private void connect() {
    try {
      close();
      if (!validateHostPort()) {
        return;
      }
      JMXServiceURL url = null;
      if (localRemote.getSelectedCheckbox().getLabel().equals("Local")) {
        url = new JMXServiceURL(
            (vm = VirtualMachine.attach(pid.getSelectedItem())).getAgentProperties()
                .getProperty("com.sun.management.jmxremote.localConnectorAddress"));
      } else {
        url = new JMXServiceURL(
            "service:jmx:rmi:///jndi/rmi://" + host.getText() + ":" + port.getText() + "/jmxrmi");
      }
      Map<String, String[]> env = new HashMap<>();
      String[] credentials = {user.getText(), password.getText()};
      env.put(JMXConnector.CREDENTIALS, credentials);
      connector = JMXConnectorFactory.connect(url, env);
      MBeanServerConnection mbsc = connector.getMBeanServerConnection();
      ObjectName mbeanName = new ObjectName("org.openecomp.jmx:name=SystemConfig");
      manager = JMX.newMBeanProxy(mbsc, mbeanName, ConfigurationManager.class, true);
      message("Message", "Success!!!");
      populateTenants(manager.getTenants());
      populateNamespaces(manager.getNamespaces());
    } catch (Exception exception) {
      message("Error", exception.getMessage());
    }
  }

  private boolean validateHostPort() {
    if (localRemote.getSelectedCheckbox().getLabel().equals("Local")) {
      if (pid.getSelectedItem() == null || pid.getSelectedItem().trim().length() == 0
          || !pid.getSelectedItem().matches("^[1-9][0-9]*$")) {
        message("Error", "pid is mandatory numeric value greater than 0.");
        return false;
      }
    } else {
      if (host.getText() == null || host.getText().trim().length() == 0) {
        message("Error", "Host is mandatory.");
        return false;
      }
      if (port.getText() == null || port.getText().trim().length() == 0
          || !port.getText().matches("^[1-9][0-9]*$")) {
        message("Error", "Port is mandatory numeric value greater than 0.");
        return false;
      }
    }
    return true;
  }

  private void populateTenants(Collection<String> collection) {
    tenantChoice.removeAll();
    for (String item : collection) {
      tenantChoice.add(item);
    }
  }

  private void populateNamespaces(Collection<String> collection) {
    namespaceChoice.removeAll();
    keyChoice.removeAll();
    for (String item : collection) {
      namespaceChoice.add(item);
    }
  }

  private void populateKeys(Collection<String> collection) {
    keyChoice.removeAll();
    for (String item : collection) {
      keyChoice.add(item);
    }
  }

  private void message(String title, String text) {
    Dialog dialog = new Dialog(container, title, true);
    dialog.setLayout(new BorderLayout());
    dialog.add(new Label(text), BorderLayout.CENTER);
    Button ok = new Button("OK");
    Panel panel = new Panel();
    panel.setLayout(new GridLayout(1, 3));
    panel.add(new Label());
    panel.add(ok);
    panel.add(new Label());
    ok.addActionListener((actionListener) -> dialog.setVisible(false));
    dialog.add(panel, BorderLayout.SOUTH);
    dialog.pack();
    centerDialog(dialog);
    dialog.setVisible(true);
  }

  private void centreWindow(Frame frame) {
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    int x1 = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
    int y1 = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
    frame.setLocation(x1, y1);
  }

  private void centerDialog(Dialog dialog) {
    Dimension dimension = container.getSize();
    container.getLocationOnScreen();
    int x1 =
        container.getLocationOnScreen().x + (int) ((dimension.getWidth() - dialog.getWidth()) / 2);
    int y1 = container.getLocationOnScreen().y
        + (int) ((dimension.getHeight() - dialog.getHeight()) / 2);
    dialog.setLocation(x1, y1);
  }

  private void setWindowPosition(Frame window, int screen) {
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] allDevices = env.getScreenDevices();
    int topLeftX;
    int topLeftY;
    int screenX;
    int screenY;
    int windowPosX;
    int windowPosY;

    if (screen < allDevices.length && screen > -1) {
      topLeftX = allDevices[screen].getDefaultConfiguration().getBounds().x;
      topLeftY = allDevices[screen].getDefaultConfiguration().getBounds().y;

      screenX = allDevices[screen].getDefaultConfiguration().getBounds().width;
      screenY = allDevices[screen].getDefaultConfiguration().getBounds().height;
    } else {
      topLeftX = allDevices[0].getDefaultConfiguration().getBounds().x;
      topLeftY = allDevices[0].getDefaultConfiguration().getBounds().y;

      screenX = allDevices[0].getDefaultConfiguration().getBounds().width;
      screenY = allDevices[0].getDefaultConfiguration().getBounds().height;
    }

    windowPosX = ((screenX - window.getWidth()) / 2) + topLeftX;
    windowPosY = ((screenY - window.getHeight()) / 2) + topLeftY;

    window.setLocation(windowPosX, windowPosY);
  }

  private void populateAvailablePids() {
    pid.removeAll();
    for (VirtualMachineDescriptor desc : VirtualMachine.list()) {
      try {
        VirtualMachine vm = null;
        JMXServiceURL url = new JMXServiceURL(
            (vm = VirtualMachine.attach(desc.id())).getAgentProperties()
                .getProperty("com.sun.management.jmxremote.localConnectorAddress"));
        Set set = JMXConnectorFactory.connect(url, null).getMBeanServerConnection()
            .queryMBeans(new ObjectName("org.openecomp.jmx:name=SystemConfig"), null);
        if (!set.isEmpty()) {
          pid.add(desc.id());
        }
        vm.detach();
      } catch (Exception exception) {
        //do nothing
      }
    }
  }
}