components/visual-panels/core/src/java/vpanels/panel/com/oracle/solaris/vp/panel/common/smf/SmfManagedObject.java
equal
deleted
inserted
replaced
18 * |
18 * |
19 * CDDL HEADER END |
19 * CDDL HEADER END |
20 */ |
20 */ |
21 |
21 |
22 /* |
22 /* |
23 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
24 */ |
24 */ |
25 |
25 |
26 package com.oracle.solaris.vp.panel.common.smf; |
26 package com.oracle.solaris.vp.panel.common.smf; |
27 |
27 |
28 import java.net.URISyntaxException; |
28 import java.net.URISyntaxException; |
29 import java.util.*; |
29 import java.util.*; |
30 import java.util.logging.*; |
30 import java.util.logging.*; |
31 import javax.management.ObjectName; |
|
32 import javax.swing.*; |
31 import javax.swing.*; |
|
32 import com.oracle.solaris.rad.client.ADRName; |
33 import com.oracle.solaris.scf.common.*; |
33 import com.oracle.solaris.scf.common.*; |
34 import com.oracle.solaris.vp.panel.common.*; |
34 import com.oracle.solaris.vp.panel.common.*; |
35 import com.oracle.solaris.vp.panel.common.api.smf_old.Dependency; |
35 import com.oracle.solaris.vp.panel.common.api.smf_old.Dependency; |
36 import com.oracle.solaris.vp.panel.common.model.ManagedObject; |
36 import com.oracle.solaris.vp.panel.common.model.ManagedObject; |
37 import com.oracle.solaris.vp.panel.common.smf.depend.DepManagedObject; |
37 import com.oracle.solaris.vp.panel.common.smf.depend.DepManagedObject; |
56 // |
56 // |
57 // Instance data |
57 // Instance data |
58 // |
58 // |
59 |
59 |
60 private ServiceTracker tracker; |
60 private ServiceTracker tracker; |
61 private ObjectName on; |
61 private ADRName an; |
62 private FMRI fmri; |
62 private FMRI fmri; |
63 private String name; |
63 private String name; |
64 private String desc; |
64 private String desc; |
65 private Map<String, Dependency> dependencies; |
65 private Map<String, Dependency> dependencies; |
66 private String serviceName; |
66 private String serviceName; |
68 |
68 |
69 // |
69 // |
70 // Constructors |
70 // Constructors |
71 // |
71 // |
72 |
72 |
73 public SmfManagedObject(ClientContext context, String fmri, ObjectName on) |
73 public SmfManagedObject(ClientContext context, String fmri, ADRName an) |
74 throws TrackerException { |
74 throws TrackerException { |
75 |
75 |
76 tracker = new ServiceTracker(on, context); |
76 tracker = new ServiceTracker(an, context); |
77 try { |
77 try { |
78 this.fmri = new FMRI(fmri); |
78 this.fmri = new FMRI(fmri); |
79 } catch (URISyntaxException e) { |
79 } catch (URISyntaxException e) { |
80 this.fmri = null; |
80 this.fmri = null; |
81 } |
81 } |
82 this.on = on; |
82 this.an = an; |
83 serviceName = ServiceUtil.toService(on); |
83 serviceName = ServiceUtil.toService(an); |
84 } |
84 } |
85 |
85 |
86 // |
86 // |
87 // Comparable methods |
87 // Comparable methods |
88 // |
88 // |
204 return dependencies.values(); |
204 return dependencies.values(); |
205 } |
205 } |
206 |
206 |
207 try { |
207 try { |
208 dependencies = new HashMap<String, Dependency>(); |
208 dependencies = new HashMap<String, Dependency>(); |
209 ServiceMXBean service = getService(); |
209 ServiceBean service = getService(); |
210 List<String> deps = service.getDependencyNames(); |
210 List<String> deps = service.getDependencyNames(); |
211 for (String dep : deps) { |
211 for (String dep : deps) { |
212 dependencies.put(dep, service.getDependency(dep)); |
212 dependencies.put(dep, service.getDependency(dep)); |
213 } |
213 } |
214 } catch (ScfException e) { |
214 } catch (ScfException e) { |
216 |
216 |
217 return dependencies.values(); |
217 return dependencies.values(); |
218 } |
218 } |
219 } |
219 } |
220 |
220 |
221 public ObjectName getObjectName() { |
221 public ADRName getObjectName() { |
222 return on; |
222 return an; |
223 } |
223 } |
224 } |
224 } |