org.eclipse.datatools.sqltools.routineeditor.launching
Class LaunchHelper

java.lang.Object
  extended by org.eclipse.datatools.sqltools.routineeditor.launching.LaunchHelper
All Implemented Interfaces:
RoutineLaunchConfigurationAttribute

public class LaunchHelper
extends java.lang.Object
implements RoutineLaunchConfigurationAttribute

Helper methods for dealing with DTP routine launch configuration. We expect to let this class to manipulate all the attributes.

Author:
Yang Liu

Field Summary
 
Fields inherited from interface org.eclipse.datatools.sqltools.routineeditor.launching.RoutineLaunchConfigurationAttribute
ROUTINE_LAUNCH_CONFIGURATION_NAME, ROUTINE_LAUNCH_CONFIGURATION_NUM, ROUTINE_LAUNCH_CONFIGURATION_TYPE, ROUTINE_LAUNCH_DATABASENAME, ROUTINE_LAUNCH_EVENTPARAMS, ROUTINE_LAUNCH_EXTERNALID, ROUTINE_LAUNCH_OPTION_TYPE, ROUTINE_LAUNCH_PARAMETERS, ROUTINE_LAUNCH_PROCID, ROUTINE_LAUNCH_PROFILENAME, ROUTINE_LAUNCH_SQL, ROUTINE_LAUNCH_TYPE
 
