├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── LICENSE.TXT ├── README.md ├── RELEASE-NOTES.txt ├── aceql-http-api-stored-procedures.md ├── aceql-http-demo-guide.md ├── aceql-http-user-guide-api.md ├── bin ├── aceql-server ├── aceql-server.bat ├── aceqlhttp ├── post-install.sh ├── properties-encryptor └── properties-encryptor.bat ├── conf ├── .gitignore ├── aceql-server.properties ├── cloudmersive.properties ├── dvdrental.txt ├── dvdrental_rules_manager.csv └── sampledb_rules_manager.csv ├── conf_test ├── .gitignore ├── aceql-server-TEST.properties ├── aceql-server-auth-jdbc.properties ├── aceql-server-auth-ldap.properties ├── aceql-server-auth-ssh.properties ├── aceql-server-auth-windows.properties ├── aceql-server-auth-ws.properties ├── aceql-server-encryped.properties ├── aceql-server-firewall.properties ├── aceql-server-four-db.properties ├── aceql-server-mssql-server.properties ├── aceql-server-stateless.properties ├── cloudmersive.properties ├── dvdrental_deny_blacklist.txt ├── dvdrental_deny_except_whitelist.txt ├── dvdrental_rules_manager.csv ├── properties_password_manager.properties └── sampledb_rules_manager.csv ├── legal ├── Apache_License_v2.0.txt ├── Eclipse Public License - Version 1.0.html └── PostgreSQLLicense.txt ├── pom.xml ├── sql ├── aceql_demo.sql ├── array_example.sql ├── customer_2.sql ├── example_msAccess.sql ├── sampledb.txt ├── sampledb_ms_sql_server.txt ├── sampledb_mysql.txt ├── sampledb_oracle_database.txt ├── sampledb_other_databases.txt └── sampledb_postgresql.txt └── src ├── main ├── java │ └── org │ │ └── kawanfw │ │ └── sql │ │ ├── WebServer.java │ │ ├── api │ │ ├── server │ │ │ ├── BasicSqlInjectionAnalyser.java │ │ │ ├── DataSourceStore.java │ │ │ ├── DatabaseConfigurationException.java │ │ │ ├── DatabaseConfigurator.java │ │ │ ├── DefaultDatabaseConfigurator.java │ │ │ ├── DefaultPoolsInfo.java │ │ │ ├── SqlEvent.java │ │ │ ├── SqlEventWrapper.java │ │ │ ├── StatementAnalyzer.java │ │ │ ├── StatementNormalizer.java │ │ │ ├── auth │ │ │ │ ├── JdbcPasswordEncryptor.java │ │ │ │ ├── JdbcUserAuthenticator.java │ │ │ │ ├── LdapUserAuthenticator.java │ │ │ │ ├── SshUserAuthenticator.java │ │ │ │ ├── UserAuthenticator.java │ │ │ │ ├── WebServiceUserAuthenticator.java │ │ │ │ ├── WindowsUserAuthenticator.java │ │ │ │ ├── crypto │ │ │ │ │ ├── DefaultPropertiesPasswordManager.java │ │ │ │ │ ├── PropertiesEncryptor.java │ │ │ │ │ ├── PropertiesEncryptorWrap.java │ │ │ │ │ ├── PropertiesPasswordManager.java │ │ │ │ │ └── package.html │ │ │ │ ├── headers │ │ │ │ │ ├── RequestHeadersAuthenticator.java │ │ │ │ │ └── package.html │ │ │ │ └── package.html │ │ │ ├── blob │ │ │ │ ├── BlobDownloadConfigurator.java │ │ │ │ ├── BlobUploadConfigurator.java │ │ │ │ ├── DefaultBlobDownloadConfigurator.java │ │ │ │ ├── DefaultBlobUploadConfigurator.java │ │ │ │ └── package.html │ │ │ ├── connectionstore │ │ │ │ ├── ConnectionKey.java │ │ │ │ ├── ConnectionStoreManager.java │ │ │ │ └── package.html │ │ │ ├── executor │ │ │ │ ├── ClientEvent.java │ │ │ │ ├── ClientEventWrapper.java │ │ │ │ ├── ServerQueryExecutor.java │ │ │ │ └── package.html │ │ │ ├── firewall │ │ │ │ ├── CsvRulesManager.java │ │ │ │ ├── CsvRulesManagerNoReload.java │ │ │ │ ├── DenyDatabaseWriteManager.java │ │ │ │ ├── DenyDclManager.java │ │ │ │ ├── DenyDdlManager.java │ │ │ │ ├── DenyExceptOnWhitelistManager.java │ │ │ │ ├── DenyMetadataQueryManager.java │ │ │ │ ├── DenyOnBlacklistManager.java │ │ │ │ ├── DenySqlInjectionManager.java │ │ │ │ ├── DenySqlInjectionManagerAsync.java │ │ │ │ ├── DenyStatementClassManager.java │ │ │ │ ├── SqlFirewallManager.java │ │ │ │ ├── package.html │ │ │ │ └── trigger │ │ │ │ │ ├── BanUserSqlFirewallTrigger.java │ │ │ │ │ ├── BeeperSqlFirewallTrigger.java │ │ │ │ │ ├── JdbcLoggerSqlFirewallTrigger.java │ │ │ │ │ ├── JsonLoggerSqlFirewallTrigger.java │ │ │ │ │ ├── SqlFirewallTrigger.java │ │ │ │ │ └── package.html │ │ │ ├── listener │ │ │ │ ├── JsonLoggerUpdateListener.java │ │ │ │ ├── UpdateListener.java │ │ │ │ └── package.html │ │ │ ├── logging │ │ │ │ ├── DefaultLoggerCreator.java │ │ │ │ ├── LoggerCreator.java │ │ │ │ └── package.html │ │ │ ├── package.html │ │ │ ├── session │ │ │ │ ├── DefaultSessionConfigurator.java │ │ │ │ ├── JwtSessionConfigurator.java │ │ │ │ ├── SessionConfigurator.java │ │ │ │ ├── SessionIdentifierGenerator.java │ │ │ │ ├── SessionInfo.java │ │ │ │ └── package.html │ │ │ ├── util │ │ │ │ ├── NoFormatter.java │ │ │ │ ├── SimpleHttpClient.java │ │ │ │ ├── SimpleSha1.java │ │ │ │ ├── UsernameConverter.java │ │ │ │ ├── Version.java │ │ │ │ ├── VerySimpleFormatter.java │ │ │ │ └── package.html │ │ │ └── web │ │ │ │ ├── WebServerApi.java │ │ │ │ └── package.html │ │ └── util │ │ │ ├── JsqlParserWrapper.java │ │ │ ├── PreparedStatementRunner.java │ │ │ ├── ResultSetPrinter.java │ │ │ ├── SqlUtil.java │ │ │ ├── StatementAnalyzerUtil.java │ │ │ ├── auth │ │ │ ├── ConfigurablePasswordEncryptorUtil.java │ │ │ └── PasswordEncryptorUtil.java │ │ │ ├── firewall │ │ │ ├── CsvRulesManagerLoader.java │ │ │ ├── DatabaseUserTableTriplet.java │ │ │ ├── FirstLineChecker.java │ │ │ ├── IllegalFirstLineException.java │ │ │ ├── IllegalStatementAllowBooleanValue.java │ │ │ ├── IllegalTableNameException.java │ │ │ ├── LearningModeExecutor.java │ │ │ ├── SqlFirewallTriggerWrapper.java │ │ │ ├── TableAllowStatements.java │ │ │ ├── TextStatementsListLoader.java │ │ │ └── cloudmersive │ │ │ │ ├── CloudmersiveApi.java │ │ │ │ ├── DenySqlInjectionManagerUtil.java │ │ │ │ └── SqlInjectionApiCallback.java │ │ │ └── webserver │ │ │ ├── ParametersExtractor.java │ │ │ ├── WebServerApiWrapper.java │ │ │ └── WebServerUtil.java │ │ ├── jdbc │ │ └── metadata │ │ │ ├── AceQLArray.java │ │ │ ├── ArrayTransporter.java │ │ │ ├── BooleanResponseDTO.java │ │ │ ├── DatabaseMetaDataMethodCallDTO.java │ │ │ └── ResultSetMetaDataHolder.java │ │ ├── metadata │ │ ├── AceQLMetaData.java │ │ ├── CatalogAndSchema.java │ │ ├── Column.java │ │ ├── ExportedKey.java │ │ ├── ForeignKey.java │ │ ├── ImportedKey.java │ │ ├── Index.java │ │ ├── JdbcDatabaseMetaData.java │ │ ├── PrimaryKey.java │ │ ├── Table.java │ │ ├── TableName.java │ │ ├── dto │ │ │ ├── DatabaseInfo.java │ │ │ ├── DatabaseInfoDto.java │ │ │ ├── JdbcDatabaseMetaDataDto.java │ │ │ ├── LimitsInfoDto.java │ │ │ ├── ServerQueryExecutorDto.java │ │ │ ├── TableDto.java │ │ │ └── TableNamesDto.java │ │ ├── sc │ │ │ └── info │ │ │ │ ├── AceQLOutputFormat.java │ │ │ │ ├── SchemaInfoAccessor.java │ │ │ │ └── SchemaInfoSC.java │ │ └── util │ │ │ ├── FileWordReplacer.java │ │ │ ├── GsonWsUtil.java │ │ │ ├── MetaDataJavaUtil.java │ │ │ └── WrappersGenerator.java │ │ ├── package.html │ │ ├── servlet │ │ ├── ActionUtil.java │ │ ├── AsyncDebug.java │ │ ├── BannerOnTester.java │ │ ├── BaseActionTreater.java │ │ ├── BlobDownloader.java │ │ ├── BlobLengthGetter.java │ │ ├── BlobUploader.java │ │ ├── HttpParameter.java │ │ ├── HttpServletRequestHolder.java │ │ ├── HttpStatus.java │ │ ├── JavaValueBuilder.java │ │ ├── MetadataQueryActionManager.java │ │ ├── MetadataQuerySchemaDownloader.java │ │ ├── PrivateTmpLogger.java │ │ ├── ServerAsyncListener.java │ │ ├── ServerLoginActionSql.java │ │ ├── ServerLogout.java │ │ ├── ServerQueryExecutorUtil.java │ │ ├── ServerSqlDispatch.java │ │ ├── ServerSqlDispatchUtil.java │ │ ├── ServerSqlManager.java │ │ ├── ServerSqlManagerDoGetTester.java │ │ ├── ServletMetadataQuery.java │ │ ├── ServletPathAnalyzer.java │ │ ├── Trace.java │ │ ├── UserAuthenticatorTester.java │ │ ├── connection │ │ │ ├── ConnectionIdUtil.java │ │ │ ├── ConnectionStore.java │ │ │ ├── ConnectionStoreGetter.java │ │ │ ├── RollbackUtil.java │ │ │ ├── SavepointDto.java │ │ │ ├── SavepointUtil.java │ │ │ └── TransactionUtil.java │ │ ├── injection │ │ │ ├── classes │ │ │ │ ├── AdvancedRequestHeadersAuthenticatorLoader.java │ │ │ │ ├── AdvancedSqlFirewallTriggersLoader.java │ │ │ │ ├── AdvancedSqlFirewallTriggersLoaderWrap.java │ │ │ │ ├── AdvancedThreadPoolExecutorBuilder.java │ │ │ │ ├── AdvancedUpdateListenersLoader.java │ │ │ │ ├── AdvancedUpdateListenersLoaderWrap.java │ │ │ │ ├── DatabaseConfiguratorClassNameBuilder.java │ │ │ │ ├── DatabaseConfiguratorClassNameBuilderCreator.java │ │ │ │ ├── DefaultDatabaseConfiguratorClassNameBuilder.java │ │ │ │ ├── DefaultNativeTomcatElementsBuilder.java │ │ │ │ ├── DefaultSessionConfiguratorClassNameBuilder.java │ │ │ │ ├── DefaultSqlFirewallTriggersLoader.java │ │ │ │ ├── DefaultUpdateListenersLoader.java │ │ │ │ ├── DefaultWebServerStarter.java │ │ │ │ ├── InjectedClasses.java │ │ │ │ ├── InjectedClassesManagerNew.java │ │ │ │ ├── InjectedClassesStore.java │ │ │ │ ├── NativeTomcatElementsBuilder.java │ │ │ │ ├── NativeTomcatElementsBuilderCreator.java │ │ │ │ ├── RequestHeadersAuthenticatorLoader.java │ │ │ │ ├── SessionConfiguratorClassNameBuilder.java │ │ │ │ ├── SessionConfiguratorClassNameBuilderCreator.java │ │ │ │ ├── SqlFirewallTriggersLoader.java │ │ │ │ ├── SqlFirewallTriggersLoaderCreator.java │ │ │ │ ├── UpdateListenersLoader.java │ │ │ │ ├── UpdateListenersLoaderCreator.java │ │ │ │ ├── WebServerStarter.java │ │ │ │ ├── blob │ │ │ │ │ ├── BlobDownloadConfiguratorClassNameBuilder.java │ │ │ │ │ ├── BlobDownloadConfiguratorClassNameBuilderCreator.java │ │ │ │ │ ├── BlobUploadConfiguratorClassNameBuilder.java │ │ │ │ │ ├── BlobUploadConfiguratorClassNameBuilderCreator.java │ │ │ │ │ ├── DefaultBlobDownloadConfiguratorClassNameBuilder.java │ │ │ │ │ └── DefaultBlobUploadConfiguratorClassNameBuilder.java │ │ │ │ ├── creator │ │ │ │ │ ├── BlobDownloadConfiguratorCreator.java │ │ │ │ │ ├── BlobUploadConfiguratorCreator.java │ │ │ │ │ ├── DatabaseConfiguratorCreator.java │ │ │ │ │ ├── LoggerCreatorBuilder.java │ │ │ │ │ ├── RequestHeadersAuthenticatorCreator.java │ │ │ │ │ ├── SessionConfiguratorCreator.java │ │ │ │ │ ├── SqlFirewallTriggersCreator.java │ │ │ │ │ ├── SqlFirewallsCreator.java │ │ │ │ │ ├── UpdateListenersCreator.java │ │ │ │ │ ├── UserAuthenticatorCreator.java │ │ │ │ │ └── WebServerStarterCreator.java │ │ │ │ └── validator │ │ │ │ │ └── ThreadPoolCapacityWarner.java │ │ │ └── properties │ │ │ │ ├── AdvancedPropertiesDecryptorWrap.java │ │ │ │ ├── AdvancedServletAceQLCallNameGetter.java │ │ │ │ ├── ConfProperties.java │ │ │ │ ├── ConfPropertiesManager.java │ │ │ │ ├── ConfPropertiesStore.java │ │ │ │ ├── ConfPropertiesUtil.java │ │ │ │ ├── OperationalMode.java │ │ │ │ ├── PropertiesDecryptor.java │ │ │ │ ├── PropertiesFileStore.java │ │ │ │ ├── PropertiesFileUtil.java │ │ │ │ └── PropertiesPasswordManagerLoader.java │ │ ├── jdbc │ │ │ └── metadata │ │ │ │ ├── DatabaseMetaDataSpecialExecutor.java │ │ │ │ ├── DefaultJdbcDatabaseMetadataActionManagerWrap.java │ │ │ │ ├── JdbcDatabaseMetaDataExecutor.java │ │ │ │ ├── JdbcDatabaseMetadataActionManager.java │ │ │ │ ├── JdbcDatabaseMetadataActionManagerCreator.java │ │ │ │ ├── MethodParametersBuilder.java │ │ │ │ └── resultset │ │ │ │ └── ResultSetMetaDataBuilder.java │ │ ├── metadata │ │ │ └── JsonDatabaseMetaData.java │ │ ├── sql │ │ │ ├── AceQLParameter.java │ │ │ ├── AceQLTypes.java │ │ │ ├── BinaryColumnFormater.java │ │ │ ├── ClobColumnFormater.java │ │ │ ├── ColumnInfoCreator.java │ │ │ ├── DbEngineManager.java │ │ │ ├── DbEngineManagerUtil.java │ │ │ ├── JavaSqlConversion.java │ │ │ ├── LoggerUtil.java │ │ │ ├── ParameterDirection.java │ │ │ ├── PostgreSqlUtil.java │ │ │ ├── ResultSetWriter.java │ │ │ ├── ResultSetWriterUtil.java │ │ │ ├── ServerSqlUtil.java │ │ │ ├── ServerStatement.java │ │ │ ├── ServerStatementRawExecute.java │ │ │ ├── ServerStatementUtil.java │ │ │ ├── StatementFailure.java │ │ │ ├── UpdateListenersCaller.java │ │ │ ├── batch │ │ │ │ ├── ServerPreparedStatementBatch.java │ │ │ │ └── ServerStatementBatch.java │ │ │ ├── callable │ │ │ │ ├── AdvancedServerCallableStatement.java │ │ │ │ ├── ServerCallableUtil.java │ │ │ │ └── aceqlproc │ │ │ │ │ ├── DefaultServerQueryExecutorWrapper.java │ │ │ │ │ ├── ServerQueryExecutorWrapper.java │ │ │ │ │ └── ServerQueryExecutorWrapperCreator.java │ │ │ ├── dto │ │ │ │ ├── PrepStatementParamsHolder.java │ │ │ │ ├── StatementsBatchDto.java │ │ │ │ └── UpdateCountsArrayDto.java │ │ │ ├── json_return │ │ │ │ ├── ExceptionReturner.java │ │ │ │ ├── JsonErrorReturn.java │ │ │ │ ├── JsonExample.java │ │ │ │ ├── JsonOkReturn.java │ │ │ │ ├── JsonSecurityMessage.java │ │ │ │ └── JsonUtil.java │ │ │ └── parameters │ │ │ │ ├── ServerPreparedStatementParameters.java │ │ │ │ └── ServerPreparedStatementParametersUtil.java │ │ └── util │ │ │ ├── BeepUtil.java │ │ │ ├── BlobUtil.java │ │ │ ├── JsonLoggerUtil.java │ │ │ ├── SqlFirewallTriggerUtil.java │ │ │ ├── UpdateListenerUtil.java │ │ │ ├── healthcheck │ │ │ └── HealthCheckInfoDto.java │ │ │ ├── logging │ │ │ ├── FlattenLogger.java │ │ │ ├── GenericLoggerCreator.java │ │ │ ├── GenericLoggerCreatorUtil.java │ │ │ ├── LoggerCreatorBuilderImpl.java │ │ │ ├── LoggerCreatorProperties.java │ │ │ ├── LoggerWrapper.java │ │ │ └── StringFlattener.java │ │ │ ├── max_rows │ │ │ ├── DefaultMaxRowsSetter.java │ │ │ ├── MaxRowsSetter.java │ │ │ └── MaxRowsSetterCreator.java │ │ │ └── operation_type │ │ │ ├── DefaultOperationType.java │ │ │ ├── OperationType.java │ │ │ └── OperationTypeCreator.java │ │ ├── tomcat │ │ ├── AceQLJdbcInterceptor.java │ │ ├── AceQLServletCallNameGetterCreator.java │ │ ├── AdvancedServletNamesGetterWrap.java │ │ ├── DefaultServletAceQLCallNameGetter.java │ │ ├── DefaultServletNamesGetter.java │ │ ├── InitParamNameValuePair.java │ │ ├── JdbcInterceptorTest.java │ │ ├── PoolPropertiesCreator.java │ │ ├── ServletAceQLCallNameGetter.java │ │ ├── ServletNamesGetter.java │ │ ├── ServletsNamesGetterCreator.java │ │ ├── StaticParms.java │ │ ├── SystemPropUpdater.java │ │ ├── TomcatConnectorsUpdater.java │ │ ├── TomcatFilterUtil.java │ │ ├── TomcatSqlModeStore.java │ │ ├── TomcatStarter.java │ │ ├── TomcatStarterMessages.java │ │ ├── TomcatStarterUtil.java │ │ ├── TomcatStarterUtilInstancesTester.java │ │ ├── TomcatStarterUtilProperties.java │ │ ├── properties │ │ │ ├── pool │ │ │ │ ├── DefaultPoolPropertiesInterceptor.java │ │ │ │ ├── PoolPropertiesInterceptor.java │ │ │ │ ├── PoolPropertiesInterceptorCreator.java │ │ │ │ └── misc │ │ │ │ │ ├── BooleanPropertiesInterceptor.java │ │ │ │ │ ├── BooleanPropertiesInterceptorCreator.java │ │ │ │ │ └── DefaultBooleanPropertiesInterceptor.java │ │ │ └── threadpool │ │ │ │ ├── DefaultThreadPoolExecutorBuilder.java │ │ │ │ ├── ThreadPoolExecutorBuilder.java │ │ │ │ ├── ThreadPoolExecutorBuilderCreator.java │ │ │ │ └── ThreadPoolProperties.java │ │ └── util │ │ │ ├── LinkedProperties.java │ │ │ ├── PortSemaphoreFile.java │ │ │ └── jdbc │ │ │ ├── ConnectionCreator.java │ │ │ ├── ConnectionCreatorUtil.java │ │ │ └── JdbcInstanceInfo.java │ │ ├── transport │ │ ├── TransportConverter.java │ │ ├── UrlTransporter.java │ │ └── no_obfsucation │ │ │ ├── ArrayHttp.java │ │ │ ├── ArrayTransporter.java │ │ │ ├── RowIdHttp.java │ │ │ ├── RowIdTransporter.java │ │ │ └── SqlArrayTransporter.java │ │ ├── util │ │ ├── Base64.java │ │ ├── Base64Test.java │ │ ├── CallableParms.java │ │ ├── ClasspathUtil.java │ │ ├── ConnectionParms.java │ │ ├── FileNameFromBlobBuilder.java │ │ ├── FileSplitSeparatorLine.java │ │ ├── FrameworkDebug.java │ │ ├── FrameworkFileUtil.java │ │ ├── FrameworkSystemUtil.java │ │ ├── HtmlConverter.java │ │ ├── IpUtil.java │ │ ├── JdbcUrlHeader.java │ │ ├── KeepTempFilePolicyParms.java │ │ ├── MapCopier.java │ │ ├── SqlActionCallable.java │ │ ├── SqlActionTransaction.java │ │ ├── SqlEventUtil.java │ │ ├── SqlReturnCode.java │ │ ├── SqlTag.java │ │ ├── Tag.java │ │ ├── TimestampUtil.java │ │ ├── parser │ │ │ ├── SqlCommentsDetector.java │ │ │ ├── SqlStringTokenizer.java │ │ │ ├── StatementAnalyzerUtil.java │ │ │ └── keywords │ │ │ │ ├── SqlKeywords.java │ │ │ │ ├── SqlKeywordsArray.java │ │ │ │ └── tools │ │ │ │ ├── SqlKeywordsClassBuilder.java │ │ │ │ ├── SqlKeywordsFileReader.java │ │ │ │ ├── SqlKeywordsTemplate.java │ │ │ │ ├── SqlKeywordsTest.java │ │ │ │ └── sql_keywords.txt │ │ └── reflection │ │ │ ├── ClassSerializer.java │ │ │ ├── Invoker.java │ │ │ └── ReflectionCaller.java │ │ └── version │ │ ├── EditionUtil.java │ │ ├── Vendor.java │ │ ├── VersionValues.java │ │ └── VersionWrapper.java ├── main.iml └── resources │ ├── DefaultLoggerCreator.properties │ ├── JsonLoggerSqlFirewallTrigger.properties │ ├── JsonLoggerUpdateListener.properties │ └── dummy.txt └── test ├── java ├── README.txt ├── com │ └── mycompany │ │ ├── MyLdapUserAuthenticator.java │ │ └── MyLdapUserAuthenticatorUtil.java └── org │ └── kawanfw │ ├── sql │ └── server │ │ └── session │ │ └── test │ │ ├── AuthSessionTest.java │ │ ├── JwtSessionConfiguratorTest.java │ │ └── SessionIdentifierGeneratorTest.java │ └── test │ ├── api │ └── server │ │ ├── App.java │ │ ├── JSQLParserTest.java │ │ ├── StatementAnalyzerTest.java │ │ ├── TestTomcatJdbcPoolBehavior.java │ │ ├── auth │ │ ├── MyRequestHeadersAuthenticator.java │ │ ├── SshUserAuthenticatorTest.java │ │ ├── TestAll.java │ │ └── WindowsUserAuthenticatorTest.java │ │ └── config │ │ ├── JsonLoggerUpdateListenerTest.java │ │ ├── MyUpdateListener.java │ │ ├── PropertiesPasswordManagerTest.java │ │ ├── SqlFirewallTriggerUtilTest.java │ │ ├── TestDatabaseConfigurator.java │ │ ├── TestThreadPoolExecutorStore.java │ │ └── TestUserAuthenticator.java │ ├── parms │ ├── ConnectionLoader.java │ ├── ConnectionLoaderJdbcInfo.java │ ├── JdbcDriverParms.java │ ├── ProxyLoader.java │ └── SqlTestParms.java │ ├── run │ └── server │ │ ├── .gitignore │ │ ├── SqlWebServerStartAuthLDAP.java │ │ ├── SqlWebServerStartAuthWindows.java │ │ ├── SqlWebServerStartNew.java │ │ ├── SqlWebServerStartNewSimple.java │ │ ├── SqlWebServerStartSqlServer.java │ │ ├── SqlWebServerStartStateless.java │ │ ├── SqlWebServerStopNew.java │ │ └── stateless │ │ └── SqlWebServerStartStateless.java │ ├── sql │ └── metadata │ │ └── aceql │ │ ├── AceQLMetaDataTest.java │ │ ├── AceQLMetaDataTestDatabaseMetaData.java │ │ ├── AceQLMetaDataTestShort.java │ │ ├── ConnectionParms.java │ │ ├── GsonWsUtiltest.java │ │ ├── MetaDataJavaPrinter.java │ │ └── RegExTests.java │ ├── stored_procedure │ ├── Main.java │ ├── TestOracleStruct.java │ ├── TestStoredProcedureCommons.java │ ├── TestStoredProcedureMySql.java │ ├── TestStoredProcedureOracleLocal.java │ └── TestStoredProcedureSqlServer.java │ └── util │ ├── .gitignore │ ├── ClobCreator.java │ ├── JsonDatabaseMetaDataTest.java │ ├── JsonSecurityMessageTest.java │ ├── LdapSample.java │ ├── Memory.java │ ├── MessageDisplayer.java │ ├── PoolPropertiesTest.java │ ├── SqlServerUtf8TestSqlServer.java │ ├── StatementNormalizerTest.java │ ├── StoredProcedureTest.java │ ├── TestMisc.java │ ├── TestReflection.java │ ├── UUIDGenerator.java │ ├── UserPrefManager.java │ ├── UsernameConverterTest.java │ └── WaffleTest.java ├── resources └── dummy.txt └── test.iml /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /lib/ 2 | /javadoc/ 3 | /RELEASE-NOTES.txt 4 | /private/ 5 | /target/ 6 | /dist/ 7 | /aceql-http-overview.html 8 | /README_new.md 9 | /javadoc.xml 10 | /src_180224_1706.zip 11 | /src_180224_1819.zip 12 | /md/ 13 | /aceql-http.iml 14 | /aceql-http-client-sdk-overview.html 15 | /NEW_WEB/ 16 | /javadoc_SAVE/ 17 | /lib-aceql-http-pro/ 18 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | aceql-http 4 | AceQL HTTP is a framework of REST like http APIs that allow to access to remote SQL databases over http from any device that supports http. 5 | 6 | AceQL HTTP is provided with three client SDK: 7 | - The AceQL C# Client SDK allows to wrap the HTTP APIs using Microsoft SQL Server like calls in their code, just like they would for a local database. 8 | - The AceQL Java Client JDBC Driver allows to wrap the HTTP APIs using JDBC calls in their code, just like they would for a local database. 9 | - The AceQL Python Client SDK allows SQL calls to be encoded with standard unmodified DB-API 2.0 syntax. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//private/NEW_WEB/new_web_todo.txt=UTF-8 3 | encoding//src/test/java/org/kawanfw/test/util/SqlServerUtf8TestSqlServer.java=UTF-8 4 | encoding/src=ISO-8859-1 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | =\=\=\=\=\=\= 2 | <<<<<<<=HEAD 3 | >>>>>>>=refs/heads/12.0 4 | eclipse.preferences.version=1 5 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 6 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 7 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 8 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 9 | org.eclipse.jdt.core.compiler.compliance=1.8 10 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 11 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 12 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 13 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 14 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 15 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 16 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 17 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 18 | org.eclipse.jdt.core.compiler.release=disabled 19 | org.eclipse.jdt.core.compiler.source=1.8 20 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /bin/aceql-server.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | REM ******************************************************************** 3 | REM AceQL Web Server Launcher * * * * 4 | REM ******************************************************************** 5 | 6 | set ACEQL_HOME=%CD% 7 | set ACEQL_HOME=%ACEQL_HOME:~0,-4% 8 | 9 | java -Xms256M -Xmx4096M -classpath "%ACEQL_HOME%\lib-server\*";"%ACEQL_HOME%\lib-jdbc\*";%CLASSPATH% -Dfrom.aceql-server.script=true org.kawanfw.sql.WebServer %1 %2 %3 %4 %5 %6 %7 10 | 11 | -------------------------------------------------------------------------------- /bin/post-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | chmod +x bin/aceql-server 3 | chmod +x bin/aceqlhttp 4 | rm -f bin/post-install.sh 5 | -------------------------------------------------------------------------------- /bin/properties-encryptor.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | REM ******************************************************************** 3 | REM AceQL Web Server Launcher * * * * 4 | REM ******************************************************************** 5 | 6 | set ACEQL_HOME=%CD% 7 | set ACEQL_HOME=%ACEQL_HOME:~0,-4% 8 | 9 | java -Xms256M -Xmx4096M -classpath "%ACEQL_HOME%\lib-server\*";"%ACEQL_HOME%\lib-jdbc\*";%CLASSPATH% -Dfrom.aceql-server.script=true org.kawanfw.sql.api.server.auth.crypto.PropertiesEncryptor 10 | 11 | -------------------------------------------------------------------------------- /conf/.gitignore: -------------------------------------------------------------------------------- 1 | /aceql-server-advanced.properties 2 | /aceql-server-ORIGINAL.properties 3 | /_ORIGINAL-aceql-server.properties 4 | -------------------------------------------------------------------------------- /conf/cloudmersive.properties: -------------------------------------------------------------------------------- 1 | ###################################################################################################### 2 | # cloudmersive.properties 3 | # 4 | # Properties for using SqlInjectionDetectionManager implementation of SqlFirewallManager 5 | # 6 | # See: 7 | # 1) https://cloudmersive.medium.com/check-text-for-sql-injection-attacks-in-java-4343a8731c7a sample 8 | # for value examples. 9 | # 2) https://account.cloudmersive.com/documentation for complete Cloudmersive documentation. 10 | ###################################################################################################### 11 | 12 | # The API key. 13 | apiKey= 14 | 15 | # The Prefix for the API key. 16 | # Optional - defaults to null. 17 | #apiKeyPrefix=Token 18 | 19 | # The detection level. Normal or High. 20 | # Optional - defaults to Normal. 21 | detectionLevel=High 22 | -------------------------------------------------------------------------------- /conf/dvdrental.txt: -------------------------------------------------------------------------------- 1 | List of relations 2 | Schema | Name | Type | Owner 3 | --------+---------------+-------+---------- 4 | public | actor | table | postgres 5 | public | address | table | postgres 6 | public | category | table | postgres 7 | public | city | table | postgres 8 | public | country | table | postgres 9 | public | customer | table | postgres 10 | public | film | table | postgres 11 | public | film_actor | table | postgres 12 | public | film_category | table | postgres 13 | public | inventory | table | postgres 14 | public | language | table | postgres 15 | public | payment | table | postgres 16 | public | rental | table | postgres 17 | public | staff | table | postgres 18 | public | store | table | postgres 19 | -------------------------------------------------------------------------------- /conf/dvdrental_rules_manager.csv: -------------------------------------------------------------------------------- 1 | username;table;delete;insert;select;update;optional comments 2 | public;all;false;false;true;false;SELECT only is allowed on all tables for all users 3 | user1;actor;true;true;true;true;actor table can be updated/deleted 4 | user1;film_actor;true;true;true;true;film_actor table can be updated/deleted 5 | -------------------------------------------------------------------------------- /conf/sampledb_rules_manager.csv: -------------------------------------------------------------------------------- 1 | username;table;delete;insert;select;update;optional comments 2 | public;all;false;false;true;false;SELECT is allowed on all tables for all users 3 | user1;all;false;true;true;true;user1 is allowed to execute all DML operations except DELETE 4 | user1;orderlog;true;true;true;true;user may delete orderlog 5 | user2;customer;false;true;true;true;user2 is allowed to execute all DML operations on customer, orderlog and documentation, except DELETE 6 | user2;orderlog;false;true;true;true; 7 | user2;documentation;false;true;true;true; 8 | -------------------------------------------------------------------------------- /conf_test/.gitignore: -------------------------------------------------------------------------------- 1 | /aceql_license_key.txt 2 | /_aceql_license_key.txt 3 | /_SAVE_aceql_license_key.txt 4 | /cloudmersive.properties 5 | -------------------------------------------------------------------------------- /conf_test/cloudmersive.properties: -------------------------------------------------------------------------------- 1 | ###################################################################################################### 2 | # cloudmersive.properties 3 | # 4 | # Properties for using SqlInjectionDetectionManager implementation of SqlFirewallManager 5 | # 6 | # See: 7 | # 1) https://cloudmersive.medium.com/check-text-for-sql-injection-attacks-in-java-4343a8731c7a sample 8 | # for value examples. 9 | # 2) https://account.cloudmersive.com/documentation for complete Cloudmersive documentation. 10 | ###################################################################################################### 11 | 12 | # The API key. 13 | apiKey= 14 | 15 | # The Prefix for the API key. 16 | # Optional - defaults to null. 17 | #apiKeyPrefix=Token 18 | 19 | # The detection level. Normal or High. 20 | # Optional - defaults to Normal. 21 | detectionLevel=High 22 | -------------------------------------------------------------------------------- /conf_test/dvdrental_deny_blacklist.txt: -------------------------------------------------------------------------------- 1 | select * from actor 2 | select * from film_actor 3 | 4 | 5 | -------------------------------------------------------------------------------- /conf_test/dvdrental_deny_except_whitelist.txt: -------------------------------------------------------------------------------- 1 | SELECT * FROM film 2 | SELECT * FROM actor 3 | -------------------------------------------------------------------------------- /conf_test/dvdrental_rules_manager.csv: -------------------------------------------------------------------------------- 1 | username;table;delete;insert;select;update;optional comments 2 | public;all;false;false;true;false;tables cannot be updated/deleted 3 | user1;film_actor;true;true;true;false;film_actor table can be updated/deleted. 4 | -------------------------------------------------------------------------------- /conf_test/properties_password_manager.properties: -------------------------------------------------------------------------------- 1 | password=loveme$123 -------------------------------------------------------------------------------- /conf_test/sampledb_rules_manager.csv: -------------------------------------------------------------------------------- 1 | username;table;delete;insert;select;update;optional comments 2 | public;all;false;false;true;false;SELECT is allowed on all tables for all users 3 | user1;all;false;true;true;true;user1 is allowed to execute all DML operations except DELETE 4 | user1;orderlog;true;true;true;true;user may delete orderlog 5 | user2;customer;false;true;true;true;user2 is allowed to execute all DML operations on customer, orderlog and documentation, except DELETE 6 | user2;orderlog;false;true;true;true; 7 | user2;documentation;false;true;true;true; 8 | -------------------------------------------------------------------------------- /legal/PostgreSQLLicense.txt: -------------------------------------------------------------------------------- 1 | PostgreSQL Database Management System 2 | (formerly known as Postgres, then as Postgres95) 3 | 4 | Portions Copyright (c) 1996-2015, The PostgreSQL Global Development Group 5 | 6 | Portions Copyright (c) 1994, The Regents of the University of California 7 | 8 | Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. 9 | 10 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | 12 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- /sql/aceql_demo.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Kawansoft aceql_demo database 3 | -- 4 | -- NOTES 5 | -- Change the type of the following columns according to your database: 6 | -- ==> product_image.image 7 | 8 | CREATE TABLE users 9 | ( 10 | username varchar(300) not null, 11 | encrypted_password varchar(300) not null, 12 | PRIMARY KEY (username) 13 | ); 14 | 15 | CREATE TABLE customer 16 | ( 17 | customer_id integer not null, 18 | customer_title char(4) null, 19 | fname varchar(32) null, 20 | lname varchar(32) not null, 21 | addressline varchar(64) not null, 22 | town varchar(32) not null, 23 | zipcode char(10) not null, 24 | phone varchar(32) null, 25 | PRIMARY KEY(customer_id) 26 | ); 27 | 28 | CREATE TABLE product_image 29 | ( 30 | product_id integer not null, 31 | name varchar(64) not null, 32 | 33 | -- longblob for MySQL 34 | -- blob for DB2 & HSQLDB & Informix & Oracle & Terradata 35 | -- oid For PostgreSQL / VarBinary(max) for SQL Server 36 | -- Image for Sybase AES & Sybase SQL Anywhere 37 | image oid null, 38 | 39 | PRIMARY KEY(product_id) 40 | ); 41 | 42 | -- 43 | -- Init the users table with a (username, encrypted_password) 44 | -- 45 | 46 | insert into users values ('username', '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'); -------------------------------------------------------------------------------- /sql/array_example.sql: -------------------------------------------------------------------------------- 1 | 2 | -- 3 | -- HSQLDB 4 | -- 5 | 6 | create table REGIONS 7 | (REGION_NAME varchar(32) NOT NULL, 8 | ZIPS varchar(32) ARRAY[10] NOT NULL, 9 | PRIMARY KEY (REGION_NAME)); 10 | 11 | insert into REGIONS values( 12 | 'Northwest', 13 | ARRAY['93101', '97201', '99210']); 14 | 15 | insert into REGIONS values( 16 | 'Southwest', 17 | ARRAY['94105', '90049', '92027']); 18 | 19 | -- 20 | -- Postgres 21 | -- 22 | 23 | create table REGIONS 24 | (REGION_NAME varchar(32) NOT NULL, 25 | ZIPS varchar(32) ARRAY[10] NOT NULL, 26 | PRIMARY KEY (REGION_NAME)); 27 | 28 | insert into REGIONS values( 29 | 'Northwest', 30 | '{"93101", "97201", "99210"}'); 31 | 32 | insert into REGIONS values( 33 | 'Southwest', 34 | '{"94105", "90049", "92027"}'); 35 | 36 | create table REGIONS_INTEGER 37 | (REGION_NAME varchar(32) NOT NULL, 38 | ZIPS integer ARRAY[10] NOT NULL, 39 | PRIMARY KEY (REGION_NAME)); 40 | 41 | insert into REGIONS_INTEGER values( 42 | 'Northwest', 43 | '{93101, 97201, 99210}'); 44 | 45 | insert into REGIONS_INTEGER values( 46 | 'Southwest', 47 | '{94105, 90049, 92027}'); 48 | -- 49 | -- ORACLE 50 | -- 51 | 52 | -- We must create a type for an array: 53 | CREATE OR REPLACE TYPE vcarray AS VARRAY(10) OF VARCHAR(32); 54 | 55 | -- We use the type in create table & insert 56 | create table REGIONS 57 | (REGION_NAME varchar(32) NOT NULL, 58 | ZIPS vcarray NOT NULL, 59 | PRIMARY KEY (REGION_NAME)); 60 | 61 | insert into REGIONS values( 62 | 'Northwest', vcarray('93101', '97201', '99210')); 63 | 64 | insert into REGIONS values( 65 | 'Southwest', vcarray('94105', '90049', '92027')); 66 | -------------------------------------------------------------------------------- /sql/customer_2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE customer_2 2 | ( 3 | customer_id integer not null, 4 | customer_title char(4) null, 5 | fname varchar(32) null, 6 | lname varchar(32) not null, 7 | addressline varchar(64) not null, 8 | town varchar(32) not null, 9 | zipcode char(10) not null, 10 | phone varchar(32) null, 11 | row_2 varchar(32) null, 12 | row_count varchar(32) null, 13 | PRIMARY KEY(customer_id) 14 | ); -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/SqlEventWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server; 13 | 14 | import java.sql.SQLException; 15 | import java.util.List; 16 | 17 | /** 18 | * A internal wrapper for Java package protected calls.
19 | * This is an internal undocumented class that should not be used nor called by 20 | * the users of the AceQL APis. 21 | * 22 | * @author Nicolas de Pomereu 23 | * @since 9.0 24 | */ 25 | 26 | public class SqlEventWrapper { 27 | 28 | 29 | protected SqlEventWrapper() { 30 | 31 | } 32 | 33 | public static SqlEvent sqlEventBuild(String username, String database, String ipAddress, String sql, 34 | boolean isPreparedStatement, List parameterValues, boolean isMetadataQuery) throws SQLException { 35 | return new SqlEvent(username, database, ipAddress, sql, isPreparedStatement, parameterValues, isMetadataQuery); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/crypto/PropertiesEncryptorWrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.auth.crypto; 13 | 14 | import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; 15 | import org.jasypt.iv.RandomIvGenerator; 16 | 17 | /** 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | class PropertiesEncryptorWrap { 22 | 23 | public static StandardPBEStringEncryptor createEncryptor(String password) { 24 | StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); 25 | encryptor.setPassword(password); 26 | encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); 27 | encryptor.setIvGenerator(new RandomIvGenerator()); 28 | return encryptor; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/crypto/PropertiesPasswordManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.auth.crypto; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | 17 | /** 18 | * Interface that defines how to get the password used to encrypt the 19 | * {@code Properties} of the {@code aceql-server.properties} file.
20 | * The password must have been previously created with the 21 | * {@link PropertiesEncryptor} class called via command line 22 | * {@code properties-encryptor.bat} on Windows or {@code properties-encryptor} Bash script 23 | * on Unix.
24 | *
25 | * Implement the {@code getPassword()} in your own 26 | * {@code PropertiesPasswordManager} concrete method or use the provided 27 | * {@link DefaultPropertiesPasswordManager} implementation. 28 | * 29 | * @author Nicolas de Pomereu 30 | * @since 7.0 31 | */ 32 | public interface PropertiesPasswordManager { 33 | 34 | /** 35 | * Returns the password to use to decrypt the encrypted the {@code Properties} 36 | * of the {@code aceql-server.properties} file. 37 | * 38 | * @return the password to use to decrypt the {@code Properties} of the 39 | * {@code aceql-server.properties} file. 40 | * @throws IOException if an IOException occurs 41 | * @throws SQLException if a SQLException occurs 42 | */ 43 | public char[] getPassword() throws IOException, SQLException; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/crypto/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides an interface in order to decrypt with a password the Properties encrypted in the aceql-server.properties file. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/headers/RequestHeadersAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.auth.headers; 13 | 14 | import java.io.IOException; 15 | import java.util.Map; 16 | 17 | import org.kawanfw.sql.api.server.auth.UserAuthenticator; 18 | 19 | /** 20 | * Allows authenticating a client user using the request headers set and sent from 21 | * the client side.
22 | *
23 | * This allows an alternate or supplementary authentication to 24 | * {@link UserAuthenticator}.
25 | *
26 | * Typical usage would be to send - using HTTP - an authentication token stored 27 | * in one of the request headers to a remote cloud provider. 28 | * 29 | * @author Nicolas de Pomereu 30 | * @since 6.3 31 | */ 32 | public interface RequestHeadersAuthenticator { 33 | 34 | /** 35 | * Allows to check/validate the request headers as a mean of client 36 | * authentication. If method returns {@code false}, user will not be granted 37 | * access. 38 | * 39 | * @param headers the request headers sent by the client side. 40 | * @return {@code true} if request headers are OK and validated. If 41 | * {@code false}, the client side will not be authorized to send any 42 | * command. 43 | * @throws IOException if an IOException occurs 44 | */ 45 | public boolean validate(Map headers) throws IOException; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/headers/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides an interface in order to authenticate client user using request headers. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/auth/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides an interface and concrete ready to plug-and-play implementations in order to authenticate remote client users. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/blob/DefaultBlobDownloadConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.blob; 13 | 14 | import java.io.File; 15 | import java.io.FileNotFoundException; 16 | import java.io.IOException; 17 | import java.io.OutputStream; 18 | import java.nio.file.Files; 19 | 20 | import javax.servlet.http.HttpServletRequest; 21 | 22 | /** 23 | * 24 | * Class that allows downloading Blob/Clobs. Default implementation.
25 | * It is not required nor recommended to extend this class or to develop another 26 | * {@code BlobDownloadConfigurator} implementation.
27 | * Extend this class and override 28 | * {@link #download(HttpServletRequest, File, OutputStream)} only if you want to 29 | * implement your own advanced download mechanism with special features: file 30 | * chunking, recovery mechanisms, etc. 31 | * 32 | * @author Nicolas de Pomereu 33 | * 34 | */ 35 | public class DefaultBlobDownloadConfigurator implements BlobDownloadConfigurator { 36 | 37 | /** 38 | * Simple copy of file to download on Servlet output stream. 39 | */ 40 | @Override 41 | public void download(HttpServletRequest request, File file, OutputStream outputStream) throws IOException { 42 | 43 | if (!file.exists()) { 44 | throw new FileNotFoundException("File does not exist: " + file.getName()); 45 | } 46 | 47 | Files.copy(file.toPath(), outputStream); 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/blob/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | 23 | Provides classes and interfaces to download or upload Blobs/Clobs. 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/connectionstore/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | 23 | Provides classes to manage the JDBC Connections stored in memory on server side. 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/executor/ClientEventWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.executor; 13 | 14 | import java.sql.SQLException; 15 | import java.util.List; 16 | 17 | /** 18 | * A internal wrapper for Java package protected calls.
19 | * This is an internal undocumented class that should not be used nor called by 20 | * the users of the AceQL APis. 21 | * 22 | * @author Nicolas de Pomereu 23 | * @since 9.0 24 | */ 25 | 26 | public class ClientEventWrapper { 27 | 28 | protected ClientEventWrapper() { 29 | 30 | } 31 | 32 | public static ClientEvent builderClientEvent(String username, String database, String ipAddress, 33 | List parameterValues) throws SQLException { 34 | return new ClientEvent(username, database, ipAddress, parameterValues); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/executor/ServerQueryExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.executor; 13 | 14 | import java.io.IOException; 15 | import java.sql.Connection; 16 | import java.sql.ResultSet; 17 | import java.sql.SQLException; 18 | 19 | /** 20 | * Implementation of this interface allow client side to call a server side 21 | * programmed class that returns a {@code ResultSet}.
22 | * This is a a kind of AceQL stored procedure written in Java.
23 | * 24 | * @author Nicolas de Pomereu 25 | * @since 10.1 26 | * 27 | */ 28 | public interface ServerQueryExecutor { 29 | 30 | /** 31 | * Executes a query and returns {@code ResultSet} for the client-side. 32 | * 33 | * @param clientEvent contains all info about the request asked by the client 34 | * side 35 | * @param connection the current SQL/JDBC Connection. 36 | * @return a ResultSet object that contains the data produced by 37 | * the query; never null 38 | * @throws IOException if an IOException occurs 39 | * @throws SQLException if a SQLException occurs 40 | */ 41 | public ResultSet executeQuery(ClientEvent clientEvent, Connection connection) throws IOException, SQLException; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/executor/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides an interface that allows implementing server-side coded SQL queries. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/firewall/CsvRulesManagerNoReload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.firewall; 13 | /** 14 | * Firewall manager that extends {@code CsvRulesManager}, the only change is 15 | * to prohibit reloading rules when the CSV file is updated. 16 | * 17 | * @author Nicolas de Pomereu 18 | * @since 10.0 19 | */ 20 | 21 | public class CsvRulesManagerNoReload extends CsvRulesManager { 22 | 23 | /** 24 | * Constructor. 25 | */ 26 | public CsvRulesManagerNoReload() { 27 | super.allowReload = false; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/firewall/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides interface and default implementation for SQL firewalling. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/firewall/trigger/BeeperSqlFirewallTrigger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.firewall.trigger; 13 | 14 | import java.io.IOException; 15 | import java.sql.Connection; 16 | import java.sql.SQLException; 17 | 18 | import javax.sound.sampled.LineUnavailableException; 19 | 20 | import org.kawanfw.sql.api.server.SqlEvent; 21 | import org.kawanfw.sql.api.server.firewall.SqlFirewallManager; 22 | import org.kawanfw.sql.servlet.util.BeepUtil; 23 | 24 | /** 25 | * A trigger that simply beeps on the terminal if an attack is detected by a 26 | * {@code SqlFirewallManager}.
27 | * Uses a slightly modified 28 | * GitHub Gist 29 | * created by Jacek Bzdak. 30 | * 31 | * @author Nicolas de Pomereu 32 | * @since 11.0 33 | */ 34 | public class BeeperSqlFirewallTrigger implements SqlFirewallTrigger { 35 | 36 | /** 37 | * Beeps on terminal if an attack is detected by a {@code SqlFirewallManager} 38 | */ 39 | @Override 40 | public void runIfStatementRefused(SqlEvent sqlEvent, SqlFirewallManager sqlFirewallManager, Connection connection) 41 | throws IOException, SQLException { 42 | try { 43 | BeepUtil.beep(750, 1000); 44 | } catch (InterruptedException | LineUnavailableException e) { 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/firewall/trigger/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides interface and default implementation for triggers when SqlFirewallManager instances detect an attack. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/listener/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides update listener interface and classes that allow triggering actions following a successful database update. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/logging/LoggerCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.logging; 13 | 14 | import java.io.IOException; 15 | import java.util.Map; 16 | 17 | import org.slf4j.Logger; 18 | 19 | /** 20 | * Allows to create a neutral sl4fj Logger that thus will support many implementations. 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public interface LoggerCreator { 25 | 26 | /** 27 | * Returns the Logger as sl4fj instance 28 | * @return the Logger as sl4fj instance 29 | * @throws IOException if any I/O error occurs at Logger creation 30 | */ 31 | public Logger getLogger() throws IOException; 32 | 33 | /** 34 | * Return the elements of the {@code Logger}: name, fileNamePattern, etc. 35 | * This allows to give admin users info about the {@code Logger} when stating the programe. 36 | * Implementation is free. 37 | * @return the elements of the Logger 38 | */ 39 | public Map getElements(); 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/logging/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides interface and default implementation for Loggers. 23 | Package includes built in and ready to use classes. 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides classes and interfaces to configure the Server SQL Manager. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/session/SessionIdentifierGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.session; 13 | 14 | import java.security.SecureRandom; 15 | 16 | /** 17 | * 18 | * Session id generator with 26 long strings. 19 | *

20 | * Uses a static {@code SecureRandom}.
21 | * Each call to {@code nextSessionId()} calls {@code SecureRandom#nextInt(int)}. 22 | *
23 | * See Open Source Edition source 25 | * code. 26 | * 27 | * @author Nicolas de Pomereu 28 | * 29 | */ 30 | public class SessionIdentifierGenerator { 31 | 32 | private static final String AB = "0123456789abcdefghijklmnopqrstuvwxyz"; 33 | private static SecureRandom rnd = new SecureRandom(); 34 | 35 | /** 36 | * Returns the next session id using a {@code SecureRandom} 37 | * 38 | * @return the next session id using a {@code SecureRandom} 39 | */ 40 | public String nextSessionId() { 41 | return randomString(26); 42 | } 43 | 44 | private String randomString(int len) { 45 | StringBuilder sb = new StringBuilder(len); 46 | for (int i = 0; i < len; i++) 47 | sb.append(AB.charAt(rnd.nextInt(AB.length()))); 48 | return sb.toString(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/session/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides classes to define how client sessions are managed. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/util/NoFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.util; 13 | 14 | import java.util.logging.Formatter; 15 | import java.util.logging.LogRecord; 16 | 17 | /** 18 | * A nothing to do formatter. 19 | * 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class NoFormatter extends Formatter { 24 | 25 | @Override 26 | public String format(final LogRecord record) { 27 | return String.format("%1$s\n", formatMessage(record)); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/util/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.util; 13 | 14 | import org.kawanfw.sql.version.VersionWrapper; 15 | 16 | /** 17 | * 18 | * Allows to get version info. 19 | * 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | 24 | public class Version { 25 | 26 | /** 27 | * Returns the product name, version and date 28 | * @return the product name, version and date 29 | */ 30 | public String getVersion() { 31 | return VersionWrapper.getServerVersion(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/util/VerySimpleFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.server.util; 13 | 14 | import java.text.SimpleDateFormat; 15 | import java.util.Date; 16 | import java.util.logging.Formatter; 17 | import java.util.logging.LogRecord; 18 | 19 | /** 20 | * A very simple formatter on one line Stolen on 21 | * https://stackoverflow.com/questions/194765/how-do-i-get-java-logging-output-to-appear-on-a-single-line 22 | * 23 | * @author Nicolas de Pomereu 24 | * 25 | */ 26 | public class VerySimpleFormatter extends Formatter { 27 | 28 | private static final String PATTERN = "yyyy-MM-dd HH:mm:ss.SSS"; 29 | 30 | @Override 31 | public String format(final LogRecord record) { 32 | return String.format("%1$s %2$-7s %3$s\n", new SimpleDateFormat(PATTERN).format(new Date(record.getMillis())), 33 | record.getLevel().getName(), 34 | formatMessage(record)); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides utility classes. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/server/web/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides class to start and stop the embedded Web Server from a Java program. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/StatementAnalyzerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class StatementAnalyzerUtil { 19 | 20 | /** 21 | * Replace fulltext with _fulltext_ because of a bug in JSQLParser. 22 | * @param sql the sql query 23 | * @return the sql query with fulltext replaced by _fulltext_ and FULLTEXT replaced by _FULLTEXT_ 24 | */ 25 | public static String fixForJsqlparser(final String sql) { 26 | 27 | if (sql == null) { 28 | return null; 29 | } 30 | 31 | String theSql = sql; 32 | if (theSql.contains(" fulltext")) { 33 | theSql = theSql.replace(" fulltext", " _fulltext_"); 34 | } 35 | if (theSql.contains(" FULLTEXT")) { 36 | theSql = theSql.replace(" FULLTEXT", " _FULLTEXT_"); 37 | } 38 | if (theSql.contains("fulltext ")) { 39 | theSql = theSql.replace("fulltext ", "_fulltext_ "); 40 | } 41 | if (theSql.contains("FULLTEXT ")) { 42 | theSql = theSql.replace("FULLTEXT ", "_FULLTEXT_ "); 43 | } 44 | 45 | return theSql; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/firewall/IllegalFirstLineException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util.firewall; 13 | 14 | import java.io.File; 15 | 16 | public class IllegalFirstLineException extends IllegalArgumentException { 17 | 18 | private static final long serialVersionUID = -7299666473941182269L; 19 | 20 | public IllegalFirstLineException(File file, String s) { 21 | super(file.getName() + ": " + s); 22 | } 23 | 24 | public IllegalFirstLineException(Throwable cause) { 25 | super(cause); 26 | } 27 | 28 | public IllegalFirstLineException(String message, Throwable cause) { 29 | super(message, cause); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/firewall/IllegalStatementAllowBooleanValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util.firewall; 13 | 14 | import java.io.File; 15 | 16 | public class IllegalStatementAllowBooleanValue extends IllegalArgumentException { 17 | 18 | private String statement = null; 19 | private int lineNumber = -1; 20 | 21 | private static final long serialVersionUID = 3329147381309094047L; 22 | 23 | public IllegalStatementAllowBooleanValue(File file, String value, String statement, int lineNumber) { 24 | super(file.getName() + ": " + "value \"" + value + "\" is not of expected \"false\" or \"true\" for \"" + statement + "\" column (line " + lineNumber + ")."); 25 | this.statement = statement; 26 | this.lineNumber = lineNumber; 27 | } 28 | 29 | public String getStatement() { 30 | return statement; 31 | } 32 | 33 | public int getLineNumber() { 34 | return lineNumber; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/firewall/IllegalTableNameException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util.firewall; 13 | 14 | import java.io.File; 15 | 16 | public class IllegalTableNameException extends IllegalArgumentException { 17 | 18 | private static final long serialVersionUID = -1392006668676537022L; 19 | 20 | private String table = null; 21 | private int lineNumber = -1; 22 | 23 | public IllegalTableNameException(File file, String table, int lineNumber) { 24 | super(file.getName() + ": " + "table \"" + table + "\" does no exists in database (line " + lineNumber + ")."); 25 | this.table = table; 26 | this.lineNumber = lineNumber; 27 | } 28 | 29 | public String getTable() { 30 | return table; 31 | } 32 | 33 | public int getLineNumber() { 34 | return lineNumber; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/firewall/SqlFirewallTriggerWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util.firewall; 13 | 14 | import java.io.IOException; 15 | import java.sql.Connection; 16 | import java.sql.SQLException; 17 | import java.util.Objects; 18 | import java.util.Set; 19 | 20 | import org.kawanfw.sql.api.server.SqlEvent; 21 | import org.kawanfw.sql.api.server.firewall.SqlFirewallManager; 22 | import org.kawanfw.sql.api.server.firewall.trigger.SqlFirewallTrigger; 23 | import org.kawanfw.sql.servlet.injection.classes.InjectedClassesStore; 24 | 25 | /** 26 | * @author Nicolas de Pomereu 27 | * 28 | */ 29 | public class SqlFirewallTriggerWrapper { 30 | 31 | public static void runIfStatementRefused(SqlEvent sqlEvent, SqlFirewallManager sqlFirewallManager, 32 | Connection connection) throws IOException, SQLException { 33 | Objects.requireNonNull(sqlEvent, "sqlEvent cannot be null!"); 34 | Objects.requireNonNull(sqlFirewallManager, "sqlFirewallManager cannot be null!"); 35 | Objects.requireNonNull(connection, "connection cannot be null!"); 36 | 37 | String database = sqlEvent.getDatabase(); 38 | 39 | Set sqlFirewallTriggers = InjectedClassesStore.get().getSqlFirewallTriggerMap() 40 | .get(database); 41 | 42 | for (SqlFirewallTrigger sqlFirewallTrigger : sqlFirewallTriggers) { 43 | sqlFirewallTrigger.runIfStatementRefused(sqlEvent, sqlFirewallManager, connection); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/api/util/firewall/cloudmersive/DenySqlInjectionManagerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.api.util.firewall.cloudmersive; 13 | 14 | import java.io.File; 15 | import java.io.FileNotFoundException; 16 | import java.util.Objects; 17 | 18 | import org.kawanfw.sql.servlet.injection.properties.PropertiesFileStore; 19 | 20 | public class DenySqlInjectionManagerUtil { 21 | 22 | /** 23 | * Returns the {@code cloudmersive.properties} file 24 | * 25 | * @return {@code cloudmersive.properties} file 26 | * @throws FileNotFoundException if the file does not exist. 27 | */ 28 | public static File getCloudmersivePropertiesFile() throws FileNotFoundException { 29 | File file = PropertiesFileStore.get(); 30 | 31 | Objects.requireNonNull(file, "file cannot be null!"); 32 | 33 | if (!file.exists()) { 34 | throw new FileNotFoundException("The properties file does not exist: " + file); 35 | } 36 | 37 | File dir = PropertiesFileStore.get().getParentFile(); 38 | File cloudmersivePropertiesFile = new File(dir + File.separator + "cloudmersive.properties"); 39 | 40 | if (!cloudmersivePropertiesFile.exists()) { 41 | throw new FileNotFoundException( 42 | "The cloudmersive.properties file does not exist: " + cloudmersivePropertiesFile); 43 | } 44 | 45 | return cloudmersivePropertiesFile; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/jdbc/metadata/BooleanResponseDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.jdbc.metadata; 13 | /** 14 | * A boolean response DTO. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | 19 | public class BooleanResponseDTO { 20 | 21 | private String status = "OK"; 22 | private Boolean response; 23 | 24 | /** 25 | * Constructor. 26 | * @param response the true/false response. 27 | */ 28 | public BooleanResponseDTO(boolean response) { 29 | super(); 30 | this.response = response; 31 | } 32 | 33 | public Boolean getResponse() { 34 | return response; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "BooleanResponseDTO [status=" + status + ", response=" + response + "]"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/CatalogAndSchema.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata; 13 | /** 14 | * Parent of all metadata of objects: they all belong to a catalog and schema. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | 19 | public class CatalogAndSchema { 20 | 21 | private String catalog = ""; 22 | private String schema = ""; 23 | 24 | public String getCatalog() { 25 | return catalog; 26 | } 27 | void setCatalog(String catalog) { 28 | this.catalog = catalog; 29 | } 30 | public String getSchema() { 31 | return schema; 32 | } 33 | void setSchema(String schema) { 34 | this.schema = schema; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/ExportedKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata; 13 | 14 | import java.sql.DatabaseMetaData; 15 | 16 | /** 17 | * Metadata object that wraps the result of {@link DatabaseMetaData#getExportedKeys(String, String, String)} 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class ExportedKey extends ForeignKey { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/ImportedKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata; 13 | 14 | import java.sql.DatabaseMetaData; 15 | 16 | /** 17 | * Metadata object that wraps the result of 18 | * {@link DatabaseMetaData#getImportedKeys(String, String, String)} 19 | * 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class ImportedKey extends ForeignKey { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/TableName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata; 13 | /** 14 | * Metadata object that defines a table name and it's type. 15 | * @author Nicolas de Pomereu. 16 | */ 17 | 18 | public class TableName { 19 | 20 | private String name = null; 21 | private String type = null; 22 | 23 | public TableName(String name, String type) { 24 | this.name = name; 25 | this.type = type; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public String getType() { 33 | return type; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | final int prime = 31; 39 | int result = 1; 40 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 41 | return result; 42 | } 43 | 44 | @Override 45 | public boolean equals(Object obj) { 46 | if (this == obj) 47 | return true; 48 | if (obj == null) 49 | return false; 50 | if (getClass() != obj.getClass()) 51 | return false; 52 | TableName other = (TableName) obj; 53 | if (name == null) { 54 | if (other.name != null) 55 | return false; 56 | } else if (!name.equals(other.name)) 57 | return false; 58 | return true; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "TableName [name=" + name + ", type=" + type + "]"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/dto/JdbcDatabaseMetaDataDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.dto; 13 | 14 | import org.kawanfw.sql.metadata.JdbcDatabaseMetaData; 15 | 16 | public class JdbcDatabaseMetaDataDto { 17 | 18 | private String status = "OK"; 19 | private JdbcDatabaseMetaData jdbcDatabaseMetaData = null; 20 | 21 | public JdbcDatabaseMetaDataDto(JdbcDatabaseMetaData jdbcDatabaseMetaData) { 22 | super(); 23 | this.jdbcDatabaseMetaData = jdbcDatabaseMetaData; 24 | } 25 | 26 | public String getStatus() { 27 | return status; 28 | } 29 | 30 | public JdbcDatabaseMetaData getJdbcDatabaseMetaData() { 31 | return jdbcDatabaseMetaData; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "JdbcDatabaseMetaDataDto [status=" + status + ", jdbcDatabaseMetaData=" + jdbcDatabaseMetaData + "]"; 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/dto/LimitsInfoDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.dto; 13 | 14 | /** 15 | * Container to transport limits info defined in DatabaseConfigurator. 16 | * 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class LimitsInfoDto { 21 | 22 | private String status = "OK"; 23 | private long maxRows = 0; 24 | private long maxBlobLength = 0; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param maxRows value of {@code DatabaseConfigurator.getMaxRows} 30 | * @param maxBlobLength value of {@code DatabaseConfigurator.getMaxBlobLength} 31 | */ 32 | public LimitsInfoDto(long maxRows, long maxBlobLength) { 33 | this.maxRows = maxRows; 34 | this.maxBlobLength = maxBlobLength; 35 | } 36 | 37 | /** 38 | * @return the status 39 | */ 40 | public String getStatus() { 41 | return status; 42 | } 43 | 44 | /** 45 | * @return the maxRows 46 | */ 47 | public long getMaxRows() { 48 | return maxRows; 49 | } 50 | 51 | /** 52 | * @return the maxBlobLength 53 | */ 54 | public long getMaxBlobLength() { 55 | return maxBlobLength; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "LimitsInfoDto [status=" + status + ", maxRows=" + maxRows + ", maxBlobLength=" + maxBlobLength + "]"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/dto/TableDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.dto; 13 | 14 | import org.kawanfw.sql.metadata.Table; 15 | 16 | /** 17 | * Contains the list of tables of the database. 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class TableDto { 22 | 23 | private String status = "OK"; 24 | private Table table = null; 25 | 26 | public TableDto(Table table) { 27 | super(); 28 | this.table = table; 29 | } 30 | 31 | public String getStatus() { 32 | return status; 33 | } 34 | 35 | public Table getTable() { 36 | return table; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "TableDto [status=" + status + ", table=" + table + "]"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/dto/TableNamesDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.dto; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * Contains the list of tables of the database. 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class TableNamesDto { 23 | 24 | private String status = "OK"; 25 | private List tableNames = new ArrayList<>(); 26 | 27 | public TableNamesDto(List tableNames) { 28 | this.tableNames = tableNames; 29 | } 30 | 31 | public String getStatus() { 32 | return status; 33 | } 34 | 35 | public List getTableNames() { 36 | return tableNames; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "TableNamesDto [status=" + status + ", tableNames=" + tableNames + "]"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/sc/info/AceQLOutputFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.sc.info; 13 | /** 14 | * Enum to choose the output format of a SQL generated Schema. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | public enum AceQLOutputFormat { 19 | text, 20 | html 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/metadata/util/GsonWsUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.metadata.util; 13 | 14 | import java.io.BufferedReader; 15 | import java.io.StringReader; 16 | 17 | import com.google.gson.Gson; 18 | import com.google.gson.GsonBuilder; 19 | 20 | /** 21 | * GSON utility class 22 | * 23 | * @author abecquereau 24 | * 25 | */ 26 | public final class GsonWsUtil { 27 | 28 | /** 29 | * Create json string representing object 30 | * 31 | * @param obj 32 | * @return 33 | */ 34 | public static String getJSonString(final Object obj) { 35 | final GsonBuilder builder = new GsonBuilder(); 36 | final Gson gson = builder.setPrettyPrinting().create(); 37 | return gson.toJson(obj, obj.getClass()); 38 | } 39 | 40 | /** 41 | * Create Object from jsonString 42 | * 43 | * @param jsonString 44 | * @param type 45 | * @return 46 | */ 47 | public static T fromJson(final String jsonString, final Class type) { 48 | final GsonBuilder builder = new GsonBuilder(); 49 | final Gson gson = builder.create(); 50 | final BufferedReader bufferedReader = new BufferedReader(new StringReader(jsonString)); 51 | final T dTO = gson.fromJson(bufferedReader, type); 52 | return dTO; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | Provides class to start and stop the embedded Web Server from command line. 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/ActionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet; 13 | 14 | import java.sql.SQLException; 15 | import java.util.Objects; 16 | 17 | /** 18 | * Utility methods for actions. 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class ActionUtil { 23 | 24 | public static boolean isMetadataQueryAction(String action) throws SQLException { 25 | Objects.requireNonNull(action, "action cannot be null!"); 26 | 27 | return (action.equals(HttpParameter.METADATA_QUERY_DB_SCHEMA_DOWNLOAD) 28 | || action.equals(HttpParameter.METADATA_QUERY_GET_TABLE_DETAILS) 29 | || action.equals(HttpParameter.METADATA_QUERY_GET_DB_METADATA) 30 | || action.equals(HttpParameter.METADATA_QUERY_GET_TABLE_NAMES)); 31 | } 32 | 33 | public static boolean isJdbcDatabaseMetaDataQuery(String action) { 34 | return action.equals(HttpParameter.JDBC_DATABASE_META_DATA); 35 | } 36 | 37 | public static boolean isHealthCheckInfo(String action) { 38 | return action.equals(HttpParameter.HEALTH_CHECK_INFO); 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/AsyncDebug.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet; 13 | 14 | import java.sql.Timestamp; 15 | import java.text.DateFormat; 16 | import java.text.SimpleDateFormat; 17 | 18 | import org.kawanfw.sql.util.FrameworkDebug; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class AsyncDebug { 25 | 26 | public static boolean DEBUG = FrameworkDebug.isSet(AsyncDebug.class); 27 | 28 | public static void debug(String s) { 29 | if (DEBUG) { 30 | System.out.println(getNowFormatted() + " " + s); 31 | } 32 | } 33 | 34 | public static String getNowFormatted() { 35 | Timestamp tsNow = new Timestamp(System.currentTimeMillis()); 36 | DateFormat df = new SimpleDateFormat("yy/MM/dd HH:mm:ss.SSS"); 37 | String now = df.format(tsNow); 38 | return now; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/HttpStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet; 13 | 14 | import javax.servlet.http.HttpServletResponse; 15 | 16 | /** 17 | * 18 | * Wrapper to return an error http status. Allows logging. 19 | * 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class HttpStatus { 24 | 25 | protected HttpStatus() { 26 | 27 | } 28 | 29 | public static void set(HttpServletResponse response, int httpStatus, 30 | String logMessage) { 31 | 32 | Trace.httpStatus(httpStatus + " " + logMessage); 33 | 34 | response.setStatus(httpStatus); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/ServletMetadataQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet; 13 | 14 | import java.util.Objects; 15 | 16 | public class ServletMetadataQuery { 17 | 18 | public static final String METADATA_QUERY = "METADATA_QUERY"; 19 | 20 | private String requestUri = null; 21 | 22 | public ServletMetadataQuery(String requestUri) { 23 | this.requestUri =Objects.requireNonNull(requestUri, "requestUri cannot be null!"); 24 | } 25 | 26 | public String getAction() { 27 | 28 | if (requestUri.contains("/metadata_query/db_schema_download")) { 29 | return HttpParameter.METADATA_QUERY_DB_SCHEMA_DOWNLOAD; 30 | } 31 | else if (requestUri.endsWith("/metadata_query/get_db_metadata")) { 32 | return HttpParameter.METADATA_QUERY_GET_DB_METADATA; 33 | } 34 | else if (requestUri.endsWith("/metadata_query/get_table_names")) { 35 | return HttpParameter.METADATA_QUERY_GET_TABLE_NAMES; 36 | } 37 | else if (requestUri.contains("/metadata_query/get_table")) { 38 | return HttpParameter.METADATA_QUERY_GET_TABLE_DETAILS; 39 | } 40 | else { 41 | throw new IllegalArgumentException("Unknown metadata_query action: " + requestUri); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/Trace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet; 13 | /** 14 | * Trace options to ease some demos, debug, etc. Different from DEBUG 15 | * 16 | * @author Nicolas de Pomereu 17 | * 18 | */ 19 | 20 | public class Trace { 21 | 22 | public static boolean TRACE_ON = false; 23 | 24 | /** Trace Token ID */ 25 | public static boolean TRACE_SESSION_ID = true; 26 | 27 | /** Trace all Http Status on error */ 28 | public static boolean TRACE_HTTP_STATUS = true; 29 | 30 | private Trace() { 31 | 32 | } 33 | 34 | public static void httpStatus(String s) { 35 | 36 | if (TRACE_ON && TRACE_HTTP_STATUS) { 37 | System.out.println(s); 38 | } 39 | 40 | } 41 | 42 | public static void sessionId(String s) { 43 | 44 | if (TRACE_ON && TRACE_SESSION_ID) { 45 | System.out.println(s); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/connection/ConnectionIdUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.connection; 13 | 14 | import java.sql.Connection; 15 | 16 | /** 17 | * 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class ConnectionIdUtil { 22 | 23 | private static final String STATELESS = "stateless"; 24 | 25 | /** 26 | * A simple wrapper for connection.hashCode(); 27 | * @param connection 28 | * @return connection.hashCode() in String value 29 | */ 30 | public static String getConnectionId(Connection connection) { 31 | return "" + connection.hashCode(); 32 | } 33 | 34 | /** 35 | * Returns the Connection Id value for a stateless Connection 36 | * @return the Connection Id value for a stateless Connection 37 | */ 38 | public static String getStatelessConnectionId() { 39 | return STATELESS; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/connection/RollbackUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.connection; 13 | 14 | import java.sql.Connection; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class RollbackUtil { 21 | 22 | public static void rollback(Connection connection) { 23 | 24 | if (connection == null) { 25 | return; 26 | } 27 | 28 | try { 29 | if (! connection.getAutoCommit()) { 30 | connection.rollback(); 31 | } 32 | } catch (Exception e) { 33 | System.out.println("RollbackUtil Exception thrown:"); 34 | e.printStackTrace(System.out); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/connection/SavepointDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.connection; 13 | /** 14 | * Contains the ID and name of a savepont. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | 19 | public class SavepointDto { 20 | 21 | private String status = "OK"; 22 | private int id; 23 | private String name; 24 | 25 | public SavepointDto(int id, String name) { 26 | this.id = id; 27 | this.name = name; 28 | } 29 | 30 | public String getStatus() { 31 | return status; 32 | } 33 | 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "SavepointDto [status=" + status + ", id=" + id + ", name=" + name + "]"; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DatabaseConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.sql.SQLException; 15 | 16 | public interface DatabaseConfiguratorClassNameBuilder { 17 | 18 | String getClassName(String database) throws ClassNotFoundException, SQLException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultDatabaseConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import org.kawanfw.sql.api.server.DefaultDatabaseConfigurator; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class DefaultDatabaseConfiguratorClassNameBuilder implements DatabaseConfiguratorClassNameBuilder { 21 | 22 | 23 | @Override 24 | public String getClassName(String database) { 25 | return DefaultDatabaseConfigurator.class.getName(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultNativeTomcatElementsBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | 17 | import org.kawanfw.sql.api.server.DatabaseConfigurationException; 18 | import org.kawanfw.sql.util.Tag; 19 | 20 | /** 21 | * Process to do for Native Tomcat only 22 | * 23 | * @author Nicolas de Pomereu 24 | * 25 | */ 26 | public class DefaultNativeTomcatElementsBuilder implements NativeTomcatElementsBuilder { 27 | 28 | /** 29 | * Creates the the datasources and the ConfProperties. 30 | * 31 | * @param the properties file (native Tomcat only); 32 | * @throws DatabaseConfigurationException 33 | * @throws IOException 34 | * @throws SQLException 35 | */ 36 | @Override 37 | public void create(String propertiesFile) throws DatabaseConfigurationException, IOException, SQLException { 38 | throw new UnsupportedOperationException(Tag.PRODUCT + " " + "Using Tomcat or other servlet containers " 39 | + Tag.REQUIRES_ACEQL_ENTERPRISE_EDITION); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultSessionConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import org.kawanfw.sql.api.server.session.DefaultSessionConfigurator; 15 | import org.kawanfw.sql.api.server.session.JwtSessionConfigurator; 16 | import org.kawanfw.sql.servlet.injection.properties.ConfPropertiesStore; 17 | import org.kawanfw.sql.util.Tag; 18 | 19 | /** 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class DefaultSessionConfiguratorClassNameBuilder implements SessionConfiguratorClassNameBuilder { 24 | 25 | @Override 26 | public String getClassName() { 27 | String SessionConfiguratorClassName = ConfPropertiesStore.get().getSessionConfiguratorClassName(); 28 | 29 | if (!SessionConfiguratorClassName.endsWith(DefaultSessionConfigurator.class.getSimpleName()) 30 | && SessionConfiguratorClassName.endsWith(JwtSessionConfigurator.class.getSimpleName())) { 31 | throw new UnsupportedOperationException(Tag.PRODUCT + " " 32 | + "Session Configurator other than DefaultSessionConfigurator & JwtSessionConfigurator " 33 | + Tag.REQUIRES_ACEQL_ENTERPRISE_EDITION); 34 | } 35 | 36 | return SessionConfiguratorClassName; 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultSqlFirewallTriggersLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.util.LinkedHashSet; 16 | import java.util.Set; 17 | 18 | import org.kawanfw.sql.api.server.firewall.trigger.SqlFirewallTrigger; 19 | import org.kawanfw.sql.servlet.injection.classes.InjectedClasses.InjectedClassesBuilder; 20 | 21 | public class DefaultSqlFirewallTriggersLoader implements SqlFirewallTriggersLoader { 22 | 23 | 24 | @Override 25 | public Set loadSqlFirewallTriggers(String database, InjectedClassesBuilder injectedClassesBuilder, 26 | Set sqlFirewallTriggerClassNames) 27 | throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, 28 | IllegalAccessException, IllegalArgumentException, InvocationTargetException { 29 | 30 | Set sqlFirewallTriggers = new LinkedHashSet<>(); 31 | return sqlFirewallTriggers; 32 | } 33 | 34 | @Override 35 | public String getClassNameToLoad() { 36 | Set classNameToLoad = new LinkedHashSet<>(); 37 | return classNameToLoad.toString(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultUpdateListenersLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.util.ArrayList; 16 | import java.util.LinkedHashSet; 17 | import java.util.List; 18 | import java.util.Set; 19 | 20 | import org.kawanfw.sql.api.server.listener.UpdateListener; 21 | import org.kawanfw.sql.servlet.injection.classes.InjectedClasses.InjectedClassesBuilder; 22 | 23 | public class DefaultUpdateListenersLoader implements UpdateListenersLoader { 24 | 25 | 26 | @Override 27 | public Set loadUpdateListeners(String database, InjectedClassesBuilder injectedClassesBuilder, 28 | Set updateListenerClassNames) 29 | throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, 30 | IllegalAccessException, IllegalArgumentException, InvocationTargetException { 31 | 32 | Set updateListeners = new LinkedHashSet<>(); 33 | return updateListeners; 34 | } 35 | 36 | @Override 37 | public String getClassNameToLoad() { 38 | List classNameToLoad = new ArrayList<>(); 39 | return classNameToLoad.toString(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/DefaultWebServerStarter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.io.File; 15 | 16 | import org.kawanfw.sql.api.util.webserver.WebServerApiWrapper; 17 | import org.kawanfw.sql.util.Tag; 18 | 19 | /** 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class DefaultWebServerStarter implements WebServerStarter { 24 | 25 | @Override 26 | public void startServer(WebServerApiWrapper webServerApiWrapper, String host, int port, File propertiesFile) { 27 | throw new UnsupportedOperationException(Tag.PRODUCT + " " 28 | + "WebServerApi usage " 29 | + Tag.REQUIRES_ACEQL_ENTERPRISE_EDITION); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/InjectedClassesStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.util.Objects; 15 | 16 | /** 17 | * Static store of the injected classes instances ready to use. 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | 22 | public class InjectedClassesStore { 23 | 24 | private static InjectedClasses injectedClasses = null; 25 | 26 | private InjectedClassesStore() { 27 | } 28 | 29 | public static InjectedClasses get() { 30 | //Objects.requireNonNull(injectedClasses, "injectedClasses is null and was never set!"); 31 | return injectedClasses; 32 | } 33 | 34 | public static void set(InjectedClasses injectedClasses) { 35 | Objects.requireNonNull(injectedClasses, "injectedClasses cannot be null!"); 36 | InjectedClassesStore.injectedClasses = injectedClasses; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/NativeTomcatElementsBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | 17 | import org.kawanfw.sql.api.server.DatabaseConfigurationException; 18 | 19 | public interface NativeTomcatElementsBuilder { 20 | 21 | /** 22 | * Creates the the datasources and the ConfProperties. 23 | * @param config servlet configuration elements (native Tomcat only); 24 | * @throws DatabaseConfigurationException 25 | * @throws IOException 26 | * @throws SQLException 27 | */ 28 | void create(String propertiesFile) throws DatabaseConfigurationException, IOException, SQLException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/RequestHeadersAuthenticatorLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.sql.SQLException; 16 | 17 | import org.kawanfw.sql.servlet.injection.classes.InjectedClasses.InjectedClassesBuilder; 18 | 19 | public interface RequestHeadersAuthenticatorLoader { 20 | 21 | /** 22 | * Loads a RequestHeadersAuthenticatorCreator instance. 23 | * 24 | * @param injectedClassesBuilder 25 | * @param requestHeadersAuthenticatorClassName 26 | * @throws ClassNotFoundException 27 | * @throws NoSuchMethodException 28 | * @throws SecurityException 29 | * @throws InstantiationException 30 | * @throws IllegalAccessException 31 | * @throws IllegalArgumentException 32 | * @throws InvocationTargetException 33 | * @throws SQLException 34 | */ 35 | void loadRequestHeadersAuthenticator(InjectedClassesBuilder injectedClassesBuilder, 36 | String requestHeadersAuthenticatorClassName) 37 | throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, 38 | IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/SessionConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.sql.SQLException; 15 | 16 | public interface SessionConfiguratorClassNameBuilder { 17 | 18 | String getClassName() throws SQLException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/WebServerStarter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes; 13 | 14 | import java.io.File; 15 | import java.io.IOException; 16 | import java.net.ConnectException; 17 | import java.sql.SQLException; 18 | 19 | import org.apache.catalina.LifecycleException; 20 | import org.kawanfw.sql.api.server.DatabaseConfigurationException; 21 | import org.kawanfw.sql.api.util.webserver.WebServerApiWrapper; 22 | 23 | /** 24 | * @author Nicolas de Pomereu 25 | * 26 | */ 27 | public interface WebServerStarter { 28 | 29 | public void startServer(WebServerApiWrapper webServerApiWrapper, String host, int port, File propertiesFile) 30 | throws ConnectException, DatabaseConfigurationException, IOException, SQLException, LifecycleException; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/blob/BlobDownloadConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes.blob; 13 | 14 | import java.sql.SQLException; 15 | 16 | public interface BlobDownloadConfiguratorClassNameBuilder { 17 | 18 | String getClassName() throws SQLException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/blob/BlobUploadConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes.blob; 13 | 14 | import java.sql.SQLException; 15 | 16 | public interface BlobUploadConfiguratorClassNameBuilder { 17 | 18 | String getClassName() throws SQLException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/blob/DefaultBlobDownloadConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes.blob; 13 | 14 | import org.kawanfw.sql.api.server.blob.DefaultBlobDownloadConfigurator; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class DefaultBlobDownloadConfiguratorClassNameBuilder implements BlobDownloadConfiguratorClassNameBuilder { 21 | 22 | @Override 23 | public String getClassName() { 24 | return DefaultBlobDownloadConfigurator.class.getName(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/blob/DefaultBlobUploadConfiguratorClassNameBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes.blob; 13 | 14 | import org.kawanfw.sql.api.server.blob.DefaultBlobUploadConfigurator; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class DefaultBlobUploadConfiguratorClassNameBuilder implements BlobUploadConfiguratorClassNameBuilder { 21 | 22 | @Override 23 | public String getClassName() { 24 | return DefaultBlobUploadConfigurator.class.getName(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/classes/creator/WebServerStarterCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.classes.creator; 13 | 14 | import java.lang.reflect.Constructor; 15 | import java.sql.SQLException; 16 | 17 | import org.kawanfw.sql.servlet.injection.classes.DefaultWebServerStarter; 18 | import org.kawanfw.sql.servlet.injection.classes.WebServerStarter; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class WebServerStarterCreator { 25 | 26 | 27 | public WebServerStarter createInstance() 28 | throws SQLException { 29 | 30 | Class c; 31 | try { 32 | c = Class.forName("org.kawanfw.sql.pro.reflection.builders.ProEditionWebServerStarter"); 33 | Constructor constructor = c.getConstructor(); 34 | WebServerStarter webServerStarter = (WebServerStarter) constructor.newInstance(); 35 | return webServerStarter; 36 | } catch (ClassNotFoundException e) { 37 | System.err.println(e.toString()); 38 | return new DefaultWebServerStarter(); 39 | } catch (Exception e) { 40 | throw new SQLException(e); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/properties/ConfPropertiesStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.properties; 13 | /** 14 | * Static store of the ConfProperties instance containing all properties in use. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | 19 | public class ConfPropertiesStore { 20 | 21 | private static ConfProperties confProperties = null; 22 | 23 | private ConfPropertiesStore() { 24 | } 25 | 26 | public static ConfProperties get() { 27 | return confProperties; 28 | } 29 | 30 | public static void set(ConfProperties confProperties) { 31 | ConfPropertiesStore.confProperties = confProperties; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/properties/ConfPropertiesUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.properties; 13 | 14 | public class ConfPropertiesUtil { 15 | 16 | public static final String OPERATIONAL_MODE = "operationalMode"; 17 | 18 | protected ConfPropertiesUtil() { 19 | 20 | } 21 | 22 | public static boolean isStatelessMode() { 23 | return ConfPropertiesStore.get().isStatelessMode(); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/properties/OperationalMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.properties; 13 | /** 14 | * Enum of the operationalMode property. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | public enum OperationalMode { 19 | off, 20 | learning, 21 | detecting, 22 | protecting 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/injection/properties/PropertiesDecryptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.injection.properties; 13 | 14 | import java.io.IOException; 15 | import java.util.Properties; 16 | 17 | /** 18 | * Interface for Properties Decryption. 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public interface PropertiesDecryptor { 23 | 24 | Properties decrypt(Properties properties, char[] password) throws IOException; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/jdbc/metadata/JdbcDatabaseMetadataActionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.jdbc.metadata; 13 | 14 | import java.io.IOException; 15 | import java.io.OutputStream; 16 | import java.sql.Connection; 17 | import java.sql.SQLException; 18 | import java.util.List; 19 | 20 | import javax.servlet.http.HttpServletRequest; 21 | import javax.servlet.http.HttpServletResponse; 22 | 23 | import org.kawanfw.sql.api.server.firewall.SqlFirewallManager; 24 | 25 | public interface JdbcDatabaseMetadataActionManager { 26 | 27 | void execute(HttpServletRequest request, HttpServletResponse response, OutputStream out, 28 | List sqlFirewallManagers, Connection connection) throws SQLException, IOException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/ParameterDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class ParameterDirection { 19 | public static final String IN = "in"; 20 | public static final String OUT = "out"; 21 | public static final String INOUT = "inout"; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/ServerStatementUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | 16 | import org.kawanfw.sql.servlet.HttpParameter; 17 | 18 | /** 19 | * Utility class for ServerStatement & ServerExecute. 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class ServerStatementUtil { 24 | 25 | /** 26 | * Static class. 27 | */ 28 | protected ServerStatementUtil() { 29 | 30 | } 31 | 32 | public static boolean isPreparedStatement(HttpServletRequest request) { 33 | String preparedStatement = request.getParameter(HttpParameter.PREPARED_STATEMENT); 34 | return Boolean.parseBoolean(preparedStatement); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/callable/aceqlproc/ServerQueryExecutorWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql.callable.aceqlproc; 13 | 14 | import java.io.IOException; 15 | import java.io.OutputStream; 16 | import java.sql.Connection; 17 | import java.sql.SQLException; 18 | 19 | import javax.servlet.http.HttpServletRequest; 20 | 21 | /** 22 | * @author Nicolas de Pomereu 23 | * 24 | */ 25 | public interface ServerQueryExecutorWrapper { 26 | 27 | public void executeQuery(HttpServletRequest request, OutputStream out, String action, 28 | Connection connection) throws SQLException, IOException, ClassNotFoundException; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/dto/StatementsBatchDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql.dto; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * Contains the list of SQL statements to upload to server 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class StatementsBatchDto { 23 | 24 | private List batchList = new ArrayList<>(); 25 | 26 | /** 27 | * 28 | * @param batchList the list of SQL statements created with Statement.addBatch() 29 | */ 30 | public StatementsBatchDto(List batchList) { 31 | super(); 32 | this.batchList = batchList; 33 | } 34 | 35 | /** 36 | * @return the batchList 37 | */ 38 | public List getBatchList() { 39 | return batchList; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "StatementsBatchDto [batchList=" + batchList + "]"; 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/dto/UpdateCountsArrayDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql.dto; 13 | 14 | import java.util.Arrays; 15 | 16 | /** 17 | * Contains the list of SQL batch responses downloaded for server 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class UpdateCountsArrayDto { 22 | 23 | private String status = "OK"; 24 | private int [] updateCountsArray; 25 | 26 | public UpdateCountsArrayDto(int[] updateCountsArray) { 27 | this.updateCountsArray = updateCountsArray; 28 | } 29 | 30 | /** 31 | * @return the status 32 | */ 33 | public String getStatus() { 34 | return status; 35 | } 36 | 37 | /** 38 | * @return the updateCountsArray 39 | */ 40 | public int[] getUpdateCountsArray() { 41 | return updateCountsArray; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "UpdateCountsArrayDto [updateCountsArray=" + Arrays.toString(updateCountsArray) + "]"; 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/sql/json_return/JsonUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.sql.json_return; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | import javax.json.Json; 18 | import javax.json.stream.JsonGenerator; 19 | import javax.json.stream.JsonGeneratorFactory; 20 | 21 | /** 22 | * @author Nicolas de Pomereu 23 | * 24 | */ 25 | public class JsonUtil { 26 | 27 | /** Always force pretty printing */ 28 | public static final boolean DEFAULT_PRETTY_PRINTING = true; 29 | 30 | /** 31 | * protected 32 | */ 33 | protected JsonUtil() { 34 | 35 | } 36 | 37 | /** 38 | * JsonGeneratorFactory getter with pretty printing on/off 39 | * 40 | * @param prettyPrintingif 41 | * true, JSON will be pretty printed 42 | * @return 43 | */ 44 | public static JsonGeneratorFactory getJsonGeneratorFactory( 45 | boolean prettyPrinting) { 46 | Map properties = new HashMap<>(1); 47 | if (prettyPrinting) { 48 | // Putting any value sets the pretty printing to true... So test 49 | // must be done 50 | properties.put(JsonGenerator.PRETTY_PRINTING, prettyPrinting); 51 | } 52 | 53 | JsonGeneratorFactory jf = Json.createGeneratorFactory(properties); 54 | return jf; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/BlobUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util; 13 | 14 | import java.io.File; 15 | import java.io.FileNotFoundException; 16 | import java.io.IOException; 17 | import java.sql.SQLException; 18 | import java.util.Objects; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class BlobUtil { 25 | 26 | /** 27 | * Protected contrusctor 28 | */ 29 | protected BlobUtil() { 30 | 31 | } 32 | 33 | public static long getBlobLength(String blobId, File blobDirectory) 34 | throws IOException, SQLException { 35 | 36 | Objects.requireNonNull(blobId, "blobId cannot be null!"); 37 | Objects.requireNonNull(blobDirectory, "blobDirectory cannot be null!"); 38 | 39 | String fileName = blobDirectory.toString() + File.separator + blobId; 40 | 41 | File file = new File(fileName); 42 | 43 | if (!file.exists()) { 44 | throw new FileNotFoundException( 45 | "No file found for blob_id: " + blobId); 46 | } 47 | 48 | return file.length(); 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/JsonLoggerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class JsonLoggerUtil { 19 | /** 20 | * Returns the simple name + ".log" of this class 21 | * @return the simple name + ".log" of this class 22 | */ 23 | public static String getSimpleName(Class clazz) { 24 | return clazz.getSimpleName() + ".log"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/logging/StringFlattener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.logging; 13 | 14 | import java.io.BufferedReader; 15 | import java.io.IOException; 16 | import java.io.StringReader; 17 | 18 | /** 19 | * Remove all CR/LF from a string. 20 | * 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class StringFlattener { 25 | 26 | private final String inString; 27 | 28 | public StringFlattener(String inString) { 29 | this.inString = inString; 30 | } 31 | 32 | /** 33 | * Flatten the inString by removing all CR/LF. 34 | * 35 | * @return The flattened inString 36 | * @throws IOException 37 | */ 38 | public String flatten() throws IOException { 39 | 40 | if (inString == null) { 41 | return null; 42 | } 43 | 44 | if (! inString.contains("\n")) { 45 | return inString; 46 | } 47 | 48 | StringBuffer buffer = new StringBuffer(); 49 | 50 | try (BufferedReader bufferedReader = new BufferedReader(new StringReader(inString));) { 51 | String line = null; 52 | while ((line = bufferedReader.readLine()) != null) { 53 | buffer.append(line); 54 | } 55 | 56 | return buffer.toString(); 57 | } 58 | 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/max_rows/DefaultMaxRowsSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.max_rows; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | import java.sql.Statement; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | 20 | import org.kawanfw.sql.api.server.DatabaseConfigurator; 21 | 22 | /** 23 | * @author Nicolas de Pomereu 24 | * 25 | */ 26 | public class DefaultMaxRowsSetter implements MaxRowsSetter { 27 | 28 | @Override 29 | public void setMaxRows(HttpServletRequest request, String username, String database, Statement statement, 30 | DatabaseConfigurator databaseConfigurator) throws NumberFormatException, SQLException, IOException { 31 | // do nothing 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/max_rows/MaxRowsSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.max_rows; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | import java.sql.Statement; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | 20 | import org.kawanfw.sql.api.server.DatabaseConfigurator; 21 | 22 | public interface MaxRowsSetter { 23 | 24 | void setMaxRows(HttpServletRequest request, String username, String database, Statement statement, 25 | DatabaseConfigurator databaseConfigurator) throws NumberFormatException, SQLException, IOException; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/max_rows/MaxRowsSetterCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.max_rows; 13 | 14 | import java.lang.reflect.Constructor; 15 | import java.lang.reflect.InvocationTargetException; 16 | import java.sql.SQLException; 17 | 18 | public class MaxRowsSetterCreator { 19 | 20 | private static MaxRowsSetter maxRowsSetter = null; 21 | 22 | /** 23 | * Creates a MaxRowsSetter instance. 24 | * 25 | * @return a MaxRowsSetter instance. 26 | * @throws ClassNotFoundException 27 | * @throws NoSuchMethodException 28 | * @throws SecurityException 29 | * @throws InstantiationException 30 | * @throws IllegalAccessException 31 | * @throws IllegalArgumentException 32 | * @throws InvocationTargetException 33 | * @throws SQLException 34 | */ 35 | public static MaxRowsSetter createInstance() throws SQLException { 36 | 37 | if (maxRowsSetter == null) { 38 | Class c; 39 | try { 40 | c = Class.forName("org.kawanfw.sql.pro.reflection.builders.ProEditionMaxRowsSetter"); 41 | Constructor constructor = c.getConstructor(); 42 | maxRowsSetter = (MaxRowsSetter) constructor.newInstance(); 43 | return maxRowsSetter; 44 | } catch (ClassNotFoundException e) { 45 | return new DefaultMaxRowsSetter(); 46 | } catch (Exception e) { 47 | throw new SQLException(e); 48 | } 49 | } 50 | 51 | return maxRowsSetter; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/operation_type/DefaultOperationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.operation_type; 13 | 14 | import org.kawanfw.sql.api.util.JsqlParserWrapper; 15 | 16 | import net.sf.jsqlparser.JSQLParserException; 17 | import net.sf.jsqlparser.parser.CCJSqlParserUtil; 18 | import net.sf.jsqlparser.statement.Statement; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class DefaultOperationType implements OperationType { 25 | 26 | @Override 27 | public boolean isOperationAuthorized(String sql) { 28 | 29 | if (sql == null) { 30 | return true; 31 | } 32 | 33 | try { 34 | Statement parsedStatement = CCJSqlParserUtil.parse(sql); 35 | JsqlParserWrapper jsqlParserWrapper = new JsqlParserWrapper(parsedStatement); 36 | return ! jsqlParserWrapper.isDCL() && ! jsqlParserWrapper.isDDL(); 37 | } catch (JSQLParserException e) { 38 | System.err.println("sql: " + sql); 39 | e.printStackTrace(); 40 | return true; 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/servlet/util/operation_type/OperationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.servlet.util.operation_type; 13 | 14 | import java.sql.SQLException; 15 | 16 | public interface OperationType { 17 | 18 | boolean isOperationAuthorized(String sql) throws SQLException; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/AdvancedServletNamesGetterWrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.sql.SQLException; 15 | import java.util.HashSet; 16 | import java.util.Properties; 17 | import java.util.Set; 18 | 19 | public class AdvancedServletNamesGetterWrap{ 20 | 21 | /** 22 | * @param properties 23 | * @param licenseStatus 24 | * @return 25 | * @throws SQLException 26 | */ 27 | public static Set getServletsWrap(Properties properties) throws SQLException { 28 | 29 | String servlets = properties.getProperty("servlets"); 30 | 31 | if (servlets == null || servlets.isEmpty()) { 32 | return new HashSet<>(); 33 | } 34 | 35 | String[] servletArray = servlets.split(","); 36 | 37 | Set servletSet = new HashSet<>(); 38 | for (int i = 0; i < servletArray.length; i++) { 39 | servletSet.add(servletArray[i].trim()); 40 | } 41 | return servletSet; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/DefaultServletAceQLCallNameGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.io.IOException; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class DefaultServletAceQLCallNameGetter implements ServletAceQLCallNameGetter { 21 | 22 | @Override 23 | public String getName() throws IOException { 24 | return "aceql"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/DefaultServletNamesGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.util.HashSet; 15 | import java.util.Properties; 16 | import java.util.Set; 17 | 18 | /** 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class DefaultServletNamesGetter implements ServletNamesGetter { 23 | 24 | @Override 25 | public Set getServlets(Properties properties) { 26 | Set servletNames = new HashSet<>(); 27 | return servletNames; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/JdbcInterceptorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import org.apache.tomcat.jdbc.pool.ConnectionPool; 15 | import org.apache.tomcat.jdbc.pool.JdbcInterceptor; 16 | import org.apache.tomcat.jdbc.pool.PooledConnection; 17 | 18 | /** 19 | * Simple test JdbcInterceptor to be sure it is loaded along user defined in aceql-server.properties 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class JdbcInterceptorTest extends JdbcInterceptor { 24 | 25 | public JdbcInterceptorTest() { 26 | System.err.println("JdbcInterceptorTest Creation."); 27 | } 28 | 29 | @Override 30 | public void reset(ConnectionPool parent, PooledConnection con) { 31 | System.err.println("JdbcInterceptorTest reset call."); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/ServletAceQLCallNameGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.io.IOException; 15 | import java.sql.SQLException; 16 | 17 | /** 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public interface ServletAceQLCallNameGetter { 22 | 23 | public String getName() throws IOException, SQLException; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/ServletNamesGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.sql.SQLException; 15 | import java.util.Properties; 16 | import java.util.Set; 17 | 18 | public interface ServletNamesGetter { 19 | 20 | public Set getServlets(Properties properties) throws SQLException; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/StaticParms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | /** 14 | * Stores static parameters values valid for all running instances of AceQL in the JVM. 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | 19 | public class StaticParms { 20 | 21 | public static boolean FLUSH_EACH_RESULT_SET_ROW; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/TomcatStarterUtilProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Date; 16 | import java.util.List; 17 | 18 | import org.kawanfw.sql.util.FrameworkDebug; 19 | 20 | public class TomcatStarterUtilProperties { 21 | 22 | private static boolean DEBUG = FrameworkDebug.isSet(TomcatStarterUtilProperties.class); 23 | 24 | public static List getList(String classNameArray) { 25 | 26 | debug("classNameArray: " + classNameArray + ":"); 27 | 28 | List classNames = new ArrayList<>(); 29 | 30 | if (classNameArray == null || classNameArray.isEmpty()) { 31 | return classNames; 32 | } 33 | 34 | String [] array = classNameArray.split(","); 35 | for (String className : array) { 36 | debug("className: " + className.trim() + ":"); 37 | classNames.add(className.trim()); 38 | } 39 | 40 | return classNames; 41 | } 42 | 43 | /** 44 | * Method called by children Servlet for debug purpose Println is done only if 45 | * class name name is in kawansoft-debug.ini 46 | */ 47 | public static void debug(String s) { 48 | if (DEBUG) { 49 | System.out.println(new Date() + " " + s); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/pool/PoolPropertiesInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.pool; 13 | 14 | import java.sql.SQLException; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public interface PoolPropertiesInterceptor { 21 | 22 | public String interceptValue(String theMethod, String propertyValue) throws SQLException; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/pool/PoolPropertiesInterceptorCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.pool; 13 | 14 | import java.lang.reflect.Constructor; 15 | import java.sql.SQLException; 16 | 17 | /** 18 | * 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class PoolPropertiesInterceptorCreator { 23 | 24 | private static PoolPropertiesInterceptor poolPropertiesInterceptor = null; 25 | 26 | public static PoolPropertiesInterceptor createInstance() throws SQLException { 27 | if (poolPropertiesInterceptor == null) { 28 | Class c; 29 | try { 30 | c = Class.forName("org.kawanfw.sql.pro.reflection.builders.ProEditionPoolPropertiesInterceptor"); 31 | Constructor constructor = c.getConstructor(); 32 | poolPropertiesInterceptor = (PoolPropertiesInterceptor) constructor.newInstance(); 33 | return poolPropertiesInterceptor; 34 | } catch (ClassNotFoundException e) { 35 | return new DefaultPoolPropertiesInterceptor(); 36 | } catch (Exception e) { 37 | throw new SQLException(e); 38 | } 39 | } 40 | 41 | return poolPropertiesInterceptor; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/pool/misc/BooleanPropertiesInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.pool.misc; 13 | 14 | import java.sql.SQLException; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public interface BooleanPropertiesInterceptor { 21 | 22 | public boolean interceptValue(boolean propertyValue) throws SQLException; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/pool/misc/BooleanPropertiesInterceptorCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.pool.misc; 13 | 14 | import java.lang.reflect.Constructor; 15 | import java.sql.SQLException; 16 | 17 | /** 18 | * 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | public class BooleanPropertiesInterceptorCreator { 23 | 24 | private static BooleanPropertiesInterceptor booleanPropertiesInterceptor = null; 25 | 26 | public static BooleanPropertiesInterceptor createInstance() throws SQLException { 27 | if (booleanPropertiesInterceptor == null) { 28 | Class c; 29 | try { 30 | c = Class.forName("org.kawanfw.sql.pro.reflection.builders.ProEditionBooleanPropertiesInterceptor"); 31 | Constructor constructor = c.getConstructor(); 32 | booleanPropertiesInterceptor = (BooleanPropertiesInterceptor) constructor.newInstance(); 33 | return booleanPropertiesInterceptor; 34 | } catch (ClassNotFoundException e) { 35 | return new DefaultBooleanPropertiesInterceptor(); 36 | } catch (Exception e) { 37 | throw new SQLException(e); 38 | } 39 | } 40 | 41 | return booleanPropertiesInterceptor; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/pool/misc/DefaultBooleanPropertiesInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.pool.misc; 13 | 14 | import java.sql.SQLException; 15 | 16 | public class DefaultBooleanPropertiesInterceptor implements BooleanPropertiesInterceptor { 17 | 18 | @Override 19 | public boolean interceptValue(boolean propertyValue) throws SQLException { 20 | return false; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/properties/threadpool/ThreadPoolExecutorBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.properties.threadpool; 13 | 14 | import java.io.IOException; 15 | import java.lang.reflect.InvocationTargetException; 16 | import java.sql.SQLException; 17 | import java.util.concurrent.ThreadPoolExecutor; 18 | 19 | import org.kawanfw.sql.api.server.DatabaseConfigurationException; 20 | 21 | public interface ThreadPoolExecutorBuilder { 22 | 23 | /** 24 | * Creates the ThreadPoolExecutor that will be used using properties 25 | * @throws SQLException 26 | * @throws ClassNotFoundException 27 | * @throws SecurityException 28 | * @throws NoSuchMethodException 29 | * @throws InvocationTargetException 30 | * @throws IllegalArgumentException 31 | * @throws IllegalAccessException 32 | * @throws InstantiationException 33 | */ 34 | ThreadPoolExecutor build() throws DatabaseConfigurationException, IOException, SQLException ; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/tomcat/util/jdbc/JdbcInstanceInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.tomcat.util.jdbc; 13 | 14 | import java.util.Objects; 15 | 16 | public class JdbcInstanceInfo { 17 | 18 | private String driverClassName; 19 | private String url; 20 | private String username; 21 | 22 | public JdbcInstanceInfo(String driverClassName, String url, String username) { 23 | this.driverClassName = Objects.requireNonNull(driverClassName, "driverClassName cannot be null!"); 24 | this.url = Objects.requireNonNull(url, "url cannot be null!"); 25 | this.username = Objects.requireNonNull(username, "username cannot be null!"); 26 | } 27 | 28 | public String getDriverClassName() { 29 | return driverClassName; 30 | } 31 | 32 | public String getUrl() { 33 | return url; 34 | } 35 | 36 | public String getUsername() { 37 | return username; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "JdbcInstanceInfo [driverClassName=" + driverClassName + ", url=" + url + ", username=" + username + "]"; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/Base64Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import java.io.File; 15 | import java.io.IOException; 16 | import java.util.Date; 17 | 18 | import org.apache.commons.io.FileUtils; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class Base64Test { 25 | 26 | /** 27 | * @param args 28 | */ 29 | public static void main(String[] args) throws IOException { 30 | 31 | System.out.println(new Date() + " Begin..."); 32 | File file = new File("c:\\test\\proust.txt"); 33 | String text = FileUtils.readFileToString(file, "UTF-8"); 34 | System.out.println(text); 35 | 36 | String originalInput = text; 37 | org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(80); 38 | String encodedString = new String(base64.encode(originalInput.getBytes())); 39 | System.out.println(encodedString); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/CallableParms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class CallableParms { 19 | 20 | public static final String NO_RESULT_SET = "NO_RESULT_SET"; 21 | 22 | /** 23 | * Protected Constructor 24 | */ 25 | protected CallableParms() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/ClasspathUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | /** 18 | * 19 | * @author Nicolas de Pomereu 20 | */ 21 | public class ClasspathUtil { 22 | 23 | public static List getClasspath() { 24 | String classpath = System.getProperty("java.class.path"); 25 | 26 | String [] classpathArray = classpath.split(System.getProperty("path.separator")); 27 | 28 | if (classpathArray == null) { 29 | return null; 30 | } 31 | 32 | List classpathList = Arrays.asList(classpathArray); 33 | return classpathList; 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/ConnectionParms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class ConnectionParms { 19 | 20 | public static final String CONNECTION_ID = "CONNECTION_ID"; 21 | 22 | public static final String AUTOCOMMIT = "AUTOCOMMIT"; 23 | public static final String READONLY = "READONLY"; 24 | public static final String HOLDABILITY = "HOLDABILITY"; 25 | public static final String TRANSACTION_ISOLATION = "TRANSACTION_ISOLATION"; 26 | 27 | public static final String NO_PARM = "NO_PARM"; 28 | // Connection Info 29 | public static final String TIMEOUT = "timeout"; 30 | public static final String VALUE = "value"; 31 | public static final String PROPERTIES = "properties"; 32 | 33 | public static final String SCHEMA = "schema"; 34 | 35 | public static final String ELEMENTS = "elements"; 36 | public static final String TYPENAME = "typename"; 37 | 38 | /** 39 | * Protected Constructor 40 | */ 41 | protected ConnectionParms() { 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/FileSplitSeparatorLine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class FileSplitSeparatorLine { 19 | 20 | public static final String RESULT_SET_GET_METADATA_SEP = "kawanfw**ResultSet.getMetaData()**kawanfw"; 21 | 22 | protected FileSplitSeparatorLine() { 23 | 24 | } 25 | 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/HtmlConverter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kawansoft/aceql-http/19fafad51808128e937aef8c93524636e40e80a4/src/main/java/org/kawanfw/sql/util/HtmlConverter.java -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/IpUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | 16 | public class IpUtil { 17 | 18 | protected IpUtil() { 19 | 20 | } 21 | 22 | /** 23 | * Gets user IP address of the servlet request by testing first X-FORWARDED-FOR 24 | * @param httpServletRequest the servlet request 25 | * @return the IP address of the servlet request 26 | */ 27 | public static String getRemoteAddr(HttpServletRequest httpServletRequest) { 28 | String remoteAddr = ""; 29 | 30 | if (httpServletRequest != null) { 31 | remoteAddr = httpServletRequest.getHeader("X-FORWARDED-FOR"); 32 | if (remoteAddr == null || "".equals(remoteAddr)) { 33 | remoteAddr = httpServletRequest.getRemoteAddr(); 34 | } 35 | } 36 | 37 | return remoteAddr; 38 | 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/KeepTempFilePolicyParms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * 15 | * Define if we delete the temp files created when uploading and downloading 16 | * Blobs/Clob. 17 | * 18 | * @author Nicolas de Pomereu 19 | */ 20 | 21 | public class KeepTempFilePolicyParms { 22 | 23 | /** if true, the local blob files will be deleted after been uploaded */ 24 | public static boolean KEEP_TEMP_FILE = FrameworkDebug.isSet(KeepTempFilePolicyParms.class); 25 | 26 | /** 27 | * No Constructor 28 | */ 29 | protected KeepTempFilePolicyParms() { 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/SqlActionCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | * Parameters to be used in programs 17 | */ 18 | 19 | public class SqlActionCallable { 20 | 21 | public static final String ACTION_SQL_CALLABLE_EXECUTE_QUERY = "sql_call_ex_qu"; 22 | public static final String ACTION_SQL_CALLABLE_EXECUTE_RAW = "sql_call_ex_raw"; 23 | 24 | /** 25 | * Protected Constructor 26 | */ 27 | protected SqlActionCallable() { 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/SqlActionTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | * Parameters to be used in programs 17 | */ 18 | 19 | public class SqlActionTransaction { 20 | 21 | public static final String ACTION_SQL_COMMIT = "sql_commit"; 22 | public static final String ACTION_SQL_ROLLBACK = "sql_rollback"; 23 | public static final String ACTION_SQL_CON_CLOSE = "sql_con_close"; 24 | 25 | public static final String ACTION_SQL_SET_AUTOCOMMIT = "sql_set_autocommit"; 26 | public static final String ACTION_SQL_SET_READ_ONLY = "sql_set_read_only "; 27 | public static final String ACTION_SQL_SET_HOLDABILITY = "sql_set_holdability"; 28 | public static final String ACTION_SQL_SET_TRANSACTION_ISOLATION = "sql_set_transaction_isolation="; 29 | 30 | public static final String ACTION_SQL_GET_AUTOCOMMIT = "sql_get_autocommit"; 31 | public static final String ACTION_SQL_IS_READ_ONLY = "sql_is_read_only "; 32 | public static final String ACTION_SQL_GET_HOLDABILITY = "sql_get_holdability"; 33 | public static final String ACTION_SQL_GET_TRANSACTION_ISOLATION = "sql_get_transaction_isolation="; 34 | 35 | /** 36 | * Protected Constructor 37 | */ 38 | protected SqlActionTransaction() { 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/SqlEventUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class SqlEventUtil { 22 | 23 | /** 24 | * Transforms the Object parameters values into strings. 25 | * 26 | * @param parameterValues the Object parameter values 27 | * @return the converted String parameter values 28 | */ 29 | public static List toString(List parameterValues) { 30 | List list = new ArrayList<>(); 31 | for (Object object : parameterValues) { 32 | list.add(String.valueOf(object)); 33 | } 34 | return list; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/SqlReturnCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | * Return codes specific to SQL Framework 17 | */ 18 | 19 | public class SqlReturnCode { 20 | 21 | public static final String SESSION_INVALIDATED = "SESSION_INVALIDATED"; 22 | 23 | /** 24 | * 25 | */ 26 | protected SqlReturnCode() { 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/SqlTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import org.kawanfw.sql.version.VersionWrapper; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class SqlTag { 21 | 22 | public static final String SQL_PRODUCT_INIT = "[" 23 | + VersionWrapper.getName().toUpperCase() + " INIT]"; 24 | 25 | public static final String SQL_PRODUCT_START = "[" 26 | + VersionWrapper.getName().toUpperCase() + " START]"; 27 | public static final String SQL_PRODUCT_START_FAILURE = "[" 28 | + VersionWrapper.getName().toUpperCase() + " START FAILURE]"; 29 | 30 | public static final String USER_CONFIGURATION = "[USER CONFIGURATION]"; 31 | public static final String SQL_PRODUCT_LICENSE_FAILURE = "[" 32 | + VersionWrapper.getName().toUpperCase() + " - LICENSE FAILURE]"; 33 | 34 | public static final String PLEASE_CORRECT = "Please correct and retry."; 35 | 36 | protected SqlTag() { 37 | 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/TimestampUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util; 13 | 14 | import java.text.SimpleDateFormat; 15 | import java.util.Date; 16 | 17 | public class TimestampUtil { 18 | 19 | private static final String PATTERN = "yyyy-MM-dd HH:mm:ss.SSS"; 20 | private static final String PATTERN_SHORT = "yyyy-MM-dd HH:mm:ss"; 21 | /** 22 | * Protected 23 | */ 24 | protected TimestampUtil() { 25 | 26 | } 27 | 28 | public static String getHumanTimestampNow() { 29 | return getHumanTimestamp(System.currentTimeMillis()); 30 | } 31 | 32 | public static String getHumanTimestampNoMillisNow() { 33 | return getHumanTimestampNoMillis(System.currentTimeMillis()); 34 | } 35 | 36 | public static String getHumanTimestamp(long timestamp) { 37 | return new SimpleDateFormat(PATTERN).format(new Date(timestamp)); 38 | } 39 | 40 | public static String getHumanTimestampNoMillis(long timestamp) { 41 | return new SimpleDateFormat(PATTERN_SHORT).format(new Date(timestamp)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/SqlCommentsDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser; 13 | 14 | import java.util.regex.Pattern; 15 | 16 | import org.apache.commons.lang3.StringUtils; 17 | 18 | /** 19 | * Detects if sql statement part without values in quotes has comments 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class SqlCommentsDetector { 24 | 25 | private static Pattern commentPattern = Pattern.compile("/\\*.*?\\*/", Pattern.DOTALL); 26 | 27 | private String sql; 28 | 29 | private boolean withComments; 30 | 31 | public SqlCommentsDetector(String sql) { 32 | this.sql = sql; 33 | } 34 | 35 | /** 36 | * @return true if the SQL statement part contains comments 37 | */ 38 | public boolean isWithComments() { 39 | return withComments; 40 | } 41 | 42 | /** 43 | * Remove the comments from the statement part 44 | * @return statement part without comments 45 | */ 46 | public String removeComments() { 47 | // 1) Surrounds /* and */ with spaces 48 | sql = StringUtils.replace(sql, "/*", " /* "); 49 | sql = StringUtils.replace(sql, "*/", " */ "); 50 | 51 | // 2) Remvoe then 52 | final String sqlOut = commentPattern.matcher(sql).replaceAll(""); 53 | 54 | this.withComments = sql.length() == sqlOut.length() ? false:true; 55 | 56 | return sqlOut; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/StatementAnalyzerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser; 13 | 14 | /** 15 | * @author Nicolas de Pomereu 16 | * 17 | */ 18 | public class StatementAnalyzerUtil { 19 | 20 | /** 21 | * Replace fulltext with _fulltext_ because of a bug in JSQLParser. 22 | * @param sql the sql query 23 | * @return the sql query with fulltext replaced by _fulltext_ and FULLTEXT replaced by _FULLTEXT_ 24 | */ 25 | public static String fixForJsqlparser(final String sql) { 26 | 27 | if (sql == null) { 28 | return null; 29 | } 30 | 31 | String theSql = sql; 32 | if (theSql.contains(" fulltext")) { 33 | theSql = theSql.replace(" fulltext", " _fulltext_"); 34 | } 35 | if (theSql.contains(" FULLTEXT")) { 36 | theSql = theSql.replace(" FULLTEXT", " _FULLTEXT_"); 37 | } 38 | if (theSql.contains("fulltext ")) { 39 | theSql = theSql.replace("fulltext ", "_fulltext_ "); 40 | } 41 | if (theSql.contains("FULLTEXT ")) { 42 | theSql = theSql.replace("FULLTEXT ", "_FULLTEXT_ "); 43 | } 44 | 45 | return theSql; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/keywords/SqlKeywords.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser.keywords; 13 | 14 | import java.util.Arrays; 15 | import java.util.HashSet; 16 | import java.util.Set; 17 | 18 | /** 19 | * Loads the set of keywords in memory and allow to get them. 20 | * 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class SqlKeywords { 25 | 26 | private static Set keywords = null; 27 | 28 | /** 29 | * Get the SQL keywords Set 30 | * @return the SQL keywords Set 31 | */ 32 | public static Set getKeywordSet() { 33 | if (keywords == null) { 34 | keywords= new HashSet(Arrays.asList(SqlKeywordsArray.KEYWORDS)); 35 | } 36 | 37 | return keywords; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/keywords/tools/SqlKeywordsFileReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser.keywords.tools; 13 | 14 | import java.io.BufferedReader; 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | import java.io.InputStreamReader; 18 | import java.util.LinkedHashSet; 19 | import java.util.Set; 20 | 21 | /** 22 | * @author Nicolas de Pomereu 23 | * 24 | */ 25 | class SqlKeywordsFileReader { 26 | 27 | private String name; 28 | 29 | 30 | public SqlKeywordsFileReader(String name) { 31 | this.name = name; 32 | } 33 | 34 | public Set buildKeywordsSet() throws IOException { 35 | 36 | Set keywords = new LinkedHashSet<>(); 37 | 38 | InputStream in = getClass().getResourceAsStream(name); 39 | try (BufferedReader bufferedReader = new BufferedReader( 40 | new InputStreamReader(in));) { 41 | 42 | String line = null; 43 | while ((line = bufferedReader.readLine()) != null) { 44 | keywords.add(line.toUpperCase().trim()); 45 | } 46 | } 47 | 48 | return keywords; 49 | } 50 | 51 | public static void main(String[] args) throws IOException { 52 | SqlKeywordsFileReader sqlKeywordsFileReader = new SqlKeywordsFileReader(SqlKeywordsClassBuilder.SQL_KEYWORDS_TXT); 53 | Set keywords = sqlKeywordsFileReader.buildKeywordsSet(); 54 | for (String keyword : keywords) { 55 | System.out.println(keyword); 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/keywords/tools/SqlKeywordsTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser.keywords.tools; 13 | class SqlKeywordsTemplate { 14 | @SuppressWarnings("unused") 15 | private static String [] KEYWORDS = { 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/util/parser/keywords/tools/SqlKeywordsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.util.parser.keywords.tools; 13 | 14 | import java.util.Set; 15 | 16 | import org.kawanfw.sql.util.parser.keywords.SqlKeywords; 17 | 18 | /** 19 | * @author Nicolas de Pomereu 20 | * 21 | */ 22 | class SqlKeywordsTest { 23 | 24 | /** 25 | * @param args 26 | */ 27 | public static void main(String[] args) { 28 | Set keywords = SqlKeywords.getKeywordSet(); 29 | System.out.println(keywords); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/version/EditionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.version; 13 | /** 14 | * @author Nicolas de Pomereu 15 | * 16 | */ 17 | 18 | public class EditionUtil { 19 | 20 | /** 21 | * Says is edition is Enterprise. 22 | */ 23 | public static boolean isEnterpriseEdition() { 24 | String edition = System.getProperty("ACEQL_EDITION"); 25 | if (edition == null) { 26 | return false; 27 | } 28 | return edition.equals("ACEQL_ENTERPRISE"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/version/Vendor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.version; 13 | class Vendor { 14 | public static final String NAME = "KawanSoft SAS"; 15 | public static final String WEB = "https://www.kawansoft.com"; 16 | public static final String COPYRIGHT = "Copyright © 2023"; 17 | public static final String EMAIL = "contact@kawansoft.com"; 18 | @Override 19 | public String toString() { 20 | return Vendor.NAME + " - " + Vendor.WEB; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/kawanfw/sql/version/VersionValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.version; 13 | /** 14 | * Contains the package DefaultVersion info 15 | */ 16 | class VersionValues { 17 | public static final String VERSION = "v12.5"; 18 | public static final String DATE = "17-Jun-2024"; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/main.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/DefaultLoggerCreator.properties: -------------------------------------------------------------------------------- 1 | 2 | ############################################################ 3 | # Logging Configuration File DefaultLoggerCreator 4 | # File must be located in user.home/.kawansoft/conf. 5 | # 6 | # If the file does not exist, the default values 7 | # are used. 8 | ############################################################ 9 | 10 | # The logging directory. Defauts to user.home/.kawansoft/log. 11 | logDirectory= 12 | 13 | # The file name pattern following Logback format. 14 | # Defaults to aceql_%d.log.%i. 15 | fileNamePattern=aceql_%d.log.%i 16 | 17 | # The pattern for each log line, following Logback format. 18 | # Defaults to %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 19 | # 20 | pattern=%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 21 | 22 | # The maximum file size in byte. Defaults to 300Mb. 23 | maxFileSize= 314572800 24 | 25 | # The total file size before rotation begins. Defaults to 3Gb. 26 | totalSizeCap=3221225472 27 | 28 | # Says if logging must be done on console too. Defaults to false. 29 | displayOnConsole=false 30 | 31 | # Says if the status of the log creation is to be displayed on stderr. 32 | # This is to be used to debug the log creation. Defaults to false. 33 | displayLogStatusMessages=false -------------------------------------------------------------------------------- /src/main/resources/JsonLoggerSqlFirewallTrigger.properties: -------------------------------------------------------------------------------- 1 | 2 | ############################################################ 3 | # Logging Configuration File JsonLoggerSqlFirewallTrigger 4 | # File must be located in user.home/.kawansoft/conf dir. 5 | # 6 | # If the file does not exist, the default values 7 | # are used. 8 | ############################################################ 9 | 10 | # The logging directory. Defauts to user.home/.kawansoft/log. 11 | logDirectory= 12 | 13 | # The file name pattern following Logback format. 14 | # JsonLoggerSqlFirewallTrigger_%d.log.%i 15 | fileNamePattern=JsonLoggerSqlFirewallTrigger_%d.log.%i 16 | 17 | # The pattern for each log line, following Logback format. 18 | # Defaults to %msg%n 19 | # 20 | pattern=%msg%n 21 | 22 | # The maximum file size in byte. Defaults to 300Mb. 23 | maxFileSize= 314572800 24 | 25 | # The total file size before rotation begins. Defaults to 3Gb. 26 | totalSizeCap=3221225472 27 | 28 | # Says if logging must be done on console too. Defaults to false it not set. 29 | displayOnConsole=false 30 | 31 | # Says if the status of the log creation is to be displayed on stderr. 32 | # This is to be used to debug the log creation. 33 | displayLogStatusMessages=false -------------------------------------------------------------------------------- /src/main/resources/JsonLoggerUpdateListener.properties: -------------------------------------------------------------------------------- 1 | 2 | ############################################################ 3 | # Logging Configuration File JsonLoggerUpdateListener 4 | # File must be located in user.home/.kawansoft/conf dir. 5 | # 6 | # If the file does not exist, the default values 7 | # are used. 8 | ############################################################ 9 | 10 | # The logging directory. Defauts to user.home/.kawansoft/log. 11 | logDirectory= 12 | 13 | # The file name pattern following Logback format. 14 | # JsonLoggerUpdateListener_%d.log.%i 15 | fileNamePattern=JsonLoggerUpdateListener_%d.log.%i 16 | 17 | # The pattern for each log line, following Logback format. 18 | # Defaults to %msg%n 19 | # 20 | pattern=%msg%n 21 | 22 | # The maximum file size in byte. Defaults to 300Mb. 23 | maxFileSize= 314572800 24 | 25 | # The total file size before rotation begins. Defaults to 3Gb. 26 | totalSizeCap=3221225472 27 | 28 | # Says if logging must be done on console too. Defaults to false it not set. 29 | displayOnConsole=false 30 | 31 | # Says if the status of the log creation is to be displayed on stderr. 32 | # This is to be used to debug the log creation. 33 | displayLogStatusMessages=false -------------------------------------------------------------------------------- /src/main/resources/dummy.txt: -------------------------------------------------------------------------------- 1 | Required for adding src/main/resources to Git index. -------------------------------------------------------------------------------- /src/test/java/README.txt: -------------------------------------------------------------------------------- 1 | AceQL 2 | ----- 3 | 4 | All majors tests are run using The Client SDK (aceql-http-client-jdbc-driver project): 5 | com.aceql 6 | aceql-http-client-jdbc-driver 7 | x.y 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/test/java/com/mycompany/MyLdapUserAuthenticatorUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package com.mycompany; 13 | 14 | import javax.naming.NamingException; 15 | import javax.naming.directory.DirContext; 16 | 17 | public class MyLdapUserAuthenticatorUtil { 18 | 19 | /** 20 | * Closes the DirContext 21 | * 22 | * @param ctx the DirContext to close 23 | */ 24 | public static void closeDirContext(DirContext ctx) { 25 | try { 26 | ctx.close(); 27 | } catch (NamingException e) { 28 | System.err.println("InitialDirContext.close() Exception: " + e); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/sql/server/session/test/AuthSessionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.server.session.test; 13 | 14 | import org.kawanfw.sql.api.server.session.SessionIdentifierGenerator; 15 | import org.kawanfw.sql.api.server.session.SessionInfo; 16 | 17 | /** 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class AuthSessionTest { 22 | 23 | 24 | /** 25 | * @param args 26 | */ 27 | public static void main(String[] args) throws Exception { 28 | 29 | String username = "user1"; 30 | String database = "my_database"; 31 | 32 | SessionIdentifierGenerator sessionIdentifierGenerator = new SessionIdentifierGenerator(); 33 | String sessionId = sessionIdentifierGenerator.nextSessionId(); 34 | 35 | @SuppressWarnings("unused") 36 | SessionInfo SessionInfo = new SessionInfo(sessionId, username, 37 | database); 38 | System.out.println("sessionId: " + sessionId); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/sql/server/session/test/JwtSessionConfiguratorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.sql.server.session.test; 13 | 14 | import org.kawanfw.sql.api.server.session.JwtSessionConfigurator; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class JwtSessionConfiguratorTest { 21 | 22 | /** 23 | * @param args 24 | */ 25 | public static void main(String[] args) throws Exception { 26 | JwtSessionConfigurator jwtSessionConfigurator = new JwtSessionConfigurator(); 27 | 28 | String token = jwtSessionConfigurator.generateSessionId("username", 29 | "sampledb"); 30 | 31 | String username = jwtSessionConfigurator.getUsername(token); 32 | String database = jwtSessionConfigurator.getDatabase(token); 33 | 34 | System.out.println("username: " + username); 35 | System.out.println("database: " + database); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/auth/MyRequestHeadersAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.auth; 13 | 14 | import java.io.IOException; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | import java.util.Map; 18 | import java.util.Set; 19 | 20 | import org.kawanfw.sql.api.server.auth.headers.RequestHeadersAuthenticator; 21 | 22 | public class MyRequestHeadersAuthenticator implements RequestHeadersAuthenticator { 23 | 24 | @Override 25 | public boolean validate(Map headers) throws IOException { 26 | // Print all the request headers (name, value) on stdout 27 | 28 | Set keysSet = headers.keySet(); 29 | List keysList = new ArrayList(); 30 | keysList.addAll(keysSet); 31 | 32 | System.out.println(); 33 | for (String key : keysList) { 34 | System.out.println(key + ": " + headers.get(key)); 35 | } 36 | 37 | // This true says that we have accepted all values. 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/auth/SshUserAuthenticatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.auth; 13 | 14 | import java.io.File; 15 | import java.io.IOException; 16 | import java.sql.SQLException; 17 | import java.util.Date; 18 | 19 | import org.apache.commons.io.FileUtils; 20 | import org.kawanfw.sql.api.server.auth.SshUserAuthenticator; 21 | import org.kawanfw.sql.servlet.injection.properties.PropertiesFileStore; 22 | 23 | /** 24 | * @author Nicolas de Pomereu 25 | * 26 | */ 27 | public class SshUserAuthenticatorTest { 28 | 29 | /** 30 | * Tests a login using SSH. 31 | * @throws IOException 32 | * @throws SQLException 33 | */ 34 | public static void test() throws IOException, SQLException { 35 | PropertiesFileStore.set(new File("I:\\_dev_awake\\aceql-http-main\\aceql-http\\conf\\aceql-server.properties")); 36 | SshUserAuthenticator sshUserAuthenticator = new SshUserAuthenticator(); 37 | String password = FileUtils.readFileToString(new File("I:\\__NDP\\_MyPasswords\\login_user1.txt"), "UTF-8"); 38 | boolean logged = sshUserAuthenticator.login("user1", password.toCharArray(), "database", "10.0.0.10"); 39 | System.out.println(new Date() + " SshUserAuthenticator logged: " + logged); 40 | } 41 | 42 | /** 43 | * @param args 44 | */ 45 | public static void main(String[] args) throws Exception { 46 | test(); 47 | } 48 | 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/auth/TestAll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.auth; 13 | 14 | import java.util.Date; 15 | 16 | /** 17 | * Test all built in Authenticator classes. 18 | * @author Nicolas de Pomereu 19 | * 20 | */ 21 | public class TestAll { 22 | 23 | /** 24 | * @param args 25 | */ 26 | public static void main(String[] args) throws Exception { 27 | System.out.println(new Date() + " Begin..."); 28 | SshUserAuthenticatorTest.test(); 29 | WindowsUserAuthenticatorTest.test(); 30 | System.out.println(new Date() + " End..."); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/config/JsonLoggerUpdateListenerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.config; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import org.kawanfw.sql.api.server.SqlEvent; 18 | import org.kawanfw.sql.api.server.SqlEventWrapper; 19 | import org.kawanfw.sql.servlet.util.UpdateListenerUtil; 20 | 21 | /** 22 | * @author Nicolas de Pomereu 23 | * 24 | */ 25 | public class JsonLoggerUpdateListenerTest { 26 | 27 | public static void main(String[] args) throws Exception { 28 | List list = new ArrayList<>(); 29 | list.add("value1"); 30 | list.add("value2"); 31 | list.add("value3"); 32 | SqlEvent evt = SqlEventWrapper.sqlEventBuild("user1", "db1", "10.0.0.0", "select * from table", false, list, false); 33 | 34 | String jsonString = UpdateListenerUtil.toJsonString(evt); 35 | System.out.println(jsonString); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/config/MyUpdateListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.config; 13 | 14 | import java.io.IOException; 15 | import java.sql.Connection; 16 | import java.sql.SQLException; 17 | import java.util.Date; 18 | 19 | import org.kawanfw.sql.api.server.SqlEvent; 20 | import org.kawanfw.sql.api.server.listener.UpdateListener; 21 | 22 | /** 23 | * Concrete implementation of {@code UpdateListener}. The 24 | * {@code updateActionPerformed(ClientEvent, Connection)} logs 25 | * {@code ClientEvent} on stdout. 26 | * 27 | * @author Nicolas de Pomereu 28 | * @since 9.0 29 | */ 30 | 31 | public class MyUpdateListener implements UpdateListener { 32 | 33 | /** 34 | * Prints all successful SQL updates main info on stdout 35 | */ 36 | @Override 37 | public void updateActionPerformed(SqlEvent sqlEvent, Connection connection) throws IOException, SQLException { 38 | 39 | System.out.println(new Date() + " client username: " + sqlEvent.getUsername() + " database: " + sqlEvent.getDatabase() 40 | + " SQL statement: " + sqlEvent.getSql() + " user IP address: " + sqlEvent.getIpAddress()); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/config/PropertiesPasswordManagerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.config; 13 | 14 | import java.io.FileInputStream; 15 | import java.util.Properties; 16 | 17 | import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; 18 | import org.jasypt.iv.RandomIvGenerator; 19 | import org.jasypt.properties.EncryptableProperties; 20 | 21 | /** 22 | * @author Nicolas de Pomereu 23 | * 24 | */ 25 | public class PropertiesPasswordManagerTest { 26 | 27 | 28 | /** 29 | * @param args 30 | */ 31 | public static void main(String[] args) throws Exception { 32 | StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); 33 | encryptor.setPassword("azerty123"); // could be got from web, env variable... 34 | encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); 35 | encryptor.setIvGenerator(new RandomIvGenerator()); 36 | 37 | /* 38 | * Create our EncryptableProperties object and load it the usual way. 39 | */ 40 | Properties props = new EncryptableProperties(encryptor); 41 | props.load(new FileInputStream("I:\\_dev_awake\\aceql-http-main\\aceql-http\\conf\\aceql-server.properties")); 42 | 43 | System.out.println(props.get("sampledb.username")); 44 | System.out.println(props.get("sampledb.password")); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/config/SqlFirewallTriggerUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.config; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import org.kawanfw.sql.api.server.SqlEvent; 18 | import org.kawanfw.sql.api.server.SqlEventWrapper; 19 | import org.kawanfw.sql.api.server.firewall.SqlFirewallManager; 20 | import org.kawanfw.sql.servlet.util.SqlFirewallTriggerUtil; 21 | 22 | /** 23 | * @author Nicolas de Pomereu 24 | * 25 | */ 26 | public class SqlFirewallTriggerUtilTest { 27 | 28 | public static void main(String[] args) throws Exception { 29 | List list = new ArrayList<>(); 30 | list.add("value1"); 31 | list.add("value2"); 32 | list.add("value3"); 33 | 34 | SqlFirewallManager sqlFirewallManager = null; 35 | SqlEvent evt = SqlEventWrapper.sqlEventBuild("user1", "db1", "10.0.0.0", "select * from table", false, list, false); 36 | 37 | String jsonString = SqlFirewallTriggerUtil.toJsonString(evt, sqlFirewallManager); 38 | System.out.println(jsonString); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/api/server/config/TestDatabaseConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.api.server.config; 13 | 14 | import java.util.Date; 15 | 16 | import org.kawanfw.sql.api.server.DatabaseConfigurator; 17 | import org.kawanfw.sql.api.server.DefaultDatabaseConfigurator; 18 | import org.kawanfw.sql.util.FrameworkDebug; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | * DatabaseConfigurator implementation. Its extends the default 24 | * configuration and provides a security mechanism for login. 25 | */ 26 | 27 | public class TestDatabaseConfigurator extends DefaultDatabaseConfigurator 28 | implements DatabaseConfigurator { 29 | 30 | /** Debug info */ 31 | private static boolean DEBUG = FrameworkDebug 32 | .isSet(TestDatabaseConfigurator.class); 33 | 34 | 35 | /** 36 | * @param s 37 | * the content to log/debug 38 | */ 39 | @SuppressWarnings("unused") 40 | private void debug(String s) { 41 | if (DEBUG) 42 | System.out.println( 43 | this.getClass().getName() + " " + new Date() + " " + s); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/run/server/.gitignore: -------------------------------------------------------------------------------- 1 | /SqlWebServerStartAdvanced.java 2 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/run/server/SqlWebServerStopNew.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.run.server; 13 | 14 | import org.kawanfw.sql.api.util.webserver.WebServerApiWrapper; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class SqlWebServerStopNew { 21 | 22 | /** 23 | * no constructor 24 | */ 25 | private SqlWebServerStopNew() { 26 | 27 | } 28 | 29 | /** 30 | * @param args 31 | * @throws Exception 32 | */ 33 | public static void main(String[] args) throws Exception { 34 | stopOnPort(9090); 35 | stopOnPort(9091); 36 | stopOnPort(9092); 37 | stopOnPort(9093); 38 | stopOnPort(9094); 39 | stopOnPort(9095); 40 | stopOnPort(9096); 41 | stopOnPort(9096); 42 | stopOnPort(9097); 43 | } 44 | 45 | /** 46 | * @param port 47 | */ 48 | private static void stopOnPort(int port) { 49 | WebServerApiWrapper webServerApiWrapper = new WebServerApiWrapper(); 50 | try { 51 | System.out.println("Stoping AceQL on port: " + port); 52 | webServerApiWrapper.stopServer(port); 53 | } catch (Exception e) { 54 | System.err.println(e.getMessage()); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/sql/metadata/aceql/AceQLMetaDataTestDatabaseMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.sql.metadata.aceql; 13 | 14 | import java.sql.Connection; 15 | import java.sql.DatabaseMetaData; 16 | 17 | import org.kawanfw.sql.metadata.AceQLMetaData; 18 | import org.kawanfw.sql.metadata.JdbcDatabaseMetaData; 19 | 20 | public class AceQLMetaDataTestDatabaseMetaData { 21 | 22 | /** 23 | * @param args 24 | */ 25 | public static void main(String[] args) throws Exception { 26 | 27 | for (int i = 1; i < 6; i++) { 28 | Connection connection = ConnectionParms.getConnection(i); 29 | 30 | DatabaseMetaData databaseMetaData = connection.getMetaData(); 31 | String databaseProductName = databaseMetaData.getDatabaseProductName(); 32 | System.out.println(); 33 | System.out.println("Product : " + databaseProductName); 34 | System.out.println("UserName: " + databaseMetaData.getUserName()); 35 | 36 | AceQLMetaData aceQLMetaData = new AceQLMetaData(connection); 37 | JdbcDatabaseMetaData jdbcDatabaseMetaData = aceQLMetaData.getJdbcDatabaseMetaData(); 38 | 39 | System.out.println("jdbcDatabaseMetaData : " + jdbcDatabaseMetaData); 40 | } 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/sql/metadata/aceql/RegExTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.sql.metadata.aceql; 13 | 14 | import java.util.regex.Matcher; 15 | import java.util.regex.Pattern; 16 | 17 | public class RegExTests { 18 | 19 | public static void main(String[] args) throws Exception { 20 | 21 | String text = "http://jenkov.com"; 22 | 23 | Pattern pattern = Pattern.compile("com$"); 24 | Matcher matcher = pattern.matcher(text); 25 | 26 | while(matcher.find()){ 27 | System.out.println("Found match at: " + matcher.start() + " to " + matcher.end()); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/stored_procedure/TestStoredProcedureCommons.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.stored_procedure; 13 | 14 | import java.sql.Connection; 15 | import java.sql.ResultSet; 16 | import java.sql.SQLException; 17 | import java.sql.Statement; 18 | 19 | /** 20 | * @author Nicolas de Pomereu 21 | * 22 | */ 23 | public class TestStoredProcedureCommons { 24 | 25 | public static void selectCustomerExecute(Connection connection) throws SQLException { 26 | String sql = "select * from customer where customer_id >= 1 order by customer_id"; 27 | Statement statement = connection.createStatement(); 28 | statement.execute(sql); 29 | 30 | ResultSet rs = statement.getResultSet(); 31 | 32 | while (rs.next()) { 33 | System.out.println(); 34 | System.out.println("customer_id : " + rs.getInt("customer_id")); 35 | System.out.println("customer_title: " + rs.getString("customer_title")); 36 | System.out.println("fname : " + rs.getString("fname")); 37 | System.out.println("lname : " + rs.getString("lname")); 38 | } 39 | System.out.println(); 40 | 41 | statement.close(); 42 | rs.close(); 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/.gitignore: -------------------------------------------------------------------------------- 1 | /TestMisc.java 2 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/JsonDatabaseMetaDataTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.util; 13 | 14 | import java.sql.Connection; 15 | import java.sql.DatabaseMetaData; 16 | 17 | import org.kawanfw.sql.servlet.metadata.JsonDatabaseMetaData; 18 | import org.kawanfw.test.parms.ConnectionLoader; 19 | 20 | /** 21 | * @author Nicolas de Pomereu 22 | * 23 | */ 24 | public class JsonDatabaseMetaDataTest { 25 | 26 | /** 27 | * @param args 28 | */ 29 | public static void main(String[] args) throws Exception { 30 | 31 | Connection connection = ConnectionLoader.getLocalConnection(); 32 | DatabaseMetaData databaseMetaData = connection.getMetaData(); 33 | 34 | JsonDatabaseMetaData jsonDatabaseMetaData = new JsonDatabaseMetaData( 35 | databaseMetaData); 36 | String JsonString = jsonDatabaseMetaData.build(); 37 | System.out.println(JsonString); 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/JsonSecurityMessageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.util; 13 | 14 | import java.util.ArrayList; 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | import org.kawanfw.sql.servlet.sql.json_return.JsonSecurityMessage; 20 | 21 | public class JsonSecurityMessageTest { 22 | 23 | /** 24 | * @param args 25 | */ 26 | public static void main(String[] args) { 27 | 28 | boolean doPrettyPrinting = true; 29 | String sqlOrder = "DELETE FROM CUSTOMER"; 30 | 31 | String errorMessage = "Statement not allowed for ExecuteUpdate"; 32 | String jsonErrorMessage = JsonSecurityMessage.statementNotAllowedBuild( 33 | sqlOrder, errorMessage, doPrettyPrinting); 34 | System.out.println(jsonErrorMessage); 35 | 36 | Map parameters = new HashMap<>(); 37 | parameters.put(1, "VARCHAR"); 38 | parameters.put(2, "INTEGER"); 39 | List values = new ArrayList<>(); 40 | values.add("Doe"); 41 | values.add(1); 42 | 43 | sqlOrder = "UPDATE CUSTOMER SET ? WHERE CUSTOMER_ID = ?"; 44 | errorMessage = "Prepared Statement not allowed."; 45 | jsonErrorMessage = JsonSecurityMessage.prepStatementNotAllowedBuild( 46 | sqlOrder, errorMessage, parameters, values, doPrettyPrinting); 47 | System.out.println(); 48 | System.out.println(jsonErrorMessage); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/PoolPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.util; 13 | 14 | import org.apache.tomcat.jdbc.pool.PoolProperties; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class PoolPropertiesTest { 21 | 22 | /** 23 | * @param args 24 | */ 25 | public static void main(String[] args) throws Exception { 26 | PoolProperties p = new PoolProperties(); 27 | p.setDriverClassName("driverClassName"); 28 | p.setUrl("url"); 29 | p.setUsername("username"); 30 | p.setPassword("password"); 31 | 32 | p.setInitialSize(10); 33 | p.setMaxActive(100); 34 | 35 | // p.setMinIdle(10); 36 | // p.setMaxIdle(maxIdle); 37 | // p.setValidationQuery("SELECT 1"); 38 | // p.setTimeBetweenEvictionRunsMillis(30000); 39 | 40 | // Other possible values to set 41 | // p.setTestOnBorrow(true); 42 | // p.setTestOnReturn(false); 43 | p.setValidationInterval(30000); 44 | 45 | p.setMaxWait(10000); 46 | p.setMinEvictableIdleTimeMillis(30000); 47 | 48 | p.setLogAbandoned(true); 49 | 50 | // p.setRemoveAbandonedTimeout(86400); 51 | p.setRemoveAbandoned(true); 52 | p.setRemoveAbandonedTimeout(3600); 53 | p.setRollbackOnReturn(true); 54 | 55 | p.setJdbcInterceptors("ConnectionState;StatementFinalizer"); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/TestReflection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.util; 13 | 14 | import java.lang.reflect.Method; 15 | 16 | /** 17 | * @author Nicolas de Pomereu 18 | * 19 | */ 20 | public class TestReflection { 21 | 22 | 23 | @SuppressWarnings({ "rawtypes", "unchecked", "unused" }) 24 | public static void testReflection() throws Exception { 25 | String myString = "Reflection!"; 26 | System.out.println("myString: " + myString); 27 | 28 | Class clazz = myString.getClass(); 29 | Method setter = clazz.getMethod("toLowerCase"); // You need to specify 30 | // the parameter types 31 | Object[] params = new Object[] { "New String" }; 32 | 33 | // If you have a static method you can pass 'null' instead. 34 | myString = (String) setter.invoke(myString); // 'this' represents the 35 | // class from were you 36 | // calling that method. 37 | System.out.println("myString: " + myString); 38 | } 39 | 40 | /** 41 | * @param args 42 | */ 43 | public static void main(String[] args) throws Exception { 44 | testReflection(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/UUIDGenerator.java: -------------------------------------------------------------------------------- 1 | package org.kawanfw.test.util; 2 | 3 | import java.util.UUID; 4 | 5 | public class UUIDGenerator { 6 | 7 | public static void main(String[] args) { 8 | UUID uuid = UUID.randomUUID(); 9 | String uuidStr = uuid.toString(); 10 | System.out.println("UUID: " + uuidStr); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/org/kawanfw/test/util/UsernameConverterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c)2023 KawanSoft S.A.S. All rights reserved. 3 | * 4 | * Use of this software is governed by the Business Source License included 5 | * in the LICENSE.TXT file in the project's root directory. 6 | * 7 | * Change Date: 2026-02-21 8 | * 9 | * On the date above, in accordance with the Business Source License, use 10 | * of this software will be governed by version 2.0 of the Apache License. 11 | */ 12 | package org.kawanfw.test.util; 13 | 14 | import org.kawanfw.sql.api.server.util.UsernameConverter; 15 | import org.kawanfw.sql.util.HtmlConverter; 16 | 17 | public class UsernameConverterTest { 18 | /** 19 | * @param args 20 | */ 21 | public static void main(String[] args) { 22 | String string = "user-<>:\"/\\|?*"; 23 | System.out.println(string); 24 | String specialString = UsernameConverter.fromSpecialChars(string); 25 | System.out.println(specialString); 26 | string = UsernameConverter.toSpecialChars(specialString); 27 | System.out.println(string); 28 | 29 | System.out.println(); 30 | String ldapUser = "cn=read-only-admin,dc=example,dc=com"; 31 | String ldapUserHtml = HtmlConverter.toHtml(ldapUser); 32 | System.out.println(ldapUserHtml); 33 | 34 | ldapUser = "CN=L. Eagle,O=Sue\\2C Grabbit and Runn,C=GB"; 35 | ldapUser = UsernameConverter.fromSpecialChars(ldapUser); 36 | System.out.println(ldapUser); 37 | ldapUser = HtmlConverter.toHtml(ldapUser); 38 | System.out.println(ldapUser); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/dummy.txt: -------------------------------------------------------------------------------- 1 | Required for adding src/test/resources to Git index. -------------------------------------------------------------------------------- /src/test/test.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | --------------------------------------------------------------------------------