Class Main


  • public class Main
    extends java.lang.Object
    Utility app to connect to a database and create/update the IBM FHIR Server schema. The DDL processing is idempotent, with only the necessary changes applied.
    This utility also includes an option to exercise the tenant partitioning code.
    • Field Detail

      • STORED_PROCEDURE_ENABLED

        public java.util.List<DbType> STORED_PROCEDURE_ENABLED
      • PRIVILEGES_FEATURE_ENABLED

        public java.util.List<DbType> PRIVILEGES_FEATURE_ENABLED
      • ADMIN_SCHEMANAME

        public static final java.lang.String ADMIN_SCHEMANAME
        See Also:
        Constant Field Values
      • OAUTH_SCHEMANAME

        public static final java.lang.String OAUTH_SCHEMANAME
        See Also:
        Constant Field Values
      • BATCH_SCHEMANAME

        public static final java.lang.String BATCH_SCHEMANAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • Main

        public Main()
    • Method Detail

      • createConnection

        protected java.sql.Connection createConnection()
        Returns:
        a created connection to the selected database
      • configureConnectionPool

        protected void configureConnectionPool()
        Create a simple connection pool associated with our data source so that we can perform the DDL deployment in parallel
      • buildAdminSchemaModel

        protected void buildAdminSchemaModel​(PhysicalDataModel pdm)
        Add the admin schema objects to the PhysicalDataModel
        Parameters:
        pdm - the data model to build
      • buildOAuthSchemaModel

        protected void buildOAuthSchemaModel​(PhysicalDataModel pdm)
        Add the OAuth schema objects to the given PhysicalDataModel
        Parameters:
        pdm - the model to build
      • buildJavaBatchSchemaModel

        protected void buildJavaBatchSchemaModel​(PhysicalDataModel pdm)
        Add the JavaBatch schema objects to the given PhysicalDataModel
        Parameters:
        pdm -
      • checkCompatibility

        protected boolean checkCompatibility()
        specific feature to check if it is compatible.
        Returns:
      • createSchemas

        protected void createSchemas()
        Create the schemas
      • updateSchemas

        protected void updateSchemas()
        Process the schemas configured to be updated
      • buildFhirDataSchemaModel

        protected void buildFhirDataSchemaModel​(PhysicalDataModel pdm)
        Add FHIR data schema objects to the given PhysicalDataModel
        Parameters:
        pdm - the data model being built
      • updateFhirSchema

        protected void updateFhirSchema()
        Update the FHIR data schema
      • updateOauthSchema

        protected void updateOauthSchema()
        Build and apply the OAuth schema changes
      • updateJavaBatchSchema

        protected void updateJavaBatchSchema()
        Build and apply the JavaBatch schema changes
      • populateResourceTypeAndParameterNameTableEntries

        protected void populateResourceTypeAndParameterNameTableEntries()
        populates the RESOURCE_TYPE table.
      • dropSchema

        protected void dropSchema()
        Drop all the objects in the admin and data schemas. Typically used during development.
      • updateProcedures

        protected void updateProcedures()
        Update the stored procedures used by FHIR to insert records into the FHIR resource tables
      • buildCommonModel

        protected void buildCommonModel​(PhysicalDataModel pdm,
                                        boolean addFhirDataSchema,
                                        boolean addOAuthSchema,
                                        boolean addJavaBatchSchema)
        Build a common PhysicalDataModel containing all the requested schemas
        Parameters:
        pdm - the model to construct
        addFhirDataSchema - include objects for the FHIR data schema
        addOAuthSchema - include objects for the Liberty OAuth schema
        addJavaBatchSchema - include objects for the Liberty JavaBatch schema
      • grantPrivilegesForFhirData

        protected void grantPrivilegesForFhirData()
      • grantReadPrivilegesForFhirData

        protected void grantReadPrivilegesForFhirData()
        Grant only SELECT privileges to the given user to provide read-only direct schema access
      • grantPrivilegesForFhirData

        protected void grantPrivilegesForFhirData​(java.lang.String privilegeGroupName,
                                                  java.lang.String targetUser)
        Apply grants to the FHIR data schema objects
        Parameters:
        privilegeGroupName - identifies the group of privileges to apply
      • grantPrivilegesForOAuth

        protected void grantPrivilegesForOAuth()
        Apply grants to the OAuth schema objects
      • grantPrivilegesForBatch

        protected void grantPrivilegesForBatch()
        Apply grants to the JavaBatch schema objects
      • grantPrivileges

        protected void grantPrivileges()
        Grant the minimum required set of privileges on the FHIR schema objects to the grantTo user. All tenant data access is via this user, and is the only user the FHIR server itself is configured with.
      • getDataSchemaType

        protected SchemaType getDataSchemaType()
        What type of FHIR data schema do we want to build?
        Returns:
      • parseArgs

        protected void parseArgs​(java.lang.String[] args)
        Parse the command-line arguments, building up the environment and establishing the run-list
        Parameters:
        args -
      • loadPropertyFile

        public void loadPropertyFile​(java.lang.String filename)
        Read the properties from the given file
        Parameters:
        filename -
      • addProperty

        public void addProperty​(java.lang.String pair)
        Parse the given key=value string and add to the properties being collected
        Parameters:
        pair -
      • applyDataMigrationForV0027

        protected void applyDataMigrationForV0027()
      • updateVacuumSettings

        public void updateVacuumSettings()
        updates the vacuum settings for postgres/citus.
      • process

        protected void process()
        Process the requested operation
      • getExitStatus

        protected int getExitStatus()
        Get the program exit status from the environment
        Returns:
      • logStatusMessage

        protected void logStatusMessage​(int status)
        Write a final status message - useful for QA to review when checking the output
      • main

        public static void main​(java.lang.String[] args)
        Main entry point
        Parameters:
        args -