Skip to content

Commit ab9fb64

Browse files
Merge branch 'master' into Compress
2 parents 21b11bd + e55e520 commit ab9fb64

File tree

287 files changed

+17871
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+17871
-69
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
2525
| gxexternalproviders | Implements service provider for IBM Cloud, Google, Azure, Amazon
2626
| gxgeospatial | Geography data type implementation
2727
| gxodata | OData access
28+
| securityapicommons | SecurityAPI's common module
29+
| gxcryptography | SecurityAPI's GeneXusCryptography module
30+
| gxjwt | SecurityAPI's GeneXusJWT module
31+
| gxxmlsignature | SecurityAPI's GeneXusXmlSignature module
32+
| gxftps | SecurityAPI's GeneXusFTPS module
33+
| gxsftp | SecurityAPI's GeneXusSFTP module
2834

2935
The dependencies between the projects are specified in each pom.xml within their directory.
3036

android/src/main/java/com/genexus/internet/HttpContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ public void SendState()
414414
}catch(Exception ex){}
415415
writeTextNL("<script type=\"text/javascript\">gx.http.useBase64State=true;</script>");
416416
}
417-
writeText("<div><input type=\"hidden\" name=\"GXState\" value='");
417+
writeText("<div><input type=\"hidden\" name=\"GXState\" data-gtm-ignore='true' value='");
418418
writeTextNL("'" + htmlEndTag(HTMLElement.INPUT) + "</div>");
419419
if (this.formCaption != null && !this.formCaption.equals(""))
420420
{

android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Map;
1010

1111
public class AndroidJSONSerialization implements IExtensionJSONSerialization {
12+
1213
@Override
1314
public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
1415
Map<String, Object> map = new LinkedHashMap<>();
@@ -24,4 +25,15 @@ public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapp
2425
public JSONTokener getJSONTokener(String s) {
2526
return new AndroidJSONTokenerWrapper(s);
2627
}
28+
29+
@Override
30+
public Map<String, Object> getJSONObjectMap(JSONObjectWrapper obj) {
31+
Map<String, Object> map = new LinkedHashMap<>();
32+
for (Iterator<String> it = obj.keys(); it.hasNext(); ) {
33+
String k = it.next();
34+
map.put(k, obj.get(k)); // add key and value to map result
35+
}
36+
return map;
37+
38+
}
2739
}

common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>org.bouncycastle</groupId>
4545
<artifactId>bcprov-jdk18on</artifactId>
46-
<version>1.78.1</version>
46+
<version>${org.bouncycastle.version}</version>
4747
</dependency>
4848
<dependency>
4949
<groupId>io.opentelemetry</groupId>

common/src/main/java/com/genexus/BaseProvider.java

Lines changed: 44 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.File;
44
import java.io.IOException;
5-
import java.nio.charset.StandardCharsets;
65
import java.util.Date;
76
import java.util.List;
87
import java.util.ListIterator;
@@ -20,6 +19,8 @@
2019
import com.genexus.common.interfaces.SpecificImplementation;
2120
import com.genexus.util.GXDirectory;
2221
import com.genexus.util.GXFileCollection;
22+
import org.springframework.core.io.ClassPathResource;
23+
import org.springframework.core.io.FileSystemResource;
2324
import org.springframework.core.io.Resource;
2425
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
2526

@@ -53,76 +54,65 @@ private void loadQueryTables()
5354
{
5455
String path = SpecificImplementation.Application.getModelContext().getHttpContext().getDefaultPath();
5556
String configurationDirectoryPath = path + File.separatorChar + "Metadata" + File.separatorChar + "TableAccess";
56-
57-
ConcurrentHashMap<String, Vector<String>> qTables = new ConcurrentHashMap();
58-
loadQueryTablesPlatform(configurationDirectoryPath, qTables);
57+
ConcurrentHashMap<String, Vector<String>> qTables = new ConcurrentHashMap<String, Vector<String>>();
58+
if (ApplicationContext.getInstance().isSpringBootApp())
59+
loadQueryTablesSpringBoot(configurationDirectoryPath, qTables);
60+
else
61+
loadQueryTablesFileSystem(configurationDirectoryPath, qTables);
5962
startupDate = CommonUtil.now(false,false);
6063
queryTables = qTables;
6164
}
6265
}
6366

