DBHelper.java revision 73db7653fd150e027270e0e9cc9f421ea3ce6681
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * Copyright (c) 2011-2013 ForgeRock AS. 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 * 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]" * A Helper to interact with the OrientDB * Setup logging for the {@link DBHelper}. * Get the DB pool for the given URL. May return an existing pool * configuration if setupDB is enabled * Do not close the returned pool directly as it may be used by others. * To cleanly shut down the application, call closePools at the end * the orientdb user to connect * the orientdb password to connect * the full configuration for the DB * true if it should also check the DB exists in the state to * match the passed configuration, and to set it up to match * @throws org.forgerock.openidm.config.enhanced.InvalidException * Closes all pools managed by this helper Call at application shut-down to * cleanly shut down the pools. * Initialize the DB pool. * the orientdb user to connect * the orientdb password to connect * @return the initialized pool * @throws org.forgerock.openidm.config.enhanced.InvalidException // Initialize and try to verify the DB. Retry maxRetry times. * Perform a basic access on the DB for a rudimentary test * @return whether the basic access succeeded // JSONResource always should exist logger.
info(
"Exceptions encountered in verifying the DB",
ex);
* Ensure the min size pool entries are initilized. Cuts down on some * (small) initial latency with lazy init Do not call with a min past the * real pool max, it will block. logger.
warn(
"Issue in connection close during warming up db pool, entry {}",
entry,
* Ensures the DB is present in the expected form. // OConfigurationException("Database 'openidm' is not configured on server"); // Assume the 'openidm' database does not exist. "7A5DEAB30884B4C8026A047F13D4A67BDEDC7CA227AA8F4D477727EABE5541B4")
"Missing /rootName and /rootPassword configuration so the 'openidm' database can not be created automatically.");
"New database must use the default 'admin':'admin' name:password combination");
// The exception was not because the 'openidm' // database does not exits "New database must use the default 'admin':'admin' name:password combination");
// TODO: Review the initialization mechanism logger.
warn(
"No database structure defined in the configuration.");
// Default always to create Config class for bootstrapping // TODO: update indexes too if changed // TODO Recheck this method call "Invalid index configuration. Missing propertyName(s) on index configuration");
// Determine a unique name to use for the index // Naming pattern used is <class>|property1[|propertyN]*|Idx // Not using dot as is reserved for (simple index) naming convention // Check if a single property is being defined and create it if so "Creating index on properties {} of type {} with index type {} on {} for OrientDB class ",
+
"' in configuration on properties " +
propertyNames +
" of type " // Populates the default user, the pwd needs to be changed by the installer logger.
trace(
"Created default user 'openidm-admin'. Please change the assigned default password.");
logger.
trace(
"Created default user 'anonymous' for registration purposes.");
" \"_openidm_id\":\"openidm-admin\",\n" +
" \"userName\":\"openidm-admin\",\n" +
" \"iv\":\"fIevcJYS4TMxClqcK7covg==\",\n" +
" \"data\":\"Tu9o/S+j+rhOIgdp9uYc5Q==\",\n" +
" \"key\":\"openidm-sym-default\"\n" +
" \"type\":\"x-simple-encryption\"\n" +
" \"openidm-admin\",\n" +
" \"openidm-authorized\"\n" +
" \"_openidm_id\":\"anonymous\",\n" +
" \"userName\":\"anonymous\",\n" +
" \"password\":\"anonymous\",\n" +