Constructor Summary
LaunchHelper()
           
 
Method Summary
static java.lang.String constructCallableStatementDisplayString(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Constructs a sql statement to show the detailed information of a CallableStatement, which includes parameters if any.
static java.lang.String constructCallableStatementSQLString(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Constructs a SQL string which can be used in a CallableStatement.
static java.lang.String constructDirectInvocationSQLString(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Constructs a sql string to directly invoke the launch configuration.
static org.eclipse.debug.core.ILaunchConfigurationWorkingCopy createExternalClientConfiguration(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier, java.lang.String connid)
          Creates a launch configuration that can be used to launch a ILaunch that debug an external client connection.
static org.eclipse.datatools.sqltools.core.dbitem.ParameterDescriptor[] getAllParameterDescriptors(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static ParameterInOutWrapper[] getAllParameterWrappers(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static ParameterInOutWrapper[] getAllParameterWrappersByOrder(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static org.eclipse.debug.core.ILaunchConfigurationType getLaunchConfigType()
           
static org.eclipse.datatools.sqltools.core.dbitem.ParameterDescriptor[] getParameterDescriptors(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static void initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static boolean isAdHocSQL(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
static org.eclipse.datatools.sqltools.core.DatabaseIdentifier readDatabaseIdentifier(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
static java.util.Map readEventParameter(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
static java.lang.String readExternalClientId(org.eclipse.debug.core.ILaunchConfiguration configuration)
          "" means no client connection id
static java.lang.String readLaunchSQLStatement(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
static java.util.List readParameterList(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
static org.eclipse.datatools.sqltools.core.ProcIdentifier readProcIdentifier(org.eclipse.debug.core.ILaunchConfiguration configuration)
          This method should only be called when is not adhoc sql.
static boolean readQuotedIDConfig(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
           
static void renameAllConfigurations(org.eclipse.datatools.sqltools.core.ProcIdentifier oldProc, org.eclipse.datatools.sqltools.core.ProcIdentifier newProc)
           
static void saveAdHocSQL(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, java.lang.String profileName, java.lang.String dbName, java.lang.String sql)
           
static void saveEvent(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.datatools.sqltools.core.ProcIdentifier proc, java.util.Map eventparams, java.lang.String sql)
           
static void saveSPUDF(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.datatools.sqltools.core.ProcIdentifier proc, java.util.List parameters, java.lang.String sql)
           
static void saveTrigger(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.datatools.sqltools.core.ProcIdentifier proc, java.lang.String sql)
           
static void setConnectionLevelOptions(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration)
          Sets the default values of connection level options for newly-created launch configuration
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LaunchHelper

public LaunchHelper()
Method Detail

getLaunchConfigType

public static org.eclipse.debug.core.ILaunchConfigurationType getLaunchConfigType()

createExternalClientConfiguration

public static org.eclipse.debug.core.ILaunchConfigurationWorkingCopy createExternalClientConfiguration(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier,
                                                                                                       java.lang.String connid)
                                                                                                throws org.eclipse.core.runtime.CoreException
Creates a launch configuration that can be used to launch a ILaunch that debug an external client connection.

Parameters:
sd -
connid -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

saveSPUDF

public static void saveSPUDF(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                             org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                             java.util.List parameters,
                             java.lang.String sql)

saveEvent

public static void saveEvent(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                             org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                             java.util.Map eventparams,
                             java.lang.String sql)

saveAdHocSQL

public static void saveAdHocSQL(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                                java.lang.String profileName,
                                java.lang.String dbName,
                                java.lang.String sql)

saveTrigger

public static void saveTrigger(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                               org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                               java.lang.String sql)

initializeConfiguration

public static void initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                                           org.eclipse.datatools.sqltools.core.ProcIdentifier proc)

readExternalClientId

public static java.lang.String readExternalClientId(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                             throws org.eclipse.core.runtime.CoreException
"" means no client connection id

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

readDatabaseIdentifier

public static org.eclipse.datatools.sqltools.core.DatabaseIdentifier readDatabaseIdentifier(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                                     throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

isAdHocSQL

public static boolean isAdHocSQL(org.eclipse.debug.core.ILaunchConfiguration configuration)
                          throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

readProcIdentifier

public static org.eclipse.datatools.sqltools.core.ProcIdentifier readProcIdentifier(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                             throws org.eclipse.core.runtime.CoreException
This method should only be called when is not adhoc sql.

Parameters:
configuration -
Returns:
null if fail to read the proc id.
Throws:
org.eclipse.core.runtime.CoreException

readParameterList

public static java.util.List readParameterList(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                        throws org.eclipse.core.runtime.CoreException
Parameters:
configuration -
Returns:
@throws CoreException
Throws:
org.eclipse.core.runtime.CoreException

readEventParameter

public static java.util.Map readEventParameter(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                        throws org.eclipse.core.runtime.CoreException
Parameters:
configuration -
Returns:
@throws CoreException
Throws:
org.eclipse.core.runtime.CoreException

readLaunchSQLStatement

public static java.lang.String readLaunchSQLStatement(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                               throws org.eclipse.core.runtime.CoreException
Parameters:
configuration -
Returns:
@throws CoreException
Throws:
org.eclipse.core.runtime.CoreException

constructDirectInvocationSQLString

public static java.lang.String constructDirectInvocationSQLString(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                           throws org.eclipse.core.runtime.CoreException,
                                                                  java.sql.SQLException,
                                                                  org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Constructs a sql string to directly invoke the launch configuration.

Parameters:
configuration -
Returns:
@throws CoreException
Throws:
org.eclipse.core.runtime.CoreException
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

constructCallableStatementSQLString

public static java.lang.String constructCallableStatementSQLString(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                            throws org.eclipse.core.runtime.CoreException,
                                                                   java.sql.SQLException,
                                                                   org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Constructs a SQL string which can be used in a CallableStatement.

Parameters:
configuration -
Returns:
@throws CoreException
Throws:
org.eclipse.core.runtime.CoreException
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

constructCallableStatementDisplayString

public static java.lang.String constructCallableStatementDisplayString(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                throws org.eclipse.core.runtime.CoreException,
                                                                       java.sql.SQLException,
                                                                       org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Constructs a sql statement to show the detailed information of a CallableStatement, which includes parameters if any. This string is for display purpose and should not be executed.

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

readQuotedIDConfig

public static boolean readQuotedIDConfig(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                         org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
Parameters:
configuration -
proc -

setConnectionLevelOptions

public static void setConnectionLevelOptions(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration)
Sets the default values of connection level options for newly-created launch configuration

Parameters:
configuration -

renameAllConfigurations

public static void renameAllConfigurations(org.eclipse.datatools.sqltools.core.ProcIdentifier oldProc,
                                           org.eclipse.datatools.sqltools.core.ProcIdentifier newProc)

getAllParameterWrappers

public static ParameterInOutWrapper[] getAllParameterWrappers(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
                                                       throws java.sql.SQLException,
                                                              org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Parameters:
profilefile -
type -
runstring -
Returns:
@throws NoSuchProfileException
Throws:
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

getAllParameterWrappersByOrder

public static ParameterInOutWrapper[] getAllParameterWrappersByOrder(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
                                                              throws java.sql.SQLException,
                                                                     org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Parameters:
profilefile -
type -
runstring -
Returns:
@throws NoSuchProfileException
Throws:
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

getAllParameterDescriptors

public static org.eclipse.datatools.sqltools.core.dbitem.ParameterDescriptor[] getAllParameterDescriptors(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
                                                                                                   throws java.sql.SQLException,
                                                                                                          org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Parameters:
profilefile -
type -
runstring -
Returns:
@throws NoSuchProfileException
Throws:
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException

getParameterDescriptors

public static org.eclipse.datatools.sqltools.core.dbitem.ParameterDescriptor[] getParameterDescriptors(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)
                                                                                                throws java.sql.SQLException,
                                                                                                       org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException
Parameters:
profilefile -
type -
runstring -
Returns:
@throws NoSuchProfileException
Throws:
java.sql.SQLException
org.eclipse.datatools.sqltools.core.profile.NoSuchProfileException