isql-alpha Mailing List for iSQL-Viewer (Page 2)
Brought to you by:
mkobold
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
(8) |
Apr
(5) |
May
(4) |
Jun
(9) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
(14) |
Apr
(9) |
May
(7) |
Jun
(22) |
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <mk...@us...> - 2007-06-03 16:25:16
|
Revision: 61 http://svn.sourceforge.net/isql/?rev=61&view=rev Author: mkobold Date: 2007-06-03 09:25:18 -0700 (Sun, 03 Jun 2007) Log Message: ----------- * Added small UI fix for 1.6 JRE Modified Paths: -------------- isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java Modified: isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java 2007-05-24 03:01:00 UTC (rev 60) +++ isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java 2007-06-03 16:25:18 UTC (rev 61) @@ -82,18 +82,22 @@ case WindowEvent.WINDOW_OPENED : retrieveWindowPrefs(WINDOW_ID, this); defaultView.initializeView(); + String jre = System.getProperty("java.specification.version"); + if ("1.5".equals(jre)) { + validateTree(); + } break; case WindowEvent.WINDOW_CLOSING : storeWindowPrefs(WINDOW_ID, this); defaultView.disposeView(applicationPreferences); + try { + applicationPreferences.sync(); + } catch (BackingStoreException error) { + error.printStackTrace(System.err); + } break; } super.processWindowEvent(e); - try { - applicationPreferences.sync(); - } catch (BackingStoreException error) { - error.printStackTrace(System.err); - } } private synchronized void initializeUI() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-05-24 03:00:58
|
Revision: 60 http://svn.sourceforge.net/isql/?rev=60&view=rev Author: mkobold Date: 2007-05-23 20:01:00 -0700 (Wed, 23 May 2007) Log Message: ----------- * Corrected some issues with the query executor. * updated and corrected the code license. Modified Paths: -------------- isql-core/trunk/build.xml isql-core/trunk/src/org/isqlviewer/BindVariable.java isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java isql-core/trunk/src/org/isqlviewer/ServiceReference.java isql-core/trunk/src/org/isqlviewer/UserOptions.java isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkFolder.java isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java isql-core/trunk/src/org/isqlviewer/bookmarks/ColorLabel.java isql-core/trunk/src/org/isqlviewer/event/DatabaseEvent.java isql-core/trunk/src/org/isqlviewer/event/DatabaseListener.java isql-core/trunk/src/org/isqlviewer/event/EventDispatcher.java isql-core/trunk/src/org/isqlviewer/event/EventProxyDelegate.java isql-core/trunk/src/org/isqlviewer/event/ProgressEvent.java isql-core/trunk/src/org/isqlviewer/event/ProgressListener.java isql-core/trunk/src/org/isqlviewer/history/CommandType.java isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java isql-core/trunk/src/org/isqlviewer/sql/CallableStatementWrapper.java isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java isql-core/trunk/src/org/isqlviewer/sql/DatabaseMetadataWrapper.java isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java isql-core/trunk/src/org/isqlviewer/sql/PlatformRegistrar.java isql-core/trunk/src/org/isqlviewer/sql/PreparedStatementWrapper.java isql-core/trunk/src/org/isqlviewer/sql/RegistrarFactory.java isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java isql-core/trunk/src/org/isqlviewer/sql/ResultSetWrapper.java isql-core/trunk/src/org/isqlviewer/sql/ServiceType.java isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java isql-core/trunk/src/org/isqlviewer/sql/embedded/CompatabilityKit.java isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java isql-core/trunk/src/org/isqlviewer/sql/embedded/Procedures.java isql-core/trunk/src/org/isqlviewer/sql/platform/OracleRegistrar.java isql-core/trunk/src/org/isqlviewer/sql/processor/AbstractProcessor.java isql-core/trunk/src/org/isqlviewer/sql/processor/SqlProcessor.java isql-core/trunk/src/org/isqlviewer/sql/processor/TextSymbol.java isql-core/trunk/src/org/isqlviewer/sql/processor/Token.java isql-core/trunk/src/org/isqlviewer/sql/processor/TokenType.java isql-core/trunk/src/org/isqlviewer/util/Assertions.java isql-core/trunk/src/org/isqlviewer/util/AsynchronousBookmarkSaver.java isql-core/trunk/src/org/isqlviewer/util/BasicUtilities.java isql-core/trunk/src/org/isqlviewer/util/IsqlToolkit.java isql-core/trunk/src/org/isqlviewer/util/LocalMessages.java isql-core/trunk/src/org/isqlviewer/util/Log4jOutputStream.java isql-core/trunk/src/org/isqlviewer/util/LoggableObject.java isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java isql-core/trunk/src/org/isqlviewer/util/StringTokenizer.java isql-core/trunk/src/org/isqlviewer/util/StringUtilities.java isql-core/trunk/src/org/isqlviewer/util/UserProperties.java isql-core/trunk/src/org/isqlviewer/xml/BookmarkDigester.java isql-core/trunk/src/org/isqlviewer/xml/SaxResolver.java isql-core/trunk/src/org/isqlviewer/xml/ServiceDigester.java Modified: isql-core/trunk/build.xml =================================================================== --- isql-core/trunk/build.xml 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/build.xml 2007-05-24 03:01:00 UTC (rev 60) @@ -1,30 +1,26 @@ <?xml version="1.0"?> <!-- -Copyright 2000-2005 by Mark A. Kobold - -The contents of this file are subject to the Mozilla Public License Version - 1.1 (the "License"); you may not use this file except in compliance with the -License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -the specific language governing rights and limitations under the License. - +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. -The Initial Developer of the Original Code is Markus A. Kobold. +The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. +Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. -Portions created by Mark A. Kobold are Copyright (C) -2000-2005 Mark A. Kobold. All Rights Reserved. - Contributor(s): - Mark A. Kobold <mk...@is...>. - -Contributor(s): all the names of the contributors are added in the source -code where applicable. - + Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + If you didn't download this code from the following link, you should check -if you aren't using an obsolete version: http://isql.sourceforge.net/ +if you aren't using an obsolete version: http://www.isqlviewer.com + ===================================================================== Prerequisites: Requires JDK 1.5.0+ Modified: isql-core/trunk/src/org/isqlviewer/BindVariable.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/BindVariable.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/BindVariable.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer; Modified: isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer; Modified: isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer; Modified: isql-core/trunk/src/org/isqlviewer/ServiceReference.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/ServiceReference.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/ServiceReference.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer; @@ -182,21 +177,19 @@ this.lastUsed = lastUsed; } - /** * @return the createdOn */ public Date getCreatedOn() { - + return createdOn; } - /** * @param createdOn the createdOn to set */ public void setCreatedOn(Date createdOn) { - + this.createdOn = createdOn; } } \ No newline at end of file Modified: isql-core/trunk/src/org/isqlviewer/UserOptions.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/UserOptions.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/UserOptions.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer; Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.bookmarks; Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkFolder.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkFolder.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkFolder.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.bookmarks; Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.bookmarks; Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/ColorLabel.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/ColorLabel.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/ColorLabel.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.bookmarks; Modified: isql-core/trunk/src/org/isqlviewer/event/DatabaseEvent.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/DatabaseEvent.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/DatabaseEvent.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/event/DatabaseListener.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/DatabaseListener.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/DatabaseListener.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/event/EventDispatcher.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/EventDispatcher.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/EventDispatcher.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/event/EventProxyDelegate.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/EventProxyDelegate.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/EventProxyDelegate.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/event/ProgressEvent.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/ProgressEvent.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/ProgressEvent.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/event/ProgressListener.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/event/ProgressListener.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/event/ProgressListener.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.event; Modified: isql-core/trunk/src/org/isqlviewer/history/CommandType.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/history/CommandType.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/history/CommandType.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.history; Modified: isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.history; Modified: isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/src/org/isqlviewer/sql/CallableStatementWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/CallableStatementWrapper.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/CallableStatementWrapper.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/src/org/isqlviewer/sql/DatabaseMetadataWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/DatabaseMetadataWrapper.java 2007-05-24 02:47:37 UTC (rev 59) +++ isql-core/trunk/src/org/isqlviewer/sql/DatabaseMetadataWrapper.java 2007-05-24 03:01:00 UTC (rev 60) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.sql; Modified: isql-core/trunk/... [truncated message content] |
From: <mk...@us...> - 2007-05-24 02:47:37
|
Revision: 59 http://svn.sourceforge.net/isql/?rev=59&view=rev Author: mkobold Date: 2007-05-23 19:47:37 -0700 (Wed, 23 May 2007) Log Message: ----------- * Added application icon * Corrected some preferences issues and added some more for the main JDBC workbench. * Added large application icon for frame icon. * Fixed an issue with DnD bookmarks. * Fixed login dialog layout on windows. * updated and corrected the code license. * Addressed bug in schema node rendering as result sets. Modified Paths: -------------- isql-swing/trunk/build.xml isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/JdbcSchemaTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java isql-swing/trunk/src/org/isqlviewer/swing/AbstractTreeModel.java isql-swing/trunk/src/org/isqlviewer/swing/CompoundIcon.java isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java isql-swing/trunk/src/org/isqlviewer/swing/ExtensionFileFilter.java isql-swing/trunk/src/org/isqlviewer/swing/JTextPopup.java isql-swing/trunk/src/org/isqlviewer/swing/LoginDialog.java isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java isql-swing/trunk/src/org/isqlviewer/swing/WizardPanel.java isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/EventTask.java isql-swing/trunk/src/org/isqlviewer/swing/action/OverwriteToggleAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/RunnableEventTask.java isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java isql-swing/trunk/src/org/isqlviewer/swing/action/SwingEventManager.java isql-swing/trunk/src/org/isqlviewer/swing/outline/AbstractCellEditor.java isql-swing/trunk/src/org/isqlviewer/swing/outline/AbstractTreeTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/outline/JOutline.java isql-swing/trunk/src/org/isqlviewer/swing/outline/MergeSort.java isql-swing/trunk/src/org/isqlviewer/swing/outline/OutlineModel.java isql-swing/trunk/src/org/isqlviewer/swing/outline/TreeTableModelAdapter.java isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/table/PropertyTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/table/ResultSetTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/table/RowComparator.java isql-swing/trunk/src/org/isqlviewer/swing/table/Sortable.java isql-swing/trunk/src/org/isqlviewer/swing/table/UndoableTableModelEdit.java isql-swing/trunk/src/org/isqlviewer/swing/text/SyntaxHighlighter.java isql-swing/trunk/src/org/isqlviewer/swing/text/SyntaxStylizer.java isql-swing/trunk/src/org/isqlviewer/ui/AbstractApplicationView.java isql-swing/trunk/src/org/isqlviewer/ui/AbstractObjectEditor.java isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java isql-swing/trunk/src/org/isqlviewer/ui/ApplicationView.java isql-swing/trunk/src/org/isqlviewer/ui/BookmarkEditor.java isql-swing/trunk/src/org/isqlviewer/ui/ConnectionProfileEditor.java isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java isql-swing/trunk/src/org/isqlviewer/ui/JdbcSchemaTreeRefreshable.java isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java isql-swing/trunk/src/org/isqlviewer/ui/OperationStatus.java isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandEditor.java isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandMouseAdapter.java isql-swing/trunk/src/org/isqlviewer/ui/SwingLauncher.java isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/ThrowableView.java isql-swing/trunk/src/org/isqlviewer/ui/VariableSubstitutor.java isql-swing/trunk/src/org/isqlviewer/ui/WizardRunner.java isql-swing/trunk/src/org/isqlviewer/ui/WorkbenchView.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/BookmarkTreeDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/ResultSetRendererDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/SchemaNodeRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/TabbedPaneDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/TextComponentDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/laf/ColorLedIcon.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedBooleanCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedDateCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedDecimalCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedListCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedNumberCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedTableCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedTreeUI.java isql-swing/trunk/src/org/isqlviewer/ui/laf/NullIcon.java isql-swing/trunk/src/org/isqlviewer/ui/laf/SortableHeaderRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/BookmarkMouseInputListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/BookmarkTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/HistoryTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/SchemaTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/SchemaTreeListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/ThrowableTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/BookmarkTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/ClassListCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/FileListCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTableCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/JDBCTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/ThrowableTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/AbstractWizardStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/Step.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/Wizard.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/WizardContext.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfigureBasicServiceOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfigureServiceResources.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmDeleteService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmNewService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmUpdateService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/DriverPropertyOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceFunctionStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ServiceProfileOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ServiceWizard.java Added Paths: ----------- isql-swing/trunk/src/org/isqlviewer/resource/icons/x128/ isql-swing/trunk/src/org/isqlviewer/resource/icons/x128/application.png Modified: isql-swing/trunk/build.xml =================================================================== --- isql-swing/trunk/build.xml 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/build.xml 2007-05-24 02:47:37 UTC (rev 59) @@ -1,30 +1,26 @@ <?xml version="1.0"?> <!-- -Copyright 2000-2005 by Mark A. Kobold - -The contents of this file are subject to the Mozilla Public License Version - 1.1 (the "License"); you may not use this file except in compliance with the -License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -the specific language governing rights and limitations under the License. - +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. -The Initial Developer of the Original Code is Markus A. Kobold. +The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. +Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. -Portions created by Mark A. Kobold are Copyright (C) -2000-2005 Mark A. Kobold. All Rights Reserved. - Contributor(s): - Mark A. Kobold <mk...@is...>. - -Contributor(s): all the names of the contributors are added in the source -code where applicable. - + Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + If you didn't download this code from the following link, you should check -if you aren't using an obsolete version: http://isql.sourceforge.net/ +if you aren't using an obsolete version: http://www.isqlviewer.com + ===================================================================== Prerequisites: Requires JDK 1.5.0+ Modified: isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Modified: isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Modified: isql-swing/trunk/src/org/isqlviewer/model/JdbcSchemaTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/JdbcSchemaTreeModel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/JdbcSchemaTreeModel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Modified: isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Modified: isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Modified: isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.model; Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x128/application.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x128/application.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: isql-swing/trunk/src/org/isqlviewer/swing/AbstractTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/AbstractTreeModel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/AbstractTreeModel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/CompoundIcon.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/CompoundIcon.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/CompoundIcon.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; @@ -33,10 +28,10 @@ import javax.swing.Icon; /** - * TODO Add CompoundIcon Object overview JavaDoc information. + * Simple Icon implementation of using two existing icons as one side by side. * <p> * - * @author TODO Add author information for CompoundIcon + * @author Mark A. Kobold * @version 1.0 */ public class CompoundIcon implements Icon { Modified: isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; @@ -50,7 +45,7 @@ import org.isqlviewer.ui.dnd.TabbedPaneDropTarget; /** - * TODO Add ITabbedPane Object overview JavaDoc information. + * Enhanced tabbed pane with new input events and lockable and closable tabs. * <p> * * @author Mark A. Kobold Modified: isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; @@ -84,7 +79,7 @@ * TODO Add EnhancedTable Object overview JavaDoc information. * <p> * - * @author TODO Add author information for EnhancedTable + * @author Mark A. Kobold * @version 1.0 */ public class EnhancedTable extends JTable { Modified: isql-swing/trunk/src/org/isqlviewer/swing/ExtensionFileFilter.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/ExtensionFileFilter.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/ExtensionFileFilter.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/JTextPopup.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/JTextPopup.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/JTextPopup.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/LoginDialog.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/LoginDialog.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/LoginDialog.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,39 +1,33 @@ /* - * Copyright 2002 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ * - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the License. - * - * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * Portions created by Mark A. Kobold are - * Copyright (C) Copyright (C) 2000 Mark A. Kobold. All Rights Reserved. - * Contributor(s): Mark A. Kobold <mk...@sp...>. + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. * - * Contributor(s): all the names of the contributors are added in the source code - * where applicable. + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. * - * If you didn't download this code from the following link, you should check if - * you aren't using an obsolete version: - * http://isql.sourceforge.net/ + * Contributor(s): + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; -import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -73,7 +67,7 @@ public LoginDialog(Frame frameParent) { super(frameParent, messages.getMessage("logindialog.title"), true); - initUI(); + initializeUI(); } public String[] getAuthTokens() { @@ -100,24 +94,17 @@ @Override protected void processWindowEvent(WindowEvent e) { - super.processWindowEvent(e); switch (e.getID()) { case WindowEvent.WINDOW_OPENED : principal.requestFocus(); principal.setText(System.getProperty("user.name")); - validateTree(); - pack(); - if (SwingUtilities.isMacOS()) { - // I have no idea why i have to do this on Mac OS X ??? // - Dimension ps = getPreferredSize(); - setSize(new Dimension(ps.width + 20, ps.height + 20)); - } setLocationRelativeTo(getOwner()); break; } + super.processWindowEvent(e); } - private void initUI() { + private void initializeUI() { Component component = null; Object constraint = null; @@ -142,38 +129,52 @@ constraint = constrain(1, 1, 1, 1, 1.0d, 1.0d, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL); contentPanel.add(component, constraint); - JComponent commandPanel = new JPanel(new GridLayout(1, 3)); + component = Box.createVerticalStrut(10); + constraint = constrain(0, 2, 2, 1, 0.0d, 0.0d, GridBagConstraints.WEST, GridBagConstraints.NONE); + contentPanel.add(component, constraint); + + JComponent commandPanel = new JPanel(new GridBagLayout()); JButton actionButton = null; - commandPanel.add(Box.createHorizontalGlue()); + constraint = constrain(0, 0, 1, 1, 1.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); + commandPanel.add(Box.createHorizontalStrut(10), constraint); + + constraint = constrain(1, 0, 1, 1, 1.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); + commandPanel.add(Box.createHorizontalGlue(), constraint); + actionButton = okButton; actionButton.addActionListener(this); actionButton.setActionCommand(Integer.toString(0)); actionButton.setToolTipText(messages.getMessage("logindialog.okbutton.tip")); - commandPanel.add(actionButton); + constraint = constrain(2, 0, 1, 1, 0.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.NONE); + commandPanel.add(actionButton, constraint); actionButton = cancelButton; actionButton.addActionListener(this); actionButton.setActionCommand(Integer.toString(1)); actionButton.setToolTipText(messages.getMessage("logindialog.cancelbutton.tip")); - commandPanel.add(actionButton); + constraint = constrain(3, 0, 1, 1, 0.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.NONE); + commandPanel.add(actionButton, constraint); - getRootPane().setDefaultButton(cancelButton); + constraint = constrain(4, 0, 1, 1, 0.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); + commandPanel.add(Box.createHorizontalStrut(10), constraint); + + constraint = constrain(0, 1, 5, 1, 0.0d, 0.0d, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); + commandPanel.add(Box.createVerticalStrut(10), constraint); + + getRootPane().setDefaultButton(okButton); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - Container container = getContentPane(); + Container container = new JPanel(new BorderLayout()); container.add(contentPanel, BorderLayout.CENTER); container.add(commandPanel, BorderLayout.SOUTH); + container.add(Box.createVerticalStrut(10), BorderLayout.NORTH); + container.add(Box.createHorizontalStrut(10), BorderLayout.WEST); + container.add(Box.createHorizontalStrut(10), BorderLayout.EAST); - JPanel realRoot = new JPanel(new WizardPanel.Layout()); - realRoot.add(container); - realRoot.validate(); - setContentPane(realRoot); - + setContentPane(container); setResizable(false); - - principal.addActionListener(this); - credentials.addActionListener(this); + pack(); } private static GridBagConstraints constrain(int x, int y, int w, int h, double wx, double wy, int a, int f) { Modified: isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; @@ -59,10 +54,10 @@ import org.isqlviewer.ui.laf.NullIcon; /** - * TODO Add SwingUtilities Object overview JavaDoc information. + * Customized swing utilities for iSQL-Viewer. * <p> * - * @author TODO Add author information for SwingUtilities + * @author Mark A. Kobold * @version 1.0 */ public final class SwingUtilities { Modified: isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/WizardPanel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/WizardPanel.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/WizardPanel.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.swing; Modified: isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java 2007-05-24 02:43:44 UTC (rev 58) +++ isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java 2007-05-24 02:47:37 UTC (rev 59) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of ... [truncated message content] |
From: <mk...@us...> - 2007-05-24 02:43:45
|
Revision: 58 http://svn.sourceforge.net/isql/?rev=58&view=rev Author: mkobold Date: 2007-05-23 19:43:44 -0700 (Wed, 23 May 2007) Log Message: ----------- * Added build.xml * Updated code and corrected the code license Modified Paths: -------------- isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java Added Paths: ----------- isql-mrj/trunk/build.xml Property Changed: ---------------- isql-mrj/trunk/ Property changes on: isql-mrj/trunk ___________________________________________________________________ Name: svn:ignore - bin + bin classes Added: isql-mrj/trunk/build.xml =================================================================== --- isql-mrj/trunk/build.xml (rev 0) +++ isql-mrj/trunk/build.xml 2007-05-24 02:43:44 UTC (rev 58) @@ -0,0 +1,195 @@ +<?xml version="1.0"?> +<!-- +Copyright 2000-2005 by Mark A. Kobold + +The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +the specific language governing rights and limitations under the License. + +The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + +The Initial Developer of the Original Code is Markus A. Kobold. + +Portions created by Mark A. Kobold are Copyright (C) +2000-2005 Mark A. Kobold. All Rights Reserved. + +Contributor(s): + Mark A. Kobold <mk...@is...>. + +Contributor(s): all the names of the contributors are added in the source +code where applicable. + +If you didn't download this code from the following link, you should check +if you aren't using an obsolete version: http://isql.sourceforge.net/ +===================================================================== +Prerequisites: + Requires JDK 1.5.0+ + jakarta-ant 1.6.2+ from http://jakarta.apache.org . + +Build Instructions: + To build, run java org.apache.tools.ant.Main <target> + on the directory where this file is located with the target you want. + +Most useful targets: + - all *default* -> cleans, compiles, packages, and copies the jar file + - compile -> compile classes package in "./${bin.dir}/classes" + - jar -> jar the classes to "${build.lib}/${name}.jar" + - javadocs -> creates the javadocs in "./${bin.dir}/javadocs" + - dist -> creates the complete binary distribution + +====================================================================== --> +<project name="isql-mrj" default="all"> + <description>Build script for the iSQL-Viewer MRJ Launcher for Mac OS X.</description> + <property name="project.name" value="isql-mrj" /> + <property name="build.debug" value="yes" /> + <property name="junit.src.dir" value="${basedir}/test" /> + <property name="junit.reports" value="${basedir}/reports" /> + + <property name="src.dir" value="${basedir}/src" /> + <property name="bin.dir" value="${basedir}/classes" /> + <property name="doc.dir" value="${basedir}/doc" /> + <property name="lib.dir" value="${basedir}/lib" /> + <property name="deploy.dir" value="${user.home}" /> + + <patternset id="text.files"> + <include name="**/*.txt" /> + </patternset> + + <patternset id="java.image.types"> + <include name="**/*.png" /> + </patternset> + + <patternset id="resource.files"> + <include name="**/*.properties" /> + <include name="**/*.html" /> + <include name="**/*.htm" /> + <include name="**/*.sql" /> + </patternset> + + <path id="build.classpath"> + <pathelement location="${basedir}/../isql-core/lib/log4j.jar" /> + <pathelement location="${basedir}/../isql-core/classes" /> + <pathelement location="${basedir}/../isql-swing/classes" /> + </path> + + <path id="junit.classpath"> + <pathelement location="${junit.home}/junit.jar" /> + <pathelement location="${basedir}/../isql-core/lib/log4j.jar" /> + <pathelement location="${basedir}/../isql-core/classes" /> + <pathelement location="${basedir}/../isql-swing/classes" /> + <pathelement location="${bin.dir}" /> + </path> + + <target name="all" depends="deploy" /> + + <target name="deploy" depends="package"> + <copy file="${basedir}/${project.name}.jar" toDir="${deploy.dir}" /> + <copy file="${basedir}/${project.name}-src.zip" toDir="${deploy.dir}" /> + </target> + + <!-- =================================================================== --> + <!-- removes previous class files and distribution jar --> + <!-- =================================================================== --> + <target name="clean"> + <delete dir="${bin.dir}" failonerror="false" /> + <delete file="${basedir}/${project.name}.jar" failonerror="false" /> + <mkdir dir="${bin.dir}" /> + </target> + + <!-- =================================================================== --> + <!-- Compiles the source directory, and copies all resources --> + <!-- =================================================================== --> + <target name="compile" depends="clean"> + <javac source="1.5" srcdir="${src.dir}" destdir="${bin.dir}" debug="${build.debug}" classpathref="build.classpath" /> + <copy todir="${bin.dir}/org/isqlviewer"> + <fileset dir="${basedir}/src/org/isqlviewer"> + <patternset refid="resource.files" /> + </fileset> + </copy> + <antcall inheritrefs="true" target="compile-tests" /> + </target> + + <!-- =================================================================== --> + <!-- Creates the API documentation --> + <!-- =================================================================== --> + <target name="javadocs" depends="clean, compile"> + <delete dir="${doc.dir}" /> + <mkdir dir="${doc.dir}" /> + <javadoc access="protected" author="true" classpath="${lib.dir}/log4j.jar" destdir="doc" doctitle="${project.name} - ${project.version} Java Documentation" nodeprecated="false" nodeprecatedlist="false" splitindex="true" use="true" version="true"> + <group title="iSQL-Viewer Core Library" packages="org.isqlviewer.*" /> + <packageset dir="src" defaultexcludes="yes"> + <include name="org/isqlviewer/**" /> + <include name="org/isqlviewer/bookmarks/**" /> + <include name="org/isqlviewer/event/**" /> + <include name="org/isqlviewer/history/**" /> + <include name="org/isqlviewer/sql/**" /> + <include name="org/isqlviewer/sql/embedded/**" /> + <include name="org/isqlviewer/sql/platform/**" /> + <include name="org/isqlviewer/util/**" /> + <include name="org/isqlviewer/xml/**" /> + </packageset> + <link href="http://java.sun.com/j2se/1.5.0/docs/api/" /> + </javadoc> + </target> + + <!-- =================================================================== --> + <!-- Create Java Application archive --> + <!-- =================================================================== --> + <target name="package" depends="compile"> + <jar jarfile="${basedir}/${project.name}.jar" basedir="${bin.dir}"> + <manifest> + <attribute name="Built-By" value="${user.name}" /> + <attribute name="Main-Class" value="${app.main.class}" /> + <attribute name="Project-Version" value="${project.version}" /> + </manifest> + </jar> + <zip zipfile="${basedir}/${project.name}-src.zip" basedir="${src.dir}" /> + </target> + + <target name="compile-tests" if="junit.compile"> + <javac source="1.5" srcdir="${junit.src.dir}" destdir="${bin.dir}" debug="${build.debug}" classpathref="build.classpath" /> + <antcall target="perform-tests" /> + </target> + + <target name="perform-tests" if="junit.execute"> + <echo>Performing JUnit Tests</echo> + <junit fork="yes" printsummary="true" haltonfailure="false" failureproperty="junit.failed"> + <batchtest fork="yes" todir="${junit.reports}"> + <fileset dir="${bin.dir}"> + <include name="**/Test*.class" /> + <exclude name="**/*Test*$$*" /> + </fileset> + </batchtest> + <formatter type="xml" /> + <classpath refid="junit.classpath" /> + </junit> + <antcall inheritrefs="true" target="compile-test-reports" /> + </target> + + <target name="compile-test-reports" if="junit.build.report"> + <echo>Compiling JUnit reports to '${junit.reports}'</echo> + <junitreport todir="${junit.reports}"> + <fileset dir="${junit.reports}"> + <include name="TEST-*.xml" /> + </fileset> + <report todir="${junit.reports}" /> + </junitreport> + <delete> + <fileset dir="${junit.reports}"> + <include name="*.xml" /> + </fileset> + </delete> + </target> + + <target name="eclipse-setup"> + <echo>Copying XML DTD's</echo> + <mkdir dir="${basedir}/bin/org/isqlviewer/resource/xml" /> + <copy file="${basedir}/support/xml/bookmarks.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> + <copy file="${basedir}/support/xml/service_2_x.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> + <copy file="${basedir}/support/xml/service_3_x.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> + </target> +</project> \ No newline at end of file Modified: isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java 2007-05-17 02:13:24 UTC (rev 57) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java 2007-05-24 02:43:44 UTC (rev 58) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.mrj; Modified: isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java 2007-05-17 02:13:24 UTC (rev 57) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java 2007-05-24 02:43:44 UTC (rev 58) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.mrj; Modified: isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java 2007-05-17 02:13:24 UTC (rev 57) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java 2007-05-24 02:43:44 UTC (rev 58) @@ -1,29 +1,24 @@ /* - * Copyright 2000-2005 by Mark A. Kobold + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ + * if you aren't using an obsolete version: http://www.isqlviewer.com */ package org.isqlviewer.mrj; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-05-17 02:13:31
|
Revision: 57 http://svn.sourceforge.net/isql/?rev=57&view=rev Author: mkobold Date: 2007-05-16 19:13:24 -0700 (Wed, 16 May 2007) Log Message: ----------- * Added busy icon of spinning arrows in favor of indeterminate progess bars; i dunno windows and the whole knight rider look and the hoff's trouble meh; just coincidence. * Updated shared action constants correct a couple duplicates. * Added hook for accessing the event manager for the Mac OS X Launcher * Added support for querying database meta-data invokes prompt to connect somewhere; should probably do that on refresh as well? * Cleaned up the result rendering code, still has a bit of an issue when a 'batch' query is executed. * Added some missing class files that should have been added awhile ago (sorry). Modified Paths: -------------- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java Added Paths: ----------- isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/busy_animation.png isql-swing/trunk/src/org/isqlviewer/ui/dnd/TabbedPaneDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/laf/NullIcon.java Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/busy_animation.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/busy_animation.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-05-17 02:13:24 UTC (rev 57) @@ -186,16 +186,17 @@ public String getSelectedToolTip() { int tab = getSelectedIndex(); - if (tab >= 0) + if (tab >= 0) { return getToolTipTextAt(tab); - + } return null; } public void setMaxTabCount(int newMax) { - if (newMax < 1) + if (newMax < 1) { throw new IllegalArgumentException(Integer.toString(newMax)); + } if (newMax >= maxtabcount) { maxtabcount = newMax; } else { @@ -209,8 +210,9 @@ public void removeSelectedTab() { int tab = getSelectedIndex(); - if (tab >= 0) + if (tab >= 0) { removeTabAt(tab); + } } public void lockSelectedTab() { Modified: isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java 2007-05-17 02:13:24 UTC (rev 57) @@ -384,7 +384,6 @@ } } - @SuppressWarnings("unchecked") private void setLazyValue(Hashtable h, Class c, String s) { h.put(c, new UIDefaults.ProxyLazyValue(s)); Modified: isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java 2007-05-17 02:13:24 UTC (rev 57) @@ -27,7 +27,6 @@ */ package org.isqlviewer.swing.action; - /** * @author Mark A. Kobold <mkobold at isqlviewer dot com> * @version 1.0 @@ -36,33 +35,33 @@ public static final int ADD_BOOKMARK_FOLDER = 0; public static final int CATALOG_CHANGED = 1; - public static final int CLEAR_ALL_HISTORY = 24; - public static final int CLOSE_ALL_RESULTS = 2; - public static final int CLOSE_SELECTED_RESULTS = 3; - public static final int CONVERT_HISTORY_TO_BOOKMARK = 4; - public static final int CONVERT_TEXT_TO_BOOKMARK = 5; - public static final int CREATE_NEW_BOOKMARK = 6; - public static final int DELETE_BOOKMARK_SELECTION = 7; - public static final int EDIT_BOOKMARK = 8; - public static final int EXECUTE_SQL_COMMAND = 9; - public static final int EXIT_APPLICATION = 10; - public static final int NAVIGATE_RIGHT_TAB = 11; - public static final int NAVIGATE_LEFT_TAB = 12; - public static final int OVERWRITE_TOGGLE = 13; - public static final int REFRESH_SELECTED_RESULTS = 14; - public static final int REFRESH_SELECTED_VIEW = 15; - public static final int SCHEMA_CHANGED = 16; - public static final int SERVICE_ADDED = 17; - public static final int SERVICE_CONNECT = 18; - public static final int SERVICE_DISCONNECT = 19; - public static final int SERVICE_REMOVED = 20; - public static final int SERVICE_UPDATED = 21; - public static final int SHOW_SERVICE_WIZARD = 22; + public static final int CLEAR_ALL_HISTORY = 2; + public static final int CLOSE_ALL_RESULTS = 3; + public static final int CLOSE_SELECTED_RESULTS = 4; + public static final int CONVERT_HISTORY_TO_BOOKMARK = 5; + public static final int CONVERT_TEXT_TO_BOOKMARK = 6; + public static final int CREATE_NEW_BOOKMARK = 7; + public static final int DELETE_BOOKMARK_SELECTION = 8; + public static final int EDIT_BOOKMARK = 9; + public static final int EXECUTE_SQL_COMMAND = 10; + public static final int EXIT_APPLICATION = 11; + public static final int NAVIGATE_RIGHT_TAB = 12; + public static final int NAVIGATE_LEFT_TAB = 13; + public static final int OVERWRITE_TOGGLE = 14; + public static final int REFRESH_SELECTED_RESULTS = 15; + public static final int REFRESH_SELECTED_VIEW = 16; + public static final int SCHEMA_CHANGED = 17; + public static final int SERVICE_ADDED = 18; + public static final int SERVICE_CONNECT = 19; + public static final int SERVICE_DISCONNECT = 20; + public static final int SERVICE_REMOVED = 21; + public static final int SERVICE_UPDATED = 22; public static final int SHOW_CONNECTION_INFO = 23; - public static final int SHOW_IMPORT_WIZARD = 24; - public static final int SHOW_EXPORT_WIZARD = 25; + public static final int SHOW_EXPORT_WIZARD = 24; + public static final int SHOW_IMPORT_WIZARD = 25; + public static final int SHOW_SERVICE_WIZARD = 26; private SharedActions() { } -} +} \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java 2007-05-17 02:13:24 UTC (rev 57) @@ -148,4 +148,10 @@ } return true; } + + + public SwingEventManager getSwingEventManager() { + + return swingEventManager; + } } \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java 2007-05-17 02:13:24 UTC (rev 57) @@ -98,9 +98,7 @@ public void doLayout(JComponent parentComponent, Preferences preferences, SwingEventManager eventManager) { - // TODO Auto-generated method stub - - table = new EnhancedTable(); // workbench.controller.getActionManager()); + table = new EnhancedTable(); // TODO table.setDropTarget(new DropTarget(table, workbench.bookmarkDropper)); table.setFont(table.getFont().deriveFont(10f)); // table.putClientProperty(EnhancedTable.CLIENT_JPOPUP_MENU, workbench.tablePopupMenu); Modified: isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java 2007-05-17 02:13:24 UTC (rev 57) @@ -69,6 +69,7 @@ import javax.swing.JEditorPane; import javax.swing.JMenu; import javax.swing.JMenuBar; +import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -183,10 +184,8 @@ public void actionPerformed(ActionEvent event) { int id = event.getID(); - int index = 0; switch (id) { case SharedActions.REFRESH_SELECTED_RESULTS : - break; case SharedActions.NAVIGATE_LEFT_TAB : navigateLeftTab(); @@ -232,34 +231,10 @@ showWizard(ServiceWizard.class); break; case SharedActions.SHOW_CONNECTION_INFO : - DataGrid dataGrid = new DataGrid(); - DatabaseMetaData metaData; - try { - metaData = currentService.getConnection().getMetaData(); - } catch (SQLException error) { - error("", error); - return; + if (checkConnection()) { + queryDatabaseMetadata(); } - JPanel view = new JPanel(); - dataGrid.doLayout(view, null, null); - Map<String, Object> metaDataMap = JdbcUtilities.extractMetadata(metaData); - EnhancedTableModel model = new EnhancedTableModel(new String[]{"Property", "Value"}); - Set<Map.Entry<String, Object>> entries = metaDataMap.entrySet(); - for (Map.Entry<String, Object> entry : entries) { - ArrayList<Object> row = new ArrayList<Object>(); - row.add(entry.getKey()); - row.add(entry.getValue()); - model.addRow(row); - } - dataGrid.setModel(model); - - EnhancedTabbedPane tabbedPane = tabRenderer.getTabbedPane(); - tabbedPane.addTab("ConnectionInfo", view); - index = tabbedPane.indexOfComponent(view); - tabbedPane.setClosableTab(index, true); - tabbedPane.setIconAt(index, SwingUtilities.loadIconResource("information", 16)); break; - case SharedActions.REFRESH_SELECTED_VIEW : Refreshable source = (Refreshable) event.getSource(); if (source != null) { @@ -294,15 +269,7 @@ break; case SharedActions.EXECUTE_SQL_COMMAND : String statement = event.getActionCommand(); - boolean connected = false; - try { - if (currentService == null || currentService.getConnection().isClosed()) { - connected = promptForService(); - } else { - connected = true; - } - } catch (SQLException ignored) { - } + boolean connected = checkConnection(); if (connected) { QueryExecutor executor = new QueryExecutor(currentService, tabRenderer, statement); executor.run(); @@ -327,18 +294,6 @@ } } - private void updateSyntaxHighlighting() { - - try { - String catalog = schemaModel.getCurrentCatlog(); - String schema = schemaModel.getCurrentSchema(); - commandEditor.updateServiceKeywords(currentService, catalog, schema); - - } catch (SQLException e) { - error("", e); - } - } - public void doLayout(JComponent parentComponent, Preferences preferences, SwingEventManager swingEventManager) { Preferences prefs = preferences.node("Views"); @@ -441,6 +396,7 @@ localizeTextComponent(console, undoManager); console.setEditable(false); + console.setDragEnabled(true); commandEditor.initializeView(); schemaMenu.setEnabled(false); @@ -756,9 +712,9 @@ dialog.setModal(true); dialog.setVisible(true); } catch (InstantiationException e) { - e.printStackTrace(); + debug("", e); } catch (IllegalAccessException e) { - e.printStackTrace(); + debug("", e); } finally { if (instance != null) { try { @@ -942,7 +898,7 @@ action = new CustomAction("show-meta-data", SharedActions.SHOW_CONNECTION_INFO, manager); action.putValue(Action.SHORT_DESCRIPTION, messages.format("jdbcworkbench.show_meta_data")); - action.putValue(CustomAction.ICON_NAME, "about"); + action.putValue(CustomAction.ICON_NAME, "information"); addButton(toolbar, manager, action); SchemaTreeListener listener = new SchemaTreeListener(schemaModel, tabRenderer, manager); @@ -1006,11 +962,13 @@ ca = new CustomAction("import-wizard", SharedActions.SHOW_IMPORT_WIZARD, manager); ca.putValue(Action.DEFAULT, messages.getMessage("menu.import_wizard.title")); ca.putValue(CustomAction.ICON_NAME, "import"); + ca.setEnabled(false); addMenuItem(menu, ca); ca = new CustomAction("export-wizard", SharedActions.SHOW_EXPORT_WIZARD, manager); ca.putValue(CustomAction.ICON_NAME, "export"); ca.putValue(Action.DEFAULT, messages.getMessage("menu.export_wizard.title")); + ca.setEnabled(false); addMenuItem(menu, ca); menu.addSeparator(); @@ -1178,6 +1136,14 @@ } } } + + if (schemaSelection.getButtonCount() == 0) { + JMenuItem disabledOption = new JMenuItem(); + disabledOption.setEnabled(false); + disabledOption.setText(messages.format("JdbcWorkbench.no_schemas")); + disabledOption.setIcon(SwingUtilities.loadIconResource("user", 16)); + schemaMenu.add(disabledOption); + } return preferredSchema; } @@ -1216,6 +1182,7 @@ rhsTabbedPane.addTab(txt, ico, componentView, tip); int index = rhsTabbedPane.indexOfComponent(componentView); rhsTabbedPane.setClosableTab(index, true); + rhsTabbedPane.setSelectedIndex(index); return componentView; } } finally { @@ -1246,6 +1213,7 @@ rhsTabbedPane.addTab(txt, ico, componentView, tip); int index = rhsTabbedPane.indexOfComponent(componentView); rhsTabbedPane.setClosableTab(index, true); + rhsTabbedPane.setSelectedIndex(index); return componentView; } } finally { @@ -1271,6 +1239,7 @@ lhsTabbedPane.addTab(txt, ico, componentView, tip); int index = lhsTabbedPane.indexOfComponent(componentView); lhsTabbedPane.setClosableTab(index, true); + lhsTabbedPane.setSelectedIndex(index); return componentView; } } finally { @@ -1485,6 +1454,13 @@ } } } + if (catalogSelection.getButtonCount() == 0) { + JMenuItem disabledOption = new JMenuItem(); + disabledOption.setEnabled(false); + disabledOption.setText(messages.format("JdbcWorkbench.no_catalogs")); + disabledOption.setIcon(SwingUtilities.loadIconResource("catalog", 16)); + catalogMenu.add(disabledOption); + } return preferredCatalog; } @@ -1535,6 +1511,60 @@ reloadQueryHistory(); } + private void queryDatabaseMetadata() { + + int index; + DataGrid dataGrid = new DataGrid(); + DatabaseMetaData metaData; + try { + metaData = currentService.getConnection().getMetaData(); + } catch (SQLException error) { + error("", error); + return; + } + JPanel view = new JPanel(); + dataGrid.doLayout(view, null, null); + Map<String, Object> metaDataMap = JdbcUtilities.extractMetadata(metaData); + EnhancedTableModel model = new EnhancedTableModel(new String[]{"Property", "Value"}); + Set<Map.Entry<String, Object>> entries = metaDataMap.entrySet(); + for (Map.Entry<String, Object> entry : entries) { + ArrayList<Object> row = new ArrayList<Object>(); + row.add(entry.getKey()); + row.add(entry.getValue()); + model.addRow(row); + } + dataGrid.setModel(model); + EnhancedTabbedPane tabbedPane = tabRenderer.getTabbedPane(); + tabbedPane.addTab(messages.format("JdbcWorkbench.database_metadata"), view); + index = tabbedPane.indexOfComponent(view); + tabbedPane.setClosableTab(index, true); + tabbedPane.setIconAt(index, SwingUtilities.loadIconResource("information", 16)); + } + + private boolean checkConnection() { + + try { + if (currentService == null || currentService.getConnection().isClosed()) { + return promptForService(); + } + return true; + } catch (SQLException ignored) { + debug("", ignored); + } + return false; + } + + private void updateSyntaxHighlighting() { + + try { + String catalog = schemaModel.getCurrentCatlog(); + String schema = schemaModel.getCurrentSchema(); + commandEditor.updateServiceKeywords(currentService, catalog, schema); + } catch (SQLException ignored) { + debug("", ignored); + } + } + private static class ToggleViewAction extends AbstractAction { private static final long serialVersionUID = -1587118235512663612L; Modified: isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties 2007-05-17 02:13:24 UTC (rev 57) @@ -91,6 +91,10 @@ jdbcworkbench.please_select_your_service=Please select the service to connect to jdbcworkbench.driver_information=Using JDBC Driver name:''{0}'' version:''{1}''. jdbcworkbench.database_information=Connected to database:''{0}'' version:''{1}''. +jdbcworkbench.show_meta_data=Show Database Metadata about this connection. +JdbcWorkbench.database_metadata=Database Metadata +JdbcWorkbench.no_catalogs=No Catalogs Available +JdbcWorkbench.no_schemas=No Schemas Available servicemanager.servicename.title=Service Name servicemanager.servicename.tip=Enter the name you wish to use indentifying this connection throughout iSQL-Viewer. @@ -138,4 +142,14 @@ VariableSubstitutor.okbutton.tip=Substitute the new value for this value. VariableSubstitutor.cancelbutton.tip=Do not substitute anything for this given variable. - +TabbedResultsetRenderer.finalize_statement=Finalizing statement:''{0}'' +TabbedResultsetRenderer.processing_generated_keys=Processing JDBC generated keys for statement:''{0}''. +TabbedResultsetRenderer.process_resultset=Extracting information from ResultSet for statement:''{0}''. +TabbedResultsetRenderer.resultset_warnings=Processing Resultset warnings from statement. +TabbedResultsetRenderer.statement_warnings=Processing Statement warnings from connection. +TabbedResultsetRenderer.row_updates={0} Row(s) where affected by the statement. +TabbedResultsetRenderer.statement_initalized=Statement:''{0}'' has been initialized. +TabbedResultsetRenderer.processing_variable_substitutions=Processing any query variable substitutions. +TabbedResultsetRenderer.cancel_button.text=Cancel Query +TabbedResultsetRenderer.cancel_button.tip=Cancel processing the results of this query. +TabbedResultsetRenderer.statement_cancel_failed=Failed to cancel the statement with the following error. \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java 2007-05-17 02:06:10 UTC (rev 56) +++ isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java 2007-05-17 02:13:24 UTC (rev 57) @@ -36,10 +36,12 @@ import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; +import java.text.MessageFormat; import java.util.Properties; import java.util.concurrent.atomic.AtomicBoolean; import java.util.prefs.Preferences; +import javax.swing.BoundedRangeModel; import javax.swing.Box; import javax.swing.Icon; import javax.swing.JButton; @@ -55,151 +57,155 @@ import org.isqlviewer.swing.SwingUtilities; import org.isqlviewer.swing.WizardPanel; import org.isqlviewer.swing.action.SwingEventManager; +import org.isqlviewer.swing.table.EnhancedTableModel; import org.isqlviewer.swing.table.ResultSetTableModel; import org.isqlviewer.util.IsqlToolkit; import org.isqlviewer.util.LocalMessages; /** + * Resultset handler that translate query results into tables within an EnhancedTabbedPane. + * <p> + * * @author Mark A. Kobold <mkobold at isqlviewer dot com> * @version 1.0 */ -public class TabbedResultsetRenderer extends JPanel implements ActionListener, ResultSetRenderer { +public class TabbedResultsetRenderer implements ResultSetRenderer { private static final long serialVersionUID = 1199835121337623550L; private static final String BUNDLE_NAME = "org.isqlviewer.ui.ResourceBundle"; + private LocalMessages messages = new LocalMessages(BUNDLE_NAME); - private LocalMessages messages = new LocalMessages(BUNDLE_NAME); - private EnhancedTabbedPane container = null; + private Preferences preferences = Preferences.userRoot().node(IsqlToolkit.getRootPreferencesNode()); + private MessageFormat choiceNodeFormat = new MessageFormat("string-substitutions/{0}"); private AtomicBoolean isCancelled = new AtomicBoolean(false); - private BusyQueryIndicator eyeCandy = new BusyQueryIndicator(isCancelled); + private Properties currentSubstitutions = new Properties(); - private Preferences prefs = Preferences.userRoot().node(IsqlToolkit.getRootPreferencesNode()); + private BusyQueryIndicator eyeCandy = null; + private EnhancedTabbedPane tabbedPane = null; public TabbedResultsetRenderer(EnhancedTabbedPane container) { if (container == null) { throw new NullPointerException(); } - this.container = container; - eyeCandy.doLayout(this, null, null); + this.tabbedPane = container; } - public void actionPerformed(ActionEvent event) { + public void initialize() { - int index = container.indexOfComponent(this); - container.setClosableTab(index, true); + synchronized (isCancelled) { + isCancelled.set(false); + } + currentSubstitutions.clear(); + JPanel componentView = new JPanel(); + eyeCandy = new BusyQueryIndicator(isCancelled); + eyeCandy.doLayout(componentView, null, null); + int index = tabbedPane.getTabCount(); + tabbedPane.addTab("", SwingUtilities.loadIconResource("busy_animation", 16), componentView); + tabbedPane.setClosableTab(index, false); } - public void statementInitialized(String stmtID) { + public void statementInitialized(String stmtID, Statement statement) { synchronized (isCancelled) { isCancelled.set(false); } - - eyeCandy.reset(); - currentSubstitutions.clear(); - int index = container.indexOfComponent(this); - if (index < 0) { - index = container.getTabCount(); - container.addTab("", this); - } - container.setClosableTab(index, false); + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.statement_initalized", stmtID)); + eyeCandy.setStatement(statement); } - public void handleSQLException(ResultSet set, SQLException error) { + public void handleSQLException(SQLException error) { ThrowableView view = new ThrowableView(error, ""); JPanel parentComponent = new JPanel(); view.doLayout(parentComponent, null, null); String tabText = "ERROR"; Icon tabIcon = SwingUtilities.loadIconResource("fatal_error", 16); - int index = container.indexOfComponent(this); + JComponent componentView = eyeCandy.getComponentView(); + int index = tabbedPane.indexOfComponent(componentView); if (index < 0) { - container.addTab("error", this); - index = container.indexOfComponent(this); + tabbedPane.addTab("error", componentView); + index = tabbedPane.indexOfComponent(componentView); } - container.setToolTipTextAt(index, "ERROR"); - container.setTitleAt(index, tabText); - container.setComponentAt(index, parentComponent); - container.setClosableTab(index, true); - container.setIconAt(index, tabIcon); - container.setSelectedIndex(index); + tabbedPane.setToolTipTextAt(index, "ERROR"); + tabbedPane.setTitleAt(index, tabText); + tabbedPane.setComponentAt(index, parentComponent); + tabbedPane.setClosableTab(index, true); + tabbedPane.setIconAt(index, tabIcon); + tabbedPane.setSelectedIndex(index); } public long processResultSet(String stmtID, ResultSet set, String nativeSQL, int count) { + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.process_resultset", stmtID)); try { - ResultSetTableModel model = new ResultSetTableModel(); model.setResults(set, this); - - DataGrid grid = new DataGrid(); - JPanel view = new JPanel(); - grid.doLayout(view, null, null); - grid.setModel(model); - - String str = ""; - Icon ico = null; - if (count >= 0) { - str = "Resultset"; - ico = SwingUtilities.loadIconResource("Table", 16); - } else { - str = "Generated Keys"; - ico = SwingUtilities.loadIconResource("KeyTable", 16); - } - int index = container.indexOfComponent(this); - if (index < 0) { - container.addTab("", this); - index = container.indexOfComponent(this); - } - String html = nativeSQL; - container.setToolTipTextAt(index, html); - container.setTitleAt(index, str); - container.setComponentAt(index, view); - container.setClosableTab(index, true); - container.setIconAt(index, ico); - container.setSelectedIndex(index); + eyeCandy.setQueryData(model); return model.getTrueRowCount(); - } catch (SQLException e) { - } finally { - container.validate(); + } catch (SQLException error) { + handleSQLException(error); } return -1; } public void recieveResultsetWarnings(ResultSet set, SQLWarning warnings) { - // SQLWarningViewer.addResultsetWarnings(warnings); + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.resultset_warnings")); } public void recieveStatementWarnings(Statement stmt, SQLWarning warnings) { - // SQLWarningViewer.addStatementWarnings(warnings); + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.statement_warnings")); } public void processRowUpdates(String stmtID, int updateCount, String nativeSQL) { + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.row_updates", Integer.toString(updateCount))); Logger logger = IsqlToolkit.getApplicationLogger(); logger.info(messages.format("tabbedresultsetrenderer.rows_affected", new Integer(updateCount))); - int index = container.indexOfComponent(this); - if (index >= 0) { - container.removeTabAt(index); - } } - public void handleStatementInterrupted(String stmtID) { + public void finalizeStatement(String stmtID) { - // currentConnection = null; - // System.out.println(BasicUtilities.getString("Query_Failed")); - // int index = workbench.resultPane.indexOfComponent(this); - // workbench.resultPane.setClosableTab(index, true); - // eyecandy.setIndeterminate(false); - // labelInfo.setText(BasicUtilities.getString("Query_Cancelled")); - // eyecandy.setValue(eyecandy.getMaximum()); + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.finalize_statement", stmtID)); + + String html = ""; + EnhancedTableModel resultSet = eyeCandy.getQueryData(); + JComponent componentView = eyeCandy.getComponentView(); + if (resultSet != null) { + String str = ""; + Icon ico = null; + str = "Resultset"; + ico = SwingUtilities.loadIconResource("table", 16); + int index = tabbedPane.indexOfComponent(componentView); + if (index < 0) { + tabbedPane.addTab("", componentView); + index = tabbedPane.indexOfComponent(componentView); + } + DataGrid dataGrid = new DataGrid(); + componentView.removeAll(); + dataGrid.doLayout(componentView, null, null); + dataGrid.setModel(eyeCandy.getQueryData()); + tabbedPane.setToolTipTextAt(index, html); + tabbedPane.setTitleAt(index, str); + tabbedPane.setComponentAt(index, componentView); + tabbedPane.setClosableTab(index, true); + tabbedPane.setIconAt(index, ico); + tabbedPane.setSelectedIndex(index); + } else { + int index = tabbedPane.indexOfComponent(componentView); + if (index >= 0) { + tabbedPane.removeTabAt(index); + } + } + tabbedPane.invalidate(); + eyeCandy.destroy(); } public void processGeneratedKeys(String stmtID, ResultSet keys, String nativeSQL) { + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.processing_generated_keys", stmtID)); processResultSet(stmtID, keys, nativeSQL, Integer.MIN_VALUE); } @@ -220,14 +226,17 @@ public String substituteVariable(String variableName) { + eyeCandy.updateStatus(messages.format("TabbedResultsetRenderer.processing_variable_substitutions")); + String existingInput = currentSubstitutions.getProperty(variableName); if (existingInput != null) { return existingInput; } - Preferences preferences = prefs.node("string-substitutions/ " + variableName); - Frame frameOwner = (Frame) javax.swing.SwingUtilities.getAncestorOfClass(Frame.class, container); - VariableSubstitutor substitutor = new VariableSubstitutor(frameOwner, variableName, preferences); + Object[] arguments = new Object[]{variableName}; + Preferences previousChoices = preferences.node(choiceNodeFormat.format(arguments)); + Frame frameOwner = (Frame) javax.swing.SwingUtilities.getAncestorOfClass(Frame.class, tabbedPane); + VariableSubstitutor substitutor = new VariableSubstitutor(frameOwner, variableName, previousChoices); substitutor.setVisible(true); String selection = substitutor.getSubstitution(); if (selection != null) { @@ -241,7 +250,7 @@ public EnhancedTabbedPane getTabbedPane() { - return container; + return tabbedPane; } private static class BusyQueryIndicator extends AbstractApplicationView implements ActionListener { @@ -250,18 +259,39 @@ private JButton cancelButton = null; private JLabel statusLabel = null; private AtomicBoolean isCancelled = null; + private EnhancedTableModel queryData = null; + private JComponent componentView = null; + private Statement statement = null; + private LocalMessages msgs = new LocalMessages(BUNDLE_NAME); public BusyQueryIndicator(AtomicBoolean isCancelled) { this.isCancelled = isCancelled; } - public void reset() { + public void destroy() { - cancelButton.setEnabled(true); - statusLabel.setText(""); + progressBar = null; + cancelButton = null; + statusLabel = null; + isCancelled = null; + queryData = null; + componentView = null; + statement = null; } + public void setStatement(Statement statement) { + + this.statement = statement; + } + + public void updateStatus(String text) { + + statusLabel.setText(text); + BoundedRangeModel model = progressBar.getModel(); + model.setValue(model.getValue() + 1); + } + public void configureMenubar(JMenuBar menuBar) { } @@ -273,21 +303,22 @@ public void doLayout(JComponent parentComponent, Preferences preferences, SwingEventManager eventManager) { Object obj = null; + + this.componentView = parentComponent; JPanel container = new JPanel(new GridBagLayout()); - parentComponent.setLayout(new WizardPanel.Layout()); parentComponent.add(container); obj = constrain(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); - progressBar = new JProgressBar(JProgressBar.HORIZONTAL); - progressBar.setIndeterminate(true); + progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 1, 6); container.add(progressBar, obj); - statusLabel = new JLabel("Status What?"); + statusLabel = new JLabel(SwingUtilities.loadIconResource("information", 16)); obj = constrain(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL); container.add(statusLabel, obj); - cancelButton = new JButton("Cancel"); + cancelButton = new JButton(msgs.format("TabbedResultsetRenderer.cancel_button.text")); + cancelButton.setToolTipText(msgs.format("TabbedResultsetRenderer.cancel_button.tip")); cancelButton.addActionListener(this); obj = constrain(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE); container.add(cancelButton, obj); @@ -307,9 +338,32 @@ synchronized (isCancelled) { isCancelled.set(true); + if (statement != null) { + try { + statement.cancel(); + } catch (SQLException error) { + Logger logger = IsqlToolkit.getApplicationLogger(); + String text = msgs.format("TabbedResultsetRenderer.statement_cancel_failed"); + logger.warn(text, error); + } + } } cancelButton.setEnabled(false); } + + public EnhancedTableModel getQueryData() { + + return queryData; + } + + public void setQueryData(EnhancedTableModel queryData) { + + this.queryData = queryData; + } + + public JComponent getComponentView() { + + return componentView; + } } - -} +} \ No newline at end of file Added: isql-swing/trunk/src/org/isqlviewer/ui/dnd/TabbedPaneDropTarget.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/dnd/TabbedPaneDropTarget.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/ui/dnd/TabbedPaneDropTarget.java 2007-05-17 02:13:24 UTC (rev 57) @@ -0,0 +1,96 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.ui.dnd; + +import java.awt.Component; +import java.awt.HeadlessException; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; + +import javax.swing.JTabbedPane; +import javax.swing.plaf.TabbedPaneUI; + +import org.isqlviewer.swing.EnhancedTabbedPane; + +/** + * Enhanced Drop target for TabbedPanes. + * <p> + * Currently this drop target creates that dragOver tab / change selection effect. Not quite a spring loaded effect but + * effective for dragging something from one view to abother tabbed view + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class TabbedPaneDropTarget extends DropTarget { + + private static final long serialVersionUID = 7669524130710371514L; + private final EnhancedTabbedPane pane; + private int currentDraggingIndex = -1; + + public TabbedPaneDropTarget(EnhancedTabbedPane pane, Component c, DropTargetListener dtl) throws HeadlessException { + + super(c, dtl); + this.pane = pane; + } + + @Override + public synchronized void dragEnter(DropTargetDragEvent dtde) { + + TabbedPaneUI tabUI = this.pane.getUI(); + JTabbedPane source = (JTabbedPane) getComponent(); + int x = dtde.getLocation().x; + int y = dtde.getLocation().y; + int index = tabUI.tabForCoordinate(source, x, y); + if (index >= 0) { + source.setSelectedIndex(index); + currentDraggingIndex = index; + } + } + + @Override + public synchronized void dragExit(DropTargetEvent dte) { + + currentDraggingIndex = -1; + } + + @Override + public synchronized void dragOver(DropTargetDragEvent dtde) { + + TabbedPaneUI tabUI = this.pane.getUI(); + JTabbedPane source = (JTabbedPane) getComponent(); + int x = dtde.getLocation().x; + int y = dtde.getLocation().y; + int index = tabUI.tabForCoordinate(source, x, y); + if (index >= 0 && currentDraggingIndex != index) { + source.setSelectedIndex(index); + currentDraggingIndex = index; + } + } +} \ No newline at end of file Added: isql-swing/trunk/src/org/isqlviewer/ui/laf/NullIcon.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/laf/NullIcon.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/ui/laf/NullIcon.java 2007-05-17 02:13:24 UTC (rev 57) @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.ui.laf; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; + +import javax.swing.UIManager; + +/** + * Default Icon to use when no icon is available. + * <p> + * Does a color LED thing with a ? in the center. + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class NullIcon extends ColorLedIcon { + + public NullIcon() { + + super(UIManager.getColor("textHighlight"), 0, 0); + } + + @Override + public void paintIcon(Component c, Graphics g1, int x, int y) { + + super.paintIcon(c, g1, x, y); + Graphics2D g = (Graphics2D) g1; + + Dimension size = new Dimension(getIconWidth(), getIconHeight()); + int sphereSize = size.width <= size.height ? size.width : size.height; + Rectangle gradientRect = new Rectangle(-sphereSize / 2, -sphereSize / 2, 3 * sphereSize / 2, 3 * sphereSize / 2); + float x1 = gradientRect.width / 2f; + float y1 = gradientRect.height / 2f; + g.setColor(UIManager.getColor("textHighlightText")); + g.drawString("?", x1 / 2, y1); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-05-17 02:06:09
|
Revision: 56 http://svn.sourceforge.net/isql/?rev=56&view=rev Author: mkobold Date: 2007-05-16 19:06:10 -0700 (Wed, 16 May 2007) Log Message: ----------- * .classpath ** Updated the project classpath business * isqlviewer/PreferenceKeys.java ** Deleted unused class * sql/ResultSetRendere.java ** Tweaked up the API some more for a bit more polish; still needs a bit more work. * isqlviewer/UserOptions.java ** Added missing file that should have been comitted awhile ago >.> * util/NullResultSetViewer.java ** Updated to reflect interface changes * util/QueryExecutor.java ** Updated to follow a flow based off the resultset render than just doing whatever so it actually works in a more deterministic fashion. * util/StringUtilities.java ** Removed unused method. Modified Paths: -------------- isql-core/trunk/.classpath isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java isql-core/trunk/src/org/isqlviewer/util/StringUtilities.java Added Paths: ----------- isql-core/trunk/src/org/isqlviewer/UserOptions.java Removed Paths: ------------- isql-core/trunk/src/org/isqlviewer/PreferenceKeys.java Modified: isql-core/trunk/.classpath =================================================================== --- isql-core/trunk/.classpath 2007-05-17 01:52:10 UTC (rev 55) +++ isql-core/trunk/.classpath 2007-05-17 02:06:10 UTC (rev 56) @@ -3,8 +3,8 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="test"/> + <classpathentry exported="true" kind="var" path="JUNIT_HOME/junit.jar" sourcepath="/JUNIT_SRC_HOME/junitsrc.zip"/> <classpathentry exported="true" kind="lib" path="lib/log4j.jar"/> - <classpathentry exported="true" sourcepath="/JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/> - <classpathentry kind="lib" path="lib/derby.jar"/> + <classpathentry exported="true" kind="lib" path="lib/derby.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Deleted: isql-core/trunk/src/org/isqlviewer/PreferenceKeys.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/PreferenceKeys.java 2007-05-17 01:52:10 UTC (rev 55) +++ isql-core/trunk/src/org/isqlviewer/PreferenceKeys.java 2007-05-17 02:06:10 UTC (rev 56) @@ -1,671 +0,0 @@ -/* - * Copyright 2000-2005 by Mark A. Kobold - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * - * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * - * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * - * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ - */ -package org.isqlviewer; - -import javax.swing.UIManager; - -import org.isqlviewer.util.StringUtilities; - -/** - * TODO Add PreferenceKeys Overview JavaDoc. - * <p> - * - * @author Mark A. Kobold <mkobold at isqlviewer dot com> - * @version 1.0 - */ -public final class PreferenceKeys { - - public static String createStyleKey(String base, String secondary) { - - return base.concat(".").concat(secondary); - } - - public static final String KEY_STYLE_ITALICS = "italics"; - - public static final String KEY_STYLE_COLOR = "color"; - - public static final String KEY_STYLE_BOLDED = "bolded"; - - /** - * Boolean property to determine if it should automatically check for a new version of iSQL-Viewer on startup. - */ - public static final String KEY_USE_WEB_CHK = "advanced.versioncheck-enabled"; - /** - * Integer property that determine if Beta & Stable version are acceptable or just Stable versions. - */ - public static final String KEY_WEB_CHK_TYPE = "advanced.versioncheck-type"; - /** - * String property that is the name of a iSQL service to automatically connect on startup. - */ - public static final String STARTUP_SERVICE = "jdbc.auto-service"; - /** - * Boolean property for configuring JDBC tracing when connected to an iSQL service. - */ - public static final String KEY_JDBC_TRACE_ENABLED = "jdbc.trace-enabled"; - /** - * Boolean property that ensures a final commit is called to a service if nessecary, upon disconnection. - */ - public static final String KEY_JDBC_COMMIT_ON_CLOSE = "jdbc.autocommit-enabled"; - /** - * Boolean property to determine if JDBC activity is verbose or not. - */ - public static final String KEY_JDBC_VERBOSE = "jdbc.verbose-enabled"; - /** - * Boolean property to echo or not echo queries as they are executed. - */ - public static final String KEY_QUERY_ECHO = "jdbc.echo-query"; - /** - * Boolean property to ensure that when queries are executed that the connection is available. - */ - public static final String KEY_JDBC_KEEPALIVE = "jdbc.keepalive-enabled"; - /** - * Boolean property to tell database connection that you want genereated keys if available from ResultSets. - */ - public static final String KEY_JDBC_GENERATE_KEYS = "jdbc.resultsetkeys-enabled"; - /** - * Integer property for the number of seconds that should pass before a connection timesout. - */ - public static final String KEY_LOGIN_TIMEOUT = "jdbc.timeout-login"; - /** - * Integer property for the number of seconds that should pass before a statement execution timesout. - */ - public static final String KEY_QUERY_TIMEOUT = "jdbc.timeout-query"; - /** - * Boolean property to echo the number of rows recieved from a ResultSet object. - */ - public static final String KEY_ROW_CNT_ECHO = "jdbc.echo-rowcount"; - /** - * Integer property for configuring resultset holdability. - * - * @see java.sql.Connection#setHoldability(int) - */ - public static final String KEY_JDBC_HOLDABILITY = "jdbc.resultset-holdability"; - /** - * Boolean property to turn on/off escaping processing in the JDBC driver. - */ - public static final String KEY_JDBC_ESCAPE = "jdbc.escapeProc-enabled"; - /** - * Boolean property to debug JDBC activity. - */ - public static final String KEY_JDBC_DEBUG = "jdbc.debug-enabled"; - /** - * Boolean property for enabling reverse fetching of ResultSet data. - */ - public static final String KEY_JDBC_RFETCH = "jdbc.reverseFetch-enabled"; - /** - * Integer property to configure the maximum number of rows a Statement object should return. - */ - public static final String KEY_JDBC_MAX_ROWS = "jdbc.max-rows"; - /** - * Integer property to configure the maximum field size a Statement object should return. - */ - public static final String KEY_JDBC_MAX_FIELD_SZ = "jdbc.max-fieldsize"; - /** - * Integer property to determine how deep to process chained SQLExceptions & SQLWarnings. - */ - public static final String KEY_WARNING_CHAIN_LENGTH = "jdbc.max-warnings"; - /** - * Boolean property that determines if the resultset toolbar is enabled or not. - */ - public static final String KEY_TB_RESSET_VISIBLE = "toolbar.resultset-visible"; - /** - * Boolean property that determines if the main toolbar is enabled or not. - */ - public static final String KEY_TB_FILE_VISIBLE = "toolbar.file-visible"; - /** - * Boolean property that determines if the SQL editor toolbar is enabled or not. - */ - public static final String KEY_TB_HISTORY_VISIBLE = "toolbar.history-visible"; - /** - * String property that determines the location of the resultset toolbar e.g. NORTH,SOUTH,EAST,WEST - */ - public static final String KEY_TB_RESSET_DOCK = "toolbar.resultset-dock"; - /** - * String property that determines the location of the main toolbar e.g. NORTH,SOUTH,EAST,WEST - */ - public static final String KEY_TB_FILE_DOCK = "toolbar.file-dock"; - /** - * String property that determines the location of the SQL Editor toolbar e.g. NORTH,SOUTH,EAST,WEST - */ - public static final String KEY_TB_HISTORY_DOCK = "toolbar.history-dock"; - /** - * Boolean property for wether all classes are shown in the service manager or only those in the classpath. - */ - public static final String KEY_SERVICE_DRIVERS_VISIBLE = "general.alldrivers-visible"; - /** - * Boolean property for switching tabs when a new service is selected in the service manager. - */ - public static final String KEY_SERVICE_SWITCH_ON_CHANGE = "servicemanager.switchtab-enabled"; - /** - * Boolean property to ensure that the JDBC driver listing is always sorted or not. - */ - public static final String KEY_DRIVERS_AUTOSORT = "general.driversort-enabled"; - /** - * Boolean property that allows the current driver.properties file to overwritten when a new version is installed. - */ - public static final String KEY_DRIVERS_AUTOUPDATE = "general.driverupdate-enabled"; - /** - * Boolean property to scan service paths for service files when iSQL-Viewer is started. - */ - public static final String KEY_SERVICE_AUTODETECT = "general.servicescan-enabled"; - /** - * String property of the fully qualified class name of the desired LookAndFeel to use. - */ - public static final String KEY_LOOK_N_FEEL = "general.plaf-class"; - /** - * Boolean property for using large 24x24 or smaller 16x16 icons. - */ - public static final String KEY_USE_LARGE_ICONS = "general.large-icons"; - /** - * Boolean property that enables a single click sort of tables otherwise a double-click is required. - */ - public static final String SINGLE_CLICK_SORTING = "general.1clicksort-enabled"; - /** - * String property that is the format for the tabs of ResultSets so that they can be easily identified. - */ - public static final String KEY_RESSET_TAB_FMT = "general.results-format"; - /** - * Boolean property for saving session oriented information such as last selection, and window locations. - */ - public static final String KEY_ENABLE_METRICS = "general.metrics-enabled"; - /** - * String property that is a localized path of directories and files to load classes from. - */ - public static final String KEY_EXTRA_CLASSPATH = "advanced.classpath"; - /** - * String property that is a localized path of directories to load iSQL services. - */ - public static final String KEY_SERVICES_PATH = "advanced.servicepath"; - /** - * Color property to that is used to highlight null values returned from ResultSet objects. - */ - public static final String KEY_NULL_HIGHLIGHT = "general.null-color"; - /** - * Boolean property that will reuse that same tab when refreshing a previously executed statement. - */ - public static final String REUSE_TAB_ON_REFRESH = "general.refresh-reuse"; - /** - * Boolean property that will clear the SQL Editor upon execution of an SQL statement. - */ - public static final String KEY_EDITOR_AUTO_CLEAR = "editor.autoclear-enabled"; - - /** - * Boolean for enabling/disabling context-sensitive help in the main editor. - */ - public static final String EDITOR_CONTEXT_HELP = "editor.context-help.enabled"; - /** - * Boolean for enabling/disabling syntax highlighting in the main editor. - */ - public static final String EDITOR_SYNTAX_HELP = "editor.syntax-help.enabled"; - /** - * Boolean property to determine if the caret style is row:column or :location. - */ - public static final String KEY_EDITOR_CARET_STYLE = "editor.caretoffset-enabled"; - /** - * Color property for the SQL editor's foreground. - */ - public static final String STYLE_BASE_COLOR = "editor.default-color"; - /** - * Color property for the SQL editor's background. - */ - public static final String EDITOR_DEFAULT_COLOR = "editor.background-color"; - /** - * Color property for syntax highlighting of table,views, and procedure names along other JDBC objects. - */ - public static final String STYLE_LOCAL_OBJ = "editor.local-obj"; - /** - * Color property for syntax highlighting of SQL keywords. - */ - public static final String STYLE_SQL_KEWORDS = "editor.sql-keywords"; - /** - * Color property for syntax highlighting single line comments. - */ - public static final String STYLE_SLINE_CMNTS = "editor.sline-comments"; - /** - * Color property for syntax highlighting of string literals. - */ - public static final String STYLE_LITERALS = "editor.literals"; - /** - * Color property for syntax highlighting of sql functions. - */ - public static final String STYLE_FUNCTIONS = "editor.functions"; - /** - * Color property for syntax highlighting of sql & parameters. - */ - public static final String STYLE_PARAMETERS = "editor.parameters"; - /** - * Style preference for tablespace words like catalogs, and schema names. - */ - public static final String STYLE_TABLESPACE = "editor.tablespace"; - - public static final String STYLE_PROCEDURES = "editor.procedures"; - public static final String STYLE_FOREIGN_OBJ = "editor.foreign-obj"; - /** - * Font property for the SQL editor. - */ - public static final String KEY_EDITOR_FONT = "editor.font"; - /** - * Color property for syntax highlighting of multi-line commets such as /** comments - */ - public static final String STYLE_MLINE_CMNTS = "editor.multicomment-color"; - /** - * Color property for the Syste console foreground color. - */ - public static final String KEY_CONSOLE_FG_COLOR = "console.foreground-color"; - /** - * Default color for the console foreground. - */ - public static final String DEF_CONSOLE_FG_COLOR = StringUtilities.getHTMLColor(UIManager - .getColor("TextArea.foreground")); - - /** - * Color property for the System console background color. - */ - public static final String KEY_CONSOLE_BG_COLOR = "console.background-color"; - /** - * Default color for the console background. - */ - public static final String DEF_CONSOLE_BG_COLOR = StringUtilities.getHTMLColor(UIManager - .getColor("TextArea.background")); - - /** - * Color property of text that is printed using the System.out PrintStream. - */ - public static final String KEY_CONSOLE_SYS_COLOR = "console.sys-color"; - /** - * Color property of text that is printed using the System.err PrintStream. - */ - public static final String KEY_CONSOLE_ERR_COLOR = "console.err-color"; - /** - * Default HTML color for displaying errors in the iSQL-Viewer console. - */ - public static final String DEF_CONSOLE_ERR_COLOR = "#FF0000"; - - /** - * Color property for displaying text printed using the JDBC tracing streams. - */ - public static final String KEY_CONSOLE_SQL_COLOR = "console.sql-color"; - /** - * Font property for the iSQL console component. - */ - public static final String KEY_CONSOLE_FONT = "console.font"; - /** - * Default font property to use if none is previously set. - */ - public static final String DEF_CONSOLE_FONT = "Monospaced,10"; - - public static final String DEF_CONSOLE_SQL_COLOR = "#0000FF"; - - /** - * String property that is the format of time in which to prepend to text being displayed. - */ - public static final String KEY_CONSOLE_TIME_FMT = "console/timestamp-format"; - /** - * Default time format if no preference is previously set. - */ - public static final String DEF_CONSOLE_TIME_FMT = "[HH:mm:ss]"; - - /** - * Integer property that determines which kind of history set to use. - */ - public static final String KEY_HISTORY_STYLE = "history.style"; - /** - * Integer property for the maximum number of days to keep a history item. - */ - public static final String KEY_HISTORY_MAX_DAYS = "history.max-days"; - /** - * Integer property for the maximum number of history items to manage at a time. - */ - public static final String KEY_HISTORY_MAX_COUNT = "history.max-count"; - /** - * Boolean property for browsing history items to be circular or not. - */ - public static final String KEY_HISTORY_CONTINUOUS = "history.circular-enabled"; - /** - * Boolean property that will discard duplicate history items. - */ - public static final String KEY_HISTORY_DISCARD_DUPES = "history.duplicates-enabled"; - /** - * Boolean property for enabling/disabling the use of CRC32 when detecting duplicate history items. - */ - public static final String KEY_HISTORY_USECRC32 = "history.crc32-enabled"; - /** - * Boolean property to determine if the history items of the current session are kept when manually cleared. - */ - public static final String KEY_HISTORY_CLEAR_SESSION = "history.sessionclear-enabled"; - /** - * Boolean property that enables a history that is not persisted to disk. - */ - public static final String KEY_HISTORY_SESSION_ONLY = "history.persistent-enabled"; - /** - * Boolean property that enabled the showing of hidden files when selecting a file or directory. - */ - public static final String KEY_SHOW_HIDDEN_FILES = "general.hiddenfiles-enabled"; - /** - * Integer property that sets the maximum number of ResultSets before unlocked tabs are reused. - */ - public static final String MAX_QUERY_VIEWS = "general.max-resultsets"; - /** - * Integer property of how tables are spread out across mutliple pages. - */ - public static final String KEY_PRINT_GRID_STYLE = "print.table-style"; - /** - * Boolean property to use color over monochrome when printing. - */ - public static final String KEY_PRINT_USE_COLOR = "print.color-enabled"; - /** - * Boolean property to include the table gridlines when printing. - */ - public static final String KEY_PRINT_GRID = "print.grid-enabled"; - /** - * Boolean property to include footer information on each page when printing. - */ - public static final String KEY_PRINT_FOOTER = "print.footer-enabled"; - /** - * Boolean property to include header information on each page when printing. - */ - public static final String KEY_PRINT_HEADER = "print.header-enabled"; - /** - * Boolean property that indicates the global preference of keeping iSQL service passwords secure. - */ - public static final String KEY_ENABLE_SECURITY = "general.security-enabled"; - /** - * String property that is used to seperate SQL statements when parsing batch files. - */ - public static final String KEY_BATCH_SEPERATOR = "batch.seperator-char"; - /** - * String property that is used to ignore data based on this value. - */ - public static final String KEY_BATCH_COMMENT = "batch.comment-char"; - /** - * String property used to identify string literals when parsing batch files. - */ - public static final String KEY_BATCH_LITERAL = "batch.literal-char"; - /** - * Integer property that indicates how statements are seperated in batch files. - */ - public static final String KEY_BATCH_SEPERATOR_STYLE = "batch.seperator-style"; - /** - * Integer property for the kind of comments to support when parsing batch files. - */ - public static final String KEY_BATCH_COMMENT_STYLE = "batch.comment-style"; - /** - * Integer property for the kind of literal style to used for parsing batch files. - */ - public static final String KEY_BATCH_LITERAL_STYLE = "batch.literal-style"; - /** - * Boolean property that will force all text into lower case form when parsing batch files. - */ - public static final String KEY_BATCH_FORCE_LC = "batch.lowercase-enable"; - /** - * Integer property to determine the page size of larger tables so that they can render faster. - */ - public static final String TABLE_PAGING_SIZE = "general.tablepage-size"; - /** - * String property for the preferred input/output format of Time values. - */ - public static final String KEY_FORMAT_TIME = "general.time-format"; - /** - * String property for the preferred input/output format of Timestamp values - */ - public static final String KEY_FORMAT_TIMESTAMP = "general.timestamp-format"; - /** - * String property for the preferred input/output format of Date values. - */ - public static final String KEY_FORMAT_DATE = "general.date-format"; - /** - * Boolean property to allow the double-click execution of SQL bookmarks. - */ - public static final String KEY_BOOKMARK_ACTIVATE_STYLE = "bookmark.activation-style"; - /** - * String property that is the preferred location of the bookmark drawer, ie Right, Left. - */ - public static final String KEY_BOOKMARK_LOCATION = "bookmark.location"; - /** - * Boolean property that determines wether to warn the user before deleting bookmarks, and folders. - */ - public static final String KEY_BOOKMARK_DELETE_WARNING = "bookmarks.deletewarning-enabled"; - /** - * Boolean property to enable debugging withing the ScriptManager. - */ - public static final String KEY_SCRIPT_DEBUG = "scripting.debug-enabled"; - /** - * String property of a localized path of directories to load scripts from. - */ - public static final String KEY_SCRIPT_PATHS = "scripting.path"; - /** - * Boolean property to filter out files that are not known to the script manager. - */ - public static final String KEY_SCRIPT_FILTER_FILES = "scripting.filefilter-enabled"; - /** - * String property for the preferred HTTP proxy host. - */ - public static final String KEY_HTTP_PROXY_HOST = "advanced.httpproxy-host"; - /** - * Integer property for the HTTP proxy port of use on the proxy host. - */ - public static final String KEY_HTTP_PROXY_PORT = "advanced.httpproxy-port"; - /** - * String property of the HTTP proxy user name to use. - */ - public static final String KEY_HTTP_PROXY_USER = "advanced.httpproxy-user"; - /** - * String property for the HTTP proxy password to use. - */ - public static final String KEY_HTTP_PROXY_PASSW = "advanced.httpproxy-pass"; - /** - * This value will indicate the prefix of session proeprties so it is easy to filter them out when preferences are - * saved to disk. - */ - public static final String KEY_SESSION_PREFIX = "session."; - /** - * String value that is that last accessed file used. - */ - public static final String KEY_SES_LAST_FILE = "session.last-location"; - /** - * Boolean property to enable ASCII compatibility for UNICODE characters whenever nessecary. - * <p> - * Generally if this preference is true, there will be automatic encoding and decoding of ASCII UNICODE escape - * sequences of the form '\ uXXXX' where XXXX is the UNICODE value. - */ - public static final String KEY_USE_ASCII_COMPATIBILITY = "general.ascii2native-enabled"; - /** - * Boolean property to show statement that return an update count as a tab. - * <p> - * When a query is executed in the main SQLWOrkbench, this is true a tab will be created showing the updated count, - * and will have to be removed manually. otherwise if this is false the update count will be echoed to the - * System.out which ends up in the console window. - */ - public static final String KEEP_UPDATE_RESULTS = "general.showupdatetab-enabled"; - - public static final String SCRATCH_PAD_COUNT = "workbench.scratchpad-count"; - - // defaults.putBoolean(ConfigConstants.KEY_ENABLE_SECURITY, true); - // defaults.putInt(ConfigConstants.KEY_PRINT_GRID_STYLE, 0); - // defaults.putBoolean(ConfigConstants.KEY_PRINT_GRID, true); - // defaults.putBoolean(ConfigConstants.KEY_PRINT_HEADER, true); - // defaults.putBoolean(ConfigConstants.KEY_PRINT_FOOTER, true); - // defaults.putBoolean(ConfigConstants.KEY_PRINT_USE_COLOR, true); - // defaults.putBoolean(ConfigConstants.KEY_SERVICE_AUTODETECT, false); - // defaults.putBoolean(ConfigConstants.KEY_SERVICE_DRIVERS_VISIBLE, false); - // defaults.putBoolean(ConfigConstants.KEY_SERVICE_SWITCH_ON_CHANGE, true); - // defaults.putBoolean(ConfigConstants.KEY_DRIVERS_AUTOSORT, true); - // defaults.putBoolean(ConfigConstants.KEY_DRIVERS_AUTOUPDATE, true); - // defaults.putBoolean(ConfigConstants.KEEP_UPDATE_RESULTS, false); - // defaults.put(ConfigConstants.KEY_HTTP_PROXY_HOST, System.getProperty("http.proxyHost", "")); - // defaults.put(ConfigConstants.KEY_HTTP_PROXY_PORT, System.getProperty("http.proxyPort", "80")); - // defaults.put(ConfigConstants.KEY_HTTP_PROXY_USER, ""); - // defaults.put(ConfigConstants.KEY_HTTP_PROXY_PASSW, ""); - // defaults.putInt(ConfigConstants.MAX_QUERY_VIEWS, 10); - // defaults.putBoolean(ConfigConstants.KEY_SHOW_HIDDEN_FILES, false); - // String fmt = BasicUtilities.getString("Preferred_Date_Format"); - // defaults.put(ConfigConstants.KEY_FORMAT_DATE, fmt); - // fmt = BasicUtilities.getString("Preferred_Time_Format"); - // defaults.put(ConfigConstants.KEY_FORMAT_TIME, fmt); - // fmt = BasicUtilities.getString("Preferred_Timestamp_Format"); - // defaults.put(ConfigConstants.KEY_FORMAT_TIMESTAMP, fmt); - // defaults.putBoolean(ConfigConstants.KEY_USE_ASCII_COMPATIBILITY, false); - // defaults.putBoolean(ConfigConstants.KEY_TB_FILE_VISIBLE, true); - // defaults.putBoolean(ConfigConstants.KEY_TB_HISTORY_VISIBLE, true); - // defaults.putBoolean(ConfigConstants.KEY_TB_RESSET_VISIBLE, true); - // defaults.put(ConfigConstants.KEY_TB_HISTORY_DOCK, BorderLayout.NORTH); - // defaults.put(ConfigConstants.KEY_TB_FILE_DOCK, BorderLayout.NORTH); - // defaults.put(ConfigConstants.KEY_TB_RESSET_DOCK, BorderLayout.WEST); - // defaults.put(ConfigConstants.KEY_RESSET_TAB_FMT, "%s (%r,%c)"); - // defaults.put(ConfigConstants.KEY_LOOK_N_FEEL, UIManager.getSystemLookAndFeelClassName()); - // defaults.putBoolean(ConfigConstants.SINGLE_CLICK_SORTING, BasicUtilities.isMac()); - // defaults.putInt(ConfigConstants.KEY_HISTORY_STYLE, HistoryManager.STYLE_GLOBAL); - // defaults.putInt(ConfigConstants.KEY_HISTORY_MAX_COUNT, 256); - // defaults.putInt(ConfigConstants.KEY_HISTORY_MAX_DAYS, 30); - // defaults.putBoolean(ConfigConstants.KEY_HISTORY_CLEAR_SESSION, true); - // defaults.putBoolean(ConfigConstants.KEY_HISTORY_CONTINUOUS, true); - // defaults.putBoolean(ConfigConstants.KEY_HISTORY_DISCARD_DUPES, true); - // defaults.putBoolean(ConfigConstants.KEY_HISTORY_USECRC32, true); - // defaults.putBoolean(ConfigConstants.KEY_HISTORY_SESSION_ONLY, false); - // defaults.put(ConfigConstants.KEY_BOOKMARK_LOCATION, BasicUtilities.getString("Bookmark_Pref_Loc_Right")); - // defaults.putBoolean(ConfigConstants.KEY_BOOKMARK_ACTIVATE_STYLE, false); - // defaults.putBoolean(ConfigConstants.KEY_BOOKMARK_DELETE_WARNING, true); - // defaults.putInt(ConfigConstants.TABLE_PAGING_SIZE, 4096); - // defaults.putBoolean(ConfigConstants.REUSE_TAB_ON_REFRESH, true); - // defaults.putBoolean(ConfigConstants.KEY_USE_LARGE_ICONS, true); - // defaults.putBoolean(ConfigConstants.KEY_ENABLE_METRICS, false); - // defaults.put(ConfigConstants.KEY_EXTRA_CLASSPATH, ""); - // defaults.put(ConfigConstants.KEY_NULL_HIGHLIGHT, "#FF0000"); - // defaults.putInt(ConfigConstants.KEY_WEB_CHK_TYPE, 0); - // defaults.putBoolean(ConfigConstants.KEY_USE_WEB_CHK, false); - // defaults.putBoolean(ConfigConstants.EDITOR_SYNTAX_HELP, true); - // defaults.putBoolean(ConfigConstants.EDITOR_CONTEXT_HELP, true); - // - // defaults.put(ConfigConstants.KEY_EDITOR_FONT, "Default,11"); - // String defaultColor = StringUtilities.getHTMLColor(UIManager.getColor("TextArea.background")); - // defaults.put(ConfigConstants.EDITOR_DEFAULT_COLOR, defaultColor); - // defaultColor = StringUtilities.getHTMLColor(UIManager.getColor("TextArea.foreground")); - // defaults.put(ConfigConstants.STYLE_BASE_COLOR, defaultColor); - // String prefKey = null; - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SQL_KEWORDS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#0000FF"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SQL_KEWORDS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SQL_KEWORDS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FUNCTIONS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#000808"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FUNCTIONS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FUNCTIONS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LITERALS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#0000FF"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LITERALS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LITERALS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LOCAL_OBJ, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#810558"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LOCAL_OBJ, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_LOCAL_OBJ, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FOREIGN_OBJ, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#6666FF"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FOREIGN_OBJ, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_FOREIGN_OBJ, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, true); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PROCEDURES, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#000808"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PROCEDURES, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PROCEDURES, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PARAMETERS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#808080"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PARAMETERS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, true); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_PARAMETERS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, false); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SLINE_CMNTS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#808080"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SLINE_CMNTS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_SLINE_CMNTS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, true); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_MLINE_CMNTS, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#5F9479"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_MLINE_CMNTS, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_MLINE_CMNTS, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, true); - // - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_TABLESPACE, ConfigConstants.KEY_STYLE_COLOR); - // defaults.put(prefKey, "#000088"); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_TABLESPACE, ConfigConstants.KEY_STYLE_BOLDED); - // defaults.putBoolean(prefKey, false); - // prefKey = ConfigConstants.createStyleKey(ConfigConstants.STYLE_TABLESPACE, ConfigConstants.KEY_STYLE_ITALICS); - // defaults.putBoolean(prefKey, true); - - public static final boolean DEF_EDITOR_CARET_STYLE = false; - public static final boolean DEF_EDITOR_AUTO_CLEAR = false; - public static final boolean DEF_ENABLE_SECURITY = true; - public static final boolean DEF_QUERY_ECHO = true; - public static final boolean DEF_ROW_CNT_ECHO = true; - public static final boolean DEF_JDBC_KEEPALIVE = true; - public static final boolean DEF_JDBC_COMMIT_ON_CLOSE = true; - public static final boolean DEF_JDBC_VERBOSE = false; - public static final boolean DEF_JDBC_RFETCH = false; - public static final boolean DEF_JDBC_DEBUG = false; - public static final boolean DEF_JDBC_TRACE_ENABLED = false; - public static final boolean DEF_BATCH_FORCE_LC = false; - public static final boolean DEF_JDBC_ESCAPE = false; - public static final int DEF_LOGIN_TIMEOUT = 0; - public static final int DEF_QUERY_TIMEOUT = 0; - public static final int DEF_JDBC_MAX_FIELD_SZ = 0; - public static final int DEF_JDBC_MAX_ROWS = 0; - public static final int DEF_WARNING_CHAIN_LENGTH = 10; - public static final String DEF_BATCH_COMMENT = "#"; - public static final String DEF_BATCH_LITERAL = "\""; - public static final String DEF_BATCH_SEPERATOR = ";"; - public static final int DEF_BATCH_COMMENT_STYLE = 0;// BatchConstants.COMMENT_STYLE_CUSTOM); - public static final int DEF_BATCH_LITERAL_STYLE = 0; // BatchConstants.LITERAL_STYLE_DOUBLE); - public static final int DEF_BATCH_SEPERATOR_STYLE = 0;// BatchConstants.SEPERATOR_STYLE_CUSTOM); - - private PreferenceKeys() { - - // nothing to do here.// - } - -} Added: isql-core/trunk/src/org/isqlviewer/UserOptions.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/UserOptions.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/UserOptions.java 2007-05-17 02:06:10 UTC (rev 56) @@ -0,0 +1,511 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer; + +import javax.swing.UIManager; + +import org.isqlviewer.util.StringUtilities; + +/** + * TODO Add PreferenceKeys Overview JavaDoc. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public final class UserOptions { + + public static String createStyleKey(String base, String secondary) { + + return base.concat(".").concat(secondary); + } + + public static final String KEY_STYLE_ITALICS = "italics"; + + public static final String KEY_STYLE_COLOR = "color"; + + public static final String KEY_STYLE_BOLDED = "bolded"; + + /** + * Boolean property to determine if it should automatically check for a new version of iSQL-Viewer on startup. + */ + public static final String KEY_USE_WEB_CHK = "advanced.versioncheck-enabled"; + /** + * Integer property that determine if Beta & Stable version are acceptable or just Stable versions. + */ + public static final String KEY_WEB_CHK_TYPE = "advanced.versioncheck-type"; + /** + * String property that is the name of a iSQL service to automatically connect on startup. + */ + public static final String STARTUP_SERVICE = "jdbc.auto-service"; + /** + * Boolean property for configuring JDBC tracing when connected to an iSQL service. + */ + public static final String KEY_JDBC_TRACE_ENABLED = "jdbc.trace-enabled"; + /** + * Boolean property that ensures a final commit is called to a service if nessecary, upon disconnection. + */ + public static final String KEY_JDBC_COMMIT_ON_CLOSE = "jdbc.autocommit-enabled"; + /** + * Boolean property to determine if JDBC activity is verbose or not. + */ + public static final String KEY_JDBC_VERBOSE = "jdbc.verbose-enabled"; + /** + * Boolean property to echo or not echo queries as they are executed. + */ + public static final String KEY_QUERY_ECHO = "jdbc.echo-query"; + /** + * Boolean property to ensure that when queries are executed that the connection is available. + */ + public static final String KEY_JDBC_KEEPALIVE = "jdbc.keepalive-enabled"; + /** + * Boolean property to tell database connection that you want genereated keys if available from ResultSets. + */ + public static final String KEY_JDBC_GENERATE_KEYS = "jdbc.resultsetkeys-enabled"; + /** + * Integer property for the number of seconds that should pass before a connection timesout. + */ + public static final String KEY_LOGIN_TIMEOUT = "jdbc.timeout-login"; + /** + * Integer property for the number of seconds that should pass before a statement execution timesout. + */ + public static final String KEY_QUERY_TIMEOUT = "jdbc.timeout-query"; + /** + * Boolean property to echo the number of rows recieved from a ResultSet object. + */ + public static final String KEY_ROW_CNT_ECHO = "jdbc.echo-rowcount"; + /** + * Integer property for configuring resultset holdability. + * + * @see java.sql.Connection#setHoldability(int) + */ + public static final String KEY_JDBC_HOLDABILITY = "jdbc.resultset-holdability"; + /** + * Boolean property to turn on/off escaping processing in the JDBC driver. + */ + public static final String KEY_JDBC_ESCAPE = "jdbc.escapeProc-enabled"; + /** + * Boolean property to debug JDBC activity. + */ + public static final String KEY_JDBC_DEBUG = "jdbc.debug-enabled"; + /** + * Boolean property for enabling reverse fetching of ResultSet data. + */ + public static final String KEY_JDBC_RFETCH = "jdbc.reverseFetch-enabled"; + /** + * Integer property to configure the maximum number of rows a Statement object should return. + */ + public static final String KEY_JDBC_MAX_ROWS = "jdbc.max-rows"; + /** + * Integer property to configure the maximum field size a Statement object should return. + */ + public static final String KEY_JDBC_MAX_FIELD_SZ = "jdbc.max-fieldsize"; + /** + * Integer property to determine how deep to process chained SQLExceptions & SQLWarnings. + */ + public static final String KEY_WARNING_CHAIN_LENGTH = "jdbc.max-warnings"; + /** + * Boolean property that determines if the resultset toolbar is enabled or not. + */ + public static final String KEY_TB_RESSET_VISIBLE = "toolbar.resultset-visible"; + /** + * Boolean property that determines if the main toolbar is enabled or not. + */ + public static final String KEY_TB_FILE_VISIBLE = "toolbar.file-visible"; + /** + * Boolean property that determines if the SQL editor toolbar is enabled or not. + */ + public static final String KEY_TB_HISTORY_VISIBLE = "toolbar.history-visible"; + /** + * String property that determines the location of the resultset toolbar e.g. NORTH,SOUTH,EAST,WEST + */ + public static final String KEY_TB_RESSET_DOCK = "toolbar.resultset-dock"; + /** + * String property that determines the location of the main toolbar e.g. NORTH,SOUTH,EAST,WEST + */ + public static final String KEY_TB_FILE_DOCK = "toolbar.file-dock"; + /** + * String property that determines the location of the SQL Editor toolbar e.g. NORTH,SOUTH,EAST,WEST + */ + public static final String KEY_TB_HISTORY_DOCK = "toolbar.history-dock"; + /** + * Boolean property for wether all classes are shown in the service manager or only those in the classpath. + */ + public static final String KEY_SERVICE_DRIVERS_VISIBLE = "general.alldrivers-visible"; + /** + * Boolean property for switching tabs when a new service is selected in the service manager. + */ + public static final String KEY_SERVICE_SWITCH_ON_CHANGE = "servicemanager.switchtab-enabled"; + /** + * Boolean property to ensure that the JDBC driver listing is always sorted or not. + */ + public static final String KEY_DRIVERS_AUTOSORT = "general.driversort-enabled"; + /** + * Boolean property that allows the current driver.properties file to overwritten when a new version is installed. + */ + public static final String KEY_DRIVERS_AUTOUPDATE = "general.driverupdate-enabled"; + /** + * Boolean property to scan service paths for service files when iSQL-Viewer is started. + */ + public static final String KEY_SERVICE_AUTODETECT = "general.servicescan-enabled"; + /** + * String property of the fully qualified class name of the desired LookAndFeel to use. + */ + public static final String KEY_LOOK_N_FEEL = "general.plaf-class"; + /** + * Boolean property for using large 24x24 or smaller 16x16 icons. + */ + public static final String KEY_USE_LARGE_ICONS = "general.large-icons"; + /** + * Boolean property that enables a single click sort of tables otherwise a double-click is required. + */ + public static final String SINGLE_CLICK_SORTING = "general.1clicksort-enabled"; + /** + * String property that is the format for the tabs of ResultSets so that they can be easily identified. + */ + public static final String KEY_RESSET_TAB_FMT = "general.results-format"; + /** + * Boolean property for saving session oriented information such as last selection, and window locations. + */ + public static final String KEY_ENABLE_METRICS = "general.metrics-enabled"; + /** + * String property that is a localized path of directories and files to load classes from. + */ + public static final String KEY_EXTRA_CLASSPATH = "advanced.classpath"; + /** + * String property that is a localized path of directories to load iSQL services. + */ + public static final String KEY_SERVICES_PATH = "advanced.servicepath"; + /** + * Color property to that is used to highlight null values returned from ResultSet objects. + */ + public static final String KEY_NULL_HIGHLIGHT = "general.null-color"; + /** + * Boolean property that will reuse that same tab when refreshing a previously executed statement. + */ + public static final String REUSE_TAB_ON_REFRESH = "general.refresh-reuse"; + /** + * Boolean property that will clear the SQL Editor upon execution of an SQL statement. + */ + public static final String KEY_EDITOR_AUTO_CLEAR = "editor.autoclear-enabled"; + + /** + * Boolean for enabling/disabling context-sensitive help in the main editor. + */ + public static final String EDITOR_CONTEXT_HELP = "editor.context-help.enabled"; + /** + * Boolean for enabling/disabling syntax highlighting in the main editor. + */ + public static final String EDITOR_SYNTAX_HELP = "editor.syntax-help.enabled"; + /** + * Boolean property to determine if the caret style is row:column or :location. + */ + public static final String KEY_EDITOR_CARET_STYLE = "editor.caretoffset-enabled"; + /** + * Color property for the SQL editor's foreground. + */ + public static final String STYLE_BASE_COLOR = "editor.default-color"; + /** + * Color property for the SQL editor's background. + */ + public static final String EDITOR_DEFAULT_COLOR = "editor.background-color"; + /** + * Color property for syntax highlighting of table,views, and procedure names along other JDBC objects. + */ + public static final String STYLE_LOCAL_OBJ = "editor.local-obj"; + /** + * Color property for syntax highlighting of SQL keywords. + */ + public static final String STYLE_SQL_KEWORDS = "editor.sql-keywords"; + /** + * Color property for syntax highlighting single line comments. + */ + public static final String STYLE_SLINE_CMNTS = "editor.sline-comments"; + /** + * Color property for syntax highlighting of string literals. + */ + public static final String STYLE_LITERALS = "editor.literals"; + /** + * Color property for syntax highlighting of sql functions. + */ + public static final String STYLE_FUNCTIONS = "editor.functions"; + /** + * Color property for syntax highlighting of sql & parameters. + */ + public static final String STYLE_PARAMETERS = "editor.parameters"; + /** + * Style preference for tablespace words like catalogs, and schema names. + */ + public static final String STYLE_TABLESPACE = "editor.tablespace"; + + public static final String STYLE_PROCEDURES = "editor.procedures"; + public static final String STYLE_FOREIGN_OBJ = "editor.foreign-obj"; + /** + * Font property for the SQL editor. + */ + public static final String KEY_EDITOR_FONT = "editor.font"; + /** + * Color property for syntax highlighting of multi-line commets such as /** comments + */ + public static final String STYLE_MLINE_CMNTS = "editor.multicomment-color"; + /** + * Color property for the Syste console foreground color. + */ + public static final String KEY_CONSOLE_FG_COLOR = "console.foreground-color"; + /** + * Default color for the console foreground. + */ + public static final String DEF_CONSOLE_FG_COLOR = StringUtilities.getHTMLColor(UIManager + .getColor("TextArea.foreground")); + + /** + * Color property for the System console background color. + */ + public static final String KEY_CONSOLE_BG_COLOR = "console.background-color"; + /** + * Default color for the console background. + */ + public static final String DEF_CONSOLE_BG_COLOR = StringUtilities.getHTMLColor(UIManager + .getColor("TextArea.background")); + + /** + * Color property of text that is printed using the System.out PrintStream. + */ + public static final String KEY_CONSOLE_SYS_COLOR = "console.sys-color"; + /** + * Color property of text that is printed using the System.err PrintStream. + */ + public static final String KEY_CONSOLE_ERR_COLOR = "console.err-color"; + /** + * Default HTML color for displaying errors in the iSQL-Viewer console. + */ + public static final String DEF_CONSOLE_ERR_COLOR = "#FF0000"; + + /** + * Color property for displaying text printed using the JDBC tracing streams. + */ + public static final String KEY_CONSOLE_SQL_COLOR = "console.sql-color"; + /** + * Font property for the iSQL console component. + */ + public static final String KEY_CONSOLE_FONT = "console.font"; + /** + * Default font property to use if none is previously set. + */ + public static final String DEF_CONSOLE_FONT = "Monospaced,11"; + + public static final String DEF_CONSOLE_SQL_COLOR = "#0000FF"; + + /** + * String property that is the format of time in which to prepend to text being displayed. + */ + public static final String KEY_CONSOLE_TIME_FMT = "console/timestamp-format"; + /** + * Default time format if no preference is previously set. + */ + public static final String DEF_CONSOLE_TIME_FMT = "[HH:mm:ss]"; + + /** + * Integer property that determines which kind of history set to use. + */ + public static final String KEY_HISTORY_STYLE = "history.style"; + /** + * Integer property for the maximum number of days to keep a history item. + */ + public static final String KEY_HISTORY_MAX_DAYS = "history.max-days"; + /** + * Integer property for the maximum number of history items to manage at a time. + */ + public static final String KEY_HISTORY_MAX_COUNT = "history.max-count"; + /** + * Boolean property for browsing history items to be circular or not. + */ + public static final String KEY_HISTORY_CONTINUOUS = "history.circular-enabled"; + /** + * Boolean property that will discard duplicate history items. + */ + public static final String KEY_HISTORY_DISCARD_DUPES = "history.duplicates-enabled"; + /** + * Boolean property for enabling/disabling the use of CRC32 when detecting duplicate history items. + */ + public static final String KEY_HISTORY_USECRC32 = "history.crc32-enabled"; + /** + * Boolean property to determine if the history items of the current session are kept when manually cleared. + */ + public static final String KEY_HISTORY_CLEAR_SESSION = "history.sessionclear-enabled"; + /** + * Boolean property that enables a history that is not persisted to disk. + */ + public static final String KEY_HISTORY_SESSION_ONLY = "history.persistent-enabled"; + /** + * Boolean property that enabled the showing of hidden files when selecting a file or directory. + */ + public static final String KEY_SHOW_HIDDEN_FILES = "general.hiddenfiles-enabled"; + /** + * Integer property that sets the maximum number of ResultSets before unlocked tabs are reused. + */ + public static final String MAX_QUERY_VIEWS = "general.max-resultsets"; + /** + * Integer property of how tables are spread out across mutliple pages. + */ + public static final String KEY_PRINT_GRID_STYLE = "print.table-style"; + /** + * Boolean property to use color over monochrome when printing. + */ + public static final String KEY_PRINT_USE_COLOR = "print.color-enabled"; + /** + * Boolean property to include the table gridlines when printing. + */ + public static final String KEY_PRINT_GRID = "print.grid-enabled"; + /** + * Boolean property to include footer information on each page when printing. + */ + public static final String KEY_PRINT_FOOTER = "print.footer-enabled"; + /** + * Boolean property to include header information on each page when printing. + */ + public static final String KEY_PRINT_HEADER = "print.header-enabled"; + /** + * Boolean property that indicates the global preference of keeping iSQL service passwords secure. + */ + public static final String KEY_ENABLE_SECURITY = "general.security-enabled"; + /** + * String property that is used to seperate SQL statements when parsing batch files. + */ + public static final String KEY_BATCH_SEPERATOR = "batch.seperator-char"; + /** + * String property that is used to ignore data based on this value. + */ + public static final String KEY_BATCH_COMMENT = "batch.comment-char"; + /** + * String property used to identify string literals when parsing batch files. + */ + public static final String KEY_BATCH_LITERAL = "batch.literal-char"; + /** + * Integer property that indicates how statements are seperated in batch files. + */ + public static final String KEY_BATCH_SEPERATOR_STYLE = "batch.seperator-style"; + /** + * Integer property for the kind of comments to support when parsing batch files. + */ + public static final String KEY_BATCH_COMMENT_STYLE = "batch.comment-style"; + /** + * Integer property for the kind of literal style to used for parsing batch files. + */ + public static final String KEY_BATCH_LITERAL_STYLE = "batch.literal-style"; + /** + * Boolean property that will force all text into lower case form when parsing batch files. + */ + public static final String KEY_BATCH_FORCE_LC = "batch.lowercase-enable"; + /** + * Integer property to determine the page size of larger tables so that they can render faster. + */ + public static final String TABLE_PAGING_SIZE = "general.tablepage-size"; + /** + * String property for the preferred input/output format of Time values. + */ + public static final String KEY_FORMAT_TIME = "general.time-format"; + /** + * String property for the preferred input/output format of Timestamp values + */ + public static final String KEY_FORMAT_TIMESTAMP = "general.timestamp-format"; + /** + * String property for the preferred input/output format of Date values. + */ + public static final String KEY_FORMAT_DATE = "general.date-format"; + /** + * Boolean property to allow the double-click execution of SQL bookmarks. + */ + public static final String KEY_BOOKMARK_ACTIVATE_STYLE = "bookmark.activation-style"; + /** + * String property that is the preferred location of the bookmark drawer, ie Right, Left. + */ + public static final String KEY_BOOKMARK_LOCATION = "bookmark.location"; + /** + * Boolean property that determines wether to warn the user before deleting bookmarks, and folders. + */ + public static final String KEY_BOOKMARK_DELETE_WARNING = "bookmarks.deletewarning-enabled"; + /** + * Boolean property to enable debugging withing the ScriptManager. + */ + public static final String KEY_SCRIPT_DEBUG = "scripting.debug-enabled"; + /** + * String property of a localized path of directories to load scripts from. + */ + public static final String KEY_SCRIPT_PATHS = "scripting.path"; + /** + * Boolean property to filter out files that are not known to the script manager. + */ + public static final String KEY_SCRIPT_FILTER_FILES = "scripting.filefilter-enabled"; + /** + * String property for the preferred HTTP proxy host. + */ + public static final String KEY_HTTP_PROXY_HOST = "advanced.httpproxy-host"; + /** + * Integer property for the HTTP proxy port of use on the proxy host. + */ + public static final String KEY_HTTP_PROXY_PORT = "advanced.httpproxy-port"; + /** + * String property of the HTTP proxy user name to use. + */ + public static final String KEY_HTTP_PROXY_USER = "advanced.httpproxy-user"; + /** + * String property for the HTTP proxy password to use. + */ + public static final String KEY_HTTP_PROXY_PASSW = "advanced.httpproxy-pass"; + /** + * This value will indicate the prefix of session proeprties so it is easy to filter them out when preferences are + * saved to disk. + */ + public static final String KEY_SESSION_PREFIX = "session."; + /** + * String value that is that last accessed file used. + */ + public static final String KEY_SES_LAST_FILE = "session.last-location"; + /** + * Boolean property to enable ASCII compatibility for UNICODE characters whenever nessecary. + * <p> + * Generally if this preference is true, there will be automatic encoding and decoding of ASCII UNICODE escape + * sequences of the form '\ uXXXX' where XXXX is the UNICODE value. + */ + public static final String KEY_USE_ASCII_COMPATIBILITY = "general.ascii2native-enabled"; + /** + * Boolean property to show statement that return an update count as a tab. + * <p> + * When a query is executed in the main SQLWOrkbench, this is true a tab will be created showing the updated count, + * and will have to be removed manually. otherwise if this is false the update count will be echoed to the + * System.out which ends up in the console window. + */ + public static final String KEEP_UPDATE_RESULTS = "general.showupdatetab-enabled"; + + private UserOptions() { + + // nothing to do here.// + } + +} Modified: isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-05-17 01:52:10 UTC (rev 55) +++ isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-05-17 02:06:10 UTC (rev 56) @@ -42,6 +42,12 @@ public interface ResultSetRenderer { /** + * Basic initialization method to allocate resource prior to executing a query. + * <p> + */ + public void initialize(); + + /** * Allows the renderer to substitute the variable by name with something else. * <p> * When an SQL Statement is executed and inline variables in the Jav variable form of ${variable.name} are detect @@ -117,7 +123,7 @@ * * @param stmtID unique identifier for the statement currently executing. */ - public void statementInitialized(String stmtID); + public void statementInitialized(String stmtID, Statement statement); /** * Determines if this object wants to view generated keys. @@ -162,7 +168,7 @@ * @param set ResultSet as the source of the Exception, can be null. * @param e Exception that has occured. */ - public void handleSQLException(ResultSet set, SQLException e); + public void handleSQLException(SQLException e); /** * handler if the statement has been interrupted or cancelled. @@ -176,7 +182,7 @@ * * @param stmtID unqiue identifier for the statement that was cancelled. */ - public void handleStatementInterrupted(String stmtID); + public void finalizeStatement(String stmtID); /** * Statement warnings from a resultset can be delegated here. Modified: isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java 2007-05-17 01:52:10 UTC (rev 55) +++ isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java 2007-05-17 02:06:10 UTC (rev 56) @@ -36,14 +36,18 @@ class NullResultSetViewer implements ResultSetRenderer { - public void handleSQLException(ResultSet set, SQLException e) { + public void initialize() { } - public void handleStatementInterrupted(Strin... [truncated message content] |
From: <mk...@us...> - 2007-05-17 01:52:09
|
Revision: 55 http://svn.sourceforge.net/isql/?rev=55&view=rev Author: mkobold Date: 2007-05-16 18:52:10 -0700 (Wed, 16 May 2007) Log Message: ----------- * Added nessecary classes for launching iSQL-Viewer and integrating properly with the desktop of a Mac OS X OS. Added Paths: ----------- isql-mrj/trunk/.classpath isql-mrj/trunk/.project isql-mrj/trunk/src/ isql-mrj/trunk/src/org/ isql-mrj/trunk/src/org/isqlviewer/ isql-mrj/trunk/src/org/isqlviewer/mrj/ isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java isql-mrj/trunk/support/ isql-mrj/trunk/support/Launch Aqua iSQL-Viewer.launch Property Changed: ---------------- isql-mrj/trunk/ Property changes on: isql-mrj/trunk ___________________________________________________________________ Name: svn:ignore + bin Added: isql-mrj/trunk/.classpath =================================================================== --- isql-mrj/trunk/.classpath (rev 0) +++ isql-mrj/trunk/.classpath 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/isql-core"/> + <classpathentry combineaccessrules="false" kind="src" path="/isql-swing"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: isql-mrj/trunk/.project =================================================================== --- isql-mrj/trunk/.project (rev 0) +++ isql-mrj/trunk/.project 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>isql-mrj</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java (rev 0) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/AquaLauncher.java 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,140 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.mrj; + +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.FileNotFoundException; + +import javax.swing.UIManager; + +import org.isqlviewer.sql.embedded.EmbeddedDatabase; +import org.isqlviewer.swing.action.SharedActions; +import org.isqlviewer.swing.action.SwingEventManager; +import org.isqlviewer.ui.ApplicationFrame; +import org.isqlviewer.util.IsqlToolkit; + +import com.apple.eawt.Application; +import com.apple.eawt.ApplicationAdapter; +import com.apple.eawt.ApplicationEvent; +import com.apple.eio.FileManager; + +/** + * Launcher class for starting the iSQL-Viewer application on Mac OS X. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class AquaLauncher extends ApplicationAdapter { + + public static final short kSystemDomain = -32766; + public static final short kLocalDomain = -32765; + public static final short kNetworkDomain = -32764; + public static final short kClassicDomain = -32762; + public static final short kUserDomain = -32763; + + private SwingEventManager eventManager = null; + + public AquaLauncher(SwingEventManager eventManager) { + + this.eventManager = eventManager; + } + + public static void main(String[] args) { + + String applicationSupport = null; + try { + short domain = Domain.USER.value(); + int folderType = FolderType.APPLICATION_SUPPORT.value(); + applicationSupport = FileManager.findFolder(domain, folderType, true); + } catch (FileNotFoundException error) { + error.printStackTrace(); + return; + } + File homeDirectory = new File(applicationSupport, "iSQL-Viewer"); + homeDirectory.mkdirs(); + System.setProperty(IsqlToolkit.PROPERTY_MRJ_ENABLED, "true"); + System.setProperty(IsqlToolkit.PROPERTY_HOME, homeDirectory.getAbsolutePath()); + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", "iSQL-Viewer"); + System.setProperty("com.apple.mrj.application.live-resize", "true"); + + Application appliactionInstance = Application.getApplication(); + appliactionInstance.setEnabledAboutMenu(true); + appliactionInstance.setEnabledPreferencesMenu(false); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Throwable error) { + error.printStackTrace(); + return; + } + // ensure that the embedded database driver is available // + EmbeddedDatabase.getSharedInstance(); + ApplicationFrame frame = new ApplicationFrame(); + appliactionInstance.addApplicationListener(new AquaLauncher(frame.getSwingEventManager())); + frame.setVisible(true); + } + + @Override + public void handleAbout(ApplicationEvent event) { + + } + + @Override + public void handleOpenApplication(ApplicationEvent event) { + + } + + @Override + public void handleOpenFile(ApplicationEvent event) { + + } + + @Override + public void handlePreferences(ApplicationEvent event) { + + } + + @Override + public void handlePrintFile(ApplicationEvent event) { + + } + + @Override + public void handleQuit(ApplicationEvent event) { + + ActionEvent action = new ActionEvent(event.getSource(), SharedActions.EXIT_APPLICATION, ""); + eventManager.actionPerformed(action); + } + + @Override + public void handleReOpenApplication(ApplicationEvent event) { + + } +} \ No newline at end of file Added: isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java (rev 0) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/Domain.java 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,75 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.mrj; + +/** + * Enumeration of Mac OS X Folder domains + * <p> + * These types are used for the FileManager class in getting access to system folders. + * <p> + * I take no credit in the calculation of the names or values as i got them off of a list in the apple developer + * mailings [http://lists.apple.com/archives/Java-dev/2003/Apr/msg00460.html] + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public enum Domain { + /** + * + */ + SYSTEM((short) -32766), + /** + * + */ + LOCAL((short) -32765), + /** + * + */ + NETWORK((short) -32764), + /** + * + */ + CLASSIC((short) -32762), + /** + * + */ + USER((short) -32763); + + private short value = -1; + + private Domain(short value) { + + this.value = value; + + } + + public short value() { + + return value; + } +} \ No newline at end of file Added: isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java =================================================================== --- isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java (rev 0) +++ isql-mrj/trunk/src/org/isqlviewer/mrj/FolderType.java 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,139 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.mrj; + +/** + * Enumeration of Mac OS X Folder types + * <p> + * These types are used for the FileManager class in getting access to system folders. + * <p> + * I take no credit in the calculation of the names or values as i got them off of a list in the apple developer + * mailings [http://lists.apple.com/archives/Java-dev/2003/Apr/msg00460.html] + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public enum FolderType { + /** + * + */ + SYSTEM("macs"), + /** + * + */ + DESKTOP("desk"), + /** + * + */ + SYSTEM_DESKTOP("sdsk"), + /** + * + */ + TRASH("trsh"), + /** + * + */ + SYSTEM_TRASH("strs"), + /** + * + */ + WHERE_TO_EMPTY_TRASH("empt"), + /** + * + */ + PRINT_MONITOR("prnt"), + /** + * + */ + STARTUP("strt"), + /** + * + */ + SHUTDOWN("shdf"), + /** + * + */ + APPLE_MENU("amnu"), + + /** + * + */ + CONTROL_PANEL("ctrl"), + /** + * + */ + SYSTEM_CONTROL_PANEL("sctl"), + /** + * + */ + EXTENSIONS("extn"), + /** + * + */ + FONT("font"), + /** + * + */ + PREFERENCES("pref"), + /** + * + */ + SYSTEM_PREFERENCES("sprf"), + /** + * + */ + TEMP("temp"), + /** + * + */ + APPLICATION_SUPPORT("asup"); + + private int value = 0; + + private FolderType(String typeStr) { + + if (typeStr == null || typeStr.length() != 4) { + this.value = 0; + } else { + int type = 0; + byte[] bytes = typeStr.getBytes(); + for (int i = 0; i < 4; i++) { + int t = bytes[i]; + t &= 0xFF; + t <<= (3 - i) * 8; + type |= t; + } + this.value = type; + } + } + + public int value() { + + return value; + } +} Added: isql-mrj/trunk/support/Launch Aqua iSQL-Viewer.launch =================================================================== --- isql-mrj/trunk/support/Launch Aqua iSQL-Viewer.launch (rev 0) +++ isql-mrj/trunk/support/Launch Aqua iSQL-Viewer.launch 2007-05-17 01:52:10 UTC (rev 55) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.isqlviewer.mrj.AquaLauncher"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="isql-mrj"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/isql-mrj"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +</launchConfiguration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-05-17 00:31:08
|
Revision: 54 http://svn.sourceforge.net/isql/?rev=54&view=rev Author: mkobold Date: 2007-05-16 17:31:06 -0700 (Wed, 16 May 2007) Log Message: ----------- Added isql-mrj for the Mac OS X specific launcher classes. Added Paths: ----------- isql-mrj/ isql-mrj/branches/ isql-mrj/tags/ isql-mrj/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 23:05:36
|
Revision: 53 http://svn.sourceforge.net/isql/?rev=53&view=rev Author: mkobold Date: 2007-04-30 16:05:36 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * added missing file from previos commit Added Paths: ----------- isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandMouseAdapter.java Added: isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandMouseAdapter.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandMouseAdapter.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandMouseAdapter.java 2007-04-30 23:05:36 UTC (rev 53) @@ -0,0 +1,130 @@ +package org.isqlviewer.ui; + +import java.awt.Cursor; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +import javax.swing.JEditorPane; +import javax.swing.SwingUtilities; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.MouseInputAdapter; +import javax.swing.text.AttributeSet; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.Position; + +public class SqlCommandMouseAdapter extends MouseInputAdapter { + + /** + * This is used by viewToModel to avoid allocing a new array each time. + */ + private Position.Bias[] bias = new Position.Bias[1]; + + public void mouseClicked(MouseEvent e) { + + JEditorPane editor = (JEditorPane) e.getSource(); + if (SwingUtilities.isLeftMouseButton(e)) { + Point pt = new Point(e.getX(), e.getY()); + int pos = editor.viewToModel(pt); + if (pos >= 0) { + DefaultStyledDocument document = (DefaultStyledDocument) editor.getDocument(); + AttributeSet as = document.getCharacterElement(pos).getAttributes(); + if (Boolean.TRUE == as.getAttribute("hyperlinked")) { + activateLink(pos, editor, e.getX(), e.getY()); + } + } + } + } + + public void mouseMoved(MouseEvent e) { + + JEditorPane editor = (JEditorPane) e.getSource(); + + Point pt = new Point(e.getX(), e.getY()); + int pos = editor.getUI().viewToModel(editor, pt, bias); + if (bias[0] == Position.Bias.Backward && pos > 0) { + pos--; + } + boolean setCursor = false; + if (pos >= 0) { + DefaultStyledDocument document = (DefaultStyledDocument) editor.getDocument(); + AttributeSet as = document.getCharacterElement(pos).getAttributes(); + if ((e.getModifiers() & org.isqlviewer.swing.SwingUtilities.MENU_SHORTCUT_MASK) == org.isqlviewer.swing.SwingUtilities.MENU_SHORTCUT_MASK) { + if (Boolean.TRUE == as.getAttribute("hyperlinked")) { + setCursor = true; + } + } + } + if (setCursor) { + editor.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + editor.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + } + } + + private void activateLink(int pos, JEditorPane editor, int x, int y) { + + String text = editor.getText(); + int currentLocation = Math.min(text.length() - 1, pos); + currentLocation = Math.max(0, currentLocation); + + int fromIndex = 0; + int toIndex = text.length() - 1; + for (int i = currentLocation; i >= 0; i--) { + char c = text.charAt(i); + if (Character.isWhitespace(c)) { + fromIndex = i; + break; + } + } + boolean found = false; + for (int i = currentLocation; i < toIndex; i++) { + char c = text.charAt(i); + if (Character.isWhitespace(c)) { + toIndex = i; + found = true; + break; + } + } + if (!found) { + toIndex = text.length(); + } + + String currentWord = text.substring(fromIndex, toIndex).trim(); + if (currentWord.length() == 0) { + return; + } + URL url; + try { + url = new URL("table", null, -1, currentWord, new InternalURLStreamHandler()); + HyperlinkEvent hle = new HyperlinkEvent(editor, HyperlinkEvent.EventType.ACTIVATED, url); + editor.fireHyperlinkUpdate(hle); + } catch (MalformedURLException e) { + } + } + + private static class InternalURLStreamHandler extends URLStreamHandler { + + @Override + protected URLConnection openConnection(URL u) throws IOException { + + return new NullURLConnection(u); + } + } + + private static class NullURLConnection extends URLConnection { + + protected NullURLConnection(URL url) { + + super(url); + } + + public void connect() { + + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:37:49
|
Revision: 52 http://svn.sourceforge.net/isql/?rev=52&view=rev Author: mkobold Date: 2007-04-30 15:37:49 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * Lots of changes; honestly to lazy to outline them all. ** Updated and Simplified the icon set ** Updated the wizard system. ** Filled out the new service wizard ** Lots of UI changes and improvements. Modified Paths: -------------- isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTable.java isql-swing/trunk/src/org/isqlviewer/swing/JTextPopup.java isql-swing/trunk/src/org/isqlviewer/swing/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java isql-swing/trunk/src/org/isqlviewer/swing/WizardPanel.java isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/OverwriteToggleAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java isql-swing/trunk/src/org/isqlviewer/swing/action/SwingEventManager.java isql-swing/trunk/src/org/isqlviewer/swing/outline/JOutline.java isql-swing/trunk/src/org/isqlviewer/swing/outline/TreeTableModelAdapter.java isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/text/SyntaxStylizer.java isql-swing/trunk/src/org/isqlviewer/ui/AbstractApplicationView.java isql-swing/trunk/src/org/isqlviewer/ui/BookmarkEditor.java isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandEditor.java isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/ThrowableView.java isql-swing/trunk/src/org/isqlviewer/ui/WizardRunner.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/BookmarkTreeDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/ResultSetRendererDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedTableCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/HistoryTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/SchemaTreeListener.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/BookmarkTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTableCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/JDBCTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/AbstractWizardStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/WizardContext.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfigureBasicServiceOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmUpdateService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceFunctionStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ServiceWizard.java Added Paths: ----------- isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/application.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark_add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_cancel.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_ok.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/catalog.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/close_view.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/database.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/day_of_month.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_batch.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_insert.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_update.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/disconnect.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_clear.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_copy.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_cut.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_paste.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/exit.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/export.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fatal_error.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fileexport.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder_add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history_clear.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/import.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/information.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/locked.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/null_data.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/options.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/query.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/question.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/redo.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/reload.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/search.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service_manager.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/spacer.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/stack_trace_element.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_columns.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_info.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_keys.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/undo.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/unlocked.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/user.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/warning.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark_add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_cancel.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_ok.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/catalog.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/close_view.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/database.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/day_of_month.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_batch.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_insert.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_update.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/disconnect.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_clear.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_copy.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_cut.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_delete.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_paste.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/exit.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder_add.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/history.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/information.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/locked.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/null_data.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/options.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/procedure.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/procedure_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/query.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/question.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/redo.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/reload.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/search.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/service.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/service_manager.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/table.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/table_columns.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/table_keys.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/table_set.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/undo.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/user.png isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/warning.png isql-swing/trunk/src/org/isqlviewer/ui/JdbcSchemaTreeRefreshable.java isql-swing/trunk/src/org/isqlviewer/ui/VariableSubstitutor.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/TextComponentDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/ThrowableTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/ThrowableTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/DriverPropertyOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ServiceProfileOptions.java Removed Paths: ------------- isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceType.java Modified: isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-04-30 22:25:20 UTC (rev 51) +++ isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-04-30 22:37:49 UTC (rev 52) @@ -36,8 +36,6 @@ import org.isqlviewer.bookmarks.BookmarkReference; import org.isqlviewer.sql.embedded.EmbeddedDatabase; import org.isqlviewer.swing.AbstractTreeModel; -import org.isqlviewer.ui.BookmarkEditor; -import org.isqlviewer.ui.OperationStatus; /** * Datamodel for managing Bookmark objects similar to a local-filesystem. Modified: isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-04-30 22:25:20 UTC (rev 51) +++ isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-04-30 22:37:49 UTC (rev 52) @@ -39,7 +39,6 @@ import org.isqlviewer.JdbcCommandLogger; import org.isqlviewer.history.HistoricalCommand; -import org.isqlviewer.history.HistoryReference; import org.isqlviewer.sql.embedded.EmbeddedDatabase; import org.isqlviewer.swing.outline.AbstractTreeTableModel; import org.isqlviewer.swing.outline.OutlineModel; @@ -58,21 +57,21 @@ private static final Class[] columnTypes = {OutlineModel.class, Date.class}; - private final TreeMap<Date, List<HistoryReference>> rootNode = new TreeMap<Date, List<HistoryReference>>(); + private final TreeMap<Date, List<HistoricalCommand>> rootNode = new TreeMap<Date, List<HistoricalCommand>>(); private final List<Date> rootKeySet = new Vector<Date>(); public HistoryTreeModel() { } - public void addReference(HistoryReference reference) { + public void addReference(HistoricalCommand reference) { Date normalizedDate = normalizeTimestamp(reference.getQueryTime()); - List<HistoryReference> set = null; + List<HistoricalCommand> set = null; synchronized (rootNode) { set = rootNode.get(normalizedDate); if (set == null) { - set = new Vector<HistoryReference>(); + set = new Vector<HistoricalCommand>(); rootNode.put(normalizedDate, set); rootKeySet.add(normalizedDate); reload(); @@ -93,6 +92,7 @@ public synchronized void clear() { rootNode.clear(); + rootKeySet.clear(); reload(); } @@ -108,6 +108,9 @@ } else if (parent instanceof Date) { List< ? > list = rootNode.get(parent); return list == null ? null : list.get(index); + } else if (parent instanceof HistoricalCommand) { + HistoricalCommand reference = (HistoricalCommand) parent; + return reference.getChildCommand(index); } return null; } @@ -119,14 +122,18 @@ } else if (parent instanceof Date) { List< ? > list = rootNode.get(parent); return list == null ? 0 : list.size(); + } else if (parent instanceof HistoricalCommand) { + HistoricalCommand reference = (HistoricalCommand) parent; + return reference.getChildCount(); } return 0; } public boolean isLeaf(Object node) { - if (node instanceof HistoryReference) { - return true; + if (node instanceof HistoricalCommand) { + HistoricalCommand reference = (HistoricalCommand) node; + return !reference.hasChildCommands(); } return false; } @@ -142,6 +149,10 @@ } else if (parent instanceof Date) { List< ? > list = rootNode.get(parent); return list == null ? -1 : list.indexOf(child); + } else if (parent instanceof HistoricalCommand) { + HistoricalCommand reference = (HistoricalCommand) parent; + HistoricalCommand subCommand = (HistoricalCommand) child; + return reference.indexOf(subCommand); } return -1; } @@ -182,7 +193,7 @@ EmbeddedDatabase edb = EmbeddedDatabase.getSharedInstance(); try { - HistoryReference reference = edb.addHistoricalCommand(command); + HistoricalCommand reference = edb.addHistoricalCommand(command); addReference(reference); } catch (SQLException e) { } Modified: isql-swing/trunk/src/org/isqlviewer/model/ResourceBundle.properties =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/ResourceBundle.properties 2007-04-30 22:25:20 UTC (rev 51) +++ isql-swing/trunk/src/org/isqlviewer/model/ResourceBundle.properties 2007-04-30 22:37:49 UTC (rev 52) @@ -17,4 +17,9 @@ schema.userdatatypes_java_object.node=JavaObject Types schema.userdatatypes_struct.node=Struct Types #This node is an internal node but can show up to the user it should say something to let the user now the application is loading data. -schema.noncached.node=[Loading Data] \ No newline at end of file +schema.noncached.node=[Loading Data] + + +ThrowableOutlineModel.stacktrace_column.header=Stacktrace Element +ThrowableOutlineModel.sqlstate_column.header=SQL State +ThrowableOutlineModel.sqlerror_column.header=SQL Error \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-04-30 22:25:20 UTC (rev 51) +++ isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-04-30 22:37:49 UTC (rev 52) @@ -50,7 +50,7 @@ /** * Table Type node that is usually of the form INDEX, TABLE, VIEW, SYNONYM, and etc. */ - TABLE_TYPE("query"), + TABLE_TYPE("table_set"), /** * Table node that is a a child of TABLE_TYPE, and represents a database table or view usually. */ @@ -58,90 +58,90 @@ /** * Index information for a given table, this node is usually a child of a TABLE node. */ - INDEX("tableinfo"), + INDEX("table_info"), /** * Node that shows that the current table has primary keys defined. */ - PRIMARY_KEYS("keytable"), + PRIMARY_KEYS("table_keys"), /** * Node that shows that other tables that rely on the primary keys defined within the table. */ - EXPORTED_KEYS("keytable"), + EXPORTED_KEYS("table_keys"), /** * Node that shows foriegn keys from other tables that part of the table's definition. */ - IMPORTED_KEYS("keytable"), + IMPORTED_KEYS("table_keys"), /** * If tables is defined in a hierarchial fashion then this node shows the parent tables for the current one. */ - SUPER_TABLES("tableinfo"), + SUPER_TABLES("table_info"), /** * Node to indicate that this table defines columns that are automatically updated when any row is updated. */ - VERSION_COLUMNS("tableinfo"), + VERSION_COLUMNS("table_info"), /** * Node for indicating that the table has defined security constraints on the table. */ - TABLE_PRIVILIGES("tableinfo"), + TABLE_PRIVILIGES("table_info"), /** * Node that indicates that the current table has column specific priviliges defined. */ - COLUMN_PRIVILIGES("tableinfo"), + COLUMN_PRIVILIGES("table_info"), /** * This node type is a place holder for representing the parent column node for the actual column type. * <p> * The children for this node are loaded on demand by the user. */ - COLUMN_SET("tablecolumns"), + COLUMN_SET("table_columns"), /** * Node that represents a column in a table, the parent node type is acutually a COLUMN_SET. */ - COLUMN("about"), + COLUMN("table_info"), /** * This node type is a place holder as the parent node for stored procedure for the actual procedure type. */ - PROCEDURE_SET("stored_procedure_folder"), + PROCEDURE_SET("procedure_set"), /** * Node that represents a stored procedure definied in the current catalog and or schema. * <p> * The children for this node are loaded on demand by the user. */ - PROCEDURE("script"), + PROCEDURE("procedure"), /** * This node type is a place holder as the parent node for data types that are allowed by the current database. * <p> * The childeren for this node are loaded on demand by the user. */ - DATA_TYPE_SET("datatypeset"), + DATA_TYPE_SET("data_type_set"), /** * Node the represents a data type defined by the current database. */ - DATA_TYPE("datatype"), + DATA_TYPE("data_type"), /** * This node type is a place holder as the parent node for user data types that are defined in the current * catalog/schema. * <p> */ - UDT_SET("datatypeset"), + UDT_SET("folder"), /** * This node type is a place holder as the parent node for user data types are DISTINCT types. * <p> */ - UDT_SET_DISTINCT, + UDT_SET_DISTINCT("folder"), /** * This node type is a place holder as the parent node for user data types are JAVA_OBJECT types. * <p> */ - UDT_SET_JAVA_OBJECT, + UDT_SET_JAVA_OBJECT("folder"), /** * This node type is a place holder as the parent node for user data types are STRUCT types. * <p> */ - UDT_SET_STRUCT, + UDT_SET_STRUCT("folder"), /** * A node that represents a user data type that is supported by the current schema/catalog. */ - UDT("datatype"); + UDT("data_type"); private String preferredIcon = null; Added: isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/model/ThrowableOutlineModel.java 2007-04-30 22:37:49 UTC (rev 52) @@ -0,0 +1,172 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.model; + +import java.sql.SQLException; +import java.util.Vector; + +import javax.swing.tree.TreePath; + +import org.isqlviewer.swing.outline.AbstractTreeTableModel; +import org.isqlviewer.swing.outline.OutlineModel; +import org.isqlviewer.util.LocalMessages; + +/** + * Outline model for showing exceptions in a tree-table fashion. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class ThrowableOutlineModel extends AbstractTreeTableModel { + + private static final Class[] columnTypes = {OutlineModel.class, String.class, String.class}; + private static final String RESOURCE_BUNDLE = "org.isqlviewer.model.ResourceBundle"; + + private Object root = new Object(); + private LocalMessages messages = new LocalMessages(RESOURCE_BUNDLE); + private Vector<Throwable> errorChain = new Vector<Throwable>(); + + public ThrowableOutlineModel(Throwable error) { + + errorChain.add(error); + Throwable sourceError = error; + Throwable nextError = getCause(sourceError); + while (nextError != null && nextError != sourceError) { + errorChain.add(nextError); + sourceError = nextError; + nextError = getCause(sourceError); + } + } + + public Class getColumnClass(int column) { + + return columnTypes[column]; + } + + public int getColumnCount() { + + return columnTypes.length; + } + + public String getColumnName(int column) { + + switch (column) { + case 0 : + return messages.format("ThrowableOutlineModel.stacktrace_column.header"); + case 1 : + return messages.format("ThrowableOutlineModel.sqlstate_column.header"); + case 2 : + return messages.format("ThrowableOutlineModel.sqlerror_column.header"); + default : + return null; + } + } + + public Object getValueAt(Object node, int column) { + + if (node instanceof SQLException) { + SQLException sqlError = (SQLException) node; + switch (column) { + case 1 : + return sqlError.getSQLState(); + case 2 : + return Integer.toString(sqlError.getErrorCode()); + } + } else { + switch (column) { + case 1 : + return ""; + case 2 : + return ""; + } + } + return node; + } + + public Object getChild(Object parent, int index) { + + if (parent == root) { + return errorChain.elementAt(index); + } else if (parent instanceof Throwable) { + return ((Throwable) parent).getStackTrace()[index]; + } + return null; + } + + public int getChildCount(Object parent) { + + if (parent == root) { + return errorChain.size(); + } else if (parent instanceof Throwable) { + return ((Throwable) parent).getStackTrace().length; + } + return 0; + } + + public int getIndexOfChild(Object parent, Object child) { + + if (parent == root) { + return errorChain.indexOf(child); + } else if (parent instanceof Throwable) { + StackTraceElement[] stackTrace = ((Throwable) parent).getStackTrace(); + for (int i = 0; i < stackTrace.length; i++) { + String line = stackTrace[i].toString(); + if (line.equals(child)) { + return i; + } + } + } + return -1; + } + + public Object getRoot() { + + return root; + } + + public boolean isLeaf(Object node) { + + return !(node instanceof Throwable) && node != root; + } + + public void valueForPathChanged(TreePath path, Object newValue) { + + } + + private Throwable getCause(Throwable sourceError) { + + if (sourceError instanceof SQLException) { + Throwable cause = ((SQLException) sourceError).getNextException(); + if (cause != null) { + return cause; + } + } + return sourceError.getCause(); + } +} \ No newline at end of file Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/application.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/application.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark_add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/bookmark_add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_cancel.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_cancel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_ok.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/button_ok.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/catalog.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/catalog.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/close_view.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/close_view.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type_set.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/data_type_set.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/database.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/database.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/day_of_month.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/day_of_month.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_batch.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_batch.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_insert.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_insert.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_update.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/db_update.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/disconnect.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/disconnect.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_clear.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_clear.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_copy.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_copy.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_cut.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_cut.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_paste.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/edit_paste.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/exit.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/exit.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/export.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/export.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fatal_error.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fatal_error.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fileexport.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/fileexport.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder_add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/folder_add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history_clear.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/history_clear.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/import.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/import.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/information.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/information.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/locked.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/locked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/null_data.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/null_data.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/options.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/options.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure_set.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/procedure_set.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/query.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/query.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/question.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/question.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/redo.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/redo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/reload.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/reload.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/search.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/search.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service_manager.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/service_manager.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/spacer.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/spacer.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/stack_trace_element.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/stack_trace_element.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_columns.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_columns.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_info.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_info.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_keys.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_keys.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_set.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/table_set.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/undo.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/undo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/unlocked.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/unlocked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/user.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/user.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/warning.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x16/warning.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark_add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/bookmark_add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_cancel.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_cancel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_ok.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/button_ok.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/catalog.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/catalog.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/close_view.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/close_view.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type_set.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/data_type_set.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/database.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/database.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/day_of_month.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/day_of_month.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_batch.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_batch.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_insert.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_insert.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_update.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/db_update.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/disconnect.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/disconnect.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_clear.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_clear.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_copy.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_copy.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_cut.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_cut.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_delete.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_paste.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/edit_paste.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/exit.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/exit.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder_add.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/folder_add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/history.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/history.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/information.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/information.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/locked.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/locked.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/null_data.png =================================================================== (Binary files differ) Property changes on: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/null_data.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: isql-swing/trunk/src/org/isqlviewer/resource/icons/x22/options.png =================================================================== (Binary fil... [truncated message content] |
From: <mk...@us...> - 2007-04-30 22:25:19
|
Revision: 51 http://svn.sourceforge.net/isql/?rev=51&view=rev Author: mkobold Date: 2007-04-30 15:25:20 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * service_3_x.dtd ** added definition for JDBC driver properties in the service file. Modified Paths: -------------- isql-core/trunk/support/xml/service_3_x.dtd Modified: isql-core/trunk/support/xml/service_3_x.dtd =================================================================== --- isql-core/trunk/support/xml/service_3_x.dtd 2007-04-30 22:24:42 UTC (rev 50) +++ isql-core/trunk/support/xml/service_3_x.dtd 2007-04-30 22:25:20 UTC (rev 51) @@ -72,7 +72,7 @@ Used In: isql-service --> -<!ELEMENT connection-profile (query-timeout?, login-timeout?, jdbc-tracing?, preferred-schema?, preferred-catalog?, resources)> +<!ELEMENT connection-profile (query-timeout?, login-timeout?, jdbc-tracing?, preferred-schema?, preferred-catalog?, extended-properties?, resources)> <!-- Attributes for the connection-profile element. @@ -141,33 +141,23 @@ href CDATA #REQUIRED > <!-- - Base tag for defining connection based logging. + JDBC Drivers can specify their own connection properties via the DriverProperty class. + this tag contains all Driver Properties or extended properties for this connection. - Used In: isql-service - --> -<!ELEMENT connection-logging (log-home, log-size?, log-pattern?)> -<!-- - Base directory for containing the log-files. - - The actual file name of the log will be automatically determined by iSQL-Viewer. - - Used In: connection-logging - --> -<!ELEMENT log-home (#PCDATA)> + Used In: config. +--> +<!ELEMENT extended-properties (property+)> <!-- - Maximum acceptable size for log file to be before the archive is rolled over and compressed. + Generic property tag for defining a simple key/value pair. this is used in the xxx-properties tags. - This value needs to be a natural number size as in log4j systems like 10MB for 10 Megabytes, 300KB for 300 kilo-bytes. - - Used In: connection-logging. + Used In: extended-properties --> -<!ELEMENT log-size (#PCDATA)> +<!ELEMENT property EMPTY> <!-- - Logging output pattern for this service. - - This value will be text that is properly formed as specified by the PatternLayout component of log4j - http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html - - Used In: connection-logging. + name: property key name + value: value associated with the said property name. --> -<!ELEMENT log-pattern (#PCDATA)> +<!ATTLIST property + name CDATA #REQUIRED + value CDATA #REQUIRED +> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:24:41
|
Revision: 50 http://svn.sourceforge.net/isql/?rev=50&view=rev Author: mkobold Date: 2007-04-30 15:24:42 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * TestStringTokenizer.java ** Updated to reflect removed methods and new functionality Modified Paths: -------------- isql-core/trunk/test/org/isqlviewer/test/util/TestStringTokenizer.java Modified: isql-core/trunk/test/org/isqlviewer/test/util/TestStringTokenizer.java =================================================================== --- isql-core/trunk/test/org/isqlviewer/test/util/TestStringTokenizer.java 2007-04-30 22:23:03 UTC (rev 49) +++ isql-core/trunk/test/org/isqlviewer/test/util/TestStringTokenizer.java 2007-04-30 22:24:42 UTC (rev 50) @@ -88,9 +88,7 @@ int idx = 0; StringTokenizer st = new StringTokenizer("This is a 'Quoted\"String'"); st.setQuotesEnabled(true); - st.setQuoteChar('\''); assertTrue("Unexpected quote flag", st.isQuotesEnabled()); - assertEquals("Unexpected quote character", '\'', st.getQuoteChar()); assertEquals("Unexpected number of tokens", 4, st.countTokens()); while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -131,9 +129,7 @@ int idx = 0; StringTokenizer st = new StringTokenizer("This is a 'Escaped\\'Quoted String'"); st.setQuotesEnabled(true); - st.setQuoteChar('\''); assertTrue("Unexpected quote flag", st.isQuotesEnabled()); - assertEquals("Unexpected quote character", '\'', st.getQuoteChar()); assertEquals("Unexpected number of tokens", 4, st.countTokens()); while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -175,7 +171,6 @@ StringTokenizer st = new StringTokenizer( "SELECT * FROM X WHERE Y='count();'; SELECT COUNT(*) FROM X where Y <> 'select();';", ";"); st.setQuotesEnabled(true); - st.setQuoteChar('\''); assertEquals("Unexpected number of tokens", 2, st.countTokens()); while (st.hasMoreTokens()) { String token = st.nextToken(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:23:02
|
Revision: 49 http://svn.sourceforge.net/isql/?rev=49&view=rev Author: mkobold Date: 2007-04-30 15:23:03 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * ServiceDigester.java ** Corrected the read/write of JDBC driver properties. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/xml/ServiceDigester.java Modified: isql-core/trunk/src/org/isqlviewer/xml/ServiceDigester.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/xml/ServiceDigester.java 2007-04-30 22:22:00 UTC (rev 48) +++ isql-core/trunk/src/org/isqlviewer/xml/ServiceDigester.java 2007-04-30 22:23:03 UTC (rev 49) @@ -43,6 +43,8 @@ import java.util.Iterator; import java.util.Map; import java.util.Properties; +import java.util.Set; +import java.util.Map.Entry; import org.isqlviewer.sql.ConnectionProfile; import org.isqlviewer.sql.JdbcService; @@ -77,8 +79,8 @@ private static final String TAG_ROOT = "isql-service"; private static final String V2_TAG_AUTH = "authorization"; - private static final String V2_TAG_EXTP = "extended-properties"; - private static final String V2_TAG_JDBC = "jdbc-properties"; + private static final String V2_TAG_EXTENDED_PROPERTIES = "extended-properties"; + private static final String V2_APPLICATION_PROPERTIES = "jdbc-properties"; private static final String V2_TAG_RSRC = "resources"; private static final String V2_TAG_PROP = "property"; private static final String V2_TAG_JAR = "jar"; @@ -117,18 +119,17 @@ private static final String ATTRIB_URL = REMOTE_URL; - private static final byte[] xorKey = new byte[]{(byte) 0x01, (byte) 0x08, (byte) 0x10, (byte) 0x18, (byte) 0x02, - (byte) 0x0A, (byte) 0x12, (byte) 0x1A, (byte) 0x04, (byte) 0x0C, - (byte) 0x14, (byte) 0x1C, (byte) 0x06, (byte) 0x0E, (byte) 0x16, - (byte) 0x1E, (byte) 0x08, (byte) 0x10, (byte) 0x18, (byte) 0x20, - (byte) 0x0A, (byte) 0x12, (byte) 0x1A, (byte) 0x22}; + private static final byte[] xorKey = new byte[]{ + (byte) 0x01, (byte) 0x08, (byte) 0x10, (byte) 0x18, (byte) 0x02, (byte) 0x0A, (byte) 0x12, (byte) 0x1A, + (byte) 0x04, (byte) 0x0C, (byte) 0x14, (byte) 0x1C, (byte) 0x06, (byte) 0x0E, (byte) 0x16, (byte) 0x1E, + (byte) 0x08, (byte) 0x10, (byte) 0x18, (byte) 0x20, (byte) 0x0A, (byte) 0x12, (byte) 0x1A, (byte) 0x22}; private JdbcService reference = new JdbcService(); private ConnectionProfile profile = new ConnectionProfile(); - private Properties jdbcEnvironment = new Properties(); + private Properties driverProperties = new Properties(); private int documentVersion = VERSION_2; private boolean ignoreRemoteTag = false; - private boolean inProfileProperties = false; + private boolean inDriverProperties = false; private boolean inEnvironmentProperties = false; private boolean do21XDecryption = false; private StringBuffer cdataBuffer = new StringBuffer(""); @@ -268,6 +269,10 @@ profile.setLoginTimeout(Integer.parseInt(interpreted)); } else if (V3_TAG_JDBC_TRACING.equals(tag)) { profile.setTracingEnabled(Boolean.parseBoolean(interpreted)); + } else if (inDriverProperties && V2_TAG_EXTENDED_PROPERTIES.equals(tag)) { + reference.setEnvironment(driverProperties); + driverProperties.clear(); + inDriverProperties = false; } } @@ -283,6 +288,8 @@ } } reference.setName(value); + } else if (V2_TAG_EXTENDED_PROPERTIES.equals(tag)) { + inDriverProperties = true; } else if (V2_TAG_JAR.equals(tag)) { String uri = attr.getValue(V2_ATTRIB_HREF); if (uri != null && uri.trim().length() >= 1) { @@ -296,6 +303,15 @@ Boolean isEncrypted = Boolean.valueOf(attr.getValue(V3_ATTRIB_ENCRYPTED)); profile.setCredentialsPersistent(true); profile.setCredentialsSecure(isEncrypted.booleanValue()); + } else if (inDriverProperties && V2_TAG_PROP.equals(tag)) { + String key = attr.getValue(V2_ATTRIB_NAME); + String value = attr.getValue(V2_ATTRIB_VALUE); + if (value == null) { + return; + } + if (key != null && key.trim().length() > 0) { + driverProperties.setProperty(key, value); + } } } @@ -312,10 +328,10 @@ } } else if (V2_TAG_REMOTE.equals(tag)) { // TODO re-enable remote services... - } else if (V2_TAG_JDBC.equals(tag)) { - inProfileProperties = true; - } else if (V2_TAG_EXTP.equals(tag)) { + } else if (V2_APPLICATION_PROPERTIES.equals(tag)) { inEnvironmentProperties = true; + } else if (V2_TAG_EXTENDED_PROPERTIES.equals(tag)) { + inDriverProperties = true; } else if (V2_TAG_CFG.equals(tag)) { if (attr.getIndex(V2_ATTRIB_SCHEMA) >= 0) { profile.setPreferredSchema(attr.getValue(V2_ATTRIB_SCHEMA)); @@ -336,10 +352,10 @@ } else if (V2_TAG_PROP.equals(tag)) { String key = attr.getValue(V2_ATTRIB_NAME); String val = attr.getValue(V2_ATTRIB_VALUE); - if (key != null && key.trim().length() >= 1) { - if (inEnvironmentProperties) { - jdbcEnvironment.setProperty(key, val); - } else if (inProfileProperties) { + if (key != null && key.trim().length() > 0) { + if (inDriverProperties) { + driverProperties.setProperty(key, val); + } else if (inEnvironmentProperties) { if (ConnectionProfile.CONNECTION_KEEPALIVE.equals(key)) { profile.setKeepAlive(Boolean.valueOf(val).booleanValue()); } else if (ConnectionProfile.JDBC_ESCAPE_PROC.equals(key)) { @@ -404,30 +420,31 @@ } } - private static String v2encryptString(String text) { + private static String v2encryptString(final String text) { - if (text == null) + if (text == null) { return ""; + } - if (text.length() < xorKey.length) { - int pad = xorKey.length - text.length(); + String content = text; + if (content.length() < xorKey.length) { + int pad = xorKey.length - content.length(); byte[] padkey = new byte[pad]; - for (int i = 0; i < pad; i++) + for (int i = 0; i < pad; i++) { padkey[i] = xorKey[i]; - - text = text.concat(new String(padkey)); + } + content = content.concat(new String(padkey)); } - byte[] pass = text.getBytes(); + byte[] pass = content.getBytes(); byte[] xorStr = new byte[pass.length]; - int j = 0; for (int i = 0; i < pass.length; i++) { - if (j >= xorKey.length) + if (j >= xorKey.length) { j = 0; + } xorStr[i] = (byte) (xorKey[j++] ^ (pass[i])); } - String str = new String(xorStr); return str.trim(); } @@ -466,38 +483,6 @@ ps.println("\" >"); v3printBasicElements(service, ps); v3printProfileElements(service, ps); - - // TODO fix this // - // ConnectionProfile profile = service.getProfile(); - // ps.print("\t<"); - // ps.print(V3_TAG_CONNECTION_LOGGING); - // ps.println('>'); - // ps.print("\t\t<"); - // ps.print(V3_TAG_LOG_HOME); - // ps.print('>'); - // ps.print(Integer.toString(profile.getQueryTimeout())); - // ps.print("</"); - // ps.print(V3_TAG_LOG_HOME); - // ps.println('>'); - // ps.print("\t\t<"); - // ps.print(V3_TAG_LOG_SIZE); - // ps.print('>'); - // ps.print(Integer.toString(profile.getQueryTimeout())); - // ps.print("</"); - // ps.print(V3_TAG_LOG_SIZE); - // ps.println('>'); - // ps.print("\t\t<"); - // ps.print(V3_TAG_LOG_PATTERN); - // ps.print('>'); - // ps.print(Integer.toString(profile.getQueryTimeout())); - // ps.print("</"); - // ps.print(V3_TAG_LOG_PATTERN); - // ps.println('>'); - // - // ps.print("\t</"); - // ps.print(V3_TAG_CONNECTION_LOGGING); - // ps.println('>'); - ps.print("</"); ps.print(TAG_ROOT); ps.println(">"); @@ -548,7 +533,32 @@ ps.print("</"); ps.print(V3_TAG_PREFERRED_CATALOG); ps.println('>'); + ps.print("\t\t<"); + ps.print(V2_TAG_EXTENDED_PROPERTIES); + ps.println('>'); + Properties environment = service.getEnvironment(); + Set<Entry<Object, Object>> entries = environment.entrySet(); + for (Entry<Object, Object> entry : entries) { + String key = entry.getKey().toString(); + String value = entry.getValue().toString(); + ps.print("\t\t\t<"); + ps.print(V2_TAG_PROP); + ps.print(" "); + ps.print(V2_ATTRIB_NAME); + ps.print("=\""); + ps.print(StringUtilities.encodeXMLEntities(key)); + ps.print("\" "); + ps.print(V2_ATTRIB_VALUE); + ps.print("=\""); + ps.print(StringUtilities.encodeXMLEntities(value)); + ps.println("\" />"); + } + ps.print("\t\t</"); + ps.print(V2_TAG_EXTENDED_PROPERTIES); + ps.println('>'); + + ps.print("\t\t<"); ps.print(V3_TAG_RESOURCES); ps.println('>'); Enumeration<File> elements = profile.resourceElements(); @@ -705,10 +715,10 @@ ps.println("\" >"); Properties properties = service.getEnvironment(); - v2printProperties(ps, properties, 2, V2_TAG_EXTP); + v2printProperties(ps, properties, 2, V2_TAG_EXTENDED_PROPERTIES); properties = profile.toProperties(); - v2printProperties(ps, properties, 2, V2_TAG_JDBC); + v2printProperties(ps, properties, 2, V2_APPLICATION_PROPERTIES); Enumeration elements = profile.resourceElements(); if (elements.hasMoreElements()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:22:01
|
Revision: 48 http://svn.sourceforge.net/isql/?rev=48&view=rev Author: mkobold Date: 2007-04-30 15:22:00 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * BasicUtilities.java ** Corrected the use of modifying the input parameter for creating a safe filename. * IsqlToolkit.java ** Updated system properties and updated system/toolkit initialization. * LocalMessages.java ** Corrected usage of not modifying input parameter references * NullResultSetViewer.java ** Refactored this class from an internal class file. * QueryExecutor.java ** Added support for variable substitution in a unified form. * StringTokenizer.java ** Removed quote support. ** Added method toArray() for all tokens in string as an array. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/util/BasicUtilities.java isql-core/trunk/src/org/isqlviewer/util/IsqlToolkit.java isql-core/trunk/src/org/isqlviewer/util/LocalMessages.java isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java isql-core/trunk/src/org/isqlviewer/util/StringTokenizer.java Added Paths: ----------- isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java Modified: isql-core/trunk/src/org/isqlviewer/util/BasicUtilities.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/BasicUtilities.java 2007-04-30 22:15:13 UTC (rev 47) +++ isql-core/trunk/src/org/isqlviewer/util/BasicUtilities.java 2007-04-30 22:22:00 UTC (rev 48) @@ -153,8 +153,9 @@ * @param fqFilename original filename. * @return String an updated version that should be safe for most systems. */ - public static String createSafeFilename(String fqFilename) { + public static String createSafeFilename(final String fileName) { + String fqFilename = fileName; fqFilename = fqFilename.replace(File.pathSeparatorChar, '_'); fqFilename = fqFilename.replace(File.separatorChar, '_'); fqFilename = fqFilename.replace('*', '_'); @@ -238,7 +239,8 @@ * @see SAXParserFactory#setNamespaceAware(boolean) * @see SAXParserFactory#setValidating(boolean) */ - public static XMLReader createXMLReader(boolean namespaceAware, boolean validating) throws ParserConfigurationException { + public static XMLReader createXMLReader(boolean namespaceAware, boolean validating) + throws ParserConfigurationException { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(namespaceAware); Modified: isql-core/trunk/src/org/isqlviewer/util/IsqlToolkit.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/IsqlToolkit.java 2007-04-30 22:15:13 UTC (rev 47) +++ isql-core/trunk/src/org/isqlviewer/util/IsqlToolkit.java 2007-04-30 22:22:00 UTC (rev 48) @@ -79,38 +79,18 @@ */ public static final String PROPERTY_HOME = "isql.home"; /** - * System property for the fully qualified path for the looking for plugins. + * System property for defining the default location for log files. */ - public static final String PROPERTY_PLUGIN_HOME = "isql.home.plugins"; + public static final String PROPERTY_LOGGING_HOME = "isql.logging.home"; /** - * System property for the fully qualified path for the default script location. + * System property for the fully qualified path for the looking for plugins. */ - public static final String PROPERTY_SCRIPT_HOME = "isql.home.scripts"; + public static final String PROPERTY_PLUGIN_HOME = "isql.plugin.home"; /** - * System property for the path for to automatically load jar/zip/directories to classpath. - */ - public static final String PROPERTY_LIBRARY_HOME = "isql.home.library"; - /** * System property for the current version of iSQL-Viewer currently running. */ public static final String PROPERTY_VERSION = "isql.version"; /** - * System property for enabling debugging information throughout the iSQL-Viewer system. - */ - public static final String PROPERTY_DEBUG = "isql.debug"; - /** - * System property for enabling thread information to be displayed for messages. - */ - public static final String PROPERTY_DEBUG_THREADS = "isql.debug.threads"; - /** - * System property for determining if iSQL-Viewer is running within the Java Web Start environment. - */ - public static final String PROPERTY_JAVA_WEBSTART = "isql.jnlp"; - /** - * System property for determining if iSQL-Viewer is providing proxy authentication services. - */ - public static final String PROPERTY_PROXY_ENABLED = "isql.proxy.enabled"; - /** * System property flag to indicate that iSQL-Viewer is running embedded or is controlled by another application. */ public static final String PROPERTY_STANDALONE = "isql.stand-alone"; @@ -129,10 +109,9 @@ private static final String ServiceDtdResourcePath_3 = "/org/isqlviewer/resource/xml/service_3_x.dtd"; private static final String ENCRYPTION_ALGORITHIM = "DESede"; - private static File baseDirectory = null; - private static File scriptDirectory = null; - private static File pluginDirectory = null; - private static File libraryDirectory = null; + private static final File baseDirectory; + private static final File loggingDirectory; + private static final File pluginDirectory; private static final String DRIVER_DEFINITIONS_FILE = "driver.properties"; private static final String BOOKMARKS_FILE_NAME = "bookmarks.xml"; @@ -141,10 +120,51 @@ private static final Key localEncryptionKey; static { - entityResolver = new SaxResolver(); - entityResolver.register(BookmarkDtdPublicId, BookmarkDtdResourcePath, IsqlToolkit.class); - entityResolver.register(ServiceDtdPublicId_2, ServiceDtdResourcePath_2, IsqlToolkit.class); - entityResolver.register(ServiceDtdPublicId_3, ServiceDtdResourcePath_3, IsqlToolkit.class); + + Properties systemProperties = System.getProperties(); + boolean exists = false; + File location = null; + + systemProperties.put(PROPERTY_VERSION, getVersionInfo()); + exists = systemProperties.containsKey(PROPERTY_HOME); + if (!exists) { + String defaultValue = new File(System.getProperty("user.home"), ".iSQL-Viewer").getAbsolutePath(); + systemProperties.setProperty(PROPERTY_HOME, defaultValue); + } + location = new File(systemProperties.getProperty(PROPERTY_HOME)); + location.mkdirs(); + baseDirectory = location; + + exists = systemProperties.containsKey(PROPERTY_LOGGING_HOME); + if (!exists) { + String defaultValue = new File(System.getProperty(PROPERTY_HOME), "logs").getAbsolutePath(); + systemProperties.setProperty(PROPERTY_LOGGING_HOME, defaultValue); + } + location = new File(systemProperties.getProperty(PROPERTY_LOGGING_HOME)); + location.mkdirs(); + loggingDirectory = location; + + exists = systemProperties.containsKey(PROPERTY_PLUGIN_HOME); + if (!exists) { + String defaultValue = new File(System.getProperty(PROPERTY_HOME), "plugins").getAbsolutePath(); + systemProperties.setProperty(PROPERTY_PLUGIN_HOME, defaultValue); + } + location = new File(systemProperties.getProperty(PROPERTY_PLUGIN_HOME)); + location.mkdirs(); + pluginDirectory = location; + + exists = systemProperties.containsKey(PROPERTY_DEFAULTS_ROOT); + if (!exists) { + String defaultValue = "/org/isqlviewer/core/Preferences"; + systemProperties.setProperty(PROPERTY_DEFAULTS_ROOT, defaultValue); + } + + exists = systemProperties.containsKey(PROPERTY_STANDALONE); + if (!exists) { + String defaultValue = Boolean.FALSE.toString(); + systemProperties.setProperty(PROPERTY_STANDALONE, defaultValue); + } + Key existingKey = loadExistingPrivateKey(); if (existingKey == null) { try { @@ -157,14 +177,11 @@ } else { localEncryptionKey = existingKey; } - Properties systemProperties = System.getProperties(); - boolean exists = false; - exists = systemProperties.containsKey(PROPERTY_HOME); - if (!exists) { - String defaultValue = new File(System.getProperty("user.home"), ".iSQL-Viewer").getAbsolutePath(); - systemProperties.setProperty(PROPERTY_HOME, defaultValue); - } + entityResolver = new SaxResolver(); + entityResolver.register(BookmarkDtdPublicId, BookmarkDtdResourcePath, IsqlToolkit.class); + entityResolver.register(ServiceDtdPublicId_2, ServiceDtdResourcePath_2, IsqlToolkit.class); + entityResolver.register(ServiceDtdPublicId_3, ServiceDtdResourcePath_3, IsqlToolkit.class); } private IsqlToolkit() { @@ -193,62 +210,32 @@ */ public static synchronized File getBaseDirectory() { - if (baseDirectory == null) { - File defaultBase = new File(System.getProperty("user.home"), ".iSQL-Viewer"); - baseDirectory = new File(System.getProperty(PROPERTY_HOME, defaultBase.getAbsolutePath())); - if (!baseDirectory.exists()) { - baseDirectory.mkdirs(); - } - } return baseDirectory; } /** - * Gets the default location to look for scripts for the iSQL-Viewer program. + * Gets the default location to look for application plug-ins from. * <p> * - * @return file location to look for scripts. + * @return file location where plug-in components are loaded from. */ - public static synchronized File getScriptsDirectory() { + public static synchronized File getPluginDirectory() { - if (scriptDirectory == null) { - File defaultBase = new File(getBaseDirectory(), "scripts"); - scriptDirectory = new File(System.getProperty(PROPERTY_SCRIPT_HOME, defaultBase.getAbsolutePath())); - } - return scriptDirectory; + return pluginDirectory; } /** - * Gets the default runtime class-path for loading dynamic classes and resources from. + * Gets the default location to write log files to. * <p> * - * @return file location to scan for support classes and libraries. + * @return file location where log files are written to. */ - public static synchronized File getLibraryDirectory() { + public static synchronized File getLoggingDirectory() { - if (libraryDirectory == null) { - File defaultBase = new File(getBaseDirectory(), "lib"); - libraryDirectory = new File(System.getProperty(PROPERTY_LIBRARY_HOME, defaultBase.getAbsolutePath())); - } - return libraryDirectory; + return loggingDirectory; } /** - * Gets the default location to look for application plug-ins from. - * <p> - * - * @return file location where plug-in components are loaded from. - */ - public static synchronized File getPluginDirectory() { - - if (pluginDirectory == null) { - File defaultBase = new File(getBaseDirectory(), "plugins"); - pluginDirectory = new File(System.getProperty(PROPERTY_PLUGIN_HOME, defaultBase.getAbsolutePath())); - } - return pluginDirectory; - } - - /** * Gets the root node for all application preferences to reside from. * <p> * @@ -257,7 +244,7 @@ */ public static String getRootPreferencesNode() { - return System.getProperty(PROPERTY_DEFAULTS_ROOT, "/org/isqlviewer/core/Preferences"); + return System.getProperty(PROPERTY_DEFAULTS_ROOT); } /** Modified: isql-core/trunk/src/org/isqlviewer/util/LocalMessages.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/LocalMessages.java 2007-04-30 22:15:13 UTC (rev 47) +++ isql-core/trunk/src/org/isqlviewer/util/LocalMessages.java 2007-04-30 22:22:00 UTC (rev 48) @@ -226,14 +226,15 @@ } // this is a copy from the java.util.ResourceBundle. // - private String getFullBundleIdentifier(String baseName) { + private String getFullBundleIdentifier(final String baseName) { String localeSuffix = preferredLocale.toString(); + String bundleId = baseName; if (localeSuffix.length() > 0) { - baseName += "_" + localeSuffix; + bundleId += "_" + localeSuffix; } else if (preferredLocale.getVariant().length() > 0) { - baseName += "___" + preferredLocale.getVariant(); + bundleId += "___" + preferredLocale.getVariant(); } - return baseName; + return bundleId; } } Added: isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/util/NullResultSetViewer.java 2007-04-30 22:22:00 UTC (rev 48) @@ -0,0 +1,91 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.util; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.Statement; + +import org.isqlviewer.sql.ResultSetRenderer; + +class NullResultSetViewer implements ResultSetRenderer { + + public void handleSQLException(ResultSet set, SQLException e) { + + } + + public void handleStatementInterrupted(String stmtID) { + + } + + public void processGeneratedKeys(String stmtID, ResultSet keys, String nativeSQL) { + + } + + public long processResultSet(String stmtID, ResultSet set, String nativeSQL, int count) { + + return 0; + } + + public void processRowUpdates(String stmtID, int updateCount, String nativeSQL) { + + } + + public void recieveResultsetWarnings(ResultSet set, SQLWarning warnings) { + + } + + public void recieveStatementWarnings(Statement stmt, SQLWarning warnings) { + + } + + public void statementInitialized(String stmtID) { + + } + + public boolean supportsGeneratedKeys() { + + return false; + } + + public boolean supportsUpdateableResultSets() { + + return false; + } + + public boolean isCancelled() { + + return false; + } + + public String substituteVariable(String variableName) { + + return variableName; + } +} \ No newline at end of file Modified: isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java 2007-04-30 22:15:13 UTC (rev 47) +++ isql-core/trunk/src/org/isqlviewer/util/QueryExecutor.java 2007-04-30 22:22:00 UTC (rev 48) @@ -37,8 +37,14 @@ import java.sql.SQLWarning; import java.sql.Statement; import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Date; import java.util.concurrent.TimeUnit; +import org.isqlviewer.JdbcCommandLogger; +import org.isqlviewer.history.CommandType; +import org.isqlviewer.history.HistoricalCommand; +import org.isqlviewer.sql.ConnectionProfile; import org.isqlviewer.sql.JdbcService; import org.isqlviewer.sql.JdbcUtilities; import org.isqlviewer.sql.ResultSetRenderer; @@ -53,6 +59,10 @@ */ public class QueryExecutor extends LoggableObject implements Runnable { + private static final String DELIM_START = "${"; + private static final char DELIM_STOP = '}'; + private static final int DELIM_START_LEN = 2; + private static final int DELIM_STOP_LEN = 1; private static final String RESOURCE_BUNDLE = "org.isqlviewer.util.ResourceBundle"; private static final LocalMessages messages = new LocalMessages(RESOURCE_BUNDLE); @@ -89,25 +99,53 @@ String localID = Long.toHexString(System.currentTimeMillis()); renderer.statementInitialized(localID); - StringTokenizer st = new StringTokenizer(statement.concat(";"), ";", false); + StringTokenizer st = new StringTokenizer(statement, ";", false); st.setQuotesEnabled(true); - try { - while (st.hasMoreTokens()) { - String query = st.nextToken().trim(); - if (query.length() == 0) { - continue; + + String[] statements = st.toArray(); + JdbcCommandLogger commandLogger = service.getCommandLogger(); + + HistoricalCommand executionHistory = new HistoricalCommand(); + executionHistory.setCommandText(""); + executionHistory.setQueryTime(new Date()); + executionHistory.setTransactionId(System.currentTimeMillis()); + executionHistory.setService(service.getName()); + executionHistory.setType(CommandType.BATCH_QUERY); + boolean logBatch = statements.length > 1; + for (int i = 0; i < statements.length; i++) { + String userQuery = statements[i].trim(); + if (userQuery.length() > 0) { + try { + String substitutedQuery = doVariableSubstitutions(userQuery); + String nativeSQL = getNativeSql(connection, substitutedQuery); + Date queryTime = new Date(); + doQuery(connection, localID, nativeSQL); + if (logBatch && commandLogger != null) { + HistoricalCommand subCommand = new HistoricalCommand(); + subCommand.setCommandText(userQuery); + subCommand.setQueryTime(queryTime); + subCommand.setService(service.getName()); + subCommand.setTransactionId(executionHistory.getTransactionId()); + getTypeForQuery(subCommand, userQuery); + executionHistory.addSubcommand(subCommand); + } else { + logCommandHistory(commandLogger, userQuery, queryTime); + } + } catch (ParseException e) { + error("ERR:", e); + } catch (SQLException sqle) { + Object[] parameters = { + sqle.getMessage(), Integer.toString(sqle.getErrorCode()), sqle.getSQLState()}; + error(messages.format("queryexecutor.sql_execption", parameters)); + renderer.handleSQLException(null, sqle); + } catch (Exception e) { + error("ERR:", e); } - String nativeSQL = echoStatementInfo(connection, query); - doQuery(connection, localID, nativeSQL); } - } catch (SQLException sqle) { - Object[] parameters = {sqle.getMessage(), Integer.toString(sqle.getErrorCode()), sqle.getSQLState()}; - error(messages.format("queryexecutor.sql_execption", parameters), sqle); - renderer.handleSQLException(null, sqle); - - } catch (Exception e) { - error("ERR:", e); } + if (commandLogger != null && logBatch) { + commandLogger.logCommand(executionHistory); + } } finally { info(messages.getMessage("queryexecutor.finished")); System.gc(); @@ -115,24 +153,69 @@ } + private void logCommandHistory(JdbcCommandLogger commandLogger, String userQuery, Date queryTime) { + + if (commandLogger != null) { + HistoricalCommand command = new HistoricalCommand(); + command.setCommandText(userQuery); + command.setQueryTime(queryTime); + command.setService(service.getName()); + getTypeForQuery(command, userQuery); + commandLogger.logCommand(command); + } + } + + private void getTypeForQuery(HistoricalCommand command, String userQuery) { + + StringBuilder builder = new StringBuilder(""); + for (int i = 0; i < userQuery.length(); i++) { + char c = userQuery.charAt(i); + if (Character.isWhitespace(c)) { + break; + } + builder.append(c); + } + + String firstWord = builder.toString().toUpperCase(); + if ("UPDATE".equals(firstWord)) { + command.setType(CommandType.UPDATE_QUERY); + } else if ("INSERT".equalsIgnoreCase(firstWord)) { + command.setType(CommandType.INSERT_QUERY); + } else if ("DELETE".equalsIgnoreCase(firstWord)) { + command.setType(CommandType.DELETE_QUERY); + } else if ("CREATE".equalsIgnoreCase(firstWord)) { + command.setType(CommandType.INSERT_QUERY); + } else if ("DROP".equalsIgnoreCase(firstWord)) { + command.setType(CommandType.DELETE_QUERY); + } else { + command.setType(CommandType.QUERY); + } + } + private void doQuery(Connection connection, String localID, String nativeSQL) throws SQLException { boolean results = false; + ConnectionProfile profile = service.getProfile(); DatabaseMetaData jdbcMetaData = connection.getMetaData(); Statement sqlStatement = connection.createStatement(); + MemoryMXBean memoryMBean = ManagementFactory.getMemoryMXBean(); ThreadMXBean threadMBean = ManagementFactory.getThreadMXBean(); long cpuTime = 0; long vmMemory = 0; boolean returnKeys = false; - boolean generateKeys = service.getProfile().isResultsetKeys(); + boolean generateKeys = profile.isResultsetKeys(); boolean supportsMultiResults = jdbcMetaData.supportsMultipleResultSets(); - String formattedSQL = StringUtilities.formatBreak(80, nativeSQL, "", false); + // if escape processing is enable it now otherwise leave with driver default // + if (!profile.isEscapeProcessing()) { + sqlStatement.setEscapeProcessing(profile.isEscapeProcessing()); + } + if (generateKeys) { if (jdbcMetaData.supportsGetGeneratedKeys()) { - info(messages.format("queryexecutor.generated_keys_query", formattedSQL)); + info(messages.format("queryexecutor.generated_keys_query", nativeSQL)); cpuTime = threadMBean.getCurrentThreadUserTime(); vmMemory = memoryMBean.getHeapMemoryUsage().getUsed(); results = sqlStatement.execute(nativeSQL, Statement.RETURN_GENERATED_KEYS); @@ -140,7 +223,7 @@ cpuTime = threadMBean.getCurrentThreadUserTime() - cpuTime; returnKeys = true; } else { - info(messages.format("queryexecutor.generated_keys_query_not_supported", formattedSQL)); + info(messages.format("queryexecutor.generated_keys_query_not_supported", nativeSQL)); cpuTime = threadMBean.getCurrentThreadUserTime(); vmMemory = memoryMBean.getHeapMemoryUsage().getUsed(); results = sqlStatement.execute(nativeSQL, Statement.NO_GENERATED_KEYS); @@ -148,7 +231,7 @@ cpuTime = threadMBean.getCurrentThreadUserTime() - cpuTime; } } else { - info(messages.format("queryexecutor.executing_query", formattedSQL)); + info(messages.format("queryexecutor.executing_query", nativeSQL)); cpuTime = threadMBean.getCurrentThreadUserTime(); vmMemory = memoryMBean.getHeapMemoryUsage().getUsed(); results = sqlStatement.execute(nativeSQL); @@ -156,8 +239,8 @@ cpuTime = threadMBean.getCurrentThreadUserTime() - cpuTime; } - info(messages.format("queryexecutor.execution_time", StringUtilities - .getFullHumanReadableTime(TimeUnit.NANOSECONDS.toMillis(cpuTime)))); + String execTime = StringUtilities.getFullHumanReadableTime(TimeUnit.NANOSECONDS.toMillis(cpuTime)); + info(messages.format("queryexecutor.execution_time", execTime)); info(messages.format("queryexecutor.execution_memory_profile", StringUtilities.getHumanReadableSize(vmMemory))); int rowsAffected = -1; if (!results) { @@ -273,7 +356,7 @@ } } - private String echoStatementInfo(Connection connection, String query) { + private String getNativeSql(Connection connection, String query) { try { return connection.nativeSQL((query == null ? "" : query)); @@ -282,59 +365,48 @@ } } - private static class NullResultSetViewer implements ResultSetRenderer { + private String doVariableSubstitutions(final String source) throws ParseException { - public void handleSQLException(ResultSet set, SQLException e) { + StringBuffer sbuf = new StringBuffer(); + int i = 0; + int j, k; + while (true) { + j = source.indexOf(DELIM_START, i); + if (j == -1) { + // no more variables + if (i == 0) { // this is a simple string + return source; + } + // add the tail string which contains no variables and return the result. + sbuf.append(source.substring(i, source.length())); + return sbuf.toString(); + } + sbuf.append(source.substring(i, j)); + k = source.indexOf(DELIM_STOP, j); + if (k == -1) { + throw new ParseException(messages.format("StringUtilities.bad_variable_format"), j); + } + j += DELIM_START_LEN; + String key = source.substring(j, k); + // first try in System properties + String replacement = renderer.substituteVariable(key); + // then try props parameter + if (replacement != null) { + // Do variable substitution on the replacement string + // such that we can solve "Hello ${x2}" as "Hello p1" + // the where the properties are + // x1=p1 + // x2=${x1} + String recursiveReplacement = doVariableSubstitutions(replacement); + sbuf.append(recursiveReplacement); + } else { + sbuf.append(DELIM_START); + sbuf.append(key); + sbuf.append(DELIM_STOP); + } + i = k + DELIM_STOP_LEN; } + } - public void handleStatementInterrupted(String stmtID) { - - } - - public void processGeneratedKeys(String stmtID, ResultSet keys, String nativeSQL) { - - } - - public long processResultSet(String stmtID, ResultSet set, String nativeSQL, int count) { - - return 0; - } - - public void processRowUpdates(String stmtID, int updateCount, String nativeSQL) { - - } - - public void recieveResultsetWarnings(ResultSet set, SQLWarning warnings) { - - } - - public void recieveStatementWarnings(Statement stmt, SQLWarning warnings) { - - } - - public void statementInitialized(String stmtID) { - - } - - public boolean supportsGeneratedKeys() { - - return false; - } - - public boolean supportsUpdateableResultSets() { - - return false; - } - - public boolean isCancelled() { - - return false; - } - - public String substituteVariable(String variableName) { - - return variableName; - } - } } Modified: isql-core/trunk/src/org/isqlviewer/util/StringTokenizer.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/util/StringTokenizer.java 2007-04-30 22:15:13 UTC (rev 47) +++ isql-core/trunk/src/org/isqlviewer/util/StringTokenizer.java 2007-04-30 22:22:00 UTC (rev 48) @@ -27,6 +27,7 @@ */ package org.isqlviewer.util; +import java.util.ArrayList; import java.util.Enumeration; import java.util.NoSuchElementException; @@ -51,8 +52,6 @@ private String delimiters; private boolean retDelims; private boolean delimsChanged; - private char quoteChar = '\"'; - /** * maxDelimCodePoint stores the value of the delimiter character with the highest value. It is used to optimize the * detection of delimiter characters. It is unlikely to provide any optimization benefit in the hasSurrogates case @@ -171,7 +170,7 @@ boolean withinLiteral = false; while (position < maxPosition) { char c = str.charAt(position); - if (c == quoteChar && quotesEnabled) { + if (isQuotable(c) && quotesEnabled) { if (position > 0 && str.charAt(position - 1) != '\\') { // quote was not escaped // withinLiteral = !withinLiteral; @@ -191,6 +190,11 @@ return position; } + private boolean isQuotable(char character) { + + return character == '\'' || character == '\"'; + } + /** * Tests if there are more tokens available from this tokenizer's string. If this method returns <tt>true</tt>, * then a subsequent call to <tt>nextToken</tt> with no argument will successfully return a token. @@ -332,30 +336,22 @@ return quotesEnabled; } - /** - * Sets the quoting character. - * <p> - * This character will be used as defining a quoted string. such if a token exists within 2 instances of the - * character returned it will not be considered a token. - * <p> - * In a more generic sense this character can also define igornable boundaries with delimiters. - * - * @return character that determins quoted information. - */ - public synchronized char getQuoteChar() { + public String[] toArray() { - return quoteChar; - } + ArrayList<String> tokens = new ArrayList<String>(); + // reset internal variables so we get all tokens. + currentPosition = 0; + newPosition = -1; + delimsChanged = false; - /** - * Sets the quote character as the boundary character for ignoring delimiters within. - * <p> - * The quote character is only valid if and only if this instance has quotes enabled, which is by default false. - * - * @param quoteChar to set for setting ignorable parsing boundaries. - */ - public synchronized void setQuoteChar(char quoteChar) { + while (hasMoreTokens()) { + tokens.add(nextToken()); + } - this.quoteChar = quoteChar; + // reset internal variables so it can stil be used normally. + currentPosition = 0; + newPosition = -1; + delimsChanged = false; + return tokens.toArray(new String[tokens.size()]); } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:15:13
|
Revision: 47 http://svn.sourceforge.net/isql/?rev=47&view=rev Author: mkobold Date: 2007-04-30 15:15:13 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * StatmentWrapper.java * ConnectionWrapper.java ** Removed references to the CommandLogger. * JdbcService.java Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java isql-core/trunk/src/org/isqlviewer/sql/PreparedStatementWrapper.java isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java isql-core/trunk/src/org/isqlviewer/sql/processor/AbstractProcessor.java isql-core/trunk/src/org/isqlviewer/sql/processor/SqlProcessor.java isql-core/trunk/src/org/isqlviewer/sql/processor/TokenType.java Modified: isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-04-30 22:15:13 UTC (rev 47) @@ -40,8 +40,6 @@ import java.util.Hashtable; import java.util.Map; -import org.isqlviewer.JdbcCommandLogger; -import org.isqlviewer.history.HistoricalCommand; import org.isqlviewer.util.BasicUtilities; import org.isqlviewer.util.LocalMessages; @@ -116,7 +114,8 @@ } } - public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) + throws SQLException { guardConnection(); try { @@ -207,7 +206,8 @@ return stmt; } - public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) + throws SQLException { guardConnection(); try { @@ -758,15 +758,6 @@ return sqle; } - void logCommand(HistoricalCommand command) { - - JdbcCommandLogger commandLogger = dataSource.getCommandLogger(); - if (commandLogger != null) { - command.setService(dataSource.getName()); - commandLogger.logCommand(command); - } - } - protected void info(Object message, Throwable error) { dataSource.info(message, error); Modified: isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java 2007-04-30 22:15:13 UTC (rev 47) @@ -27,6 +27,7 @@ */ package org.isqlviewer.sql; +import java.io.File; import java.io.PrintWriter; import java.security.AccessController; import java.security.PrivilegedAction; @@ -39,7 +40,10 @@ import javax.sql.DataSource; +import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.Priority; import org.isqlviewer.JdbcCommandLogger; import org.isqlviewer.util.IsqlToolkit; import org.isqlviewer.util.LocalMessages; @@ -361,6 +365,29 @@ return type; } + public Driver getDriver() { + + return AccessController.doPrivileged(new PrivilegedAction<Driver>() { + + public Driver run() { + + ClassLoader classLoader = profile.toClassLoader(); + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(classLoader); + try { + Class clazz = Class.forName(getDriverClass(), true, profile.toClassLoader()); + return (Driver) clazz.newInstance(); + } catch (Throwable t) { + // fall-back on the driver manager to get the connection. + error(messages.format("DataSource.DriverError"), t); + return null; + } finally { + Thread.currentThread().setContextClassLoader(contextClassLoader); + } + } + }); + } + /** * Logs informational error and supplementary message. * <p> @@ -480,6 +507,7 @@ return cachedConnection; } + initializeLogging(); Object result = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { @@ -501,7 +529,12 @@ public void run() { try { - resultPlaceHolder.add(driver.connect(jdbcURL, env)); + Connection connection = driver.connect(jdbcURL, env); + if (connection != null) { + resultPlaceHolder.add(connection); + } else { + throw new RuntimeException("Failed to connect to:'" + jdbcURL + "'"); + } } catch (SQLException sqle) { error(messages.format("DataSource.driver_error"), sqle); resultPlaceHolder.add(sqle); @@ -510,13 +543,15 @@ error(messages.format("DataSource.driver_error"), e); try { resultPlaceHolder.add(DriverManager.getConnection(jdbcURL, env)); - } catch (SQLException sqle) { - resultPlaceHolder.add(sqle); + } catch (Throwable error) { + error(messages.format("DataSource.driver_error"), error); + resultPlaceHolder.add(error); } } } }); + t.setName("privileged:iSQL-Viewer/createDriverConnection()"); t.start(); synchronized (t) { t.join(timeout); @@ -528,7 +563,7 @@ t.interrupt(); String time = StringUtilities.getFullHumanReadableTime(timeout); - throw new SQLException(messages.format("DataSource.connection_timed_out", time)); + return new SQLException(messages.format("DataSource.connection_timed_out", time)); } catch (InterruptedException ie) { SQLException sqle = new SQLException(messages.format("DataSource.connection_interrupted")); return sqle; @@ -537,8 +572,9 @@ error(messages.format("DataSource.DriverError"), t); try { return DriverManager.getConnection(jdbcURL, env); - } catch (SQLException sqle) { - return sqle; + } catch (Throwable error) { + error(messages.format("DataSource.DriverError"), error); + return error; } } finally { Thread.currentThread().setContextClassLoader(contextClassLoader); @@ -548,6 +584,9 @@ if (result instanceof SQLException) { throw (SQLException) result; + } else if (result instanceof Throwable) { + Throwable error = (Throwable) result; + throw new SQLException(error.getMessage()); } else if (result instanceof Connection) { cachedConnection = new ConnectionWrapper(this, (Connection) result); RegistrarFactory registrarFactory = RegistrarFactory.getSharedInstance(); @@ -573,6 +612,9 @@ synchronized void clearConnection() { cachedConnection = null; + Logger newLogger = Logger.getLogger(getDriverClass()); + newLogger.removeAllAppenders(); + logger = IsqlToolkit.getApplicationLogger(); System.gc(); } @@ -595,4 +637,25 @@ this.commandLogger = commandLogger; } + private void initializeLogging() { + + // we will use the driver class package name instead of our own since the driver + // is likely to use a logger in this category if it also uses log4j + int lastIndex = driverClass.lastIndexOf('.'); + String packageName = driverClass.substring(0, lastIndex); + Logger newLogger = Logger.getLogger(packageName); + newLogger.setAdditivity(false); + newLogger.removeAllAppenders(); + PatternLayout patternLayout = new PatternLayout("%d{ISO8601} [%-5p] - {%t} - %m\n"); + FileAppender fileAppender = new FileAppender(); + fileAppender.setLayout(patternLayout); + File logFile = new File(IsqlToolkit.getLoggingDirectory(), getName().concat(".log")); + fileAppender.setFile(logFile.getAbsolutePath()); + fileAppender.setAppend(false); + // TODO make this go to DEBUG externally if user wants it too // + fileAppender.setThreshold(Priority.INFO); + fileAppender.activateOptions(); + newLogger.addAppender(fileAppender); + logger = newLogger; + } } Modified: isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java 2007-04-30 22:15:13 UTC (rev 47) @@ -38,15 +38,12 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.SQLWarning; import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; import java.text.Format; import java.text.ParseException; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Hashtable; @@ -106,293 +103,10 @@ e.printStackTrace(); } } - properties.put("HONK HONK HONK", Boolean.TRUE); return properties; } /** - * Retrieves a single column from a ResultSet via column number. - * <p> - * This method create an collection of Objects from the given column in the given ResultSet. All SQLExceptions and - * SQLWarnings are passed to the ResultSetViewer. The ResultSetViewer can be null, if null no information about - * Warnings and Exceptions will be passed back. - * <p> - * If the given ResultSet is null this method will immediately return null. - * <p> - * Remeber that this will call first and then continue processing the ResultSet and will call first again to return - * the ResultSet to the original location of the ResultSet. If for some reason a first cannot be executed before - * processing the result set an empty collection will be returned. - * - * @see #getSingleColumn(ResultSet, String, ResultSetRenderer) - * @param rs ResultSet that has data to be extracted. - * @param column a number 1..n where n is number of columns in the resultset. - * @param handler to accept SQLWarnings and Exceptions, can be null. - * @return collection of Object representing the desired column. - */ - public static Collection<String> getSingleColumn(ResultSet rs, int column, ResultSetRenderer handler) { - - if (rs == null) { - return null; - } - - boolean isScrollable = false; - try { - int type = rs.getType(); - isScrollable = type == ResultSet.TYPE_SCROLL_INSENSITIVE || type == ResultSet.TYPE_SCROLL_SENSITIVE; - } catch (Throwable t) { - } - - ArrayList<String> collection = new ArrayList<String>(); - if (isScrollable) { - try { - rs.beforeFirst(); - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - return collection; - } catch (AbstractMethodError ame) { - addWarning(rs, ame.getClass().getName(), "ResultSet:beforeFirst()"); - } catch (UnsupportedOperationException ose) { - addWarning(rs, ose.getClass().getName(), "ResultSet:beforeFirst()"); - } catch (Throwable t) { - return collection; - } - } - - try { - - while (rs.next()) { - try { - String o = rs.getString(column); - if (!collection.contains(o) || !rs.wasNull()) { - collection.add(o); - } - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } - if (handler != null) { - try { - handler.recieveResultsetWarnings(rs, rs.getWarnings()); - } catch (Throwable t) { - - } - } - } - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } catch (Throwable t) { - } finally { - if (isScrollable) { - try { - rs.beforeFirst(); - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } catch (AbstractMethodError ame) { - addWarning(rs, AbstractMethodError.class.getName(), "ResultSet:beforeFirst()"); - } catch (UnsupportedOperationException ose) { - addWarning(rs, UnsupportedOperationException.class.getName(), "ResultSet:beforeFirst()"); - } catch (Throwable t) { - } - } - } - return collection; - } - - /** - * Retrieves a single column from a ResultSet via column name. - * <p> - * This will create an Object array of the given column. This method makes a call to the ResultSets' - * findColumn(String) and then will call the other getSingleColumn() method of this class. If an error occurs will - * finding the column an empty Object array will be returned. - * <p> - * If the given ResultSet is null this method will immediately return null. - * <p> - * Remeber that this will call first and then continue processing the ResultSet and will call first again to return - * the ResultSet to the original location of the ResultSet. - * - * @see #getSingleColumn(ResultSet, int, ResultSetRenderer) - * @param rs ResultSet that has data to be extracted. - * @param column a String identifer for the column - * @param handler to accept SQLWarnings and Exceptions, can be null. - * @return collection of Object representing the desired column. - */ - public static String[] getSingleColumn(ResultSet rs, String column, ResultSetRenderer handler) { - - if (rs == null) { - return null; - } - - try { - int columnID = rs.findColumn(column); - Collection<String> columnList = getSingleColumn(rs, columnID, handler); - return columnList.toArray(new String[columnList.size()]); - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } catch (Throwable t) { - } - - return new String[0]; - } - - /** - * Returns a given row from a ResultSet. - * <p> - * This is mainly a helper method since there is no real way to get a row count from a ResultSet or the meta-data - * associated with it. So this method will simply next on the Result set till the row number passed in matches the - * internal counter. So if an out of range number is given this will simply return an empty collection. - * <p> - * If the given ResultSet is null this method will immediately return null. - * <p> - * Remeber that this will call first and then continue processing the ResultSet and will call first again to return - * the ResultSet to the original location of the ResultSet. If for some reason a first cannot be executed before - * processing the result set an empty collection will be returned. - * - * @param rs ResultSet that has data to be extracted. - * @param row number 1..n to pull data from the resultset. - * @param handler to accept SQLWarnings and Exceptions, can be null. - * @return collection of Object representing the desired row. - */ - public static Collection getSingleRow(ResultSet rs, int row, ResultSetRenderer handler) { - - if (rs == null) { - return null; - } - boolean isScrollable = false; - try { - int type = rs.getType(); - isScrollable = type != ResultSet.TYPE_FORWARD_ONLY; - } catch (Throwable t) { - } - - if (isScrollable) { - try { - rs.beforeFirst(); - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - return new ArrayList(); - } catch (UnsupportedOperationException ose) { - addWarning(rs, ose.getClass().getName(), "ResultSet:first()"); - } catch (Throwable t) { - return new ArrayList(); - } - } else { - try { - if (!rs.isBeforeFirst()) { - addWarning(rs, "JdbcUtilities:getSingleRow(" + row + ")", "ResultSet:!isBeforefirst()"); - } - } catch (Throwable t) { - } - } - - ArrayList<Object> collection = new ArrayList<Object>(); - try { - int current = 1; - int columnCount = rs.getMetaData().getColumnCount(); - while (rs.next()) - if (current++ == row) { - for (int i = 1; i <= columnCount; i++) - collection.add(rs.getObject(i)); - } - - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } catch (Throwable t) { - } finally { - if (isScrollable) { - try { - rs.beforeFirst(); - } catch (SQLException sqle) { - if (handler != null) { - handler.handleSQLException(rs, sqle); - } else { - addWarning(rs, sqle); - } - } catch (UnsupportedOperationException ose) { - addWarning(rs, ose.getClass().getName(), "ResultSet:first()"); - } catch (Throwable t) { - } - } - } - return collection; - } - - /** - * Helper method for adding warnings to a ResultSet. - * <p> - * This is mainly for iSQL-Viewer to add custom warnings to a ResultSet that are easily identified as an iSQL-Viewer - * warning. - * <p> - * If any kind of exception or error occurs here it will be echoed to the System.out. - * - * @see ResultSet#getWarnings() - * @see SQLWarning#setNextWarning(java.sql.SQLWarning) - * @param reason reason for the warning. - * @param state SQL state of the warning. - * @param rs ResultSet to add this warning too. - */ - public static void addWarning(ResultSet rs, String reason, String state) { - - try { - reason = (reason == null) ? "" : reason; - state = (state == null) ? "" : state; - SQLWarning warnings = rs.getWarnings(); - if (warnings == null) { - throw new SQLException(reason, state); - } - - SQLWarning newWarning = new SQLWarning(reason, "ISQLV-" + state, 0x12377); - warnings.setNextWarning(newWarning); - } catch (SQLException sqle) { - } catch (Throwable t) { - } - } - - /** - * Helper method for adding SQLException as a warning to a ResultSet. - * <p> - * This is mainly for iSQL-Viewer to add custom warnings to a ResultSet that are easily identified as an iSQL-Viewer - * warning. - * <p> - * If any kind of exception or error occurs here it will be echoed to the System.out. - * - * @see ResultSet#getWarnings() - * @see SQLWarning#setNextWarning(java.sql.SQLWarning) - * @param sqle Exception to add. - * @param rs ResultSet to add this warning too. - */ - public static void addWarning(ResultSet rs, SQLException sqle) { - - addWarning(rs, sqle.getMessage(), sqle.getSQLState()); - } - - /** * Checks if the ResultSet is deemed updatable. * <p> * Basically if the ResultSet has the UPDATABLE concurrency and is not of the FORWARD_ONLY type this method will @@ -1039,7 +753,8 @@ * @throws NullPointerException if data or type is null * @throws IllegalArgumentException if the data.length != type.length */ - public static void configurePreparedStatement(PreparedStatement ps, Object[] data, int[] type, boolean convert) throws SQLException { + public static void configurePreparedStatement(PreparedStatement ps, Object[] data, int[] type, boolean convert) + throws SQLException { if (data == null || type == null) { throw new NullPointerException(); Modified: isql-core/trunk/src/org/isqlviewer/sql/PreparedStatementWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/PreparedStatementWrapper.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/PreparedStatementWrapper.java 2007-04-30 22:15:13 UTC (rev 47) @@ -592,7 +592,7 @@ private void logQuery() throws SQLException { if (!hasLogged) { - String nsql = connection.nativeSQL(lastQuerySQL); + String nsql = connection.nativeSQL(lastStatement); info(messages.format("DataSource.StatementExec", nsql)); hasLogged = true; } Modified: isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java 2007-04-30 22:15:13 UTC (rev 47) @@ -32,12 +32,9 @@ import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; -import java.util.Date; import java.util.Iterator; import java.util.Vector; -import org.isqlviewer.history.CommandType; -import org.isqlviewer.history.HistoricalCommand; import org.isqlviewer.util.LocalMessages; /** @@ -52,14 +49,14 @@ protected static final LocalMessages messages = new LocalMessages(ConnectionWrapper.BUNDLE_NAME); protected Statement stmt; protected ConnectionWrapper connection; - protected String lastQuerySQL; + protected String lastStatement; protected Vector<ResultSetWrapper> openCursors = new Vector<ResultSetWrapper>(); public StatementWrapper(ConnectionWrapper connection, Statement stmt, String currentSQL) { this.stmt = stmt; this.connection = connection; - this.lastQuerySQL = currentSQL; + this.lastStatement = currentSQL; } public ConnectionWrapper getOwner() { @@ -115,7 +112,7 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; + lastStatement = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); ResultSetWrapper wrs = new ResultSetWrapper(this, stmt.executeQuery(sql)); @@ -134,17 +131,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(lastQuerySQL); - info(messages.format("DataSource.StatementExec", nsql)); - - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - boolean result = stmt.execute(sql); - return result; + lastStatement = sql; + return stmt.execute(sql); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "getResultSet()"), sqle); throw sqle; @@ -158,16 +146,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - boolean result = stmt.execute(sql, autoGeneratedKeys); - return result; + lastStatement = sql; + return stmt.execute(sql, autoGeneratedKeys); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "execute(String,int)"), sqle); throw sqle; @@ -181,16 +161,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - boolean result = stmt.execute(sql, columnIndexes); - return result; + lastStatement = sql; + return stmt.execute(sql, columnIndexes); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "execute(String,int[])"), sqle); throw sqle; @@ -204,14 +176,7 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); + lastStatement = sql; return stmt.execute(sql, columnNames); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "execute(String,String[])"), sqle); @@ -226,16 +191,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - int result = stmt.executeUpdate(sql, autoGeneratedKeys); - return result; + lastStatement = sql; + return stmt.executeUpdate(sql, autoGeneratedKeys); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "executeUpdate(String,int)"), sqle); throw sqle; @@ -249,16 +206,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - int result = stmt.executeUpdate(sql, columnIndexes); - return result; + lastStatement = sql; + return stmt.executeUpdate(sql, columnIndexes); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "executeUpdate(String,int[])"), sqle); throw sqle; @@ -272,17 +221,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - - int result = stmt.executeUpdate(sql, columnNames); - return result; + lastStatement = sql; + return stmt.executeUpdate(sql, columnNames); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "executeUpdate(String,String[])"), sqle); throw sqle; @@ -296,16 +236,8 @@ connection.updateLastAccess(); try { - lastQuerySQL = sql; - String nsql = connection.nativeSQL(sql); - info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(); - command.setType(CommandType.QUERY); - command.setQueryTime(new Date(System.currentTimeMillis())); - command.setCommandText(sql); - connection.logCommand(command); - int result = stmt.executeUpdate(sql); - return result; + lastStatement = sql; + return stmt.executeUpdate(sql); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "executeUpdate(String)"), sqle); throw sqle; Modified: isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java 2007-04-30 22:15:13 UTC (rev 47) @@ -49,7 +49,6 @@ import java.util.Enumeration; import org.apache.derby.jdbc.EmbeddedDriver; -import org.apache.log4j.Logger; import org.isqlviewer.BindVariable; import org.isqlviewer.ServiceReference; import org.isqlviewer.bookmarks.Bookmark; @@ -58,7 +57,6 @@ import org.isqlviewer.bookmarks.ColorLabel; import org.isqlviewer.history.CommandType; import org.isqlviewer.history.HistoricalCommand; -import org.isqlviewer.history.HistoryReference; import org.isqlviewer.util.BasicUtilities; import org.isqlviewer.util.IsqlToolkit; @@ -73,6 +71,7 @@ */ public class EmbeddedDatabase { + private static final String HISTORY_DELETE_ALL = "DELETE FROM HISTORY"; private static final String CONSTRAINT_VIOLATION = "23505"; private static final String NO_DATA_AVAILABLE = "24000"; @@ -97,8 +96,9 @@ private static final String SERVICE_DELETE = "DELETE FROM SERVICE WHERE SERVICE_ID = ?"; private static final String HISTORY_INSERT = "INSERT INTO HISTORY (SERVICE_ID, QUERY_TIME, TRANSACTION_ID, COMMAND_TYPE, COMMAND_TEXT) values (?, ?, ?, ?, ?)"; - private static final String HISTORY_SELECT_ALL = "SELECT HISTORY_ID, QUERY_TIME, TRANSACTION_ID, COMMAND_TYPE, COMMAND_TEXT FROM HISTORY ORDER BY QUERY_TIME"; + private static final String HISTORY_SELECT_ALL = "SELECT HISTORY_ID, QUERY_TIME, TRANSACTION_ID, COMMAND_TYPE, COMMAND_TEXT FROM HISTORY ORDER BY HISTORY_ID, QUERY_TIME"; private static final String HISTORY_SELECT_SINGLE = "SELECT H.HISTORY_ID, S.NAME, H.QUERY_TIME, H.TRANSACTION_ID, H.COMMAND_TYPE, H.COMMAND_TEXT FROM HISTORY H, SERVICE S WHERE HISTORY_ID = ? AND H.SERVICE_ID = S.SERVICE_ID"; + private static final String HISTORY_SELECT_SINGLE_BATCH = "SELECT H.HISTORY_ID, S.NAME, H.QUERY_TIME, H.TRANSACTION_ID, H.COMMAND_TYPE, H.COMMAND_TEXT FROM HISTORY H, SERVICE S WHERE TRANSACTION_ID = ? AND H.SERVICE_ID = S.SERVICE_ID ORDER BY HISTORY_ID"; private static final String HISTORY_DELETE_SERVICE = "DELETE FROM HISTORY WHERE SERVICE_ID = ?"; private static final String PRIMARY_KEY_QUERY = "values IDENTITY_VAL_LOCAL()"; @@ -115,9 +115,9 @@ } private Connection embeddedConnection = null; - private Logger logger = IsqlToolkit.getApplicationLogger(); private File databaseHome = new File(IsqlToolkit.getBaseDirectory(), "derby"); + // private Logger logger = IsqlToolkit.getApplicationLogger(); // private static final String BUNDLE_NAME = "org.isqlviewer.sql.embedded.ResourceBundle"; // private LocalMessages messages = new LocalMessages(BUNDLE_NAME); @@ -158,47 +158,59 @@ } } - public HistoryReference addHistoricalCommand(HistoricalCommand command) throws SQLException { + public HistoricalCommand addHistoricalCommand(HistoricalCommand command) throws SQLException { - Object[] bindVariables = new Object[5]; - bindVariables[0] = new Long(getServiceIDForName(command.getService())); - Date executionTime = command.getQueryTime(); - bindVariables[1] = new Timestamp(executionTime == null ? 0 : executionTime.getTime()); - bindVariables[2] = new Long(command.getTransactionId()); - bindVariables[3] = command.getType().toString(); - bindVariables[4] = command.getCommandText(); + HistoricalCommand reference = null; + if (command.hasChildCommands()) { + reference = addHistoricalCommand0(command); + Enumeration<HistoricalCommand> childCommands = command.elements(); + while (childCommands.hasMoreElements()) { + HistoricalCommand next = childCommands.nextElement(); + reference.addSubcommand(addHistoricalCommand0(next)); + } + } else { + return addHistoricalCommand0(command); + } + return reference; + } + + public HistoricalCommand getHistoricalCommand(HistoricalCommand reference) throws SQLException { + + ensureConnection(); PreparedStatement preparedStatement = null; + HistoricalCommand parentCommand = null; + ResultSet cursor = null; try { - preparedStatement = embeddedConnection.prepareStatement(HISTORY_INSERT); - for (int i = 0; i < bindVariables.length; i++) { - preparedStatement.setObject(i + 1, bindVariables[i]); - } - int affectedCount = preparedStatement.executeUpdate(); - if (affectedCount == 1) { - long identityValue = getInsertedPrimaryKey(); - command.setId(identityValue); - - HistoryReference referenceObject = new HistoryReference(); - referenceObject.setId(identityValue); - referenceObject.setQueryTime(command.getQueryTime()); - referenceObject.setTransactionId(command.getTransactionId()); - referenceObject.setType(command.getType()); - - String commandText = (String) bindVariables[4]; - StringBuilder builder = new StringBuilder(""); - for (int i = 0; i < commandText.length(); i++) { - char c = commandText.charAt(i); - if (Character.isWhitespace(c)) { - break; + preparedStatement = embeddedConnection.prepareStatement(HISTORY_SELECT_SINGLE_BATCH); + preparedStatement.setLong(1, reference.getTransactionId()); + boolean hasResults = preparedStatement.execute(); + if (hasResults) { + cursor = preparedStatement.getResultSet(); + while (cursor.next()) { + HistoricalCommand command = new HistoricalCommand(); + command.setId(cursor.getLong(1)); + command.setService(cursor.getString(2)); + Date executionTime = new Date(cursor.getTimestamp(3).getTime()); + command.setQueryTime(executionTime); + command.setTransactionId(cursor.getLong(4)); + command.setType(CommandType.valueOf(cursor.getString(5))); + String commandText = cursor.getString(6); + command.setCommandText(commandText); + if (parentCommand == null) { + parentCommand = command; + } else { + parentCommand.addSubcommand(command); } - builder.append(c); } - referenceObject.setShortCommand(builder.toString()); - return referenceObject; } - return null; } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } if (preparedStatement != null) { try { preparedStatement.close(); @@ -206,13 +218,9 @@ } } } + return parentCommand; } - public HistoricalCommand getHistoricalCommand(HistoryReference reference) throws SQLException { - - return getHistoricalCommand(reference.getId()); - } - public HistoricalCommand getHistoricalCommand(long historyId) throws SQLException { PreparedStatement preparedStatement = null; @@ -252,18 +260,20 @@ } } - public Collection<HistoryReference> getHistory() throws SQLException { + public Collection<HistoricalCommand> getHistory() throws SQLException { ensureConnection(); - ArrayList<HistoryReference> historySet = new ArrayList<HistoryReference>(); + ArrayList<HistoricalCommand> historySet = new ArrayList<HistoricalCommand>(); Statement stmt = embeddedConnection.createStatement(); ResultSet cursor = null; try { boolean hasResults = stmt.execute(HISTORY_SELECT_ALL); if (hasResults) { cursor = stmt.getResultSet(); + long currentTransactionId = -1; + HistoricalCommand parentCommand = null; while (cursor.next()) { - HistoryReference reference = new HistoryReference(); + HistoricalCommand reference = new HistoricalCommand(); reference.setId(cursor.getLong(1)); Date executionTime = new Date(cursor.getTimestamp(2).getTime()); reference.setQueryTime(executionTime); @@ -278,8 +288,25 @@ } builder.append(c); } - reference.setShortCommand(builder.toString()); - historySet.add(reference); + + long transactionId = reference.getTransactionId(); + if (transactionId > 0 && parentCommand == null) { + parentCommand = reference; + currentTransactionId = transactionId; + historySet.add(reference); + } else if (transactionId > 0 && parentCommand != null) { + if (transactionId == currentTransactionId) { + parentCommand.addSubcommand(reference); + } else { + parentCommand = reference; + currentTransactionId = transactionId; + historySet.add(reference); + } + } else if (transactionId < 0) { + parentCommand = null; + currentTransactionId = -1; + historySet.add(reference); + } } } } finally { @@ -721,7 +748,6 @@ try { reference.setResourceURL(new URL(cursor.getString(6))); } catch (MalformedURLException e) { - System.out.println("Skipping " + reference.getId()); continue; } serviceReferenceSet.add(reference); @@ -752,6 +778,22 @@ return null; } + public int removeAllHistory() throws SQLException { + + ensureConnection(); + Statement stmt = embeddedConnection.createStatement(); + try { + return stmt.executeUpdate(HISTORY_DELETE_ALL); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + } + public boolean renameBookmarkFolder(String existingPath, String newPath) throws SQLException { Object[] bindVariables = new Object[3]; @@ -821,7 +863,6 @@ if (line.length() == 0) { try { if (sqlBuffer.length() > 0) { - logger.info(sqlBuffer); executeStatement(sqlBuffer.toString()); } } finally { @@ -833,7 +874,6 @@ } } if (sqlBuffer.length() > 0) { - logger.info(sqlBuffer); executeStatement(sqlBuffer.toString()); } executeStatement(SERVICE_INSTALL_UNKNOWN); @@ -846,7 +886,8 @@ return createTables; } - private boolean addBookmark0(Bookmark bookmark, BookmarkFolder folder, PreparedStatement preparedStatement) throws SQLException { + private boolean addBookmark0(Bookmark bookmark, BookmarkFolder folder, PreparedStatement preparedStatement) + throws SQLException { Object[] bindVariables = new Object[8]; int[] types = new int[8]; @@ -876,19 +917,22 @@ boolean hasError = true; embeddedConnection.setAutoCommit(false); + PreparedStatement statement = null; try { if (preparedStatement == null) { - preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_INSERT); + statement = embeddedConnection.prepareStatement(BOOKMARK_INSERT); + } else { + statement = preparedStatement; } for (int i = 0; i < bindVariables.length; i++) { if (bindVariables[i] == null) { - preparedStatement.setNull(i + 1, types[i]); + statement.setNull(i + 1, types[i]); } else { - preparedStatement.setObject(i + 1, bindVariables[i]); + statement.setObject(i + 1, bindVariables[i]); } } try { - int affectedCount = preparedStatement.executeUpdate(); + int affectedCount = statement.executeUpdate(); long identityValue = getInsertedPrimaryKey(); bookmark.setId(identityValue); addBindVariables(bookmark); @@ -906,7 +950,6 @@ } else { embeddedConnection.commit(); } - embeddedConnection.setAutoCommit(true); if (preparedStatement != null) { if (!doBatch) { @@ -922,6 +965,55 @@ } } + private HistoricalCommand addHistoricalCommand0(HistoricalCommand command) throws SQLException { + + Object[] bindVariables = new Object[5]; + bindVariables[0] = new Long(getServiceIDForName(command.getService())); + Date executionTime = command.getQueryTime(); + bindVariables[1] = new Timestamp(executionTime == null ? 0 : executionTime.getTime()); + bindVariables[2] = new Long(command.getTransactionId()); + bindVariables[3] = command.getType().toString(); + bindVariables[4] = command.getCommandText(); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(HISTORY_INSERT); + for (int i = 0; i < bindVariables.length; i++) { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + int affectedCount = preparedStatement.executeUpdate(); + if (affectedCount == 1) { + long identityValue = getInsertedPrimaryKey(); + command.setId(identityValue); + + HistoricalCommand referenceObject = new HistoricalCommand(); + referenceObject.setId(identityValue); + referenceObject.setQueryTime(command.getQueryTime()); + referenceObject.setTransactionId(command.getTransactionId()); + referenceObject.setType(command.getType()); + + String commandText = (String) bindVariables[4]; + StringBuilder builder = new StringBuilder(""); + for (int i = 0; i < commandText.length(); i++) { + char c = commandText.charAt(i); + if (Character.isWhitespace(c)) { + break; + } + builder.append(c); + } + return referenceObject; + } + return null; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + private void addBindVariables(Bookmark bookmark) throws SQLException { Object[] bindVariables = new Object[5]; @@ -960,7 +1052,8 @@ } } - private void addBookmarkFolder0(BookmarkFolder bookmarkFolder, int stackDepth, PreparedStatement preparedStatement) throws SQLException { + private void addBookmarkFolder0(BookmarkFolder bookmarkFolder, int stackDepth, PreparedStatement preparedStatement) + throws SQLException { int childCount = bookmarkFolder.getChildCount(); for (int i = 0; i < childCount; i++) { Modified: isql-core/trunk/src/org/isqlviewer/sql/processor/AbstractProcessor.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/processor/AbstractProcessor.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/processor/AbstractProcessor.java 2007-04-30 22:15:13 UTC (rev 47) @@ -177,40 +177,44 @@ */ public int find(int p) { - int start = 0, end, mid, midpos; - if (!scanning) + int firstIndex = 0, lastIndex, mid, midpos; + if (!scanning) { moveGap(gap + tokens.length - endgap); - end = gap - 1; - if (p > tokens[end].position) - return end; - while (end > start + 1) { - mid = (start + end) / 2; + } + lastIndex = gap - 1; + if (p > tokens[lastIndex].position) { + return lastIndex; + } + while (lastIndex > firstIndex + 1) { + mid = (firstIndex + lastIndex) / 2; midpos = tokens[mid].position; if (p > midpos) { - start = mid; + firstIndex = mid; } else { - end = mid; + lastIndex = mid; } } - return start; + return firstIndex; } /** * Report the position of an edit, the length of the text being replaced, and the length of the replacement text, to * prepare for rescanning. The call returns the index of the token at which rescanning will start. */ - public int change(int start, int len, int newLen) { + public int change(int firstIndex, int len, int newLen) { - if (start < 0 || len < 0 || newLen < 0 || start + len > textLength) { - throw new Error("change(" + start + "," + len + "," + newLen + ")"); + if (firstIndex < 0 || len < 0 || newLen < 0 || firstIndex + len > textLength) { + throw new Error("change(" + firstIndex + "," + len + "," + newLen + ")"); } textLength += newLen - len; - int end = start + newLen; + int currentEnd = firstIndex + newLen; if (scanning) { - while (gap > 0 && tokens[gap - 1].position > start) + while (gap > 0 && tokens[gap - 1].position > firstIndex) { gap--; - if (gap > 0) + } + if (gap > 0) { gap--; + } if (gap > 0) { gap--; position = tokens[gap].position; @@ -219,23 +223,26 @@ position = 0; state = TokenType.WHITESPACE; } - while (tokens[endgap].position + textLength < end) + while (tokens[endgap].position + textLength < currentEnd) { endgap++; + } return gap; } - if (endgap == tokens.length) + if (endgap == tokens.length) { moveGap(gap - 1); + } scanning = true; - while (tokens[endgap].position + textLength < start) { + while (tokens[endgap].position + textLength < firstIndex) { tokens[endgap].position += textLength; tokens[gap++] = tokens[endgap++]; } - while (gap > 0 && tokens[gap - 1].position > start) { + while (gap > 0 && tokens[gap - 1].position > firstIndex) { tokens[--endgap] = tokens[--gap]; tokens[endgap].position -= textLength; } - if (gap > 0) + if (gap > 0) { gap--; + } if (gap > 0) { gap--; position = tokens[gap].position; @@ -244,8 +251,9 @@ position = 0; state = TokenType.WHITESPACE; } - while (tokens[endgap].position + textLength < end) + while (tokens[endgap].position + textLength < currentEnd) { endgap++; + } return gap; } Modified: isql-core/trunk/src/org/isqlviewer/sql/processor/SqlProcessor.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/processor/SqlProcessor.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/processor/SqlProcessor.java 2007-04-30 22:15:13 UTC (rev 47) @@ -28,6 +28,7 @@ package org.isqlviewer.sql.processor; import java.sql.DatabaseMetaData; +import java.sql.ResultSet; import java.sql.SQLException; import org.isqlviewer.util.StringTokenizer; @@ -50,8 +51,9 @@ initUniKind(); } - public void installServiceKeywords(DatabaseMetaData metaData) throws SQLException { + public void installServiceKeywords(DatabaseMetaData metaData, String catalog, String schema) throws SQLException { + initSymbolTable(); String wordSet = metaData.getSystemFunctions(); StringTokenizer st = new StringTokenizer(wordSet, ","); while (st.hasMoreTokens()) { @@ -79,6 +81,12 @@ String nextToken = st.nextToken(); lookup(TokenType.FUNCTION, nextToken); } + + ResultSet set = metaData.getTables(catalog, schema, null, null); + while (set.next()) { + String tableName = set.getString("TABLE_NAME"); + lookup(TokenType.TABLE_NAME, tableName); + } } @Override @@ -780,9 +788,10 @@ // Read a number, without checking whether it is out of range // Doesn't deal with e.g. 0777.9 or 07779f - private TokenType readNumber(char c) { + private TokenType readNumber(final char c) { - if (c == '0') { + char character = c; + if (character == '0') { int saveStart = start, saveLength = charlength; start = start + charlength; charlength = 1; @@ -838,31 +847,31 @@ readDigits(10); if (start >= end) return TokenType.NUMBER; - c = buffer[start]; - if (c == '\\') - c = next(); - if (c == 'l' || c == 'L') { + character = buffer[start]; + if (character == '\\') + character = next(); + if (character == 'l' || character == 'L') { start = start + charlength; charlength = 1; return TokenType.NUMBER; } } - if (c == '.') { + if (character == '.') { start = start + charlength; charlength = 1; if (start >= end) return TokenType.NUMBER; - c = buffer[start]; - if (c == '\\') - c = next(); + character = buffer[start]; + if (character == '\\') + character = next(); if ('0' <= c && c <= '9') { hasDigits = true; readDigits(10); if (start >= end) return TokenType.NUMBER; - c = buffer[start]; - if (c == '\\') - c = next(); + character = buffer[start]; + if (character == '\\') + character = next(); } } if (!hasDigits) @@ -874,17 +883,19 @@ charlength = 1; if (start >= end) return bad(); - c = buffer[start]; - if (c == '\\') - c = next(); + character = buffer[start]; + if (character == '\\') + character = next(); if (c == '+' || c == '-') { start = start + charlength; charlength = 1; - if (start >= end) + if (start >= end) { return bad(); - c = buffer[start]; - if (c == '\\') - c = next(); + } + character = buffer[start]; + if (character == '\\') { + character = next(); + } } readDigits(10); break; Modified: isql-core/trunk/src/org/isqlviewer/sql/processor/TokenType.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/processor/TokenType.java 2007-04-30 22:12:52 UTC (rev 46) +++ isql-core/trunk/src/org/isqlviewer/sql/processor/TokenType.java 2007-04-30 22:15:13 UTC (rev 47) @@ -126,7 +126,11 @@ /** * */ - VARIABLE; + VARIABLE, + /** + * + */ + TABLE_NAME; public static TokenType forByte(byte index) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:12:51
|
Revision: 46 http://svn.sourceforge.net/isql/?rev=46&view=rev Author: mkobold Date: 2007-04-30 15:12:52 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * CommandType.java ** Removed and simplified this enumeration. * HistoryReference.java ** Removed due to complication with the 'heavy' peer class. * HistoricalCommand.java ** Refactored to be both light and heavy in the same object. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/history/CommandType.java isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java Removed Paths: ------------- isql-core/trunk/src/org/isqlviewer/history/HistoryReference.java Modified: isql-core/trunk/src/org/isqlviewer/history/CommandType.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/history/CommandType.java 2007-04-30 22:09:50 UTC (rev 45) +++ isql-core/trunk/src/org/isqlviewer/history/CommandType.java 2007-04-30 22:12:52 UTC (rev 46) @@ -38,35 +38,31 @@ /** * Place holder for all commands for completeness, no real value. */ - NOT_DEFINED("unavailable"), + NOT_DEFINED("null_data"), /** * A SQL command that is not prepared nor a callable statement. */ - QUERY("search"), + QUERY("query"), /** - * Command for when a rollback command is invoked on the connection. + * */ - TRANSACTION_ROLLBACK("rollback"), + BATCH_QUERY("db_batch"), /** - * Command for when a commit command is invoked on the connection. + * The SQL command was executed using one of the executeUpdate methods. */ - TRANSACTION_COMMIT("commit"), + UPDATE_QUERY("db_update"), /** - * Command for when the auto-commit flag is initially set to false, since it is by default true. + * */ - TRANSACTION_START("transaction"), + DELETE_QUERY("db_delete"), /** - * The SQL Command was executed using a callable statement instance. + * */ - STORED_PROCEDURE("script"), + INSERT_QUERY("db_insert"), /** - * The SQL command was executed using a prepared statement instance.. + * */ - PREPARED_QUERY("datatypeset"), - /** - * The SQL command was executed using one of the executeUpdate methods. - */ - UPDATE_QUERY("apply"); + PREPARED_QUERY(""); private String preferredIcon = null; Modified: isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java 2007-04-30 22:09:50 UTC (rev 45) +++ isql-core/trunk/src/org/isqlviewer/history/HistoricalCommand.java 2007-04-30 22:12:52 UTC (rev 46) @@ -28,12 +28,20 @@ package org.isqlviewer.history; import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; +import java.io.Serializable; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.Date; import java.util.Enumeration; import java.util.Vector; +import org.isqlviewer.FieldNotModifiableException; +import org.isqlviewer.sql.embedded.EmbeddedDatabase; import org.isqlviewer.util.Assertions; +import org.isqlviewer.util.BasicUtilities; /** * Generic command object for logging command history within iSQL-Viewer. @@ -42,7 +50,7 @@ * @author Mark A. Kobold <mkobold at isqlviewer dot com> * @version 1.0 */ -public class HistoricalCommand extends HistoryReference { +public class HistoricalCommand implements Serializable, Transferable { /** * Standard data-transfer flavor for DnD operations. @@ -52,37 +60,202 @@ private String commandText = null; private String service = null; + private long id = -1; + private long transactionId = -1; + private CommandType type = CommandType.NOT_DEFINED; + private Date queryTime = null; private Vector<HistoricalCommand> subCommands = new Vector<HistoricalCommand>(); - @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if (FLAVOR.equals(flavor)) { - return this; - } else if (flavor.isFlavorTextType()) { - return getCommandText(); + if (flavor != null) { + EmbeddedDatabase database = EmbeddedDatabase.getSharedInstance(); + HistoricalCommand command = null; + try { + if (hasChildCommands()) { + command = database.getHistoricalCommand(this); + } else { + command = database.getHistoricalCommand(getId()); + } + } catch (SQLException sourceError) { + IOException wrappedError = new IOException(sourceError.getMessage()); + BasicUtilities.wrapThrowable(sourceError, wrappedError); + throw wrappedError; + } + StringBuilder userCommand = new StringBuilder(); + if (hasChildCommands()) { + for (HistoricalCommand child : command.subCommands) { + userCommand.append(child.getCommandText()); + userCommand.append(";\n"); + } + command.setCommandText(userCommand.toString()); + } + if (HistoricalCommand.FLAVOR.equals(flavor)) { + return command; + } else if (flavor.isFlavorTextType()) { + return command.getCommandText(); + } } throw new UnsupportedFlavorException(flavor); } - @Override public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[]{FLAVOR, DataFlavor.stringFlavor}; + return new DataFlavor[]{FLAVOR, HistoricalCommand.FLAVOR, DataFlavor.stringFlavor}; } - @Override public boolean isDataFlavorSupported(DataFlavor flavor) { if (flavor != null) { - if (FLAVOR.equals(flavor) || flavor.isFlavorTextType()) { + if (FLAVOR.equals(flavor) || HistoricalCommand.FLAVOR.equals(flavor) || flavor.isFlavorTextType()) { return true; } } return false; } + @Override + public int hashCode() { + + return (int) (id ^ (id >>> 32)); + } + + @Override + public boolean equals(Object other) { + + if (other instanceof HistoricalCommand) { + HistoricalCommand hr = (HistoricalCommand) other; + return hr.id == id; + } + return false; + } + + @Override + public String toString() { + + Object[] arguments = new Object[3]; + arguments[0] = Long.toString(id); + arguments[1] = Long.toString(transactionId); + arguments[2] = type.name(); + return MessageFormat.format("HistoricalCommand[id=''{0}'', txnId=''{1}'', type=''{2}'']", arguments); + } + /** + * Gets the execution time at which this event occured. + * <p> + * + * @return timestamp at which this event happened as Java Date; can be null if not previously set. + */ + public Date getQueryTime() { + + return queryTime == null ? null : (Date) queryTime.clone(); + } + + /** + * Sets the time this command was executed at in millis. + * <p> + * + * @param queryTime as a Java date object. + * @throws NullPointerException if the given queryTime value is null. + */ + public void setQueryTime(Date queryTime) { + + Assertions.assertNotNull("history-query-time", queryTime); + this.queryTime = (Date) queryTime.clone(); + } + + /** + * Gets the unique identifier for this history reference. + * <p> + * Simply number that unique identifies this service reference within the iSQL-Viewer application. If the Id is -1 + * or less than 0, then that indicates that this particular history reference instance is not registered within the + * application. + * <p> + * This value has no real value other than uniquely identifying this historical event. + * + * @return the id of this historical command; can be negative if not previously set. + */ + public long getId() { + + return id; + } + + /** + * Sets the service reference identifier to the specified value. + * <p> + * + * @param id the id to set to uniquely identify this service. + * @throws IllegalArgumentException if the given id is not a positive number. + * @throws FieldNotModifiableException if the id for this instance has already been set. + */ + public void setId(long id) { + + Assertions.assertPositive("history-reference-id", id); + if (this.id == -1) { + this.id = id; + } else { + throw new FieldNotModifiableException("history-reference-id"); + } + } + + /** + * Gets the type of historical event this instance represents. + * <p> + * + * @return the type of command this instance is. + */ + public CommandType getType() { + + return type; + } + + /** + * Sets the type of command this event represents. + * <p> + * + * @param type the event type for this instance. + * @throws NullPointerException if the given type is null. + * @throws FieldNotModifiableException if the type has been previously set. + */ + public void setType(CommandType type) { + + Assertions.assertNotNull("history-reference-type", type); + if (this.type == CommandType.NOT_DEFINED) { + this.type = type; + } else { + throw new FieldNotModifiableException("history-reference-type"); + } + } + + /** + * Gets the transaction id for this event. + * <p> + * If multiple events occur within the same transaction they will all be associated with the same transaction id. + * This id has no real value in its solitary form. + * + * @return the transactionId for this event; can be negative if not set or is not applicable to this event. + */ + public long getTransactionId() { + + return transactionId; + } + + /** + * Sets the transactional id for this event . + * <p> + * + * @param transactionId to set for this event. + * @throws IllegalArgumentException if the given transaction id is negative; with the exception -1; + */ + public void setTransactionId(long transactionId) { + + if (transactionId != -1) { + Assertions.assertPositive("history-reference-transaction-id", transactionId); + } + this.transactionId = transactionId; + } + + /** * Gets the commandText of this command that was executed. * <p> * @@ -207,4 +380,9 @@ return !subCommands.isEmpty(); } + + public int getChildCount() { + + return subCommands.size(); + } } \ No newline at end of file Deleted: isql-core/trunk/src/org/isqlviewer/history/HistoryReference.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/history/HistoryReference.java 2007-04-30 22:09:50 UTC (rev 45) +++ isql-core/trunk/src/org/isqlviewer/history/HistoryReference.java 2007-04-30 22:12:52 UTC (rev 46) @@ -1,265 +0,0 @@ -/* - * Copyright 2000-2005 by Mark A. Kobold - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - * the specific language governing rights and limitations under the License. - * - * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are Copyright (C) - * 2000-2005 Mark A. Kobold. All Rights Reserved. - * - * Contributor(s): - * Mark A. Kobold <mk...@is...>. - * - * Contributor(s): all the names of the contributors are added in the source - * code where applicable. - * - * If you didn't download this code from the following link, you should check - * if you aren't using an obsolete version: http://isql.sourceforge.net/ - */ -package org.isqlviewer.history; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.IOException; -import java.io.Serializable; -import java.sql.SQLException; -import java.util.Date; - -import org.isqlviewer.FieldNotModifiableException; -import org.isqlviewer.sql.embedded.EmbeddedDatabase; -import org.isqlviewer.util.Assertions; -import org.isqlviewer.util.BasicUtilities; - -/** - * Lightwieght object to refer to a historical command object. - * <p> - * This object can be used to query the 'heavier' historical information. This object contains the basic information to - * be rendered to the user. - * - * @author Mark A. Kobold <mkobold at isqlviewer dot com> - * @see org.isqlviewer.history.HistoricalCommand - * @version 1.0 - */ -public class HistoryReference implements Serializable, Transferable { - - /** - * Standard data-transfer flavor for DnD operations. - */ - public static final DataFlavor FLAVOR = new DataFlavor(HistoryReference.class, "iSQL-Viewer Historical Command"); - - private long id = -1; - private long transactionId = -1; - private CommandType type = CommandType.NOT_DEFINED; - private String shortCommand = null; - private Date queryTime = null; - private static final long serialVersionUID = 2025914937121793336L; - - @Override - public int hashCode() { - - return (int) (id ^ (id >>> 32)); - } - - @Override - public boolean equals(Object other) { - - if (other instanceof HistoryReference) { - HistoryReference hr = (HistoryReference) other; - return hr.id == id; - } - return false; - } - - /** - * Gets the execution time at which this event occured. - * <p> - * - * @return timestamp at which this event happened as Java Date; can be null if not previously set. - */ - public Date getQueryTime() { - - return queryTime == null ? null : (Date) queryTime.clone(); - } - - /** - * Sets the time this command was executed at in millis. - * <p> - * - * @param queryTime as a Java date object. - * @throws NullPointerException if the given queryTime value is null. - */ - public void setQueryTime(Date queryTime) { - - Assertions.assertNotNull("history-query-time", queryTime); - this.queryTime = (Date) queryTime.clone(); - } - - /** - * Gets the unique identifier for this history reference. - * <p> - * Simply number that unique identifies this service reference within the iSQL-Viewer application. If the Id is -1 - * or less than 0, then that indicates that this particular history reference instance is not registered within the - * application. - * <p> - * This value has no real value other than uniquely identifying this historical event. - * - * @return the id of this historical command; can be negative if not previously set. - */ - public long getId() { - - return id; - } - - /** - * Sets the service reference identifier to the specified value. - * <p> - * - * @param id the id to set to uniquely identify this service. - * @throws IllegalArgumentException if the given id is not a positive number. - * @throws FieldNotModifiableException if the id for this instance has already been set. - */ - public void setId(long id) { - - Assertions.assertPositive("history-reference-id", id); - if (this.id == -1) { - this.id = id; - } else { - throw new FieldNotModifiableException("history-reference-id"); - } - } - - /** - * Gets the type of historical event this instance represents. - * <p> - * - * @return the type of command this instance is. - */ - public CommandType getType() { - - return type; - } - - /** - * Sets the type of command this event represents. - * <p> - * - * @param type the event type for this instance. - * @throws NullPointerException if the given type is null. - * @throws FieldNotModifiableException if the type has been previously set. - */ - public void setType(CommandType type) { - - Assertions.assertNotNull("history-reference-type", type); - if (this.type == CommandType.NOT_DEFINED) { - this.type = type; - } else { - throw new FieldNotModifiableException("history-reference-type"); - } - } - - /** - * Gets the transaction id for this event. - * <p> - * If multiple events occur within the same transaction they will all be associated with the same transaction id. - * This id has no real value in its solitary form. - * - * @return the transactionId for this event; can be negative if not set or is not applicable to this event. - */ - public long getTransactionId() { - - return transactionId; - } - - /** - * Sets the transactional id for this event . - * <p> - * - * @param transactionId to set for this event. - * @throws IllegalArgumentException if the given transaction id is negative; with the exception -1; - */ - public void setTransactionId(long transactionId) { - - if (transactionId != -1) { - Assertions.assertPositive("history-reference-transaction-id", transactionId); - } - this.transactionId = transactionId; - } - - /** - * Gets the short version of this command. - * <p> - * This value is usually the actual command, since generally in SQL the real command INSERT,CREATE,SELECT, DELETE, - * UPDATE and so forth are all always the first word in the command. - * <p> - * This value serves as *short-hand* to the full command text executed. - * - * @return the short hand text of the fulle command text this history item refers to; can be null if not set. - */ - public String getShortCommand() { - - return shortCommand; - } - - /** - * Sets the short hand version of the full command text of this history reference. - * <p> - * - * @param shortCommand short hand version of the command text. - * @throws NullPointerException if the given shortCommand is null. - */ - public void setShortCommand(String shortCommand) { - - Assertions.assertNotNull("history-short-command", shortCommand); - this.shortCommand = shortCommand; - } - - public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - - if (flavor != null) { - EmbeddedDatabase database = EmbeddedDatabase.getSharedInstance(); - if (FLAVOR.equals(flavor)) { - return this; - } - HistoricalCommand command = null; - try { - command = database.getHistoricalCommand(this); - } catch (SQLException sourceError) { - IOException wrappedError = new IOException(sourceError.getMessage()); - BasicUtilities.wrapThrowable(sourceError, wrappedError); - throw wrappedError; - } - if (HistoricalCommand.FLAVOR.equals(flavor)) { - return command; - } else if (flavor.isFlavorTextType()) { - return command.getCommandText(); - } - } - throw new UnsupportedFlavorException(flavor); - } - - public DataFlavor[] getTransferDataFlavors() { - - return new DataFlavor[]{FLAVOR, HistoricalCommand.FLAVOR, DataFlavor.stringFlavor}; - } - - public boolean isDataFlavorSupported(DataFlavor flavor) { - - if (flavor != null) { - if (FLAVOR.equals(flavor) || HistoricalCommand.FLAVOR.equals(flavor) || flavor.isFlavorTextType()) { - return true; - } - } - return false; - } - -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-04-30 22:09:51
|
Revision: 45 http://svn.sourceforge.net/isql/?rev=45&view=rev Author: mkobold Date: 2007-04-30 15:09:50 -0700 (Mon, 30 Apr 2007) Log Message: ----------- * Renamed data-flavors as to not create confusion since they had the same name. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java 2007-03-03 19:38:43 UTC (rev 44) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/Bookmark.java 2007-04-30 22:09:50 UTC (rev 45) @@ -51,7 +51,7 @@ /** * Standard data-transfer flavor for DnD operations. */ - public static final DataFlavor FLAVOR = new DataFlavor(Bookmark.class, "iSQL-Viewer SQL Bookmark"); + public static final DataFlavor BOOKMARK_FLAVOR = new DataFlavor(Bookmark.class, "iSQL-Viewer SQL Bookmark"); private static final long serialVersionUID = 9004874440081925048L; // raw SQL text for this bookmark. @@ -93,7 +93,7 @@ @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if (FLAVOR.equals(flavor)) { + if (BOOKMARK_FLAVOR.equals(flavor)) { return this; } else if (flavor.isFlavorTextType()) { return getCommandText(); @@ -104,14 +104,14 @@ @Override public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[]{FLAVOR, DataFlavor.stringFlavor}; + return new DataFlavor[]{BOOKMARK_FLAVOR, DataFlavor.stringFlavor}; } @Override public boolean isDataFlavorSupported(DataFlavor flavor) { if (flavor != null) { - if (FLAVOR.equals(flavor) || flavor.isFlavorTextType()) { + if (BOOKMARK_FLAVOR.equals(flavor) || flavor.isFlavorTextType()) { return true; } } Modified: isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java 2007-03-03 19:38:43 UTC (rev 44) +++ isql-core/trunk/src/org/isqlviewer/bookmarks/BookmarkReference.java 2007-04-30 22:09:50 UTC (rev 45) @@ -49,7 +49,7 @@ /** * Standard data-transfer flavor for DnD operations. */ - public static final DataFlavor FLAVOR = new DataFlavor(BookmarkReference.class, "iSQL-Viewer Bookmark Reference"); + public static final DataFlavor BOOKMARK_REFERENCE_FLAVOR = new DataFlavor(BookmarkReference.class, "iSQL-Viewer Bookmark Reference"); private static final long serialVersionUID = 3377871201547716160L; private long id = -1; @@ -189,7 +189,7 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (flavor != null) { - if (FLAVOR.equals(flavor)) { + if (BOOKMARK_REFERENCE_FLAVOR.equals(flavor)) { return this; } Bookmark bookmark = null; @@ -202,7 +202,7 @@ BasicUtilities.wrapThrowable(sourceError, wrappedError); throw wrappedError; } - if (Bookmark.FLAVOR.equals(flavor)) { + if (Bookmark.BOOKMARK_FLAVOR.equals(flavor)) { return bookmark; } else if (flavor.isFlavorTextType()) { return bookmark.getCommandText(); @@ -214,15 +214,15 @@ public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[]{FLAVOR, Bookmark.FLAVOR, DataFlavor.stringFlavor}; + return new DataFlavor[]{BOOKMARK_REFERENCE_FLAVOR, Bookmark.BOOKMARK_FLAVOR, DataFlavor.stringFlavor}; } public boolean isDataFlavorSupported(DataFlavor flavor) { if (flavor != null) { - if (FLAVOR.equals(flavor)) { + if (BOOKMARK_REFERENCE_FLAVOR.equals(flavor)) { return true; - } else if (Bookmark.FLAVOR.equals(flavor)) { + } else if (Bookmark.BOOKMARK_FLAVOR.equals(flavor)) { return true; } else if (flavor.isFlavorTextType()) { return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:38:42
|
Revision: 44 http://svn.sourceforge.net/isql/?rev=44&view=rev Author: mkobold Date: 2007-03-03 11:38:43 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * processor/Token.java ** made class public. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/sql/processor/Token.java Modified: isql-core/trunk/src/org/isqlviewer/sql/processor/Token.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/processor/Token.java 2007-03-03 19:36:47 UTC (rev 43) +++ isql-core/trunk/src/org/isqlviewer/sql/processor/Token.java 2007-03-03 19:38:43 UTC (rev 44) @@ -34,7 +34,7 @@ * @author Mark A. Kobold <mkobold at isqlviewer dot com> * @version 1.0 */ -class Token { +public class Token { /** * The symbol contains all the properties shared with similar tokens. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:36:47
|
Revision: 43 http://svn.sourceforge.net/isql/?rev=43&view=rev Author: mkobold Date: 2007-03-03 11:36:47 -0800 (Sat, 03 Mar 2007) Log Message: ----------- Lots of things changed here need to commit to synchronize with the isql-core packages. Modified Paths: -------------- isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/table/ResultSetTableModel.java isql-swing/trunk/src/org/isqlviewer/swing/text/SyntaxStylizer.java isql-swing/trunk/src/org/isqlviewer/ui/ApplicationFrame.java isql-swing/trunk/src/org/isqlviewer/ui/BookmarkEditor.java isql-swing/trunk/src/org/isqlviewer/ui/DataGrid.java isql-swing/trunk/src/org/isqlviewer/ui/JdbcWorkbench.java isql-swing/trunk/src/org/isqlviewer/ui/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/SqlCommandEditor.java isql-swing/trunk/src/org/isqlviewer/ui/SwingLauncher.java isql-swing/trunk/src/org/isqlviewer/ui/TabbedResultsetRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/WizardRunner.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/BookmarkTreeDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/ResultSetRendererDropTarget.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedTreeUI.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/BookmarkTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/HistoryTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/SchemaTreeDragListener.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/SchemaTreeListener.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/BookmarkTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/AbstractWizardStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/wizards/WizardContext.java Added Paths: ----------- isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java isql-swing/trunk/src/org/isqlviewer/swing/text/SyntaxHighlighter.java isql-swing/trunk/src/org/isqlviewer/swing/text/package.html isql-swing/trunk/src/org/isqlviewer/ui/WorkbenchView.java isql-swing/trunk/src/org/isqlviewer/ui/dnd/SchemaNodeRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/laf/ColorLedIcon.java isql-swing/trunk/src/org/isqlviewer/ui/laf/EnhancedListCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/listeners/BookmarkMouseInputListener.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTableCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoryTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfigureBasicServiceOptions.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfigureServiceResources.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmDeleteService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmNewService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ConfirmUpdateService.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ResourceBundle.properties isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceFunctionStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceStep.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/SelectServiceType.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/ServiceWizard.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/service/package.html Removed Paths: ------------- isql-swing/trunk/src/org/isqlviewer/swing/text/SQLDocument.java isql-swing/trunk/src/org/isqlviewer/swing/text/SqlScanner.java isql-swing/trunk/src/org/isqlviewer/ui/ServiceManagerView.java isql-swing/trunk/src/org/isqlviewer/ui/renderer/HistoricalCommandTreeCellRenderer.java isql-swing/trunk/src/org/isqlviewer/ui/wizards/NewServiceWizard.java Modified: isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/model/BookmarkTreeModel.java 2007-03-03 19:36:47 UTC (rev 43) @@ -27,11 +27,17 @@ */ package org.isqlviewer.model; +import java.sql.SQLException; + +import javax.swing.event.TreeModelEvent; import javax.swing.tree.TreePath; -import org.isqlviewer.bookmarks.Bookmark; import org.isqlviewer.bookmarks.BookmarkFolder; +import org.isqlviewer.bookmarks.BookmarkReference; +import org.isqlviewer.sql.embedded.EmbeddedDatabase; import org.isqlviewer.swing.AbstractTreeModel; +import org.isqlviewer.ui.BookmarkEditor; +import org.isqlviewer.ui.OperationStatus; /** * Datamodel for managing Bookmark objects similar to a local-filesystem. @@ -54,14 +60,14 @@ */ public class BookmarkTreeModel extends AbstractTreeModel { - private BookmarkFolder rootNode = null; + private BookmarkFolder rootFolder = null; /** * @param rootFolder */ public BookmarkTreeModel(BookmarkFolder rootFolder) { - this.rootNode = rootFolder; + this.rootFolder = rootFolder; } public Object getChild(Object parent, int index) { @@ -93,15 +99,102 @@ public Object getRoot() { - return rootNode; + return rootFolder; } public boolean isLeaf(Object node) { - return (node == null || node instanceof Bookmark); + return (node == null || node instanceof BookmarkReference); } public void valueForPathChanged(TreePath path, Object newValue) { + System.out.println("path:" + path + "; " + newValue); + Object changedObject = path.getLastPathComponent(); + String changedName = newValue.toString(); + EmbeddedDatabase database = EmbeddedDatabase.getSharedInstance(); + if (changedObject instanceof BookmarkReference) { + BookmarkReference reference = (BookmarkReference) changedObject; + String previousName = reference.getName(); + try { + reference.setName(changedName); + database.updateBookmark(reference); + } catch (SQLException e) { + reference.setName(previousName); + } + } else if (changedObject instanceof BookmarkFolder) { + BookmarkFolder folder = (BookmarkFolder) changedObject; + String previousName = folder.getName(); + String existingPath = folder.getPath(); + try { + folder.setName(changedName); + String newPath = folder.getPath(); + database.renameBookmarkFolder(existingPath, newPath); + } catch (SQLException e) { + folder.setName(previousName); + } + } } + + public void removeBookmark(BookmarkReference bookmark) { + + BookmarkFolder parentFolder = rootFolder.findChildPath(bookmark.getPath()); + parentFolder = (parentFolder == null) ? rootFolder : parentFolder; + + Object[] objectPath = BookmarkFolder.getPathElements(parentFolder); + Object[] children = new Object[]{bookmark}; + int[] indicies = new int[]{parentFolder.indexOfChild(bookmark)}; + parentFolder.removeBookmark(bookmark); + + TreeModelEvent removeEvent = new TreeModelEvent(this, objectPath, indicies, children); + fireTreeNodesRemoved(removeEvent); + } + + public void removeBookmarkFolder(BookmarkFolder folder) { + + BookmarkFolder parentFolder = folder.getParentFolder(); + parentFolder = (parentFolder == null) ? rootFolder : parentFolder; + + Object[] objectPath = BookmarkFolder.getPathElements(parentFolder); + Object[] children = new Object[]{folder}; + int[] indicies = new int[]{parentFolder.indexOfChild(folder)}; + parentFolder.removeFolder(folder); + + TreeModelEvent removeEvent = new TreeModelEvent(this, objectPath, indicies, children); + fireTreeNodesRemoved(removeEvent); + } + + public void addBookmark(BookmarkReference bookmark, BookmarkFolder parentFolder) { + + parentFolder.addBookmark(bookmark); + Object[] objectPath = BookmarkFolder.getPathElements(parentFolder); + Object[] children = new Object[]{bookmark}; + int[] indicies = new int[]{parentFolder.indexOfChild(bookmark)}; + + TreeModelEvent addEvent = new TreeModelEvent(this, objectPath, indicies, children); + fireTreeNodesInserted(addEvent); + } + + public void addBookmarkFolder(BookmarkFolder parentFolder, String folderName) { + + BookmarkFolder childFolder = parentFolder.addChildFolder(folderName); + + Object[] objectPath = BookmarkFolder.getPathElements(parentFolder); + Object[] children = new Object[]{childFolder}; + int[] indicies = new int[]{parentFolder.indexOfChild(childFolder)}; + + TreeModelEvent removeEvent = new TreeModelEvent(this, objectPath, indicies, children); + fireTreeNodesInserted(removeEvent); + } + + public void reload(BookmarkFolder parentFolder, BookmarkReference bookmark) { + + Object[] objectPath = BookmarkFolder.getPathElements(parentFolder); + Object[] children = new Object[]{bookmark}; + int[] indicies = new int[]{parentFolder.indexOfChild(bookmark)}; + parentFolder.addBookmark(bookmark); + + TreeModelEvent changeEvent = new TreeModelEvent(this, objectPath, indicies, children); + fireTreeNodesChanged(changeEvent); + } } \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/model/HistoryTreeModel.java 2007-03-03 19:36:47 UTC (rev 43) @@ -27,42 +27,64 @@ */ package org.isqlviewer.model; -import java.text.DateFormat; +import java.sql.SQLException; import java.util.Calendar; import java.util.Date; +import java.util.List; +import java.util.TreeMap; import java.util.Vector; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; +import javax.swing.event.TreeModelEvent; import javax.swing.tree.TreePath; import org.isqlviewer.JdbcCommandLogger; -import org.isqlviewer.history.CommandType; import org.isqlviewer.history.HistoricalCommand; -import org.isqlviewer.sql.JdbcService; +import org.isqlviewer.history.HistoryReference; +import org.isqlviewer.sql.embedded.EmbeddedDatabase; import org.isqlviewer.swing.outline.AbstractTreeTableModel; import org.isqlviewer.swing.outline.OutlineModel; /** - * Model for displaying the history items in a tree fashion. + * Model for displaying the historical events in a tree fashion. * <p> - * This model is based on an internal mappings of Date objects to ArrayList objects that contain the historical items - * based on the key Date object. - * <p> - * The root object for this model is simply a dummy object value and has no real significance other than for purposes of - * this model. + * This model is a two tier tree such that there are date nodes refere to an internal collection historical reference + * nodes. * - * @author Markus A. Kobold <mkobold at sprintpcs dot com> + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @see org.isqlviewer.history.HistoryReference + * @version 1.0 */ public final class HistoryTreeModel extends AbstractTreeTableModel implements JdbcCommandLogger { - private final Vector<HistoricalCommand> rootNode = new Vector<HistoricalCommand>(); - protected static final Class[] columnTypes = {OutlineModel.class, Date.class}; + private static final Class[] columnTypes = {OutlineModel.class, Date.class}; + private final TreeMap<Date, List<HistoryReference>> rootNode = new TreeMap<Date, List<HistoryReference>>(); + private final List<Date> rootKeySet = new Vector<Date>(); + public HistoryTreeModel() { } + public void addReference(HistoryReference reference) { + + Date normalizedDate = normalizeTimestamp(reference.getQueryTime()); + List<HistoryReference> set = null; + synchronized (rootNode) { + set = rootNode.get(normalizedDate); + if (set == null) { + set = new Vector<HistoryReference>(); + rootNode.put(normalizedDate, set); + rootKeySet.add(normalizedDate); + reload(); + } + set.add(reference); + } + Object[] objectPath = new Object[]{rootNode, normalizedDate}; + Object[] children = new Object[]{reference}; + int[] indicies = new int[]{set.size() - 1}; + fireTreeNodesInserted(new TreeModelEvent(this, objectPath, indicies, children)); + } + /** * Empties this tree model of all internal references to other objects. * <p> @@ -82,29 +104,31 @@ public Object getChild(Object parent, int index) { if (parent == rootNode) { - return rootNode.get(index); + return rootKeySet.get(index); + } else if (parent instanceof Date) { + List< ? > list = rootNode.get(parent); + return list == null ? null : list.get(index); } - - HistoricalCommand treeNode = (HistoricalCommand) parent; - return treeNode.getChildCommand(index); + return null; } public int getChildCount(Object parent) { if (parent == rootNode) { - return rootNode.size(); + return rootKeySet.size(); + } else if (parent instanceof Date) { + List< ? > list = rootNode.get(parent); + return list == null ? 0 : list.size(); } - HistoricalCommand treeNode = (HistoricalCommand) parent; - return treeNode.size(); + return 0; } public boolean isLeaf(Object node) { - if (node == rootNode) { - return false; + if (node instanceof HistoryReference) { + return true; } - HistoricalCommand treeNode = (HistoricalCommand) node; - return !treeNode.hasChildCommands(); + return false; } public void valueForPathChanged(TreePath path, Object newValue) { @@ -114,86 +138,14 @@ public int getIndexOfChild(Object parent, Object child) { if (parent == rootNode) { - return rootNode.indexOf(child); + return rootKeySet.indexOf(child); + } else if (parent instanceof Date) { + List< ? > list = rootNode.get(parent); + return list == null ? -1 : list.indexOf(child); } - HistoricalCommand treeNode = (HistoricalCommand) parent; - return treeNode.indexOf((HistoricalCommand) child); + return -1; } - public void addChangeListener(ChangeListener listener) { - - eventListeners.add(ChangeListener.class, listener); - } - - public void removeChangeListener(ChangeListener listener) { - - eventListeners.remove(ChangeListener.class, listener); - } - - public Date[] getCommandExecutionBlocks(int calendarField) { - - return null; - } - - public HistoricalCommand[] getLoggedCommands() { - - return null; - } - - public HistoricalCommand[] getLoggedCommands(int calendarField, Date executionBlock) { - - return null; - } - - public synchronized void logCommand(JdbcService service, HistoricalCommand command) { - - Date normalizedDate = normalizeTimestamp(command.getExecutionTime()); - HistoricalCommand parentCommand = null; - for (HistoricalCommand root : rootNode) { - if (root.getExecutionTime().equals(normalizedDate)) { - parentCommand = root; - break; - } - } - if (parentCommand == null) { - parentCommand = new HistoricalCommand(CommandType.ROOT); - parentCommand.setExecutionTime(normalizedDate); - parentCommand.setName(DateFormat.getDateInstance(DateFormat.MEDIUM).format(normalizedDate)); - rootNode.add(parentCommand); - } - parentCommand.add(command); - fireStateChanged(new ChangeEvent(this)); - reload(); - } - - public void logTransactionCommited(JdbcService service) { - - HistoricalCommand command = new HistoricalCommand(CommandType.TRANSACTION_COMMIT); - command.setExecutionTime(new Date(System.currentTimeMillis())); - logCommand(service, command); - } - - public void logTransactionRolledback(JdbcService service) { - - HistoricalCommand command = new HistoricalCommand(CommandType.TRANSACTION_ROLLBACK); - command.setExecutionTime(new Date(System.currentTimeMillis())); - logCommand(service, command); - } - - public void logTransactionStarted(JdbcService service) { - - HistoricalCommand command = new HistoricalCommand(CommandType.TRANSACTION_START); - command.setExecutionTime(new Date(System.currentTimeMillis())); - logCommand(service, command); - } - - public void logTransactionFinished(JdbcService service) { - - HistoricalCommand command = new HistoricalCommand(CommandType.TRANSACTION_FINISHED); - command.setExecutionTime(new Date(System.currentTimeMillis())); - logCommand(service, command); - } - public Class getColumnClass(int column) { return columnTypes[column]; @@ -220,16 +172,19 @@ if (node == rootNode) { return rootNode; + } else if (column == 0 && node instanceof Date) { + return node; } + return node; + } - HistoricalCommand command = (HistoricalCommand) node; - switch (column) { - case 0 : - return command.getName(); - case 1 : - return command.getExecutionTime(); - default : - return null; + public synchronized void logCommand(HistoricalCommand command) { + + EmbeddedDatabase edb = EmbeddedDatabase.getSharedInstance(); + try { + HistoryReference reference = edb.addHistoricalCommand(command); + addReference(reference); + } catch (SQLException e) { } } @@ -238,20 +193,6 @@ } - private void fireStateChanged(ChangeEvent e) { - - ChangeListener[] ll = eventListeners.getListeners(ChangeListener.class); - if (ll != null) { - for (int i = 0; i < ll.length; i++) { - try { - ll[i].stateChanged(e); - } catch (Exception error) { - error("Error Dispatching ChangeEvent (" + e + ")", error); - } - } - } - } - // Normalizes the timestamp to the zero hour minute and seconds of the day// private Date normalizeTimestamp(Date timestamp) { @@ -261,9 +202,7 @@ calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); - Date branchDate = calendar.getTime(); return branchDate; } - } \ No newline at end of file Modified: isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/model/SchemaNode.java 2007-03-03 19:36:47 UTC (rev 43) @@ -46,8 +46,8 @@ */ public final class SchemaNode extends DefaultMutableTreeNode implements Transferable { - public static final DataFlavor DATA_FLAVOR = new DataFlavor( - SchemaNode.class, "java-x-object/org.isqlviewer.model.HistoryNode"); + public static final String MIME_TYPE = "java-x-object/org.isqlviewer.model.SchemaNode"; + public static final DataFlavor DATA_FLAVOR = new DataFlavor(SchemaNode.class, MIME_TYPE); private static final long serialVersionUID = 1L; private SchemaNodeType nodeType = null; Modified: isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/model/SchemaNodeType.java 2007-03-03 19:36:47 UTC (rev 43) @@ -100,7 +100,7 @@ /** * This node type is a place holder as the parent node for stored procedure for the actual procedure type. */ - PROCEDURE_SET("datatypeset"), + PROCEDURE_SET("stored_procedure_folder"), /** * Node that represents a stored procedure definied in the current catalog and or schema. * <p> Modified: isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/DocumentAppender.java 2007-03-03 19:36:47 UTC (rev 43) @@ -40,6 +40,7 @@ import java.awt.Color; import java.awt.Font; +import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.prefs.PreferenceChangeEvent; @@ -150,8 +151,37 @@ builder.append(sdf.format(new Date(event.timeStamp))); builder.append(' '); builder.append(event.getRenderedMessage()); + ThrowableInformation errors = event.getThrowableInformation(); if (errors != null) { + Throwable exception = errors.getThrowable(); + if (exception instanceof SQLException) { + SQLException sqlError = (SQLException) exception; + builder.append('\n'); + builder.append(exception.getClass()); + builder.append('\t'); + builder.append("Error Code:"); + builder.append(Integer.toString(sqlError.getErrorCode())); + builder.append('\n'); + builder.append('\t'); + builder.append("SQL State:"); + builder.append(sqlError.getSQLState()); + builder.append('\n'); + int i =0; + while (sqlError.getNextException() != sqlError && sqlError.getNextException() != null) { + sqlError = sqlError.getNextException(); + builder.append(" ["); + builder.append(Integer.toString(++i)); + builder.append("] Error Code:"); + builder.append(sqlError.getMessage()); + builder.append(Integer.toString(sqlError.getErrorCode())); + builder.append(" "); + builder.append("SQL State:"); + builder.append(sqlError.getSQLState()); + builder.append('\n'); + } + } + builder.append('\n'); String[] stackTrace = errors.getThrowableStrRep(); for (int i = 0; i < stackTrace.length; i++) { Modified: isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/EnhancedTabbedPane.java 2007-03-03 19:36:47 UTC (rev 43) @@ -29,8 +29,13 @@ import java.awt.Component; import java.awt.Cursor; +import java.awt.HeadlessException; import java.awt.IllegalComponentStateException; import java.awt.Rectangle; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; @@ -40,9 +45,13 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; +import javax.swing.JScrollPane; import javax.swing.JTabbedPane; +import javax.swing.JViewport; import javax.swing.SwingConstants; +import javax.swing.event.EventListenerList; import javax.swing.event.MouseInputAdapter; +import javax.swing.plaf.TabbedPaneUI; /** * TODO Add ITabbedPane Object overview JavaDoc information. @@ -66,6 +75,7 @@ private static final String CLIENT_IS_LOCKED = "EnhancedTabbedPane.isLocked"; private transient Vector<ActionListener> actionListeners; + private transient EventListenerList eventListeners = new EventListenerList(); private transient Hashtable<JComponent, Icon> iconCache; public EnhancedTabbedPane() { @@ -83,10 +93,10 @@ super(TabPlacement); this.maxtabcount = MaxTabCount; iconCache = new Hashtable<JComponent, Icon>(maxtabcount); - MouseHandler ma = new MouseHandler(); + TabMouseInputHandler ma = new TabMouseInputHandler(); addMouseListener(ma); addMouseMotionListener(ma); - + setDropTarget(new DragEventListener(this, null)); } @Override @@ -110,9 +120,8 @@ jc.putClientProperty(CLIENT_IS_LOCKED, Boolean.FALSE); } super.addTab(s, new CompoundIcon(null, icon), c, tip); - invalidate(); - repaint(); - fireStateChanged(); + int index = indexOfComponent(c); + fireTabAdded(index, c); } else { int tab = locateFirstUnlockedTab(); if (tab >= 0 && tab < getTabCount()) { @@ -120,9 +129,6 @@ setIconAt(tab, new CompoundIcon(null, icon)); setComponentAt(tab, c); setToolTipTextAt(tab, tip); - invalidate(); - repaint(); - fireStateChanged(); } else { throw new IllegalStateException(); } @@ -143,9 +149,9 @@ } @Override - public void removeTabAt(int i) { + public void removeTabAt(int index) { - if (isTabLocked(i)) { + if (isTabLocked(index)) { String msg = "LockedTab_Close_Warning"; String title = "Warning"; int res = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION); @@ -153,11 +159,10 @@ return; } } - iconCache.remove(getComponentAt(i)); - super.removeTabAt(i); - invalidate(); - repaint(); - fireStateChanged(); + Component component = getComponent(index); + iconCache.remove(component); + super.removeTabAt(index); + fireTabRemoved(index, component); } public void removeAllTabs() { @@ -317,15 +322,20 @@ } } - public void addActionListener(ActionListener l) { + public void addActionListener(ActionListener listener) { - Vector<ActionListener> v = actionListeners == null ? new Vector<ActionListener>(2) : actionListeners; - if (!v.contains(l)) { - v.addElement(l); - actionListeners = v; + synchronized (listenerList) { + listenerList.add(ActionListener.class, listener); } } + public void addTabbedPaneListener(TabbedPaneLister listener) { + + synchronized (listenerList) { + listenerList.add(TabbedPaneLister.class, listener); + } + } + protected int locateFirstUnlockedTab() { if (oldestIndex >= getTabCount() || oldestIndex < 0) { @@ -343,21 +353,94 @@ protected void fireActionPerformed(ActionEvent e) { - if (actionListeners != null) { - Vector listeners = actionListeners; - int count = listeners.size(); - for (int i = 0; i < count; i++) { - try { - ((ActionListener) listeners.elementAt(i)).actionPerformed(e); - } catch (Throwable t) { - } + ActionListener[] listeners = listenerList.getListeners(ActionListener.class); + for (int i = 0; i < listeners.length; i++) { + ActionListener delegate = listeners[i]; + synchronized (delegate) { + delegate.actionPerformed(e); } } } - private class MouseHandler extends MouseInputAdapter { + protected void fireTabRemoved(int index, Component component) { + TabbedPaneLister[] listeners = listenerList.getListeners(TabbedPaneLister.class); + Component actualComponent = component; + if (component instanceof JScrollPane) { + JViewport viewPort = ((JScrollPane) component).getViewport(); + actualComponent = viewPort.getView(); + } + for (int i = 0; i < listeners.length; i++) { + TabbedPaneLister delegate = listeners[i]; + synchronized (delegate) { + delegate.tabRemoved(this, index, actualComponent); + } + } + } + + protected void fireTabAdded(int index, Component component) { + + TabbedPaneLister[] listeners = eventListeners.getListeners(TabbedPaneLister.class); + Component actualComponent = component; + if (component instanceof JScrollPane) { + JViewport viewPort = ((JScrollPane) component).getViewport(); + actualComponent = viewPort.getView(); + } + for (int i = 0; i < listeners.length; i++) { + TabbedPaneLister delegate = listeners[i]; + synchronized (delegate) { + delegate.tabAdded(this, index, actualComponent); + } + } + } + + private class DragEventListener extends DropTarget { + + private int currentDraggingIndex = -1; + + public DragEventListener(Component c, DropTargetListener dtl) throws HeadlessException { + + super(c, dtl); + } + @Override + public synchronized void dragEnter(DropTargetDragEvent dtde) { + + TabbedPaneUI ui = getUI(); + JTabbedPane source = (JTabbedPane) getComponent(); + int x = dtde.getLocation().x; + int y = dtde.getLocation().y; + int index = ui.tabForCoordinate(source, x, y); + if (index >= 0) { + source.setSelectedIndex(index); + currentDraggingIndex = index; + } + } + + @Override + public synchronized void dragExit(DropTargetEvent dte) { + + currentDraggingIndex = -1; + } + + @Override + public synchronized void dragOver(DropTargetDragEvent dtde) { + + TabbedPaneUI ui = getUI(); + JTabbedPane source = (JTabbedPane) getComponent(); + int x = dtde.getLocation().x; + int y = dtde.getLocation().y; + int index = ui.tabForCoordinate(source, x, y); + if (index >= 0 && currentDraggingIndex != index) { + source.setSelectedIndex(index); + currentDraggingIndex = index; + } + } + } + + private class TabMouseInputHandler extends MouseInputAdapter { + + @Override public void mousePressed(MouseEvent e) { if (getSelectedIndex() < 0) { @@ -410,10 +493,12 @@ } } } - } catch (Throwable t) { + } catch (Exception ignored) { } - if (getCursor().getType() != Cursor.DEFAULT_CURSOR) + + if (getCursor().getType() != Cursor.DEFAULT_CURSOR) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } } } -} +} \ No newline at end of file Added: isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/swing/Refreshable.java 2007-03-03 19:36:47 UTC (rev 43) @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.swing; + +/** + * Basic interface for providing refresh/reloading functionality through the + * {@link org.isqlviewer.swing.action.RefreshViewAction}. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public interface Refreshable { + + /** + * Notification to refresh the content managed by this implementation. + * <p> + */ + public void refreshView(); + +} Modified: isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/SwingUtilities.java 2007-03-03 19:36:47 UTC (rev 43) @@ -440,7 +440,7 @@ * * @see KeyStroke#getKeyStroke(java.lang.String) */ - protected static KeyStroke getKeyStroke(String s) { + public static KeyStroke getKeyStroke(String s) { if (s == null || s.length() == 0) { return null; Added: isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/swing/TabbedPaneLister.java 2007-03-03 19:36:47 UTC (rev 43) @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.swing; + +import java.awt.Component; +import java.util.EventListener; + +import javax.swing.JTabbedPane; + +/** + * TODO Add TabbedPaneLister JavaDoc inforamation + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public interface TabbedPaneLister extends EventListener { + + public void tabAdded(JTabbedPane tabPane, int index, Component component); + + public void tabRemoved(JTabbedPane tabPane, int index, Component component); + +} Modified: isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/action/CustomAction.java 2007-03-03 19:36:47 UTC (rev 43) @@ -44,9 +44,14 @@ public class CustomAction extends AbstractAction { private static final long serialVersionUID = -430436376187044613L; + public final static String ICON_NAME = "ICON_NAME"; + public final static String ACTION_ID = "ACTION_ID"; - private SwingEventManager eventManager = null; + + public final static String USER_OBJECT = "USER_OBJECT"; + + protected final SwingEventManager eventManager; public CustomAction(String name, int id, ResourceBundle bundle, SwingEventManager eventManager) { Added: isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java (rev 0) +++ isql-swing/trunk/src/org/isqlviewer/swing/action/RefreshViewAction.java 2007-03-03 19:36:47 UTC (rev 43) @@ -0,0 +1,63 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.swing.action; + +import java.awt.event.ActionEvent; + +import org.isqlviewer.swing.Refreshable; + +/** + * Specialized action class for supporting a generic 'refresh' or 'reload' call. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class RefreshViewAction extends CustomAction { + + private static final long serialVersionUID = -1869812791179865998L; + private transient Refreshable refreshable = null; + + public RefreshViewAction(SwingEventManager eventManager, Refreshable refreshable) { + + super("refresh-toggle", SharedActions.REFRESH_SELECTED_VIEW, null, eventManager); + putValue(CustomAction.ICON_NAME, "reload"); + this.refreshable = refreshable; + } + + @Override + public void actionPerformed(ActionEvent evt) { + + if (eventManager != null) { + int id = SharedActions.REFRESH_SELECTED_VIEW; + Object source = refreshable; + ActionEvent forwardAction = new ActionEvent(source, id, evt.getActionCommand(), evt.getModifiers()); + eventManager.actionPerformed(forwardAction); + } + } +} Modified: isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/action/SharedActions.java 2007-03-03 19:36:47 UTC (rev 43) @@ -33,6 +33,7 @@ */ public final class SharedActions { + // TODO make this an Enum private SharedActions() { } @@ -92,4 +93,10 @@ public static final int CREATE_SAVE_POINT = 48; public static final int SCRATCHPAD = 49; public static final int OVERWRITE_TOGGLE = 50; + public static final int SHOW_CONNECTION_INFO = 51; + + public static final int CONVERT_HISTORY_TO_BOOKMARK = 52; + public static final int SERVICE_ADDED = 53; + public static final int SERVICE_UPDATED = 54; + public static final int SERVICE_REMOVED = 55; } Modified: isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/table/EnhancedTableModel.java 2007-03-03 19:36:47 UTC (rev 43) @@ -226,12 +226,8 @@ */ public Object getValueAt(int rowIndex, int columnIndex) { - try { - ArrayList row = getRow(rowIndex); - return row.get(columnIndex); - } catch (Throwable t) { - return null; - } + ArrayList row = getRow(rowIndex); + return row.get(columnIndex); } /** Modified: isql-swing/trunk/src/org/isqlviewer/swing/table/ResultSetTableModel.java =================================================================== --- isql-swing/trunk/src/org/isqlviewer/swing/table/ResultSetTableModel.java 2007-03-03 19:26:22 UTC (rev 42) +++ isql-swing/trunk/src/org/isqlviewer/swing/table/ResultSetTableModel.java 2007-03-03 19:36:47 UTC (rev 43) @@ -26,39 +26,27 @@ */ package org.isqlviewer.swing.table; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; -import java.lang.reflect.Method; import java.math.BigDecimal; import java.sql.Array; import java.sql.Blob; import java.sql.Clob; -import java.sql.DatabaseMetaData; import java.sql.Date; import java.sql.Ref; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; -import java.sql.SQLWarning; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.Random; import org.isqlviewer.sql.ByteArrayBlob; import org.isqlviewer.sql.ByteArrayClob; -import org.isqlviewer.sql.JdbcUtilities; import org.isqlviewer.sql.ResultSetRenderer; -import org.isqlviewer.util.BasicUtilities; -import org.isqlviewer.util.StringUtilities; /** * @author Markus A. Kobold <mkobold at sprintpcs dot com> @@ -66,937 +54,179 @@ */ public class ResultSetTableModel extends EnhancedTableModel { - private Random seed = new Random(System.currentTimeMillis()); - private boolean isShowingMetaData = false; - private boolean allowMetaCopy = true; - private EnhancedTableModel metaData = new EnhancedTableModel(); - private ResultSet rs = null; - private ArrayList<String> primaryKeys = null; - public ResultSetTableModel() { - this(null, null, true); + super(new String[0]); } - public ResultSetTableModel(ResultSet set) { + public synchronized void setResults(ResultSet resultSet, ResultSetRenderer renderer) throws SQLException { - this(set, null, true); - } - - public ResultSetTableModel(ResultSet set, ResultSetRenderer rsv, boolean copyMetaData) { - - if (set != null) - setData(set, rsv); - allowMetaCopy = copyMetaData; - } - - public synchronized void showMetaData() { - - if (!isShowingMetaData) { - synchronized (this) { - isShowingMetaData = true; - } - fireTableStructureChanged(); - } - } - - public synchronized void showResultSetData() { - - if (isShowingMetaData) { - synchronized (this) { - isShowingMetaData = false; - } - fireTableStructureChanged(); - } - } - - public boolean isShowingMetadata() { - - return isShowingMetaData; - } - - public Object getResultSetValue(int row, int col) { - - return super.getValueAt(row, col); - - } - - public Object getMetaDataValue(int row, int col) { - - return metaData.getValueAt(row, col); - } - - public String getMetaColumnName(int column) { - - return metaData.getColumnName(column); - } - - public int getMetaColumnCount() { - - return metaData.getColumnCount(); - } - - public Class< ? extends Object> getMetaColumnClass(int column) { - - return metaData.getColumnClass(column); - } - - public int getMetaRowCount() { - - return metaData.getRowCount(); - } - - public String getResultSetColumnName(int column) { - - return super.getColumnName(column); - } - - public int getResultSetColumnCount() { - - return super.getColumnCount(); - } - - public synchronized void setData(ResultSet set, ResultSetRenderer rsv) { - clearAllData(); - ResultSetMetaData rsmd = null; try { - rsmd = set.getMetaData(); - } catch (SQLException sqle) { - throw new RuntimeException(sqle); - } - - rs = null; - int cc = -1; - try { - cc = rsmd.getColumnCount(); - } catch (SQLException sqle) { - throw new RuntimeException(sqle); - } - - if (JdbcUtilities.isUpdatable(set)) { - rs = set; - } - - if (allowMetaCopy) { - copyMetaDataStore(rsmd); - } - - String[] cols = new String[cc]; - for (int i = 1; i <= cols.length; i++) { + int preferredMaxRows = Integer.MAX_VALUE; + int columnCount = 0; + ResultSetMetaData metaData = resultSet.getMetaData(); + Statement statement = resultSet.getStatement(); try { - cols[i - 1] = rsmd.getColumnLabel(i); - } catch (Throwable t) { - try { - cols[i - 1] = rsmd.getColumnName(i); - } catch (SQLException sqle) { - throw new RuntimeException(sqle); - } + preferredMaxRows = statement.getMaxRows(); + preferredMaxRows = preferredMaxRows <= 0 ? Integer.MAX_VALUE : preferredMaxRows; + } catch (SQLException warning) { } - } - setColumns(cols); - // UserPreferences prefs = SystemConfig.getInstance().getPreferences(); - boolean ascii2native = true; // prefs.getBoolean(ConfigConstants.KEY_USE_ASCII_COMPATIBILITY); - - int maxrows = 0; - try { - Statement stmt = set.getStatement(); - if (stmt != null) { - maxrows = stmt.getMaxRows(); + columnCount = metaData.getColumnCount(); + if (columnCount <= 0) { + // nothing to show // + return; } - } catch (Throwable t) { - } - - try { - if (set.getType() != ResultSet.TYPE_FORWARD_ONLY) { - if (!set.isBeforeFirst()) { - set.beforeFirst(); - - } else { - String msg = "Bad Cursor";// BasicUtilities.getString("JDBC_Cursor_Off", - // Integer.toString(set.getRow())); - System.err.println(msg); - } - } - } catch (SQLException sqle) { - // throw new RuntimeException(sqle); - } - - try { - while (set.next()) { - if (maxrows >= 1 && getRowCount() >= maxrows) { - String msg = "Too many rows.";// BasicUtilities.getString("JDBC_MaxRows_Warning", - // Integer.toString(maxrows)); - System.err.println(msg); - break; - } - - ArrayList<Object> newRow = extractCurrentRow(set, ascii2native); - synchronized (dataStore) { - dataStore.add(newRow); - } - - if (rsv != null) { - try { - SQLWarning warnings = set.getWarnings(); - if (warnings != null) { - rsv.recieveResultsetWarnings(set, warnings); - } - } catch (Throwable t) { - } - } - + columns.clear(); + for (int i = 0; i < columnCount; i++) { try { - set.clearWarnings(); - } catch (Throwable t) { + columns.add(metaData.getColumnLabel(i + 1)); + } catch (SQLException warning) { + columns.add(metaData.getColumnName(i + 1)); } } - } catch (SQLException sqle) { - throw new RuntimeException(sqle); - } - } - public void applyPrimaryKeys(Collection<Object> keys) { - - primaryKeys = (primaryKeys == null) ? new ArrayList<String>() : primaryKeys; - if (keys == null) { - primaryKeys.clear(); - primaryKeys = null; - } else { - Iterator itr = keys.iterator(); - while (itr.hasNext()) { - String next = (String) itr.next(); - synchronized (primaryKeys) { - primaryKeys.add(next.toUpperCase()); - } - } - } - - } - - public boolean isPrimaryKey(String column) { - - if (primaryKeys != null) { - return primaryKeys.contains(column.toUpperCase()); - } - - return false; - } - - public ResultSet toResultSet() { - - return rs; - } - - public void disableEditing() { - - if (rs != null) { + // make sure we are at the front of the results only if the result set is 'scrollable' try { - rs.close(); - } catch (Throwable t) { - } finally { - rs = null; - } - } - } - - public EnhancedTableModel getMetadataAsModel() { - - return (EnhancedTableModel) metaData.clone(); - } - - @Override - public int applyFilter(String text) { - - if (isShowingMetaData) { - int r = metaData.applyFilter(text); - fireTableDataChanged(); - return r; - } - - return super.applyFilter(text); - } - - @Override - public void clearFilter() { - - if (isShowingMetaData) { - metaData.clearFilter(); - fireTableDataChanged(); - } else { - super.clearFilter(); - } - } - - public void refreshRow(int rowIndex) throws SQLException { - - if (rs != null) { - rs.cancelRowUpdates(); - // UserPreferences prefs = SystemConfig.getInstance().getPreferences(); - boolean ascii2native = true; // prefs.getBoolean(ConfigConstants.KEY_USE_ASCII_COMPATIBILITY); - - if (rs.absolute(rowIndex + 1)) { - rs.refreshRow(); - ArrayList<Object> lst = extractCurrentRow(rs, ascii2native); - dataStore.set(rowIndex, lst); - fireTableRowsUpdated(rowIndex, rowIndex); - } else { - throw new SQLException("ResultSet::absolute(" + (rowIndex + 1) + ")"); - } - } - - } - - public void createInsertRow() throws SQLException { - - if (rs != null) { - ArrayList<Object> mdlRow = new ArrayList<Object>(); - rs.moveToInsertRow(); - ResultSetMetaData md = rs.getMetaData(); - int cc = md.getColumnCount(); - for (int i = 1; i <= cc; i++) { - int type = md.getColumnType(i); - - if (md.isAutoIncrement(i)) { - mdlRow.add(null); - continue; + int resultSetType = resultSet.getType(); + if (resultSetType != ResultSet.TYPE_FORWARD_ONLY) { + if (resultSet.isBeforeFirst()) { + resultSet.beforeFirst(); + } } - - if (md.isNullable(i) == DatabaseMetaData.columnNullable) { - rs.updateNull(i); - mdlRow.add(null); - continue; - } - - switch (type) { - case Types.LONGVARCHAR : - case Types.VARCHAR : - case Types.CHAR : - mdlRow.add(""); - rs.updateString(i, ""); - break; - case Types.DATE : - Date date = new Date(System.currentTimeMillis()); - mdlRow.add(date); - rs.updateDate(i, date); - break; - case Types.TIME : - Time time = new Time(System.currentTimeMillis()); - mdlRow.add(time); - rs.updateTime(i, time); - break; - case Types.TIMESTAMP : - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - mdlRow.add(timestamp); - rs.updateTimestamp(i, timestamp); - break; - case Types.TINYINT : - Byte bite = new Byte((byte) seed.nextInt()); - mdlRow.add(bite); - rs.updateByte(i, bite.byteValue()); - break; - case Types.SMALLINT : - Short shrt = new Short((short) seed.nextInt()); - mdlRow.add(shrt); - rs.updateShort(i, shrt.shortValue()); - break; - case Types.INTEGER : - Integer integer = new Integer(seed.nextInt()); - mdlRow.add(integer); - rs.updateInt(i, integer.intValue()); - break; - case Types.REAL : - case Types.DOUBLE : - case Types.FLOAT : - Double doub = new Double(seed.nextDouble()); - mdlRow.add(doub); - rs.updateDouble(i, doub.doubleValue()); - break; - case Types.BIGINT : - Long lon = new Long(seed.nextLong()); - mdlRow.add(lon); - rs.updateLong(i, lon.longValue()); - break; - case Types.DECIMAL : - case Types.NUMERIC : - BigDecimal bigdec = new BigDecimal(seed.nextDouble()); - mdlRow.add(bigdec); - rs.updateBigDecimal(i, bigdec); - break; - case Types.BIT : - case Types.BOOLEAN : - rs.updateBoolean(i, Boolean.FALSE.booleanValue()); - break; - case Types.LONGVARBINARY : - case Types.VARBINARY : - byte[] bytes = new byte[0]; - mdlRow.add(bytes); - rs.updateBytes(i, bytes); - break; - case Types.BLOB : - Blob blob = new ByteArrayBlob(new byte[0]); - mdlRow.add(blob); - rs.updateBlob(i, blob); - break; - case Types.CLOB : - try { - Clob clob = new ByteArrayClob(""); - mdlRow.add(clob); - rs.updateClob(i, clob); - } catch (IOException ioe) { - throw new SQLException(ioe.getMessage()); - } - break; - default : - rs.updateObject(i, ""); - break; - } + } catch (SQLException warning) { } - rs.insertRow(); - int newRow = getRowCount(); - addRow(mdlRow); - fireTableRowsInserted(newRow, newRow); - rs.beforeFirst(); - } - } - - @Override - public boolean isCellEditable(int row, int column) { - - if (!isShowingMetaData) { - try { - if (rs == null) { - return false; + int rowsExtracted = 0; + rowLoop : while (rowsExtracted < preferredMaxRows && resultSet.next()) { + if (renderer.isCancelled()) { + break; } - ResultSetMetaData md = rs.getMetaData(); - int concur = rs.getConcurrency(); - boolean canEdit = !md.isReadOnly(column + 1) && !md.isAutoIncrement(column + 1); - return canEdit && concur == ResultSet.CONCUR_UPDATABLE; - } catch (Throwable t) { - return false; - } - } - - return false; - } - - @Override - public void clearAll() { - - clearAllData(); - metaData.clearAll(); - fireTableStructureChanged(); - - } - - @Override - public void clear() { - - clearData(); - metaData.clear(); - fireTableDataChanged(); - } - - @Override - public Class< ? extends Object> getColumnClass(int index) { - - if (isShowingMetaData) - return getMetaColumnClass(index); - - return super.getColumnClass(index); - } - - @Override - public synchronized void removeRow(int rowIndex) { - - ArrayList lock = (isShowingMetadata() ? metaData.dataStore : dataStore); - try { - if (rs != null && !isShowingMetadata()) { - rs.absolute(rowIndex + 1); - rs.deleteRow(); - rs.beforeFirst(); - } - - synchronized (lock) { - lock.remove(rowIndex); - } - - fireTableRowsDeleted(rowIndex, rowIndex); - } catch (Throwable t) { - - } - - } - - @Override - public synchronized void removeColumn(int columnIndex) { - - ArrayList lock = (isShowingMetadata() ? metaData.dataStore : dataStore); - Iterator itr = lock.iterator(); - synchronized (lock) { - try { - if (isShowingMetaData) { - metaData.columns.remove(columnIndex); - } else { - columns.remove(columnIndex); - } - } catch (Throwable t) { - return; - } - - while (itr.hasNext()) { - try { - A... [truncated message content] |
From: <mk...@us...> - 2007-03-03 19:26:23
|
Revision: 42 http://svn.sourceforge.net/isql/?rev=42&view=rev Author: mkobold Date: 2007-03-03 11:26:22 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * isqlviewer/ServiceManager.java ** removed in favor of using the sql.embedded.EmdeddedDatabse object. * examples/sql-history.xml * xml/sql-history.dtd ** Removed as it no longer applies at this time. Modified Paths: -------------- isql-core/trunk/.classpath isql-core/trunk/test/org/isqlviewer/test/util/TestStringUtilities.java Removed Paths: ------------- isql-core/trunk/src/org/isqlviewer/ServiceManager.java isql-core/trunk/support/xml/examples/sql-history.xml isql-core/trunk/support/xml/sql-history.dtd Property Changed: ---------------- isql-core/trunk/ Property changes on: isql-core/trunk ___________________________________________________________________ Name: svn:ignore - bin isql-core.jar isql-core-src.zip + bin isql-core.jar isql-core-src.zip classes Modified: isql-core/trunk/.classpath =================================================================== --- isql-core/trunk/.classpath 2007-03-03 19:24:02 UTC (rev 41) +++ isql-core/trunk/.classpath 2007-03-03 19:26:22 UTC (rev 42) @@ -5,5 +5,6 @@ <classpathentry kind="src" path="test"/> <classpathentry exported="true" kind="lib" path="lib/log4j.jar"/> <classpathentry exported="true" sourcepath="/JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/> + <classpathentry kind="lib" path="lib/derby.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Deleted: isql-core/trunk/src/org/isqlviewer/ServiceManager.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/ServiceManager.java 2007-03-03 19:24:02 UTC (rev 41) +++ isql-core/trunk/src/org/isqlviewer/ServiceManager.java 2007-03-03 19:26:22 UTC (rev 42) @@ -1,379 +0,0 @@ -/* - * Copyright 2002 by Mark A. Kobold - * - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the License. - * - * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. - * - * The Initial Developer of the Original Code is Markus A. Kobold. - * - * Portions created by Mark A. Kobold are - * Copyright (C) Copyright (C) 2000 Mark A. Kobold. All Rights Reserved. - * Contributor(s): Mark A. Kobold <mk...@sp...>. - * - * Contributor(s): all the names of the contributors are added in the source code - * where applicable. - * - * If you didn't download this code from the following link, you should check if - * you aren't using an obsolete version: - * http://isql.sourceforge.net/ - */ -package org.isqlviewer; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; -import java.util.TreeMap; -import java.util.Map.Entry; - -import org.isqlviewer.sql.JdbcService; -import org.isqlviewer.util.IsqlToolkit; -import org.isqlviewer.util.LocalMessages; -import org.isqlviewer.util.LoggableObject; -import org.isqlviewer.util.StringUtilities; -import org.isqlviewer.xml.ServiceDigester; -import org.xml.sax.InputSource; - -/** - * Standard class for managing and accessing iSQL-Viewer JDBC services. - * <p> - * This class will provide default access to local JDBC services defined within XML. Future revision will contain - * support hooks for providing services via other mechanisims such as JNDI,RMI, and so forth. - * - * @author Mark A. Kobold <mkobold at isqlviewer dot com> - * @version 1.0 - */ -public final class ServiceManager extends LoggableObject { - - private static ServiceManager sharedInstance = null; - - private final static String CACHE_FILE = "services.cache"; - private final static String V3_SERVICE_INDEX = "services.index"; - private final static String KEY_SERVICE_LIST = "SERVICE_ORDER"; - private final static String SERVICE_SEPERATOR = "\u0001"; - private final static char FIELD_SEPERATOR = '='; - - private static final LocalMessages messages = new LocalMessages("org.isqlviewer.ResourceBundle"); - private final ArrayList<String> preferredOrder = new ArrayList<String>(); - private final ArrayList<File> serviceLocations = new ArrayList<File>(); - private final TreeMap<String, File> serviceFileMapping = new TreeMap<String, File>(new ServiceOrderComparator( - preferredOrder)); - private boolean isLoaded = false; - - public synchronized static ServiceManager getSharedInstance() { - - if (sharedInstance == null) { - sharedInstance = new ServiceManager(); - } - return sharedInstance; - } - - public ServiceManager() { - - this(true); - } - - public ServiceManager(boolean isShared) { - - if (isShared && sharedInstance != null) { - throw new IllegalStateException("Shared instance already allocated."); - } else if (isShared && sharedInstance == null) { - sharedInstance = this; - } - - } - - public boolean addLocation(File location) { - - return serviceLocations.add(location); - } - - public boolean containsLocation(File location) { - - return serviceLocations.contains(location); - } - - public boolean removeLocation(File location) { - - return serviceLocations.remove(location); - } - - public JdbcService serviceForName(String service) throws NoSuchElementException { - - return serviceForName(service, false); - } - - public JdbcService serviceForName(String service, boolean forceSync) throws NoSuchElementException { - - checkState(); - File serviceFile = serviceFileMapping.get(service); - if (serviceFile.exists() && serviceFile.canRead()) { - FileInputStream fis = null; - try { - fis = new FileInputStream(serviceFile); - InputSource inputSource = new InputSource(fis); - // TODO get entity resolver // - return ServiceDigester.parseService(inputSource, IsqlToolkit.getSharedEntityResolver()); - } catch (IOException ioe) { - ioe.printStackTrace(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - String reason = messages.format("ServiceManager.NoSuchService", service); - throw new NoSuchElementException(reason); - } - - public void updateService(JdbcService service, int documentVersion) throws NoSuchElementException, IOException { - - if (service == null) { - return; - } - if (!isRegistered(service)) { - throw new NoSuchElementException(/* TODO i18n message */); - } - FileOutputStream outputStream = null; - try { - File serviceFile = serviceFileMapping.get(service.getName()); - outputStream = new FileOutputStream(serviceFile, false); - ServiceDigester.writeService(documentVersion, outputStream, service); - outputStream.flush(); - } finally { - if (outputStream != null) { - try { - outputStream.close(); - } catch (Exception ignored) { - } - } - } - } - - public boolean registerService(JdbcService service, File location) { - - if (service == null) { - return false; - } - - synchronized (serviceFileMapping) { - serviceFileMapping.put(service.getName(), location); - try { - storeServiceCache(); - } catch (IOException e) { - e.printStackTrace(); - return false; - } - } - return true; - } - - public synchronized boolean deregisterService(String service) { - - return serviceFileMapping.remove(service) != null; - } - - public boolean deregisterService(JdbcService service) { - - if (service == null) { - return false; - } - return deregisterService(service.getName()); - } - - public boolean isRegistered(JdbcService service) { - - if (service == null) { - return false; - } - return isRegistered(service.getName()); - } - - public boolean isRegistered(String service) { - - return serviceFileMapping.containsKey(service); - } - - public void detectServices() { - - } - - public Collection<String> getRegisteredServices() { - - checkState(); - return Collections.unmodifiableCollection(serviceFileMapping.keySet()); - } - - public void setPreferredServiceOrder(Collection<String> services) { - - synchronized (preferredOrder) { - preferredOrder.clear(); - preferredOrder.addAll(services); - } - - synchronized (serviceFileMapping) { - String firstKey = serviceFileMapping.firstKey(); - File first = serviceFileMapping.remove(firstKey); - serviceFileMapping.put(firstKey, first); - } - } - - private synchronized void storeServiceCache() throws IOException { - - File file = new File(IsqlToolkit.getBaseDirectory(), V3_SERVICE_INDEX); - if (!file.exists()) { - if (!file.createNewFile()) { - throw new IOException(/* TODO i18n message */); - } - - // TODO debug("Creating service cache file:''"); - } - - if (file.canWrite()) { - Iterator<Entry<String, File>> itr = serviceFileMapping.entrySet().iterator(); - FileOutputStream outputStream = new FileOutputStream(file); - PrintWriter writer = new PrintWriter(outputStream, true); - writer.print(KEY_SERVICE_LIST); - writer.print('='); - writer.println(StringUtilities.explode(serviceFileMapping.keySet(), SERVICE_SEPERATOR)); - - while (itr.hasNext()) { - Entry<String, File> next = itr.next(); - writer.print(StringUtilities.encodeASCII(next.getKey())); - writer.print('='); - String uri = next.getValue().toURL().toExternalForm(); - writer.println(StringUtilities.encodeASCII(uri)); - } - writer.flush(); - } else { - throw new IOException(/* TODO i18n message */); - } - } - - private synchronized void checkState() { - - if (!isLoaded) { - loadServiceCache(); - isLoaded = true; - } - } - - private void loadServiceCache() { - - serviceFileMapping.clear(); - preferredOrder.clear(); - File file = new File(IsqlToolkit.getBaseDirectory(), V3_SERVICE_INDEX); - if (!file.exists()) { - file = new File(IsqlToolkit.getBaseDirectory(), CACHE_FILE); - if (!file.exists()) { - return; - } - } - - if (file.canRead()) { - FileReader fileReader = null; - try { - fileReader = new FileReader(file); - BufferedReader lineReader = new BufferedReader(fileReader); - while (lineReader.ready()) { - String data = lineReader.readLine(); - if (data.charAt(0) == '#') { - continue; - } - int idx0 = 0; - int idx1 = data.indexOf(FIELD_SEPERATOR); - - String serviceName = StringUtilities.decodeASCII(data.substring(idx0, idx1)); - String serviceURI = StringUtilities.decodeASCII(data.substring(idx1 + 1)); - debug("[" + serviceName + "][" + serviceURI + "]"); - if (serviceName.equalsIgnoreCase(KEY_SERVICE_LIST)) { - StringTokenizer st = new StringTokenizer(serviceURI, SERVICE_SEPERATOR); - while (st.hasMoreTokens()) { - String name = st.nextToken(); - preferredOrder.add(name.toLowerCase().trim()); - } - continue; - } - try { - URL url = new URL(serviceURI); - File serviceFile = new File(url.getFile()); - if (serviceFile.isDirectory()) { - warn(messages.format("ServiceManager.ServiceIsDirectorySkip", serviceFile)); - continue; - } else if (!serviceFile.canRead()) { - warn(messages.format("ServiceManager.ServiceCannotReadSkip", serviceFile)); - continue; - } else if (!serviceFile.exists()) { - warn(messages.format("ServiceManager.ServiceNonexistentSkip", serviceFile)); - continue; - } - String bindName = serviceName.toLowerCase().trim(); - if (serviceFileMapping.put(bindName, serviceFile) != null) { - warn(messages.format("ServiceManager.ServiceDuplicate", serviceName, serviceFile)); - } else { - info(messages.format("ServiceManager.ServiceRegistered", serviceName)); - } - } catch (MalformedURLException e) { - error(messages.format("ServiceManager.URIParsingError", serviceURI)); - } - } - - } catch (IOException ioe) { - error("ServiceManager:loadServices()", ioe); - return; - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (Throwable ignored) { - } - } - } - } - } - - private static class ServiceOrderComparator implements Comparator<String> { - - private List<String> preferredOrder; - - public ServiceOrderComparator(List<String> preferredOrder) { - - this.preferredOrder = preferredOrder; - } - - public int compare(String o1, String o2) { - - int order1 = preferredOrder.indexOf(o1); - int order2 = preferredOrder.indexOf(o2); - if (order1 == -1) { - preferredOrder.add(o1); - order1 = preferredOrder.indexOf(o1); - } - - if (order2 == -1) { - preferredOrder.add(o2); - order2 = preferredOrder.indexOf(o2); - } - return order1 == order2 ? 0 : (order1 > order2 ? 1 : -1); - } - } -} \ No newline at end of file Deleted: isql-core/trunk/support/xml/examples/sql-history.xml =================================================================== --- isql-core/trunk/support/xml/examples/sql-history.xml 2007-03-03 19:24:02 UTC (rev 41) +++ isql-core/trunk/support/xml/examples/sql-history.xml 2007-03-03 19:26:22 UTC (rev 42) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE isql-history PUBLIC "-//iSQL-Viewer.org.//DTD JDBC History 3.0.0//EN" "http://isqlviewer.org/dtd/sql-history.dtd"> -<isql-history> - <query timestamp="0" service="my-service-name"> - U0VMRUNUXCAqXCBGUk9NXCBQR19UQUJMRVM= - </query> - <transaction timestamp="1" service="my-service-name"> - <query timestamp="2"> - REVMRVRFXCBGUk9NXCBVU0VSU1wgV0hFUkVcIFVJRFwgPj1cIDA7 - </query> - <rollback timestamp="3" /> - <query timestamp="4"> - REVMRVRFXCBGUk9NXCBVU0VSU1wgV0hFUkVcIFVJRFwgPj1cIDA7 - </query> - <commit timestamp="5" /> - </transaction> - <query timestamp="100" service="my-other-service"> - U0VMRUNUXCAqXCBGUk9NXCBQR19UQUJMRVM= - </query> - <transaction timestamp="101" service="my-other-service"> - <query timestamp="102"> - REVMRVRFXCBGUk9NXCBVU0VSU1wgV0hFUkVcIFVJRFwgPj1cIDA7 - </query> - <rollback timestamp="103" /> - <query timestamp="104"> - REVMRVRFXCBGUk9NXCBVU0VSU1wgV0hFUkVcIFVJRFwgPj1cIDA7 - </query> - <commit timestamp="105" /> - </transaction> -</isql-history> \ No newline at end of file Deleted: isql-core/trunk/support/xml/sql-history.dtd =================================================================== --- isql-core/trunk/support/xml/sql-history.dtd 2007-03-03 19:24:02 UTC (rev 41) +++ isql-core/trunk/support/xml/sql-history.dtd 2007-03-03 19:26:22 UTC (rev 42) @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Root element defining the start of a JDBC command history document. - This will contain any number of queries or transactions which can contain queries along with commit and rollback actions. - - This folder is the be the root folder. - --> -<!ELEMENT isql-history (query|transaction)*> -<!-- - Commit for identifying the commit action within a transaction. - - Used In: transcation - --> -<!ELEMENT commit EMPTY> -<!-- - timestamp: Date/Time in milliseconds this historical item occurred. - service: Name of the service this historical item was executed against if available. - - The service name is usually implied on a commit by the transaction it is contained in. - --> -<!ATTLIST commit - timestamp CDATA #REQUIRED - service CDATA #IMPLIED -> -<!-- - Element for identifying the rollback action within a transaction. - - Used In: transcation - --> -<!ELEMENT rollback EMPTY> -<!-- - timestamp: Date/Time in milliseconds this historical item occurred. - service: Name of the service this historical item was executed against if available. - - The service name is usually implied on a rollback by the transaction it is contained in. - --> -<!ATTLIST rollback - timestamp CDATA #REQUIRED - service CDATA #IMPLIED -> -<!-- - Element for identifying a basic query. - - The character data is base64 encoded of the query that was executed. - - Used In: transcation, isql-history - --> -<!ELEMENT query (#PCDATA)> -<!-- - timestamp: Date/Time in milliseconds this historical item occurred. - service: Name of the service this historical item was executed against if available. - - The service name is usually implied on a query if it exists in transaction, then the service is - assumed to be from the same service as the transaction. - --> -<!ATTLIST query - timestamp CDATA #REQUIRED - service CDATA #IMPLIED -> -<!-- - Element for defining a transaction as part of the query history. - - Transactions are started and ended by using the JDBC auto-commit true or false respectively. - - Used In: isql-history - --> -<!ELEMENT transaction (query|rollback|commit)*> -<!-- - timestamp: Date/Time in milliseconds this historical item occurred. - service: Name of the service this historical item was executed against if available. - --> -<!ATTLIST transaction - timestamp CDATA #REQUIRED - service CDATA #IMPLIED -> \ No newline at end of file Modified: isql-core/trunk/test/org/isqlviewer/test/util/TestStringUtilities.java =================================================================== --- isql-core/trunk/test/org/isqlviewer/test/util/TestStringUtilities.java 2007-03-03 19:24:02 UTC (rev 41) +++ isql-core/trunk/test/org/isqlviewer/test/util/TestStringUtilities.java 2007-03-03 19:26:22 UTC (rev 42) @@ -27,10 +27,19 @@ */ package org.isqlviewer.test.util; -import org.isqlviewer.util.StringUtilities; +import java.awt.Color; +import java.security.GeneralSecurityException; +import java.security.Key; +import java.security.Permission; +import java.text.ParseException; +import java.util.Properties; +import javax.crypto.KeyGenerator; + import junit.framework.TestCase; +import org.isqlviewer.util.StringUtilities; + /** * TODO Add TestStringUtilities Overview JavaDoc. * <p> @@ -42,166 +51,427 @@ public void testTrimToSize() { - String testString = "The Quick Brown Fox Jumps Over the Lazy Dog"; - String result = null; - result = StringUtilities.trimToSize(testString, 10); - assertEquals("Unexpected trimmed length", 10, result.length()); - result = StringUtilities.trimToSize("small text", 15); - assertEquals("Unexpected result from trimming", "small text", result); - result = StringUtilities.trimToSize(null, 15); - assertNull("Unexpected result from null trimming", result); + final String testString = "The Quick Brown Fox Jump Over The Lazy Dog"; + String resultString = StringUtilities.trimToSize(testString, 10); + assertEquals("Unexpected length of result string after trim.", 10, resultString.length()); + String tempString = testString.substring(0, 10); + assertEquals("Unexpected result string value after trim.", tempString, resultString); + resultString = StringUtilities.trimToSize(testString, 10000); + assertEquals("Unexpected length of result string after trim.", testString.length(), resultString.length()); + assertEquals("Unexpected result string value after trim.", testString, resultString); + + try { + StringUtilities.trimToSize(null, 10); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.trimToSize(testString, -1); + fail("Failed to throw an illegal argument exception for a negative length."); + } catch (IllegalArgumentException expected) { + } } public void testSearchStringSet() { + final String testString = "The Quick Brown Fox Jump Over The Lazy Dog"; + final String badCharacterSet = "!@#$%"; + final String goodCharacterSet = "Fz"; + + int actualIndex = StringUtilities.searchStringSet(testString, badCharacterSet); + int expectedIndex = -1; + assertEquals("Characters do not exist", expectedIndex, actualIndex); + + expectedIndex = testString.indexOf('F'); + actualIndex = StringUtilities.searchStringSet(testString, goodCharacterSet); + assertEquals("Characters do exist", expectedIndex, actualIndex); + try { + StringUtilities.searchStringSet(null, goodCharacterSet); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.searchStringSet(testString, null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.searchStringSet(null, null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } public void testEncodeXMLEntities() { + final String testString = "<The Quick' &Brown Fox \"Jump\" Over The Lazy\u221E Dog>"; + String encodedTestString = StringUtilities.encodeXMLEntities(testString); + assertEquals("< symbol was not properly encoded", -1, encodedTestString.indexOf('<')); + assertEquals("> symbol was not properly encoded", -1, encodedTestString.indexOf('>')); + assertEquals("' symbol was not properly encoded", -1, encodedTestString.indexOf('\'')); + assertEquals("\\u221E symbol was not properly encoded", -1, encodedTestString.indexOf('\u221E')); + assertEquals("& symbol was not properly encoded", -1, encodedTestString.indexOf("&Brown")); + assertEquals("\" symbol was not properly encoded", -1, encodedTestString.indexOf('\"')); + try { + StringUtilities.encodeXMLEntities(null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } public void testEncodeHTMLEntities() { + final String testString = "<The Quick` &Brown Fox' \"Jump\" Over\tThe Lazy\u221E Dog>"; + String encodedTestString = StringUtilities.encodeHTMLEntities(testString); + assertEquals("' symbol was not properly encoded", -1, encodedTestString.indexOf('\'')); + assertEquals("< symbol was not properly encoded", -1, encodedTestString.indexOf('<')); + assertEquals("> symbol was not properly encoded", -1, encodedTestString.indexOf('>')); + assertEquals("' symbol was not properly encoded", -1, encodedTestString.indexOf('\'')); + assertEquals("\\t symbol was not properly encoded", -1, encodedTestString.indexOf('\t')); + assertEquals("\\u221E symbol was not properly encoded", -1, encodedTestString.indexOf('\u221E')); + assertEquals("& symbol was not properly encoded", -1, encodedTestString.indexOf("&Brown")); + assertEquals("\" symbol was not properly encoded", -1, encodedTestString.indexOf('\"')); + try { + StringUtilities.encodeHTMLEntities(null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } - public void testEncodeMD5() { + public void testEncodeASCII() { + final String testString = "The\nQuick\nBrown\tFox Jump\rOver The Lazy\u221E Dog\\"; + String encodedTestString = StringUtilities.encodeASCII(testString); + assertEquals("\\n symbol was not properly encoded", -1, encodedTestString.indexOf('\n')); + assertEquals("\\r symbol was not properly encoded", -1, encodedTestString.indexOf('\r')); + assertEquals("\\t symbol was not properly encoded", -1, encodedTestString.indexOf('\t')); + assertEquals("\\u221E symbol was not properly encoded", -1, encodedTestString.indexOf('\u221E')); + try { + StringUtilities.encodeASCII(null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } - public void testEncode() { + public void testDecodeASCII() { + final String testString = "The\\nQuick\\nBrown\\tFox Jump\\rOver The Lazy\\u221E Dog"; + String decodedTestString = StringUtilities.decodeASCII(testString); + assertEquals("\\n symbol was not properly decoded", -1, decodedTestString.indexOf("\\n")); + assertEquals("\\r symbol was not properly decoded", -1, decodedTestString.indexOf("\\r")); + assertEquals("\\t symbol was not properly decoded", -1, decodedTestString.indexOf("\\t")); + assertEquals("\\u221E symbol was not properly encoded", -1, decodedTestString.indexOf("\\u221E")); + assertTrue("UNICODE character \u221E was not properly decoded", decodedTestString.indexOf('\u221E') >= 0); + try { + StringUtilities.decodeASCII(null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } - public void testDecode() { + public void testGetHTMLColor() { + assertEquals("Unexpected HTML Color", "#000000", StringUtilities.getHTMLColor(Color.BLACK)); + assertEquals("Unexpected HTML Color", "#FF0000", StringUtilities.getHTMLColor(Color.RED)); + assertEquals("Unexpected HTML Color", "#00FF00", StringUtilities.getHTMLColor(Color.GREEN)); + assertEquals("Unexpected HTML Color", "#0000FF", StringUtilities.getHTMLColor(Color.BLUE)); + assertEquals("Unexpected HTML Color", "#FFFFFF", StringUtilities.getHTMLColor(Color.WHITE)); } - public void testCharCount() { + public void testGetHumanReadableTime() { - } + final long SECOND = 1000; + final long MINUTE = 60 * SECOND; + final long HOUR = 60 * MINUTE; + final long DAY = 24 * HOUR; - public void testGetTypeStringForObject() { + // 3 hours 10 minutes 4 seconds // + long givenTime = (3 * HOUR) + (10 * MINUTE) + (4 * SECOND); + String expectedTime = "3.168hr"; + assertEquals("Unexpected readable time.", expectedTime, StringUtilities.getHumanReadableTime(givenTime)); + // 10 days 3 hours 0 minutes 0 seconds // + givenTime = (10 * DAY) + (3 * HOUR) + (0 * MINUTE) + (0 * SECOND); + expectedTime = "10.125dy"; + assertEquals("Unexpected readable time.", expectedTime, StringUtilities.getHumanReadableTime(givenTime)); + try { + StringUtilities.getHumanReadableTime(-1); + fail("Failed to throw an illegal argument exception for negative time."); + } catch (IllegalArgumentException expected) { + } + try { + StringUtilities.getHumanReadableTime(Long.MIN_VALUE); + fail("Failed to throw an illegal argument exception for negative time."); + } catch (IllegalArgumentException expected) { + } } - public void testGetTypeforValue() { + public void testGetFullHumanReadableTime() { - } + final long SECOND = 1000; + final long MINUTE = 60 * SECOND; + final long HOUR = 60 * MINUTE; + final long DAY = 24 * HOUR; - public void testGetHTMLColor() { + // 3 hours 10 minutes 4 seconds // + long givenTime = (3 * HOUR) + (10 * MINUTE) + (4 * SECOND); + String expectedTime = "3 hour(s) 10 minute(s) 4 second(s)"; + assertEquals("Unexpected readable time.", expectedTime, StringUtilities.getFullHumanReadableTime(givenTime)); - } + // 10 days 3 hours 0 minutes 0 seconds // + givenTime = (10 * DAY) + (3 * HOUR) + (0 * MINUTE) + (0 * SECOND); + expectedTime = "10 day(s) 3 hour(s)"; + assertEquals("Unexpected readable time.", expectedTime, StringUtilities.getFullHumanReadableTime(givenTime)); - public void testGetHumanReadableTime() { + // 10 days 3 hours 30 minutes 10 seconds // + givenTime = (10 * DAY) + (3 * HOUR) + (30 * MINUTE) + (10 * SECOND); + expectedTime = "10 day(s) 3 hour(s) 30 minute(s)"; + assertEquals("Unexpected readable time.", expectedTime, StringUtilities.getFullHumanReadableTime(givenTime)); + try { + StringUtilities.getFullHumanReadableTime(-1); + fail("Failed to throw an illegal argument exception for negative time."); + } catch (IllegalArgumentException expected) { + } + try { + StringUtilities.getFullHumanReadableTime(Long.MIN_VALUE); + fail("Failed to throw an illegal argument exception for negative time."); + } catch (IllegalArgumentException expected) { + } } - public void testGetFullHumanReadableTime() { - - } - public void testGetHumanReadableSize() { - } + final long kiloByte = 1024; + final long megaByte = 1024 * kiloByte; + final long gigaByte = 1024 * megaByte; - public void testRemoveSubString() { + long givenSize = 0; + String expectedSize = null; - } + givenSize = (10 * gigaByte) + (420 * megaByte); + expectedSize = "10.41GB"; + assertEquals("Unexpected readable size.", expectedSize, StringUtilities.getHumanReadableSize(givenSize)); - public void testFormatBreak() { + givenSize = (10 * megaByte) + (420 * kiloByte); + expectedSize = "10.41MB"; + assertEquals("Unexpected readable size.", expectedSize, StringUtilities.getHumanReadableSize(givenSize)); - } + givenSize = (10 * kiloByte) + (420); + expectedSize = "10.41KB"; + assertEquals("Unexpected readable size.", expectedSize, StringUtilities.getHumanReadableSize(givenSize)); - public void testOneLine() { + givenSize = 420; + expectedSize = "420B"; + assertEquals("Unexpected readable size.", expectedSize, StringUtilities.getHumanReadableSize(givenSize)); + try { + StringUtilities.getHumanReadableSize(-1); + fail("Failed to throw an illegal argument exception for negative byte size."); + } catch (IllegalArgumentException expected) { + } + try { + StringUtilities.getHumanReadableSize(Long.MIN_VALUE); + fail("Failed to throw an illegal argument exception for negative byte size."); + } catch (IllegalArgumentException expected) { + } } - public void testEncodeBase64() { + public void testCollapseToArray() { + final String testString = "Item1, Item2, Item3, Item4, Item5"; + String[] stringSet = StringUtilities.collapseToArray(testString, ","); + assertEquals("Unexpected number of array elements after collapse.", 5, stringSet.length); + assertEquals("Unexpected element in the array after collapse", "Item1", stringSet[0]); + assertEquals("Unexpected element in the array after collapse", "Item2", stringSet[1]); + assertEquals("Unexpected element in the array after collapse", "Item3", stringSet[2]); + assertEquals("Unexpected element in the array after collapse", "Item4", stringSet[3]); + assertEquals("Unexpected element in the array after collapse", "Item5", stringSet[4]); + try { + StringUtilities.collapseToArray(null, ","); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.collapseToArray(null, null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.collapseToArray(testString, null); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } } - public void testDecodeBase64() { + public void testRightFill() { - } + final String testString = "Hello World"; + String filledString = StringUtilities.rightFill(testString, 100); + assertEquals("Unexpected string length after right fill.", 100, filledString.length()); + assertEquals("Unexpected string value after right fill.", testString, filledString.trim()); + try { + StringUtilities.rightFill(null, 100); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.rightFill(testString, -1); + fail("Failed to throw a illegal argument exception for a negative length."); + } catch (IllegalArgumentException expected) { + } - public void testForceTrim() { - + try { + StringUtilities.rightFill(testString, testString.length() - 1); + fail("Failed to throw a illegal argument exception for inappropriate length."); + } catch (IllegalArgumentException expected) { + } } - public void testStripCharacters() { + public void testLeftFill() { - } + final String testString = "Hello World"; + String filledString = StringUtilities.leftFill(testString, 100); + assertEquals("Unexpected string length after left fill.", 100, filledString.length()); + assertEquals("Unexpected string value after left fill.", testString, filledString.trim()); + try { + StringUtilities.leftFill(null, 100); + fail("Failed to throw a null pointer exception."); + } catch (NullPointerException expected) { + } + try { + StringUtilities.leftFill(testString, -1); + fail("Failed to throw a illegal argument exception for a negative length."); + } catch (IllegalArgumentException expected) { + } - public void testExplodeObjectArray() { - + try { + StringUtilities.leftFill(testString, testString.length() - 1); + fail("Failed to throw a illegal argument exception for inappropriate length."); + } catch (IllegalArgumentException expected) { + } } - public void testExplodeCollection() { + public void testEncryptDecryptText() throws Exception { - } + KeyGenerator kg = KeyGenerator.getInstance("DESede"); + Key secret = kg.generateKey(); + final String DOCUMENT = "All your bases are belong to us."; + // encrypt with RSA key using 3-DES algorithm. + String encrypted = null; - public void testExplodeCollectionString() { + try { + encrypted = StringUtilities.encryptText(DOCUMENT, secret, "DESede"); + assertNotSame(DOCUMENT, encrypted); + } catch (GeneralSecurityException gse) { + gse.printStackTrace(); + fail("Failed to encrypt text"); + } - } + try { + String original = StringUtilities.decryptText(encrypted, secret, "DESede"); + assertEquals(DOCUMENT, original); + } catch (GeneralSecurityException gse) { + gse.printStackTrace(); + fail("Failed to decrypt text"); + } - public void testCollapseToCollection() { + try { + StringUtilities.encryptText(null, secret, "DESede"); + fail("Failed to throw the proper exception with bad input."); + } catch (NullPointerException expected) { + } - } + try { + StringUtilities.decryptText(null, secret, "DESede"); + fail("Failed to throw the proper exception with bad input."); + } catch (NullPointerException expected) { + } - public void testCollapseToArray() { + try { + StringUtilities.encryptText(DOCUMENT, secret, "Voodoo"); + fail("Failed to throw security exception."); + } catch (GeneralSecurityException expected) { + } + try { + StringUtilities.decryptText(encrypted, secret, "Voodoo"); + fail("Failed to throw security exception."); + } catch (GeneralSecurityException gse) { + } } - public void testRightFill() { + public void testGetSystemProperty() { + String property = System.getProperty("user.home"); + // install security manager with no more rights // + SecurityManager securityManager = new PropertySecurityManager(); + System.setSecurityManager(securityManager); + try { + try { + property = System.getProperty("user.home"); + fail("Security Manager is not installed correctly"); + } catch (SecurityException expected) { + } + String safeProperty = StringUtilities.getSystemProperty("user.home", "on-the-range"); + assertNotSame("Safe property should not be the same as the protected property.", property, safeProperty); + } finally { + System.setSecurityManager(null); + } } - public void testLeftFill() { + public void testSubstituteVariables() throws Exception { - } + final String pattern = "A Quick brown ${first} jumps over the lazy ${second}"; + final String recursivePattern = "A ${value} saved is a ${prize} earned $$$"; - public void testEncodeMD5Data() { + Properties properties = new Properties(); - } + properties.put("first", "fox"); + properties.put("second", "dog"); - public void testCompare() { + String normalized = StringUtilities.substituteVariables(pattern, properties); + assertEquals("A Quick brown fox jumps over the lazy dog", normalized); - } + properties.put("first", "bear"); + properties.put("second", "kitten"); + normalized = StringUtilities.substituteVariables(pattern, properties); + assertEquals("A Quick brown bear jumps over the lazy kitten", normalized); - /* - * Test method for 'org.isqlviewer.util.StringUtilities.getNormalizedClassName(String)' - */ - public void testGetNormalizedClassName() { + properties.put("value", "penny"); + properties.put("prize", "${hidden-secret}"); + properties.put("hidden-secret", "penny"); + normalized = StringUtilities.substituteVariables(recursivePattern, properties); + assertEquals("A penny saved is a penny earned $$$", normalized); - } + normalized = StringUtilities.substituteVariables(recursivePattern, null); + assertEquals("A saved is a earned $$$", normalized); - /* - * Test method for 'org.isqlviewer.util.StringUtilities.toNumber(String)' - */ - public void testToNumber() { + // this test validates system properties precedence that the user properties are + // checked before system properties. + properties.put("value", "penny"); + properties.put("prize", "${java.vm.name}"); + properties.put("java.vm.name", "penny"); + normalized = StringUtilities.substituteVariables(recursivePattern, properties); + assertEquals("A penny saved is a penny earned $$$", normalized); - } + try { + StringUtilities.substituteVariables("bad variable ${something.else ", properties); + } catch (ParseException expected) { + } - /* - * Test method for 'org.isqlviewer.util.StringUtilities.encryptText(String, Key, String)' - */ - public void testEncryptText() { - } - /* - * Test method for 'org.isqlviewer.util.StringUtilities.decryptText(String, Key, String)' - */ - public void testDecryptText() { + static class PropertySecurityManager extends SecurityManager { - } + @Override + public void checkPermission(Permission perm) { - /* - * Test method for 'org.isqlviewer.util.StringUtilities.parseFontString(String)' - */ - public void testParseFontString() { - + if (perm.implies(new RuntimePermission("setSecurityManager"))) { + return; + } + super.checkPermission(perm); + } } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:24:02
|
Revision: 41 http://svn.sourceforge.net/isql/?rev=41&view=rev Author: mkobold Date: 2007-03-03 11:24:02 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * Updated build.xml to properly build the isql-core.jar file correctly. Modified Paths: -------------- isql-core/trunk/build.xml Modified: isql-core/trunk/build.xml =================================================================== --- isql-core/trunk/build.xml 2007-03-03 19:23:37 UTC (rev 40) +++ isql-core/trunk/build.xml 2007-03-03 19:24:02 UTC (rev 41) @@ -67,15 +67,18 @@ <include name="**/*.properties" /> <include name="**/*.html" /> <include name="**/*.htm" /> + <include name="**/*.sql" /> </patternset> <path id="build.classpath"> <pathelement location="${lib.dir}/log4j.jar" /> + <pathelement location="${lib.dir}/derby.jar" /> </path> <path id="junit.classpath"> <pathelement location="${junit.home}/junit.jar" /> <pathelement location="${lib.dir}/log4j.jar" /> + <pathelement location="${lib.dir}/hsqldb.jar" /> <pathelement location="${bin.dir}" /> </path> @@ -109,7 +112,6 @@ <copy file="${basedir}/support/xml/bookmarks.dtd" todir="${bin.dir}/org/isqlviewer/resource/xml" /> <copy file="${basedir}/support/xml/service_2_x.dtd" todir="${bin.dir}/org/isqlviewer/resource/xml" /> <copy file="${basedir}/support/xml/service_3_x.dtd" todir="${bin.dir}/org/isqlviewer/resource/xml" /> - <copy file="${basedir}/support/xml/sql-history.dtd" todir="${bin.dir}/org/isqlviewer/resource/xml" /> <antcall inheritrefs="true" target="compile-tests" /> </target> @@ -125,7 +127,10 @@ <include name="org/isqlviewer/**" /> <include name="org/isqlviewer/bookmarks/**" /> <include name="org/isqlviewer/event/**" /> + <include name="org/isqlviewer/history/**" /> <include name="org/isqlviewer/sql/**" /> + <include name="org/isqlviewer/sql/embedded/**" /> + <include name="org/isqlviewer/sql/platform/**" /> <include name="org/isqlviewer/util/**" /> <include name="org/isqlviewer/xml/**" /> </packageset> @@ -188,7 +193,5 @@ <copy file="${basedir}/support/xml/bookmarks.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> <copy file="${basedir}/support/xml/service_2_x.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> <copy file="${basedir}/support/xml/service_3_x.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> - <copy file="${basedir}/support/xml/sql-history.dtd" todir="${basedir}/bin/org/isqlviewer/resource/xml" /> - </target> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:23:36
|
Revision: 40 http://svn.sourceforge.net/isql/?rev=40&view=rev Author: mkobold Date: 2007-03-03 11:23:37 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * Added embedded database support using Apache Derby / JavaDB to support storage and retrieval of iSQL-Viewer application objects such as bookmark, service definitions, and history. Added Paths: ----------- isql-core/trunk/lib/derby.jar isql-core/trunk/src/org/isqlviewer/sql/embedded/ isql-core/trunk/src/org/isqlviewer/sql/embedded/CompatabilityKit.java isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java isql-core/trunk/src/org/isqlviewer/sql/embedded/Procedures.java isql-core/trunk/src/org/isqlviewer/sql/embedded/ResourceBundle.properties isql-core/trunk/src/org/isqlviewer/sql/embedded/dbinit.sql Added: isql-core/trunk/lib/derby.jar =================================================================== (Binary files differ) Property changes on: isql-core/trunk/lib/derby.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: isql-core/trunk/src/org/isqlviewer/sql/embedded/CompatabilityKit.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/CompatabilityKit.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/CompatabilityKit.java 2007-03-03 19:23:37 UTC (rev 40) @@ -0,0 +1,269 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.sql.embedded; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; + +import org.apache.log4j.Logger; +import org.isqlviewer.ServiceReference; +import org.isqlviewer.bookmarks.BookmarkFolder; +import org.isqlviewer.history.CommandType; +import org.isqlviewer.history.HistoricalCommand; +import org.isqlviewer.util.IsqlToolkit; +import org.isqlviewer.util.LocalMessages; +import org.isqlviewer.util.StringUtilities; +import org.isqlviewer.xml.BookmarkDigester; +import org.isqlviewer.xml.ServiceDigester; +import org.xml.sax.InputSource; + +/** + * Class for providing backward compatability to previous versions of ISQL-Viewer resources. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class CompatabilityKit { + + private static final String CACHE_FILE = "services.cache"; + private static final String KEY_SERVICE_LIST = "SERVICE_ORDER"; + private static final String SERVICE_SEPERATOR = "\u0001"; + private static final String HISTORY_FIELD_SEPERATOR = "\u0006"; + private static final char SERVICE_FIELD_SEPERATOR = '='; + private static final String BUNDLE_NAME = "org.isqlviewer.sql.embedded.ResourceBundle"; + + private static LocalMessages messages = new LocalMessages(BUNDLE_NAME); + private static Logger logger = IsqlToolkit.getApplicationLogger(); + + /** + * Gets all the bookmarks from the bookmarks.xml file from the iSQL-Viewer base directory. + * <p> + * + * @return root bookmark folder containing all bookmarks and sub-folders. + */ + public static BookmarkFolder get2xxBookmarks() { + + File bookmarksFile = new File(IsqlToolkit.getBaseDirectory(), "bookmarks.xml"); + BookmarkFolder rootFolder = null; + if (bookmarksFile.exists()) { + FileInputStream fis = null; + try { + fis = new FileInputStream(bookmarksFile); + InputSource source = new InputSource(fis); + rootFolder = BookmarkDigester.parseBookmarks(source); + } catch (FileNotFoundException error) { + logger.warn(messages.format("compatability_kit.no_bookmarks_xml")); + } catch (Exception error) { + logger.error(messages.format("compatability_kit.generic_bookmark_error"), error); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception ignored) { + } + } + if (rootFolder == null) { + rootFolder = BookmarkFolder.createRootFolder(); + } + } + } + return rootFolder; + } + + /** + * Loads all service definitions defined in the services.cache file in the iSQL-Viewer base directory. + * <p> + * + * @return all existing service definitions declared within the old caches file. + */ + public static Collection<ServiceReference> get2xxServices() { + + ArrayList<ServiceReference> references = new ArrayList<ServiceReference>(); + Map<String, File> serviceFileMapping = loadServiceCache(); + int order = 0; + Set<Map.Entry<String, File>> serviceSet = serviceFileMapping.entrySet(); + for (Map.Entry<String, File> entry : serviceSet) { + ServiceReference reference = new ServiceReference(); + reference.setName(entry.getKey()); + reference.setOrder(order++); + try { + reference.setResourceURL(entry.getValue().toURL()); + } catch (MalformedURLException ignored) { + // we already have it checked when we call loadServiceCache()// + } + references.add(reference); + } + return references; + } + + /** + * Aquires the autoloaded history elements from previous versions of iSQL-Viewer. + * <p> + * + * @return collection of all history elements logged in the 'autoload.history' file. + */ + public static Collection<HistoricalCommand> get2xxHistory() { + + ArrayList<HistoricalCommand> history = new ArrayList<HistoricalCommand>(); + FileReader fileReader = null; + StringBuilder buffer = new StringBuilder(""); + File baseDirectory = new File(IsqlToolkit.getBaseDirectory(), "history"); + try { + fileReader = new FileReader(new File(baseDirectory, "autoload.history")); + BufferedReader bufferedReader = new BufferedReader(fileReader); + while (bufferedReader.ready()) { + String line = bufferedReader.readLine(); + if (line.trim().length() == 0) { + String content = buffer.toString(); + history.add(decodeHistoryItem(content)); + buffer.setLength(0); + continue; + } + buffer.append(line); + buffer.append('\n'); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fileReader != null) { + fileReader.close(); + } + } catch (Exception ignored) { + } + } + return history; + } + + // Old decode code for transforming the history item to the new object. + private static HistoricalCommand decodeHistoryItem(String s) { + + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + String b64Decoded = StringUtilities.decodeBase64(s); + StringTokenizer st = new StringTokenizer(b64Decoded, HISTORY_FIELD_SEPERATOR); + long executionTime = Long.parseLong(st.nextToken()); + command.setQueryTime(new Date(executionTime)); + command.setService(st.nextToken()); + command.setCommandText(st.nextToken()); + return command; + } + + // Old code from service manager to load the service cache file properly. + private static Map<String, File> loadServiceCache() { + + ArrayList<String> preferredOrder = new ArrayList<String>(); + HashMap<String, File> serviceFileMapping = new HashMap<String, File>(); + File file = new File(IsqlToolkit.getBaseDirectory(), CACHE_FILE); + if (!file.exists()) { + return serviceFileMapping; + } + + if (file.canRead()) { + FileReader fileReader = null; + try { + fileReader = new FileReader(file); + BufferedReader lineReader = new BufferedReader(fileReader); + while (lineReader.ready()) { + String data = lineReader.readLine(); + if (data.charAt(0) == '#') { + continue; + } + int idx0 = 0; + int idx1 = data.indexOf(SERVICE_FIELD_SEPERATOR); + + String name = StringUtilities.decodeASCII(data.substring(idx0, idx1)); + String uri = StringUtilities.decodeASCII(data.substring(idx1 + 1)); + if (name.equalsIgnoreCase(KEY_SERVICE_LIST)) { + StringTokenizer st = new StringTokenizer(uri, SERVICE_SEPERATOR); + while (st.hasMoreTokens()) { + String serviceName = st.nextToken(); + preferredOrder.add(serviceName.toLowerCase().trim()); + } + continue; + } + + try { + URL url = new URL(uri); + File serviceFile = new File(url.getFile()); + if (serviceFile.isDirectory()) { + logger.warn(messages.format("compatability_kit.service_mapped_to_directory", name, uri)); + continue; + } else if (!serviceFile.canRead()) { + logger.warn(messages.format("compatability_kit.service_not_readable", name, uri)); + continue; + } else if (!serviceFile.exists()) { + logger.warn(messages.format("compatability_kit.service_does_not_exist", name, uri)); + continue; + } + String bindName = name.toLowerCase().trim(); + InputStream inputStream = null; + try { + inputStream = url.openStream(); + InputSource inputSource = new InputSource(inputStream); + bindName = ServiceDigester.parseService(inputSource, IsqlToolkit.getSharedEntityResolver()) + .getName(); + } catch (Exception error) { + continue; + } + if (serviceFileMapping.put(bindName, serviceFile) != null) { + logger.warn(messages.format("compatability_kit.service_duplicate_name_error", name, uri)); + } + } catch (MalformedURLException e) { + logger.error(messages.format("compatability_kit.service_uri_error", name, uri), e); + } + } + } catch (IOException ioe) { + logger.error("compatability_kit.service_generic_error", ioe); + } finally { + if (fileReader != null) { + try { + fileReader.close(); + } catch (Throwable ignored) { + } + } + } + } + return serviceFileMapping; + } +} \ No newline at end of file Added: isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/EmbeddedDatabase.java 2007-03-03 19:23:37 UTC (rev 40) @@ -0,0 +1,1061 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.sql.embedded; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.sql.Types; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.Enumeration; + +import org.apache.derby.jdbc.EmbeddedDriver; +import org.apache.log4j.Logger; +import org.isqlviewer.BindVariable; +import org.isqlviewer.ServiceReference; +import org.isqlviewer.bookmarks.Bookmark; +import org.isqlviewer.bookmarks.BookmarkFolder; +import org.isqlviewer.bookmarks.BookmarkReference; +import org.isqlviewer.bookmarks.ColorLabel; +import org.isqlviewer.history.CommandType; +import org.isqlviewer.history.HistoricalCommand; +import org.isqlviewer.history.HistoryReference; +import org.isqlviewer.util.BasicUtilities; +import org.isqlviewer.util.IsqlToolkit; + +/** + * Embedded Database Wrapper for providing high-level application functionaliy backed by a JDBC database. + * <p> + * This class currently uses Apache Derby as the backed. The DDL that defines the structures are defined by the + * dbinit.sql script within this package. + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class EmbeddedDatabase { + + private static final String CONSTRAINT_VIOLATION = "23505"; + private static final String NO_DATA_AVAILABLE = "24000"; + + private static final String BOOKMARK_INSERT = "INSERT INTO BOOKMARK (IS_FAVORITE, CREATION_TIME, LAST_ACCESS, NAME, COMMAND_TEXT, USAGE_COUNT, FOLDER, COLOR_LABEL) VALUES (?, ?, ?, ?, ?, ? ,?, ?)"; + private static final String BOOKMARK_UPDATE = "UPDATE BOOKMARK SET IS_FAVORITE = ?, LAST_ACCESS = CURRENT_TIMESTAMP, NAME = ?, COMMAND_TEXT = ?, USAGE_COUNT = ?, FOLDER = ?, COLOR_LABEL=? WHERE BOOKMARK_ID=?"; + private static final String BOOKMARK_UPDATE_LITE = "UPDATE BOOKMARK SET NAME = ?, IS_FAVORITE = ?, LAST_ACCESS = CURRENT_TIMESTAMP, FOLDER = ?, COLOR_LABEL=? WHERE BOOKMARK_ID=?"; + + private static final String BOOKMARK_SELECT_LITE = "SELECT BOOKMARK_ID,NAME,FOLDER,IS_FAVORITE, COLOR_LABEL FROM BOOKMARK ORDER BY FOLDER"; + private static final String BOOKMARK_SELECT_SINGLE = "SELECT BOOKMARK_ID, IS_FAVORITE, CREATION_TIME, LAST_ACCESS, NAME, COMMAND_TEXT, USAGE_COUNT, COLOR_LABEL FROM BOOKMARK WHERE BOOKMARK_ID = ?"; + private static final String BOOKMARK_DELETE = "DELETE FROM BOOKMARK WHERE BOOKMARK_ID=?"; + private static final String BOOKMARK_DELETE_FOLDER = "DELETE FROM BOOKMARK WHERE FOLDER LIKE ''{0}%'' "; + private static final String BOOKMARK_FOLDER_RENAME = "UPDATE BOOKMARK SET FOLDER = REGEX_REPLACE(FOLDER, ?, ?) WHERE FOLDER LIKE ?"; + + private static final String BOOKMARK_BIND_VARIABLE_INSERT = "INSERT INTO BOOKMARK_BIND_VARIABLE (BOOKMARK_ID, PARAMETER_INDEX, SQL_TYPE, USER_DATA, OPTIONS) VALUES (?, ?, ?, ?, ?)"; + + private static final String SERVICE_SELECT_ALL = "SELECT SERVICE_ID, NAME, ORDER_PREFERENCE, LAST_USED, CREATION_TIME, RESOURCE_URL FROM SERVICE WHERE SERVICE_ID > 0 ORDER BY SERVICE_ID"; + private static final String SERVICE_SELECT_BY_NAME = "SELECT SERVICE_ID, NAME, ORDER_PREFERENCE, LAST_USED, CREATION_TIME, RESOURCE_URL FROM SERVICE WHERE NAME = ?"; + private static final String SERVICE_INSERT = "INSERT INTO SERVICE (NAME, ORDER_PREFERENCE, LAST_USED,RESOURCE_URL, CREATION_TIME) values (?, ?, ?, ?, ?)"; + private static final String SERVICE_ID_FOR_NAME = "SELECT SERVICE_ID FROM SERVICE WHERE NAME = ?"; + private static final String SERVICE_UPDATE = "UPDATE SERVICE SET NAME = ?, ORDER_PREFERENCE = ?, LAST_USED = ?, RESOURCE_URL = ? WHERE SERVICE_ID=?"; + private static final String SERVICE_INSTALL_UNKNOWN = "INSERT INTO SERVICE (NAME, ORDER_PREFERENCE, RESOURCE_URL, CREATION_TIME) values ( '???', -1, '', CURRENT_TIMESTAMP)"; + private static final String SERVICE_DELETE = "DELETE FROM SERVICE WHERE SERVICE_ID = ?"; + + private static final String HISTORY_INSERT = "INSERT INTO HISTORY (SERVICE_ID, QUERY_TIME, TRANSACTION_ID, COMMAND_TYPE, COMMAND_TEXT) values (?, ?, ?, ?, ?)"; + private static final String HISTORY_SELECT_ALL = "SELECT HISTORY_ID, QUERY_TIME, TRANSACTION_ID, COMMAND_TYPE, COMMAND_TEXT FROM HISTORY ORDER BY QUERY_TIME"; + private static final String HISTORY_SELECT_SINGLE = "SELECT H.HISTORY_ID, S.NAME, H.QUERY_TIME, H.TRANSACTION_ID, H.COMMAND_TYPE, H.COMMAND_TEXT FROM HISTORY H, SERVICE S WHERE HISTORY_ID = ? AND H.SERVICE_ID = S.SERVICE_ID"; + private static final String HISTORY_DELETE_SERVICE = "DELETE FROM HISTORY WHERE SERVICE_ID = ?"; + + private static final String PRIMARY_KEY_QUERY = "values IDENTITY_VAL_LOCAL()"; + + private static final EmbeddedDatabase sharedInstance; + + public static EmbeddedDatabase getSharedInstance() { + + return sharedInstance; + } + + static { + sharedInstance = new EmbeddedDatabase(); + } + + private Connection embeddedConnection = null; + private Logger logger = IsqlToolkit.getApplicationLogger(); + private File databaseHome = new File(IsqlToolkit.getBaseDirectory(), "derby"); + + // private static final String BUNDLE_NAME = "org.isqlviewer.sql.embedded.ResourceBundle"; + // private LocalMessages messages = new LocalMessages(BUNDLE_NAME); + + private EmbeddedDatabase() { + + // just create the driver and register it with the connection manager // + new EmbeddedDriver(); + } + + public boolean addService(ServiceReference serviceReference) throws SQLException { + + Object[] bindVariables = new Object[5]; + bindVariables[0] = serviceReference.getName(); + bindVariables[1] = new Integer(serviceReference.getOrder()); + Date lastUsed = serviceReference.getLastUsed(); + bindVariables[2] = new Timestamp(lastUsed == null ? 0 : lastUsed.getTime()); + bindVariables[3] = serviceReference.getResourceURL().toExternalForm(); + Date createdOn = serviceReference.getCreatedOn(); + bindVariables[4] = new Timestamp(createdOn == null ? System.currentTimeMillis() : createdOn.getTime()); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(SERVICE_INSERT); + for (int i = 0; i < bindVariables.length; i++) { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + int affectedCount = preparedStatement.executeUpdate(); + long identityValue = getInsertedPrimaryKey(); + serviceReference.setId(identityValue); + return affectedCount == 1; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public HistoryReference addHistoricalCommand(HistoricalCommand command) throws SQLException { + + Object[] bindVariables = new Object[5]; + bindVariables[0] = new Long(getServiceIDForName(command.getService())); + Date executionTime = command.getQueryTime(); + bindVariables[1] = new Timestamp(executionTime == null ? 0 : executionTime.getTime()); + bindVariables[2] = new Long(command.getTransactionId()); + bindVariables[3] = command.getType().toString(); + bindVariables[4] = command.getCommandText(); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(HISTORY_INSERT); + for (int i = 0; i < bindVariables.length; i++) { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + int affectedCount = preparedStatement.executeUpdate(); + if (affectedCount == 1) { + long identityValue = getInsertedPrimaryKey(); + command.setId(identityValue); + + HistoryReference referenceObject = new HistoryReference(); + referenceObject.setId(identityValue); + referenceObject.setQueryTime(command.getQueryTime()); + referenceObject.setTransactionId(command.getTransactionId()); + referenceObject.setType(command.getType()); + + String commandText = (String) bindVariables[4]; + StringBuilder builder = new StringBuilder(""); + for (int i = 0; i < commandText.length(); i++) { + char c = commandText.charAt(i); + if (Character.isWhitespace(c)) { + break; + } + builder.append(c); + } + referenceObject.setShortCommand(builder.toString()); + return referenceObject; + } + return null; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public HistoricalCommand getHistoricalCommand(HistoryReference reference) throws SQLException { + + return getHistoricalCommand(reference.getId()); + } + + public HistoricalCommand getHistoricalCommand(long historyId) throws SQLException { + + PreparedStatement preparedStatement = null; + ResultSet cursor = null; + try { + preparedStatement = embeddedConnection.prepareStatement(HISTORY_SELECT_SINGLE); + preparedStatement.setLong(1, historyId); + boolean hasResults = preparedStatement.execute(); + if (hasResults) { + cursor = preparedStatement.getResultSet(); + if (cursor.next()) { + HistoricalCommand command = new HistoricalCommand(); + command.setId(cursor.getLong(1)); + command.setService(cursor.getString(2)); + command.setQueryTime(cursor.getTimestamp(3)); + command.setTransactionId(cursor.getLong(4)); + CommandType type = CommandType.valueOf(cursor.getString(5)); + command.setType(type); + command.setCommandText(cursor.getString(6)); + return command; + } + } + return null; + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public Collection<HistoryReference> getHistory() throws SQLException { + + ensureConnection(); + ArrayList<HistoryReference> historySet = new ArrayList<HistoryReference>(); + Statement stmt = embeddedConnection.createStatement(); + ResultSet cursor = null; + try { + boolean hasResults = stmt.execute(HISTORY_SELECT_ALL); + if (hasResults) { + cursor = stmt.getResultSet(); + while (cursor.next()) { + HistoryReference reference = new HistoryReference(); + reference.setId(cursor.getLong(1)); + Date executionTime = new Date(cursor.getTimestamp(2).getTime()); + reference.setQueryTime(executionTime); + reference.setTransactionId(cursor.getLong(3)); + reference.setType(CommandType.valueOf(cursor.getString(4))); + String commandText = cursor.getString(5); + StringBuilder builder = new StringBuilder(""); + for (int i = 0; i < commandText.length(); i++) { + char c = commandText.charAt(i); + if (Character.isWhitespace(c)) { + break; + } + builder.append(c); + } + reference.setShortCommand(builder.toString()); + historySet.add(reference); + } + } + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + return historySet; + } + + public long getServiceIDForName(String service) throws SQLException { + + PreparedStatement preparedStatement = null; + ResultSet cursor = null; + try { + preparedStatement = embeddedConnection.prepareStatement(SERVICE_ID_FOR_NAME); + preparedStatement.setString(1, service); + boolean hasResults = preparedStatement.execute(); + if (hasResults) { + cursor = preparedStatement.getResultSet(); + if (cursor.next()) { + long serviceID = cursor.getLong(1); + if (cursor.wasNull()) { + return 1; + } + return serviceID; + } + } + } catch (SQLException sqle) { + if (NO_DATA_AVAILABLE.equals(sqle.getSQLState())) { + return 1; + } + throw sqle; + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + return 1; + } + + public boolean addBookmarkFolder(BookmarkFolder bookmarkFolder) throws SQLException { + + int childCount = bookmarkFolder.getChildCount(); + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_INSERT); + for (int i = 0; i < childCount; i++) { + Object childElement = bookmarkFolder.getChild(i); + if (childElement instanceof Bookmark) { + addBookmark0((Bookmark) childElement, bookmarkFolder, preparedStatement); + } else if (childElement instanceof BookmarkFolder) { + addBookmarkFolder0((BookmarkFolder) childElement, 1, preparedStatement); + } + } + preparedStatement.executeBatch(); + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + return true; + } + + public Bookmark getBookmark(BookmarkReference reference) throws SQLException { + + Bookmark bookmark = getBookmark(reference.getId()); + bookmark.setFolder(reference.getFolder()); + return bookmark; + } + + public Bookmark getBookmark(long bookmarkId) throws SQLException { + + PreparedStatement preparedStatement = null; + ResultSet cursor = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_SELECT_SINGLE); + preparedStatement.setLong(1, bookmarkId); + boolean hasResults = preparedStatement.execute(); + if (hasResults) { + cursor = preparedStatement.getResultSet(); + if (cursor.next()) { + Bookmark bookmark = new Bookmark(); + bookmark.setId(cursor.getLong(1)); + bookmark.setFavorite(cursor.getBoolean(2)); + bookmark.setCreationTime(cursor.getTimestamp(3)); + bookmark.setLastAccess(cursor.getTimestamp(4)); + bookmark.setName(cursor.getString(5)); + bookmark.setCommandText(cursor.getString(6)); + bookmark.setUseCount(cursor.getLong(7)); + String labelColorText = cursor.getString(8); + if (labelColorText != null) { + bookmark.setColorLabel(ColorLabel.valueOf(labelColorText)); + } + return bookmark; + } + } + return null; + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean updateService(ServiceReference serviceReference) throws SQLException { + + Object[] bindVariables = new Object[5]; + int[] types = new int[5]; + + types[0] = Types.VARCHAR; + types[1] = Types.INTEGER; + types[2] = Types.TIMESTAMP; + types[2] = Types.VARCHAR; + types[4] = Types.BIGINT; + + bindVariables[0] = serviceReference.getName(); + bindVariables[1] = new Integer(serviceReference.getOrder()); + Date lastUsed = serviceReference.getLastUsed(); + bindVariables[2] = new Timestamp(lastUsed == null ? System.currentTimeMillis() : lastUsed.getTime()); + bindVariables[3] = serviceReference.getResourceURL(); + bindVariables[3] = new Long(serviceReference.getId()); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(SERVICE_UPDATE); + for (int i = 0; i < bindVariables.length; i++) { + if (bindVariables[i] == null) { + preparedStatement.setNull(i + 1, types[i]); + } else { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + } + int affected = preparedStatement.executeUpdate(); + return affected == 1; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean updateBookmark(BookmarkReference bookmark) throws SQLException { + + Object[] bindVariables = new Object[5]; + int[] types = new int[5]; + + types[0] = Types.VARCHAR; + types[1] = Types.BOOLEAN; + types[2] = Types.VARCHAR; + types[2] = Types.VARCHAR; + types[4] = Types.BIGINT; + + bindVariables[0] = bookmark.getName(); + bindVariables[1] = Boolean.valueOf(bookmark.isFavorite()); + bindVariables[2] = bookmark.getPath(); + ColorLabel colorLabel = bookmark.getColorLabel(); + bindVariables[3] = colorLabel == null ? null : colorLabel.name(); + bindVariables[4] = new Long(bookmark.getId()); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_UPDATE_LITE); + for (int i = 0; i < bindVariables.length; i++) { + if (bindVariables[i] == null) { + preparedStatement.setNull(i + 1, types[i]); + } else { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + } + int affected = preparedStatement.executeUpdate(); + return affected == 1; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean updateBookmark(Bookmark bookmark) throws SQLException { + + Object[] bindVariables = new Object[7]; + int[] types = new int[7]; + + types[0] = Types.BOOLEAN; + types[1] = Types.VARCHAR; + types[2] = Types.VARCHAR; + types[3] = Types.BIGINT; + types[4] = Types.VARCHAR; + types[5] = Types.VARCHAR; + types[6] = Types.BIGINT; + + bindVariables[0] = Boolean.valueOf(bookmark.isFavorite()); + bindVariables[1] = bookmark.getName(); + bindVariables[2] = bookmark.getCommandText(); + bindVariables[3] = new Long(bookmark.getUseCount()); + bindVariables[4] = bookmark.getPath(); + ColorLabel colorLabel = bookmark.getColorLabel(); + bindVariables[5] = colorLabel == null ? null : colorLabel.name(); + bindVariables[6] = new Long(bookmark.getId()); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_UPDATE); + for (int i = 0; i < bindVariables.length; i++) { + if (bindVariables[i] == null) { + preparedStatement.setNull(i + 1, types[i]); + } else { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + } + int affected = preparedStatement.executeUpdate(); + return affected == 1; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean removeBookmarkFolder(BookmarkFolder folder) throws SQLException { + + Statement statement = null; + String query = MessageFormat.format(BOOKMARK_DELETE_FOLDER, new Object[]{folder.getPath()}); + try { + statement = embeddedConnection.createStatement(); + int affectedCount = statement.executeUpdate(query); + return affectedCount == 1; + } catch (SQLException sqle) { + if (NO_DATA_AVAILABLE.equals(sqle.getSQLState())) { + return false; + } + throw sqle; + } finally { + if (statement != null) { + try { + statement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean removeBookmark(BookmarkReference bookmark) throws SQLException { + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_DELETE); + preparedStatement.setLong(1, bookmark.getId()); + int affectedCount = preparedStatement.executeUpdate(); + return affectedCount == 1; + } catch (SQLException sqle) { + if (NO_DATA_AVAILABLE.equals(sqle.getSQLState())) { + return false; + } + throw sqle; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public boolean removeService(ServiceReference reference) throws SQLException { + + ensureConnection(); + PreparedStatement statement = null; + try { + statement = embeddedConnection.prepareStatement(SERVICE_DELETE); + statement.setLong(1, reference.getId()); + int affectedCount = statement.executeUpdate(); + statement.close(); + + statement = embeddedConnection.prepareStatement(HISTORY_DELETE_SERVICE); + statement.setLong(1, reference.getId()); + statement.executeUpdate(); + + return affectedCount == 1; + } catch (SQLException sqle) { + if (NO_DATA_AVAILABLE.equals(sqle.getSQLState())) { + return false; + } + throw sqle; + } finally { + if (statement != null) { + try { + statement.close(); + } catch (SQLException ignored) { + } + } + } + } + + public BookmarkFolder getBookmarks() throws SQLException { + + ensureConnection(); + BookmarkFolder rootFolder = BookmarkFolder.createRootFolder(); + + Statement stmt = embeddedConnection.createStatement(); + ResultSet cursor = null; + try { + boolean hasResults = stmt.execute(BOOKMARK_SELECT_LITE); + if (hasResults) { + cursor = stmt.getResultSet(); + while (cursor.next()) { + BookmarkReference bookmark = new BookmarkReference(); + bookmark.setId(cursor.getLong(1)); + bookmark.setName(cursor.getString(2)); + bookmark.setFavorite(cursor.getBoolean(4)); + String labelColorText = cursor.getString(5); + if (labelColorText != null) { + bookmark.setColorLabel(ColorLabel.valueOf(labelColorText)); + } + BookmarkFolder folder = rootFolder.mkdirs(cursor.getString(3)); + if (folder != null) { + folder.addBookmark(bookmark); + bookmark.setFolder(folder); + } + } + } + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + return rootFolder; + } + + public ServiceReference getServiceForName(String serviceName) throws SQLException { + + ensureConnection(); + PreparedStatement preparedStatement = null; + ResultSet cursor = null; + try { + preparedStatement = embeddedConnection.prepareStatement(SERVICE_SELECT_BY_NAME); + preparedStatement.setString(1, serviceName); + boolean hasResults = preparedStatement.execute(); + if (hasResults) { + cursor = preparedStatement.getResultSet(); + if (cursor.next()) { + ServiceReference reference = new ServiceReference(); + reference.setId(cursor.getLong(1)); + reference.setName(cursor.getString(2)); + reference.setOrder(cursor.getInt(3)); + reference.setLastUsed(cursor.getDate(4)); + reference.setCreatedOn(cursor.getDate(5)); + reference.setResourceURL(new URL(cursor.getString(6))); + return reference; + } + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + return null; + } + + public Collection<ServiceReference> getRegisteredServices() throws SQLException { + + ensureConnection(); + ArrayList<ServiceReference> serviceReferenceSet = new ArrayList<ServiceReference>(); + Statement stmt = embeddedConnection.createStatement(); + ResultSet cursor = null; + try { + boolean hasResults = stmt.execute(SERVICE_SELECT_ALL); + if (hasResults) { + cursor = stmt.getResultSet(); + while (cursor.next()) { + ServiceReference reference = new ServiceReference(); + + reference.setId(cursor.getLong(1)); + reference.setName(cursor.getString(2)); + reference.setOrder(cursor.getInt(3)); + reference.setLastUsed(cursor.getDate(4)); + reference.setCreatedOn(cursor.getDate(5)); + try { + reference.setResourceURL(new URL(cursor.getString(6))); + } catch (MalformedURLException e) { + System.out.println("Skipping " + reference.getId()); + continue; + } + serviceReferenceSet.add(reference); + } + } + } finally { + if (cursor != null) { + try { + cursor.close(); + } catch (SQLException ignored) { + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + return serviceReferenceSet; + } + + public BookmarkReference addBookmark(Bookmark bookmark) throws SQLException { + + if (addBookmark0(bookmark, null, null)) { + return bookmark.toBookmarkReference(); + } + return null; + } + + public boolean renameBookmarkFolder(String existingPath, String newPath) throws SQLException { + + Object[] bindVariables = new Object[3]; + int[] types = new int[3]; + + types[0] = Types.VARCHAR; + types[1] = Types.VARCHAR; + types[2] = Types.VARCHAR; + + bindVariables[0] = MessageFormat.format("({0})(.*)", new Object[]{existingPath}); + bindVariables[1] = MessageFormat.format("{0}$2", new Object[]{newPath}); + bindVariables[2] = MessageFormat.format("{0}%", new Object[]{existingPath}); + + PreparedStatement preparedStatement = null; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_FOLDER_RENAME); + for (int i = 0; i < bindVariables.length; i++) { + if (bindVariables[i] == null) { + preparedStatement.setNull(i + 1, types[i]); + } else { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + } + int affected = preparedStatement.executeUpdate(); + return affected >= 1; + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + /** + * Initializes the internal databases by creating the connection and creating all the nessecary database structures. + * <p> + * If this method returns true, the calling method should perform any nessecary upgrade and or import functions as + * deemed nessecary by the caller. + * <p> + * This method should only be called once. + * + * @return <tt>true</tt> if the database was initialized as a new instance, <tt>false</tt> if the database was + * pre-existing. + * @throws SQLException + */ + public synchronized boolean initialize() throws SQLException { + + boolean createTables = false; + if (!databaseHome.exists()) { + // if (!databaseHome.mkdirs()) { + // String msg = messages.format("embedded_database.failed_to_create_database_home", databaseHome); + // throw new SQLException(msg); + // } + createTables = true; + } + + ensureConnection(); + if (createTables) { + InputStream initStream = EmbeddedDatabase.class.getResourceAsStream("dbinit.sql"); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(initStream)); + StringBuilder sqlBuffer = new StringBuilder(""); + while (reader.ready()) { + String line = reader.readLine(); + if (line.length() == 0) { + try { + if (sqlBuffer.length() > 0) { + logger.info(sqlBuffer); + executeStatement(sqlBuffer.toString()); + } + } finally { + sqlBuffer.setLength(0); + } + } else { + sqlBuffer.append(line); + sqlBuffer.append(' '); + } + } + if (sqlBuffer.length() > 0) { + logger.info(sqlBuffer); + executeStatement(sqlBuffer.toString()); + } + executeStatement(SERVICE_INSTALL_UNKNOWN); + } catch (IOException error) { + SQLException sqlError = new SQLException(error.getMessage()); + BasicUtilities.wrapThrowable(error, sqlError); + throw sqlError; + } + } + return createTables; + } + + private boolean addBookmark0(Bookmark bookmark, BookmarkFolder folder, PreparedStatement preparedStatement) throws SQLException { + + Object[] bindVariables = new Object[8]; + int[] types = new int[8]; + + types[0] = Types.BOOLEAN; + types[1] = Types.TIMESTAMP; + types[2] = Types.TIMESTAMP; + types[3] = Types.VARCHAR; + types[4] = Types.VARCHAR; + types[5] = Types.BIGINT; + types[6] = Types.VARCHAR; + types[7] = Types.VARCHAR; + + bindVariables[0] = Boolean.valueOf(bookmark.isFavorite()); + Date time = bookmark.getCreationTime(); + bindVariables[1] = new Timestamp(time == null ? System.currentTimeMillis() : time.getTime()); + time = bookmark.getLastAccess(); + bindVariables[2] = new Timestamp(time == null ? System.currentTimeMillis() : time.getTime()); + bindVariables[3] = bookmark.getName(); + bindVariables[4] = bookmark.getCommandText(); + bindVariables[5] = new Long(bookmark.getUseCount()); + bindVariables[6] = folder == null ? bookmark.getPath() : folder.getPath(); + ColorLabel colorLabel = bookmark.getColorLabel(); + bindVariables[7] = colorLabel == null ? null : colorLabel.name(); + + boolean doBatch = (preparedStatement != null); + boolean hasError = true; + embeddedConnection.setAutoCommit(false); + + try { + if (preparedStatement == null) { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_INSERT); + } + for (int i = 0; i < bindVariables.length; i++) { + if (bindVariables[i] == null) { + preparedStatement.setNull(i + 1, types[i]); + } else { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + } + try { + int affectedCount = preparedStatement.executeUpdate(); + long identityValue = getInsertedPrimaryKey(); + bookmark.setId(identityValue); + addBindVariables(bookmark); + hasError = false; + return affectedCount == 1; + } catch (SQLException exception) { + if (CONSTRAINT_VIOLATION.equals(exception.getSQLState())) { + return false; + } + throw exception; + } + } finally { + if (hasError) { + embeddedConnection.rollback(); + } else { + embeddedConnection.commit(); + } + + embeddedConnection.setAutoCommit(true); + if (preparedStatement != null) { + if (!doBatch) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } else if (doBatch) { + preparedStatement.clearParameters(); + preparedStatement.clearWarnings(); + } + } + } + } + + private void addBindVariables(Bookmark bookmark) throws SQLException { + + Object[] bindVariables = new Object[5]; + bindVariables[0] = new Long(bookmark.getId()); + + Enumeration<BindVariable> variables = bookmark.variables(); + PreparedStatement preparedStatement = null; + int localParameterIndex = 1; + try { + preparedStatement = embeddedConnection.prepareStatement(BOOKMARK_BIND_VARIABLE_INSERT); + + while (variables.hasMoreElements()) { + BindVariable next = variables.nextElement(); + int index = next.getIndex(); + if (index <= 0) { + index = localParameterIndex; + } + localParameterIndex++; + bindVariables[1] = new Integer(index); + bindVariables[2] = new Integer(next.getType()); + bindVariables[3] = next.getUserData(); + bindVariables[4] = next.getFormatOptions(); + + for (int i = 0; i < bindVariables.length; i++) { + preparedStatement.setObject(i + 1, bindVariables[i]); + } + preparedStatement.executeUpdate(); + } + } finally { + if (preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException ignored) { + } + } + } + } + + private void addBookmarkFolder0(BookmarkFolder bookmarkFolder, int stackDepth, PreparedStatement preparedStatement) throws SQLException { + + int childCount = bookmarkFolder.getChildCount(); + for (int i = 0; i < childCount; i++) { + Object childElement = bookmarkFolder.getChild(i); + if (childElement instanceof Bookmark) { + addBookmark0((Bookmark) childElement, bookmarkFolder, preparedStatement); + } else if (childElement instanceof BookmarkFolder) { + addBookmarkFolder0((BookmarkFolder) childElement, stackDepth + 1, preparedStatement); + } + } + } + + private void executeStatement(String sqlBuffer) throws SQLException { + + Statement stmt = null; + try { + stmt = embeddedConnection.createStatement(); + stmt.execute(sqlBuffer.toString()); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + } + + private void ensureConnection() throws SQLException { + + if (embeddedConnection != null) { + return; + } + String url = constructURL(); + boolean hasError = true; + try { + embeddedConnection = DriverManager.getConnection(url); + hasError = false; + } catch (SQLException error) { + throw error; + } finally { + if (hasError) { + invalidateConnection(); + } + } + } + + private void invalidateConnection() { + + if (embeddedConnection != null) { + try { + embeddedConnection.close(); + } catch (Exception ignored) { + } finally { + embeddedConnection = null; + } + } + } + + private long getInsertedPrimaryKey() throws SQLException { + + Statement stmt = null; + ResultSet identity = null; + try { + stmt = embeddedConnection.createStatement(); + boolean hasResults = stmt.execute(PRIMARY_KEY_QUERY); + if (hasResults) { + identity = stmt.getResultSet(); + if (identity.next()) { + return identity.getLong(1); + } + } + return -1; + } finally { + if (identity != null) { + try { + identity.close(); + } catch (SQLException ignored) { + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException ignored) { + } + } + } + } + + private String constructURL() { + + MessageFormat urlFormat = new MessageFormat("jdbc:derby:{0}/;create=true;upgrade=true;"); + Object[] parameters = new Object[1]; + parameters[0] = databaseHome.getAbsolutePath(); + return urlFormat.format(parameters); + } + +} \ No newline at end of file Added: isql-core/trunk/src/org/isqlviewer/sql/embedded/Procedures.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/Procedures.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/Procedures.java 2007-03-03 19:23:37 UTC (rev 40) @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer.sql.embedded; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * TODO Add Procedures JavaDoc inforamation + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class Procedures { + + /** + * Function wrapper to support regex replace within Apache Derby. + * <p> + * This function is primarily used to do bookmark folder renames. + * + * @see Matcher#replaceFirst(String) + */ + public static String regexReplace(String source, String regex, String target) { + + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(source); + return matcher.replaceFirst(target); + } +} Added: isql-core/trunk/src/org/isqlviewer/sql/embedded/ResourceBundle.properties =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/ResourceBundle.properties (rev 0) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/ResourceBundle.properties 2007-03-03 19:23:37 UTC (rev 40) @@ -0,0 +1,11 @@ +embedded_database.failed_to_create_database_home=Failed to create a new database directory:''{1}''. + +compatability_kit.no_bookmarks_xml=The file'bookmarks.xml' is not available, no bookmarks can be imported from previous versions of iSQL-Viewer. +compatability_kit.generic_bookmark_error=There was an unexpected error while processing bookmarks from the bookmarks.xml file, please see the log for further details. + +compatability_kit.service_mapped_to_directory=Cannot load service definition that is mapped to a directory (service=''{0}'', directory=''{1}''). +compatability_kit.service_not_readable=Cannot load service definition that cannot be read (service=''{0}'', service-file=''{1}''). +compatability_kit.service_does_not_exist=Cannot load service definition from a file that does not exist (service=''{0}'', service-file=''{1}''). +compatability_kit.service_duplicate_name_error=Cannot load service definition as a service is already declared with the same name (service=''{0}'', service-file=''{1}''). +compatability_kit.service_uri_error=Cannot load service definition as the URI cannot be parsed properly see log for more details (service=''{0}'', service-file=''{1}''). +compatability_kit.service_generic_error=There was an unexpected error that has occured while loading the services, please see the log for further details. \ No newline at end of file Added: isql-core/trunk/src/org/isqlviewer/sql/embedded/dbinit.sql =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/embedded/dbinit.sql (rev 0) +++ isql-core/trunk/src/org/isqlviewer/sql/embedded/db... [truncated message content] |
From: <mk...@us...> - 2007-03-03 19:21:26
|
Revision: 39 http://svn.sourceforge.net/isql/?rev=39&view=rev Author: mkobold Date: 2007-03-03 11:21:27 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * sql/ByteArrayBlob.java * sql/ByteArrayClob.java ** Cleaned up code. * sql/ConnectionProfile.java ** Simplified resource urls for services to be local files instead of URL's * sql/ConnectionWrapper.java ** Commented out various JdbcCommand Logging functions. * sql/JdbcService.java ** Corrected reference to a localized string. * sql/JdbcUtilities.java ** Added code to extract meta-data * sql/ResourceBundle.properties ** Added/Updated localized messages * sql/ResultSetRenderer.java ** Added method to support isCancelled to allow rendering interruption properly. ** Added method to support java variable substitutions in the query. * sql/StatementWrapper.java ** Updated HistoricalCommand generation when queries are executed. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java isql-core/trunk/src/org/isqlviewer/sql/ResourceBundle.properties isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java Modified: isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ByteArrayBlob.java 2007-03-03 19:21:27 UTC (rev 39) @@ -28,11 +28,15 @@ package org.isqlviewer.sql; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.sql.Blob; import java.sql.SQLException; +import org.isqlviewer.util.BasicUtilities; + /** * Utility Implementation for dealing with BLOB objects in memory. * <p> @@ -44,31 +48,36 @@ */ public class ByteArrayBlob implements Blob { - protected StringBuffer blob = null; + protected ByteArrayOutputStream blob = new ByteArrayOutputStream(); public ByteArrayBlob() { - this("".getBytes()); } - public ByteArrayBlob(byte[] data) { + public ByteArrayBlob(byte[] data) throws IOException { - if (data == null) { - blob = new StringBuffer(""); - } else { - blob = new StringBuffer(new String(data)); - } + blob.write(data); } + /** + * @param binaryStream + */ + public ByteArrayBlob(InputStream binaryStream) throws IOException { + + BasicUtilities.copyStream(binaryStream, blob); + } + public long length() { - return blob.length(); + return blob.size(); } public byte[] getBytes(long pos, int length) throws SQLException { try { - return blob.substring((int) pos, (int) (pos + length)).getBytes(); + byte[] copy = new byte[length]; + System.arraycopy(blob.toByteArray(), (int) pos, copy, 0, length); + return copy; } catch (Throwable t) { throw new SQLException(t.getMessage()); } @@ -77,7 +86,7 @@ public InputStream getBinaryStream() throws SQLException { try { - return new ByteArrayInputStream(blob.toString().getBytes()); + return new ByteArrayInputStream(blob.toByteArray()); } catch (Throwable t) { throw new SQLException(t.getMessage()); } @@ -99,10 +108,14 @@ return position(pattern.getBytes(0, (int) pattern.length()), start); } - public void truncate(long len) throws SQLException { + public void truncate(long length) throws SQLException { try { - blob.setLength((int) len); + int len = (int) length; + byte[] copy = new byte[len]; + System.arraycopy(blob.toByteArray(), 0, copy, 0, len); + blob.reset(); + blob.write(copy); } catch (Throwable t) { throw new SQLException(t.getMessage()); } @@ -110,20 +123,16 @@ public OutputStream setBinaryStream(long pos) throws SQLException { - try { - BlobAdapterStream bas = new BlobAdapterStream(); - bas.setOffset(pos); - return bas; - } catch (Throwable t) { - throw new SQLException(t.getMessage()); - } + return blob; } public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException { try { - String str = new String(bytes, offset, len); - blob.replace((int) pos, (int) (pos + len), str); + byte[] copy = blob.toByteArray(); + System.arraycopy(blob.toByteArray(), 0, copy, 0, len); + blob.reset(); + blob.write(copy); return len; } catch (Throwable t) { throw new SQLException(t.getMessage()); @@ -134,65 +143,4 @@ return setBytes(pos, bytes, 0, bytes.length); } - - private class BlobAdapterStream extends OutputStream { - - private StringBuffer buf = new StringBuffer(""); - private long offset = -1L; - - public void setOffset(long pos) { - - offset = pos; - if (offset > blob.length()) { - offset = -1; - } - } - - @Override - public synchronized void write(int b) { - - b &= 0x000000FF; - char c = (char) b; - buf.append(String.valueOf(c)); - } - - @Override - public synchronized void write(byte[] b, int off, int length) { - - buf.append(new String(b, off, length)); - } - - @Override - public synchronized void write(byte[] b) { - - buf.append(new String(b)); - } - - @Override - public synchronized void flush() { - - synchronized (buf) { - if (buf.length() > 0) { - if (offset < blob.length() && offset >= 0) { - try { - setBytes(offset, buf.toString().getBytes()); - } catch (Throwable t) { - } - offset += buf.length(); - } else { - blob.append(buf.toString()); - offset = blob.length(); - } - } - buf.setLength(0); - } - } - - @Override - public void close() { - - flush(); - buf.setLength(0); - } - } } \ No newline at end of file Modified: isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ByteArrayClob.java 2007-03-03 19:21:27 UTC (rev 39) @@ -44,8 +44,8 @@ /** * Utility Implementation for dealing with CLOB objects in memory. * <p> - * This is very easy implementation of a CLOB using the StringBuffer. This class - * is designed for easily creating CLOB objects at runtime using Strings. + * This is very easy implementation of a CLOB using the StringBuffer. This class is designed for easily creating CLOB + * objects at runtime using Strings. * * @see java.lang.StringBuffer * @author Markus A. Kobold <mkobold at sprintpcs dot com> @@ -56,119 +56,77 @@ protected StringBuffer buff = new StringBuffer(""); public ByteArrayClob(String clobData) throws IOException { + this(clobData.toCharArray()); } public ByteArrayClob(char[] clobData) throws IOException { + clobStorage.write(clobData); buff = clobStorage.getBuffer(); } public ByteArrayClob(Reader reader) throws IOException { + BasicUtilities.copyReader(reader, clobStorage); buff = clobStorage.getBuffer(); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#length() - */ public long length() { + return buff.length(); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#getSubString(long, int) - */ public String getSubString(long pos, int length) { + return buff.substring((int) pos, (int) pos + length); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#getCharacterStream() - */ public Reader getCharacterStream() { + return new InputStreamReader(getAsciiStream()); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#getAsciiStream() - */ public InputStream getAsciiStream() { + String buffer = buff.toString(); return new ByteArrayInputStream(buffer.getBytes()); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#position(java.lang.String, long) - */ public long position(String searchstr, long start) { + String x = clobStorage.toString(); return x.indexOf(searchstr, (int) start); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#position(java.sql.Clob, long) - */ public long position(Clob searchstr, long start) { + return 0; } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#setString(long, java.lang.String) - */ public int setString(long pos, String str) throws SQLException { + return setString(pos, str, 0, str.length()); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#setString(long, java.lang.String, int, int) - */ public int setString(long pos, String str, int offset, int len) throws SQLException { - buff.insert((int) pos, str.toCharArray(), offset, len); + + buff.insert((int) pos, str.toCharArray(), offset, len); return len; } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#setAsciiStream(long) - */ public OutputStream setAsciiStream(long pos) { + return new ByteArrayOutputStream(); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#setCharacterStream(long) - */ public Writer setCharacterStream(long pos) { + return new StringWriter(); } - /* - * (non-Javadoc) - * - * @see java.sql.Clob#truncate(long) - */ public void truncate(long len) throws SQLException { - buff.setLength((int) len); - } + buff.setLength((int) len); + } } \ No newline at end of file Modified: isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ConnectionProfile.java 2007-03-03 19:21:27 UTC (rev 39) @@ -29,7 +29,9 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.io.File; import java.io.Serializable; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.Collections; @@ -150,7 +152,7 @@ // though it doesn't follow the true bean convention, I don't think it matters // private UserProperties profileSettings = new UserProperties(); // - private TreeSet<URL> resources = new TreeSet<URL>(); + private TreeSet<File> resources = new TreeSet<File>(); // notification mechanisim when settings are changed. private transient PropertyChangeSupport propertyListeners = new PropertyChangeSupport(this); // Classloader reference from the parent for creating hierical classloaders as expected. @@ -614,13 +616,13 @@ * This method will always return false if a null resourceURL is received. All duplicates are discarded and not * added. * - * @param resourceURL resource containing runtime resources required for the connection implementation. + * @param location resource containing runtime resources required for the connection implementation. * @return <tt>true</tt> if the resourceURL was sucessfully added. */ - public boolean addResourceURL(URL resourceURL) { + public boolean addResource(File location) { - if (resourceURL != null) { - return resources.add(resourceURL); + if (location != null) { + return resources.add(location); } return false; } @@ -629,13 +631,13 @@ * Removes given resourceURL from this profile. * <p> * - * @param resourceURL to needs to be removed from this profile. + * @param location to needs to be removed from this profile. * @return <tt>true</tt> if the URL was actually removed. */ - public boolean removeResourceURL(URL resourceURL) { + public boolean removeResource(File location) { - if (resourceURL != null) { - return resources.remove(resourceURL); + if (location != null) { + return resources.remove(location); } return false; } @@ -646,9 +648,9 @@ * * @return collection of all added resource urls prior. */ - public Enumeration<URL> resourceElements() { + public Enumeration<File> resourceElements() { - return Collections.<URL> enumeration(resources); + return Collections.<File> enumeration(resources); } /** @@ -673,7 +675,14 @@ */ public synchronized ClassLoader toClassLoader() { - URL[] resourceArray = resources.toArray(new URL[resources.size()]); + URL[] resourceArray = new URL[resources.size()]; + int i = 0; + for (File f : resources) { + try { + resourceArray[i++] = f.toURL(); + } catch (MalformedURLException ignored) { + } + } return new URLClassLoader(resourceArray, parentClassLoader); } Modified: isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ConnectionWrapper.java 2007-03-03 19:21:27 UTC (rev 39) @@ -361,14 +361,15 @@ updateLastAccess(); try { - JdbcCommandLogger logger = dataSource.getCommandLogger(); - if (logger != null) { - if (!autoCommit) { - logger.logTransactionStarted(dataSource); - } else { - logger.logTransactionFinished(dataSource); - } - } + // TODO re-implement this + // JdbcCommandLogger logger = dataSource.getCommandLogger(); + // if (logger != null) { + // if (!autoCommit) { + // logger.logTransactionStarted(dataSource); + // } else { + // logger.logTransactionFinished(dataSource); + // } + // } proxy.setAutoCommit(autoCommit); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "setAutoCommit(boolean)"), sqle); @@ -397,10 +398,11 @@ updateLastAccess(); try { - JdbcCommandLogger logger = dataSource.getCommandLogger(); - if (logger != null) { - logger.logTransactionCommited(dataSource); - } + // TODO re-implement this + // JdbcCommandLogger logger = dataSource.getCommandLogger(); + // if (logger != null) { + // logger.logTransactionCommited(dataSource); + // } proxy.commit(); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "commit()"), sqle); @@ -422,10 +424,11 @@ updateLastAccess(); try { - JdbcCommandLogger logger = dataSource.getCommandLogger(); - if (logger != null) { - logger.logTransactionRolledback(dataSource); - } + // TODO re-implement this + // JdbcCommandLogger logger = dataSource.getCommandLogger(); + // if (logger != null) { + // logger.logTransactionRolledback(dataSource); + // } proxy.rollback(); } catch (SQLException sqle) { error(messages.format("DataSource.GeneralMethodError", "rollback()"), sqle); @@ -759,7 +762,8 @@ JdbcCommandLogger commandLogger = dataSource.getCommandLogger(); if (commandLogger != null) { - commandLogger.logCommand(dataSource, command); + command.setService(dataSource.getName()); + commandLogger.logCommand(command); } } Modified: isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/JdbcService.java 2007-03-03 19:21:27 UTC (rev 39) @@ -41,6 +41,7 @@ import org.apache.log4j.Logger; import org.isqlviewer.JdbcCommandLogger; +import org.isqlviewer.util.IsqlToolkit; import org.isqlviewer.util.LocalMessages; import org.isqlviewer.util.StringUtilities; @@ -78,7 +79,7 @@ // Number of seconds that a connection is allowed to have when creating a connection. private int loginTimeout = 0; // Internal logging facility provided by log4j. - private Logger logger = Logger.getRootLogger(); + private Logger logger = IsqlToolkit.getApplicationLogger(); // User defined name for identifying this service. private String name = null; // @@ -561,10 +562,9 @@ warn(messages.format("DataSource.failed_to_register_correctly", getName())); } } catch (SQLException sqle) { - error(messages.format("DataSource.platform_registrartion_failed", result), sqle); + error(messages.format("DataSource.platform_registration_failed", result), sqle); } } - return cachedConnection; } throw new RuntimeException(messages.format("DataSource.connectionerror", result)); Modified: isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/JdbcUtilities.java 2007-03-03 19:21:27 UTC (rev 39) @@ -29,6 +29,8 @@ import java.io.IOException; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.math.BigDecimal; import java.sql.Blob; import java.sql.Clob; @@ -47,6 +49,8 @@ import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; import java.util.Vector; /** @@ -72,6 +76,41 @@ } /** + * @return + */ + public synchronized static Map<String, Object> extractMetadata(DatabaseMetaData dmd) { + + Class< ? extends DatabaseMetaData> c = dmd.getClass(); + Method[] methods = c.getMethods(); + Hashtable<String, Object> properties = new Hashtable<String, Object>(methods.length); + Object[] p = new Object[0]; + + for (int i = 0; i < methods.length; i++) { + String methodName = methods[i].getName(); + try { + if (methodName.startsWith("get")) { + Class returnType = methods[i].getReturnType(); + methodName = methodName.substring(3); + if (returnType.isPrimitive() || returnType == String.class) { + Object methodResult = methods[i].invoke(dmd, p); + properties.put(methodName, methodResult); + } + } + } catch (AbstractMethodError ame) { + properties.put(methodName, ""); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + } + properties.put("HONK HONK HONK", Boolean.TRUE); + return properties; + } + + /** * Retrieves a single column from a ResultSet via column number. * <p> * This method create an collection of Objects from the given column in the given ResultSet. All SQLExceptions and @@ -504,7 +543,7 @@ * @return converted object. * @throws ParseException if using the format object parsing exception occurs. */ - public static Object convertValue(Object data, int type, Format fmt) throws ParseException { + public static Object convertValue(Object data, int type, Format fmt) throws ParseException, IOException { if (data == null && type != Types.NULL) { throw new IllegalArgumentException("null (" + getTypeforValue(type) + ")"); @@ -1045,6 +1084,8 @@ convertValue(value, type, null); } catch (ParseException pe) { throw new SQLException(pe.getMessage()); + } catch (IOException e) { + throw new SQLException(e.getMessage()); } } Modified: isql-core/trunk/src/org/isqlviewer/sql/ResourceBundle.properties =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ResourceBundle.properties 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ResourceBundle.properties 2007-03-03 19:21:27 UTC (rev 39) @@ -5,7 +5,7 @@ DataSource.connection_interrupted=The JDBC connection process has been interrupted. DataSource.connection_timed_out=Failed to create a JDBC connection in the specified timeout:''{0}''. DataSource.connectionerror=An unexpected error occured while establishing the the JDBC Session with the following error:''{0}''. -DataSource.platform_registration_successfull=Successfully registered JDBC session for service:''{0}''. +DataSource.platform_registration_sucessfull=Successfully registered JDBC session for service:''{0}''. DataSource.failed_to_register_correctly=Failed to register JDBC session for service:''{0}'' please check logs for more information. DataSource.platform_registration_failed=Failed to register JDBC session for service:''{0}'' due to an unexpected SQL Exception. DataSource.cannot_use_null_connection_profile=A null service profile cannot be used with this service. Modified: isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-03-03 19:21:27 UTC (rev 39) @@ -42,6 +42,17 @@ public interface ResultSetRenderer { /** + * Allows the renderer to substitute the variable by name with something else. + * <p> + * When an SQL Statement is executed and inline variables in the Jav variable form of ${variable.name} are detect + * the SQL executor will request a substitution for the variable name. + * + * @param variableName to substitute. + * @return the value to be substituted for the given variable name. + */ + public String substituteVariable(String variableName); + + /** * Processes ResultSet objects from a statement execution. * <p> * This is the common method for dispatching a result set for processing outside the database connection object. @@ -62,8 +73,9 @@ * @param stmtID unique identifier for this statement. * @param set ResultSet returned from the statement's execution. * @param count in the situation of multiple resultsets this will be a counter for the resultset. + * @return number of rows processed from the result set. */ - public void processResultSet(String stmtID, ResultSet set, String nativeSQL, int count); + public long processResultSet(String stmtID, ResultSet set, String nativeSQL, int count); /** * Processes row updates from a statement execution. @@ -188,4 +200,9 @@ */ public void recieveResultsetWarnings(ResultSet set, SQLWarning warnings); + /** + * @return + */ + public boolean isCancelled(); + } Modified: isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java 2007-03-03 19:16:20 UTC (rev 38) +++ isql-core/trunk/src/org/isqlviewer/sql/StatementWrapper.java 2007-03-03 19:21:27 UTC (rev 39) @@ -41,7 +41,7 @@ import org.isqlviewer.util.LocalMessages; /** - * TODO Add StatementWrapper Overview JavaDoc. + * Wrapper class for generic statements produced by the underlying connection object. * <p> * * @author Mark A. Kobold <mkobold at isqlviewer dot com> @@ -138,9 +138,10 @@ String nsql = connection.nativeSQL(lastQuerySQL); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); boolean result = stmt.execute(sql); return result; @@ -160,9 +161,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); boolean result = stmt.execute(sql, autoGeneratedKeys); return result; @@ -182,9 +184,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); boolean result = stmt.execute(sql, columnIndexes); return result; @@ -204,9 +207,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); return stmt.execute(sql, columnNames); } catch (SQLException sqle) { @@ -225,9 +229,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.UPDATE_QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); int result = stmt.executeUpdate(sql, autoGeneratedKeys); return result; @@ -247,9 +252,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.UPDATE_QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); int result = stmt.executeUpdate(sql, columnIndexes); return result; @@ -269,9 +275,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.UPDATE_QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); int result = stmt.executeUpdate(sql, columnNames); @@ -292,9 +299,10 @@ lastQuerySQL = sql; String nsql = connection.nativeSQL(sql); info(messages.format("DataSource.StatementExec", nsql)); - HistoricalCommand command = new HistoricalCommand(CommandType.UPDATE_QUERY); - command.setExecutionTime(new Date(System.currentTimeMillis())); - command.setContent(sql); + HistoricalCommand command = new HistoricalCommand(); + command.setType(CommandType.QUERY); + command.setQueryTime(new Date(System.currentTimeMillis())); + command.setCommandText(sql); connection.logCommand(command); int result = stmt.executeUpdate(sql); return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:16:25
|
Revision: 38 http://svn.sourceforge.net/isql/?rev=38&view=rev Author: mkobold Date: 2007-03-03 11:16:20 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * isqlviewer/BindVariable.java ** Added here from the bookmark package as it can now apply to both history and bookmark items Added Paths: ----------- isql-core/trunk/src/org/isqlviewer/BindVariable.java Added: isql-core/trunk/src/org/isqlviewer/BindVariable.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/BindVariable.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/BindVariable.java 2007-03-03 19:16:20 UTC (rev 38) @@ -0,0 +1,166 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer; + +/** + * Represents parameterized data for bookmarks and historical items that are to be executed as a prepared statement. + * <p> + * Each parameter has an optional index to specify the order in the prepared statement to bound in. If the order is not + * specified it will be automatically set based on the order it was added to the bookmark. + * <p> + * Each parameter has the user data to be transformed into a specific object in the form of a string, the format options + * will represent a string of commands to transform the user data into the specific type. + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class BindVariable implements Comparable<BindVariable> { + + private int index = 0; + private int type = 1; + private String userData = null; + private String formatOptions = null; + + /** + * Compares this parameter data to another for ordering by the index of the parameter. + * <p> + * + * @param o other bookmark parameter data to be comparaed against. + * @return number indicating relative value as specificed by comparable. + * @see Comparable + */ + public int compareTo(BindVariable o) { + + if (o == null) { + return 1; + } + return index > o.index ? 1 : (index == o.index ? 0 : -1); + } + + /** + * Returns the formatting options to be applied to the user data. + * <p> + * These commands are semi-colon ';' seperated commands that will be applied to the user data field of this object + * in order to transfor the user data in to the proper data type. + * + * @return formatting options and commands for the user data; can be <tt>null</tt>. + */ + public String getFormatOptions() { + + return formatOptions; + } + + /** + * Sets the formatting options and commands for the user data. + * <p> + * + * @param formatOptions The formatOptions for the user data to set; use <tt>null</tt> to disable. + */ + public void setFormatOptions(String formatOptions) { + + this.formatOptions = formatOptions; + } + + /** + * Gets the index of this parameter as part of the prepared statement. + * <p> + * This value will be a number of 1..n where n is total number of parameters for a bookmark. if the value is + * anything else like 0 or less then actual index will be determined automatically by the bookmark this instance is + * added to. + * + * @return index of this parameter for order within a prepared statement. + */ + public int getIndex() { + + return index; + } + + /** + * Sets the parameter index for determining order for a prepared statement. + * <p> + * + * @param index order of the parameter binding. within a prepared statement; use 0 or less to make index automatic. + */ + public void setIndex(int index) { + + this.index = index; + } + + /** + * Get the SQL type that represents the intended data type for this parameter. + * <p> + * This should always be a value that is defined within the java.sql.Types interface. The Types interface defines + * the domain of inteded values for this field. + * + * @return the intended SQL data type for this parameter. + * @see java.sql.Types + */ + public int getType() { + + return type; + } + + /** + * Sets the SQL data-type for the parameter. + * <p> + * + * @param type data-type identifier as defined by java.sql.Types. + * @see java.sql.Types + */ + public void setType(int type) { + + this.type = type; + } + + /** + * Gets the user data that represents the actual data to be bound to the prepared statement. + * <p> + * If there are formatting options those commands will be applied to this content to transform it to the target + * data-type. + * <p> + * This value can be null if not specified. It is not recommended to use the NULL Type for null values as that is + * not actually what the NULL type is for, so if a null date is needed that still use the DATE data-type. + * + * @return user data that represents the data to be bound to a prepared statement. + */ + public String getUserData() { + + return userData; + } + + /** + * Sets the user data to be bound to a prepared statement. + * <p> + * + * @param userData that represents the data-type; can be null. + */ + public void setUserData(String userData) { + + this.userData = userData; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mk...@us...> - 2007-03-03 19:15:53
|
Revision: 37 http://svn.sourceforge.net/isql/?rev=37&view=rev Author: mkobold Date: 2007-03-03 11:15:51 -0800 (Sat, 03 Mar 2007) Log Message: ----------- * isqlviewer/BindVariable.java ** Added here from the bookmark package as it can now apply to both history and bookmark items * isqlviewer/FieldNotModifiableException.java ** Added new exception when a field that cannot be modified is attempted to be modified. * isqlviewer/ServiceReference.java ** Lightwieght structure for referring to a JdbcService without all properties of that object. * isqlviewer/JdbcCommandLogger.java ** Simplified until funtictionaly is required. * isqlviewer/ResourceBundle.properties ** Added new resource strings. Modified Paths: -------------- isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java isql-core/trunk/src/org/isqlviewer/ResourceBundle.properties Added Paths: ----------- isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java isql-core/trunk/src/org/isqlviewer/ServiceReference.java Added: isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/FieldNotModifiableException.java 2007-03-03 19:15:51 UTC (rev 37) @@ -0,0 +1,62 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer; + +/** + * Thrown when a class field is attempted to be modified through a setter but cannot be mutated in the given context. + * <p> + * This exception helps define the situation where a member field is modifiable only once or when the requirements for + * other class members of an object are met. If a user attempts to modify the field when it is not modification is not + * allowed this exception can be thrown. + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class FieldNotModifiableException extends RuntimeException { + + private static final long serialVersionUID = -7991215330717402660L; + + public FieldNotModifiableException() { + + } + + public FieldNotModifiableException(String message) { + + super(message); + } + + public FieldNotModifiableException(Throwable cause) { + + super(cause); + } + + public FieldNotModifiableException(String message, Throwable cause) { + + super(message, cause); + } +} \ No newline at end of file Modified: isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java 2007-03-03 19:11:39 UTC (rev 36) +++ isql-core/trunk/src/org/isqlviewer/JdbcCommandLogger.java 2007-03-03 19:15:51 UTC (rev 37) @@ -27,12 +27,7 @@ */ package org.isqlviewer; -import java.util.Date; - -import javax.swing.event.ChangeListener; - import org.isqlviewer.history.HistoricalCommand; -import org.isqlviewer.sql.JdbcService; /** * Interface for defining a JDBC command history logging mechanisim. @@ -43,24 +38,11 @@ */ public interface JdbcCommandLogger { - public void logCommand(JdbcService service, HistoricalCommand command); - - public void logTransactionStarted(JdbcService service); - - public void logTransactionFinished(JdbcService dataSource); - - public void logTransactionCommited(JdbcService service); - - public void logTransactionRolledback(JdbcService service); - - public Date[] getCommandExecutionBlocks(int calendarField); - - public HistoricalCommand[] getLoggedCommands(); - - public HistoricalCommand[] getLoggedCommands(int calendarField, Date executionBlock); - - public void addChangeListener(ChangeListener listener); - - public void removeChangeListener(ChangeListener listener); - + /** + * Logs a historical command to the underlying implementation. + * <p> + * + * @param command to log. + */ + public void logCommand(HistoricalCommand command); } Modified: isql-core/trunk/src/org/isqlviewer/ResourceBundle.properties =================================================================== --- isql-core/trunk/src/org/isqlviewer/ResourceBundle.properties 2007-03-03 19:11:39 UTC (rev 36) +++ isql-core/trunk/src/org/isqlviewer/ResourceBundle.properties 2007-03-03 19:15:51 UTC (rev 37) @@ -1,7 +0,0 @@ -ServiceManager.ServiceIsDirectorySkip=Skipping service registration as service file:''{0}'' is a directory. -ServiceManager.ServiceCannotReadSkip=Skipping service registration for unreadable file:''{0}'' (check permissions). -ServiceManager.ServiceNonexistentSkip=Skipping service registration for non-existent file:''{0}''. -ServiceManager.ServiceDuplicate=Duplicate entry for service named ''{0}'' in file:''{1}''. -ServiceManager.ServiceRegistered=Successfully registered isql-service:''{0}''. -ServiceManager.URIParsingError=Skipping service registration for due to malformed URI:''{0}'' in cache file. -ServiceManager.NoSuchService=The service:''{0}'' could not be found in this instance, please check the name and try again. \ No newline at end of file Added: isql-core/trunk/src/org/isqlviewer/ServiceReference.java =================================================================== --- isql-core/trunk/src/org/isqlviewer/ServiceReference.java (rev 0) +++ isql-core/trunk/src/org/isqlviewer/ServiceReference.java 2007-03-03 19:15:51 UTC (rev 37) @@ -0,0 +1,202 @@ +/* + * Copyright 2000-2005 by Mark A. Kobold + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is Markus A. Kobold. + * + * Portions created by Mark A. Kobold are Copyright (C) + * 2000-2005 Mark A. Kobold. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold <mk...@is...>. + * + * Contributor(s): all the names of the contributors are added in the source + * code where applicable. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://isql.sourceforge.net/ + */ +package org.isqlviewer; + +import java.net.URL; +import java.util.Date; + +/** + * Lightweight object to refer to a service definition at runtime. + * <p> + * Service definitions within iSQL-Viewer can be and most often are heavy objects containing lots of information + * regarding how to connect to a specific JDBC resource. This class serves as a lightwieght reference containing only + * the basic information required to connect to the service, without having all the service connection information + * resident in memory. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class ServiceReference { + + private long id = -1; + private String name = null; + private int order = -1; + private Date lastUsed = null; + private Date createdOn = null; + private URL resourceURL = null; + + /** + * Gets the unique identifier for this service reference. + * <p> + * Simply number that unique identifies this service reference within the iSQL-Viewer application. If the Id is -1 + * or less than 0, then that indicates that this particular service reference instance is not registered within the + * application. + * <p> + * This value has no real value other than uniquely identifying this service. + * + * @return the id of this service reference. + */ + public long getId() { + + return id; + } + + /** + * Sets the service reference identifier to the specified value. + * <p> + * + * @param id the id to set to uniquely identify this service. + */ + public void setId(long id) { + + this.id = id; + } + + /** + * Gets the common service name for this reference. + * <p> + * This is the name set by the user when the service definition was created. + * + * @return the name of the service this instance refers to; can be null if not set. + */ + public String getName() { + + return name; + } + + /** + * Sets the service name this instance refers to. + * <p> + * + * @param name to set as a logical reference for this instance. + * @throws NullPointerException if the given name is <tt>null</tt>. + * @throws IllegalArgumentException if the given name is blank. + */ + public void setName(String name) { + + if (name == null) { + throw new NullPointerException("name"); + } else if (name.trim().length() == 0) { + throw new IllegalArgumentException("name cannot be blank"); + } + this.name = name; + } + + /** + * Gets the preferred order of this service. + * <p> + * The order refers to the order defined by the user as thier preferred order. + * + * @return the order of this service as determined by the user. + */ + public int getOrder() { + + return order; + } + + /** + * Sets the order of this service reference. + * <p> + * + * @param order the order to set for this reference. + * @throws IllegalArgumentException if the given order is less than zero. + */ + public void setOrder(int order) { + + this.order = order; + } + + /** + * Gets the resource URL containing the service information for this instance. + * <p> + * This points to the service file containing all the nessecary connection information used to make and configure + * JDBC connections made by iSQL-Viewer. + * <p> + * The idea for using URL versus local file is allow service defintions to be accessed via HTTP and other Java + * supported protocols. + * + * @return the resource URL containing the detailed service connection information. + */ + public URL getResourceURL() { + + return resourceURL; + } + + /** + * Sets the resource URL for this service reference. + * <p> + * + * @param resourceURL to set for this reference. + * @throws NullPointerException if the given URL is null. + */ + public void setResourceURL(URL resourceURL) { + + this.resourceURL = resourceURL; + } + + /** + * Gets the last time a connection was made to the referring service by iSQL-Viewer. + * <p> + * + * @return the date and time at which a connection was made to this service. + */ + public Date getLastUsed() { + + return lastUsed; + } + + /** + * Sets the last time a connection was made to this service. + * <p> + * + * @param lastUsed the date and time at which a connection was successfull. + */ + public void setLastUsed(Date lastUsed) { + + this.lastUsed = lastUsed; + } + + + /** + * @return the createdOn + */ + public Date getCreatedOn() { + + return createdOn; + } + + + /** + * @param createdOn the createdOn to set + */ + public void setCreatedOn(Date createdOn) { + + this.createdOn = createdOn; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |