diff -r cc70edb97d7a derby/src/org/netbeans/modules/derby/DerbyOptions.java --- a/derby/src/org/netbeans/modules/derby/DerbyOptions.java Fri Mar 12 17:50:02 2010 +0100 +++ b/derby/src/org/netbeans/modules/derby/DerbyOptions.java Fri Mar 12 18:26:51 2010 +0100 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common @@ -24,7 +24,7 @@ * Contributor(s): * * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun * Microsystems, Inc. All Rights Reserved. * * If you wish your version of this file to be governed by only the CDDL @@ -135,6 +135,14 @@ return location; } + private String getCurrentLocation() { + String location = getProperty(PROP_DERBY_LOCATION); + if (location == null) { + location = ""; // NOI18N + } + return location; + } + /** * Returns true if the Derby location is null. This method is needed * since getLocation() will never return a null value. @@ -181,7 +189,7 @@ public synchronized boolean trySetLocation(String location) { LOGGER.log(Level.FINE, "trySetLocation: Trying to set location to {0}", location); // NOI18N - String current = getLocation(); + String current = getCurrentLocation(); if (current.length() == 0) { setLocation(location); LOGGER.fine("trysetLocation: Succeeded"); // NOI18N diff -r cc70edb97d7a derby/src/org/netbeans/modules/derby/DerbyRegistration.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/derby/src/org/netbeans/modules/derby/DerbyRegistration.java Fri Mar 12 18:26:51 2010 +0100 @@ -0,0 +1,151 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + +package org.netbeans.modules.derby; + +import java.io.File; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; + +/** + * Registers installation of JavaDB by creating instance file in cluster config + * directory. Designed to be called from installer. + * The DerbyRegistration can called multiple times but only the first invocation + * is stored. + *
+ * Sample command line
+ *
+ * java -cp platform/core/core.jar:platform/lib/boot.jar:platform/lib/org-openide-modules.jar:
+ * platform/core/org-openide-filesystems.jar:platform/lib/org-openide-util.jar:
+ * platform/lib/org-openide-util-lookup.jar:ide/modules/org-netbeans-modules-derby.jar
+ * org.netbeans.modules.derby.DerbyRegistration nb /usr/local/share/java/jdk1.6.0_18/db
+ *
+ * @author Jiri Rechtacek
+ * @see #main(args)
+ */
+public class DerbyRegistration {
+
+ private static final String DERBY_REGISTRATION_DIR = "JavaDB"; // NOI18N
+ private static final String DERBY_REGISTRATION_FILE = "registration_instance"; // NOI18N
+ private static final String ATTR_DERBY_HOME = "javadb_installation_home"; // NOI18N
+ private static final Logger LOGGER = Logger.getLogger(DerbyRegistration.class.getName());
+
+ /**
+ * Performs registration.
+ *
+ * Exit codes:
+ *