18 * |
18 * |
19 * CDDL HEADER END |
19 * CDDL HEADER END |
20 */ |
20 */ |
21 |
21 |
22 /* |
22 /* |
23 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
24 */ |
24 */ |
25 |
25 |
26 package com.oracle.solaris.vp.panels.zconsole.client.text; |
26 package com.oracle.solaris.vp.panels.zconsole.client.text; |
27 |
27 |
28 import java.util.Map; |
28 import java.util.Map; |
29 import java.util.logging.Level; |
29 import java.util.logging.Level; |
30 import com.oracle.solaris.rad.ObjectException; |
30 import com.oracle.solaris.rad.client.RadObjectException; |
31 import com.oracle.solaris.rad.zonesbridge.IOMXBean; |
31 import com.oracle.solaris.rad.client.RadPrivilegeException; |
|
32 import com.oracle.solaris.rad.zonesbridge.IO; |
32 import com.oracle.solaris.vp.panel.common.ConnectionInfo; |
33 import com.oracle.solaris.vp.panel.common.ConnectionInfo; |
33 import com.oracle.solaris.vp.panel.common.control.*; |
34 import com.oracle.solaris.vp.panel.common.control.*; |
34 import com.oracle.solaris.vp.util.misc.TermUtil; |
35 import com.oracle.solaris.vp.util.misc.TermUtil; |
35 import com.oracle.solaris.vp.util.misc.finder.Finder; |
36 import com.oracle.solaris.vp.util.misc.finder.Finder; |
36 |
37 |
47 // Instance data |
48 // Instance data |
48 // |
49 // |
49 |
50 |
50 private String zone; |
51 private String zone; |
51 private long token; |
52 private long token; |
52 private IOMXBean bean; |
53 private IO bean; |
53 private BeanToStdout beanToStdout; |
54 private BeanToStdout beanToStdout; |
54 private StdinToBean stdinToBean; |
55 private StdinToBean stdinToBean; |
55 |
56 |
56 // |
57 // |
57 // Constructors |
58 // Constructors |
58 // |
59 // |
59 |
60 |
60 public MainControl(ZoneConsolePanelDescriptor descriptor, |
61 public MainControl(ZoneConsolePanelDescriptor descriptor, |
61 IOMXBean bean) { |
62 IO bean) { |
62 |
63 |
63 super(descriptor.getId(), descriptor.getName(), descriptor); |
64 super(descriptor.getId(), descriptor.getName(), descriptor); |
64 this.bean = bean; |
65 this.bean = bean; |
65 } |
66 } |
66 |
67 |
90 |
91 |
91 String zone = getParameter(parameters, PARAM_ZONE); |
92 String zone = getParameter(parameters, PARAM_ZONE); |
92 |
93 |
93 try { |
94 try { |
94 token = bean.openConsole(zone); |
95 token = bean.openConsole(zone); |
95 } catch (SecurityException e) { |
96 } catch (RadPrivilegeException e) { |
96 ConnectionInfo info = getClientContext().getConnectionInfo(); |
97 ConnectionInfo info = getClientContext().getConnectionInfo(); |
97 String user = info.getRole(); |
98 String user = info.getRole(); |
98 if (user == null) { |
99 if (user == null) { |
99 user = info.getUser(); |
100 user = info.getUser(); |
100 } |
101 } |
101 throw new NavigationFailedException(Finder.getString( |
102 throw new NavigationFailedException(Finder.getString( |
102 "error.security", user, info.getHost(), zone), e); |
103 "error.security", user, info.getHost(), zone), e); |
103 } catch (ObjectException e) { |
104 } catch (RadObjectException e) { |
104 ConnectionInfo info = getClientContext().getConnectionInfo(); |
105 ConnectionInfo info = getClientContext().getConnectionInfo(); |
105 String user = info.getRole(); |
106 String user = info.getRole(); |
106 if (user == null) { |
107 if (user == null) { |
107 user = info.getUser(); |
108 user = info.getUser(); |
108 } |
109 } |