-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors XML to template conversion
Previous implemtation was re-implementing the full XML parser. This version uses Stax as XML parser and adds parsing of the characters events to extract JTwig code islands.
- Loading branch information
Showing
41 changed files
with
3,155 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"protocol":"http", | ||
"host":"0.0.0.0", | ||
"port":2115, | ||
"tmpFolder":"docsCache",/** cache during a request, it will be deleted when the request is finished **/ | ||
"min": 10,/** min workers **/ | ||
"max": 100,/** max workers **/ | ||
"timeout":"30s",/** timeout duration **/ | ||
"logConfig":{ | ||
"level":"TRACE", /** OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL **/ | ||
"level_console":"DEBUG", /** OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL **/ | ||
"maxFileSize": "5MB", | ||
"maxBackupIndex": 5, | ||
"pattern": "%d{dd.MM.yyyy HH:mm:ss} %-5p %c{1}:%L - %m%n", | ||
"filePath":"./logs/document-service.log" | ||
}, | ||
"libreConfig":{ | ||
"librepath":"/Applications/LibreOffice.app/Contents/MacOS/soffice", /** the libreoffice executable folder path **/ | ||
"min" : 10, /** default 8 | min executables ready to be ready. An executable is mainly needed to convert to PDF. It is recommended to use one exe for a request at the time.**/ | ||
"max" : 100, /** default 40 | max capacity of executable running. The next request will be on hold until one is freed or until request timeout..**/ | ||
"highLoad": 55 /** highLoad defines the percentage of executables in use, when it is reached prepare new ones to be ready for high availability and fast response.**/ | ||
/** Please note! LibreOffice likes to fail sometimes, to have a stable failover, you might want to keep the highLoad value around 50% or even lower.**/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
- - :permit | ||
- BSD | ||
- :who: | ||
:why: | ||
:versions: [] | ||
:when: 2019-12-20 09:24:59.598985000 Z | ||
- - :permit | ||
- MIT | ||
- :who: | ||
:why: | ||
:versions: [] | ||
:when: 2019-12-20 09:25:04.086031000 Z | ||
- - :permit | ||
- Apache 2.0 | ||
- :who: | ||
:why: | ||
:versions: [] | ||
:when: 2019-12-20 09:25:50.159396000 Z | ||
- - :permit | ||
- Apache 2.0, Eclipse Public License - Version 1.0 | ||
- :who: | ||
:why: | ||
:versions: [] | ||
:when: 2019-12-20 09:26:16.280768000 Z | ||
- - :approve | ||
- juh | ||
- :who: | ||
:why: LibreOffice MPL 2.0 | ||
:versions: [] | ||
:when: 2019-12-20 13:55:54.070224000 Z | ||
- - :approve | ||
- jurt | ||
- :who: | ||
:why: LibreOffice MPL 2.0 | ||
:versions: [] | ||
:when: 2019-12-20 13:55:58.446785000 Z | ||
- - :approve | ||
- ridl | ||
- :who: | ||
:why: LibreOffice MPL 2.0 | ||
:versions: [] | ||
:when: 2019-12-20 13:56:05.186925000 Z | ||
- - :approve | ||
- unoil | ||
- :who: | ||
:why: LibreOffice MPL 2.0 | ||
:versions: [] | ||
:when: 2019-12-20 13:56:10.946673000 Z | ||
- - :approve | ||
- javax.servlet-api | ||
- :who: | ||
:why: GPLv2 with CPE | ||
:versions: [] | ||
:when: 2019-12-20 13:56:57.264730000 Z | ||
- - :approve | ||
- jaxb-api | ||
- :who: | ||
:why: GPLv2 with CPE | ||
:versions: [] | ||
:when: 2019-12-20 14:04:55.702653000 Z |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.proxeus.xml.jtwig; | ||
|
||
public enum ExtractorState { | ||
XML, | ||
MAYBE_BEGIN_ISLAND, | ||
ISLAND, | ||
SINGLE_QUOTE_STRING, | ||
DOUBLE_QUOTE_STRING, | ||
MAYBE_END_ISLAND, | ||
} |
117 changes: 117 additions & 0 deletions
117
src/main/java/com/proxeus/xml/jtwig/ExtractorXMLEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.proxeus.xml.jtwig; | ||
|
||
import sun.nio.cs.ext.ISCII91; | ||
|
||
import javax.xml.namespace.QName; | ||
import javax.xml.stream.Location; | ||
import javax.xml.stream.XMLStreamException; | ||
import javax.xml.stream.events.Characters; | ||
import javax.xml.stream.events.EndElement; | ||
import javax.xml.stream.events.StartElement; | ||
import javax.xml.stream.events.XMLEvent; | ||
import java.io.Writer; | ||
|
||
public class ExtractorXMLEvent implements XMLEvent { | ||
|
||
private XMLEvent event; | ||
private ExtractorState state; | ||
private IslandType islandType; | ||
|
||
public ExtractorXMLEvent(XMLEvent event, ExtractorState state, IslandType islandType) { | ||
this.event = event; | ||
this.state = state; | ||
this.islandType = islandType; | ||
} | ||
|
||
public XMLEvent getEvent() { | ||
return event; | ||
} | ||
|
||
public ExtractorState getState() { | ||
return state; | ||
} | ||
|
||
@Override | ||
public int getEventType() { | ||
return event.getEventType(); | ||
} | ||
|
||
@Override | ||
public Location getLocation() { | ||
return event.getLocation(); | ||
} | ||
|
||
@Override | ||
public boolean isStartElement() { | ||
return event.isStartElement(); | ||
} | ||
|
||
@Override | ||
public boolean isAttribute() { | ||
return event.isAttribute(); | ||
} | ||
|
||
@Override | ||
public boolean isNamespace() { | ||
return event.isNamespace(); | ||
} | ||
|
||
@Override | ||
public boolean isEndElement() { | ||
return event.isEndElement(); | ||
} | ||
|
||
@Override | ||
public boolean isEntityReference() { | ||
return event.isEntityReference(); | ||
} | ||
|
||
@Override | ||
public boolean isProcessingInstruction() { | ||
return event.isProcessingInstruction(); | ||
} | ||
|
||
@Override | ||
public boolean isCharacters() { | ||
return event.isCharacters(); | ||
} | ||
|
||
@Override | ||
public boolean isStartDocument() { | ||
return event.isStartDocument(); | ||
} | ||
|
||
@Override | ||
public boolean isEndDocument() { | ||
return event.isEndDocument(); | ||
} | ||
|
||
@Override | ||
public StartElement asStartElement() { | ||
return event.asStartElement(); | ||
} | ||
|
||
@Override | ||
public EndElement asEndElement() { | ||
return event.asEndElement(); | ||
} | ||
|
||
@Override | ||
public Characters asCharacters() { | ||
return event.asCharacters(); | ||
} | ||
|
||
@Override | ||
public QName getSchemaType() { | ||
return event.getSchemaType(); | ||
} | ||
|
||
@Override | ||
public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException { | ||
event.writeAsEncodedUnicode(writer); | ||
} | ||
|
||
public String toString() { | ||
return event.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.proxeus.xml.jtwig; | ||
|
||
public enum IslandType { | ||
CODE, | ||
OUTPUT, | ||
COMMENT | ||
} |
Oops, something went wrong.