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