ImportServiceConfiguration.java revision 4709b991352c6de69ba02928ed6cbf373ca62ed5
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: ImportServiceConfiguration.java,v 1.10 2010/01/11 17:34:33 veiming Exp $
*
*/
/*
* Portions Copyrighted 2010-2011 ForgeRock AS
*/
/**
* Import service configuration data.
*/
public class ImportServiceConfiguration extends AuthenticatedCommand {
/**
* Services a Commandline Request.
*
* @param rc Request Context.
* @throws CLIException if the request cannot serviced.
*/
throws CLIException {
super.handleRequest(rc);
try {
} catch (CLIException clie) {
//There is no encryptSecret file
}
// disable notification
"com.sun.am.event.connection.disable.list", "sm,aci,um");
// disable error debug messsage
try {
) {
throw new CLIException(getResourceString(
"import-service-configuration-unknown-ds"),
}
"import-service-configuration-prompt-delete") + " ");
) {
"import-service-configuration-processing"));
}
} else {
"import-service-configuration-processing"));
}
} catch (SMSException e) {
throw new CLIException(e.getMessage(),
} catch (LDAPException e) {
throw new CLIException(e.getMessage(),
} catch (SSOException e) {
throw new CLIException(e.getMessage(),
} catch (IOException e) {
throw new CLIException(e.getMessage(),
} catch (LoginException e) {
throw new CLIException(
} catch (InvalidAuthContextException e) {
throw new CLIException(
} finally {
}
}
throws IOException {
try {
//don't fall for tagswappable value
}
}
}
} finally {
try {
} catch (IOException e) {
//ignore
}
}
}
return encKey;
}
throws SMSException, SSOException {
}
private void deleteOuServicesDescendents(
) throws SSOException, SMSException {
s.delete();
}
{ // hardcoding hidden realm, cannot find a better option.
"o=sunamhiddenrealmdelegationservicepermissions," +
s.delete();
}
s.delete();
}
mgr.clearCache();
}
private void importData(
// set the correct password encryption key.
// without doing so, the default encryption key will be used.
encKey);
}
try {
"import-service-configuration-succeeded"));
} catch (IOException e) {
} catch (SSOException e) {
} catch (SMSException e) {
} catch (Exception e) {
} finally {
try {
} catch (IOException ie) {
//ignore if file input stream cannot be closed.
}
}
}
}
private LDAPConnection getLDAPConnection()
throws CLIException {
if (isVerbose()) {
"import-service-configuration-connecting-to-ds"));
}
try {
} else {
throw new CLIException(
"import-service-configuration-not-connect-to-ds"),
}
if (isVerbose()) {
"import-service-configuration-connected-to-ds"));
}
return ld;
} catch (LDAPServiceException e) {
throw new CLIException(
"import-service-configuration-not-connect-to-ds"),
}
}
try {
ld.disconnect();
} catch (LDAPException e) {
debugWarning("cannot discount from directory server", e);
}
}
}
private void loadLDIF(
) throws CLIException {
try {
ldif = new DataInputStream(
index = new DataInputStream(
}
} catch (LDAPException e) {
e.printStackTrace();
throw new CLIException(e.getMessage(),
} catch (IOException e) {
throw new CLIException(e.getMessage(),
} finally {
try {
} catch (IOException ex) {
//ignore
}
}
try {
} catch (IOException ex) {
//ignore
}
}
}
}
throws CLIException {
if (start == -1) {
throw new CLIException(getResourceString(
"import-service-configuration-unable-to-locate-hash-secret"),
}
if (end == -1) {
throw new CLIException(getResourceString(
"import-service-configuration-unable-to-locate-hash-secret"),
}
throw new CLIException(getResourceString(
"import-service-configuration-secret-key"),
}
}
}