64-
public void loadQueryTablesPlatform(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
65-
if (ApplicationContext.getInstance().isSpringBootApp())
66-
loadQueryTablesSpringBoot(configurationDirectoryPath, qTables);
67-
else
68-
loadQueryTablesNone(configurationDirectoryPath, qTables);
69-
70-
}
71-
72-
public void loadQueryTablesNone(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
67+
private void loadQueryTablesFileSystem(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables){
7368
GXDirectory configurationDirectory = new GXDirectory(configurationDirectoryPath);
7469
GXFileCollection files = configurationDirectory.getFiles();
7570
XMLReader reader = new XMLReader();
76-
short ok;
77-
boolean anyTable=false;
78-
for(int i=1; i <= files.getItemCount(); i++) {
79-
Vector<String> lst = new Vector<String>();
80-
lst.add(FORCED_INVALIDATE); // Caso en que se invalido el cache manualmente
71+
boolean anyTables=false;
72+
for(int i=1; i <= files.getItemCount(); i++)
73+
{
8174
AbstractGXFile xmlFile = files.item(i);
82-
reader.open(xmlFile.getAbsoluteName());
83-
ok = reader.readType(1, "Table");
84-
while (ok == 1) {
85-
anyTable=true;
86-
lst.add(normalizeKey(reader.getAttributeByName("name")));
87-
ok = reader.readType(1, "Table");
88-
}
89-
reader.close();
90-
if (anyTable) {
91-
qTables.put(normalizeKey(xmlFile.getNameNoExt()), lst);
92-
}
75+
String xmlFileName = xmlFile.getAbsoluteName();
76+
String xmlFileNameNoExt = xmlFile.getNameNoExt();
77+
anyTables = processXMLFile(reader, anyTables, xmlFileName, xmlFileNameNoExt, qTables);
9378
}
9479
}
9580

96-
public void loadQueryTablesSpringBoot(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
81+
private void loadQueryTablesSpringBoot(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables){
82+
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
9783
try {
98-
Resource[] resources = new PathMatchingResourcePatternResolver().getResources(configurationDirectoryPath + "/*.xml");
84+
Resource[] resources = resolver.getResources("classpath:" + configurationDirectoryPath + "/*");
9985
XMLReader reader = new XMLReader();
100-
reader.setDocEncoding("UTF8");
101-
short ok;
102-
boolean anyTable=false;
103-
String xmlContent;
104-
for (int i = 0; i < resources.length; i++) {
105-
Vector<String> lst = new Vector<String>();
106-
lst.add(FORCED_INVALIDATE);
107-
xmlContent = resources[i].getContentAsString(StandardCharsets.UTF_8);
108-
if (!xmlContent.startsWith("<"))
109-
xmlContent = xmlContent.substring(1); //Avoid BOM
110-
reader.openFromString(xmlContent);
111-
ok = reader.readType(1, "Table");
112-
while (ok == 1) {
113-
anyTable=true;
114-
lst.add(normalizeKey(reader.getAttributeByName("name")));
115-
ok = reader.readType(1, "Table");
116-
}
117-
reader.close();
118-
if (anyTable) {
119-
qTables.put(normalizeKey(resources[i].getFilename().substring(0, resources[i].getFilename().lastIndexOf("."))), lst);
120-
}
86+
boolean anyTables=false;
87+
for (Resource resource : resources) {
88+
String xmlFileName = resource.getFilename();
89+
String xmlFileNameNoExt = xmlFileName.substring(0, xmlFileName.lastIndexOf('.'));
90+
xmlFileName = resource instanceof FileSystemResource? ((FileSystemResource) resource).getPath() : ((ClassPathResource) resource).getPath();
91+
anyTables = processXMLFile(reader, anyTables, xmlFileName, xmlFileNameNoExt, qTables);
12192
}
12293
}
123-
catch (IOException e) {
124-
logger.error("Error reading Table Access metadata", e);
94+
catch (IOException e){
95+
logger.error("Error loading Query Tables ", e);
96+
}
97+
}
98+
99+
private boolean processXMLFile(XMLReader reader, boolean anyTables, String xmlFileName, String xmlFileNameNoExt, ConcurrentHashMap<String, Vector<String>> qTables) {
100+
Vector<String> lst = new Vector<>();
101+
lst.add(FORCED_INVALIDATE); // Caso en que se invalido el cache manualmente
102+
reader.open(xmlFileName);
103+
short ok = reader.readType(1, "Table");
104+
boolean anyLocalTables = false;
105+
while (ok == 1)
106+
{
107+
anyLocalTables = true;
108+
lst.add(normalizeKey(reader.getAttributeByName("name")));
109+
ok = reader.readType(1, "Table");
110+
}
111+
reader.close();
112+
if (anyTables || anyLocalTables) {
113+
qTables.put(normalizeKey(xmlFileNameNoExt), lst);
125114
}
115+
return anyTables || anyLocalTables;
126116
}
127117

128118
public ConcurrentHashMap<String, Vector<String>> queryTables() {

common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
public interface IExtensionJSONSerialization {
1010
Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj);
1111
JSONTokener getJSONTokener(String s);
12+
public Map<String, Object> getJSONObjectMap(JSONObjectWrapper obj);
1213
}

common/src/main/java/com/genexus/json/JSONObjectWrapper.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ public JSONObjectWrapper(String string) {
2222
? SpecificImplementation.JsonSerialization.getJSONTokener(string)
2323
: new JSONTokenerWrapper(string)
2424
);
25-
26-
if (map == null)
27-
map = new LinkedHashMap<String, Object>();
25+
initMap();
2826
}
2927

3028
public JSONObjectWrapper(JSONTokenerWrapper token) {
3129
super(token);
32-
if (map == null)
33-
map = new LinkedHashMap<String, Object>();
30+
initMap();
3431
}
3532

3633
public JSONObjectWrapper(Map<?,?> m) {
@@ -48,8 +45,18 @@ public JSONObjectWrapper(Map<?,?> m) {
4845

4946
public JSONObjectWrapper(JSONObject jsonObject) {
5047
super(jsonObject.toString());
48+
initMap();
49+
}
50+
51+
private void initMap() {
5152
if (map == null)
52-
map = new LinkedHashMap<String, Object>();
53+
{
54+
// this is a workaround for the Android implementation not loading the map in the JsonObject constructor
55+
if (SpecificImplementation.JsonSerialization != null)
56+
map = SpecificImplementation.JsonSerialization.getJSONObjectMap(this);
57+
else
58+
map = new LinkedHashMap<String, Object>();
59+
}
5360
}
5461

5562
public Set<Entry<String, Object>> entrySet() {

gxcryptocommon/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>org.bouncycastle</groupId>
2424
<artifactId>bcpkix-jdk18on</artifactId>
25-
<version>1.78.1</version>
25+
<version>${org.bouncycastle.version}</version>
2626
</dependency>
2727
<dependency>
2828
<groupId>org.apache.santuario</groupId>

gxcryptography/pom.xml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.genexus</groupId>
8+
<artifactId>parent</artifactId>
9+
<version>${revision}${changelist}</version>
10+
</parent>
11+
12+
<artifactId>gxcryptography</artifactId>
13+
<name>GeneXus Cryptography</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.bouncycastle</groupId>
18+
<artifactId>bcpkix-jdk18on</artifactId>
19+
<version>${org.bouncycastle.version}</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.bouncycastle</groupId>
23+
<artifactId>bcprov-jdk18on</artifactId>
24+
<version>${org.bouncycastle.version}</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.apache.logging.log4j</groupId>
28+
<artifactId>log4j-core</artifactId>
29+
<version>${log4j.version}</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>${project.groupId}</groupId>
33+
<artifactId>securityapicommons</artifactId>
34+
<version>${project.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>${project.groupId}</groupId>
38+
<artifactId>securityapicommons</artifactId>
39+
<type>test-jar</type>
40+
<version>${revision}${changelist}</version>
41+
<scope>test</scope>
42+
</dependency>
43+
</dependencies>
44+
<build>
45+
<finalName>GeneXusCryptography</finalName>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>3.8.0</version>
51+
<configuration>
52+
<source>1.8</source>
53+
<target>1.8</target>
54+
</configuration>
55+
</plugin>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-jar-plugin</artifactId>
59+
<version>3.1.1</version>
60+
<executions>
61+
<execution>
62+
<goals>
63+
<goal>test-jar</goal>
64+
</goals>
65+
</execution>
66+
</executions>
67+
</plugin>
68+
</plugins>
69+
</build>
70+
71+
</project>

0 commit comments

Comments
 (0)