1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.spi.db.explorer; 21 22 /** 23 * Represents an instance of a database server, typically a local installation which can be 24 * started when a connection to this server is being made, or stopped upon IDE shutdown. 25 * 26 * <p>Implementations of this class should be put in the Databases/Runtimes folder 27 * in the default filesystem.</p> 28 * 29 * @author Nam Nguyen, Andrei Badea 30 */ 31 public interface DatabaseRuntime { 32 33 /** 34 * Returns the JDBC driver class which is used to make connections to the 35 * represented database server instance. 36 * 37 * <p>When a connection is being made, only the database runtimes which have 38 * the same JDBC driver as the driver used by this connection are considered 39 * for further usage (e.g., starting the database server instance).</p> 40 * 41 * @return the fully-qualified class name of the driver used to make 42 * connections to the represented database server instance. 43 */ 44 public String getJDBCDriverClass(); 45 46 /** 47 * Returns whether this runtime accepts this database URL (the database URL 48 * would cause a connection to be made to the database server instance 49 * represented by this runtime). 50 * 51 * @param url the database URL 52 * 53 * @return true if the runtime accepts this database URL; false otherwise. 54 */ 55 boolean acceptsDatabaseURL(String url); 56 57 /** 58 * Returns the state (running/not running) of the represented database server 59 * instance. 60 * 61 * @return true if the database server instance is running; false otherwise. 62 */ 63 boolean isRunning(); 64 65 /** 66 * Returns whether the database server instance can be started by a call to the 67 * {@link #start} method. 68 * 69 * @return true if the database server instance can be started; false 70 * otherwise. 71 */ 72 public boolean canStart(); 73 74 /** 75 * Starts the database server instance represented by this runtime. 76 */ 77 void start(); 78 79 /** 80 * Stops the database server instance represented by this runtime. 81 */ 82 void stop(); 83 } 84