mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ludovicp
27.13.2010 ffd470451bdf647c49b5a48951e3123f1bd410da
Improves the time to start-up the server and the way service tags are detected
5 files modified
108 ■■■■■ changed files
opends/resource/servicetag/opends.uuids.properties 6 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/servicetag/ServiceTagDefinition.java 7 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/servicetag/ServiceTagRegistration.java 87 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ConfigureWindowsService.java 4 ●●● patch | view | raw | blame | history
opends/resource/servicetag/opends.uuids.properties
@@ -1,6 +1,6 @@
org.opends.server.servicetag.productname=OpenDS 2.2
org.opends.server.servicetag.version=2.2
org.opends.server.servicetag.uuid=urn:uuid:03abeb3a-9cd1-11de-9d26-080020a9ed93
org.opends.server.servicetag.productname=OpenDS 2.4
org.opends.server.servicetag.version=2.4
org.opends.server.servicetag.uuid=urn:uuid:16cff1a9-f950-11de-a671-080020a9ed93
org.opends.server.servicetag.parent=Unknown
org.opends.server.servicetag.parenturn=Unknown
org.opends.server.servicetag.vendor=Opends.org
opends/src/messages/messages/tools.properties
@@ -1454,8 +1454,8 @@
SEVERE_ERR_CONFIGURE_WINDOWS_SERVICE_TOO_FEW_ARGS_824=You must provide at \
 least one of the following arguments:\nenableService, disableService or \
 serviceState or cleanupService
INFO_WINDOWS_SERVICE_NAME_825=OpenDS
INFO_WINDOWS_SERVICE_DESCRIPTION_826=Open source Next Generation Directory \
INFO_WINDOWS_SERVICE_NAME_825=%s
INFO_WINDOWS_SERVICE_DESCRIPTION_826=Next Generation Directory \
 Server.  Installation path: %s
INFO_WINDOWS_SERVICE_SUCCESSULLY_ENABLED_827=The server was successfully \
 enabled to run as a Windows service
opends/src/server/org/opends/server/servicetag/ServiceTagDefinition.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.server.servicetag;
@@ -118,4 +118,9 @@
     */
    final static String PRODUCT_PARENT_URN =
            "org.opends.server.servicetag.parenturn";
    /**
     * Registration done file name.
     */
    final static String FILE_REGISTRATION_DONE = "st-registration.done";
}
opends/src/server/org/opends/server/servicetag/ServiceTagRegistration.java
@@ -22,11 +22,12 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.server.servicetag;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Properties;
@@ -100,46 +101,62 @@
    }
    /**
     * Create the defined serviceTags for OpenDS Based Servers if
     * the native registration is supported
     * If the system supports service tag, stclient will be used
     * Tests if the ST registration has already be done for the instance.
     * @return true if the ST registration has been done, false otherwise.
     */
    public boolean isRegistrationAlreadyDone() {
         File serviceTag =
                 new File(DirectoryServer.getInstanceRoot() +
                        File.separatorChar +
                        "config" +
                        File.separatorChar +
                        "servicetag" +
                        File.separatorChar +
                        ServiceTagDefinition.FILE_REGISTRATION_DONE);
         if (!serviceTag.exists()) {
            return false;
         }
         else {
           return true;
         }
    }
   /**
     * Create the registration file.
     * @throws IOException if the file cannot be created.
     */
    public void createRegistrationDone() throws IOException {
         File serviceTag =
                 new File(DirectoryServer.getInstanceRoot() +
                        File.separatorChar +
                        "config" +
                        File.separatorChar +
                        "servicetag" +
                        File.separatorChar +
                        ServiceTagDefinition.FILE_REGISTRATION_DONE);
         if (!serviceTag.exists()) {
             serviceTag.createNewFile();
         }
    }
    /**
     * Create the defined serviceTags for OpenDS Based Servers.
     * At this point the ST registration is supported. stclient will be used
     * to create the OpenDS service tag.
     * @param svcTag the ServiceTag to register.
     * @throws org.opends.server.servicetag.ServiceTagException
     * if the ServiceTag can not be registered
     * @throws org.opends.server.servicetag.ServiceTagAlreadyExistsException
     * if the ServiceTag already exists in the common registry based on
     * the product_urn and product_defined_instanceid
     * @throws java.lang.IllegalArgumentException if parameter is not valid.
     */
    public void registerServiceTag(ServiceTag svcTag) throws
            ServiceTagException, IllegalArgumentException,
            ServiceTagAlreadyExistsException {
        // Test if the common registration is supported on the filesystem
        // or not
        if (!isCommonRegistrationSupported()) {
            throw new ServiceTagException(
                    WARN_REGISTRY_NOT_SUPPORTED.get());
        }
        // Parameter checking
        if (svcTag == null) {
            throw new IllegalArgumentException(
                    WARN_PARAMETER_CANNOT_BE_NULL.get("svcTag").toString());
        }
            ServiceTagException {
        try {
            // Add the ServiceTag if it does not exist
            if (this.registry.existServiceTag(
                    svcTag.getProductURN(),
                    svcTag.getProductDefinedInstanceID())) {
                throw new ServiceTagAlreadyExistsException
                        (WARN_SERVICETAG_ALREADY_EXIST.get());
            }
            // Add the ServiceTag in the common registry
            this.registry.addServiceTag(svcTag);
            this.createRegistrationDone();
        } catch (IOException ex) {
            throw new ServiceTagException(
                    WARN_SERVICETAG_CANNOT_BE_REGISTERED.get(
@@ -165,6 +182,12 @@
    public Set<ServiceTag> registerServiceTags(String source)
            throws ServiceTagException, IllegalArgumentException {
        // Check if the registration has been done.
        if (this.isRegistrationAlreadyDone()) {
            throw new ServiceTagAlreadyExistsException
                        (WARN_SERVICETAG_ALREADY_EXIST.get());
        }
        // Parameter checking
        // Test if the common registration is supported on the filesystem
        // or not
opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -39,6 +39,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.NullOutputStream;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
@@ -403,7 +404,8 @@
  {
    Message serviceName = Utils.getCustomizedObject(
        "INFO_WINDOWS_SERVICE_NAME",
        INFO_WINDOWS_SERVICE_NAME.get(), Message.class);
        INFO_WINDOWS_SERVICE_NAME.get(DynamicConstants.PRODUCT_NAME),
        Message.class);
    Message serviceDescription = Utils.getCustomizedObject(
        "INFO_WINDOWS_SERVICE_DESCRIPTION",
        INFO_WINDOWS_SERVICE_DESCRIPTION.get(getServerRoot()), Message.class);