001: package net.sourceforge.squirrel_sql.fw.sql;
002:
003: /*
004: * Copyright (C) 2001-2003 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: import java.beans.PropertyChangeListener;
022:
023: import net.sourceforge.squirrel_sql.fw.id.IHasIdentifier;
024: import net.sourceforge.squirrel_sql.fw.id.IIdentifier;
025: import net.sourceforge.squirrel_sql.fw.persist.IValidatable;
026: import net.sourceforge.squirrel_sql.fw.persist.ValidationException;
027:
028: /**
029: * This represents a Database alias which is a description of the means
030: * required to connect to a JDBC complient database.
031: *
032: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
033: */
034: public interface ISQLAlias extends IHasIdentifier, IValidatable {
035: /**
036: * JavaBean property names for this class.
037: */
038: public interface IPropertyNames {
039: String AUTO_LOGON = "autoLogon";
040: String CONNECT_AT_STARTUP = "connectAtStartup";
041: String DRIVER = "driverIdentifier";
042: String DRIVER_PROPERTIES = "driverProperties";
043: String ID = "identifier";
044: String NAME = "name";
045: String PASSWORD = "password";
046: String URL = "url";
047: String USE_DRIVER_PROPERTIES = "useDriverProperties";
048: String USER_NAME = "userName";
049: String SCHEMA_PROPERTIES = "schemaProperties";
050: }
051:
052: /**
053: * Compare this <TT>ISQLAlias</TT> to another object. If the passed object
054: * is a <TT>ISQLAlias</TT>, then the <TT>getName()</TT> functions of the two
055: * <TT>ISQLAlias</TT> objects are used to compare them. Otherwise, it throws
056: * a ClassCastException (as <TT>ISQLAlias</TT> objects are comparable only
057: * to other <TT>ISQLAlias</TT> objects).
058: */
059: int compareTo(Object rhs);
060:
061: String getName();
062:
063: void setName(String name) throws ValidationException;
064:
065: IIdentifier getDriverIdentifier();
066:
067: void setDriverIdentifier(IIdentifier data)
068: throws ValidationException;
069:
070: String getUrl();
071:
072: void setUrl(String url) throws ValidationException;
073:
074: String getUserName();
075:
076: void setUserName(String userName) throws ValidationException;
077:
078: /**
079: * Retrieve the saved password.
080: *
081: * @return The saved password.
082: */
083: String getPassword();
084:
085: /**
086: * Set the password for this alias.
087: *
088: * @param password The new password.
089: *
090: * @throws ValidationException
091: * TODO: What conditions?
092: */
093: void setPassword(String password) throws ValidationException;
094:
095: /**
096: * Should this alias be logged on automatically.
097: *
098: * @return <TT>true</TT> if this alias should be logged on automatically
099: * else <TT>false</TT>.
100: */
101: boolean isAutoLogon();
102:
103: /**
104: * Set whether this alias should be logged on automatically.
105: *
106: * @param value <TT>true</TT> if alias should be autologged on
107: * else <TT>false</TT>.
108: */
109: void setAutoLogon(boolean value);
110:
111: /**
112: * Should this alias be connected when the application is started up.
113: *
114: * @return <TT>true</TT> if this alias should be connected when the
115: * application is started up.
116: */
117: boolean isConnectAtStartup();
118:
119: /**
120: * Set whether alias should be connected when the application is started up.
121: *
122: * @param value <TT>true</TT> if alias should be connected when the
123: * application is started up.
124: */
125: void setConnectAtStartup(boolean value);
126:
127: boolean getUseDriverProperties();
128:
129: void setUseDriverProperties(boolean value);
130:
131: SQLDriverPropertyCollection getDriverPropertiesClone();
132:
133: void setDriverProperties(SQLDriverPropertyCollection value);
134:
135: void addPropertyChangeListener(PropertyChangeListener listener);
136:
137: void removePropertyChangeListener(PropertyChangeListener listener);
138: }
|