Package com.iizigo.db

Class PluginActivator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DIRECTORY_NAME
      The plug-in directory ID.
      static java.lang.String PLUGIN_ID
      The plug-in ID.
      static PropertyEditorSetup setup
      The resource setup.
      • Fields inherited from class org.eclipse.core.runtime.Plugin

        PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
    • Constructor Summary

      Constructors 
      Constructor Description
      PluginActivator()
      The constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean createDerbyConnectionProfile​(java.lang.String profileName, int port, java.lang.String database, boolean doCreateDB, java.lang.String userID, java.lang.String password, boolean overwrite)
      Creates a Derby Driver connection profile with the specified name, (localhost) port and database.
      static boolean createDerbyConnectionProfile​(java.lang.String profileName, java.lang.String database, boolean doCreateDB, java.lang.String userID, java.lang.String password)
      Creates a Derby Driver connection profile with the specified name, (localhost), default port (1527) and database.
      void createNewWizards​(java.util.ArrayList<org.eclipse.ui.menus.CommandContributionItem> newWizards)
      Call to fill the array with "New Wizards".
      static PluginActivator getDefault()
      Returns the shared instance
      static org.eclipse.jface.resource.ImageDescriptor getIcon​(java.lang.String fileName)
      Returns an image descriptor for the image file at the given plug-in relative path.
      static org.eclipse.jface.resource.ImageDescriptor getIDTransaction()
      Gets the image descriptor of the DB transaction.
      static PluginActivator getInstance()
      Returns the shared instance.
      static PluginDescriptor getPluginDescriptor()
      Gets the iizi PluginDescriptor.
      IServerApplicationSetup[] getServerApplicationSetupInstances​(PropCnr moduleRoot)
      Queries for instances of the IServerApplicationSetup required.
      void initializeModule​(ModuleModel model)
      Initializes the plug-in after the Module project has been loaded.
      void onInitialLayout​(org.eclipse.ui.IPageLayout layout, org.eclipse.ui.IFolderLayout folder, org.eclipse.ui.IFolderLayout outlineFolder, org.eclipse.ui.IFolderLayout outputFolder)
      Called when the Module perspective has completed initializing itself with iizi-related items.
      void registerPlugin()
      Registers this plug-in with iiziGo.
      void start​(org.osgi.framework.BundleContext context)
      Starts up the Database plug-in bundle.
      void stop​(org.osgi.framework.BundleContext context)  
      • Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin

        createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
      • Methods inherited from class org.eclipse.core.runtime.Plugin

        find, find, getBundle, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PluginActivator

        public PluginActivator()
        The constructor
    • Method Detail

      • getInstance

        public static PluginActivator getInstance()
        Returns the shared instance.
        Returns:
        The shared instance.
      • start

        public void start​(org.osgi.framework.BundleContext context)
                   throws java.lang.Exception
        Starts up the Database plug-in bundle.

        If this method throws an exception, it is taken as an indication that plug-in initialization has failed; as a result, the plug-in will not be activated; moreover, the plug-in will be marked as disabled and ineligible for activation for the duration.

        Note 1: This method is automatically invoked by the platform the first time any code in the plug-in is executed.

        Note 2: This method is intended to perform simple initialization of the plug-in environment. The platform may terminate initializers that do not complete in a timely fashion.

        Note 3: The class loader typically has monitors acquired during invocation of this method. It is strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms, as this would lead to deadlock vulnerability.

        Note 4: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.

        Note 5: This method and the stop(BundleContext) may be called from separate threads, but the OSGi framework ensures that both methods will not be called simultaneously.

        Specified by:
        start in interface org.osgi.framework.BundleActivator
        Overrides:
        start in class org.eclipse.ui.plugin.AbstractUIPlugin
        Parameters:
        context - The bundle context.
        Throws:
        java.lang.Exception - For errors in loading the iizi properties framework.
      • registerPlugin

        public void registerPlugin()
                            throws org.eclipse.core.runtime.CoreException
        Registers this plug-in with iiziGo. This method is called from iizi Designer when an application requires the plug-in. The plug-in should check if registration already has been done, and if so, skip the registration. This is required due to the OSGi framework threading at startup of Eclipse.
        Specified by:
        registerPlugin in interface IPluginInitialize
        Throws:
        org.eclipse.core.runtime.CoreException - For registration failures.
      • initializeModule

        public void initializeModule​(ModuleModel model)
                              throws org.eclipse.core.runtime.CoreException
        Initializes the plug-in after the Module project has been loaded.
        Specified by:
        initializeModule in interface IPluginInitialize
        Parameters:
        model - The Module project.
        Throws:
        org.eclipse.core.runtime.CoreException - For initialization failures.
      • stop

        public void stop​(org.osgi.framework.BundleContext context)
                  throws java.lang.Exception
        Specified by:
        stop in interface org.osgi.framework.BundleActivator
        Overrides:
        stop in class org.eclipse.ui.plugin.AbstractUIPlugin
        Throws:
        java.lang.Exception
      • getDefault

        public static PluginActivator getDefault()
        Returns the shared instance
        Returns:
        the shared instance
      • getPluginDescriptor

        public static PluginDescriptor getPluginDescriptor()
        Gets the iizi PluginDescriptor.
        Returns:
        The plug-in descriptor for the database.
      • getIDTransaction

        public static org.eclipse.jface.resource.ImageDescriptor getIDTransaction()
        Gets the image descriptor of the DB transaction.
        Returns:
        The (cached) image descriptor for a database transaction.
      • createNewWizards

        public void createNewWizards​(java.util.ArrayList<org.eclipse.ui.menus.CommandContributionItem> newWizards)
        Call to fill the array with "New Wizards".
        Specified by:
        createNewWizards in interface IPluginInitialize
        Parameters:
        newWizards - Array of New Wizard's.
      • getIcon

        public static org.eclipse.jface.resource.ImageDescriptor getIcon​(java.lang.String fileName)
        Returns an image descriptor for the image file at the given plug-in relative path.
        Parameters:
        fileName - The image file name inside "icons".
        Returns:
        the image descriptor.
      • onInitialLayout

        public void onInitialLayout​(org.eclipse.ui.IPageLayout layout,
                                    org.eclipse.ui.IFolderLayout folder,
                                    org.eclipse.ui.IFolderLayout outlineFolder,
                                    org.eclipse.ui.IFolderLayout outputFolder)
        Called when the Module perspective has completed initializing itself with iizi-related items. Once the plug-ins complete their processing, additional Java and Java-EE items are added.
        Specified by:
        onInitialLayout in interface IModulePerspective
        Parameters:
        layout - The page layout.
        folder - The folder area, left side.
        outlineFolder - The outline folder on the right side, perhaps null (be careful!).
        outputFolder - The output folder area, bottom placement.
      • getServerApplicationSetupInstances

        public IServerApplicationSetup[] getServerApplicationSetupInstances​(PropCnr moduleRoot)
        Queries for instances of the IServerApplicationSetup required. This call makes it possible to redirect the query to other properties. Most plug-ins would have a single instance.
        Specified by:
        getServerApplicationSetupInstances in interface IServerApplicationSetupProvider
        Parameters:
        moduleRoot - The root of the Module application.
        Returns:
        The IServerApplicationSetup instances that is participating in the setup.
      • createDerbyConnectionProfile

        public static boolean createDerbyConnectionProfile​(java.lang.String profileName,
                                                           java.lang.String database,
                                                           boolean doCreateDB,
                                                           java.lang.String userID,
                                                           java.lang.String password)
                                                    throws org.eclipse.datatools.connectivity.ConnectionProfileException
        Creates a Derby Driver connection profile with the specified name, (localhost), default port (1527) and database.

        The is how an exported database profile to plain XML would look like for the iiziServer.

          [?xml version="1.0" encoding="UTF-8"?]
          [DataTools.ServerProfiles version="1.0"]
             [profile autoconnect="Yes" desc="iiziServer - optional description" id="fb5a9541-c23e-11ea-bb08-d0a9d799745f" name="iiziServer" providerID="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"]
                [baseproperties]
                   [property name="org.eclipse.datatools.connectivity.db.connectionProperties" value="" /]
                   [property name="org.eclipse.datatools.connectivity.db.savePWD" value="true" /]
                   [property name="org.eclipse.datatools.connectivity.drivers.defnType" value="org.eclipse.datatools.connectivity.db.derby102.clientDriver" /]
                   [property name="org.eclipse.datatools.connectivity.db.username" value="*****" /]
                   [property name="org.eclipse.datatools.connectivity.db.driverClass" value="org.apache.derby.jdbc.ClientDriver" /]
                   [property name="org.eclipse.datatools.connectivity.driverDefinitionID" value="DriverDefn.org.eclipse.datatools.connectivity.db.derby102.clientDriver.Derby Client JDBC Driver" /]
                   [property name="org.eclipse.datatools.connectivity.db.databaseName" value="iiziServer" /]
                   [property name="org.eclipse.datatools.connectivity.db.password" value="*****" /]
                   [property name="org.eclipse.datatools.connectivity.db.version" value="10.2" /]
                   [property name="org.eclipse.datatools.connectivity.db.URL" value="jdbc:derby://localhost:1527/iiziServer" /]
                   [property name="org.eclipse.datatools.connectivity.db.vendor" value="Derby" /]
                   [property name="jarList" value="C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbyclient.jar;C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbyshared.jar;C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbytools.jar" /]
                [/baseproperties]
                [org.eclipse.datatools.connectivity.versionInfo]
                   [property name="server.version" value="10.15.2.0 - (1873585)" /]
                   [property name="technology.name.jdbc" value="JDBC" /]
                   [property name="server.name" value="Apache Derby" /]
                   [property name="technology.version.jdbc" value="4.2.0" /]
                [/org.eclipse.datatools.connectivity.versionInfo]
                [driverreference]
                   [property name="driverName" value="Derby Client JDBC Driver" /]
                   [property name="driverTypeID" value="org.eclipse.datatools.connectivity.db.derby102.clientDriver" /]
                [/driverreference]
             [/profile]
          [/DataTools.ServerProfiles]
         
        Parameters:
        profileName - The profile name.
        database - The database name.
        doCreateDB - Flag to create the database if not existing.
        userID - The User ID.
        password - The password.
        Returns:
        true For success, false if connection profile already exists.
        Throws:
        org.eclipse.datatools.connectivity.ConnectionProfileException - For failures in creating the connection profile.
      • createDerbyConnectionProfile

        public static boolean createDerbyConnectionProfile​(java.lang.String profileName,
                                                           int port,
                                                           java.lang.String database,
                                                           boolean doCreateDB,
                                                           java.lang.String userID,
                                                           java.lang.String password,
                                                           boolean overwrite)
                                                    throws org.eclipse.datatools.connectivity.ConnectionProfileException
        Creates a Derby Driver connection profile with the specified name, (localhost) port and database.

        The is how an exported database profile to plain XML would look like for the iiziServer.

          [?xml version="1.0" encoding="UTF-8"?]
          [DataTools.ServerProfiles version="1.0"]
             [profile autoconnect="Yes" desc="iiziServer - optional description" id="fb5a9541-c23e-11ea-bb08-d0a9d799745f" name="iiziServer" providerID="org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"]
                [baseproperties]
                   [property name="org.eclipse.datatools.connectivity.db.connectionProperties" value="" /]
                   [property name="org.eclipse.datatools.connectivity.db.savePWD" value="true" /]
                   [property name="org.eclipse.datatools.connectivity.drivers.defnType" value="org.eclipse.datatools.connectivity.db.derby102.clientDriver" /]
                   [property name="org.eclipse.datatools.connectivity.db.username" value="*****" /]
                   [property name="org.eclipse.datatools.connectivity.db.driverClass" value="org.apache.derby.jdbc.ClientDriver" /]
                   [property name="org.eclipse.datatools.connectivity.driverDefinitionID" value="DriverDefn.org.eclipse.datatools.connectivity.db.derby102.clientDriver.Derby Client JDBC Driver" /]
                   [property name="org.eclipse.datatools.connectivity.db.databaseName" value="iiziServer" /]
                   [property name="org.eclipse.datatools.connectivity.db.password" value="*****" /]
                   [property name="org.eclipse.datatools.connectivity.db.version" value="10.2" /]
                   [property name="org.eclipse.datatools.connectivity.db.URL" value="jdbc:derby://localhost:1527/iiziServer" /]
                   [property name="org.eclipse.datatools.connectivity.db.vendor" value="Derby" /]
                   [property name="jarList" value="C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbyclient.jar;C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbyshared.jar;C:\iizi\com.iizix.jdbc\resources\jdbc-drivers\derby\derbytools.jar" /]
                [/baseproperties]
                [org.eclipse.datatools.connectivity.versionInfo]
                   [property name="server.version" value="10.15.2.0 - (1873585)" /]
                   [property name="technology.name.jdbc" value="JDBC" /]
                   [property name="server.name" value="Apache Derby" /]
                   [property name="technology.version.jdbc" value="4.2.0" /]
                [/org.eclipse.datatools.connectivity.versionInfo]
                [driverreference]
                   [property name="driverName" value="Derby Client JDBC Driver" /]
                   [property name="driverTypeID" value="org.eclipse.datatools.connectivity.db.derby102.clientDriver" /]
                [/driverreference]
             [/profile]
          [/DataTools.ServerProfiles]
         
        Parameters:
        profileName - The profile name.
        port - The database server port, zero or negative for default 1527.
        database - The database name.
        doCreateDB - Flag to create the database if not existing.
        userID - The User ID.
        password - The password.
        overwrite - Remove existing connection profile with this name if present before adding it.
        Returns:
        true For success, false if connection profile already exists and the flag overwrite was false.
        Throws:
        org.eclipse.datatools.connectivity.ConnectionProfileException - For failures in creating the connection profile or deleting an existing connection profile.