Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80178 Details for
Bug 203158
Need strict separation between UI and non-UI enablement plug-ins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
First part of Derby refactoring
patch_derby_phase_1.txt (text/plain), 94.55 KB, created by
Larry Dunnell
on 2007-10-11 16:17:13 EDT
(
hide
)
Description:
First part of Derby refactoring
Filename:
MIME Type:
Creator:
Larry Dunnell
Created:
2007-10-11 16:17:13 EDT
Size:
94.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.datatools.connectivity.derby.ui >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/DerbyUIPlugin.java >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby.ui/src/org/eclipse/datatools/connectivity/derby/internal/ui/DerbyUIPlugin.java,v >retrieving revision 1.1 >diff -u -r1.1 DerbyUIPlugin.java >--- src/org/eclipse/datatools/connectivity/derby/internal/ui/DerbyUIPlugin.java 7 Apr 2006 22:35:27 -0000 1.1 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/DerbyUIPlugin.java 11 Oct 2007 20:15:33 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.datatools.connectivity.derby.internal.ui; > >+import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.ui.plugin.AbstractUIPlugin; > > /** >@@ -36,4 +37,15 @@ > { > return plugin; > } >+ >+ /** >+ * Returns an image descriptor for the image file at the given >+ * plug-in relative path. >+ * >+ * @param path the path >+ * @return the image descriptor >+ */ >+ public static ImageDescriptor getImageDescriptor(String path) { >+ return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.datatools.connectivity.derby.ui", path); //$NON-NLS-1$ >+ } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.14 >diff -u -r1.14 MANIFEST.MF >--- META-INF/MANIFEST.MF 7 Jun 2007 16:10:00 -0000 1.14 >+++ META-INF/MANIFEST.MF 11 Oct 2007 20:15:33 -0000 >@@ -15,7 +15,11 @@ > org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)", > org.eclipse.datatools.modelbase.sql;bundle-version="[0.9.0,1.5.0)", > org.eclipse.datatools.modelbase.derby;bundle-version="[0.9.0,1.5.0)", >- org.eclipse.datatools.connectivity.derby;bundle-version="[0.9.1,1.5.0)" >+ org.eclipse.datatools.connectivity.derby;bundle-version="[0.9.1,1.5.0)", >+ org.eclipse.datatools.connectivity.db.generic;bundle-version="[0.9.1,1.5.0)", >+ org.eclipse.datatools.connectivity.db.generic.ui;bundle-version="[0.9.1,1.5.0)", >+ org.eclipse.datatools.connectivity;bundle-version="[0.9.1,1.5.0)", >+ org.eclipse.datatools.connectivity.ui;bundle-version="[0.9.1,1.5.0)" > Eclipse-LazyStart: true > Bundle-Vendor: Eclipse.org > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: build.properties >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby.ui/build.properties,v >retrieving revision 1.13 >diff -u -r1.13 build.properties >--- build.properties 7 Jun 2007 16:10:00 -0000 1.13 >+++ build.properties 11 Oct 2007 20:15:33 -0000 >@@ -4,7 +4,8 @@ > .,\ > about.html,\ > plugin.xml,\ >- icons/ >+ icons/,\ >+ plugin.properties > src.dir = src/ > plugin.version = 1.0.0.200706071 > javadoc.dir = doc/api/ >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby.ui/plugin.xml,v >retrieving revision 1.5 >diff -u -r1.5 plugin.xml >--- plugin.xml 18 May 2007 22:47:50 -0000 1.5 >+++ plugin.xml 11 Oct 2007 20:15:33 -0000 >@@ -47,4 +47,30 @@ > </contributor> > </extension> > >+ <extension >+ point="org.eclipse.datatools.connectivity.connectionProfile"> >+ <newWizard >+ class="org.eclipse.datatools.connectivity.derby.internal.ui.connection.NewDerbyEmbeddedConnectionProfileWizard" >+ icon="icons/new_db_element.gif" >+ id="org.eclipse.datatools.connectivity.db.derby.embedded.NewConnectionProfileWizard" >+ name="%DERBY_EMBEDDED_CONNECTION_PROFILE_WIZARD_NAME" >+ profile="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"/> >+ </extension> >+ <extension >+ point="org.eclipse.ui.propertyPages"> >+ <page >+ class="org.eclipse.datatools.connectivity.derby.internal.ui.connection.DerbyEmbeddedDBPropertyPage" >+ id="org.eclipse.datatools.connectivity.db.derby.profileProperties" >+ name="%DERBY_EMBEDDED_DB_PROPERTY_PAGE_NAME"> >+ <filter >+ name="org.eclipse.datatools.profile.property.id" >+ value="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"/> >+ <enabledWhen> >+ <instanceof >+ value="org.eclipse.datatools.connectivity.IConnectionProfile"> >+ </instanceof> >+ </enabledWhen> >+ </page> >+ </extension> >+ > </plugin> >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBProfileDetailsWizardPage.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBProfileDetailsWizardPage.java >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBProfileDetailsWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBProfileDetailsWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,659 @@ >+/******************************************************************************* >+ * Copyright (c) 2004-2006 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: brianf - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.datatools.connectivity.derby.internal.ui.connection; >+ >+import java.io.File; >+import java.util.ArrayList; >+import java.util.List; >+import java.util.StringTokenizer; >+ >+import javax.swing.event.ChangeEvent; >+import javax.swing.event.ChangeListener; >+ >+import org.eclipse.core.runtime.Path; >+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; >+import org.eclipse.datatools.connectivity.derby.internal.ui.DerbyUIPlugin; >+import org.eclipse.datatools.connectivity.drivers.DriverInstance; >+import org.eclipse.datatools.connectivity.internal.derby.connection.IDerbyConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList; >+import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo; >+import org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage; >+import org.eclipse.datatools.help.ContextProviderDelegate; >+import org.eclipse.datatools.help.HelpUtil; >+import org.eclipse.help.IContext; >+import org.eclipse.help.IContextProvider; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.DirectoryDialog; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+ * This class gathers the properties for the derby embedded DB connection profile. >+ * >+ * @author brianf >+ */ >+public class DerbyEmbeddedDBProfileDetailsWizardPage >+ extends ConnectionProfileDetailsPage >+ implements IContextProvider { >+ >+ // ui pieces >+ private Text mDatabaseNameText; >+ >+ private Text mURLText; >+ >+ private Text mDBUIDText; >+ >+ private Text mDBPWDText; >+ >+ private Button mSaveDBPWDCheckbox; >+ >+ private DelimitedStringList mDBConnProps; >+ >+ final DriverListCombo combo = new DriverListCombo(); >+ >+ private Button mCreateDBCheckbox; >+ >+ private Button mUpgradeDBCheckbox; >+ >+ private Text mDBFilePathText; >+ >+ private Button mBrowseFilePathButton; >+ >+ // stashed driver instance >+ private DriverInstance mDriverInstance; >+ >+ private String mDriverCategory; >+ >+ /** >+ * Constructor >+ * >+ * @param pageName >+ */ >+ public DerbyEmbeddedDBProfileDetailsWizardPage(String pageName) { >+ super(pageName); >+ setTitle(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.title")); //$NON-NLS-1$ >+ setDescription(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.msg")); //$NON-NLS-1$ >+ setDriverCategory(IDerbyConnectionProfileConstants.DERBY_CATEGORY_ID); >+ this.combo.setFilter("templateIDStartsWith = " + //$NON-NLS-1$ >+ IDerbyConnectionProfileConstants.DERBY_ENABLEMENT_DRIVER_PREFIX + "," + //$NON-NLS-1$ >+ "templateIDEndsWith = " + //$NON-NLS-1$ >+ IDerbyConnectionProfileConstants.DERBY_ENABLEMENT_DRIVER_SUFFIX); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createCustomControl(Composite parent) { >+ Composite content = new Composite(parent, SWT.NULL); >+ GridLayout layout = new GridLayout(2, false); >+ content.setLayout(layout); >+ >+ // set up the drivers combo >+ this.combo.setLabelText(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$ >+ this.combo.setCategory(getDriverCategory()); >+ this.combo.setNullDriverIsValid(false); >+ this.combo.createContents(content); >+ if (this.combo.getErrorMessage() != null) { >+ setErrorMessage(this.combo.getErrorMessage()); >+ } >+ >+ // set up the fields >+ this.mDatabaseNameText = (Text) createLabelTextPair( >+ content, >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$ >+ this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); >+ >+ Label label = new Label(content, SWT.NULL); >+ label.setLayoutData(new GridData()); >+ label.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.0")); //$NON-NLS-1$ >+ >+ Composite textAndBrowseComposite = new Composite(content, SWT.NULL); >+ GridLayout subCompositeLayout = new GridLayout(2, false); >+ subCompositeLayout.marginLeft = -5; >+ subCompositeLayout.marginRight = -5; >+ subCompositeLayout.marginTop = -5; >+ subCompositeLayout.marginBottom = -5; >+ textAndBrowseComposite.setLayout(subCompositeLayout); >+ textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER); >+ this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH); >+ this.mBrowseFilePathButton.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.1")); //$NON-NLS-1$ >+ this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); >+ >+ this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$ >+ this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL); >+ >+ this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$ >+ this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL); >+ >+ this.mURLText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$ >+ this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); >+ >+ this.mCreateDBCheckbox = new Button(content, SWT.CHECK); >+ this.mCreateDBCheckbox.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.2")); //$NON-NLS-1$ >+ this.mCreateDBCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ this.mUpgradeDBCheckbox = new Button(content, SWT.CHECK); >+ this.mUpgradeDBCheckbox.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.3")); //$NON-NLS-1$ >+ this.mUpgradeDBCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK); >+ this.mSaveDBPWDCheckbox.setText(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$ >+ this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ // spacer >+ Composite spacer = new Composite(content, SWT.NULL); >+ GridData gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ gdata.heightHint = 20; >+ spacer.setLayoutData(gdata); >+ >+ // followed by the optional properties >+ label = new Label(content, SWT.NULL); >+ gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ label.setLayoutData(gdata); >+ label.setText(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$ >+ >+ this.mDBConnProps = new DelimitedStringList(content, SWT.NONE); >+ gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ this.mDBConnProps.setLayoutData(gdata); >+ >+// // now set up the initial instance >+// if (this.mDriverInstance == null) >+// this.mDriverInstance = this.combo.getSelectedDriverInstance(); >+ >+ this.mDBConnProps.addChangeListener(new ChangeListener() { >+ >+ public void stateChanged(ChangeEvent arg0) { >+ setErrorMessage(null); >+ if (DerbyEmbeddedDBProfileDetailsWizardPage.this.mDBConnProps.getWarning() != null) { >+ setErrorMessage(DerbyEmbeddedDBProfileDetailsWizardPage.this.mDBConnProps >+ .getWarning()); >+ } >+ } >+ >+ }); >+ >+ // add a change listener to the combo box so >+ // we know when a new driver has been selected >+ this.combo.addChangeListener(new ChangeListener() { >+ >+ public void stateChanged(ChangeEvent arg0) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.mDriverInstance = DerbyEmbeddedDBProfileDetailsWizardPage.this.combo >+ .getSelectedDriverInstance(); >+ setErrorMessage(null); >+ if (DerbyEmbeddedDBProfileDetailsWizardPage.this.combo.getErrorMessage() != null) { >+ setErrorMessage(DerbyEmbeddedDBProfileDetailsWizardPage.this.combo >+ .getErrorMessage()); >+ } >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.mDatabaseNameText >+ .setText(getDriverDatabaseName()); >+ >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.mURLText >+ .setText(getDriverURL()); >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updatePropsFromURL(); >+ >+ String username = DerbyEmbeddedDBProfileDetailsWizardPage.this >+ .getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID); >+ if (username == null || username.trim().length() == 0) >+ username = new String(); >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.mDBUIDText.setText(username); >+ >+ String password = DerbyEmbeddedDBProfileDetailsWizardPage.this >+ .getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID); >+ if (password == null || password.trim().length() == 0) >+ password = new String(); >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.mDBPWDText.setText(password); >+ >+ setPageComplete(isValid()); >+ } >+ >+ }); >+ >+ this.mDBFilePathText.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mCreateDBCheckbox.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updateURLFromProps(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mUpgradeDBCheckbox.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updateURLFromProps(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.browseForDBFolder(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBProfileDetailsWizardPage.this.browseForDBFolder(); >+ } >+ }); >+ >+ this.combo.selectFirstItem(); >+ // now set up the initial instance >+ if (this.mDriverInstance == null) >+ this.mDriverInstance = this.combo.getSelectedDriverInstance(); >+ if (this.mDriverInstance != null) { >+ this.mURLText.setText(getDriverURL()); >+ } >+ this.mURLText.setEnabled(false); >+ >+ } >+ >+ /** >+ * Browse for the database folder >+ */ >+ private void browseForDBFolder() { >+ DirectoryDialog dialog = new DirectoryDialog(getShell()); >+ dialog.setText(Messages >+ .getString("DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$ >+ dialog.setMessage(Messages >+ .getString("DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$ >+ >+ String dirName = mDBFilePathText.getText(); >+ >+ File path = new File(dirName); >+ if (path.exists()) { >+ dialog.setFilterPath(new Path(dirName).toOSString()); >+ } >+ >+ String selectedDirectory = dialog.open(); >+ if (selectedDirectory != null) { >+ this.mDBFilePathText.setText(selectedDirectory); >+ } >+ } >+ >+ /** >+ * Update the UI components from the URL >+ */ >+ private void updatePropsFromURL() { >+ if (this.mDBFilePathText != null && this.mURLText != null && this.mCreateDBCheckbox != null && this.mUpgradeDBCheckbox != null) { >+ String url = this.mURLText.getText(); >+ String[] chunks = parseString(url, ";"); //$NON-NLS-1$ >+ if (chunks.length > 0) { >+ String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ >+ if (chunks2.length > 2) { >+ String filepath = chunks2[2]; >+ if (chunks2.length > 3) { >+ filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$ >+ } >+ this.mDBFilePathText.setText(filepath); >+ } >+ } >+ if (chunks.length > 1) { >+ for (int i = 1; i < chunks.length; i++) { >+ if (chunks[i].startsWith("create=")) //$NON-NLS-1$ >+ this.mCreateDBCheckbox.setSelection(true); >+ else if (chunks[i].startsWith("upgrade=")) //$NON-NLS-1$ >+ this.mUpgradeDBCheckbox.setSelection(true); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Update the URL from the UI components >+ */ >+ private void updateURLFromProps() { >+ if (this.mDBFilePathText != null && this.mURLText != null && this.mCreateDBCheckbox != null && this.mUpgradeDBCheckbox != null) { >+ String url = this.mURLText.getText(); >+ String filePath = this.mDBFilePathText.getText(); >+ boolean createDB = this.mCreateDBCheckbox.getSelection(); >+ boolean upgradeDB = this.mUpgradeDBCheckbox.getSelection(); >+ //jdbc:derby:C:\DerbyDatabases\MyDB;create=true >+ String[] chunks = parseString(url, ";"); //$NON-NLS-1$ >+ if (chunks.length > 0) { >+ String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ >+ if (chunks2.length > 2) { >+ url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$ >+ if (createDB) { >+ url = url + ";" + "create=true"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ if (upgradeDB) { >+ url = url + ";" + "upgrade=true"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ this.mURLText.setText(url); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Parse a string into a string array based on a token >+ * @param str_list >+ * @param token >+ * @return >+ */ >+ private String[] parseString(String str_list, String token) { >+ StringTokenizer tk = new StringTokenizer(str_list, token); >+ String[] pieces = new String[tk.countTokens()]; >+ int index = 0; >+ while (tk.hasMoreTokens()) >+ pieces[index++] = tk.nextToken(); >+ return pieces; >+ } >+ >+ /** >+ * @param propertyID >+ * @return >+ */ >+ private String getPropertyFromDriverInstance(String propertyID) { >+ String returnStr = new String(); >+ if (this.mDriverInstance != null >+ && this.mDriverInstance.getProperty(propertyID) != null) { >+ returnStr = this.mDriverInstance.getProperty(propertyID); >+ } >+ return returnStr; >+ } >+ >+ /** >+ * Get the sample URL from the driver instance. >+ * >+ * @return >+ */ >+ public String getDriverURL() { >+ if (this.mDriverInstance != null >+ && this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.URL_PROP_ID) != null) >+ return this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.URL_PROP_ID); >+ return new String(); >+ } >+ >+ /** >+ * Get the sample database name from the driver instance. >+ * >+ * @return >+ */ >+ public String getDriverDatabaseName() { >+ if (this.mDriverInstance != null >+ && this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID) != null) >+ return this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID); >+ return new String(); >+ } >+ >+ /** >+ * Get the vendor >+ * >+ * @return >+ */ >+ public String getVendor() { >+ String vendor = ""; //$NON-NLS-1$ >+ if (this.mDriverInstance != null) { >+ vendor = this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID); >+ } >+ return vendor; >+ } >+ >+ /** >+ * Get the version >+ * >+ * @return >+ */ >+ public String getVersion() { >+ String version = ""; //$NON-NLS-1$ >+ if (this.mDriverInstance != null) { >+ version = this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID); >+ } >+ return version; >+ } >+ >+ /** >+ * Get the driver class >+ * >+ * @return >+ */ >+ public String getDriverClass() { >+ String driverClass = ""; //$NON-NLS-1$ >+ if (this.mDriverInstance != null) { >+ driverClass = this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID); >+ } >+ return driverClass; >+ } >+ >+ /** >+ * Get the user name >+ * >+ * @return >+ */ >+ public String getDBUID() { >+ return this.mDBUIDText.getText(); >+ } >+ >+ /** >+ * Get the password >+ * >+ * @return >+ */ >+ public String getDBPWD() { >+ return this.mDBPWDText.getText(); >+ } >+ >+ /** >+ * Get the password >+ * >+ * @return >+ */ >+ public boolean getSaveDBPWD() { >+ return this.mSaveDBPWDCheckbox.getSelection(); >+ } >+ >+ /** >+ * Get the optional connection properties >+ * >+ * @return >+ */ >+ public String getDBConnProps() { >+ return this.mDBConnProps.getSelection(); >+ } >+ >+ /** >+ * Get the database name >+ * >+ * @return >+ */ >+ public String getDatabaseName() { >+ return this.mDatabaseNameText.getText(); >+ } >+ >+ /** >+ * Get the URL for the CP >+ * >+ * @return >+ */ >+ public String getURL() { >+ return this.mURLText.getText(); >+ } >+ >+ /** >+ * Get the driver ID >+ * >+ * @return >+ */ >+ public String getDriverID() { >+ return this.mDriverInstance.getId(); >+ } >+ >+ /* >+ * Create a label and a text box side by side. >+ */ >+ private Control createLabelTextPair(Composite parent, String labelText, >+ Control ctl, int style, int gData) { >+ Label label = new Label(parent, SWT.NULL); >+ label.setLayoutData(new GridData()); >+ label.setText(labelText); >+ >+ ctl = new Text(parent, style); >+ ctl.setLayoutData(new GridData(gData)); >+ >+ return ctl; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see com.sybase.suade.common.ui.wizards.ISummaryDataSource#getSummaryData() >+ */ >+ public List getSummaryData() { >+ List data = new ArrayList(); >+ >+ data >+ .add(new String[] { >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.summary.driverName.label"), //$NON-NLS-1$ >+ mDriverInstance.getName() }); >+ >+ data >+ .add(new String[] { >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.summary.connProps.label"), //$NON-NLS-1$ >+ getDBConnProps() }); >+ >+ data >+ .add(new String[] { >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.summary.userName.label"), //$NON-NLS-1$ >+ getDBUID() }); >+ >+ StringBuffer pwdMask = new StringBuffer(); >+ if (getDBPWD() != null && getDBPWD().length() > 0) { >+ for (int i = 0, count = getDBPWD().length(); i < count; ++i) { >+ pwdMask = pwdMask.append('*'); >+ } >+ } >+ >+ data >+ .add(new String[] { >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.summary.password.label"), //$NON-NLS-1$ >+ pwdMask.toString() }); >+ >+ data.add(new String[] { >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.summary.url.label"), //$NON-NLS-1$ >+ getURL() }); >+ >+ return data; >+ } >+ >+ private boolean isValid() { >+ if (getErrorMessage() != null) { >+ setPageComplete(false); >+ return false; >+ } >+ >+ return true; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String) >+ */ >+ public void setErrorMessage(String newMessage) { >+ super.setErrorMessage(newMessage); >+ isValid(); >+ } >+ >+ >+ /** >+ * @return >+ */ >+ public String getDriverCategory() { >+ return mDriverCategory; >+ } >+ >+ >+ /** >+ * Sets the driver category that should be used for displaying available >+ * driver defnitions. >+ * >+ * @param driverCategory >+ */ >+ public void setDriverCategory(String driverCategory) { >+ mDriverCategory = driverCategory; >+ if (combo != null) { >+ combo.setCategory(mDriverCategory); >+ } >+ } >+ >+ private ContextProviderDelegate contextProviderDelegate = >+ new ContextProviderDelegate(DerbyUIPlugin.getDefault().getBundle().getSymbolicName()); >+ >+ public IContext getContext(Object target) { >+ return contextProviderDelegate.getContext(target); >+ } >+ >+ public int getContextChangeMask() { >+ return contextProviderDelegate.getContextChangeMask(); >+ } >+ >+ public String getSearchExpression(Object target) { >+ return contextProviderDelegate.getSearchExpression(target); >+ } >+ >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ getShell().setData( HelpUtil.CONTEXT_PROVIDER_KEY, this); >+ HelpUtil.setHelp( getControl(), HelpUtil.getContextId(IHelpContextsDerbyProfile.DERBY_PROFILE_WIZARD_PAGE, DerbyUIPlugin.getDefault().getBundle().getSymbolicName())); >+ } >+} >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/NewDerbyEmbeddedConnectionProfileWizard.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/NewDerbyEmbeddedConnectionProfileWizard.java >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/NewDerbyEmbeddedConnectionProfileWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/NewDerbyEmbeddedConnectionProfileWizard.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 2004-2005 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: brianf - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.datatools.connectivity.derby.internal.ui.connection; >+ >+import java.util.Properties; >+ >+import org.eclipse.datatools.connectivity.ConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; >+import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard; >+import org.eclipse.datatools.connectivity.derby.internal.ui.DerbyUIPlugin; >+import org.eclipse.datatools.help.ContextProviderDelegate; >+import org.eclipse.datatools.help.HelpUtil; >+import org.eclipse.help.IContext; >+import org.eclipse.jface.wizard.Wizard; >+import org.eclipse.swt.widgets.Composite; >+ >+/** >+ * @see Wizard >+ */ >+public class NewDerbyEmbeddedConnectionProfileWizard extends >+ NewConnectionProfileWizard { >+ >+ protected DerbyEmbeddedDBProfileDetailsWizardPage mPropPage; >+ >+ public NewDerbyEmbeddedConnectionProfileWizard() { >+ setWindowTitle(Messages.getString("NewDerbyEmbeddedConnectionProfileWizard.DerbyEmbeddedDatabaseWizardTitle")); //$NON-NLS-1$ >+ } >+ >+ /** >+ * @see org.eclipse.datatools.connectivity.ui.wizards.NewDerbyEmbeddedConnectionProfileWizard#addCustomPages() >+ */ >+ public void addCustomPages() { >+ mPropPage = new DerbyEmbeddedDBProfileDetailsWizardPage("detailsPage"); //$NON-NLS-1$ >+ addPage(mPropPage); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard#getProfileProperties() >+ */ >+ public Properties getProfileProperties() { >+ Properties props = new Properties(); >+ props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, >+ this.mPropPage.getDriverID()); >+ props.setProperty( >+ IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID, >+ this.mPropPage.getDBConnProps()); >+ props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.mPropPage >+ .getDriverClass()); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.mPropPage >+ .getVendor()); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.mPropPage >+ .getVersion()); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mPropPage >+ .getDatabaseName()); >+ props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mPropPage >+ .getDBPWD()); >+ props.setProperty( >+ IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String >+ .valueOf(this.mPropPage.getSaveDBPWD())); >+ props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mPropPage >+ .getDBUID()); >+ props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, >+ this.mPropPage.getURL()); >+ return props; >+ } >+ >+ private ContextProviderDelegate contextProviderDelegate = >+ new ContextProviderDelegate(DerbyUIPlugin.getDefault().getBundle().getSymbolicName()); >+ >+ public IContext getContext(Object target) { >+ return contextProviderDelegate.getContext(target); >+ } >+ >+ public int getContextChangeMask() { >+ return contextProviderDelegate.getContextChangeMask(); >+ } >+ >+ public String getSearchExpression(Object target) { >+ return contextProviderDelegate.getSearchExpression(target); >+ } >+ >+ public void createPageControls(Composite pageContainer) { >+ super.createPageControls(pageContainer); >+ getShell().setData(HelpUtil.CONTEXT_PROVIDER_KEY, this); >+ HelpUtil.setHelp(getShell(), HelpUtil.getContextId( >+ IHelpContextsDerbyProfile.DERBY_PROFILE_WIZARD, >+ DerbyUIPlugin.getDefault().getBundle().getSymbolicName())); >+ } >+} >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBPropertyPage.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBPropertyPage.java >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBPropertyPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/DerbyEmbeddedDBPropertyPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,564 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: rcernich - initial API and implementation >+ * brianf - customized for Derby url requirements >+ ******************************************************************************/ >+package org.eclipse.datatools.connectivity.derby.internal.ui.connection; >+ >+import java.io.File; >+import java.util.Properties; >+import java.util.StringTokenizer; >+ >+import javax.swing.event.ChangeEvent; >+import javax.swing.event.ChangeListener; >+ >+import org.eclipse.core.runtime.Path; >+import org.eclipse.datatools.connectivity.ConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.IConnectionProfile; >+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; >+import org.eclipse.datatools.connectivity.derby.internal.ui.DerbyUIPlugin; >+import org.eclipse.datatools.connectivity.drivers.DriverInstance; >+import org.eclipse.datatools.connectivity.internal.derby.connection.IDerbyConnectionProfileConstants; >+import org.eclipse.datatools.connectivity.internal.ui.ConnectivityUIPlugin; >+import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList; >+import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo; >+import org.eclipse.datatools.connectivity.internal.ui.IHelpConstants; >+import org.eclipse.datatools.connectivity.ui.wizards.ProfileDetailsPropertyPage; >+import org.eclipse.datatools.help.ContextProviderDelegate; >+import org.eclipse.datatools.help.HelpUtil; >+import org.eclipse.help.IContext; >+import org.eclipse.help.IContextProvider; >+import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.DirectoryDialog; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+ * Property page for Derby Embedded profiles >+ * >+ */ >+public class DerbyEmbeddedDBPropertyPage >+ extends ProfileDetailsPropertyPage >+ implements IContextProvider { >+ >+ private static final String EMPTY_STRING = new String(); >+ >+ // UI components >+ private Text mDatabaseNameText; >+ private Text mDBUIDText; >+ private Text mDBPWDText; >+ private Text mURLText; >+ private Button mSaveDBPWDCheckbox; >+ private Button mCreateDBCheckbox; >+ private Button mUpgradeDBCheckbox; >+ private Text mDBFilePathText; >+ private Button mBrowseFilePathButton; >+ final DriverListCombo combo = new DriverListCombo(); >+ private DelimitedStringList mDBConnProps; >+ >+ // other components >+ private DriverInstance mDriverInstance; >+ private String mDriverCategory; >+ >+ /** >+ * Constructor >+ */ >+ public DerbyEmbeddedDBPropertyPage() { >+ super(); >+ noDefaultAndApplyButton(); >+ setDriverCategory(IDerbyConnectionProfileConstants.DERBY_CATEGORY_ID); >+ this.combo.setFilter("templateIDStartsWith = " + //$NON-NLS-1$ >+ IDerbyConnectionProfileConstants.DERBY_ENABLEMENT_DRIVER_PREFIX + "," + //$NON-NLS-1$ >+ "templateIDEndsWith = " + //$NON-NLS-1$ >+ IDerbyConnectionProfileConstants.DERBY_ENABLEMENT_DRIVER_SUFFIX); >+ } >+ >+ /** >+ * @see PreferencePage#createContents(Composite) >+ */ >+ protected void createCustomContents(Composite parent) { >+ Composite content = new Composite(parent, SWT.NULL); >+ GridLayout layout = new GridLayout(2, false); >+ content.setLayout(layout); >+ >+ this.combo.setLabelText(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$ >+ this.combo.setCategory(getDriverCategory()); >+ this.combo.setNullDriverIsValid(false); >+ this.combo.createContents(content); >+ >+ this.mDatabaseNameText = (Text) createLabelTextPair( >+ content, >+ Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$ >+ this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); >+ >+ Label label = new Label(content, SWT.NULL); >+ label.setLayoutData(new GridData()); >+ label.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.0")); //$NON-NLS-1$ >+ >+ Composite textAndBrowseComposite = new Composite(content, SWT.NULL); >+ GridLayout subCompositeLayout = new GridLayout(2, false); >+ subCompositeLayout.marginLeft = -5; >+ subCompositeLayout.marginRight = -5; >+ subCompositeLayout.marginTop = -5; >+ subCompositeLayout.marginBottom = -5; >+ textAndBrowseComposite.setLayout(subCompositeLayout); >+ textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER); >+ this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH); >+ this.mBrowseFilePathButton.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.1")); //$NON-NLS-1$ >+ this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); >+ >+ this.mURLText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$ >+ this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); >+ this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$ >+ this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL); //$NON-NLS-1$ >+ >+ this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$, >+ this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL); //$NON-NLS-1$ >+ >+ this.mCreateDBCheckbox = new Button(content, SWT.CHECK); >+ this.mCreateDBCheckbox.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.2")); //$NON-NLS-1$ >+ this.mCreateDBCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ this.mUpgradeDBCheckbox = new Button(content, SWT.CHECK); >+ this.mUpgradeDBCheckbox.setText(Messages.getString("DerbyEmbeddedDBProfileDetailsWizardPage.3")); //$NON-NLS-1$ >+ this.mUpgradeDBCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK); >+ this.mSaveDBPWDCheckbox.setText(Messages >+ .getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$ >+ this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING, >+ GridData.CENTER, true, false, 2, 1)); >+ >+ Composite spacer = new Composite(content, SWT.NULL); >+ GridData gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ gdata.heightHint = 20; >+ spacer.setLayoutData(gdata); >+ >+ label = new Label(content, SWT.NULL); >+ gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ label.setLayoutData(gdata); >+ label.setText(Messages.getString( >+ "DerbyEmbeddedDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$ >+ >+ this.mDBConnProps = new DelimitedStringList(content, SWT.NONE); >+ gdata = new GridData(GridData.FILL_HORIZONTAL); >+ gdata.horizontalSpan = 2; >+ this.mDBConnProps.setLayoutData(gdata); >+ >+ this.mDBConnProps.addChangeListener(new ChangeListener() { >+ >+ public void stateChanged(ChangeEvent arg0) { >+ setErrorMessage(null); >+ if (DerbyEmbeddedDBPropertyPage.this.mDBConnProps.getWarning() != null) { >+ setErrorMessage(DerbyEmbeddedDBPropertyPage.this.mDBConnProps >+ .getWarning()); >+ } >+ } >+ >+ }); >+ >+ this.combo.addChangeListener(new ChangeListener() { >+ >+ public void stateChanged(ChangeEvent arg0) { >+ DerbyEmbeddedDBPropertyPage.this.mDriverInstance = DerbyEmbeddedDBPropertyPage.this.combo >+ .getSelectedDriverInstance(); >+ setErrorMessage(null); >+ if (DerbyEmbeddedDBPropertyPage.this.combo.getErrorMessage() != null) { >+ setErrorMessage(DerbyEmbeddedDBPropertyPage.this.combo >+ .getErrorMessage()); >+ } >+ else >+ DerbyEmbeddedDBPropertyPage.this.mURLText >+ .setText(getDriverURL()); >+ String username = DerbyEmbeddedDBPropertyPage.this >+ .getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID); >+ if (username == null || username.trim().length() == 0) >+ username = new String(); >+ String oldUsername = DerbyEmbeddedDBPropertyPage.this.mDBUIDText >+ .getText(); >+ if (oldUsername == null || oldUsername.trim().length() == 0) >+ oldUsername = new String(); >+ if (oldUsername.length() == 0) >+ DerbyEmbeddedDBPropertyPage.this.mDBUIDText >+ .setText(username); >+ >+ String password = DerbyEmbeddedDBPropertyPage.this >+ .getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID); >+ if (password == null || password.trim().length() == 0) >+ password = new String(); >+ String oldPassword = DerbyEmbeddedDBPropertyPage.this.mDBPWDText >+ .getText(); >+ if (oldPassword == null || oldPassword.trim().length() == 0) >+ oldPassword = new String(); >+ if (oldPassword.length() == 0) >+ DerbyEmbeddedDBPropertyPage.this.mDBPWDText >+ .setText(password); >+ } >+ >+ }); >+ >+ initControls(); >+ >+ this.mDBFilePathText.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mCreateDBCheckbox.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.updateURLFromProps(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mUpgradeDBCheckbox.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.updateURLFromProps(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.updateURLFromProps(); >+ } >+ }); >+ >+ this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.browseForDBFolder(); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ DerbyEmbeddedDBPropertyPage.this.browseForDBFolder(); >+ } >+ }); >+ >+ // return content; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.preference.IPreferencePage#performOk() >+ */ >+ protected Properties collectProperties() { >+ Properties props = new Properties(); >+ >+ String driverID = EMPTY_STRING; >+ >+ if (this.combo.getSelectedDriverInstance() != null) { >+ DriverInstance instance = this.combo.getSelectedDriverInstance(); >+ driverID = instance.getId(); >+ } >+ >+ props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, >+ driverID); >+ props.setProperty( >+ IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID, >+ this.mDBConnProps.getSelection()); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID)); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID)); >+ props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID)); >+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mDatabaseNameText >+ .getText()); >+ props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mDBPWDText >+ .getText()); >+ props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mDBUIDText >+ .getText()); >+ props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, >+ this.mURLText.getText()); >+ props.setProperty( >+ IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String >+ .valueOf(this.mSaveDBPWDCheckbox.getSelection())); >+ >+ return props; >+ } >+ >+ /** >+ * >+ */ >+ private void initControls() { >+ IConnectionProfile profile = getConnectionProfile(); >+ String driverID = profile.getBaseProperties().getProperty( >+ ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID); >+ if (driverID != null) { >+ this.combo.setSelectionToID(driverID); >+ } >+ >+ String connectionProps = profile.getBaseProperties().getProperty( >+ IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID); >+ if (connectionProps != null) { >+ this.mDBConnProps.setSelection(connectionProps); >+ } >+ >+ String databaseName = profile.getBaseProperties().getProperty( >+ IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID); >+ if (databaseName != null) { >+ this.mDatabaseNameText.setText(databaseName); >+ } >+ >+ String databasePwd = profile.getBaseProperties().getProperty( >+ IDBDriverDefinitionConstants.PASSWORD_PROP_ID); >+ if (databasePwd != null) { >+ this.mDBPWDText.setText(databasePwd); >+ } >+ >+ String databaseUid = profile.getBaseProperties().getProperty( >+ IDBDriverDefinitionConstants.USERNAME_PROP_ID); >+ if (databaseUid != null) { >+ this.mDBUIDText.setText(databaseUid); >+ } >+ >+ String urlText = profile.getBaseProperties().getProperty( >+ IDBDriverDefinitionConstants.URL_PROP_ID); >+ if (urlText != null) { >+ this.mURLText.setText(urlText); >+ this.mURLText.setEnabled(false); >+ } >+ >+ this.mSaveDBPWDCheckbox.setSelection(Boolean.valueOf( >+ profile.getBaseProperties().getProperty( >+ IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, >+ Boolean.FALSE.toString())).booleanValue()); >+ >+ this.updatePropsFromURL(); >+ >+ setErrorMessage(null); >+ if (this.combo.getErrorMessage() != null) { >+ setErrorMessage(this.combo.getErrorMessage()); >+ } >+ } >+ >+ /** >+ * Browse for a DB folder >+ */ >+ private void browseForDBFolder() { >+ DirectoryDialog dialog = new DirectoryDialog(getShell()); >+ dialog.setText(Messages >+ .getString("DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$ >+ dialog.setMessage(Messages >+ .getString("DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$ >+ >+ String dirName = mDBFilePathText.getText(); >+ >+ File path = new File(dirName); >+ if (path.exists()) { >+ dialog.setFilterPath(new Path(dirName).toOSString()); >+ } >+ >+ String selectedDirectory = dialog.open(); >+ if (selectedDirectory != null) { >+ this.mDBFilePathText.setText(selectedDirectory); >+ } >+ } >+ >+ /** >+ * Based on the URL, update the UI components accordingly >+ */ >+ private void updatePropsFromURL() { >+ if (this.mDBFilePathText != null && this.mURLText != null && this.mCreateDBCheckbox != null && this.mUpgradeDBCheckbox != null) { >+ String url = this.mURLText.getText(); >+ String[] chunks = parseString(url, ";"); //$NON-NLS-1$ >+ if (chunks.length > 0) { >+ String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ >+ if (chunks2.length > 2) { >+ String filepath = chunks2[2]; >+ if (chunks2.length > 3) { >+ filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$ >+ } >+ this.mDBFilePathText.setText(filepath); >+ } >+ } >+ if (chunks.length > 1) { >+ for (int i = 1; i < chunks.length; i++) { >+ if (chunks[i].startsWith("create=")) //$NON-NLS-1$ >+ this.mCreateDBCheckbox.setSelection(true); >+ else if (chunks[i].startsWith("upgrade=")) //$NON-NLS-1$ >+ this.mUpgradeDBCheckbox.setSelection(true); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Based on the state of the UI components, reset the URL >+ */ >+ private void updateURLFromProps() { >+ if (this.mDBFilePathText != null && this.mURLText != null && this.mCreateDBCheckbox != null && this.mUpgradeDBCheckbox != null) { >+ String url = this.mURLText.getText(); >+ String filePath = this.mDBFilePathText.getText(); >+ boolean createDB = this.mCreateDBCheckbox.getSelection(); >+ boolean upgradeDB = this.mUpgradeDBCheckbox.getSelection(); >+ //jdbc:derby:C:\DerbyDatabases\MyDB;create=true >+ String[] chunks = parseString(url, ";"); //$NON-NLS-1$ >+ if (chunks.length > 0) { >+ String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ >+ if (chunks2.length > 2) { >+ url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$ >+ if (createDB) { >+ url = url + ";" + "create=true"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ if (upgradeDB) { >+ url = url + ";" + "upgrade=true"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ this.mURLText.setText(url); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Parse a string into an array based on a token >+ * @param str_list >+ * @param token >+ * @return >+ */ >+ private String[] parseString(String str_list, String token) { >+ StringTokenizer tk = new StringTokenizer(str_list, token); >+ String[] pieces = new String[tk.countTokens()]; >+ int index = 0; >+ while (tk.hasMoreTokens()) >+ pieces[index++] = tk.nextToken(); >+ return pieces; >+ } >+ >+ /** >+ * @param propertyID >+ * @return >+ */ >+ private String getPropertyFromDriverInstance(String propertyID) { >+ String returnStr = new String(); >+ if (this.mDriverInstance != null >+ && this.mDriverInstance.getProperty(propertyID) != null) { >+ returnStr = this.mDriverInstance.getProperty(propertyID); >+ } >+ return returnStr; >+ } >+ >+ /** >+ * @param parent >+ * @param labelText >+ * @param ctl >+ * @param style >+ * @param gData >+ * @return >+ */ >+ private Control createLabelTextPair(Composite parent, String labelText, >+ Control ctl, int style, int gData) { >+ Label label = new Label(parent, SWT.NULL); >+ label.setLayoutData(new GridData()); >+ label.setText(labelText); >+ >+ ctl = new Text(parent, style); >+ ctl.setLayoutData(new GridData(gData)); >+ >+ return ctl; >+ } >+ >+ /** >+ * @return >+ */ >+ public String getDriverURL() { >+ return this.mDriverInstance >+ .getProperty(IDBDriverDefinitionConstants.URL_PROP_ID); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.preference.IPreferencePage#isValid() >+ */ >+ public boolean isValid() { >+ if (getErrorMessage() != null) { >+ return false; >+ } >+ return super.isValid(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String) >+ */ >+ public void setErrorMessage(String newMessage) { >+ super.setErrorMessage(newMessage); >+ isValid(); >+ } >+ >+ /** >+ * @return >+ */ >+ public String getDriverCategory() { >+ return mDriverCategory; >+ } >+ >+ >+ /** >+ * Sets the driver category that should be used for displaying available >+ * driver defnitions. >+ * >+ * @param driverCategory >+ */ >+ public void setDriverCategory(String driverCategory) { >+ mDriverCategory = driverCategory; >+ if (combo != null) { >+ combo.setCategory(mDriverCategory); >+ } >+ } >+ >+ private ContextProviderDelegate contextProviderDelegate = >+ new ContextProviderDelegate(DerbyUIPlugin.getDefault().getBundle().getSymbolicName()); >+ >+ public IContext getContext(Object target) { >+ return contextProviderDelegate.getContext(target); >+ } >+ >+ public int getContextChangeMask() { >+ return contextProviderDelegate.getContextChangeMask(); >+ } >+ >+ public String getSearchExpression(Object target) { >+ return contextProviderDelegate.getSearchExpression(target); >+ } >+ >+ protected Control createContents(Composite parent) { >+ Control contents = super.createContents(parent); >+ getShell().setData( HelpUtil.CONTEXT_PROVIDER_KEY, this); >+ HelpUtil.setHelp( getControl(), HelpUtil.getContextId(IHelpConstants.CONTEXT_ID_CP_PROPERTY_PAGE, ConnectivityUIPlugin.getDefault().getBundle().getSymbolicName())); >+ return contents; >+ } >+} >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/messages.properties >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/messages.properties >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/messages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/messages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+NewDerbyEmbeddedConnectionProfileWizard.DerbyEmbeddedDatabaseWizardTitle=Derby Embedded Database >+ >+DerbyEmbeddedDBProfileDetailsWizardPage.title = Specify a Driver and Connection Details >+DerbyEmbeddedDBProfileDetailsWizardPage.msg = Select a driver from the drop-down and provide login details for the connection. >+DerbyEmbeddedDBProfileDetailsWizardPage.0=Database location: >+DerbyEmbeddedDBProfileDetailsWizardPage.1=Browse... >+DerbyEmbeddedDBProfileDetailsWizardPage.2=Create database (if required) >+DerbyEmbeddedDBProfileDetailsWizardPage.3=Upgrade database to current version >+DerbyEmbeddedDBProfileDetailsWizardPage.driverCombo.label = Select a driver from the drop-down: >+DerbyEmbeddedDBProfileDetailsWizardPage.databaseName.label = Database: >+DerbyEmbeddedDBProfileDetailsWizardPage.url.label = URL: >+DerbyEmbeddedDBProfileDetailsWizardPage.PingButton=Test connection >+DerbyEmbeddedDBProfileDetailsWizardPage.userName.label = User name: >+DerbyEmbeddedDBProfileDetailsWizardPage.password.label = Password: >+DerbyEmbeddedDBProfileDetailsWizardPage.persistpassword.label = Save Password >+DerbyEmbeddedDBProfileDetailsWizardPage.optionalProps.label = Optional properties: >+DerbyEmbeddedDBProfileDetailsWizardPage.summary.driverName.label = Driver name >+DerbyEmbeddedDBProfileDetailsWizardPage.summary.connProps.label = Connection properties >+DerbyEmbeddedDBProfileDetailsWizardPage.summary.userName.label = User name >+DerbyEmbeddedDBProfileDetailsWizardPage.summary.password.label = Password >+DerbyEmbeddedDBProfileDetailsWizardPage.summary.url.label = URL >+DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.title.filebrowse = Browse for Database Folder >+DerbyEmbeddedDBProfileDetailsWizardPage.FileDialog.msg.filebrowse = Select the folder that corresponds to your Derby database. >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/Messages.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/Messages.java >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/Messages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/Messages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.datatools.connectivity.derby.internal.ui.connection; >+ >+import java.util.MissingResourceException; >+import java.util.ResourceBundle; >+ >+public class Messages { >+ private static final String BUNDLE_NAME = "org.eclipse.datatools.connectivity.derby.internal.ui.connection.messages"; //$NON-NLS-1$ >+ >+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle >+ .getBundle(BUNDLE_NAME); >+ >+ private Messages() { >+ } >+ >+ public static String getString(String key) { >+ // TODO Auto-generated method stub >+ try { >+ return RESOURCE_BUNDLE.getString(key); >+ } catch (MissingResourceException e) { >+ return '!' + key + '!'; >+ } >+ } >+} >Index: plugin.properties >=================================================================== >RCS file: plugin.properties >diff -N plugin.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+############################################################################### >+# Copyright (c) 2006, 2007 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+# >+# Contributors: >+# IBM Corporation - initial API and implementation >+############################################################################### >+pluginName=Eclipse Data Tools Platform Apache Derby UI Plug-in >+providerName=Eclipse.org >+ >+DERBY_EMBEDDED_CONNECTION_PROFILE_WIZARD_NAME=Derby Embedded Database >+DERBY_EMBEDDED_DB_PROPERTY_PAGE_NAME=JDBC Connection Properties >+ >Index: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/IHelpContextsDerbyProfile.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/IHelpContextsDerbyProfile.java >diff -N src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/IHelpContextsDerbyProfile.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/derby/internal/ui/connection/IHelpContextsDerbyProfile.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: brianf - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.datatools.connectivity.derby.internal.ui.connection; >+ >+public interface IHelpContextsDerbyProfile { >+ >+ /** >+ * TPS_helpKey_constants_for_plug-in: org.eclipse.datatools.connectivity.db.derby >+ */ >+ >+ /* >+ * DERBY_PROFILE_WIZARD_PAGE = the wizard page that collects Derby Embedded profile >+ * details such as the path to the database, user id, password, etc. >+ */ >+ public static final String DERBY_PROFILE_WIZARD_PAGE = "DERBY_PROFILE_WIZARD_PAGE"; >+ >+ /* >+ * DERBY_PROFILE_PROPERTY_PAGE = the property page that collects and allows editing of >+ * Derby Embedded profile details such as the path to the database, user id, password, etc. >+ */ >+ public static final String DERBY_PROFILE_PROPERTY_PAGE = "DERBY_PROFILE_PROPERTY_PAGE"; >+ >+ /* >+ * DERBY_PROFILE_WIZARD = the actual New Derby Embedded Profile wizard >+ */ >+ public static final String DERBY_PROFILE_WIZARD = "DERBY_PROFILE_WIZARD"; >+} >Index: icons/new_db_element.gif >=================================================================== >RCS file: icons/new_db_element.gif >diff -N icons/new_db_element.gif >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ icons/new_db_element.gif 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+GIF89a÷ZcZcZc{{{µ9µ9½½½½ÞÞÆ½ÆÖÖÖÞÞ½çÎÿÿÿÞÞÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!ù,t° Áh?@$8A!C&8¢2näh & >+8 #ÇJP¹rÀrPÒ?`D¢Ü >+ ÀP àgÍ-u²´i5èТG¥.]ÙôiTS«å5çÖ±"5À´$ >+Uª¼èeIpàÃ; >#P org.eclipse.datatools.connectivity.derby >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby/META-INF/MANIFEST.MF,v >retrieving revision 1.26 >diff -u -r1.26 MANIFEST.MF >--- META-INF/MANIFEST.MF 7 Jun 2007 16:09:29 -0000 1.26 >+++ META-INF/MANIFEST.MF 11 Oct 2007 20:15:48 -0000 >@@ -18,7 +18,9 @@ > org.eclipse.datatools.modelbase.sql;bundle-version="[0.9.0,1.5.0)", > org.eclipse.datatools.connectivity.sqm.core;bundle-version="[0.9.1,1.5.0)", > com.ibm.icu;bundle-version="[3.4.0,4.0.0)", >- org.eclipse.datatools.modelbase.derby;bundle-version="[0.9.0,1.5.0)" >+ org.eclipse.datatools.modelbase.derby;bundle-version="[0.9.0,1.5.0)", >+ org.eclipse.datatools.connectivity.db.generic;bundle-version="[0.9.1,1.5.0)", >+ org.eclipse.datatools.connectivity;bundle-version="[0.9.1,1.5.0)" > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 > >Index: build.properties >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby/build.properties,v >retrieving revision 1.27 >diff -u -r1.27 build.properties >--- build.properties 7 Jun 2007 16:09:29 -0000 1.27 >+++ build.properties 11 Oct 2007 20:15:48 -0000 >@@ -2,7 +2,8 @@ > plugin.xml,\ > plugin.properties,\ > about.html,\ >- META-INF/ >+ META-INF/,\ >+ icons/ > jars.compile.order = . > source.. = src/ > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby/plugin.xml,v >retrieving revision 1.11 >diff -u -r1.11 plugin.xml >--- plugin.xml 27 Apr 2007 14:45:56 -0000 1.11 >+++ plugin.xml 11 Oct 2007 20:15:48 -0000 >@@ -65,4 +65,450 @@ > </generator> > </extension> > >+<extension >+ point="org.eclipse.datatools.connectivity.connectionProfile"> >+ <connectionProfile >+ category="org.eclipse.datatools.connectivity.db.category" >+ icon="icons/jdbc_16.gif" >+ pingFactory="org.eclipse.datatools.connectivity.internal.derby.connection.DerbyJDBCConnectionFactory" >+ id="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile" >+ name="%DERBY_CONNECTION_PROFILE_NAME"/> >+ <connectionFactory >+ class="org.eclipse.datatools.connectivity.internal.derby.connection.DerbyJDBCConnectionFactory" >+ id="java.sql.Connection" >+ name="%DERBY_JDBC_CONNECTION_FACTORY_NAME" >+ profile="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"/> >+ </extension> >+ >+ <extension >+ point="org.eclipse.datatools.connectivity.driverExtension"> >+ <category >+ parentCategory="org.eclipse.datatools.connectivity.db.driverCategory" >+ id="org.eclipse.datatools.connectivity.db.derby.driverCategory" >+ name="%DERBY_CATEGORY_NAME"/> >+ <category >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.driverCategory" >+ id="org.eclipse.datatools.connectivity.db.derby.10_0.driverCategory" >+ name="%10_0_VERSION_CATEGORY_NAME"/> >+ <category >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.driverCategory" >+ id="org.eclipse.datatools.connectivity.db.derby.10_1.driverCategory" >+ name="%10_1_VERSION_CATEGORY_NAME"/> >+ <category >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.driverCategory" >+ id="org.eclipse.datatools.connectivity.db.derby.10_2.driverCategory" >+ name="%10_2_VERSION_CATEGORY_NAME"/> >+ >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby.genericDriverTemplate" >+ jarList="derby.jar" >+ name="%DERBY_EMBEDDED_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_0.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="org.apache.derby.jdbc.EmbeddedDriver" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.0" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value="jdbc:derby:C:\DerbyDatabases\MyDB;create=true" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="" >+ required="false" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="false" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby101.genericDriverTemplate" >+ jarList="derby.jar" >+ name="%DERBY101_EMBEDDED_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_1.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="org.apache.derby.jdbc.EmbeddedDriver" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.1" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value="jdbc:derby:C:\DerbyDatabases\MyDB;create=true" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="" >+ required="false" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="false" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby102.genericDriverTemplate" >+ jarList="derby.jar" >+ name="%DERBY102_EMBEDDED_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_2.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="org.apache.derby.jdbc.EmbeddedDriver" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.2" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value="jdbc:derby:C:\DerbyDatabases\MyDB;create=true" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="" >+ required="false" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="false" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby.db2UniversalDriver" >+ jarList="db2jcc.jar;db2jcc_license_c.jar" >+ name="%DERBY_NETWORK_EMBEDDED_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_0.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="com.ibm.db2.jcc.DB2Driver" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.0" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value='jdbc:derby:net://localhost:1527/"C:/DerbyDatabases/MyDB";create=true:retrieveMessagesFromServerOnGetMessage=true;' >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="user" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="true" >+ value="pwd" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby101.db2UniversalDriver" >+ jarList="db2jcc.jar;db2jcc_license_c.jar" >+ name="%DERBY101_NETWORK_EMBEDDED_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_1.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="com.ibm.db2.jcc.DB2Driver" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.1" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value='jdbc:derby:net://localhost:1527/"C:/DerbyDatabases/MyDB";create=true:retrieveMessagesFromServerOnGetMessage=true;' >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="user" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="true" >+ value="pwd" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby101.clientDriver" >+ jarList="derbyclient.jar" >+ name="%DERBY101_CLIENT_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_1.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="org.apache.derby.jdbc.ClientDriver" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.1" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value="jdbc:derby://localhost:1527/sample;create=true" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="user" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="true" >+ value="pwd" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ <driverTemplate >+ createDefault="false" >+ emptyJarListIsOK="false" >+ id="org.eclipse.datatools.connectivity.db.derby102.clientDriver" >+ jarList="derbyclient.jar" >+ name="%DERBY102_CLIENT_DRIVER_TEMPLATE_NAME" >+ parentCategory="org.eclipse.datatools.connectivity.db.derby.10_2.driverCategory"> >+ <properties> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.driverClass" >+ name="%DRIVER_CLASS_PROPERTY_NAME" >+ value="org.apache.derby.jdbc.ClientDriver" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.vendor" >+ name="%VENDOR_PROPERTY_NAME" >+ value="Derby" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.version" >+ name="%VERSION_PROPERTY_NAME" >+ value="10.2" >+ required="true" >+ visible="false"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.databaseName" >+ name="%DATABASE_NAME_PROPERTY_NAME" >+ value="SAMPLE" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.URL" >+ name="%CONNECTION_URL_PROPERTY_NAME" >+ value="jdbc:derby://localhost:1527/sample;create=true" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.username" >+ name="%USER_ID_PROPERTY_NAME" >+ value="user" >+ required="true" >+ visible="true"/> >+ <property >+ generated="false" >+ id="org.eclipse.datatools.connectivity.db.password" >+ name="%PASSWORD_PROPERTY_NAME" >+ required="true" >+ value="pwd" >+ visible="true"/> >+ </properties> >+ </driverTemplate> >+ </extension> >+ > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/datatools/org.eclipse.datatools.connectivity/plugins/org.eclipse.datatools.connectivity.derby/plugin.properties,v >retrieving revision 1.2 >diff -u -r1.2 plugin.properties >--- plugin.properties 10 May 2006 13:56:58 -0000 1.2 >+++ plugin.properties 11 Oct 2007 20:15:48 -0000 >@@ -10,4 +10,29 @@ > ############################################################################### > > pluginName = Eclipse Data Tools Platform Derby Plug-in >-providerName = Eclipse.org >\ No newline at end of file >+providerName = Eclipse.org >+ >+DERBY_CONNECTION_PROFILE_NAME=Derby Embedded Database >+DERBY_JDBC_CONNECTION_FACTORY_NAME=JDBC Connection >+DERBY_PING_CONNECTION_FACTORY_NAME=Ping Connection Factory >+DERBY_SQL_MODEL_CONNECTION_FACTORY_NAME=SQL Model Connection >+DRIVER_CLASS_PROPERTY_NAME=Driver Class >+VENDOR_PROPERTY_NAME=Vendor >+VERSION_PROPERTY_NAME=Version >+DATABASE_NAME_PROPERTY_NAME=Database Name >+CONNECTION_URL_PROPERTY_NAME=Connection URL >+USER_ID_PROPERTY_NAME=User ID >+PASSWORD_PROPERTY_NAME=Password >+ >+DERBY_CATEGORY_NAME=Derby >+10_0_VERSION_CATEGORY_NAME = 10.0 >+10_1_VERSION_CATEGORY_NAME = 10.1 >+10_2_VERSION_CATEGORY_NAME = 10.2 >+ >+DERBY_EMBEDDED_DRIVER_TEMPLATE_NAME=Derby Embedded JDBC Driver >+DERBY101_EMBEDDED_DRIVER_TEMPLATE_NAME=Derby Embedded JDBC Driver >+DERBY_NETWORK_EMBEDDED_DRIVER_TEMPLATE_NAME=DB2 Universal Driver >+DERBY101_NETWORK_EMBEDDED_DRIVER_TEMPLATE_NAME=DB2 Universal Driver >+DERBY101_CLIENT_DRIVER_TEMPLATE_NAME = Derby Client JDBC Driver >+DERBY102_EMBEDDED_DRIVER_TEMPLATE_NAME=Derby Embedded JDBC Driver >+DERBY102_CLIENT_DRIVER_TEMPLATE_NAME = Derby Client JDBC Driver >\ No newline at end of file >Index: src/org/eclipse/datatools/connectivity/internal/derby/connection/IDerbyConnectionProfileConstants.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/internal/derby/connection/IDerbyConnectionProfileConstants.java >diff -N src/org/eclipse/datatools/connectivity/internal/derby/connection/IDerbyConnectionProfileConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/internal/derby/connection/IDerbyConnectionProfileConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * rcernich - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.datatools.connectivity.internal.derby.connection; >+ >+ >+public interface IDerbyConnectionProfileConstants { >+ >+ public static final String DERBY_CATEGORY_ID = "org.eclipse.datatools.connectivity.db.derby.driverCategory"; //$NON-NLS-1$ >+ public static final String DERBY_ENABLEMENT_DRIVER_PREFIX = "org.eclipse.datatools.connectivity.db.derby"; //$NON-NLS-1$ >+ public static final String DERBY_ENABLEMENT_DRIVER_SUFFIX = "genericDriverTemplate"; //$NON-NLS-1$ >+ >+} >Index: icons/jdbc_16.gif >=================================================================== >RCS file: icons/jdbc_16.gif >diff -N icons/jdbc_16.gif >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ icons/jdbc_16.gif 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+GIF89a³¿ÜÛÀ¿À®¿¿¿ßß¿ÿßßîîî`_`_`_öööÑÑÑÿÿÿ!ù,sÐIÖ½?Il HD0È!Fè²$0ê >+ >+?P(x?ä±($Áá gÅÓpÅ¢ÉD*×aA?FÁi@vÛýdzròÌD¡RTp2<_u`'G?; >Index: src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyEmbeddedJDBCConnection.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyEmbeddedJDBCConnection.java >diff -N src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyEmbeddedJDBCConnection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyEmbeddedJDBCConnection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,165 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: rcernich - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.datatools.connectivity.internal.derby.connection; >+ >+import java.sql.Connection; >+import java.sql.Driver; >+import java.sql.SQLException; >+import java.util.HashMap; >+import java.util.Map; >+import java.util.Properties; >+ >+import org.eclipse.datatools.connectivity.IConnectionProfile; >+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; >+import org.eclipse.datatools.connectivity.db.generic.JDBCConnection; >+ >+/** >+ * This class is used to represent Derby embedded connections. There are a >+ * couple of particulars to Derby embedded connections which require special >+ * treatement. >+ * >+ * One, Derby only supports a single connection per JVM when operating as an >+ * embedded DB. This class ensures that only one instance of an embedded DB >+ * connection exists at any given time. >+ * >+ * Two, java.sql.Connection.close() is not supported by the Derby embedded JDBC >+ * driver. Embedded connections must be closed using the following: >+ * java.sql.Driver.getConnection("<url>;shutdown=true"). >+ * >+ * @author rcernich >+ * >+ * Created on Jan 30, 2006 >+ */ >+public class DerbyEmbeddedJDBCConnection extends JDBCConnection { >+ >+ /** >+ * Maps connection URLs to connections. >+ */ >+ private static Map sDerbyConnections = new HashMap(); >+ /** >+ * Maps connections to integers. The integer represents the number of >+ * DerbyEmbeddedJDBCConnection objects referencing the connection >+ */ >+ private static Map sConnectionReferenceCount = new HashMap(); >+ >+ public DerbyEmbeddedJDBCConnection(IConnectionProfile profile, >+ Class factoryClass) { >+ super(profile, factoryClass); >+ } >+ >+ public void close() { >+ Connection connection = (Connection) getRawConnection(); >+ if (connection == null) { >+ return; >+ } >+ synchronized (sDerbyConnections) { >+ int count = ((Integer) sConnectionReferenceCount.get(connection)) >+ .intValue(); >+ if (count == 1) { >+ /* >+ * If this is the last reference to the connection, close the >+ * connection. >+ */ >+ String baseDBURL = getBaseDBURL(); >+ try { >+ /* The particulars of closing the connection. */ >+ String driverClass = getDriverDefinition().getProperty( >+ IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID); >+ Driver driver = (Driver) connection.getClass() >+ .getClassLoader().loadClass(driverClass) >+ .newInstance(); >+ driver.connect(baseDBURL + ";shutdown=true", //$NON-NLS-1$ >+ new Properties()); >+ } >+ catch (InstantiationException e) { >+ /* >+ * We shouldn't see this, because we needed this to create >+ * the connection >+ */ >+ } >+ catch (IllegalAccessException e) { >+ /* >+ * We shouldn't see this, because we needed this to create >+ * the connection >+ */ >+ } >+ catch (ClassNotFoundException e) { >+ /* >+ * We shouldn't see this, because we needed this to create >+ * the connection >+ */ >+ } >+ catch (SQLException e) { >+ // Successfully closed the connection >+ sConnectionReferenceCount.remove(connection); >+ sDerbyConnections.remove(baseDBURL); >+ } >+ catch (Exception e) { >+ /* >+ * Can't get the driver. This might happen if the user >+ * modified or deleted the driver definition in the time >+ * since this connection was created. >+ */ >+ } >+ } >+ else { >+ /* Otherwise, just decrement the reference count. */ >+ sConnectionReferenceCount.put(connection, new Integer(--count)); >+ } >+ } >+ } >+ >+ protected Object createConnection(ClassLoader cl) throws Throwable { >+ Connection connection; >+ synchronized (sDerbyConnections) { >+ String dbName = getBaseDBURL(); >+ if (sDerbyConnections.containsKey(dbName)) { >+ /* >+ * Get the existing connection and increment the reference >+ * count. >+ */ >+ connection = (Connection) sDerbyConnections.get(dbName); >+ int count = ((Integer) sConnectionReferenceCount >+ .get(connection)).intValue(); >+ sConnectionReferenceCount.put(connection, new Integer(++count)); >+ } >+ else { >+ /* Create the connection and initialize the referencing scheme. */ >+ connection = (Connection) super.createConnection(cl); >+ sDerbyConnections.put(dbName, connection); >+ sConnectionReferenceCount.put(connection, new Integer(1)); >+ } >+ } >+ return connection; >+ } >+ >+ /** >+ * We're only concerned with the base part of the URL. This should work for >+ * every Derby URL form except those using the databaseName parameter to >+ * specify the database name. >+ * >+ * @return the base URL >+ */ >+ private String getBaseDBURL() { >+ String baseURL; >+ String connectURL = getConnectionProfile().getBaseProperties() >+ .getProperty(IDBDriverDefinitionConstants.URL_PROP_ID); >+ int propertyStart = connectURL.indexOf(';'); >+ if (propertyStart < 0) { >+ baseURL = connectURL; >+ } >+ else { >+ baseURL = connectURL.substring(0, propertyStart); >+ } >+ return baseURL; >+ } >+ >+} >Index: src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyJDBCConnectionFactory.java >=================================================================== >RCS file: src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyJDBCConnectionFactory.java >diff -N src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyJDBCConnectionFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/datatools/connectivity/internal/derby/connection/DerbyJDBCConnectionFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Sybase, Inc. >+ * >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * rcernich - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.datatools.connectivity.internal.derby.connection; >+ >+import org.eclipse.datatools.connectivity.IConnection; >+import org.eclipse.datatools.connectivity.IConnectionFactory; >+import org.eclipse.datatools.connectivity.IConnectionProfile; >+ >+ >+public class DerbyJDBCConnectionFactory implements IConnectionFactory { >+ >+ public DerbyJDBCConnectionFactory() { >+ super(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.datatools.connectivity.IConnectionFactory#createConnection(org.eclipse.datatools.connectivity.IConnectionProfile) >+ */ >+ public IConnection createConnection(IConnectionProfile profile) { >+ DerbyEmbeddedJDBCConnection connection = new DerbyEmbeddedJDBCConnection(profile, getClass()); >+ connection.open(); >+ return connection; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.datatools.connectivity.IConnectionFactory#createConnection(org.eclipse.datatools.connectivity.IConnectionProfile, >+ * java.lang.String, java.lang.String) >+ */ >+ public IConnection createConnection(IConnectionProfile profile, String uid, >+ String pwd) { >+ return createConnection(profile); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203158
:
78235
|
79770
|
79771
|
79782
|
79783
|
79784
|
79840
| 80178 |
80254
|
80269
|
80612
|
80613
|
87290