001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * If you wish your version of this file to be governed by only the CDDL
025: * or only the GPL Version 2, indicate your decision by adding
026: * "[Contributor] elects to include this software in this distribution
027: * under the [CDDL or GPL Version 2] license." If you do not indicate a
028: * single choice of license, a recipient has the option to distribute
029: * your version of this file under either the CDDL, the GPL Version 2 or
030: * to extend the choice of license to its licensees as provided above.
031: * However, if you add GPL Version 2 code and therefore, elected the GPL
032: * Version 2 license, then the option applies only if the new code is
033: * made subject to such option by the copyright holder.
034: *
035: * Contributor(s):
036: *
037: * Portions Copyrighted 2008 Sun Microsystems, Inc.
038: */
039:
040: package org.netbeans.modules.db.mysql;
041:
042: /**
043: * This interface defines an abstraction of an installation of MySQL, which
044: * gives you information such as the path/arguments to the start command,
045: * stop command, admin command.
046: *
047: * Valid installations are loaded through the layer file using the folder
048: * Databases/MySQL/Installations
049: *
050: * @author David Van Couvering
051: */
052: public interface Installation {
053: public enum Command {
054: START, STOP, ADMIN
055: };
056:
057: /**
058: * @return true if this installation is part of a stack installation
059: * like XAMPP or MAMP. Stack-based installations take preference because
060: * they usually have an admin tool (myphpadmin) and usually don't install
061: * MySQL as a service but are instead manually started and stopped.
062: *
063: * Also, standalone installs often come as part of the OS distribution,
064: * where a stack based install is explicitly installed by the user, and
065: * thus is probably their preference.
066: */
067: public boolean isStackInstall();
068:
069: /**
070: * Returns true if this installation is valid for the current OS
071: */
072: public boolean isValidOnCurrentOS();
073:
074: /**
075: * @return the command to administer this installation. This is normally
076: * phpMyAdmin; rarely does an installation come with the MySQL admin tool.
077: * <p>
078: * The first element is the path/URL to the command.
079: * The second element is the arguments to the command
080: */
081: public String[] getAdminCommand();
082:
083: /**
084: * @return the command to stop the server. The first element is the path
085: * to the command. The second element is the arguments to the command
086: */
087: public String[] getStartCommand();
088:
089: /**
090: * @return the command to start the server. The first element is the path
091: * to the command. The second element is the arguments to the command
092: */
093: public String[] getStopCommand();
094:
095: /**
096: * @return the default port number for the server
097: */
098: public String getDefaultPort();
099:
100: /**
101: * Given a full path to a command, get an installation definition.
102: * This is for when the installation path may not be the default one.
103: * The use case for this
104: * is if the user manually specifies a path to the start command; we can
105: * then use this to determine the values for the other commands.
106: *
107: * @param command the full path to the command
108: * @param cmdType the type of command
109: *
110: * @return an Installation which is correct based on the given command,
111: * or null if it was not a valid command
112: */
113: public Installation getInstallation(String command, Command cmdType);
114: }
|