Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
25
nx01-warp-manifestor/pom.xml
Normal file
25
nx01-warp-manifestor/pom.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01</artifactId>
|
||||
<version>〇一。壬寅。一〄-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>nx01-warp-manifestor</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-driver</artifactId>
|
||||
</dependency>
|
||||
<dependency><!-- TEMP TODO: delete V2 V3 V4 V5 V6, this dep should be revered no2all is allowed to dep on warp code -->
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-no2all-nostr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.x4o.sax3.io.xdbx.XDBXReaderXml;
|
||||
import org.x4o.sax3.io.xdbx.XDBXWriterXml;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSex;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBit;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheMimeType;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContentPulser;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContentStringHandler;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ioini.ScopicIniConstants;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ioini.ScopicIniContentReader;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ioini.ScopicIniContentWriter;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestContentReader;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestContentWriter;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3.ScopicManifest3ContentReader;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3.ScopicManifest3ContentWriter;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4.ScopicManifest4ContentHandler;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4.ScopicManifest4ContentReader;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4.ScopicManifest4ContentWriter;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5.ScopicManifest5ContentParser;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5.ScopicManifest5ContentWriter;
|
||||
|
||||
/// Warp Manifestor Driver.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestorDriver {
|
||||
|
||||
private WarpManifestorDriver() {
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV1String(String input) {
|
||||
return readV1Array(input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV1Buffer(ByteBuffer input) {
|
||||
return readV1Array(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV1Array(byte[] input) {
|
||||
return readV1Stream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV1Stream(InputStream input) {
|
||||
WarpManifestX8 result = new WarpManifestX8();
|
||||
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestX0TheVersion.VERSION_1_0);
|
||||
ScopicManifestContentReader reader = new ScopicManifestContentReader(handler, ScopicManifestContentReader.FORCE_VERSION_1_0);
|
||||
try {
|
||||
reader.parse(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV2String(String input) {
|
||||
return readV2Array(input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV2Buffer(ByteBuffer input) {
|
||||
return readV2Array(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV2Array(byte[] input) {
|
||||
return readV2Stream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV2Stream(InputStream input) {
|
||||
WarpManifestX8 result = new WarpManifestX8();
|
||||
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestX0TheVersion.VERSION_1_0, WarpManifestX0TheVersion.VERSION_2_0);
|
||||
ScopicManifestContentReader reader = new ScopicManifestContentReader(handler);
|
||||
try {
|
||||
reader.parse(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV3Buffer(ByteBuffer input) {
|
||||
return readV3Array(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV3Array(byte[] input) {
|
||||
return readV3Stream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV3Stream(InputStream input) {
|
||||
WarpManifestX8 result = new WarpManifestX8();
|
||||
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestX0TheVersion.VERSION_3_0);
|
||||
ScopicManifest3ContentReader reader = new ScopicManifest3ContentReader(handler);
|
||||
TLVChainSexTeenBit chain = new TLVChainSexTeenBit();
|
||||
try {
|
||||
WarpManifestX0TheMimeType mimeType = WarpManifestX0TheMimeType.magicMarkerRead(input, WarpManifestX0TheMimeType.MARKER_3_LENGTH);
|
||||
if (!WarpManifestX0TheMimeType.MANIFEST_3.equals(mimeType)) {
|
||||
throw new ScopicManifestException("Invalid stream magic marker: " + mimeType); // TODO: move and change magicMarkerRead(in,enum)
|
||||
}
|
||||
chain.dataReadStream(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
reader.parse(chain);
|
||||
return result;
|
||||
}
|
||||
|
||||
static public WarpManifestX18 readV4Buffer(ByteBuffer input) {
|
||||
return readV4Array(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX18 readV4Array(byte[] input) {
|
||||
return readV4Stream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX18 readV4Stream(InputStream input) {
|
||||
WarpManifestX18 result = new WarpManifestX18();
|
||||
ScopicManifest4ContentHandler handler = new ScopicManifest4ContentHandler(result);
|
||||
ScopicManifest4ContentReader reader = new ScopicManifest4ContentReader(handler);
|
||||
TLVChainOctalSex chain = new TLVChainOctalSex();
|
||||
try {
|
||||
WarpManifestX0TheMimeType mimeType = WarpManifestX0TheMimeType.magicMarkerRead(input, WarpManifestX0TheMimeType.MARKER_4_LENGTH);
|
||||
if (!WarpManifestX0TheMimeType.MANIFEST_4.equals(mimeType)) {
|
||||
throw new ScopicManifestException("Invalid stream magic marker: " + mimeType); // TODO: move and change magicMarkerRead(in,enum)
|
||||
}
|
||||
chain.dataReadStream(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
reader.parse(chain);
|
||||
return result;
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV5Buffer(ByteBuffer input) {
|
||||
return readV5Array(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV5Array(byte[] input) {
|
||||
return readV5Stream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readV5Stream(InputStream input) {
|
||||
WarpManifestX8 result = new WarpManifestX8();
|
||||
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestX0TheVersion.VERSION_5_0);
|
||||
ScopicManifest5ContentParser contentParser = new ScopicManifest5ContentParser(handler);
|
||||
XDBXReaderXml reader = new XDBXReaderXml(contentParser);
|
||||
try {
|
||||
reader.parse(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readViniString(String input) {
|
||||
return readViniArray(input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readViniBuffer(ByteBuffer input) {
|
||||
return readViniArray(input.array());
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readViniArray(byte[] input) {
|
||||
return readViniStream(new ByteArrayInputStream(input));
|
||||
}
|
||||
|
||||
static public WarpManifestX8 readViniStream(InputStream input) {
|
||||
WarpManifestX8 result = new WarpManifestX8();
|
||||
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result);
|
||||
ScopicIniContentReader reader = new ScopicIniContentReader(handler);
|
||||
try {
|
||||
reader.parse(input);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// =================================================================================================================
|
||||
|
||||
static public String writeV1String(WarpManifestX8 manifest) {
|
||||
StringWriter writer = new StringWriter();
|
||||
writeV1StreamChar(manifest, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
static public void writeV1Stream(WarpManifestX8 manifest, OutputStream output) {
|
||||
writeV1StreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public void writeV1StreamChar(WarpManifestX8 manifest, Writer output) {
|
||||
ScopicManifestContentPulser.strobelight(manifest, new ScopicManifestContentWriter(output), WarpManifestX0TheVersion.VERSION_1_0.getQName());
|
||||
}
|
||||
|
||||
static public String writeV2String(WarpManifestX8 manifest) {
|
||||
StringWriter writer = new StringWriter();
|
||||
writeV2StreamChar(manifest, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
static public void writeV2Stream(WarpManifestX8 manifest, OutputStream output) {
|
||||
writeV2StreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public void writeV2StreamChar(WarpManifestX8 manifest, Writer output) {
|
||||
ScopicManifestContentPulser.strobelight(manifest, new ScopicManifestContentWriter(output), WarpManifestX0TheVersion.VERSION_2_0.getQName());
|
||||
}
|
||||
|
||||
static public ByteBuffer writeV3Buffer(WarpManifestX8 manifest) {
|
||||
return ByteBuffer.wrap(writeV3Array(manifest));
|
||||
}
|
||||
|
||||
static public byte[] writeV3Array(WarpManifestX8 manifest) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
writeV3Stream(manifest, baos);
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
static public void writeV3Stream(WarpManifestX8 manifest, OutputStream output) {
|
||||
TLVChainSexTeenBit chain = new TLVChainSexTeenBit();
|
||||
ScopicManifestContentPulser.strobelight(manifest, new ScopicManifest3ContentWriter(chain), WarpManifestX0TheVersion.VERSION_3_0.getQName());
|
||||
try {
|
||||
WarpManifestX0TheMimeType.magicMarkerWrite(output, WarpManifestX0TheMimeType.MANIFEST_3);
|
||||
chain.dataWriteStream(output);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static public ByteBuffer writeV4Buffer(WarpManifestX18 manifest) {
|
||||
return ByteBuffer.wrap(writeV4Array(manifest));
|
||||
}
|
||||
|
||||
static public byte[] writeV4Array(WarpManifestX18 manifest) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
writeV4Stream(manifest, baos);
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
static public void writeV4Stream(WarpManifestX18 manifest, OutputStream output) {
|
||||
TLVChainOctalSex chain = new TLVChainOctalSex();
|
||||
ScopicManifestContentPulser.strobelight(manifest, new ScopicManifest4ContentWriter(chain), WarpManifestX0TheVersion.VERSION_4_0);
|
||||
try {
|
||||
WarpManifestX0TheMimeType.magicMarkerWrite(output, WarpManifestX0TheMimeType.MANIFEST_4);
|
||||
chain.dataWriteStream(output);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static public ByteBuffer writeV5Buffer(WarpManifestX8 manifest) {
|
||||
return ByteBuffer.wrap(writeV5Array(manifest));
|
||||
}
|
||||
|
||||
static public byte[] writeV5Array(WarpManifestX8 manifest) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
writeV5Stream(manifest, baos);
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
static public void writeV5Stream(WarpManifestX8 manifest, OutputStream output) {
|
||||
XDBXWriterXml writerXml = new XDBXWriterXml(output);
|
||||
ScopicManifest5ContentWriter writer = new ScopicManifest5ContentWriter(writerXml);
|
||||
ScopicManifestContentPulser.strobelight(manifest, writer, WarpManifestX0TheVersion.VERSION_5_0.getQName());
|
||||
}
|
||||
|
||||
static public String writeViniString(WarpManifestX8 manifest) {
|
||||
StringWriter writer = new StringWriter();
|
||||
writeViniStreamChar(manifest, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
static public void writeViniStream(WarpManifestX8 manifest, OutputStream output) {
|
||||
writeViniStreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
static public void writeViniStreamChar(WarpManifestX8 manifest, Writer output) {
|
||||
ScopicManifestContentPulser.strobelight(manifest, new ScopicIniContentWriter(output), ScopicIniConstants.VERSION_NEW_TESTAMENT);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/// Warp manifest 0 bit model.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public interface WarpManifestX0<T, M extends WarpManifestX0<T, M, H, S>, H extends WarpManifestX0HeaderField<T, H>, S extends WarpManifestX0Section<T, H, S>> {
|
||||
|
||||
List<H> getAttributes();
|
||||
|
||||
H makeAttribute(T name, T body);
|
||||
|
||||
WarpManifestX0<T, M, H, S> withAttribute(T name, T body);
|
||||
|
||||
WarpManifestX0<T, M, H, S> withAttributes(List<H> attrbutes);
|
||||
|
||||
default boolean hasAttribute(T attributeName) {
|
||||
for (H attr : getAttributes()) {
|
||||
if (attr.getName().equals(attributeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default Optional<H> getAttribute(T attributeName) {
|
||||
for (H attr : getAttributes()) {
|
||||
if (attr.getName() == null) {
|
||||
continue;
|
||||
}
|
||||
if (attr.getName().equals(attributeName)) {
|
||||
return Optional.of(attr);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
default Optional<T> getAttributeBody(T attributeName) {
|
||||
Optional<H> attr = getAttribute(attributeName);
|
||||
if (attr.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(attr.get().getBody());
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName) {
|
||||
return getAttributeBodyNullable(attributeName, null);
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName, T defaultValue) {
|
||||
return getAttributeBody(attributeName).orElse(defaultValue);
|
||||
}
|
||||
|
||||
List<S> getSections();
|
||||
|
||||
S makeSection(T sectionName);
|
||||
|
||||
M withSections(List<S> sections);
|
||||
|
||||
default boolean hasSection(T sectionName) {
|
||||
for (S section : getSections()) {
|
||||
if (section.getName().equals(sectionName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default Optional<S> getSection(T sectionName) {
|
||||
for (S section : getSections()) {
|
||||
if (section.getName() == null) {
|
||||
continue;
|
||||
}
|
||||
if (section.getName().equals(sectionName)) {
|
||||
return Optional.of(section);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
default Optional<H> getSectionAttribute(T sectionName, T attributeName) {
|
||||
Optional<S> section = getSection(sectionName);
|
||||
if (section.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return section.get().getAttribute(attributeName);
|
||||
}
|
||||
|
||||
default Optional<T> getSectionAttributeBody(T sectionName, T attributeName) {
|
||||
Optional<S> section = getSection(sectionName);
|
||||
if (section.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return section.get().getAttributeBody(attributeName);
|
||||
}
|
||||
|
||||
default T getSectionAttributeBodyNullable(T sectionName, T attributeName) {
|
||||
return getSectionAttributeBodyNullable(sectionName, attributeName, null);
|
||||
}
|
||||
|
||||
default T getSectionAttributeBodyNullable(T sectionName, T attributeName, T defaultValue) {
|
||||
return getSectionAttributeBody(sectionName, attributeName).orElse(defaultValue);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/// Warp manifest 0 bit name value pair entry.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public interface WarpManifestX0HeaderField<T, H extends WarpManifestX0HeaderField<T, H>> {
|
||||
|
||||
T getName();
|
||||
|
||||
void setName(T name);
|
||||
|
||||
T getBody();
|
||||
|
||||
void setBody(T body);
|
||||
|
||||
List<T> getRemarks();
|
||||
|
||||
H withRemark(T remark);
|
||||
|
||||
H withRemarks(List<T> remarks);
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/// Warp manifest 0 bit section.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public interface WarpManifestX0Section<T, H extends WarpManifestX0HeaderField<T, H>, S extends WarpManifestX0Section<T, H, S>> {
|
||||
|
||||
T getName();
|
||||
|
||||
void setName(T name);
|
||||
|
||||
List<H> getAttributes();
|
||||
|
||||
H makeAttribute(T name, T body);
|
||||
|
||||
S withAttribute(T name, T body);
|
||||
|
||||
S withAttributes(List<H> attributes);
|
||||
|
||||
default boolean hasAttribute(T name) {
|
||||
for (H attr : getAttributes()) {
|
||||
if (attr.getName().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default Optional<H> getAttribute(T name) {
|
||||
for (H attr : getAttributes()) {
|
||||
if (attr.getName() == null) {
|
||||
continue;
|
||||
}
|
||||
if (attr.getName().equals(name)) {
|
||||
return Optional.of(attr);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
default Optional<T> getAttributeBody(T name) {
|
||||
Optional<H> attr = getAttribute(name);
|
||||
if (attr.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(attr.get().getBody());
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName) {
|
||||
return getAttributeBodyNullable(attributeName, null);
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName, T defaultValue) {
|
||||
return getAttributeBody(attributeName).orElse(defaultValue);
|
||||
}
|
||||
|
||||
List<T> getRemarks();
|
||||
|
||||
S withRemark(T remark);
|
||||
|
||||
S withRemarks(List<T> remarks);
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.sax3.io.xdbx.XDBXConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Warp manifest 0 bit schema of the mime types and magic markers.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum WarpManifestX0TheMimeType {
|
||||
|
||||
MANIFEST_1 ("application/manifest", "MF", null),
|
||||
MANIFEST_2 ("application/manifest2", "MF2", null),
|
||||
MANIFEST_3 ("application/manifest3", "MF3", new byte[] {0x4d,0x53,0x58,0x33,0x4d,0x46,0x30,0x42}),
|
||||
MANIFEST_4 ("application/manifest4", "MF4", new byte[] {0x4d,0x53,0x58,0x34,0x4d,0x53,0x58,0x34,0x2d,0x2d,0x4d,0x46,0x31,0x38,0x4d,0x46,0x31,0x38}),
|
||||
MANIFEST_5 ("application/manifest5", "MF5", XDBXConstants.HEADER_MARKER), // FIXME: marker is not yet used here
|
||||
//MANIFEST_6 ("application/manifest6", "MF6", null),
|
||||
//MANIFEST_7 ("application/manifest7", "MF7", null),
|
||||
;
|
||||
|
||||
static public final int MARKER_3_LENGTH = 8;
|
||||
static public final int MARKER_4_LENGTH = 18;
|
||||
private final String qName;
|
||||
private final String qExtension;
|
||||
private final byte[] qMagicMarker;
|
||||
|
||||
private WarpManifestX0TheMimeType(String qName, String qExtension, byte[] qMagicMarker) {
|
||||
this.qName = qName;
|
||||
this.qExtension = qExtension;
|
||||
this.qMagicMarker = qMagicMarker;
|
||||
}
|
||||
|
||||
public String getQName() {
|
||||
return qName;
|
||||
}
|
||||
|
||||
public String getQExtension() {
|
||||
return qExtension;
|
||||
}
|
||||
|
||||
public String getQFileName() {
|
||||
return "MANIFEST." + getQExtension();
|
||||
}
|
||||
|
||||
public byte[] getQMagicMarker() {
|
||||
return qMagicMarker;
|
||||
}
|
||||
|
||||
static public Optional<WarpManifestX0TheMimeType> valueOfQName(String qName) {
|
||||
for (WarpManifestX0TheMimeType mimeType : WarpManifestX0TheMimeType.values()) {
|
||||
if (mimeType.getQName().equals(qName)) {
|
||||
return Optional.of(mimeType);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
static public WarpManifestX0TheMimeType magicMarkerRead(InputStream input, int markerLength) throws IOException {
|
||||
byte[] magicPrefix;
|
||||
if (markerLength == MARKER_3_LENGTH) {
|
||||
magicPrefix = input.readNBytes(markerLength);
|
||||
} else if (markerLength == MARKER_4_LENGTH) {
|
||||
magicPrefix = input.readNBytes(markerLength);
|
||||
} else {
|
||||
throw new ScopicManifestException("Unsupported marker length: " + markerLength);
|
||||
}
|
||||
for (WarpManifestX0TheMimeType mimeType : WarpManifestX0TheMimeType.values()) {
|
||||
if (mimeType.getQMagicMarker() == null) {
|
||||
continue;
|
||||
}
|
||||
if (Arrays.equals(magicPrefix, mimeType.getQMagicMarker())) {
|
||||
return mimeType;
|
||||
}
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported marker: " + Arrays.toString(magicPrefix));
|
||||
}
|
||||
|
||||
static public void magicMarkerWrite(OutputStream output, WarpManifestX0TheMimeType marker) throws IOException {
|
||||
if (marker.getQMagicMarker() == null) {
|
||||
return;
|
||||
}
|
||||
output.write(marker.getQMagicMarker());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
||||
/// Warp manifest 0 bit schema of the version.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum WarpManifestX0TheVersion {
|
||||
|
||||
/// Format: teapot-ascii
|
||||
VERSION_1_0("1.0"),
|
||||
|
||||
/// Format: escaped-unicode
|
||||
VERSION_2_0("2.0"),
|
||||
|
||||
/// Format: Custom TLV 8 bit binary with unicode
|
||||
VERSION_3_0("3.0"),
|
||||
|
||||
/// Format: Custom TLV 18 bit binary (18 bit or 6 octals as byte replacement)
|
||||
// FIXME: move into enum
|
||||
|
||||
// TODO: Format: SAX3 binary 8 bit XDBX XML with unicode manifest data
|
||||
VERSION_5_0("5.0"),
|
||||
|
||||
// TODO: Format: SAX4 binary adult 18 bit XML with manifest in 4C, but tags/attr in FCDotCDC1604DashP6
|
||||
// VERSION_6_0
|
||||
|
||||
// TODO: Format: SAX4 binary adult 18 bit XML with manifest data and XML structure in 4C
|
||||
// VERSION_7_0
|
||||
;
|
||||
|
||||
public static final PrimordialOctalOrangeJuiceStraw VERSION_4_0 = PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(4, 0));
|
||||
|
||||
private final String qName;
|
||||
|
||||
private WarpManifestX0TheVersion(String qName) {
|
||||
this.qName = qName;
|
||||
}
|
||||
|
||||
public String getQName() {
|
||||
return qName;
|
||||
}
|
||||
|
||||
public static Optional<WarpManifestX0TheVersion> valueOfQName(String qName) {
|
||||
for (WarpManifestX0TheVersion version : WarpManifestX0TheVersion.values()) {
|
||||
if (version.getQName().equals(qName)) {
|
||||
return Optional.of(version);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
/// Warp manifest 18 bit model.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX18 implements WarpManifestX0<PrimordialOctalOrangeJuiceStraw, WarpManifestX18, WarpManifestX18HeaderField, WarpManifestX18Section> {
|
||||
|
||||
private final List<WarpManifestX18HeaderField> attributes;
|
||||
private final List<WarpManifestX18Section> sections;
|
||||
|
||||
public WarpManifestX18() {
|
||||
this.attributes = new ArrayList<>();
|
||||
this.sections = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX18HeaderField> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18HeaderField makeAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
WarpManifestX18HeaderField result = new WarpManifestX18HeaderField(name, body);
|
||||
this.attributes.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18 withAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
makeAttribute(name, body);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18 withAttributes(List<WarpManifestX18HeaderField> attributes) {
|
||||
this.attributes.addAll(attributes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX18Section> getSections() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18Section makeSection(PrimordialOctalOrangeJuiceStraw sectionName) {
|
||||
WarpManifestX18Section result = new WarpManifestX18Section(sectionName);
|
||||
this.sections.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18 withSections(List<WarpManifestX18Section> sections) {
|
||||
this.sections.addAll(sections);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
/// Warp manifest 18 bit name value pair entry.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX18HeaderField implements WarpManifestX0HeaderField<PrimordialOctalOrangeJuiceStraw, WarpManifestX18HeaderField> {
|
||||
|
||||
private PrimordialOctalOrangeJuiceStraw name;
|
||||
private PrimordialOctalOrangeJuiceStraw body;
|
||||
private final List<PrimordialOctalOrangeJuiceStraw> remarks;
|
||||
|
||||
public WarpManifestX18HeaderField() {
|
||||
this.remarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
public WarpManifestX18HeaderField(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
this();
|
||||
this.name = name;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimordialOctalOrangeJuiceStraw getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(PrimordialOctalOrangeJuiceStraw name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimordialOctalOrangeJuiceStraw getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBody(PrimordialOctalOrangeJuiceStraw body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrimordialOctalOrangeJuiceStraw> getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18HeaderField withRemark(PrimordialOctalOrangeJuiceStraw remark) {
|
||||
this.remarks.add(remark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18HeaderField withRemarks(List<PrimordialOctalOrangeJuiceStraw> remarks) {
|
||||
this.remarks.addAll(remarks);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.x4o.fc18.FourCornerUnicodeImport;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
||||
/// Warp manifest 18 bit model importer from 8 bit model
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX18Import {
|
||||
|
||||
private WarpManifestX18Import() {
|
||||
}
|
||||
|
||||
static public WarpManifestX18 fromX8(WarpManifestX8 manifest) {
|
||||
WarpManifestX18Section sectionX18 = null;
|
||||
WarpManifestX18HeaderField fieldX18 = null;
|
||||
WarpManifestX18 result = new WarpManifestX18();
|
||||
for (WarpManifestX8HeaderField attrX8 : manifest.getAttributes()) {
|
||||
fieldX18 = result.makeAttribute(toX8(attrX8.getName()), toX8(attrX8.getBody()));
|
||||
for (String remark : attrX8.getRemarks()) {
|
||||
fieldX18.withRemark(toX8(remark));
|
||||
}
|
||||
}
|
||||
for (WarpManifestX8Section sectionX8 : manifest.getSections()) {
|
||||
sectionX18 = result.makeSection(toX8(sectionX8.getName()));
|
||||
for (String remark : sectionX8.getRemarks()) {
|
||||
sectionX18.withRemark(toX8(remark));
|
||||
}
|
||||
for (WarpManifestX8HeaderField attrX8 : sectionX8.getAttributes()) {
|
||||
fieldX18 = sectionX18.makeAttribute(toX8(attrX8.getName()), toX8(attrX8.getBody()));
|
||||
for (String remark : attrX8.getRemarks()) {
|
||||
fieldX18.withRemark(toX8(remark));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static private PrimordialOctalOrangeJuiceStraw toX8(String value) {
|
||||
return PrimordialOctalOrangeString.valueOfSmurfs(FourCornerUnicodeImport.lossy().convertToInt18(value));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
/// Warp manifest 18 bit section.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX18Section implements WarpManifestX0Section<PrimordialOctalOrangeJuiceStraw, WarpManifestX18HeaderField, WarpManifestX18Section> {
|
||||
|
||||
private PrimordialOctalOrangeJuiceStraw name;
|
||||
private final List<WarpManifestX18HeaderField> attributes;
|
||||
private final List<PrimordialOctalOrangeJuiceStraw> remarks;
|
||||
|
||||
public WarpManifestX18Section() {
|
||||
this.attributes = new ArrayList<>();
|
||||
this.remarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
public WarpManifestX18Section(PrimordialOctalOrangeJuiceStraw name) {
|
||||
this();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimordialOctalOrangeJuiceStraw getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(PrimordialOctalOrangeJuiceStraw name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX18HeaderField> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18HeaderField makeAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
WarpManifestX18HeaderField result = new WarpManifestX18HeaderField(name, body);
|
||||
attributes.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18Section withAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
WarpManifestX18HeaderField result = new WarpManifestX18HeaderField(name, body);
|
||||
attributes.add(result);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18Section withAttributes(List<WarpManifestX18HeaderField> attributes) {
|
||||
this.attributes.addAll(attributes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrimordialOctalOrangeJuiceStraw> getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18Section withRemark(PrimordialOctalOrangeJuiceStraw remark) {
|
||||
this.remarks.add(remark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX18Section withRemarks(List<PrimordialOctalOrangeJuiceStraw> remarks) {
|
||||
this.remarks.addAll(remarks);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/// Warp manifest 8 bit model.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX8 implements WarpManifestX0<String, WarpManifestX8, WarpManifestX8HeaderField, WarpManifestX8Section> {
|
||||
|
||||
private final List<WarpManifestX8HeaderField> attributes;
|
||||
private final List<WarpManifestX8Section> sections;
|
||||
|
||||
public WarpManifestX8() {
|
||||
this.attributes = new ArrayList<>();
|
||||
this.sections = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX8HeaderField> getAttributes() {
|
||||
return this.attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8HeaderField makeAttribute(String name, String body) {
|
||||
WarpManifestX8HeaderField result = new WarpManifestX8HeaderField(name, body);
|
||||
this.attributes.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8 withAttribute(String name, String body) {
|
||||
makeAttribute(name, body);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8 withAttributes(List<WarpManifestX8HeaderField> attributes) {
|
||||
this.attributes.addAll(attributes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX8Section> getSections() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8Section makeSection(String sectionName) {
|
||||
WarpManifestX8Section result = new WarpManifestX8Section(sectionName);
|
||||
this.sections.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8 withSections(List<WarpManifestX8Section> sections) {
|
||||
this.sections.addAll(sections);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/// Warp manifest 8 bit name value pair entry.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX8HeaderField implements WarpManifestX0HeaderField<String, WarpManifestX8HeaderField> {
|
||||
|
||||
private String name;
|
||||
private String body;
|
||||
private final List<String> remarks;
|
||||
|
||||
public WarpManifestX8HeaderField() {
|
||||
this.remarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
public WarpManifestX8HeaderField(String name, String body) {
|
||||
this();
|
||||
this.name = name;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8HeaderField withRemark(String remark) {
|
||||
this.remarks.add(remark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8HeaderField withRemarks(List<String> remarks) {
|
||||
this.remarks.addAll(remarks);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/// Warp manifest 8 bit section.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX8Section implements WarpManifestX0Section<String, WarpManifestX8HeaderField, WarpManifestX8Section> {
|
||||
|
||||
private String name;
|
||||
private final List<WarpManifestX8HeaderField> attributes;
|
||||
private final List<String> remarks;
|
||||
|
||||
public WarpManifestX8Section() {
|
||||
this.attributes = new ArrayList<>();
|
||||
this.remarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
public WarpManifestX8Section(String name) {
|
||||
this();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarpManifestX8HeaderField> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8HeaderField makeAttribute(String name, String body) {
|
||||
WarpManifestX8HeaderField result = new WarpManifestX8HeaderField(name, body);
|
||||
this.attributes.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8Section withAttribute(String name, String body) {
|
||||
WarpManifestX8HeaderField result = new WarpManifestX8HeaderField(name, body);
|
||||
this.attributes.add(result);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8Section withAttributes(List<WarpManifestX8HeaderField> attributes) {
|
||||
this.attributes.addAll(attributes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8Section withRemark(String remark) {
|
||||
this.remarks.add(remark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarpManifestX8Section withRemarks(List<String> remarks) {
|
||||
this.remarks.addAll(remarks);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
/// Stroboscopic manifestor content handler.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public interface ScopicManifestContent<T> {
|
||||
|
||||
default void strobeManifestStart() {}
|
||||
|
||||
void strobeManifestDeclaration(T version);
|
||||
|
||||
void strobeMainAttribute(T name, T body);
|
||||
|
||||
void strobeSectionHeader(T sectionName);
|
||||
|
||||
void strobeSectionAttribute(T name, T body);
|
||||
|
||||
void strobeRemarkContent(T remark);
|
||||
|
||||
default void strobeManifestEnd() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0HeaderField;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0Section;
|
||||
|
||||
/// Stroboscopic manifestor content pulser.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class ScopicManifestContentPulser {
|
||||
|
||||
// An "geniface" for complex generics would be nice, note all this generics is only to add 2 default methods in a interface...
|
||||
static public <T, M extends WarpManifestX0<T, M, H, S>, H extends WarpManifestX0HeaderField<T, H>, S extends WarpManifestX0Section<T, H, S>> void strobelight(WarpManifestX0<T, M, H, S> manifest, ScopicManifestContent<T> writer, T version) {
|
||||
writer.strobeManifestStart();
|
||||
writer.strobeManifestDeclaration(Objects.requireNonNull(version, "Can't print null version"));
|
||||
for (WarpManifestX0HeaderField<T, H> mainAttr : manifest.getAttributes()) {
|
||||
Objects.requireNonNull(mainAttr.getName(), "Can't print null attribute name");
|
||||
for (T remarkValue : mainAttr.getRemarks()) {
|
||||
writer.strobeRemarkContent(remarkValue);
|
||||
}
|
||||
writer.strobeMainAttribute(mainAttr.getName(), mainAttr.getBody());
|
||||
}
|
||||
for (WarpManifestX0Section<T, H, S> section : manifest.getSections()) {
|
||||
Objects.requireNonNull(section.getName(), "Can't print null section name");
|
||||
for (T remarkValue : section.getRemarks()) {
|
||||
writer.strobeRemarkContent(remarkValue);
|
||||
}
|
||||
writer.strobeSectionHeader(section.getName());
|
||||
for (WarpManifestX0HeaderField<T, H> sectionAttr : section.getAttributes()) {
|
||||
Objects.requireNonNull(sectionAttr.getName(), "Can't print null section attribute name");
|
||||
for (T remarkValue : sectionAttr.getRemarks()) {
|
||||
writer.strobeRemarkContent(remarkValue);
|
||||
}
|
||||
writer.strobeSectionAttribute(sectionAttr.getName(), sectionAttr.getBody());
|
||||
}
|
||||
}
|
||||
writer.strobeManifestEnd();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8Section;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
|
||||
/// Stroboscopic manifest 1 and 2 content handler.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifestContentStringHandler implements ScopicManifestContent<String> {
|
||||
|
||||
private final WarpManifestX8 manifest;
|
||||
private WarpManifestX8Section currentSection;
|
||||
private List<String> remarks;
|
||||
private WarpManifestX0TheVersion[] supportedVersions;
|
||||
|
||||
public ScopicManifestContentStringHandler(WarpManifestX8 manifest, WarpManifestX0TheVersion... supportedVersions) {
|
||||
this.manifest = manifest;
|
||||
this.remarks = new ArrayList<>();
|
||||
this.supportedVersions = supportedVersions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(String version) {
|
||||
if (supportedVersions.length == 0) {
|
||||
return; // no check requested
|
||||
}
|
||||
Optional<WarpManifestX0TheVersion> manifestVersion = WarpManifestX0TheVersion.valueOfQName(version);
|
||||
if (manifestVersion.isEmpty()) {
|
||||
throw new ScopicManifestException("Unknown manifest version: " + version);
|
||||
}
|
||||
WarpManifestX0TheVersion versionParsed = manifestVersion.get();
|
||||
for (WarpManifestX0TheVersion supportedVersion : supportedVersions) {
|
||||
if (supportedVersion.equals(versionParsed)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported manifest version: " + version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(String name, String body) {
|
||||
this.manifest.makeAttribute(name, body).withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(String sectionName) {
|
||||
this.currentSection = manifest.makeSection(sectionName);
|
||||
this.currentSection.withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(String name, String body) {
|
||||
Objects.requireNonNull(this.currentSection, "Section header is not yet strobed.").makeAttribute(name, body).withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(String remark) {
|
||||
this.remarks.add(remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
this.currentSection = null;
|
||||
this.remarks.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
/// Stroboscopic manifest duplicate detector kills duplicates.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifestDuplicateDetector<T> {
|
||||
|
||||
private final Set<T> mainAttributeNames = new HashSet<>();
|
||||
private final Set<T> sectionNames = new HashSet<>();
|
||||
private final Set<T> sectionAttributeNames = new HashSet<>();
|
||||
private final Function<T, Integer> lengthExtractor;
|
||||
private final Function<T, T> keyExtractor;
|
||||
|
||||
public ScopicManifestDuplicateDetector(Function<T, Integer> lengthExtractor) {
|
||||
this(lengthExtractor, v -> v);
|
||||
}
|
||||
|
||||
public ScopicManifestDuplicateDetector(Function<T, Integer> lengthExtractor, Function<T, T> keyExtractor) {
|
||||
this.lengthExtractor = Objects.requireNonNull(lengthExtractor);
|
||||
this.keyExtractor = Objects.requireNonNull(keyExtractor);
|
||||
}
|
||||
|
||||
private Set<T> getSetForPart(ScopicManifestDuplicatePart part) {
|
||||
Set<T> uniqueSet = null;
|
||||
if (ScopicManifestDuplicatePart.MAIN_ATTRIBUTE.equals(part)) {
|
||||
uniqueSet = mainAttributeNames;
|
||||
} else if (ScopicManifestDuplicatePart.SECTION_NAME.equals(part)) {
|
||||
uniqueSet = sectionNames;
|
||||
} else if (ScopicManifestDuplicatePart.SECTION_ATTRIBUTE.equals(part)) {
|
||||
uniqueSet = sectionAttributeNames;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported part: " + part);
|
||||
}
|
||||
return uniqueSet;
|
||||
}
|
||||
|
||||
public void validateUniqueKey(ScopicManifestDuplicatePart part, T uniqueKey) {
|
||||
int size = lengthExtractor.apply(uniqueKey);
|
||||
if (size == 0) {
|
||||
throw new ScopicManifestException("Illegal empty key in " + part.nameError());
|
||||
}
|
||||
T key = keyExtractor.apply(uniqueKey);
|
||||
Set<T> uniqueSet = getSetForPart(part);
|
||||
if (uniqueSet.contains(key)) {
|
||||
throw new ScopicManifestException("Illegal duplicate key in " + part.nameError() + " detected: " + uniqueKey);
|
||||
}
|
||||
uniqueSet.add(key);
|
||||
}
|
||||
|
||||
public void clearPart(ScopicManifestDuplicatePart part) {
|
||||
getSetForPart(part).clear();
|
||||
}
|
||||
|
||||
public void clearAll() {
|
||||
for (ScopicManifestDuplicatePart part : ScopicManifestDuplicatePart.values()) {
|
||||
clearPart(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
/// Stroboscopic manifest duplicate part to check.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicManifestDuplicatePart {
|
||||
|
||||
MAIN_ATTRIBUTE,
|
||||
SECTION_NAME,
|
||||
SECTION_ATTRIBUTE
|
||||
;
|
||||
|
||||
private final String nameErrorMessage;
|
||||
|
||||
private ScopicManifestDuplicatePart() {
|
||||
nameErrorMessage = name().toLowerCase().replaceAll("_", " ");
|
||||
}
|
||||
|
||||
public String nameError() {
|
||||
return nameErrorMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic;
|
||||
|
||||
/// Manifestor content exception.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifestException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ScopicManifestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ScopicManifestException(Exception error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.ioini;
|
||||
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
/// Stroboscopic ini file constants.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicIniConstants {
|
||||
;
|
||||
/// Version must remain compatible with the GetPrivateProfileXXX functions.
|
||||
public static final String VERSION_NEW_TESTAMENT = "0.0";
|
||||
|
||||
public static final String PART_ATTR_SEPERATOR = "=";
|
||||
public static final String PART_ATTR_SEPERATOR_ALT = ":";
|
||||
|
||||
public static final String PART_ATTR_QUOTE_DOU = "\"";
|
||||
public static final String PART_ATTR_QUOTE_APO = "\'";
|
||||
|
||||
public static final String PART_ATTR_LATIN_SPACE = " ";
|
||||
public static final String PART_ATTR_NEWLINE = "\n";
|
||||
public static final String PART_ATTR_CONTINUATION = "\\";
|
||||
|
||||
public static final String PART_SECTION_START = "[";
|
||||
public static final String PART_SECTION_CLOSE = "]";
|
||||
|
||||
public static final String REMARK_CHAR_UNIX = "#";
|
||||
public static final String REMARK_CHAR_WIN1 = ";";
|
||||
|
||||
static public String escapeString(String value) {
|
||||
StringBuilder result = new StringBuilder(value.length());
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (c == '\\') {
|
||||
result.append("\\");
|
||||
continue;
|
||||
}
|
||||
if (c == '\u0000') {
|
||||
result.append("\\0");
|
||||
continue;
|
||||
}
|
||||
if (c == '\u0007') {
|
||||
result.append("\\a");
|
||||
continue;
|
||||
}
|
||||
if (c == '\b') {
|
||||
result.append("\\b");
|
||||
continue;
|
||||
}
|
||||
if (c == '\t') {
|
||||
result.append("\\t");
|
||||
continue;
|
||||
}
|
||||
if (c == '\n') {
|
||||
result.append("\\n");
|
||||
continue;
|
||||
}
|
||||
if (c == '\r') {
|
||||
result.append("\\r");
|
||||
continue;
|
||||
}
|
||||
if (c == '\f') {
|
||||
result.append("\\f");
|
||||
continue;
|
||||
}
|
||||
if (c == ';') {
|
||||
result.append("\\;");
|
||||
continue;
|
||||
}
|
||||
if (c == '#') {
|
||||
result.append("\\#");
|
||||
continue;
|
||||
}
|
||||
if (c == '=') {
|
||||
result.append("\\=");
|
||||
continue;
|
||||
}
|
||||
if (c > 127) {
|
||||
result.appendCodePoint('\\');
|
||||
result.appendCodePoint('u');
|
||||
String hex = Integer.toHexString(c).toUpperCase();
|
||||
if (hex.length() == 3) {
|
||||
result.append("0");
|
||||
}
|
||||
if (hex.length() == 2) {
|
||||
result.append("00");
|
||||
}
|
||||
result.append(hex);
|
||||
} else {
|
||||
result.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.ioini;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic ini file content reader.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicIniContentReader {
|
||||
|
||||
private final ScopicManifestContent<String> handler;
|
||||
private boolean removeAttributeQuotes = true;
|
||||
|
||||
public ScopicIniContentReader(ScopicManifestContent<String> handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public ScopicIniContentReader withRemoveAttributeQuotes(boolean value) {
|
||||
this.removeAttributeQuotes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void parse(InputStream input) throws IOException {
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) {
|
||||
handler.strobeManifestStart();
|
||||
handler.strobeManifestDeclaration(ScopicIniConstants.VERSION_NEW_TESTAMENT);
|
||||
String currentName = null;
|
||||
StringBuilder currentBody = new StringBuilder();
|
||||
boolean isContinuation = false;
|
||||
String line = null;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.isBlank()) {
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith(ScopicIniConstants.PART_SECTION_START)) {
|
||||
String sectionName = line.substring(1, line.length() - 1);
|
||||
if (sectionName.isEmpty()) {
|
||||
throw new ScopicManifestException("Illegal empty section name: " + sectionName);
|
||||
}
|
||||
if (currentName != null) {
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
}
|
||||
handler.strobeSectionHeader(sectionName);
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith(ScopicIniConstants.REMARK_CHAR_UNIX)) {
|
||||
if (currentName != null) {
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
}
|
||||
handler.strobeRemarkContent(line.substring(1).trim());
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith(ScopicIniConstants.REMARK_CHAR_WIN1)) {
|
||||
if (currentName != null) {
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
}
|
||||
handler.strobeRemarkContent(line.substring(1).trim());
|
||||
continue;
|
||||
}
|
||||
if (isContinuation && line.endsWith(ScopicIniConstants.PART_ATTR_CONTINUATION)) {
|
||||
currentBody.append(line.substring(0, line.length() - 1).trim());
|
||||
continue;
|
||||
} else if (isContinuation) {
|
||||
isContinuation = false;
|
||||
currentBody.append(line.trim());
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
int splitIdx = line.indexOf(ScopicIniConstants.PART_ATTR_SEPERATOR);
|
||||
if (splitIdx == -1) {
|
||||
splitIdx = line.indexOf(ScopicIniConstants.PART_ATTR_SEPERATOR_ALT);
|
||||
if (splitIdx == -1) {
|
||||
if (currentName != null) {
|
||||
currentBody.append(line.trim());
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
continue;
|
||||
} else {
|
||||
throw new ScopicManifestException("Illegal line: " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
String name = line.substring(0, splitIdx).trim();
|
||||
String body = line.substring(splitIdx + 1, line.length()).trim();
|
||||
|
||||
currentName = name;
|
||||
currentBody = new StringBuilder();
|
||||
|
||||
if (body.endsWith(ScopicIniConstants.PART_ATTR_CONTINUATION)) {
|
||||
String bodyClean = body.substring(0, body.length() - 1).trim();
|
||||
if (bodyClean.endsWith(ScopicIniConstants.PART_ATTR_CONTINUATION)) {
|
||||
bodyClean = bodyClean.substring(0, bodyClean.length() - 1) + ScopicIniConstants.PART_ATTR_NEWLINE;
|
||||
}
|
||||
currentBody.append(bodyClean);
|
||||
isContinuation = true;
|
||||
} else {
|
||||
currentBody.append(body);
|
||||
isContinuation = false;
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
}
|
||||
}
|
||||
if (currentName != null) {
|
||||
strobeSectionAttribute(currentName, currentBody);
|
||||
currentName = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void strobeSectionAttribute(String name, StringBuilder body) {
|
||||
String attrBody = body.toString();
|
||||
if (removeAttributeQuotes) {
|
||||
if (attrBody.startsWith(ScopicIniConstants.PART_ATTR_QUOTE_DOU) && attrBody.endsWith(ScopicIniConstants.PART_ATTR_QUOTE_DOU)) {
|
||||
attrBody = attrBody.substring(1, attrBody.length() - 1);
|
||||
}
|
||||
if (attrBody.startsWith(ScopicIniConstants.PART_ATTR_QUOTE_APO) && attrBody.endsWith(ScopicIniConstants.PART_ATTR_QUOTE_APO)) {
|
||||
attrBody = attrBody.substring(1, attrBody.length() - 1);
|
||||
}
|
||||
}
|
||||
handler.strobeSectionAttribute(name, normalizeBodyString(attrBody));
|
||||
}
|
||||
|
||||
private String normalizeBodyString(String value) {
|
||||
StringBuilder result = new StringBuilder(value.length());
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (c != '\\') {
|
||||
result.appendCodePoint(c);
|
||||
continue;
|
||||
}
|
||||
int c2 = iterator.nextInt();
|
||||
if (c2 == '\\') {
|
||||
result.appendCodePoint('\\');
|
||||
continue;
|
||||
}
|
||||
if (c2 == '\'') {
|
||||
result.appendCodePoint('\'');
|
||||
continue;
|
||||
}
|
||||
if (c2 == '\"') {
|
||||
result.appendCodePoint('\"');
|
||||
continue;
|
||||
}
|
||||
if (c2 == '0') {
|
||||
result.appendCodePoint('\0');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 'a') {
|
||||
result.appendCodePoint('\u0007');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 'b') {
|
||||
result.appendCodePoint('\b');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 't') {
|
||||
result.appendCodePoint('\t');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 'n') {
|
||||
result.appendCodePoint('\n');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 'r') {
|
||||
result.appendCodePoint('\r');
|
||||
continue;
|
||||
}
|
||||
if (c2 == 'f') {
|
||||
result.appendCodePoint('\f');
|
||||
continue;
|
||||
}
|
||||
if (c2 == ';') {
|
||||
result.appendCodePoint(';');
|
||||
continue;
|
||||
}
|
||||
if (c2 == '#') {
|
||||
result.appendCodePoint('#');
|
||||
continue;
|
||||
}
|
||||
if (c2 == '=') {
|
||||
result.appendCodePoint('=');
|
||||
continue;
|
||||
}
|
||||
if (c2 == ':') {
|
||||
result.appendCodePoint(':');
|
||||
continue;
|
||||
}
|
||||
if (c2 != SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
throw new ScopicManifestException("Illegal body escape found: " + value);
|
||||
}
|
||||
StringBuilder charRef = new StringBuilder(16);
|
||||
charRef.appendCodePoint(iterator.nextInt());
|
||||
charRef.appendCodePoint(iterator.nextInt());
|
||||
charRef.appendCodePoint(iterator.nextInt());
|
||||
charRef.appendCodePoint(iterator.nextInt());
|
||||
result.appendCodePoint(Integer.parseInt(charRef.toString(), 16));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.ioini;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicateDetector;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicatePart;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic ini file content writer.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicIniContentWriter implements ScopicManifestContent<String> {
|
||||
|
||||
private final Writer stream;
|
||||
private boolean printHeaderSpacer = true;
|
||||
private boolean printRemarks = true;
|
||||
private boolean printRemarkWin1 = false;
|
||||
private boolean allowDuplicateAttribute = true;
|
||||
private final ScopicManifestDuplicateDetector<String> duplicateDetector;
|
||||
|
||||
public ScopicIniContentWriter(Writer stream) {
|
||||
this.stream = stream;
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length() , v -> {
|
||||
return v.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
public ScopicIniContentWriter withPrintHeaderSpacer(boolean value) {
|
||||
this.printHeaderSpacer = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScopicIniContentWriter withPrintRemarks(boolean value) {
|
||||
this.printRemarks = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScopicIniContentWriter withPrintRemarkAsWin1(boolean value) {
|
||||
this.printRemarkWin1 = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScopicIniContentWriter withAllowDuplicateAttribute(boolean value) {
|
||||
this.allowDuplicateAttribute = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(String version) {
|
||||
// NOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(String name, String body) {
|
||||
throw new ScopicManifestException("Main attributes are not supported in ini files, but got: " + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(String sectionName) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
|
||||
if (allowDuplicateAttribute == false) {
|
||||
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
|
||||
}
|
||||
if (printHeaderSpacer) {
|
||||
addFrameRaw(ScopicIniConstants.PART_ATTR_NEWLINE); // optional for human eyes
|
||||
}
|
||||
addFrameBodyLine(ScopicIniConstants.PART_SECTION_START, validateBodyString(sectionName), ScopicIniConstants.PART_SECTION_CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(String name, String body) {
|
||||
if (allowDuplicateAttribute == false) { // Dup is allowed in (some) ini's, like systemd unit files.
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
|
||||
}
|
||||
addFrameBodyLine(
|
||||
escapeNameString(name),
|
||||
ScopicIniConstants.PART_ATTR_LATIN_SPACE,
|
||||
ScopicIniConstants.PART_ATTR_SEPERATOR,
|
||||
ScopicIniConstants.PART_ATTR_LATIN_SPACE,
|
||||
validateBodyString(body));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(String remark) {
|
||||
if (printRemarks == false) {
|
||||
return; // off by request
|
||||
}
|
||||
String remarkChar = ScopicIniConstants.REMARK_CHAR_UNIX;
|
||||
if (printRemarkWin1) {
|
||||
remarkChar = ScopicIniConstants.REMARK_CHAR_WIN1;
|
||||
}
|
||||
addFrameBodyLine(remarkChar, ScopicIniConstants.PART_ATTR_LATIN_SPACE, validateBodyString(remark));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
duplicateDetector.clearAll();
|
||||
try {
|
||||
stream.flush();
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFrameRaw(String text) {
|
||||
try {
|
||||
stream.write(text);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFrameBodyLine(String... parts) {
|
||||
String body = Arrays.asList(parts).stream().collect(Collectors.joining());
|
||||
addFrameRaw(body);
|
||||
addFrameRaw(ScopicIniConstants.PART_ATTR_NEWLINE);
|
||||
return;
|
||||
}
|
||||
|
||||
private String validateBodyString(String body) {
|
||||
return ScopicIniConstants.escapeString(body);
|
||||
}
|
||||
|
||||
private String escapeNameString(String name) {
|
||||
return ScopicIniConstants.escapeString(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf;
|
||||
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
/// Stroboscopic manifest 1 and 2 constants.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicManifestConstants {
|
||||
;
|
||||
public static final String PART_ATTR_SEPERATOR = ": ";
|
||||
public static final String PART_ATTR_CONTINUATION = " ";
|
||||
public static final String PART_ATTR_NEWLINE = "\n";
|
||||
|
||||
public static final int VERSION_1_MAX_LINE_LENGHT = 72;
|
||||
public static final int VERSION_1_MAX_NAME_LENGHT = VERSION_1_MAX_LINE_LENGHT
|
||||
- PART_ATTR_SEPERATOR.length();
|
||||
public static final int VERSION_3_MAX_DATA_LENGHT = 65535;
|
||||
public static final int VERSION_4_MAX_DATA_LENGHT = 262143;
|
||||
|
||||
public static final String ATTR_SIMSALABIM_SECTION = "Name";
|
||||
public static final String ATTR_SIMSALABIM_REMARK = "From";
|
||||
public static final String ATTR_MANIFEST_VERSION = "Manifest-Version";
|
||||
public static final int ATTR_MANIFEST_VERSION_MAX_LENGHT = VERSION_1_MAX_LINE_LENGHT
|
||||
- PART_ATTR_SEPERATOR.length()
|
||||
- ATTR_MANIFEST_VERSION.length();
|
||||
|
||||
static public boolean isOtherChar(String value) {
|
||||
// Source;
|
||||
// otherchar: any UTF-8 character except NUL, CR and LF
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (c == 0x00) { // NUL
|
||||
return false;
|
||||
}
|
||||
if (c == 0x0D) { // CR
|
||||
return false;
|
||||
}
|
||||
if (c == 0x0A) { // LF
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static public boolean isV1AlphaNum(int c) {
|
||||
// Source;
|
||||
// alphanum: {A-Z} | {a-z} | {0-9}
|
||||
if (c>='A' & c<='Z') { return true; }
|
||||
if (c>='a' & c<='z') { return true; }
|
||||
if (c>='0' & c<='9') { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isV1HeaderChar(int c) {
|
||||
// Source;
|
||||
// headerchar: alphanum | - | _
|
||||
if (isV1AlphaNum(c)) { return true; }
|
||||
if (c == '-') { return true; }
|
||||
if (c == '_') { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isV1NameString(String value) {
|
||||
// Source;
|
||||
// name: alphanum *headerchar
|
||||
boolean first = true;
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (first) {
|
||||
first = false;
|
||||
if (isV1AlphaNum(c) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (isV1HeaderChar(c) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static public boolean isV1NameStringSizeLegal(String value) {
|
||||
// Source;
|
||||
// Because header names cannot be continued, the maximum length of a header name is 70 bytes (there must be a colon and a SPACE after the name).
|
||||
if (value.length() > VERSION_1_MAX_NAME_LENGHT) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static public String escapeV2NameString(String value) {
|
||||
StringBuilder result = new StringBuilder(value.length());
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (isV1HeaderChar(c) == false) {
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX);
|
||||
result.append(Integer.toHexString(c).toUpperCase());
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR);
|
||||
} else {
|
||||
result.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
static public boolean isV2DataStringSizeLegal(String value) {
|
||||
return isV3DataStringSizeLegal(value); // to allow upgrade
|
||||
}
|
||||
|
||||
static public boolean isV3DataStringSizeLegal(String value) {
|
||||
// Source;
|
||||
// 16 bit TLV length value
|
||||
if (value.length() > VERSION_3_MAX_DATA_LENGHT) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static public boolean isV4DataArraySizeLegal(PrimordialOctalOrangeJuiceStraw value) {
|
||||
// Source;
|
||||
// 18 bit TLV length value
|
||||
if (value.length() > VERSION_4_MAX_DATA_LENGHT) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8HeaderField;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 1 and 2 content reader.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifestContentReader {
|
||||
|
||||
static public final boolean FORCE_VERSION_1_0 = true;
|
||||
private final ScopicManifestContent<String> handler;
|
||||
private final boolean forceV1;
|
||||
private WarpManifestX0TheVersion version;
|
||||
|
||||
public ScopicManifestContentReader(ScopicManifestContent<String> handler) {
|
||||
this(handler, false);
|
||||
}
|
||||
|
||||
public ScopicManifestContentReader(ScopicManifestContent<String> handler, boolean forceV1) {
|
||||
this.handler = handler;
|
||||
this.forceV1 = forceV1;
|
||||
}
|
||||
|
||||
public void parse(InputStream input) throws IOException {
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) {
|
||||
handler.strobeManifestStart();
|
||||
String line = in.readLine();
|
||||
WarpManifestX8HeaderField fieldVersion = parseLine(line);
|
||||
version = parseVersion(fieldVersion);
|
||||
handler.strobeManifestDeclaration(version.getQName());
|
||||
WarpManifestX8HeaderField fieldPrev = null;
|
||||
WarpManifestX8HeaderField field = null;
|
||||
boolean isContinuation = false;
|
||||
String currentName = null;
|
||||
StringBuilder currentBody = new StringBuilder();
|
||||
ScopicManifest2Segment currentSegment = ScopicManifest2Segment.MAIN_ATTR;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.isBlank()) {
|
||||
continue;
|
||||
}
|
||||
fieldPrev = field;
|
||||
field = parseLine(line);
|
||||
if (fieldPrev == null) {
|
||||
continue;
|
||||
}
|
||||
if (currentName == null) {
|
||||
currentName = fieldPrev.getName();
|
||||
}
|
||||
currentBody.append(fieldPrev.getBody());
|
||||
if (line.startsWith(ScopicManifestConstants.PART_ATTR_CONTINUATION)) {
|
||||
isContinuation = true;
|
||||
field.setBody(field.getBody().substring(1));
|
||||
continue;
|
||||
} else {
|
||||
if (isContinuation) {
|
||||
isContinuation = false;
|
||||
}
|
||||
currentSegment.runSegment(handler, currentName, currentBody.toString());
|
||||
currentName = null;
|
||||
currentBody = new StringBuilder();
|
||||
}
|
||||
if (ScopicManifestConstants.ATTR_SIMSALABIM_SECTION.equalsIgnoreCase(field.getName())) {
|
||||
currentSegment = ScopicManifest2Segment.SECTION_HEADER;
|
||||
} else if (ScopicManifest2Segment.SECTION_HEADER.equals(currentSegment)) {
|
||||
currentSegment = ScopicManifest2Segment.SECTION_ATTR;
|
||||
} else if (field.getName().startsWith(ScopicManifestConstants.ATTR_SIMSALABIM_REMARK)) {
|
||||
ScopicManifest2Segment.REMARK_ATTR.runSegment(handler, currentName, currentBody.toString());
|
||||
currentName = null;
|
||||
currentBody = new StringBuilder();
|
||||
}
|
||||
}
|
||||
if (isContinuation) {
|
||||
currentBody.append(field.getBody());
|
||||
currentSegment.runSegment(handler, currentName, currentBody.toString());
|
||||
} else {
|
||||
currentSegment.runSegment(handler, field.getName(), field.getBody());
|
||||
}
|
||||
handler.strobeManifestEnd();
|
||||
}
|
||||
}
|
||||
|
||||
enum ScopicManifest2Segment {
|
||||
MAIN_ATTR,
|
||||
SECTION_HEADER,
|
||||
SECTION_ATTR,
|
||||
REMARK_ATTR,
|
||||
;
|
||||
|
||||
protected void runSegment(ScopicManifestContent<String> reader, String name, String body) {
|
||||
if (MAIN_ATTR == this) {
|
||||
reader.strobeMainAttribute(name, body);
|
||||
} else if (SECTION_HEADER == this) {
|
||||
reader.strobeSectionHeader(body);
|
||||
} else if (SECTION_ATTR == this) {
|
||||
reader.strobeSectionAttribute(name, body);
|
||||
} else {
|
||||
reader.strobeRemarkContent(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private WarpManifestX0TheVersion parseVersion(WarpManifestX8HeaderField fieldVersion) {
|
||||
if (!ScopicManifestConstants.ATTR_MANIFEST_VERSION.equalsIgnoreCase(fieldVersion.getName())) {
|
||||
throw new ScopicManifestException("Wrong magic version: " + fieldVersion.getName()); // NOTE: on V3 input this should fail, name == null
|
||||
}
|
||||
Optional<WarpManifestX0TheVersion> versionOpt = WarpManifestX0TheVersion.valueOfQName(fieldVersion.getBody());
|
||||
if (versionOpt.isEmpty()) {
|
||||
throw new ScopicManifestException("Missing manifest version: " + fieldVersion.getBody());
|
||||
}
|
||||
WarpManifestX0TheVersion versionFile = versionOpt.get();
|
||||
if (WarpManifestX0TheVersion.VERSION_1_0.equals(versionFile)) {
|
||||
return versionFile;
|
||||
}
|
||||
if (WarpManifestX0TheVersion.VERSION_2_0.equals(versionFile)) {
|
||||
if (forceV1) {
|
||||
throw new ScopicManifestException("Illegal manifest V2 version in V1 mode: " + version);
|
||||
}
|
||||
return versionFile;
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported manifest version: " + version);
|
||||
}
|
||||
|
||||
private WarpManifestX8HeaderField parseLine(String line) {
|
||||
int splitIdx = line.indexOf(ScopicManifestConstants.PART_ATTR_SEPERATOR);
|
||||
if (splitIdx == -1) {
|
||||
return new WarpManifestX8HeaderField(line, line);
|
||||
}
|
||||
String name = line.substring(0, splitIdx);
|
||||
if (WarpManifestX0TheVersion.VERSION_2_0.equals(version)) {
|
||||
name = normalizeV2NameString(name);
|
||||
}
|
||||
String body = line.substring(splitIdx + 2, line.length());
|
||||
return new WarpManifestX8HeaderField(name, body);
|
||||
}
|
||||
|
||||
private String normalizeV2NameString(String value) {
|
||||
StringBuilder result = new StringBuilder(value.length());
|
||||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (c != SAX3XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE) {
|
||||
result.appendCodePoint(c);
|
||||
} else {
|
||||
StringBuilder charRef = new StringBuilder(16);
|
||||
int c2 = iterator.nextInt();
|
||||
if (c2 != SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER) {
|
||||
throw new ScopicManifestException("Illegal lonely amp sign found: " + value);
|
||||
}
|
||||
int c3 = iterator.nextInt();
|
||||
boolean isHex = false;
|
||||
if (c3 == SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
isHex = true;
|
||||
} else {
|
||||
charRef.appendCodePoint(c3);
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
int charRefCodePoint = iterator.nextInt();
|
||||
if (charRefCodePoint == SAX3XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR) {
|
||||
break;
|
||||
}
|
||||
charRef.appendCodePoint(charRefCodePoint);
|
||||
}
|
||||
if (isHex) {
|
||||
result.appendCodePoint(Integer.parseInt(charRef.toString(), 16));
|
||||
} else {
|
||||
result.appendCodePoint(Integer.parseInt(charRef.toString(), 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Arrays;
|
||||
import java.util.PrimitiveIterator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicateDetector;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicatePart;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 1 and 2 content writer.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifestContentWriter implements ScopicManifestContent<String> {
|
||||
|
||||
private final Writer stream;
|
||||
private boolean printVersion1 = false;
|
||||
private boolean printedDeclaration = false;
|
||||
private boolean printHeaderSpacer = true;
|
||||
private boolean printRemarks = true;
|
||||
private final ScopicManifestDuplicateDetector<String> duplicateDetector;
|
||||
|
||||
public ScopicManifestContentWriter(Writer stream) {
|
||||
this.stream = stream;
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length() , v -> {
|
||||
if (printVersion1) {
|
||||
return v.toLowerCase();
|
||||
}
|
||||
return v;
|
||||
});
|
||||
}
|
||||
|
||||
public ScopicManifestContentWriter withPrintHeaderSpacer(boolean value) {
|
||||
this.printHeaderSpacer = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScopicManifestContentWriter withPrintRemarks(boolean value) {
|
||||
this.printRemarks = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(String version) {
|
||||
if (printedDeclaration) {
|
||||
throw new ScopicManifestException("Declaration already printed.");
|
||||
}
|
||||
printedDeclaration = true;
|
||||
if (WarpManifestX0TheVersion.VERSION_1_0.getQName().equals(version)) {
|
||||
printVersion1 = true;
|
||||
}
|
||||
if (version.length() > ScopicManifestConstants.ATTR_MANIFEST_VERSION_MAX_LENGHT) {
|
||||
throw new ScopicManifestException("Declaration version too large: " + version.length());
|
||||
}
|
||||
addFrameRaw(ScopicManifestConstants.ATTR_MANIFEST_VERSION);
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_SEPERATOR);
|
||||
addFrameRaw(validateBodyString(version));
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_NEWLINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.MAIN_ATTRIBUTE, name);
|
||||
addFrameBodyLine(escapeNameString(name), ScopicManifestConstants.PART_ATTR_SEPERATOR, validateBodyString(body));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(String sectionName) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
|
||||
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
|
||||
if (printHeaderSpacer) {
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_NEWLINE); // optional for human eyes
|
||||
}
|
||||
addFrameBodyLine(ScopicManifestConstants.ATTR_SIMSALABIM_SECTION, ScopicManifestConstants.PART_ATTR_SEPERATOR, validateBodyString(sectionName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
|
||||
addFrameBodyLine(escapeNameString(name), ScopicManifestConstants.PART_ATTR_SEPERATOR, validateBodyString(body));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(String remark) {
|
||||
if (printRemarks == false) {
|
||||
return; // off by request
|
||||
}
|
||||
if (printVersion1) {
|
||||
return; // no support for comments
|
||||
}
|
||||
addFrameBodyLine(ScopicManifestConstants.ATTR_SIMSALABIM_REMARK, ScopicManifestConstants.PART_ATTR_SEPERATOR, validateBodyString(remark));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
duplicateDetector.clearAll();
|
||||
try {
|
||||
stream.flush();
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFrameRaw(String text) {
|
||||
try {
|
||||
stream.write(text);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFrameBodyLine(String... parts) {
|
||||
String body = Arrays.asList(parts).stream().collect(Collectors.joining());
|
||||
if (printVersion1 == false) {
|
||||
addFrameRaw(body); // no line limit
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_NEWLINE);
|
||||
return;
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer(body.length());
|
||||
PrimitiveIterator.OfInt charIterator = body.codePoints().iterator();
|
||||
while (charIterator.hasNext()) {
|
||||
int codePoint = charIterator.nextInt();
|
||||
buffer.appendCodePoint(codePoint);
|
||||
if (buffer.length() >= ScopicManifestConstants.VERSION_1_MAX_LINE_LENGHT) {
|
||||
addFrameRaw(buffer.toString());
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_NEWLINE);
|
||||
buffer.delete(0, buffer.length());
|
||||
buffer.append(ScopicManifestConstants.PART_ATTR_CONTINUATION);
|
||||
}
|
||||
}
|
||||
addFrameRaw(buffer.toString());
|
||||
addFrameRaw(ScopicManifestConstants.PART_ATTR_NEWLINE);
|
||||
}
|
||||
|
||||
private String validateBodyString(String body) {
|
||||
if (!ScopicManifestConstants.isOtherChar(body)) {
|
||||
throw new ScopicManifestException("Illegal control characters detected in body: " + body);
|
||||
}
|
||||
if (!ScopicManifestConstants.isV2DataStringSizeLegal(body)) {
|
||||
throw new ScopicManifestException("Manifest data token size too long: " + body);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
private String escapeNameString(String name) {
|
||||
if (!ScopicManifestConstants.isOtherChar(name)) {
|
||||
throw new ScopicManifestException("Illegal control characters detected in name: " + name);
|
||||
}
|
||||
if (!ScopicManifestConstants.isV2DataStringSizeLegal(name)) {
|
||||
throw new ScopicManifestException("Manifest data token size too long: " + name);
|
||||
}
|
||||
if (printVersion1) {
|
||||
if (name.contains(Character.toString(ScopicManifestConstants.PART_ATTR_SEPERATOR.charAt(0)))) { // NOTE: this is extra, just for custom user error
|
||||
throw new ScopicManifestException("Illegal manifest 1.0 attribute seperator in name: " + name);
|
||||
}
|
||||
if (!ScopicManifestConstants.isV1NameString(name)) {
|
||||
throw new ScopicManifestException("Illegal manifest 1.0 attribute name: " + name);
|
||||
}
|
||||
if (!ScopicManifestConstants.isV1NameStringSizeLegal(name)) {
|
||||
throw new ScopicManifestException("Illegal manifest 1.0 attribute name size too long: " + name);
|
||||
}
|
||||
}
|
||||
if (ScopicManifestConstants.ATTR_SIMSALABIM_SECTION.equalsIgnoreCase(name)) {
|
||||
throw new ScopicManifestException("Internal reserved string: " + name);
|
||||
}
|
||||
if (name.toLowerCase().startsWith(ScopicManifestConstants.ATTR_SIMSALABIM_REMARK.toLowerCase())) {
|
||||
throw new ScopicManifestException("Internal reserved string: " + name);
|
||||
}
|
||||
return ScopicManifestConstants.escapeV2NameString(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBit;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBitFrame;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 3 binary content reader.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest3ContentReader {
|
||||
|
||||
private final ScopicManifestContent<String> handler;
|
||||
|
||||
public ScopicManifest3ContentReader(ScopicManifestContent<String> handler) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
}
|
||||
|
||||
public void parse(TLVChainSexTeenBit chain) {
|
||||
Objects.requireNonNull(chain);
|
||||
handler.strobeManifestStart();
|
||||
Iterator<TLVChainSexTeenBitFrame> chainIterator = chain.iterator();
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator");
|
||||
}
|
||||
TLVChainSexTeenBitFrame frameVersion = chainIterator.next();
|
||||
if (ScopicManifest3FrameTLV.META_DECLARATION_VERSION.ordinalFrameTypeSmurf() != frameVersion.getSegmentPrologSmurf()) {
|
||||
throw new ScopicManifestException("Wrong magic version: 0x" + Integer.toHexString(frameVersion.getSegmentPrologSmurf()));
|
||||
}
|
||||
String fieldVersion = frameVersion.getSegmentChainString();
|
||||
Optional<WarpManifestX0TheVersion> versionOpt = WarpManifestX0TheVersion.valueOfQName(fieldVersion);
|
||||
if (versionOpt.isEmpty()) {
|
||||
throw new ScopicManifestException("Unsupported version: " + fieldVersion);
|
||||
}
|
||||
if (!versionOpt.get().equals(WarpManifestX0TheVersion.VERSION_3_0)) {
|
||||
throw new ScopicManifestException("Mismatched version: " + fieldVersion);
|
||||
}
|
||||
handler.strobeManifestDeclaration(WarpManifestX0TheVersion.VERSION_3_0.getQName());
|
||||
while (chainIterator.hasNext()) {
|
||||
TLVChainSexTeenBitFrame frame = chainIterator.next();
|
||||
if (ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_NAME.ordinalFrameTypeSmurf() == frame.getSegmentPrologSmurf()) {
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator on main attr body frame");
|
||||
}
|
||||
TLVChainSexTeenBitFrame frameBody = chainIterator.next();
|
||||
if (ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_BODY.ordinalFrameTypeSmurf() != frameBody.getSegmentPrologSmurf()) {
|
||||
throw new ScopicManifestException("Expected main attr body frame got: 0x" + Integer.toHexString(frameBody.getSegmentPrologSmurf()));
|
||||
}
|
||||
handler.strobeMainAttribute(frame.getSegmentChainString(), frameBody.getSegmentChainString());
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest3FrameTLV.SECTION_HEADER_NAME.ordinalFrameTypeSmurf() == frame.getSegmentPrologSmurf()) {
|
||||
String sectionName = frame.getSegmentChainString();
|
||||
handler.strobeSectionHeader(sectionName);
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_NAME.ordinalFrameTypeSmurf() == frame.getSegmentPrologSmurf()) {
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator on section attr body frame");
|
||||
}
|
||||
TLVChainSexTeenBitFrame frameBody = chainIterator.next();
|
||||
if (ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_BODY.ordinalFrameTypeSmurf() != frameBody.getSegmentPrologSmurf()) {
|
||||
throw new ScopicManifestException("Expected section attr body frame got: 0x" + Integer.toHexString(frameBody.getSegmentPrologSmurf()));
|
||||
}
|
||||
handler.strobeSectionAttribute(frame.getSegmentChainString(), frameBody.getSegmentChainString());
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest3FrameTLV.META_REMARK_CONTENT.ordinalFrameTypeSmurf() == frame.getSegmentPrologSmurf()) {
|
||||
handler.strobeRemarkContent(frame.getSegmentChainString());
|
||||
continue;
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported frame type detected: 0x" + Integer.toHexString(frame.getSegmentPrologSmurf()));
|
||||
}
|
||||
handler.strobeManifestEnd();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
w * Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBit;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBitFrameType;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicateDetector;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicatePart;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestConstants;
|
||||
|
||||
/// Stroboscopic manifest 5 binary 8 bit XDBX content writer.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest3ContentWriter implements ScopicManifestContent<String> {
|
||||
|
||||
private final TLVChainSexTeenBit chain;
|
||||
private final ScopicManifestDuplicateDetector<String> duplicateDetector;
|
||||
|
||||
public ScopicManifest3ContentWriter(TLVChainSexTeenBit chain) {
|
||||
this.chain = chain;
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(String version) {
|
||||
if (version.length() > ScopicManifestConstants.ATTR_MANIFEST_VERSION_MAX_LENGHT) {
|
||||
throw new ScopicManifestException("Declaration version too large: " + version.length());
|
||||
}
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.META_DECLARATION_VERSION, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.MAIN_ATTRIBUTE, name);
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_NAME, name);
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_BODY, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(String sectionName) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
|
||||
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.SECTION_HEADER_NAME, sectionName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_NAME, name);
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_BODY, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(String remark) {
|
||||
addFrameStringSafe(ScopicManifest3FrameTLV.META_REMARK_CONTENT, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
duplicateDetector.clearAll();
|
||||
}
|
||||
|
||||
private void addFrameStringSafe(TLVChainSexTeenBitFrameType type, String data) {
|
||||
if (!ScopicManifestConstants.isOtherChar(data)) {
|
||||
throw new ScopicManifestException("Illegal control characters detected: " + data);
|
||||
}
|
||||
if (!ScopicManifestConstants.isV3DataStringSizeLegal(data)) {
|
||||
throw new ScopicManifestException("Manifest data token size too long: " + data);
|
||||
}
|
||||
chain.addFrameString(type, data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBitFrameType;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicManifest3FrameTLV implements TLVChainSexTeenBitFrameType {
|
||||
|
||||
META_DECLARATION_VERSION (22), // SYN Synchronize
|
||||
META_REMARK_CONTENT (7), // BEL Bell
|
||||
|
||||
MAIN_ATTRIBUTE_NAME (2), // STX Start of Text
|
||||
MAIN_ATTRIBUTE_BODY (3), // ETX End of Text
|
||||
|
||||
SECTION_HEADER_NAME (1), // SOH Start of Heading
|
||||
SECTION_ATTRIBUTE_NAME (5), // ENQ Enquiry
|
||||
SECTION_ATTRIBUTE_BODY (6), // ACK Acknowledge
|
||||
;
|
||||
|
||||
private final char typeSmurf;
|
||||
|
||||
private ScopicManifest3FrameTLV(int typeSmurf) {
|
||||
this.typeSmurf = (char) typeSmurf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char ordinalFrameTypeSmurf() {
|
||||
return typeSmurf;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18Section;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 4 octal content handler.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest4ContentHandler implements ScopicManifestContent<PrimordialOctalOrangeJuiceStraw> {
|
||||
|
||||
private final WarpManifestX18 manifest;
|
||||
private WarpManifestX18Section currentSection;
|
||||
private List<PrimordialOctalOrangeJuiceStraw> remarks;
|
||||
|
||||
public ScopicManifest4ContentHandler(WarpManifestX18 manifest) {
|
||||
this.manifest = manifest;
|
||||
this.remarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(PrimordialOctalOrangeJuiceStraw version) {
|
||||
if (WarpManifestX0TheVersion.VERSION_4_0.equals(version)) {
|
||||
return;
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported manifest version: " + version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
this.manifest.makeAttribute(name, body).withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(PrimordialOctalOrangeJuiceStraw sectionName) {
|
||||
this.currentSection = manifest.makeSection(sectionName);
|
||||
this.currentSection.withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
Objects.requireNonNull(this.currentSection, "Section header is not yet strobed.").makeAttribute(name, body).withRemarks(remarks);
|
||||
this.remarks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(PrimordialOctalOrangeJuiceStraw remark) {
|
||||
this.remarks.add(remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
currentSection = null;
|
||||
this.remarks.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSex;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSexFrame;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 4 octal content reader.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest4ContentReader {
|
||||
|
||||
private final ScopicManifestContent<PrimordialOctalOrangeJuiceStraw> handler;
|
||||
|
||||
public ScopicManifest4ContentReader(ScopicManifestContent<PrimordialOctalOrangeJuiceStraw> handler) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
}
|
||||
|
||||
public void parse(TLVChainOctalSex chain) {
|
||||
Objects.requireNonNull(chain);
|
||||
handler.strobeManifestStart();
|
||||
Iterator<TLVChainOctalSexFrame> chainIterator = chain.iterator();
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator");
|
||||
}
|
||||
TLVChainOctalSexFrame frameVersion = chainIterator.next();
|
||||
if (!ScopicManifest4FrameTLV.META_DECLARATION_VERSION.ordinalFrameType().equals(frameVersion.getSegmentProlog())) {
|
||||
throw new ScopicManifestException("Wrong magic version: 0y" + frameVersion.getSegmentProlog());
|
||||
}
|
||||
PrimordialOctalOrangeJuiceStraw fieldVersion = frameVersion.getSegmentChainAtoms();
|
||||
if (!WarpManifestX0TheVersion.VERSION_4_0.equals(fieldVersion)) {
|
||||
throw new ScopicManifestException("Mismatched version: " + fieldVersion + " requested: " + WarpManifestX0TheVersion.VERSION_4_0);
|
||||
}
|
||||
handler.strobeManifestDeclaration(frameVersion.getSegmentChainAtoms());
|
||||
while (chainIterator.hasNext()) {
|
||||
TLVChainOctalSexFrame frame = chainIterator.next();
|
||||
if (ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_NAME.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator on main attr body frame");
|
||||
}
|
||||
TLVChainOctalSexFrame frameBody = chainIterator.next();
|
||||
if (ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_BODY.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
throw new ScopicManifestException("Expected main attr body frame got: 0y" + frameBody.getSegmentProlog());
|
||||
}
|
||||
handler.strobeMainAttribute(frame.getSegmentChainAtoms(), frameBody.getSegmentChainAtoms());
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest4FrameTLV.SECTION_HEADER_NAME.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
handler.strobeSectionHeader(frame.getSegmentChainAtoms());
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_NAME.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
if (!chainIterator.hasNext()) {
|
||||
throw new ScopicManifestException("Empty chain iterator on section attr body frame");
|
||||
}
|
||||
TLVChainOctalSexFrame frameBody = chainIterator.next();
|
||||
if (ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_BODY.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
throw new ScopicManifestException("Expected section attr body frame got: 0y" + frameBody.getSegmentProlog());
|
||||
}
|
||||
handler.strobeSectionAttribute(frame.getSegmentChainAtoms(), frameBody.getSegmentChainAtoms());
|
||||
continue;
|
||||
}
|
||||
if (ScopicManifest4FrameTLV.META_REMARK_CONTENT.ordinalFrameType().equals(frame.getSegmentProlog())) {
|
||||
handler.strobeRemarkContent(frame.getSegmentChainAtoms());
|
||||
continue;
|
||||
}
|
||||
throw new ScopicManifestException("Unsupported frame type detected: 0y" + frame.getSegmentProlog());
|
||||
}
|
||||
handler.strobeManifestEnd();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuiceStraw;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSex;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSexFrameType;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicateDetector;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicatePart;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestConstants;
|
||||
|
||||
/// Stroboscopic manifest 4 octal content writer.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest4ContentWriter implements ScopicManifestContent<PrimordialOctalOrangeJuiceStraw> {
|
||||
|
||||
private final TLVChainOctalSex chain;
|
||||
private final ScopicManifestDuplicateDetector<PrimordialOctalOrangeJuiceStraw> duplicateDetector;
|
||||
|
||||
public ScopicManifest4ContentWriter(TLVChainOctalSex chain) {
|
||||
this.chain = chain;
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(PrimordialOctalOrangeJuiceStraw version) {
|
||||
if (version.length() > ScopicManifestConstants.ATTR_MANIFEST_VERSION_MAX_LENGHT) {
|
||||
throw new ScopicManifestException("Declaration version too large: " + version.length());
|
||||
}
|
||||
addFrameSafe(ScopicManifest4FrameTLV.META_DECLARATION_VERSION, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.MAIN_ATTRIBUTE, name);
|
||||
addFrameSafe(ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_NAME, name);
|
||||
addFrameSafe(ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_BODY, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(PrimordialOctalOrangeJuiceStraw sectionName) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
|
||||
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
|
||||
addFrameSafe(ScopicManifest4FrameTLV.SECTION_HEADER_NAME, sectionName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(PrimordialOctalOrangeJuiceStraw name, PrimordialOctalOrangeJuiceStraw body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
|
||||
addFrameSafe(ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_NAME, name);
|
||||
addFrameSafe(ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_BODY, body);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(PrimordialOctalOrangeJuiceStraw remark) {
|
||||
addFrameSafe(ScopicManifest4FrameTLV.META_REMARK_CONTENT, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
duplicateDetector.clearAll();
|
||||
}
|
||||
|
||||
private void addFrameSafe(TLVChainOctalSexFrameType type, PrimordialOctalOrangeJuiceStraw data) {
|
||||
if (!ScopicManifestConstants.isV4DataArraySizeLegal(data)) {
|
||||
throw new ScopicManifestException("Manifest data token size too long: " + data);
|
||||
}
|
||||
chain.addFrame(type, data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf4;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeSexWord;
|
||||
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainOctalSexFrameType;
|
||||
import love.distributedrebirth.nx01.no2all.nostr.octo.tlv.TLVChainSexTeenBitFrameType;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf3.ScopicManifest3FrameTLV;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicManifest4FrameTLV implements TLVChainOctalSexFrameType {
|
||||
|
||||
META_DECLARATION_VERSION (ScopicManifest3FrameTLV.META_DECLARATION_VERSION),
|
||||
META_REMARK_CONTENT (ScopicManifest3FrameTLV.META_REMARK_CONTENT),
|
||||
|
||||
MAIN_ATTRIBUTE_NAME (ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_NAME),
|
||||
MAIN_ATTRIBUTE_BODY (ScopicManifest3FrameTLV.MAIN_ATTRIBUTE_BODY),
|
||||
|
||||
SECTION_HEADER_NAME (ScopicManifest3FrameTLV.SECTION_HEADER_NAME),
|
||||
SECTION_ATTRIBUTE_NAME (ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_NAME),
|
||||
SECTION_ATTRIBUTE_BODY (ScopicManifest3FrameTLV.SECTION_ATTRIBUTE_BODY),
|
||||
;
|
||||
|
||||
private final PrimordialOctalOrangeJuice orangeJuice;
|
||||
|
||||
private ScopicManifest4FrameTLV(TLVChainSexTeenBitFrameType number) {
|
||||
this(number.ordinalFrameTypeSmurf());
|
||||
}
|
||||
|
||||
private ScopicManifest4FrameTLV(int smurf) {
|
||||
this.orangeJuice = PrimordialOctalOrangeSexWord.valueOfSmurf(smurf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimordialOctalOrangeJuice ordinalFrameType() {
|
||||
return orangeJuice;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.sax3.io.ContentWriterAdapter;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// Stroboscopic manifest 5 text XML content reader.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest5ContentParser extends ContentWriterAdapter {
|
||||
|
||||
private final ScopicManifestContent<String> handler;
|
||||
private boolean attrMain = true;
|
||||
private String attrName;
|
||||
private StringBuilder attrValue = new StringBuilder(300);
|
||||
|
||||
public ScopicManifest5ContentParser(ScopicManifestContent<String> handler) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument() throws SAXException {
|
||||
handler.strobeManifestStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDocument() throws SAXException {
|
||||
handler.strobeManifestEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void comment(String text) throws SAXException {
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
handler.strobeRemarkContent(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(String text) throws SAXException {
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
attrValue.append(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||
if (ScopicManifest5FrameTag.ATTRIBUTE.name().equals(localName)) {
|
||||
attrName = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.ATTRIBUTE_NAME);
|
||||
return;
|
||||
}
|
||||
if (ScopicManifest5FrameTag.SECTION.name().equals(localName)) {
|
||||
attrMain = false;
|
||||
String sectionName = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.SECTION_NAME);
|
||||
handler.strobeSectionHeader(sectionName);
|
||||
return;
|
||||
}
|
||||
if (ScopicManifest5FrameTag.MANIFEST.name().equals(localName)) {
|
||||
String version = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.MANIFEST_VERSION);
|
||||
handler.strobeManifestDeclaration(version);
|
||||
return;
|
||||
}
|
||||
throw new ScopicManifestException("Unknown XML tag: " + localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
if (ScopicManifest5FrameTag.ATTRIBUTE.name().equals(localName)) {
|
||||
if (attrMain) {
|
||||
handler.strobeMainAttribute(attrName, attrValue.toString());
|
||||
} else {
|
||||
handler.strobeSectionAttribute(attrName, attrValue.toString());
|
||||
}
|
||||
attrValue = new StringBuilder();
|
||||
return;
|
||||
}
|
||||
if (ScopicManifest5FrameTag.SECTION.name().equals(localName)) {
|
||||
attrMain = true; // Support normal xml tree layout
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
w * Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.sax3.SAX3WriterEnum;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicateDetector;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestDuplicatePart;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestConstants;
|
||||
|
||||
/// Stroboscopic manifest 5 binary XML content writer.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest5ContentWriter implements ScopicManifestContent<String> {
|
||||
|
||||
private final SAX3WriterEnum<ScopicManifest5FrameTag, ContentWriter> writer;
|
||||
private final ScopicManifestDuplicateDetector<String> duplicateDetector;
|
||||
private boolean openSection = false;
|
||||
|
||||
public ScopicManifest5ContentWriter(ContentWriter writerXml) {
|
||||
this.writer = new SAX3WriterEnum<>(writerXml);
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestStart() {
|
||||
try {
|
||||
writer.startDocument();
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestDeclaration(String version) {
|
||||
if (version.length() > ScopicManifestConstants.ATTR_MANIFEST_VERSION_MAX_LENGHT) {
|
||||
throw new ScopicManifestException("Declaration version too large: " + version.length());
|
||||
}
|
||||
try {
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", ScopicManifest5FrameTag.MANIFEST_VERSION, "", "", WarpManifestX0TheVersion.VERSION_5_0.getQName());
|
||||
writer.printTagStart(ScopicManifest5FrameTag.MANIFEST, atts);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeMainAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.MAIN_ATTRIBUTE, name);
|
||||
writeAttribute(name, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionHeader(String sectionName) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
|
||||
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
|
||||
try {
|
||||
if (openSection) {
|
||||
writer.printTagEnd(ScopicManifest5FrameTag.SECTION);
|
||||
}
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", ScopicManifest5FrameTag.SECTION_NAME, "", "", sectionName);
|
||||
writer.printTagStart(ScopicManifest5FrameTag.SECTION, atts);
|
||||
openSection = true;
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSectionAttribute(String name, String body) {
|
||||
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
|
||||
writeAttribute(name, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRemarkContent(String remark) {
|
||||
try {
|
||||
writer.printComment(remark);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeManifestEnd() {
|
||||
duplicateDetector.clearAll();
|
||||
try {
|
||||
if (openSection) {
|
||||
writer.printTagEnd(ScopicManifest5FrameTag.SECTION);
|
||||
openSection = false;
|
||||
}
|
||||
writer.printTagEnd(ScopicManifest5FrameTag.MANIFEST);
|
||||
writer.endDocument();
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeAttribute(String name, String value) {
|
||||
if (!ScopicManifestConstants.isOtherChar(name)) {
|
||||
throw new ScopicManifestException("Illegal control characters detected: " + name);
|
||||
}
|
||||
try {
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", ScopicManifest5FrameTag.ATTRIBUTE_NAME, "", "", name);
|
||||
writer.printTagStart(ScopicManifest5FrameTag.ATTRIBUTE, atts);
|
||||
writer.printCharacters(value);
|
||||
writer.printTagEnd(ScopicManifest5FrameTag.ATTRIBUTE);
|
||||
} catch (IOException e) {
|
||||
throw new ScopicManifestException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public enum ScopicManifest5FrameTag {
|
||||
|
||||
MANIFEST,
|
||||
ATTRIBUTE,
|
||||
SECTION,
|
||||
;
|
||||
|
||||
static public final String MANIFEST_VERSION = "VERSION";
|
||||
static public final String SECTION_NAME = "NAME";
|
||||
static public final String ATTRIBUTE_NAME = "NAME";
|
||||
}
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8Section;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContentPulser;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5.ScopicManifest5ContentWriter;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天s
|
||||
public class WarpManifestChinaTest {
|
||||
|
||||
@Test
|
||||
public void testFullChineesium() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeAttribute("書", "乞丐歌本").withRemark("同義詞 乞丐歌集");
|
||||
manifest.makeAttribute("年", "一千五百八十一").withRemark("與中國年份時間不同的年份時間");
|
||||
manifest.makeAttribute("描述", "起司頭押韻詞海盜歌曲歌詞");
|
||||
WarpManifestX8Section section = null;
|
||||
|
||||
section = manifest.makeSection("第一節").withRemark("所以這是一個可選的額外元信息文本");
|
||||
section.makeAttribute("一號線", "威廉斯·範·納蘇韋").withRemark("章魚有八隻手臂");
|
||||
section.makeAttribute("二號線", "我是德國血統嗎").withRemark("章魚是海王");
|
||||
section.makeAttribute("三號線", "忠於祖國").withRemark("你的信來自章魚墨水");
|
||||
section.makeAttribute("四號線", "我將留下來直到死亡。").withRemark("章魚不知道零");
|
||||
section.makeAttribute("五號線", "橘子公主").withRemark("算盤有八根卷鬚");
|
||||
section.makeAttribute("六號線", "我,完全沒有羽毛,").withRemark("還可以用墨菇拼出八個字母");
|
||||
section.makeAttribute("七號線", "西班牙國王").withRemark("十月是第八個月");
|
||||
section.makeAttribute("八號線", "我一直很榮幸。").withRemark("這首歌有八行");
|
||||
|
||||
section = manifest.makeSection("第二節");
|
||||
section.withAttribute("一號線", "生活在敬畏神之中");
|
||||
section.withAttribute("二號線", "我一直觀察到,");
|
||||
section.withAttribute("三號線", "因此我被趕走,");
|
||||
section.withAttribute("四號線", "對於土地,對於大聲。");
|
||||
section.withAttribute("五號線", "但神會統治我");
|
||||
section.withAttribute("六號線", "就像一件好的樂器一樣,");
|
||||
section.withAttribute("七號線", "我會回來");
|
||||
section.withAttribute("八號線", "在我的團裡。");
|
||||
|
||||
section = manifest.makeSection("第三節");
|
||||
section.withAttribute("一號線", "受苦吧,我的臣民");
|
||||
section.withAttribute("二號線", "那些本性真誠的人,");
|
||||
section.withAttribute("三號線", "神不會拋棄你,");
|
||||
section.withAttribute("四號線", "儘管你現在背負著重擔。");
|
||||
section.withAttribute("五號線", "虔誠地渴望生活的人,");
|
||||
section.withAttribute("六號線", "日日夜夜向上帝祈禱,");
|
||||
section.withAttribute("七號線", "他會給我力量,");
|
||||
section.withAttribute("八號線", "以便我可以幫助你。");
|
||||
|
||||
section = manifest.makeSection("第四節");
|
||||
section.withAttribute("一號線", "身體和靈魂都在一起");
|
||||
section.withAttribute("二號線", "難道我沒有放過你嗎?");
|
||||
section.withAttribute("三號線", "我的兄弟們名聲顯赫");
|
||||
section.withAttribute("四號線", "還向您展示了:");
|
||||
section.withAttribute("五號線", "阿道夫伯爵留下來");
|
||||
section.withAttribute("六號線", "在弗里斯蘭的戰鬥中,");
|
||||
section.withAttribute("七號線", "他的靈魂進入永生");
|
||||
section.withAttribute("八號線", "預計最後一天。");
|
||||
|
||||
section = manifest.makeSection("第五節");
|
||||
section.withAttribute("一號線", "出身高貴、出身高貴,");
|
||||
section.withAttribute("二號線", "皇家庫存,");
|
||||
section.withAttribute("三號線", "被選中的王國王子,");
|
||||
section.withAttribute("四號線", "作為一個虔誠的基督徒,");
|
||||
section.withAttribute("五號線", "因神的話而受稱讚,");
|
||||
section.withAttribute("六號線", "我,毫不畏懼,");
|
||||
section.withAttribute("七號線", "像英雄一樣無所畏懼");
|
||||
section.withAttribute("八號線", "我的高貴血統冒了險。");
|
||||
|
||||
section = manifest.makeSection("第六節");
|
||||
section.withAttribute("一號線", "我的盾牌和信心");
|
||||
section.withAttribute("二號線", "你是我主上帝啊,");
|
||||
section.withAttribute("三號線", "我想以你為基礎");
|
||||
section.withAttribute("四號線", "永遠不要再離開我。");
|
||||
section.withAttribute("五號線", "使我能保持虔誠,");
|
||||
section.withAttribute("六號線", "你的僕人高於一切,");
|
||||
section.withAttribute("七號線", "趕走暴政");
|
||||
section.withAttribute("八號線", "誰傷了我的心。");
|
||||
|
||||
section = manifest.makeSection("第七節");
|
||||
section.withAttribute("一號線", "在所有困擾我的人中");
|
||||
section.withAttribute("二號線", "迫害我的人是,");
|
||||
section.withAttribute("三號線", "我的上帝,請保存它");
|
||||
section.withAttribute("四號線", "你忠實的僕人,");
|
||||
section.withAttribute("五號線", "他們並不讓我感到驚訝");
|
||||
section.withAttribute("六號線", "在他們邪惡的勇氣中,");
|
||||
section.withAttribute("七號線", "不洗手");
|
||||
section.withAttribute("八號線", "在我無辜的血液裡。");
|
||||
|
||||
section = manifest.makeSection("第八節");
|
||||
section.withAttribute("一號線", "如果大衛不得不逃跑");
|
||||
section.withAttribute("二號線", "對暴君掃羅來說,");
|
||||
section.withAttribute("三號線", "所以我不得不嘆息");
|
||||
section.withAttribute("四號線", "像許多貴族一樣。");
|
||||
section.withAttribute("五號線", "但神已經高舉他,");
|
||||
section.withAttribute("六號線", "脫離一切苦難,");
|
||||
section.withAttribute("七號線", "給予一個王國");
|
||||
section.withAttribute("八號線", "在以色列非常大。");
|
||||
|
||||
section = manifest.makeSection("第九節");
|
||||
section.withAttribute("一號線", "酸後我會收到");
|
||||
section.withAttribute("二號線", "來自甜蜜的上帝我的主,");
|
||||
section.withAttribute("三號線", "讓你嚮往");
|
||||
section.withAttribute("四號線", "我的皇家思想:");
|
||||
section.withAttribute("五號線", "也就是說,我可能會死");
|
||||
section.withAttribute("六號線", "在該領域享有盛譽,");
|
||||
section.withAttribute("七號線", "獲得永恆的王國");
|
||||
section.withAttribute("八號線", "就像一個忠誠的英雄。");
|
||||
|
||||
section = manifest.makeSection("第十節");
|
||||
section.withAttribute("一號線", "沒有什麼能讓我再感到遺憾");
|
||||
section.withAttribute("二號線", "在我的不幸中");
|
||||
section.withAttribute("三號線", "比人們所看到的貧窮");
|
||||
section.withAttribute("四號線", "國王的土地很好。");
|
||||
section.withAttribute("五號線", "你冒犯了西班牙人");
|
||||
section.withAttribute("六號線", "哦,高貴的荷蘭,親愛的,");
|
||||
section.withAttribute("七號線", "當我想到這一點時");
|
||||
section.withAttribute("八號線", "我那顆流血的高貴的心。");
|
||||
|
||||
section = manifest.makeSection("第十一節");
|
||||
section.withAttribute("一號線", "塞得像個王子");
|
||||
section.withAttribute("二號線", "以我的力量,");
|
||||
section.withAttribute("三號線", "暴君的");
|
||||
section.withAttribute("四號線", "我預料到了這一擊");
|
||||
section.withAttribute("五號線", "他埋葬在馬斯特里赫特附近,");
|
||||
section.withAttribute("六號線", "害怕我的暴力;");
|
||||
section.withAttribute("七號線", "有人看到我的騎士在小跑");
|
||||
section.withAttribute("八號線", "非常勇敢地穿過那個領域。");
|
||||
|
||||
section = manifest.makeSection("第十二節");
|
||||
section.withAttribute("一號線", "這就是主的旨意");
|
||||
section.withAttribute("二號線", "那時,");
|
||||
section.withAttribute("三號線", "我很想回頭");
|
||||
section.withAttribute("四號線", "你很認真地對待這件事。");
|
||||
section.withAttribute("五號線", "但天上的主,");
|
||||
section.withAttribute("六號線", "誰主宰萬物,");
|
||||
section.withAttribute("七號線", "人們應該永遠讚美他,");
|
||||
section.withAttribute("八號線", "他並不覬覦它。");
|
||||
|
||||
section = manifest.makeSection("第十三節");
|
||||
section.withAttribute("一號線", "他非常信仰基督教");
|
||||
section.withAttribute("二號線", "我的王子般的心靈,");
|
||||
section.withAttribute("三號線", "一直堅定不移");
|
||||
section.withAttribute("四號線", "我的心在逆境中。");
|
||||
section.withAttribute("五號線", "我已向主祈禱");
|
||||
section.withAttribute("六號線", "我從心底裡,");
|
||||
section.withAttribute("七號線", "他會拯救我的事業,");
|
||||
section.withAttribute("八號線", "可以讓我清白。");
|
||||
|
||||
section = manifest.makeSection("第十四節");
|
||||
section.withAttribute("一號線", "讚美我可憐的羊");
|
||||
section.withAttribute("二號線", "那些在極大苦難中的人,");
|
||||
section.withAttribute("三號線", "你的牧羊人不會睡覺,");
|
||||
section.withAttribute("四號線", "雖然現在你們已經四散了。");
|
||||
section.withAttribute("五號線", "你將走向上帝,");
|
||||
section.withAttribute("六號線", "接受祂有益的話語,");
|
||||
section.withAttribute("七號線", "作為一個虔誠的基督徒生活—");
|
||||
section.withAttribute("八號線", "很快就到這裡了。");
|
||||
|
||||
section = manifest.makeSection("第十五節");
|
||||
section.withAttribute("一號線", "在神面前我要坦白");
|
||||
section.withAttribute("二號線", "和他偉大的力量,");
|
||||
section.withAttribute("三號線", "我會活到那時");
|
||||
section.withAttribute("四號線", "曾藐視國王,");
|
||||
section.withAttribute("五號線", "更重要的是我願主上帝,");
|
||||
section.withAttribute("六號線", "最高陛下,");
|
||||
section.withAttribute("七號線", "不得不服從");
|
||||
section.withAttribute("八號線", "在正義中。");
|
||||
|
||||
String outputV2 = WarpManifestorDriver.writeV2String(manifest);
|
||||
Assertions.assertNotNull(outputV2);
|
||||
String outputIni = WarpManifestorDriver.writeViniString(new WarpManifestX8().withSections(manifest.getSections())); // removes main attributes
|
||||
Assertions.assertNotNull(outputIni);
|
||||
byte[] outputV5 = WarpManifestorDriver.writeV5Array(manifest);
|
||||
Assertions.assertNotNull(outputV5);
|
||||
|
||||
WarpManifestX8 manifestV5 = WarpManifestorDriver.readV5Array(outputV5);
|
||||
StringWriter outputXml = new StringWriter();
|
||||
SAX3WriterXml writerXml = new SAX3WriterXml(outputXml);
|
||||
ScopicManifest5ContentWriter writer = new ScopicManifest5ContentWriter(writerXml);
|
||||
ScopicManifestContentPulser.strobelight(manifestV5, writer, WarpManifestX0TheVersion.VERSION_5_0.getQName());
|
||||
Assertions.assertTrue(outputXml.toString().contains("<!-- 同義詞 乞丐歌集 -->"));
|
||||
Assertions.assertTrue(outputXml.toString().contains("<ATTRIBUTE NAME=\"一號線\">威廉斯·範·納蘇韋</ATTRIBUTE>"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18Import;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestorDriverTest {
|
||||
|
||||
@Test
|
||||
public void testWriteSimple() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeAttribute("foo", "bar");
|
||||
manifest.makeSection("my1").withAttribute("foo1", "bar1");
|
||||
String output = WarpManifestorDriver.writeV1String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.contains("foo1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLineWrapAsLastLine() {
|
||||
String checkWrap = "https://github.com/shrinkwrap/resolver/shrinkwrap-resolver-spi-maven-archive";
|
||||
String checkWrapLast = "http://www.jboss.org/shrinkwrap-resolver-parent/shrinkwrap-resolver-spi-maven-archive";
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV1Stream(getClass().getResourceAsStream("test-line-wrap.mf"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(21, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("Implementation-Title", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals(checkWrap, manitest.getAttributeBody("Scm-Url").get());
|
||||
Assertions.assertEquals(checkWrapLast, manitest.getAttributeBody("Implementation-URL").get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSizeOfVersions() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV1Stream(getClass().getResourceAsStream("test-line-wrap.mf"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
WarpManifestX18 manitestX18 = WarpManifestX18Import.fromX8(manitest);
|
||||
Assertions.assertNotNull(manitestX18);
|
||||
|
||||
System.out.println("size-OF: " + manitest.getAttributeBodyNullable("Implementation-Vendor-Id"));
|
||||
System.out.println("size-V1: " + WarpManifestorDriver.writeV1String(manitest).getBytes(StandardCharsets.UTF_8).length);
|
||||
System.out.println("size-V2: " + WarpManifestorDriver.writeV2String(manitest).getBytes(StandardCharsets.UTF_8).length);
|
||||
System.out.println("size-V3: " + WarpManifestorDriver.writeV3Array(manitest).length);
|
||||
System.out.println("size-V4: " + WarpManifestorDriver.writeV4Array(manitestX18).length);
|
||||
System.out.println("size-V5: " + WarpManifestorDriver.writeV5Array(manitest).length);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestorVIniTest {
|
||||
|
||||
@Test
|
||||
public void testViniReadSystemdService() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readViniStream(getClass().getResourceAsStream("ini/test-ntp.service"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
Assertions.assertEquals("Network Time Service", manitest.getSectionAttributeBodyNullable("Unit", "Description"));
|
||||
Assertions.assertEquals("man:ntpd(8)", manitest.getSectionAttributeBodyNullable("Unit", "Documentation"));
|
||||
//System.out.println(WarpManifestorDriver.writeViniString(manitest));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViniReadSimple() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readViniStream(getClass().getResourceAsStream("ini/test-simple.ini"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("last modified 1 April 2001 by John Doe", manitest.getSection("owner").get().getRemarks().get(0));
|
||||
Assertions.assertEquals("John Doe", manitest.getSectionAttributeBodyNullable("owner", "name"));
|
||||
Assertions.assertEquals("Acme Widgets Inc.", manitest.getSectionAttributeBodyNullable("owner", "organization"));
|
||||
|
||||
Assertions.assertEquals("192.0.2.62", manitest.getSectionAttributeBodyNullable("database", "server"));
|
||||
Assertions.assertEquals("143", manitest.getSectionAttributeBodyNullable("database", "port"));
|
||||
Assertions.assertEquals("payroll.dat", manitest.getSectionAttributeBodyNullable("database", "file"));
|
||||
Assertions.assertEquals("use IP address in case network name resolution is not working", manitest.getSectionAttribute("database", "server").get().getRemarks().get(0));
|
||||
|
||||
Assertions.assertEquals("key=v", manitest.getSectionAttributeBodyNullable("keys", "key"));
|
||||
Assertions.assertEquals("value", manitest.getSectionAttributeBodyNullable("keys", "name"));
|
||||
Assertions.assertEquals(";", manitest.getSectionAttributeBodyNullable("keys", "sem"));
|
||||
Assertions.assertEquals("v5822.433.2", manitest.getSectionAttributeBodyNullable("keys", "semver"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViniReadFruitFolding() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readViniStream(getClass().getResourceAsStream("ini/test-fruit-folding.ini"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(6, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("orchard rental service (with app)", manitest.getSectionAttributeBodyNullable("project", "name"));
|
||||
Assertions.assertEquals("Bay Area", manitest.getSectionAttributeBodyNullable("project", "target region"));
|
||||
Assertions.assertEquals("(vacant)", manitest.getSectionAttributeBodyNullable("project", "legal team"));
|
||||
Assertions.assertEquals("TODO: advertise vacant positions", manitest.getSectionAttribute("project", "legal team").get().getRemarks().get(0));
|
||||
|
||||
Assertions.assertEquals("foreseeable", manitest.getSectionAttributeBodyNullable("fruit \"Apple\"", "trademark issues"));
|
||||
Assertions.assertEquals("known", manitest.getSectionAttributeBodyNullable("fruit \"Apple\"", "taste"));
|
||||
|
||||
Assertions.assertEquals("logistics (fragile fruit)", manitest.getSectionAttributeBodyNullable("fruit \"Raspberry\"", "anticipated problems"));
|
||||
Assertions.assertEquals("possible", manitest.getSectionAttributeBodyNullable("fruit \"Raspberry\"", "Trademark Issues"));
|
||||
|
||||
Assertions.assertEquals("2021-11-23, 08:54 +0900", manitest.getSectionAttributeBodyNullable("fruit.raspberry.proponents.fred", "date"));
|
||||
Assertions.assertEquals("I like red fruit.", manitest.getSectionAttributeBodyNullable("fruit.raspberry.proponents.fred", "comment"));
|
||||
|
||||
Assertions.assertEquals("Why,I would buy dates.", manitest.getSectionAttributeBodyNullable("fruit \"Date/proponents/alfred\"", "comment"));
|
||||
Assertions.assertEquals("My name may contain a \nnewline.", manitest.getSectionAttributeBodyNullable("fruit \"Date/proponents/alfred\"", "editor"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViniWriteFruitFolding() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readViniStream(getClass().getResourceAsStream("ini/test-fruit-folding.ini"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
String strini = WarpManifestorDriver.writeViniString(manitest);
|
||||
Assertions.assertTrue(strini.contains("target region = Bay Area"));
|
||||
Assertions.assertTrue(strini.contains("# TODO: advertise vacant positions"));
|
||||
Assertions.assertTrue(strini.contains("Trademark Issues = truly unlikely"));
|
||||
Assertions.assertTrue(strini.contains("Trademark Issues = possible"));
|
||||
Assertions.assertTrue(strini.contains("comment = I like red fruit."));
|
||||
Assertions.assertTrue(strini.contains("comment = Why,I would buy dates."));
|
||||
Assertions.assertTrue(strini.contains("editor = My name may contain a \\nnewline."));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViniReadEscQuote() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readViniStream(getClass().getResourceAsStream("ini/test-esc-quote.ini"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("'Junit'", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single"));
|
||||
Assertions.assertEquals("Junit\'s hell0", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_center"));
|
||||
Assertions.assertEquals("Junit\'", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_right"));
|
||||
Assertions.assertEquals("\'Junit", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_left"));
|
||||
|
||||
Assertions.assertEquals("\"Junit\"", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double"));
|
||||
Assertions.assertEquals("Junit\"s hell0", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_center"));
|
||||
Assertions.assertEquals("Junit\"", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_right"));
|
||||
Assertions.assertEquals("\"Junit", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_left"));
|
||||
|
||||
Assertions.assertEquals("Junit\thell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "tab"));
|
||||
Assertions.assertEquals("Junit\\hell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "backslash"));
|
||||
Assertions.assertEquals("Junit\nhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "line_feed"));
|
||||
Assertions.assertEquals("Junit\rhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "carriage_return"));
|
||||
Assertions.assertEquals("Junit\0hell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "null_character"));
|
||||
Assertions.assertEquals("Junit\bhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "backspace"));
|
||||
Assertions.assertEquals("Junit\fhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "form_feed"));
|
||||
|
||||
Assertions.assertEquals("Junit;hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "semicolon"));
|
||||
Assertions.assertEquals("Junit#hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "number_sign"));
|
||||
Assertions.assertEquals("Junit=hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "equals_sign"));
|
||||
Assertions.assertEquals("Junit:hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "colon"));
|
||||
Assertions.assertEquals("str1;str2;str3", manitest.getSectionAttributeBodyNullable("EscCharOther", "quote_semi_colons"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestBigBodyTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1LongContent() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<512;i++) {
|
||||
buf.append("1234");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("long-longer-longggger", buf.toString());
|
||||
String output = WarpManifestorDriver.writeV1String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
String lines[] = output.split("\n");
|
||||
Assertions.assertEquals(31, lines.length);
|
||||
Assertions.assertEquals(72, lines[10].length());
|
||||
Assertions.assertEquals(72, lines[11].getBytes(StandardCharsets.UTF_8).length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2LongContent() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<512;i++) {
|
||||
buf.append("1234");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("long-longer-longggger", buf.toString());
|
||||
String output = WarpManifestorDriver.writeV2String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
String lines[] = output.split("\n");
|
||||
Assertions.assertEquals(2, lines.length);
|
||||
Assertions.assertEquals(21, lines[0].length());
|
||||
Assertions.assertEquals(2071, lines[1].getBytes(StandardCharsets.UTF_8).length);
|
||||
|
||||
String outputV1 = WarpManifestorDriver.writeV1String(manifest);
|
||||
WarpManifestX8 manitestV1 = WarpManifestorDriver.readV2String(outputV1);
|
||||
Assertions.assertNotNull(manitestV1);
|
||||
Assertions.assertEquals(1, manitestV1.getAttributes().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3LongContent() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<65535;i++) {
|
||||
buf.append("0");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("limit-lines", buf.toString());
|
||||
byte[] output = WarpManifestorDriver.writeV3Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
WarpManifestX8 manifestClone = WarpManifestorDriver.readV3Array(output);
|
||||
Assertions.assertEquals(manifest.getAttributes().get(0).getBody(), manifestClone.getAttributes().get(0).getBody());
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
manifest.withAttribute("limit-lines", "1" + buf.toString());
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestBodyIllegalTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1BodyNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\n");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1BodyLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\r");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1BodyNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\u0000");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2BodyNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\n");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2BodyLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\r");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2BodyNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\u0000");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3BodyNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\n");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3BodyLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\r");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3BodyNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar\u0000");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameDupTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1DuplicateMainAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar1");
|
||||
manifest.withAttribute("foo", "bar2");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1DuplicateSection() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit");
|
||||
manifest.makeSection("junit");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1DuplicateSectionAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2DuplicateMainAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar1");
|
||||
manifest.withAttribute("foo", "bar2");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2DuplicateSection() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit");
|
||||
manifest.makeSection("junit");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2DuplicateSectionAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3DuplicateMainAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "bar1");
|
||||
manifest.withAttribute("foo", "bar2");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3DuplicateSection() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit");
|
||||
manifest.makeSection("junit");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3DuplicateSectionAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV4DuplicateMainAttribute() {
|
||||
WarpManifestX18 manifest = new WarpManifestX18();
|
||||
manifest.withAttribute(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)));
|
||||
manifest.withAttribute(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)));
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV4Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV4DuplicateSection() {
|
||||
WarpManifestX18 manifest = new WarpManifestX18();
|
||||
manifest.makeSection(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)));
|
||||
manifest.makeSection(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)));
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV4Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV4DuplicateSectionAttribute() {
|
||||
WarpManifestX18 manifest = new WarpManifestX18();
|
||||
manifest.makeSection(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)))
|
||||
.withAttribute(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)))
|
||||
.withAttribute(PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(1, 2, 3)));
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV4Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5DuplicateSection() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit");
|
||||
manifest.makeSection("junit");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5DuplicateSectionAttribute() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameEmptyTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV4NameEmpty() {
|
||||
WarpManifestX18 manifest = new WarpManifestX18();
|
||||
manifest.withAttribute(PrimordialOctalOrangeString.valueOfEmpty(), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(12,34)));
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV4Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5NameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameForbidCharTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\n", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\r", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\u0000", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\n", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\r", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\u0000", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\n", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\r", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\u0000", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5NameNewLine() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\n", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5NameLineFeed() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\r", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5NameNull() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo\u0000", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameLimitTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameLimit() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<70;i++) {
|
||||
buf.append("0");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute(buf.toString(), "foo");
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
manifest.withAttribute(buf.toString() + "1", "bar");
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameLimit() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<65535;i++) {
|
||||
buf.append("0");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeAttribute(buf.toString(), "foo").withRemark("remarkable");
|
||||
String output = WarpManifestorDriver.writeV2String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.contains("foo"));
|
||||
Assertions.assertTrue(output.contains("remarkable"));
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
manifest.withAttribute(buf.toString() + "1", "bar");
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameLimit() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<65535;i++) {
|
||||
buf.append("0");
|
||||
}
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeAttribute(buf.toString(), "foo").withRemark("remarkable");
|
||||
byte[] output = WarpManifestorDriver.writeV3Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
manifest.withAttribute(buf.toString() + "1", "bar");
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameSeperatorTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameSeperator() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo:", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2OutputSeperator() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("ju n it:", "junit:");
|
||||
String output = WarpManifestorDriver.writeV2String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.contains("ju n it::"));
|
||||
Assertions.assertTrue(output.contains("junit:"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3OutputSeperator() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("ju n it:", "junit:");
|
||||
byte[] output = WarpManifestorDriver.writeV3Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV3Array(output);
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(1, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("ju n it:", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals("junit:", manitest.getAttributes().get(0).getBody());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5OutputSeperator() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("ju n it:", "junit:");
|
||||
byte[] output = WarpManifestorDriver.writeV5Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV5Array(output);
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(1, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("ju n it:", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals("junit:", manitest.getAttributes().get(0).getBody());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestNameUnicodeTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1NameUnicode() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "仙上主天");
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
manifest.withAttribute("仙上主天", "bar");
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2NameUnicode() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "仙上主天");
|
||||
manifest.withAttribute("仙上主天", "bar");
|
||||
String output = WarpManifestorDriver.writeV2String(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
String lines[] = output.split("\n");
|
||||
Assertions.assertEquals(3, lines.length);
|
||||
Assertions.assertEquals("foo: 仙上主天", lines[1]);
|
||||
Assertions.assertEquals("仙上主天: bar", lines[2]);
|
||||
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV2String(output);
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(2, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("foo", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals("仙上主天", manitest.getAttributes().get(1).getName());
|
||||
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.readV1String(output);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3NameUnicode() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "仙上主天");
|
||||
manifest.withAttribute("仙上主天", "bar");
|
||||
byte[] output = WarpManifestorDriver.writeV3Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV3Array(output);
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(2, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("foo", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals("仙上主天", manitest.getAttributes().get(1).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5NameUnicode() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.withAttribute("foo", "仙上主天");
|
||||
manifest.withAttribute("仙上主天", "bar");
|
||||
byte[] output = WarpManifestorDriver.writeV5Array(manifest);
|
||||
Assertions.assertNotNull(output);
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.readV5Array(output);
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(2, manitest.getAttributes().size());
|
||||
Assertions.assertEquals("foo", manitest.getAttributes().get(0).getName());
|
||||
Assertions.assertEquals("仙上主天", manitest.getAttributes().get(1).getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class WarpManifestSectionNameEmptyTest {
|
||||
|
||||
@Test
|
||||
public void testWriteV1SectionNameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("").withAttribute("foo", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV1String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV2SectionNameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("").withAttribute("foo", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV2String(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV3SectionNameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("").withAttribute("foo", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV3Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV4SectionNameEmpty() {
|
||||
PrimordialOctalOrangeString foobar = PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(123,456,789));
|
||||
WarpManifestX18 manifest = new WarpManifestX18();
|
||||
manifest.makeSection(PrimordialOctalOrangeString.valueOfEmpty()).withAttribute(foobar, foobar);
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV4Array(manifest);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteV5SectionNameEmpty() {
|
||||
WarpManifestX8 manifest = new WarpManifestX8();
|
||||
manifest.makeSection("").withAttribute("foo", "bar");
|
||||
Assertions.assertThrows(ScopicManifestException.class, () -> {
|
||||
WarpManifestorDriver.writeV5Array(manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
[EscQuote]
|
||||
quote_single=\'Junit\'
|
||||
quote_single_center="Junit\'s hell0"
|
||||
quote_single_right=Junit'
|
||||
quote_single_left='Junit
|
||||
quote_double=\"Junit\"
|
||||
quote_double_center="Junit\"s hell0"
|
||||
quote_double_right=Junit"
|
||||
quote_double_left="Junit
|
||||
|
||||
[EscCharNative]
|
||||
tab="Junit\thell0"
|
||||
backslash="Junit\\hell0"
|
||||
line_feed="Junit\nhell0"
|
||||
carriage_return="Junit\rhell0"
|
||||
null_character="Junit\0hell0"
|
||||
backspace="Junit\bhell0"
|
||||
form_feed="Junit\fhell0"
|
||||
|
||||
[EscCharOther]
|
||||
semicolon="Junit\;hell0"
|
||||
number_sign="Junit\#hell0"
|
||||
equals_sign="Junit\=hell0"
|
||||
colon="Junit\:hell0"
|
||||
quote_semi_colons=str1\;str2\;str3
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
[project]
|
||||
name = orchard rental service (with app)
|
||||
target region = "Bay Area"
|
||||
; TODO: advertise vacant positions
|
||||
legal team = (vacant)
|
||||
|
||||
[fruit "Apple"]
|
||||
trademark issues = foreseeable
|
||||
taste = known
|
||||
|
||||
[fruit.Date]
|
||||
taste = novel
|
||||
Trademark Issues="truly unlikely"
|
||||
|
||||
[fruit "Raspberry"]
|
||||
anticipated problems ="logistics (fragile fruit)"
|
||||
Trademark Issues=\
|
||||
possible
|
||||
|
||||
[fruit.raspberry.proponents.fred]
|
||||
date = 2021-11-23, 08:54 +0900
|
||||
comment = "I like red fruit."
|
||||
[fruit "Date/proponents/alfred"]
|
||||
comment: Why, \
|
||||
\
|
||||
\
|
||||
I would buy dates.
|
||||
# folding: Is "\\\\\nn" interpreted as "\\n" or "\n"?
|
||||
# Or does "\\\\" prevent folding?
|
||||
editor =My name may contain a \\
|
||||
newline.
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
[Unit]
|
||||
Description=Network Time Service
|
||||
Documentation=man:ntpd(8)
|
||||
Wants=network.target
|
||||
ConditionCapability=CAP_SYS_TIME
|
||||
After=network.target nss-lookup.target
|
||||
Conflicts=systemd-timesyncd.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PrivateTmp=true
|
||||
PIDFile=/run/ntpd.pid
|
||||
ExecStart=/usr/libexec/ntpsec/ntp-systemd-wrapper
|
||||
# Specifying -g on the command line allows ntpd to make large adjustments to
|
||||
# the clock on boot. However, if Restart=yes is set, a malicious (or broken)
|
||||
# server could send the incorrect time, trip the panic threshold, and when
|
||||
# ntpd restarts, serve it the incorrect time (which would be accepted).
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
Alias=ntp.service
|
||||
Alias=ntpd.service
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
; last modified 1 April 2001 by John Doe
|
||||
[owner]
|
||||
name = John Doe
|
||||
organization = Acme Widgets Inc.
|
||||
|
||||
[database]
|
||||
; use IP address in case network name resolution is not working
|
||||
server = 192.0.2.62
|
||||
port = 143
|
||||
file = "payroll.dat"
|
||||
|
||||
[keys]
|
||||
key=key=v
|
||||
name =value
|
||||
sem=;
|
||||
semver=v5822.433.2
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
Manifest-Version: 1.0
|
||||
Implementation-Title: ShrinkWrap Resolver Maven Archive SPI
|
||||
Implementation-Version: 2.2.6
|
||||
Build-Timestamp: Thu, 26 Jan 2017 16:26:41 +0000
|
||||
Archiver-Version: Plexus Archiver
|
||||
Java-Version: 1.8.0_101
|
||||
Built-By: mjobanek
|
||||
Scm-Connection: scm:git:git://github.com/shrinkwrap/resolver.git/shrin
|
||||
kwrap-resolver-spi-maven-archive
|
||||
Specification-Vendor: JBoss by Red Hat
|
||||
Os-Arch: amd64
|
||||
Specification-Title: ShrinkWrap Resolver Maven Archive SPI
|
||||
Implementation-Vendor-Id: org.jboss.shrinkwrap.resolver
|
||||
Java-Vendor: Oracle Corporation
|
||||
Os-Name: Linux
|
||||
Scm-Url: https://github.com/shrinkwrap/resolver/shrinkwrap-resolver-sp
|
||||
i-maven-archive
|
||||
Implementation-Vendor: JBoss by Red Hat
|
||||
Os-Version: 4.8.15-200.fc24.x86_64
|
||||
Scm-Revision: 773ec70bd9e470e43dc452f5d6696b5091fc483c
|
||||
Created-By: Apache Maven 3.3.9
|
||||
Build-Jdk: 1.8.0_101
|
||||
Specification-Version: 2.2.6
|
||||
Implementation-URL: http://www.jboss.org/shrinkwrap-resolver-parent/sh
|
||||
rinkwrap-resolver-spi-maven-archive
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue