Added warp fault and manifestor

This commit is contained in:
Willem Cazander 2024-11-23 19:10:47 +01:00
parent 4dabe2d905
commit b409289f18
95 changed files with 7835 additions and 0 deletions

21
nx01-warp-fault/pom.xml Normal file
View file

@ -0,0 +1,21 @@
<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-fault</artifactId>
<dependencies>
<dependency>
<groupId>love.distributedrebirth.nx01</groupId>
<artifactId>nx01-warp-manifestor</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -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.fault;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestGenerator;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestSectionWhitePaper;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoGrowlFactory;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
/// Bass fault anchor (which replaces; Exception/RuntimeException)
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
abstract public class BassFaultAnchor extends BassFaultAnchorSignalStore {
private static final long serialVersionUID = 1L;
private boolean printClean = false;
public BassFaultAnchor(String message, Class<?> signal) {
super(message, signal);
}
public BassFaultAnchor(Exception error, Class<?> signal) {
super(error, signal);
}
public BassFaultAnchor(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public BassFaultAnchor(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
public final BassFaultAnchor withSignalTrace(Class<?> signal, String key, String value) {
fetchTraceSignalMap(signal).put(key, value);
return this;
}
public final BassFaultAnchor withSignalTrace(Class<?> signal, Consumer<Map<String, String>> tracer) {
tracer.accept(fetchTraceSignalMap(signal));
return this;
}
public final BassFaultAnchor appendOnWhitePaper(String key, String value) {
return withSignalTrace(SitraManifestSectionWhitePaper.class, key, value);
}
public final BassFaultAnchor appendOnWhitePaper(Consumer<Map<String, String>> tracer) {
return withSignalTrace(SitraManifestSectionWhitePaper.class, tracer);
}
public final StackTraceElement[] getStackTraceWithoutSignals() {
return super.getStackTrace();
}
@Override
public final StackTraceElement[] getStackTrace() {
Throwable faultRoot = getCause();
if (faultRoot != null) {
if (faultRoot instanceof BassFaultAnchor) {
BassFaultAnchor.class.cast(faultRoot).printClean = true;
}
while (faultRoot.getCause() != null) {
faultRoot = faultRoot.getCause();
if (faultRoot instanceof BassFaultAnchor) {
BassFaultAnchor.class.cast(faultRoot).printClean = true;
}
}
}
StackTraceElement[] superTrace = super.getStackTrace();
if (printClean) {
return superTrace;
}
List<StackTraceElement> trace = new ArrayList<>(Arrays.asList(superTrace));
for (Class<?> traceKey : this.getTraceSignals()) {
Optional<Map<String, String>> signalsOpt = this.getTraceSignalContext(traceKey);
if (signalsOpt.isEmpty()) {
continue;
}
Map<String, String> signals = signalsOpt.get();
for (String signalKey : signals.keySet()) {
String signalValue = signals.get(signalKey);
trace.add(0, new StackTraceElement("TraceSignal", signalKey + "=" + signalValue, traceKey.getSimpleName(), 0));
}
}
StackTraceElement[] result = trace.toArray(new StackTraceElement[] {});
return result;
}
public final String toStringZilLaLa() {
return ZilLaLaManyfestoGrowlFactory..buildFaultScream(toZilLaLaManyfesto(), this);
}
public final WarpManifest3 toZilLaLaManyfesto() {
return SitraManifestGenerator..buildSignalTraceManifest(this);
}
static public StackTraceElement[] cleanStackTrace(Throwable e) {
if (e instanceof BassFaultAnchor) {
return BassFaultAnchor.class.cast(e).getStackTraceWithoutSignals();
} else {
return e.getStackTrace();
}
}
}

View file

@ -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.fault;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
/// Bass fault anchor for storing trace signals.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
abstract public class BassFaultAnchorSignalStore extends RuntimeException {
private static final long serialVersionUID = 1L;
private final LinkedHashMap<Class<?>,Map<String, String>> traceSignals = new LinkedHashMap<>();
protected BassFaultAnchorSignalStore(String message, Class<?> signal) {
super(message);
fetchTraceSignalMap(signal).put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_CHAIN_MESSAGE, message);
}
protected BassFaultAnchorSignalStore(Exception error, Class<?> signal) {
super(error.getMessage(), error);
// Copy signals from ONE (grant) parent, as they also did this;
if (error instanceof BassFaultAnchorSignalStore) { // copy signals from parent
traceSignals.putAll(BassFaultAnchorSignalStore.class.cast(error).traceSignals);
} else {
Throwable faultParentTracer = error.getCause();
if (faultParentTracer instanceof BassFaultAnchorSignalStore) { // copy signals from grand parent
traceSignals.putAll(BassFaultAnchorSignalStore.class.cast(faultParentTracer).traceSignals);
} else if (faultParentTracer != null) {
while (faultParentTracer.getCause() != null) {
faultParentTracer = faultParentTracer.getCause();
if (faultParentTracer instanceof BassFaultAnchorSignalStore) {
traceSignals.putAll(BassFaultAnchorSignalStore.class.cast(faultParentTracer).traceSignals);
break; // copy signals from first fault in the family line
}
}
}
}
fetchTraceSignalMap(signal).put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_CHAIN_ICEBERG, error.getClass().getName());
}
protected BassFaultAnchorSignalStore(Exception error, Class<?> signal, String key, String value) {
this(error, signal);
fetchTraceSignalMap(signal).put(key, value);
}
protected BassFaultAnchorSignalStore(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
this(error, signal);
tracer.accept(fetchTraceSignalMap(signal));
}
public final Set<Class<?>> getTraceSignals() {
return traceSignals.keySet();
}
public final Optional<Map<String, String>> getTraceSignalContext(Class<?> signal) {
Map<String, String> result = traceSignals.get(signal);
if (result == null) {
return Optional.empty();
}
return Optional.of(result);
}
protected final Map<String, String> fetchTraceSignalMap(Class<?> signal) {
Map<String, String> result = traceSignals.get(signal);
if (result == null) {
result = new HashMap<>();
traceSignals.put(signal, result);
}
return result;
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; InstantiationException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultBeanInstantiation extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultBeanInstantiation(String message, Class<?> signal) {
super(message, signal);
}
public FaultBeanInstantiation(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultBeanInstantiation(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultBeanInstantiation(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; InterruptedException/IllegalMonitorStateException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultBeanInterrupted extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultBeanInterrupted(String message, Class<?> signal) {
super(message, signal);
}
public FaultBeanInterrupted(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultBeanInterrupted(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultBeanInterrupted(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; IllegalStateException/UnsupportedOperationException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultBeanState extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultBeanState(String message, Class<?> signal) {
super(message, signal);
}
public FaultBeanState(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultBeanState(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultBeanState(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; IllegalAccessException/IllegalThreadStateException/SecurityException/UnsupportedOperationException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceAccess extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceAccess(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceAccess(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceAccess(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceAccess(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; NoSuchFieldException/NoSuchMethodException/ClassNotFoundException/TypeNotPresentException/EnumConstantNotPresentException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceMissing extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceMissing(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceMissing(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceMissing(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceMissing(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; NullPointerException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceNull extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceNull(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceNull(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceNull(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceNull(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; ArrayStoreException/ClassCastException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceType extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceType(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceType(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceType(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceType(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; IllegalArgumentException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceTypeValue extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceTypeValue(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceTypeValue(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceTypeValue(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceTypeValue(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; ArrayIndexOutOfBoundsException/IndexOutOfBoundsException/NegativeArraySizeException/StringIndexOutOfBoundsException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultReferenceTypeValueBounds extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultReferenceTypeValueBounds(String message, Class<?> signal) {
super(message, signal);
}
public FaultReferenceTypeValueBounds(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultReferenceTypeValueBounds(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultReferenceTypeValueBounds(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.fault;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import love.distributedrebirth.nx01.warp.fault.duck.DuckTailQuackLanguageFactory;
import love.distributedrebirth.nx01.warp.fault.duck.DuckTailQuackLanguageProvider;
/// Replaces; Packs an error of an other person.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultStreamDelegate extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultStreamDelegate(String message, Class<?> signal) {
super(message, signal);
}
public FaultStreamDelegate(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultStreamDelegate(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultStreamDelegate(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
static public FaultStreamDelegate valueOfDuckTail(Class<?> signal, String quackLanguage, String quack) {
Optional<DuckTailQuackLanguageProvider> duckTail = DuckTailQuackLanguageFactory..deliverQuackLanguage(quackLanguage);
if (duckTail.isEmpty()) {
return new FaultStreamDelegate("Missing duck for quack of: " + quackLanguage, signal);
}
FaultStreamDelegateDuckTail tail = duckTail.get().parseDuckTail(quack);
if (tail == null) {
return new FaultStreamDelegate("Missing duck tail for: " + quackLanguage, signal);
}
return new FaultStreamDelegate(tail, signal);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Wrap stack traces of other languages with duck tales.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultStreamDelegateDuckTail extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultStreamDelegateDuckTail(String message, Class<?> signal) {
super(message, signal);
}
public FaultStreamDelegateDuckTail(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultStreamDelegateDuckTail(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultStreamDelegateDuckTail(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; IOException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultStreamInterrupted extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultStreamInterrupted(String message, Class<?> signal) {
super(message, signal);
}
public FaultStreamInterrupted(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultStreamInterrupted(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultStreamInterrupted(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; NumberFormatException
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultStreamValueRead extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultStreamValueRead(String message, Class<?> signal) {
super(message, signal);
}
public FaultStreamValueRead(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultStreamValueRead(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultStreamValueRead(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault;
import java.util.Map;
import java.util.function.Consumer;
/// Replaces; real format exception
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class FaultStreamValueWrite extends BassFaultAnchor {
private static final long serialVersionUID = 1L;
public FaultStreamValueWrite(String message, Class<?> signal) {
super(message, signal);
}
public FaultStreamValueWrite(Exception error, Class<?> signal) {
super(error, signal);
}
public FaultStreamValueWrite(Exception error, Class<?> signal, String key, String value) {
super(error, signal, key, value);
}
public FaultStreamValueWrite(Exception error, Class<?> signal, Consumer<Map<String, String>> tracer) {
super(error, signal, tracer);
}
}

View file

@ -0,0 +1,53 @@
/*
* 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.fault.duck;
/// An abstract duck tail
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
abstract public class AbstractDuckTailQuackLanguageProvider implements DuckTailQuackLanguageProvider {
private final int duckMogul;
private final String quackLanguage;
public AbstractDuckTailQuackLanguageProvider(int duckMogul, String quackLanguage) {
this.duckMogul = duckMogul;
this.quackLanguage = quackLanguage;
}
@Override
public final int duckMogul() {
return duckMogul;
}
@Override
public final String quackLanguage() {
return quackLanguage;
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.fault.duck;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.ServiceLoader;
/// Holds all the duck tales quack language providers found in the class path.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum DuckTailQuackLanguageFactory {
;
private final Map<String, DuckTailQuackLanguageProvider> quackLanguages;
private DuckTailQuackLanguageFactory() {
Map<String, DuckTailQuackLanguageProvider> quackMap = new HashMap<>();
ServiceLoader<DuckTailQuackLanguageProvider> loader = ServiceLoader.load(DuckTailQuackLanguageProvider.class);
for (DuckTailQuackLanguageProvider quackSupport : loader) {
DuckTailQuackLanguageProvider other = quackMap.get(quackSupport.quackLanguage());
if (other != null && other.duckMogul() > quackSupport.duckMogul()) {
continue;
}
quackMap.put(quackSupport.quackLanguage(), quackSupport);
}
quackLanguages = Collections.unmodifiableMap(quackMap);
}
public Optional<DuckTailQuackLanguageProvider> deliverQuackLanguage(String quackLanguage) {
return Optional.ofNullable(quackLanguages.get(quackLanguage));
}
}

View file

@ -0,0 +1,43 @@
/*
* 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.fault.duck;
import love.distributedrebirth.nx01.warp.fault.FaultStreamDelegateDuckTail;
/// Creates an duck tail from a quack selected by language and highest mogol.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface DuckTailQuackLanguageProvider {
int duckMogul();
String quackLanguage();
FaultStreamDelegateDuckTail parseDuckTail(String quack);
}

View file

@ -0,0 +1,129 @@
/*
* 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.fault.duck;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.FaultStreamDelegateDuckTail;
/// Creates an duck tail from a quack selected by language and mogol.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class QuackJavaScriptDuckTales extends AbstractDuckTailQuackLanguageProvider {
public QuackJavaScriptDuckTales() {
super(1, "js");
}
@Override
public FaultStreamDelegateDuckTail parseDuckTail(String quack) {
if (!quack.contains("at")) {
return null;
}
int errorIdx = quack.indexOf("Error: ");
if (errorIdx == -1) {
return null;
}
boolean parseSignals = false;
Map<String, String> signals = new HashMap<>();
String errorMsg = quack.substring(errorIdx + 7, quack.indexOf("\n", errorIdx));
List<StackTraceElement> trace = new ArrayList<>();
Iterator<String> lines = Arrays.asList(quack.split("\n")).iterator();
while (lines.hasNext()) {
String line = lines.next();
if (parseSignals) {
if ("}".equals(line)) {
parseSignals = false;
continue;
}
String[] values = line.split(":");
if (values.length == 0) {
continue;
}
String value = values[1].replaceAll(",|'", "").trim();
signals.put("EcmaScript-Error-" + values[0].trim(), value);
continue;
}
if (!line.startsWith(" at ")) {
continue;
}
String objectMethod = null;
String objectSource = null;
Iterator<String> parts = Arrays.asList(line.split(" ")).iterator();
while (parts.hasNext()) {
String part = parts.next();
if (part.isEmpty()) {
continue;
}
if ("at".equals(part)) {
continue;
}
if ("async".equals(part)) {
continue;
}
if ("{".equals(part)) {
parseSignals = true;
continue;
}
if (objectMethod == null) {
objectMethod = part;
continue;
}
if (objectSource == null) {
objectSource = part;
continue;
}
break; // or fail...
}
// TODO: make safe, this is hacky
int indexFileStart = objectSource.indexOf("(") + 1;
int indexFileEnd = objectSource.lastIndexOf(":", objectSource.lastIndexOf(":") - 1); // backwards search
int indexLineStart = indexFileEnd + 1;
int indexLineEnd = objectSource.lastIndexOf(":");
String[] objectName = objectMethod.split("\\.");
String declaringClass = objectName.length==1?"this":objectName[0];
String methodName = objectName.length==1?objectName[0]:objectName[1];
String fileName = objectSource.substring(indexFileStart, indexFileEnd);
int lineNumber = 0;
if (indexLineEnd > 0) {
lineNumber = Integer.parseInt(objectSource.substring(indexLineStart, indexLineEnd));
}
trace.add(new StackTraceElement(declaringClass, methodName, fileName, lineNumber));
}
FaultStreamDelegateDuckTail result = new FaultStreamDelegateDuckTail(errorMsg, getClass());
result.setStackTrace(trace.toArray(new StackTraceElement[] {}));
result.withSignalTrace(getClass(), v -> v.putAll(signals));
return result;
}
}

View file

@ -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.fault.report;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionChampionsLeague;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports the fault stack trace in java2 format.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraFaultStackTraceJava2 implements SitraManifestReportProvider {
private static final String GOAL_SCORE = ZilLaLaManyfestoSectionGoal.SCISSORS.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.SCISSORS_JAVA2);
@Override
public void fillReport(BassFaultAnchor fault, Map<String, String> tracer) {
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, GOAL_SCORE);
List<Throwable> oldgroup = new ArrayList<>();
oldgroup.add(fault);
Throwable faultRoot = fault.getCause();
if (faultRoot != null) {
oldgroup.add(faultRoot);
while (faultRoot.getCause() != null) {
faultRoot = faultRoot.getCause();
oldgroup.add(faultRoot);
}
}
int errorCount = 0;
int frameCount = 0;
String matchStopTrace = null;
for (int i = 0; i < oldgroup.size(); i++) {
Throwable error = oldgroup.get(i);
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER_FAULT+errorCount++, error.toString());
int stopped = -1;
StackTraceElement[] frames = BassFaultAnchor.cleanStackTrace(error);
for (int f = 0; f < frames.length ; f++) {
StackTraceElement trace = frames[f];
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER+frameCount++, trace.toString());
if (matchStopTrace == null) {
matchStopTrace = trace.getClassName() + trace.getMethodName();
}
if (i > 0 && matchStopTrace != null) {
String matchCurrentTrace = trace.getClassName() + trace.getMethodName();
if (matchStopTrace.equals(matchCurrentTrace)) {
stopped = f;
break; // NOTE: is only 99% equal to native jvm stack trace
}
}
}
if (stopped > 0) {
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER+frameCount++, "... " + (frames.length - stopped + i) + " more");
}
for (Throwable hidden : error.getSuppressed()) {
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER_FAULT_SHADOW+errorCount++, hidden.toString());
for (StackTraceElement trace : BassFaultAnchor.cleanStackTrace(hidden)) {
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER+frameCount++, trace.toString());
}
}
}
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.fault.report;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionChampionsLeague;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports the fault stack trace in java3 format.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraFaultStackTraceJava3 implements SitraManifestReportProvider {
private static final String GOAL_SCORE = ZilLaLaManyfestoSectionGoal.SCISSORS.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.SCISSORS_JAVA3);
@Override
public void fillReport(BassFaultAnchor fault, Map<String, String> tracer) {
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, GOAL_SCORE);
List<Throwable> regroup = new ArrayList<>();
regroup.add(fault);
Throwable faultRoot = fault.getCause();
if (faultRoot != null) {
regroup.add(faultRoot);
while (faultRoot.getCause() != null) {
faultRoot = faultRoot.getCause();
regroup.add(faultRoot);
}
}
int errorCount = 0;
int frameCount = 0;
Collections.reverse(regroup);
for (int i = 0; i < regroup.size(); i++) {
Throwable error = regroup.get(i);
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER_FAULT+errorCount++, error.toString());
String matchStopTrace = null;
if (i + 1 < regroup.size()) {
Throwable errorNext = regroup.get(i + 1);
StackTraceElement[] traceNext = BassFaultAnchor.cleanStackTrace(errorNext);
if (traceNext.length > 0) {
StackTraceElement lastStep = traceNext[0];
matchStopTrace = lastStep.getClassName() + lastStep.getMethodName();
}
}
boolean stopNext = false;
for (StackTraceElement trace : BassFaultAnchor.cleanStackTrace(error)) {
if (stopNext) {
break;
}
if (matchStopTrace != null) {
String matchCurrentTrace = trace.getClassName() + trace.getMethodName();
if (matchStopTrace.equals(matchCurrentTrace)) {
stopNext = true;
}
}
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER+frameCount++, trace.toString());
}
for (Throwable hidden : error.getSuppressed()) {
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER_FAULT_SHADOW+errorCount++, hidden.toString());
for (StackTraceElement trace : BassFaultAnchor.cleanStackTrace(hidden)) {
tracer.put(ZilLaLaManyfestoHeader.PREFIX_SECTION_LADDER+frameCount++, trace.toString());
}
}
}
}
}

View file

@ -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.fault.report;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionChampionsLeague;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports sitra warp fault version
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraFaultWarpVersion implements SitraManifestReportProvider {
private static final String GOAL_SCORE = ZilLaLaManyfestoSectionGoal.BIMBAMBO.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.BIMBAMBO_MAVEN);
private final static String WARP_FAULT_GROUP_ID = "love.distributedrebirth.bassboon";
private final static String WARP_FAULT_ARTIFACT_ID = "bassboon-warp-fault";
private final static String POM_VERSION_PROPERTY_KEY = "version";
private final static String POM_PROPERTIES_RESOURCE = "/META-INF/maven/" + WARP_FAULT_GROUP_ID + "/" + WARP_FAULT_ARTIFACT_ID + "/pom.properties";
@Override
public void fillReport(Map<String, String> tracer) {
InputStream faultPomVersion = getClass().getResourceAsStream(POM_PROPERTIES_RESOURCE);
if (faultPomVersion == null) {
return;
}
try (InputStream in = faultPomVersion) {
Properties p = new Properties();
p.load(in);
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, GOAL_SCORE);
tracer.put("Warp-Fault-GroupId", WARP_FAULT_GROUP_ID);
tracer.put("Warp-Fault-ArtifactId", WARP_FAULT_ARTIFACT_ID);
tracer.put("Warp-Fault-Version", p.getProperty(POM_VERSION_PROPERTY_KEY));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}

View file

@ -0,0 +1,55 @@
/*
* 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.fault.report;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionChampionsLeague;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports runtime memory statistics.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraRuntimeChapter implements SitraManifestReportProvider {
private static final String GOAL_SCORE = ZilLaLaManyfestoSectionGoal.BUBBLES.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.BUBBLES_RUMTIME);
private static final Runtime RUNTIME = Runtime.getRuntime();
@Override
public void fillReport(Map<String, String> tracer) {
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, GOAL_SCORE);
tracer.put("VM-Version", Runtime.version().toString());
tracer.put("VM-Max-Memory", Long.toString(RUNTIME.maxMemory()));
tracer.put("VM-Free-Memory", Long.toString(RUNTIME.freeMemory()));
tracer.put("VM-Total-Memory", Long.toString(RUNTIME.totalMemory()));
tracer.put("VM-Available-Processors", Long.toString(RUNTIME.availableProcessors()));
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault.report;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports runtime threads states.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraRuntimeThreads implements SitraManifestReportProvider {
@Override
public void fillReport(Map<String, String> tracer) {
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, ZilLaLaManyfestoSectionGoal.BUTTER.toString());
Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
for (Thread thread : stacks.keySet()) {
StackTraceElement[] trackStack = stacks.get(thread);
String threadName = thread.getName();
String threadState = thread.getState().name();
String traceLine = trackStack.length==0?"":trackStack[0].toString();
String reportKey = threadState + "-ID_" + thread.getId();
String reportValue = thread.getClass().getName() + " (" + threadName + ") " + traceLine;
tracer.put(reportKey, reportValue);
}
}
}

View file

@ -0,0 +1,68 @@
/*
* 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.fault.report;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoHeader;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionChampionsLeague;
import love.distributedrebirth.nx01.warp.fault.sitra.ZilLaLaManyfestoSectionGoal;
/// Reports system memory statistics.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraSystemChapter implements SitraManifestReportProvider {
private static final String GOAL_SCORE = ZilLaLaManyfestoSectionGoal.BUBBLES.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.BUBBLES_OPERATING_SYSTEM);
private static final OperatingSystemMXBean SYSTEM = ManagementFactory.getOperatingSystemMXBean();
@SuppressWarnings("deprecation")
@Override
public void fillReport(Map<String, String> tracer) {
tracer.put(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, GOAL_SCORE);
tracer.put("OS-Name", SYSTEM.getName());
tracer.put("OS-Arch", SYSTEM.getArch());
tracer.put("OS-Version", SYSTEM.getVersion());
tracer.put("OS-Available-Processors", Integer.toString(SYSTEM.getAvailableProcessors()));
tracer.put("OS-Load-Average", Double.toString(SYSTEM.getSystemLoadAverage()));
if (SYSTEM instanceof com.sun.management.OperatingSystemMXBean) {
com.sun.management.OperatingSystemMXBean systemSun = com.sun.management.OperatingSystemMXBean.class.cast(SYSTEM);
tracer.put("OS-Committed-Virtual-Memory-Size", Long.toString(systemSun.getCommittedVirtualMemorySize()));
tracer.put("OS-Free-Swap-Space-Size", Long.toString(systemSun.getFreeSwapSpaceSize()));
tracer.put("OS-Process-Cpu-Load", Double.toString(systemSun.getProcessCpuLoad()));
tracer.put("OS-Process-Cpu-Time", Long.toString(systemSun.getProcessCpuTime()));
tracer.put("OS-Cpu-Load", Double.toString(systemSun.getSystemCpuLoad()));
tracer.put("OS-Total-Memory-Size", Long.toString(systemSun.getTotalPhysicalMemorySize()));
tracer.put("OS-Total-Memory-Usage", Double.toString(((double)systemSun.getFreeMemorySize() / (double)systemSun.getTotalPhysicalMemorySize()) * 100));
}
}
}

View file

@ -0,0 +1,47 @@
/*
* 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.fault.report;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
/// Reports the system environment variables.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraSystemEnvironment implements SitraManifestReportProvider {
@Override
public void fillReport(Map<String, String> tracer) {
for (String key : System.getenv().keySet()) {
String value = System.getenv(key);
tracer.put(key, value);
}
}
}

View file

@ -0,0 +1,48 @@
/*
* 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.fault.report;
import java.util.Locale;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
/// Reports the system locale.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraSystemLocale implements SitraManifestReportProvider {
@Override
public void fillReport(Map<String, String> tracer) {
Locale locale = Locale.getDefault();
tracer.put("Locale-Language", locale.getLanguage());
tracer.put("Locale-Country", locale.getCountry());
tracer.put("Locale-Variant", locale.getVariant());
}
}

View file

@ -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.fault.report;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.sitra.SitraManifestReportProvider;
/// Reports all the system properties.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ReportSitraSystemProperties implements SitraManifestReportProvider {
@Override
public void fillReport(Map<String, String> tracer) {
for (Object keyObj : System.getProperties().keySet()) {
if (keyObj instanceof String) {
String key = String.class.cast(keyObj);
String value = System.getProperty(key);
tracer.put(key, value);
}
}
}
}

View file

@ -0,0 +1,139 @@
/*
* 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.fault.sitra;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3Section;
import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestConstants;
/// Sitra manifest generator.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum SitraManifestGenerator {
;
private static final String SITRA_VALUE_NULL = "null";
public WarpManifest3 buildSignalTraceManifest(BassFaultAnchor fault) {
String message = fault.getLocalizedMessage();
if (message != null) {
message = escapeSignalValue(message);
}
String uuidDate = DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(Instant.now(), ZoneOffset.UTC));
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_MANYFESTO_VCROSS, ZilLaLaManyfesto.MANYFESTO_VERSION);
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_MANYFESTO_AFOUR, ZilLaLaManyfesto.MANYFESTO_A4_JAVA);
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_UUID_WM_ONE, SitraManifestUUIDCrematorium..burnWaterMarkOne().toString());
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_UUID_WM_TWO, SitraManifestUUIDCrematorium..burnWaterMarkTwo().toString());
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_UUID_WM_THREE, SitraManifestUUIDCrematorium..burnWaterMarkThree().toString());
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_UUID_WM_FOUR, SitraManifestUUIDCrematorium..burnWaterMarkFour().toString());
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_UUID_DATE, uuidDate);
Throwable faultRoot = fault.getCause();
if (faultRoot != null) {
while (faultRoot.getCause() != null) {
faultRoot = faultRoot.getCause();
}
}
if (faultRoot != null) {
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_ROOT_ICEBERG, faultRoot.getClass().getName());
}
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_TOP_ICEBERG, fault.getClass().getName());
manifest.withAttribute(ZilLaLaManyfestoHeader.MAIN_FAULT_TOP_MESSAGE, message!=null?message:SITRA_VALUE_NULL);
for (Class<?> traceKey : fault.getTraceSignals()) {
Optional<Map<String, String>> signalsOpt = fault.getTraceSignalContext(traceKey);
if (signalsOpt.isEmpty()) {
continue;
}
Map<String, String> signals = signalsOpt.get();
WarpManifest3Section section = manifest.makeSection(traceKey.getName());
if (SitraManifestSectionWhitePaper.class.equals(traceKey)) {
section.withAttribute(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, ZilLaLaManyfestoSectionGoal.PAPER.toString());
} else {
if (signals.containsKey(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_CHAIN_MESSAGE)) {
section.withAttribute(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, ZilLaLaManyfestoSectionGoal.ROCK.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.ROCK_SUMMIT));
} else {
section.withAttribute(ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_GOAL, ZilLaLaManyfestoSectionGoal.ROCK.spaceCadet(ZilLaLaManyfestoSectionChampionsLeague.ROCK_CLIMB));
}
}
for (String signalKey : signals.keySet()) {
String signalValue = signals.get(signalKey);
String attributeBody = signalValue==null?SITRA_VALUE_NULL:escapeSignalValue(signalValue);
section.withAttribute(escapeHeaderName(signalKey), attributeBody);
};
}
for (SitraManifestReportProvider report : SitraManifestReportFactory..deliverSPIReports()) {
List<Class<? extends BassFaultAnchor>> matchers = report.matchFaults();
if (!matchers.isEmpty()) {
boolean matchOne = false;
for (Class<? extends BassFaultAnchor> match : matchers) {
if (match.isAssignableFrom(fault.getClass())) {
matchOne = true;
break;
}
}
if (!matchOne) {
continue;
}
}
Map<String, String> signals = new LinkedHashMap<>();
report.fillReport(fault, signals);
WarpManifest3Section section = manifest.makeSection(report.getClass().getName());
for (String signalKey : signals.keySet()) {
String signalValue = signals.get(signalKey);
String attributeBody = signalValue==null?SITRA_VALUE_NULL:escapeSignalValue(signalValue);
section.withAttribute(escapeHeaderName(signalKey), attributeBody);
};
}
return manifest;
}
private String escapeHeaderName(String headerName) {
if (ScopicManifestConstants.ATTR_SIMSALABIM_SECTION.equalsIgnoreCase(headerName)) {
return ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_NAME;
}
if (ScopicManifestConstants.ATTR_SIMSALABIM_REMARK.equalsIgnoreCase(headerName)) {
return ZilLaLaManyfestoHeader.SIGNAL_FAULT_SECTION_FROM;
}
return headerName;
}
private String escapeSignalValue(String line) {
return line.replaceAll("\n", "\\\\n "); // TODO: check if added markdown space is correct here...
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.fault.sitra;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ServiceLoader;
/// Holds all the manifest reports found in the class path.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum SitraManifestReportFactory {
;
private final List<SitraManifestReportProvider> reports;
private SitraManifestReportFactory() {
List<SitraManifestReportProvider> reportList = new ArrayList<>();
ServiceLoader<SitraManifestReportProvider> loader = ServiceLoader.load(SitraManifestReportProvider.class);
for (SitraManifestReportProvider reportSPI : loader) {
reportList.add(reportSPI);
}
reports = Collections.unmodifiableList(reportList);
}
protected List<SitraManifestReportProvider> deliverSPIReports() {
return reports;
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.fault.sitra;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
/// Fills an manifest report section.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface SitraManifestReportProvider {
default List<Class<? extends BassFaultAnchor>> matchFaults() {
return Collections.emptyList();
}
default void fillReport(BassFaultAnchor fault, Map<String, String> tracer) {
fillReport(tracer);
}
default void fillReport(Map<String, String> tracer) {
}
}

View file

@ -0,0 +1,37 @@
/*
* 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.fault.sitra;
/// Internal marker to point to the white paper signal.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum SitraManifestSectionWhitePaper {
;
// An empty enum type is a static jvm safe locked pointer to somewhere.
}

View file

@ -0,0 +1,76 @@
/*
* 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.fault.sitra;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.UUID;
/// Builds the application id UUID provider.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum SitraManifestUUIDAppIdFactory {
;
private final SitraManifestUUIDAppIdProvider provider;
private SitraManifestUUIDAppIdFactory() {
ServiceLoader<SitraManifestUUIDAppIdProvider> loader = ServiceLoader.load(SitraManifestUUIDAppIdProvider.class);
Optional<SitraManifestUUIDAppIdProvider> providerSPI = loader.findFirst();
if (providerSPI.isPresent()) {
provider = providerSPI.get();
} else {
provider = buildDefaultSPIUUIDAId();
}
}
protected SitraManifestUUIDAppIdProvider deliverSPIUUIDAId() {
return provider;
}
private SitraManifestUUIDAppIdProvider buildDefaultSPIUUIDAId() {
return new SitraManifestUUIDAppIdProvider() {
@Override
public UUID applicationUUID() {
String appId = System.getProperty("Application.id"); // bsaf
if (appId == null) {
appId = System.getProperty("spring.application.name"); // spring
}
if (appId == null) {
appId = System.getProperty("logger.app.name"); // log4j
}
if (appId == null) {
appId = System.getProperty("user.name"); // fall back to user name
}
return UUID.nameUUIDFromBytes(appId.getBytes(StandardCharsets.UTF_8));
}
};
}
}

View file

@ -0,0 +1,39 @@
/*
* 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.fault.sitra;
import java.util.UUID;
/// SPI for providing an application id HMAC UUID.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface SitraManifestUUIDAppIdProvider {
UUID applicationUUID();
}

View file

@ -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.fault.sitra;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import java.util.UUID;
/// Burns the sitra manifest UUID water marks.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum SitraManifestUUIDCrematorium {
;
private final UUID uuidJvmInstance;
private final UUID uuidJvmClassPath;
private SitraManifestUUIDCrematorium() {
uuidJvmInstance = new UUID(generateMostSigBits(), generateLeastSigBits());
uuidJvmClassPath = UUID.nameUUIDFromBytes(generateClassPathBytes());
}
/// Water mark smurf one, runtime instance identifier UUID.
///
/// @return An UUID.
public UUID burnWaterMarkOne() {
return uuidJvmInstance;
}
/// Water mark smurf two, application identifier UUID HMAC via SPI.
///
/// @return An UUID.
public UUID burnWaterMarkTwo() {
return SitraManifestUUIDAppIdFactory..deliverSPIUUIDAId().applicationUUID();
}
/// Water mark smurf three, application version by class path UUID.
///
/// @return An UUID.
public UUID burnWaterMarkThree() {
return uuidJvmClassPath;
}
/// Water mark smurf four, application fault sequence UUID.
///
/// @return An UUID.
public UUID burnWaterMarkFour() {
return UUID.randomUUID();
}
private static byte[] generateClassPathBytes() {
return System.getProperty("java.class.path").getBytes(StandardCharsets.UTF_8);
}
private static long generateMostSigBits() {
Random random = new Random();
return random.nextLong() & 0x3FFFFFFFFFFFFFFFL | 0x8000000000000000L;
}
private static long generateLeastSigBits() {
final long epoch = System.currentTimeMillis();
final long timeMinute = (epoch & 0x0000_0000_FFFF_FFFFL) << 32;
final long timeHour = ((epoch >> 32) & 0xFFFF) << 16;
final long timeSplit = 1 << 12;
final long timeDay = ((epoch >> 48) & 0x0FFF);
return timeMinute | timeHour | timeSplit | timeDay;
}
}

View file

@ -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.fault.sitra;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheMimeType;
/// ZilLaLa manyfesto protocol constants to build or parse the manifest data uri.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum ZilLaLaManyfesto {
;
public static final String MANYFESTO_VERSION = "1.0";
public static final String MANYFESTO_A4_JAVA = "java";
public static final String MANYFESTO_A4_ERLANG = "erlang";
public static final String ZILLALA_URI_PREFIX_DATA64 = "data:" + WarpManifestTheMimeType.MANIFEST_3.getQName() + ";base64,";
public static final String ZILLALA_URI_PREFIX_DATA64_GZ = "data:" + WarpManifestTheMimeType.MANIFEST_3_GZ.getQName() + ";base64,";
public static final String ZILLALA_URI_PREFIX_NOSTR_TLV_GZ = "nostr:zillala"; // TODO: nostr link to replay to inject bug + TLV for gz sitra manifest payload
}

View file

@ -0,0 +1,81 @@
/*
* 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.fault.sitra;
import java.util.Base64;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
/// ZilLaLa manyfesto protocol constants to build or parse the manifest data uri.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum ZilLaLaManyfestoGrowlFactory {
;
/// A unicode character to indicate a separation event to a next key word.
private static final String VALUE_WHITE_SPACE = " ";
/// Multiple characters seen as a slug to indicate that words are eaten.
private static final String VALUE_CUTOFF = "...";
public String buildFaultScream(WarpManifest3 manifest, BassFaultAnchor fault) {
boolean useGzip = true;
byte[] traceManifestBytes = WarpManifestorDriver..writeV3Array(manifest, useGzip);
String trace64 = Base64.getEncoder().encodeToString(traceManifestBytes);
StringBuilder buf = new StringBuilder();
buf.append(fault.getClass().getSimpleName());
String messageShort = buildCutDottedMessage(fault);
if (messageShort != null) {
buf.append("(");
buf.append(messageShort);
buf.append(")");
}
// TODO: Move base data uri + nostr data uri to provider interface
buf.append(VALUE_WHITE_SPACE);
if (useGzip) {
buf.append(ZilLaLaManyfesto.ZILLALA_URI_PREFIX_DATA64_GZ);
} else {
buf.append(ZilLaLaManyfesto.ZILLALA_URI_PREFIX_DATA64);
}
buf.append(trace64);
buf.append("\n");
buf.append(WarpManifestorDriver..writeV2String(manifest));
return buf.toString();
}
private String buildCutDottedMessage(BassFaultAnchor fault) {
String msgShort = fault.getLocalizedMessage();
if (msgShort != null && msgShort.length() > 33) {
msgShort = msgShort.substring(0, 33) + VALUE_CUTOFF;
}
return msgShort;
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.fault.sitra;
/// Header constants to build or parse the ZilLaLa manyfesto.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum ZilLaLaManyfestoHeader {
;
public static final String MAIN_FAULT_MANYFESTO_VCROSS = "Fault-Manyfesto-VX";
public static final String MAIN_FAULT_MANYFESTO_AFOUR = "Fault-Manyfesto-A4"; // In the nether we don't use letter's
public static final String MAIN_FAULT_UUID_WM_ONE = "Fault-UUID-WM1"; // jvm instance water mark
public static final String MAIN_FAULT_UUID_WM_TWO = "Fault-UUID-WM2"; // auto optional appId HMAC via SPI
public static final String MAIN_FAULT_UUID_WM_THREE = "Fault-UUID-WM3"; // class path (version)
public static final String MAIN_FAULT_UUID_WM_FOUR = "Fault-UUID-WM4"; // fault sequence
public static final String MAIN_FAULT_UUID_DATE = "Fault-UUID-Date";
public static final String MAIN_FAULT_ROOT_ICEBERG = "Fault-Root-Iceberg";
public static final String MAIN_FAULT_TOP_ICEBERG = "Fault-Top-Iceberg";
public static final String MAIN_FAULT_TOP_MESSAGE = "Fault-Top-Message";
public static final String SIGNAL_FAULT_SECTION_GOAL = "Fault-Section-Goal";
public static final String SIGNAL_FAULT_SECTION_CHAIN_MESSAGE = "Fault-Section-Chain-Message";
public static final String SIGNAL_FAULT_SECTION_CHAIN_ICEBERG = "Fault-Section-Chain-Iceberg";
public static final String SIGNAL_FAULT_SECTION_NAME = "Fault-Section-Name"; // does auto rename "name|NAME" to this
public static final String SIGNAL_FAULT_SECTION_FROM = "Fault-Section-From"; // does auto rename "from|FROM" to this
/// StackTraceElement
public static final String PREFIX_SECTION_LADDER = "Ladder-X_";
/// Throwable
public static final String PREFIX_SECTION_LADDER_FAULT = "Ladder-Fault-X_";
/// Suppressed throwable
public static final String PREFIX_SECTION_LADDER_FAULT_SHADOW = "Ladder-Fault-Shadow-X_";
}

View file

@ -0,0 +1,48 @@
/*
* 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.fault.sitra;
/// Champions League campaign to unite the different sections goal arguments.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum ZilLaLaManyfestoSectionChampionsLeague {
;
public static final String ROCK_CLIMB = "climb";
public static final String ROCK_SUMMIT = "summit";
public static final String PAPER_NOTE = "markdown";
public static final String SCISSORS_JAVA2 = "java2";
public static final String SCISSORS_JAVA3 = "java3";
public static final String BUBBLES_OPERATING_SYSTEM = "os";
public static final String BUBBLES_RUMTIME = "runtime";
public static final String BIMBAMBO_MAVEN = "maven";
}

View file

@ -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.fault.sitra;
import java.util.LinkedHashSet;
import java.util.Set;
/// Predefined goals to the section headers to indicate purpose for UI grouping.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum ZilLaLaManyfestoSectionGoal {
;
/// A chain entry of one rock in the iceberg of errors.
public static final ZilLaLaManyfestoSectionGoalScore ROCK = .cornerKick("ROCK");
/// A white paper to write to, as last resort to report.
public static final ZilLaLaManyfestoSectionGoalScore PAPER = .cornerKick("PAPER");
/// The stack cut in small trace pieces.
public static final ZilLaLaManyfestoSectionGoalScore SCISSORS = .cornerKick("SCISSORS");
/// The threads of the process soft as butter.
public static final ZilLaLaManyfestoSectionGoalScore BUTTER = .cornerKick("BUTTER");
/// The amounts of bubble memory brain space like information.
public static final ZilLaLaManyfestoSectionGoalScore BUBBLES = .cornerKick("BUBBLES");
/// BimBamBo clock version artifact goal score meta flag.
public static final ZilLaLaManyfestoSectionGoalScore BIMBAMBO = .cornerKick("BIMBAMBO");
private final Set<ZilLaLaManyfestoSectionGoalScore> scoreEnum = new LinkedHashSet<>();
private ZilLaLaManyfestoSectionGoalScore cornerKick(String scoreType) {
ZilLaLaManyfestoSectionGoalScore cornerKick = ZilLaLaManyfestoSectionGoalScore.valueOf(scoreType);
scoreEnum.add(cornerKick);
return cornerKick;
}
public Set<String> virtualValues() {
return new LinkedHashSet<String>(scoreEnum.stream().map(v -> v.toString()).toList());
}
}

View file

@ -0,0 +1,54 @@
/*
* 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.fault.sitra;
/// Goal score type for a virtual enumeration counter.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface ZilLaLaManyfestoSectionGoalScore {
enum Constantinople {
;
private static final String UNICODE_UTF16_LATIN1_WHITE_SPACE_STRINGS = " ";
private static final String ARE_FOUR = "";
}
default String spaceCadet(String pussies) {
return toString().concat(Constantinople.UNICODE_UTF16_LATIN1_WHITE_SPACE_STRINGS).concat(Constantinople.ARE_FOUR).concat(pussies);
}
public static ZilLaLaManyfestoSectionGoalScore valueOf(final String scoreType) {
return new ZilLaLaManyfestoSectionGoalScore() {
@Override
public String toString() {
return scoreType;
}
};
}
}

View file

@ -0,0 +1 @@
love.distributedrebirth.nx01.warp.fault.duck.QuackJavaScriptDuckTales

View file

@ -0,0 +1,127 @@
/*
* 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.fault;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import love.distributedrebirth.nx01.warp.fault.BassFaultAnchor;
import love.distributedrebirth.nx01.warp.fault.FaultBeanInstantiation;
import love.distributedrebirth.nx01.warp.fault.FaultBeanState;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class FaultSignalTraceTest {
static class SpaceA {
static void traceRoot() {
throw new FaultBeanInstantiation("The signal trace root", SpaceA.class);
}
}
static class SpaceB {
static void traceRootAccess() {
try {
SpaceA.traceRoot();
} catch (FaultBeanInstantiation e) {
throw e.withSignalTrace(SpaceB.class, "Name", "FoodSection").withSignalTrace(SpaceB.class, "From", "FoodEmail");
}
}
}
static class SpaceC {
static void traceRootCatchBass() {
try {
SpaceB.traceRootAccess();
} catch (BassFaultAnchor e) {
throw e.withSignalTrace(SpaceC.class, v -> {
v.put("Junit-Foo", "Bar");
v.put("Junit-仙上主天", "仙上主天");
}).appendOnWhitePaper("Paper-SpaceC", "rock");
}
}
}
static class SpaceD {
static void traceWrapClassic() {
try {
SpaceC.traceRootCatchBass();
} catch (Exception e) {
throw new IllegalArgumentException("Classic argument missing wrapper", e);
}
}
}
static class SpaceE {
static void traceWrap() {
try {
SpaceD.traceWrapClassic();
} catch (Exception e) {
throw new FaultBeanState(e, SpaceD.class).appendOnWhitePaper("Paper-SpaceE", "sissors");
}
}
}
@Test
public void testFaultString() {
FaultBeanState error = null;
try {
SpaceE.traceWrap();
} catch (FaultBeanState e) {
error = e;
}
Assertions.assertNotNull(error);
Assertions.assertNotNull(error.getMessage());
String errorText = error.toStringZilLaLa();
//System.out.println(errorText);
//System.out.println(errorText.length()); // 3185, 3433
Assertions.assertNotNull(errorText);
Assertions.assertTrue(errorText.contains(error.getMessage()));
Assertions.assertTrue(errorText.contains("FaultBeanState"));
Assertions.assertTrue(errorText.contains("base64"));
}
@Test
public void testFaultStringSitra() {
BassFaultAnchor error = null;
try {
SpaceE.traceWrap();
} catch (BassFaultAnchor e) {
error = e;
}
Assertions.assertNotNull(error);
Assertions.assertNotNull(error.getMessage());
WarpManifest3 manifest = error.toZilLaLaManyfesto();
String sitraText = WarpManifestorDriver..writeV2String(manifest);
//System.out.println(sitraText);
Assertions.assertNotNull(sitraText);
Assertions.assertTrue(sitraText.contains("Manifest"));
Assertions.assertTrue(sitraText.contains("SpaceB"));
Assertions.assertTrue(sitraText.contains("FoodSection"));
Assertions.assertTrue(sitraText.contains("SpaceC"));
Assertions.assertTrue(sitraText.contains("Junit-Foo: Bar"));
}
}

View file

@ -0,0 +1,6 @@
love.distributedrebirth.nx01.warp.fault.report.ReportSitraFaultStackTraceJava3
love.distributedrebirth.nx01.warp.fault.report.ReportSitraFaultWarpVersion
love.distributedrebirth.nx01.warp.fault.report.ReportSitraRuntimeChapter
love.distributedrebirth.nx01.warp.fault.report.ReportSitraRuntimeThreads
love.distributedrebirth.nx01.warp.fault.report.ReportSitraSystemChapter
love.distributedrebirth.nx01.warp.fault.report.ReportSitraSystemLocale

View file

@ -0,0 +1,21 @@
<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>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,350 @@
/*
* 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 java.util.Objects;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.x4o.xml.o4o.io.tlv.TLVChainOctalSex;
import org.x4o.xml.o4o.io.tlv.TLVChainSexTeenBit;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest2;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest2HeaderField;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest2Section;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheMimeType;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
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;
/// Warp Manifestor Driver.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum WarpManifestorDriver {
;
public WarpManifest3 readV1String(String input) {
return readV1Array(input.getBytes(StandardCharsets.UTF_8));
}
public WarpManifest3 readV1Buffer(ByteBuffer input) {
return readV1Array(input.array());
}
public WarpManifest3 readV1Array(byte[] input) {
return readV1Stream(new ByteArrayInputStream(input));
}
public WarpManifest3 readV1Stream(InputStream input) {
WarpManifest3 result = new WarpManifest3();
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestTheVersion.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;
}
public WarpManifest3 readV2String(String input) {
return readV2Array(input.getBytes(StandardCharsets.UTF_8));
}
public WarpManifest3 readV2Buffer(ByteBuffer input) {
return readV2Array(input.array());
}
public WarpManifest3 readV2Array(byte[] input) {
return readV2Stream(new ByteArrayInputStream(input));
}
public WarpManifest3 readV2Stream(InputStream input) {
WarpManifest3 result = new WarpManifest3();
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestTheVersion.VERSION_1_0, WarpManifestTheVersion.VERSION_2_0);
ScopicManifestContentReader reader = new ScopicManifestContentReader(handler);
try {
reader.parse(input);
} catch (IOException e) {
throw new ScopicManifestException(e);
}
return result;
}
public WarpManifest3 readV3Buffer(ByteBuffer input) {
return readV3Array(input.array());
}
public WarpManifest3 readV3Array(byte[] input) {
return readV3Stream(new ByteArrayInputStream(input));
}
public WarpManifest3 readV3Stream(InputStream input) {
WarpManifest3 result = new WarpManifest3();
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result, WarpManifestTheVersion.VERSION_3_0);
ScopicManifest3ContentReader reader = new ScopicManifest3ContentReader(handler);
TLVChainSexTeenBit chain = new TLVChainSexTeenBit();
try {
WarpManifestTheMimeType mimeType = WarpManifestTheMimeType.magicMarkerRead(input, WarpManifestTheMimeType.MARKER_3_LENGTH);
if (!mimeType.isCompressed()) {
chain.dataReadStream(input);
} else {
chain.dataReadStream(new GZIPInputStream(input));
}
} catch (IOException e) {
throw new ScopicManifestException(e);
}
reader.parse(chain);
return result;
}
public WarpManifest4 readV4Buffer(ByteBuffer input) {
return readV4Array(input.array());
}
public WarpManifest4 readV4Array(byte[] input) {
return readV4Stream(new ByteArrayInputStream(input));
}
public WarpManifest4 readV4Stream(InputStream input) {
WarpManifest4 result = new WarpManifest4();
ScopicManifest4ContentHandler handler = new ScopicManifest4ContentHandler(result);
ScopicManifest4ContentReader reader = new ScopicManifest4ContentReader(handler);
TLVChainOctalSex chain = new TLVChainOctalSex();
try {
WarpManifestTheMimeType mimeType = WarpManifestTheMimeType.magicMarkerRead(input, WarpManifestTheMimeType.MARKER_4_LENGTH);
if (!mimeType.isCompressed()) {
chain.dataReadStream(input);
} else {
chain.dataReadStream(new GZIPInputStream(input));
}
} catch (IOException e) {
throw new ScopicManifestException(e);
}
reader.parse(chain);
return result;
}
public WarpManifest3 readViniString(String input) {
return readViniArray(input.getBytes(StandardCharsets.UTF_8));
}
public WarpManifest3 readViniBuffer(ByteBuffer input) {
return readViniArray(input.array());
}
public WarpManifest3 readViniArray(byte[] input) {
return readViniStream(new ByteArrayInputStream(input));
}
public WarpManifest3 readViniStream(InputStream input) {
WarpManifest3 result = new WarpManifest3();
ScopicManifestContentStringHandler handler = new ScopicManifestContentStringHandler(result);
ScopicIniContentReader reader = new ScopicIniContentReader(handler);
try {
reader.parse(input);
} catch (IOException e) {
throw new ScopicManifestException(e);
}
return result;
}
// An "geniface" for complex generics would be nice, note all this generics is only to add 2 default methods in a interface...
private <T, M extends WarpManifest2<T, M, H, S>, H extends WarpManifest2HeaderField<T, H>, S extends WarpManifest2Section<T, H, S>> void strobelight(WarpManifest2<T, M, H, S> manifest, ScopicManifestContent<T> writer, T version) {
writer.strobeManifestStart();
writer.strobeManifestDeclaration(Objects.requireNonNull(version, "Can't print null version"));
for (WarpManifest2HeaderField<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 (WarpManifest2Section<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 (WarpManifest2HeaderField<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();
}
public String writeV1String(WarpManifest3 manifest) {
StringWriter writer = new StringWriter();
writeV1StreamChar(manifest, writer);
return writer.toString();
}
public void writeV1Stream(WarpManifest3 manifest, OutputStream output) {
writeV1StreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
}
public void writeV1StreamChar(WarpManifest3 manifest, Writer output) {
strobelight(manifest, new ScopicManifestContentWriter(output), WarpManifestTheVersion.VERSION_1_0.getQName());
}
public String writeV2String(WarpManifest3 manifest) {
StringWriter writer = new StringWriter();
writeV2StreamChar(manifest, writer);
return writer.toString();
}
public void writeV2Stream(WarpManifest3 manifest, OutputStream output) {
writeV2StreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
}
public void writeV2StreamChar(WarpManifest3 manifest, Writer output) {
strobelight(manifest, new ScopicManifestContentWriter(output), WarpManifestTheVersion.VERSION_2_0.getQName());
}
public ByteBuffer writeV3Buffer(WarpManifest3 manifest) {
return writeV3Buffer(manifest, false);
}
public ByteBuffer writeV3Buffer(WarpManifest3 manifest, boolean useGzip) {
return ByteBuffer.wrap(writeV3Array(manifest, useGzip));
}
public byte[] writeV3Array(WarpManifest3 manifest) {
return writeV3Array(manifest, false);
}
public byte[] writeV3Array(WarpManifest3 manifest, boolean useGzip) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeV3Stream(manifest, baos, useGzip);
return baos.toByteArray();
}
public void writeV3Stream(WarpManifest3 manifest, OutputStream output) {
writeV3Stream(manifest, output, false);
}
public void writeV3Stream(WarpManifest3 manifest, OutputStream output, boolean useGzip) {
TLVChainSexTeenBit chain = new TLVChainSexTeenBit();
strobelight(manifest, new ScopicManifest3ContentWriter(chain), WarpManifestTheVersion.VERSION_3_0.getQName());
try {
if (!useGzip) {
WarpManifestTheMimeType.magicMarkerWrite(output, WarpManifestTheMimeType.MANIFEST_3);
chain.dataWriteStream(output);
} else {
WarpManifestTheMimeType.magicMarkerWrite(output, WarpManifestTheMimeType.MANIFEST_3_GZ);
GZIPOutputStream zipput = new GZIPOutputStream(output);
chain.dataWriteStream(zipput);
zipput.finish();
}
} catch (IOException e) {
throw new ScopicManifestException(e);
}
}
public ByteBuffer writeV4Buffer(WarpManifest4 manifest) {
return writeV4Buffer(manifest, false);
}
public ByteBuffer writeV4Buffer(WarpManifest4 manifest, boolean useGzip) {
return ByteBuffer.wrap(writeV4Array(manifest, useGzip));
}
public byte[] writeV4Array(WarpManifest4 manifest) {
return writeV4Array(manifest, false);
}
public byte[] writeV4Array(WarpManifest4 manifest, boolean useGzip) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeV4Stream(manifest, baos, useGzip);
return baos.toByteArray();
}
public void writeV4Stream(WarpManifest4 manifest, OutputStream output) {
writeV4Stream(manifest, output, false);
}
public void writeV4Stream(WarpManifest4 manifest, OutputStream output, boolean useGzip) {
TLVChainOctalSex chain = new TLVChainOctalSex();
strobelight(manifest, new ScopicManifest4ContentWriter(chain), WarpManifestTheVersion.VERSION_4_0);
try {
if (!useGzip) {
WarpManifestTheMimeType.magicMarkerWrite(output, WarpManifestTheMimeType.MANIFEST_4);
chain.dataWriteStream(output);
} else {
WarpManifestTheMimeType.magicMarkerWrite(output, WarpManifestTheMimeType.MANIFEST_4_GZ);
GZIPOutputStream zipput = new GZIPOutputStream(output);
chain.dataWriteStream(zipput);
zipput.finish();
}
} catch (IOException e) {
throw new ScopicManifestException(e);
}
}
public String writeViniString(WarpManifest3 manifest) {
StringWriter writer = new StringWriter();
writeViniStreamChar(manifest, writer);
return writer.toString();
}
public void writeViniStream(WarpManifest3 manifest, OutputStream output) {
writeViniStreamChar(manifest, new OutputStreamWriter(output, StandardCharsets.UTF_8));
}
public void writeViniStreamChar(WarpManifest3 manifest, Writer output) {
strobelight(manifest, new ScopicIniContentWriter(output), ScopicIniConstants.VERSION_NEW_TESTAMENT);
}
}

View file

@ -0,0 +1,131 @@
/*
* 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 manifest2 model.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface WarpManifest2<T, M extends WarpManifest2<T, M, H, S>, H extends WarpManifest2HeaderField<T, H>, S extends WarpManifest2Section<T, H, S>> {
List<H> getAttributes();
H makeAttribute(T name, T body);
WarpManifest2<T, M, H, S> withAttribute(T name, T body);
WarpManifest2<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());
}
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 getSectionAttributeBodyPrivate(T sectionName, T attributeName) {
return getSectionAttributeBodyPrivate(sectionName, attributeName, null);
}
default T getSectionAttributeBodyPrivate(T sectionName, T attributeName, T defaultValue) {
Optional<T> value = getSectionAttributeBody(sectionName, attributeName);
if (value.isEmpty()) {
return defaultValue;
} else {
return value.get();
}
}
}

View file

@ -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 manifest2 name value pair entry.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface WarpManifest2HeaderField<T, H extends WarpManifest2HeaderField<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);
}

View file

@ -0,0 +1,85 @@
/*
* 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 manifest2 section.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public interface WarpManifest2Section<T, H extends WarpManifest2HeaderField<T, H>, S extends WarpManifest2Section<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());
}
List<T> getRemarks();
S withRemark(T remark);
S withRemarks(List<T> remarks);
}

View file

@ -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 manifest3 model.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest3 implements WarpManifest2<String, WarpManifest3, WarpManifest3HeaderField, WarpManifest3Section> {
private final List<WarpManifest3HeaderField> attributes;
private final List<WarpManifest3Section> sections;
public WarpManifest3() {
this.attributes = new ArrayList<>();
this.sections = new ArrayList<>();
}
@Override
public List<WarpManifest3HeaderField> getAttributes() {
return this.attributes;
}
@Override
public WarpManifest3HeaderField makeAttribute(String name, String body) {
WarpManifest3HeaderField result = new WarpManifest3HeaderField(name, body);
this.attributes.add(result);
return result;
}
@Override
public WarpManifest3 withAttribute(String name, String body) {
makeAttribute(name, body);
return this;
}
@Override
public WarpManifest3 withAttributes(List<WarpManifest3HeaderField> attributes) {
this.attributes.addAll(attributes);
return this;
}
@Override
public List<WarpManifest3Section> getSections() {
return this.sections;
}
@Override
public WarpManifest3Section makeSection(String sectionName) {
WarpManifest3Section result = new WarpManifest3Section(sectionName);
this.sections.add(result);
return result;
}
@Override
public WarpManifest3 withSections(List<WarpManifest3Section> sections) {
this.sections.addAll(sections);
return this;
}
}

View file

@ -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 manifest3 name value pair entry.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest3HeaderField implements WarpManifest2HeaderField<String, WarpManifest3HeaderField> {
private String name;
private String body;
private final List<String> remarks;
public WarpManifest3HeaderField() {
this.remarks = new ArrayList<>();
}
public WarpManifest3HeaderField(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 WarpManifest3HeaderField withRemark(String remark) {
this.remarks.add(remark);
return this;
}
@Override
public WarpManifest3HeaderField withRemarks(List<String> remarks) {
this.remarks.addAll(remarks);
return this;
}
}

View file

@ -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 manifest3 section.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest3Section implements WarpManifest2Section<String, WarpManifest3HeaderField, WarpManifest3Section> {
private String name;
private final List<WarpManifest3HeaderField> attributes;
private final List<String> remarks;
public WarpManifest3Section() {
this.attributes = new ArrayList<>();
this.remarks = new ArrayList<>();
}
public WarpManifest3Section(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<WarpManifest3HeaderField> getAttributes() {
return attributes;
}
@Override
public WarpManifest3HeaderField makeAttribute(String name, String body) {
WarpManifest3HeaderField result = new WarpManifest3HeaderField(name, body);
this.attributes.add(result);
return result;
}
@Override
public WarpManifest3Section withAttribute(String name, String body) {
WarpManifest3HeaderField result = new WarpManifest3HeaderField(name, body);
this.attributes.add(result);
return this;
}
@Override
public WarpManifest3Section withAttributes(List<WarpManifest3HeaderField> attributes) {
this.attributes.addAll(attributes);
return this;
}
@Override
public List<String> getRemarks() {
return this.remarks;
}
@Override
public WarpManifest3Section withRemark(String remark) {
this.remarks.add(remark);
return this;
}
@Override
public WarpManifest3Section withRemarks(List<String> remarks) {
this.remarks.addAll(remarks);
return this;
}
}

View file

@ -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.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
/// Warp manifest4 model.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest4 implements WarpManifest2<PrimordialOctalOrangeJuiceAtoms, WarpManifest4, WarpManifest4HeaderField, WarpManifest4Section> {
private final List<WarpManifest4HeaderField> attributes;
private final List<WarpManifest4Section> sections;
public WarpManifest4() {
this.attributes = new ArrayList<>();
this.sections = new ArrayList<>();
}
@Override
public List<WarpManifest4HeaderField> getAttributes() {
return attributes;
}
@Override
public WarpManifest4HeaderField makeAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
WarpManifest4HeaderField result = new WarpManifest4HeaderField(name, body);
this.attributes.add(result);
return result;
}
@Override
public WarpManifest4 withAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
makeAttribute(name, body);
return this;
}
@Override
public WarpManifest4 withAttributes(List<WarpManifest4HeaderField> attributes) {
this.attributes.addAll(attributes);
return this;
}
@Override
public List<WarpManifest4Section> getSections() {
return this.sections;
}
@Override
public WarpManifest4Section makeSection(PrimordialOctalOrangeJuiceAtoms sectionName) {
WarpManifest4Section result = new WarpManifest4Section(sectionName);
this.sections.add(result);
return result;
}
@Override
public WarpManifest4 withSections(List<WarpManifest4Section> sections) {
this.sections.addAll(sections);
return this;
}
}

View file

@ -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.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
/// Warp manifest4 name value pair entry.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest4HeaderField implements WarpManifest2HeaderField<PrimordialOctalOrangeJuiceAtoms, WarpManifest4HeaderField> {
private PrimordialOctalOrangeJuiceAtoms name;
private PrimordialOctalOrangeJuiceAtoms body;
private final List<PrimordialOctalOrangeJuiceAtoms> remarks;
public WarpManifest4HeaderField() {
this.remarks = new ArrayList<>();
}
public WarpManifest4HeaderField(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
this();
this.name = name;
this.body = body;
}
@Override
public PrimordialOctalOrangeJuiceAtoms getName() {
return this.name;
}
@Override
public void setName(PrimordialOctalOrangeJuiceAtoms name) {
this.name = name;
}
@Override
public PrimordialOctalOrangeJuiceAtoms getBody() {
return this.body;
}
@Override
public void setBody(PrimordialOctalOrangeJuiceAtoms body) {
this.body = body;
}
@Override
public List<PrimordialOctalOrangeJuiceAtoms> getRemarks() {
return this.remarks;
}
@Override
public WarpManifest4HeaderField withRemark(PrimordialOctalOrangeJuiceAtoms remark) {
this.remarks.add(remark);
return this;
}
@Override
public WarpManifest4HeaderField withRemarks(List<PrimordialOctalOrangeJuiceAtoms> remarks) {
this.remarks.addAll(remarks);
return this;
}
}

View file

@ -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.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
/// Warp manifest4 section.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public final class WarpManifest4Section implements WarpManifest2Section<PrimordialOctalOrangeJuiceAtoms, WarpManifest4HeaderField, WarpManifest4Section> {
private PrimordialOctalOrangeJuiceAtoms name;
private final List<WarpManifest4HeaderField> attributes;
private final List<PrimordialOctalOrangeJuiceAtoms> remarks;
public WarpManifest4Section() {
this.attributes = new ArrayList<>();
this.remarks = new ArrayList<>();
}
public WarpManifest4Section(PrimordialOctalOrangeJuiceAtoms name) {
this();
this.name = name;
}
@Override
public PrimordialOctalOrangeJuiceAtoms getName() {
return name;
}
@Override
public void setName(PrimordialOctalOrangeJuiceAtoms name) {
this.name = name;
}
@Override
public List<WarpManifest4HeaderField> getAttributes() {
return attributes;
}
@Override
public WarpManifest4HeaderField makeAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
WarpManifest4HeaderField result = new WarpManifest4HeaderField(name, body);
attributes.add(result);
return result;
}
@Override
public WarpManifest4Section withAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
WarpManifest4HeaderField result = new WarpManifest4HeaderField(name, body);
attributes.add(result);
return this;
}
@Override
public WarpManifest4Section withAttributes(List<WarpManifest4HeaderField> attributes) {
this.attributes.addAll(attributes);
return this;
}
@Override
public List<PrimordialOctalOrangeJuiceAtoms> getRemarks() {
return this.remarks;
}
@Override
public WarpManifest4Section withRemark(PrimordialOctalOrangeJuiceAtoms remark) {
this.remarks.add(remark);
return this;
}
@Override
public WarpManifest4Section withRemarks(List<PrimordialOctalOrangeJuiceAtoms> remarks) {
this.remarks.addAll(remarks);
return this;
}
}

View file

@ -0,0 +1,122 @@
/*
* 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 love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// Warp manifest schema of the mime types and magic markers.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum WarpManifestTheMimeType {
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_3_GZ ("application/manifest3-gz", "MF3Z", new byte[] {0x4d,0x53,0x58,0x33,0x4d,0x46,0x5a,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_4_GZ ("application/manifest4-gz", "MF4Z", new byte[] {0x4d,0x53,0x58,0x34,0x4d,0x53,0x58,0x34,0x2d,0x2d,0x4d,0x46,0x5a,0x38,0x4d,0x46,0x5a,0x38}),
;
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 WarpManifestTheMimeType(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;
}
public boolean isCompressed() {
return this == MANIFEST_3_GZ || this == MANIFEST_4_GZ;
}
static public Optional<WarpManifestTheMimeType> valueOfQName(String qName) {
for (WarpManifestTheMimeType mimeType : WarpManifestTheMimeType.values()) {
if (mimeType.getQName().equals(qName)) {
return Optional.of(mimeType);
}
}
return Optional.empty();
}
static public WarpManifestTheMimeType 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 (WarpManifestTheMimeType mimeType : WarpManifestTheMimeType.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, WarpManifestTheMimeType marker) throws IOException {
if (marker.getQMagicMarker() == null) {
return;
}
output.write(marker.getQMagicMarker());
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeString;
/// Warp manifest schema of the version.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public enum WarpManifestTheVersion {
/// Format: teapot-ascii
VERSION_1_0("1.0"),
/// Format: escaped-unicode
VERSION_2_0("2.0"),
/// Format: binary-unicode
VERSION_3_0("3.0"),
;
/// Format: binary-hinari (18 bit or 6 octals)
public static final PrimordialOctalOrangeJuiceAtoms VERSION_4_0 = PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(4, 0));
private final String qName;
private WarpManifestTheVersion(String qName) {
this.qName = qName;
}
public String getQName() {
return qName;
}
public static Optional<WarpManifestTheVersion> valueOfQName(String qName) {
for (WarpManifestTheVersion version : WarpManifestTheVersion.values()) {
if (version.getQName().equals(qName)) {
return Optional.of(version);
}
}
return Optional.empty();
}
}

View file

@ -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() {}
}

View file

@ -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.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3Section;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
/// Stroboscopic manifest 1 and 2 content handler.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ScopicManifestContentStringHandler implements ScopicManifestContent<String> {
private final WarpManifest3 manifest;
private WarpManifest3Section currentSection;
private List<String> remarks;
private WarpManifestTheVersion[] supportedVersions;
public ScopicManifestContentStringHandler(WarpManifest3 manifest, WarpManifestTheVersion... 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<WarpManifestTheVersion> manifestVersion = WarpManifestTheVersion.valueOfQName(version);
if (manifestVersion.isEmpty()) {
throw new ScopicManifestException("Unknown manifest version: " + version);
}
WarpManifestTheVersion versionParsed = manifestVersion.get();
for (WarpManifestTheVersion 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();
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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();
}
}

View file

@ -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.xml.io.XMLConstants;
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 != XMLConstants.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();
}
}

View file

@ -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);
}
}

View file

@ -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.xml.io.XMLConstants;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
/// 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(XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE);
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_NUMBER);
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX);
result.append(Integer.toHexString(c).toUpperCase());
result.appendCodePoint(XMLConstants.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(PrimordialOctalOrangeJuiceAtoms value) {
// Source;
// 18 bit TLV length value
if (value.length() > VERSION_4_MAX_DATA_LENGHT) {
return false;
}
return true;
}
}

View file

@ -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.xml.io.XMLConstants;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3HeaderField;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
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 WarpManifestTheVersion 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();
WarpManifest3HeaderField fieldVersion = parseLine(line);
version = parseVersion(fieldVersion);
handler.strobeManifestDeclaration(version.getQName());
WarpManifest3HeaderField fieldPrev = null;
WarpManifest3HeaderField 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 WarpManifestTheVersion parseVersion(WarpManifest3HeaderField 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<WarpManifestTheVersion> versionOpt = WarpManifestTheVersion.valueOfQName(fieldVersion.getBody());
if (versionOpt.isEmpty()) {
throw new ScopicManifestException("Missing manifest version: " + fieldVersion.getBody());
}
WarpManifestTheVersion versionFile = versionOpt.get();
if (WarpManifestTheVersion.VERSION_1_0.equals(versionFile)) {
return versionFile;
}
if (WarpManifestTheVersion.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 WarpManifest3HeaderField parseLine(String line) {
int splitIdx = line.indexOf(ScopicManifestConstants.PART_ATTR_SEPERATOR);
if (splitIdx == -1) {
return new WarpManifest3HeaderField(line, line);
}
String name = line.substring(0, splitIdx);
if (WarpManifestTheVersion.VERSION_2_0.equals(version)) {
name = normalizeV2NameString(name);
}
String body = line.substring(splitIdx + 2, line.length());
return new WarpManifest3HeaderField(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 != XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE) {
result.appendCodePoint(c);
} else {
StringBuilder charRef = new StringBuilder(16);
int c2 = iterator.nextInt();
if (c2 != XMLConstants.CODE_POINT_ENTIY_REF_NUMBER) {
throw new ScopicManifestException("Illegal lonely amp sign found: " + value);
}
int c3 = iterator.nextInt();
boolean isHex = false;
if (c3 == XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
isHex = true;
} else {
charRef.appendCodePoint(c3);
}
while (iterator.hasNext()) {
int charRefCodePoint = iterator.nextInt();
if (charRefCodePoint == XMLConstants.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();
}
}

View file

@ -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.WarpManifestTheVersion;
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 (WarpManifestTheVersion.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);
}
}

View file

@ -0,0 +1,110 @@
/*
* 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 org.x4o.xml.o4o.io.tlv.TLVChainSexTeenBit;
import org.x4o.xml.o4o.io.tlv.TLVChainSexTeenBitFrame;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
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<WarpManifestTheVersion> versionOpt = WarpManifestTheVersion.valueOfQName(fieldVersion);
if (versionOpt.isEmpty()) {
throw new ScopicManifestException("Unsupported version: " + fieldVersion);
}
if (!versionOpt.get().equals(WarpManifestTheVersion.VERSION_3_0)) {
throw new ScopicManifestException("Mismatched version: " + fieldVersion);
}
handler.strobeManifestDeclaration(WarpManifestTheVersion.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();
}
}

View file

@ -0,0 +1,101 @@
/*
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 org.x4o.xml.o4o.io.tlv.TLVChainSexTeenBit;
import org.x4o.xml.o4o.io.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 3 binary 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);
}
}

View file

@ -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 org.x4o.xml.o4o.io.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;
}
}

View file

@ -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.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4Section;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
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<PrimordialOctalOrangeJuiceAtoms> {
private final WarpManifest4 manifest;
private WarpManifest4Section currentSection;
private List<PrimordialOctalOrangeJuiceAtoms> remarks;
public ScopicManifest4ContentHandler(WarpManifest4 manifest) {
this.manifest = manifest;
this.remarks = new ArrayList<>();
}
@Override
public void strobeManifestDeclaration(PrimordialOctalOrangeJuiceAtoms version) {
if (WarpManifestTheVersion.VERSION_4_0.equals(version)) {
return;
}
throw new ScopicManifestException("Unsupported manifest version: " + version);
}
@Override
public void strobeMainAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
this.manifest.makeAttribute(name, body).withRemarks(remarks);
this.remarks.clear();
}
@Override
public void strobeSectionHeader(PrimordialOctalOrangeJuiceAtoms sectionName) {
this.currentSection = manifest.makeSection(sectionName);
this.currentSection.withRemarks(remarks);
this.remarks.clear();
}
@Override
public void strobeSectionAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
Objects.requireNonNull(this.currentSection, "Section header is not yet strobed.").makeAttribute(name, body).withRemarks(remarks);
this.remarks.clear();
}
@Override
public void strobeRemarkContent(PrimordialOctalOrangeJuiceAtoms remark) {
this.remarks.add(remark);
}
@Override
public void strobeManifestEnd() {
currentSection = null;
this.remarks.clear();
}
}

View file

@ -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.xml.o4o.io.tlv.TLVChainOctalSex;
import org.x4o.xml.o4o.io.tlv.TLVChainOctalSexFrame;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestTheVersion;
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<PrimordialOctalOrangeJuiceAtoms> handler;
public ScopicManifest4ContentReader(ScopicManifestContent<PrimordialOctalOrangeJuiceAtoms> 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());
}
PrimordialOctalOrangeJuiceAtoms fieldVersion = frameVersion.getSegmentChainAtoms();
if (!WarpManifestTheVersion.VERSION_4_0.equals(fieldVersion)) {
throw new ScopicManifestException("Mismatched version: " + fieldVersion + " requested: " + WarpManifestTheVersion.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();
}
}

View file

@ -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.xml.o4o.io.tlv.TLVChainOctalSex;
import org.x4o.xml.o4o.io.tlv.TLVChainOctalSexFrameType;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeJuiceAtoms;
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<PrimordialOctalOrangeJuiceAtoms> {
private final TLVChainOctalSex chain;
private final ScopicManifestDuplicateDetector<PrimordialOctalOrangeJuiceAtoms> duplicateDetector;
public ScopicManifest4ContentWriter(TLVChainOctalSex chain) {
this.chain = chain;
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length());
}
@Override
public void strobeManifestDeclaration(PrimordialOctalOrangeJuiceAtoms 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(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.MAIN_ATTRIBUTE, name);
addFrameSafe(ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_NAME, name);
addFrameSafe(ScopicManifest4FrameTLV.MAIN_ATTRIBUTE_BODY, body);
}
@Override
public void strobeSectionHeader(PrimordialOctalOrangeJuiceAtoms sectionName) {
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_NAME, sectionName);
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
addFrameSafe(ScopicManifest4FrameTLV.SECTION_HEADER_NAME, sectionName);
}
@Override
public void strobeSectionAttribute(PrimordialOctalOrangeJuiceAtoms name, PrimordialOctalOrangeJuiceAtoms body) {
duplicateDetector.validateUniqueKey(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE, name);
addFrameSafe(ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_NAME, name);
addFrameSafe(ScopicManifest4FrameTLV.SECTION_ATTRIBUTE_BODY, body);
}
@Override
public void strobeRemarkContent(PrimordialOctalOrangeJuiceAtoms remark) {
addFrameSafe(ScopicManifest4FrameTLV.META_REMARK_CONTENT, remark);
}
@Override
public void strobeManifestEnd() {
duplicateDetector.clearAll();
}
private void addFrameSafe(TLVChainOctalSexFrameType type, PrimordialOctalOrangeJuiceAtoms data) {
if (!ScopicManifestConstants.isV4DataArraySizeLegal(data)) {
throw new ScopicManifestException("Manifest data token size too long: " + data);
}
chain.addFrame(type, data);
}
}

View file

@ -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.xml.o4o.io.tlv.TLVChainOctalSexFrameType;
import org.x4o.xml.o4o.io.tlv.TLVChainSexTeenBitFrameType;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeJuice;
import org.x4o.xml.o4o.octal.PrimordialOctalOrangeSexWord;
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;
}
}

View file

@ -0,0 +1,205 @@
/*
* 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.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3Section;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天s
public class WarpManifestChinaTest {
@Test
public void testFullChineesium() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeAttribute("", "乞丐歌本").withRemark("同義詞 乞丐歌集");
manifest.makeAttribute("", "一千五百八十一").withRemark("與中國年份時間不同的年份時間");
manifest.makeAttribute("描述", "起司頭押韻詞海盜歌曲歌詞");
WarpManifest3Section 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 output = WarpManifestorDriver..writeV2String(manifest);
Assertions.assertNotNull(output);
System.out.println(output);
System.out.println("=========");
System.out.println(WarpManifestorDriver..writeViniString(new WarpManifest3().withSections(manifest.getSections())));
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestorDriverTest {
@Test
public void testWriteSimple() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeAttribute("foo", "bar");
manifest.makeSection("my1").withAttribute("foo1", "bar1");
String output = WarpManifestorDriver..writeV2String(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";
WarpManifest3 manitest = WarpManifestorDriver..readV2Stream(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());
}
}

View file

@ -0,0 +1,139 @@
/*
* 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.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestorVIniTest {
@Test
public void testViniReadSystemdService() {
WarpManifest3 manitest = WarpManifestorDriver..readViniStream(getClass().getResourceAsStream("ini/test-ntp.service"));
Assertions.assertNotNull(manitest);
Assertions.assertEquals(3, manitest.getSections().size());
Assertions.assertEquals("Network Time Service", manitest.getSectionAttributeBodyPrivate("Unit", "Description"));
Assertions.assertEquals("man:ntpd(8)", manitest.getSectionAttributeBodyPrivate("Unit", "Documentation"));
//System.out.println(WarpManifestorDriver..writeViniString(manitest));
}
@Test
public void testViniReadSimple() {
WarpManifest3 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.getSectionAttributeBodyPrivate("owner", "name"));
Assertions.assertEquals("Acme Widgets Inc.", manitest.getSectionAttributeBodyPrivate("owner", "organization"));
Assertions.assertEquals("192.0.2.62", manitest.getSectionAttributeBodyPrivate("database", "server"));
Assertions.assertEquals("143", manitest.getSectionAttributeBodyPrivate("database", "port"));
Assertions.assertEquals("payroll.dat", manitest.getSectionAttributeBodyPrivate("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.getSectionAttributeBodyPrivate("keys", "key"));
Assertions.assertEquals("value", manitest.getSectionAttributeBodyPrivate("keys", "name"));
Assertions.assertEquals(";", manitest.getSectionAttributeBodyPrivate("keys", "sem"));
Assertions.assertEquals("v5822.433.2", manitest.getSectionAttributeBodyPrivate("keys", "semver"));
}
@Test
public void testViniReadFruitFolding() {
WarpManifest3 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.getSectionAttributeBodyPrivate("project", "name"));
Assertions.assertEquals("Bay Area", manitest.getSectionAttributeBodyPrivate("project", "target region"));
Assertions.assertEquals("(vacant)", manitest.getSectionAttributeBodyPrivate("project", "legal team"));
Assertions.assertEquals("TODO: advertise vacant positions", manitest.getSectionAttribute("project", "legal team").get().getRemarks().get(0));
Assertions.assertEquals("foreseeable", manitest.getSectionAttributeBodyPrivate("fruit \"Apple\"", "trademark issues"));
Assertions.assertEquals("known", manitest.getSectionAttributeBodyPrivate("fruit \"Apple\"", "taste"));
Assertions.assertEquals("logistics (fragile fruit)", manitest.getSectionAttributeBodyPrivate("fruit \"Raspberry\"", "anticipated problems"));
Assertions.assertEquals("possible", manitest.getSectionAttributeBodyPrivate("fruit \"Raspberry\"", "Trademark Issues"));
Assertions.assertEquals("2021-11-23, 08:54 +0900", manitest.getSectionAttributeBodyPrivate("fruit.raspberry.proponents.fred", "date"));
Assertions.assertEquals("I like red fruit.", manitest.getSectionAttributeBodyPrivate("fruit.raspberry.proponents.fred", "comment"));
Assertions.assertEquals("Why,I would buy dates.", manitest.getSectionAttributeBodyPrivate("fruit \"Date/proponents/alfred\"", "comment"));
Assertions.assertEquals("My name may contain a \nnewline.", manitest.getSectionAttributeBodyPrivate("fruit \"Date/proponents/alfred\"", "editor"));
}
@Test
public void testViniWriteFruitFolding() {
WarpManifest3 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() {
WarpManifest3 manitest = WarpManifestorDriver..readViniStream(getClass().getResourceAsStream("ini/test-esc-quote.ini"));
Assertions.assertNotNull(manitest);
Assertions.assertEquals(3, manitest.getSections().size());
Assertions.assertEquals("'Junit'", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single"));
Assertions.assertEquals("Junit\'s hell0", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_center"));
Assertions.assertEquals("Junit\'", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_right"));
Assertions.assertEquals("\'Junit", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_left"));
Assertions.assertEquals("\"Junit\"", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double"));
Assertions.assertEquals("Junit\"s hell0", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_center"));
Assertions.assertEquals("Junit\"", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_right"));
Assertions.assertEquals("\"Junit", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_left"));
Assertions.assertEquals("Junit\thell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "tab"));
Assertions.assertEquals("Junit\\hell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "backslash"));
Assertions.assertEquals("Junit\nhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "line_feed"));
Assertions.assertEquals("Junit\rhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "carriage_return"));
Assertions.assertEquals("Junit\0hell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "null_character"));
Assertions.assertEquals("Junit\bhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "backspace"));
Assertions.assertEquals("Junit\fhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "form_feed"));
Assertions.assertEquals("Junit;hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "semicolon"));
Assertions.assertEquals("Junit#hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "number_sign"));
Assertions.assertEquals("Junit=hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "equals_sign"));
Assertions.assertEquals("Junit:hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "colon"));
Assertions.assertEquals("str1;str2;str3", manitest.getSectionAttributeBodyPrivate("EscCharOther", "quote_semi_colons"));
}
}

View file

@ -0,0 +1,97 @@
/*
* 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.manifest.WarpManifest3;
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");
}
WarpManifest3 manifest = new WarpManifest3();
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");
}
WarpManifest3 manifest = new WarpManifest3();
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);
WarpManifest3 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");
}
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("limit-lines", buf.toString());
byte[] output = WarpManifestorDriver..writeV3Array(manifest);
Assertions.assertNotNull(output);
WarpManifest3 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);
});
}
}

View file

@ -0,0 +1,121 @@
/*
* 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.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestBodyIllegalTest {
@Test
public void testWriteV1BodyNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\n");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1BodyLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\r");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1BodyNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\u0000");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2BodyNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\n");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2BodyLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\r");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2BodyNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\u0000");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV3BodyNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\n");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3BodyLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\r");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3BodyNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar\u0000");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
}

View file

@ -0,0 +1,162 @@
/*
* 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.xml.o4o.octal.PrimordialOctalOrangeString;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestNameDupTest {
@Test
public void testWriteV1DuplicateMainAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar1");
manifest.withAttribute("foo", "bar2");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1DuplicateSection() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit");
manifest.makeSection("junit");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1DuplicateSectionAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2DuplicateMainAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar1");
manifest.withAttribute("foo", "bar2");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2DuplicateSection() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit");
manifest.makeSection("junit");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2DuplicateSectionAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV3DuplicateMainAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "bar1");
manifest.withAttribute("foo", "bar2");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3DuplicateSection() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit");
manifest.makeSection("junit");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3DuplicateSectionAttribute() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("junit").withAttribute("foo", "bar1").withAttribute("foo", "bar1");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV4DuplicateMainAttribute() {
WarpManifest4 manifest = new WarpManifest4();
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() {
WarpManifest4 manifest = new WarpManifest4();
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() {
WarpManifest4 manifest = new WarpManifest4();
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);
});
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.xml.o4o.octal.PrimordialOctalOrangeString;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestNameEmptyTest {
@Test
public void testWriteV1NameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2NameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV3NameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV4NameEmpty() {
WarpManifest4 manifest = new WarpManifest4();
manifest.withAttribute(PrimordialOctalOrangeString.valueOfEmpty(), PrimordialOctalOrangeString.valueOfSmurfs(Arrays.asList(12,34)));
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV4Array(manifest);
});
}
}

View file

@ -0,0 +1,121 @@
/*
* 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.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestNameForbidCharTest {
@Test
public void testWriteV1NameNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\n", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1NameLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\r", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV1NameNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\u0000", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2NameNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\n", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2NameLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\r", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV2NameNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\u0000", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV3NameNewLine() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\n", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3NameLineFeed() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\r", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
@Test
public void testWriteV3NameNull() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo\u0000", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV3Array(manifest);
});
}
}

View file

@ -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 org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
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");
}
WarpManifest3 manifest = new WarpManifest3();
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");
}
WarpManifest3 manifest = new WarpManifest3();
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");
}
WarpManifest3 manifest = new WarpManifest3();
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);
});
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestNameSeperatorTest {
@Test
public void testWriteV1NameSeperator() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo:", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2OutputSeperator() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("ju n it:", "junit:");
String output = WarpManifestorDriver..writeV2String(manifest);
Assertions.assertNotNull(output);
Assertions.assertTrue(output.contains("ju&#x20;n&#x20;it&#x3A;:"));
Assertions.assertTrue(output.contains("junit:"));
}
@Test
public void testWriteV3OutputSeperator() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("ju n it:", "junit:");
byte[] output = WarpManifestorDriver..writeV3Array(manifest);
Assertions.assertNotNull(output);
WarpManifest3 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());
}
}

View file

@ -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.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestNameUnicodeTest {
@Test
public void testWriteV1NameUnicode() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "仙上主天");
WarpManifestorDriver..writeV1String(manifest);
Assertions.assertThrows(ScopicManifestException.class, () -> {
manifest.withAttribute("仙上主天", "bar");
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2NameUnicode() {
WarpManifest3 manifest = new WarpManifest3();
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("&#x4ED9;&#x4E0A;&#x4E3B;&#x5929;: bar", lines[2]);
WarpManifest3 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() {
WarpManifest3 manifest = new WarpManifest3();
manifest.withAttribute("foo", "仙上主天");
manifest.withAttribute("仙上主天", "bar");
byte[] output = WarpManifestorDriver..writeV3Array(manifest);
Assertions.assertNotNull(output);
WarpManifest3 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());
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.xml.o4o.octal.PrimordialOctalOrangeString;
import love.distributedrebirth.nx01.warp.manifestor.WarpManifestorDriver;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest3;
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifest4;
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class WarpManifestSectionNameEmptyTest {
@Test
public void testWriteV1SectionNameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("").withAttribute("foo", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV1String(manifest);
});
}
@Test
public void testWriteV2SectionNameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
manifest.makeSection("").withAttribute("foo", "bar");
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV2String(manifest);
});
}
@Test
public void testWriteV3SectionNameEmpty() {
WarpManifest3 manifest = new WarpManifest3();
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));
WarpManifest4 manifest = new WarpManifest4();
manifest.makeSection(PrimordialOctalOrangeString.valueOfEmpty()).withAttribute(foobar, foobar);
Assertions.assertThrows(ScopicManifestException.class, () -> {
WarpManifestorDriver..writeV4Array(manifest);
});
}
}

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -837,5 +837,7 @@
<module>nx01-no2all-wire-jre</module>
<module>nx01-no2all-wire-ojw</module>
<module>nx01-no2all-zerofungus</module>
<module>nx01-warp-fault</module>
<module>nx01-warp-manifestor</module>
</modules>
</project>