@@ -86,7 +86,7 @@ public class ImportServiceConfiguration extends AuthenticatedCommand {
8686 * @param rc Request Context.
8787 * @throws CLIException if the request cannot serviced.
8888 */
89- public void handleRequest (RequestContext rc )
89+ public void handleRequest (RequestContext rc )
9090 throws CLIException {
9191 super .handleRequest (rc );
9292
@@ -98,7 +98,7 @@ public void handleRequest(RequestContext rc)
9898 //There is no encryptSecret file
9999 }
100100 validateEncryptSecret (xmlFile , encryptSecret );
101-
101+
102102 // disable notification
103103 SystemProperties .initializeProperties (
104104 Constants .SMS_ENABLE_DB_NOTIFICATION , "true" );
@@ -112,25 +112,26 @@ public void handleRequest(RequestContext rc)
112112 IOutput outputWriter = getOutputWriter ();
113113 try (Connection ldConnection = getLDAPConnection ()) {
114114 InitializeSystem initSys = CommandManager .initSys ;
115-
115+
116116 SSOToken ssoToken = initSys .getSSOToken (getAdminPassword ());
117117
118118 DirectoryServerVendor .Vendor vendor = DirectoryServerVendor .getInstance ().query (ldConnection );
119- if (!vendor .name .equals (DirectoryServerVendor .OPENDJ )
119+ if (!vendor .name .equals (DirectoryServerVendor .WRENDS )
120+ && !vendor .name .equals (DirectoryServerVendor .OPENDJ )
120121 && !vendor .name .equals (DirectoryServerVendor .OPENDS )
121122 && !vendor .name .equals (DirectoryServerVendor .ODSEE )
122123 ) {
123124 throw new CLIException (getResourceString (
124125 "import-service-configuration-unknown-ds" ),
125126 ExitCodes .REQUEST_CANNOT_BE_PROCESSED );
126127 }
127-
128+
128129 if (vendor .name .equals (DirectoryServerVendor .ODSEE )) {
129130 loadLDIF (vendor , ldConnection );
130131 }
131132
132133 String ouServices = "ou=services," + initSys .getRootSuffix ();
133-
134+
134135 if (this .isOuServicesExists (ssoToken , ouServices )) {
135136 System .out .print (getResourceString (
136137 "import-service-configuration-prompt-delete" ) + " " );
@@ -171,15 +172,15 @@ public void handleRequest(RequestContext rc)
171172 "exception-LDAP-login-failed" ), ExitCodes .LDAP_LOGIN_FAILED );
172173 }
173174 }
174-
175+
175176 private String getEncKey (String xmlFile )
176177 throws IOException {
177178 String encKey = null ;
178179 BufferedReader reader = null ;
179-
180+
180181 try {
181182 reader = new BufferedReader (new FileReader (xmlFile ));
182-
183+
183184 String line = reader .readLine ();
184185 String prefix = "<Value>" + Constants .ENC_PWD_PROPERTY + "=" ;
185186 while ((line != null ) && (encKey == null )) {
@@ -206,17 +207,17 @@ private String getEncKey(String xmlFile)
206207 }
207208 return encKey ;
208209 }
209-
210+
210211 private boolean isOuServicesExists (SSOToken ssoToken , String ouServices )
211212 throws SMSException , SSOException {
212213 CachedSubEntries smsEntry = CachedSubEntries .getInstance (
213214 ssoToken , ouServices );
214215 Set children = smsEntry .getSubEntries (ssoToken , "*" );
215216 return (children != null ) && !children .isEmpty ();
216217 }
217-
218+
218219 private void deleteOuServicesDescendents (
219- SSOToken ssoToken ,
220+ SSOToken ssoToken ,
220221 String ouServices
221222 ) throws SSOException , SMSException {
222223 CachedSubEntries smsEntry = CachedSubEntries .getInstance (
@@ -251,8 +252,8 @@ private void deleteOuServicesDescendents(
251252 }
252253
253254 private void importData (
254- String xmlFile ,
255- String encryptSecret ,
255+ String xmlFile ,
256+ String encryptSecret ,
256257 SSOToken ssoToken
257258 ) throws CLIException , SSOException , SMSException , IOException {
258259 // set the correct password encryption key.
@@ -263,21 +264,21 @@ private void importData(
263264 encKey );
264265 Crypt .reinitialize ();
265266 }
266- IOutput outputWriter = getOutputWriter ();
267+ IOutput outputWriter = getOutputWriter ();
267268 FileInputStream fis = null ;
268269
269270 try {
270271 AMEncryption encryptObj = new JCEEncryption ();
271272 ((ConfigurableKey )encryptObj ).setPassword (encryptSecret );
272-
273+
273274 ServiceManager ssm = new ServiceManager (ssoToken );
274275 fis = new FileInputStream (xmlFile );
275276 ssm .registerServices (fis , encryptObj );
276-
277+
277278 InitializeSystem initSys = CommandManager .initSys ;
278279 String instanceName = initSys .getInstanceName ();
279280 String serverConfigXML = initSys .getServerConfigXML ();
280- ServerConfiguration .setServerConfigXML (ssoToken , instanceName ,
281+ ServerConfiguration .setServerConfigXML (ssoToken , instanceName ,
281282 serverConfigXML );
282283 outputWriter .printlnMessage (getResourceString (
283284 "import-service-configuration-succeeded" ));
@@ -306,7 +307,7 @@ private Connection getLDAPConnection() throws CLIException {
306307 if (isVerbose ()) {
307308 outputWriter .printlnMessage (getResourceString ("import-service-configuration-connecting-to-ds" ));
308309 }
309-
310+
310311 try {
311312 Connection conn ;
312313 DSConfigMgr dsCfg = DSConfigMgr .getDSConfigMgr ();
@@ -317,7 +318,7 @@ private Connection getLDAPConnection() throws CLIException {
317318 throw new CLIException (getResourceString ("import-service-configuration-not-connect-to-ds" ),
318319 ExitCodes .REQUEST_CANNOT_BE_PROCESSED , null );
319320 }
320-
321+
321322 if (isVerbose ()) {
322323 outputWriter .printlnMessage (getResourceString ("import-service-configuration-connected-to-ds" ));
323324 }
0 commit comments