Lines 47-54
Link Here
|
47 |
import java.io.IOException; |
47 |
import java.io.IOException; |
48 |
import java.io.InputStream; |
48 |
import java.io.InputStream; |
49 |
import java.io.UnsupportedEncodingException; |
49 |
import java.io.UnsupportedEncodingException; |
50 |
import java.net.MalformedURLException; |
|
|
51 |
import java.net.URL; |
52 |
import java.nio.charset.Charset; |
50 |
import java.nio.charset.Charset; |
53 |
import java.util.List; |
51 |
import java.util.List; |
54 |
import java.util.concurrent.Callable; |
52 |
import java.util.concurrent.Callable; |
Lines 57-68
Link Here
|
57 |
import java.util.logging.Logger; |
55 |
import java.util.logging.Logger; |
58 |
import java.util.regex.Pattern; |
56 |
import java.util.regex.Pattern; |
59 |
import javax.swing.SwingUtilities; |
57 |
import javax.swing.SwingUtilities; |
|
|
58 |
import org.netbeans.api.keyring.Keyring; |
60 |
import org.netbeans.api.project.FileOwnerQuery; |
59 |
import org.netbeans.api.project.FileOwnerQuery; |
61 |
import org.netbeans.api.project.Project; |
60 |
import org.netbeans.api.project.Project; |
62 |
import org.netbeans.api.project.ProjectUtils; |
61 |
import org.netbeans.api.project.ProjectUtils; |
63 |
import org.netbeans.api.server.ServerInstance; |
62 |
import org.netbeans.api.server.ServerInstance; |
64 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.api.ApplicationManager; |
63 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.api.ApplicationManager; |
65 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.api.ApplicationManagerConnectionFactory; |
|
|
66 |
import org.netbeans.libs.oracle.cloud.api.CloudSDKHelper; |
64 |
import org.netbeans.libs.oracle.cloud.api.CloudSDKHelper; |
67 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.exception.ManagerException; |
65 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.exception.ManagerException; |
68 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.model.*; |
66 |
import org.netbeans.libs.oracle.cloud.sdkwrapper.model.*; |
Lines 94-101
Link Here
|
94 |
private static final Logger LOG = Logger.getLogger(OracleInstance.class.getSimpleName()); |
92 |
private static final Logger LOG = Logger.getLogger(OracleInstance.class.getSimpleName()); |
95 |
|
93 |
|
96 |
private final String name; |
94 |
private final String name; |
|
|
95 |
|
96 |
/* GuardedBy(this) */ |
97 |
private boolean userLoaded; |
98 |
|
99 |
/* GuardedBy(this) */ |
97 |
private String user; |
100 |
private String user; |
|
|
101 |
|
102 |
/* GuardedBy(this) */ |
103 |
private boolean passwordLoaded; |
104 |
|
105 |
/* GuardedBy(this) */ |
98 |
private String password; |
106 |
private String password; |
|
|
107 |
|
99 |
private String adminURL; |
108 |
private String adminURL; |
100 |
private String identityDomain; |
109 |
private String identityDomain; |
101 |
private String javaServiceName; |
110 |
private String javaServiceName; |
Lines 109-122
Link Here
|
109 |
|
118 |
|
110 |
/* GuardedBy(this) */ |
119 |
/* GuardedBy(this) */ |
111 |
private OracleJ2EEInstance j2eeInstance; |
120 |
private OracleJ2EEInstance j2eeInstance; |
|
|
121 |
|
122 |
public OracleInstance(String name, String user, String password, String adminURL, String identityDomain, |
123 |
String javaServiceName, String dbServiceName, String onPremiseServerInstanceId, |
124 |
String sdkFolder) { |
125 |
this(name, adminURL, identityDomain, javaServiceName, dbServiceName, onPremiseServerInstanceId, sdkFolder); |
126 |
this.userLoaded = true; |
127 |
this.user = user; |
128 |
this.passwordLoaded = true; |
129 |
this.password = password; |
130 |
} |
112 |
|
131 |
|
113 |
public OracleInstance(String name, String user, String password, |
132 |
public OracleInstance(String name, String adminURL, String identityDomain, |
114 |
String adminURL, String identityDomain, |
|
|
115 |
String javaServiceName, String dbServiceName, String onPremiseServerInstanceId, |
133 |
String javaServiceName, String dbServiceName, String onPremiseServerInstanceId, |
116 |
String sdkFolder) { |
134 |
String sdkFolder) { |
117 |
this.name = name; |
135 |
this.name = name; |
118 |
this.user = user; |
|
|
119 |
this.password = password; |
120 |
this.adminURL = adminURL; |
136 |
this.adminURL = adminURL; |
121 |
this.identityDomain = identityDomain; |
137 |
this.identityDomain = identityDomain; |
122 |
this.javaServiceName = javaServiceName; |
138 |
this.javaServiceName = javaServiceName; |
Lines 138-148
Link Here
|
138 |
} |
154 |
} |
139 |
|
155 |
|
140 |
public String getPassword() { |
156 |
public String getPassword() { |
141 |
return password; |
157 |
synchronized (this) { |
|
|
158 |
if (passwordLoaded) { |
159 |
return password; |
160 |
} |
161 |
} |
162 |
|
163 |
char[] ch = Keyring.read(OracleInstanceManager.PREFIX |
164 |
+ OracleInstanceManager.PASSWORD + "." + name); |
165 |
if (ch == null) { |
166 |
LOG.log(Level.WARNING, "no password found for "+name); |
167 |
ch = new char[]{' '}; |
168 |
} |
169 |
String passwd = new String(ch); |
170 |
assert passwd != null : "password is missing for "+name; // NOI18N |
171 |
|
172 |
synchronized (this) { |
173 |
if (!passwordLoaded) { |
174 |
passwordLoaded = true; |
175 |
password = passwd; |
176 |
} |
177 |
return password; |
178 |
} |
142 |
} |
179 |
} |
143 |
|
180 |
|
144 |
public String getUser() { |
181 |
public String getUser() { |
145 |
return user; |
182 |
synchronized (this) { |
|
|
183 |
if (userLoaded) { |
184 |
return user; |
185 |
} |
186 |
} |
187 |
|
188 |
char ch[] = Keyring.read(OracleInstanceManager.PREFIX |
189 |
+ OracleInstanceManager.USERNAME + "." + name); |
190 |
if (ch == null) { |
191 |
LOG.log(Level.WARNING, "no username found for "+name); |
192 |
ch = new char[]{' '}; |
193 |
} |
194 |
String userName = new String(ch); |
195 |
assert userName != null : "username is missing for "+name; // NOI18N |
196 |
|
197 |
synchronized (this) { |
198 |
if (!userLoaded) { |
199 |
userLoaded = true; |
200 |
user = userName; |
201 |
} |
202 |
return user; |
203 |
} |
146 |
} |
204 |
} |
147 |
|
205 |
|
148 |
public String getAdminURL() { |
206 |
public String getAdminURL() { |
Lines 189-196
Link Here
|
189 |
} |
247 |
} |
190 |
|
248 |
|
191 |
public void setPassword(String password) { |
249 |
public void setPassword(String password) { |
192 |
this.password = password; |
|
|
193 |
synchronized (this) { |
250 |
synchronized (this) { |
|
|
251 |
this.password = password; |
252 |
this.passwordLoaded = true; |
194 |
if (j2eeInstance != null) { |
253 |
if (j2eeInstance != null) { |
195 |
j2eeInstance.getInstanceProperties().setProperty( |
254 |
j2eeInstance.getInstanceProperties().setProperty( |
196 |
InstanceProperties.PASSWORD_ATTR, password); |
255 |
InstanceProperties.PASSWORD_ATTR, password); |
Lines 200-207
Link Here
|
200 |
} |
259 |
} |
201 |
|
260 |
|
202 |
public void setUser(String user) { |
261 |
public void setUser(String user) { |
203 |
this.user = user; |
|
|
204 |
synchronized (this) { |
262 |
synchronized (this) { |
|
|
263 |
this.user = user; |
264 |
this.userLoaded = true; |
205 |
if (j2eeInstance != null) { |
265 |
if (j2eeInstance != null) { |
206 |
j2eeInstance.getInstanceProperties().setProperty( |
266 |
j2eeInstance.getInstanceProperties().setProperty( |
207 |
InstanceProperties.USERNAME_ATTR, user); |
267 |
InstanceProperties.USERNAME_ATTR, user); |
Lines 240-246
Link Here
|
240 |
|
300 |
|
241 |
public synchronized ApplicationManager getApplicationManager() { |
301 |
public synchronized ApplicationManager getApplicationManager() { |
242 |
if (platform == null) { |
302 |
if (platform == null) { |
243 |
platform = createApplicationManager(adminURL, user, password, sdkFolder); |
303 |
platform = createApplicationManager(adminURL, getUser(), getPassword(), sdkFolder); |
244 |
} |
304 |
} |
245 |
return platform; |
305 |
return platform; |
246 |
} |
306 |
} |