Skip to content

Commit

Permalink
Java Geci dependency was removed, and instead Jamal dependency added …
Browse files Browse the repository at this point in the history
…with the 2.1.0-SNAPSHOT release

it will not compile on the GitHub site, not relesable version
  • Loading branch information
verhas committed May 14, 2023
1 parent dfd697b commit 061d1ef
Show file tree
Hide file tree
Showing 13 changed files with 238 additions and 240 deletions.
3 changes: 2 additions & 1 deletion .mvn/extensions.jam
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{@import https://raw.githubusercontent.com/verhas/jamal/master/version.jim}
{@comment nosave}\
{@import https://raw.githubusercontent.com/verhas/jamal/master/version.jim}\
<!--
This file was generated from extensions.jam in the same directory as extensions.xml

Expand Down
6 changes: 3 additions & 3 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
This file was generated from extensions.jam in the same directory as extensions.xml
The current version of Jamal is 1.12.3-SNAPSHOT.
The latest version is 1.12.2.
The current version of Jamal is 2.1.0-SNAPSHOT.
The latest version is 2.0.2.
--><extensions>
<extension>
<groupId>com.javax0.jamal</groupId>
<artifactId>jamal-maven-extension</artifactId>
<version>1.12.2</version>
<version>2.0.2</version>
</extension>
</extensions>
19 changes: 10 additions & 9 deletions pom.jam
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{#thinXml{@xmlFormat}
{@comment}
{#thinXml
project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
modelVersion>4.0.0
groupId>com.javax0.license3j
artifactId>license3j
version>3.2.0
packaging>jar

name>License3j
properties>sourceEncoding>UTF-8
distributionManagement>
Expand Down Expand Up @@ -55,12 +55,6 @@ project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mav
version>5.8.2
scope>test

dependency>
groupId>com.javax0.geci
artifactId>javageci-testengine
version>1.6.5
scope>test

profiles>profile>
id>release
build>plugins>plugin>
Expand Down Expand Up @@ -89,6 +83,13 @@ project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mav
artifactId>junit-jupiter-engine
version>5.7.0

plugin>
groupId>com.javax0.jamal
artifactId>jamal-maven-plugin
version>2.1.0-SNAPSHOT
executions>execution>
goals>goal>jamal

plugin>
groupId>org.apache.maven.plugins
artifactId>maven-source-plugin
Expand Down Expand Up @@ -121,4 +122,4 @@ project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mav
serverId>ossrh
nexusUrl>https://oss.sonatype.org/
autoReleaseAfterClose>true
}
}{@xmlFormat}
23 changes: 14 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<groupId>com.javax0.license3j</groupId>
<artifactId>license3j</artifactId>
<version>3.2.0</version>
<packaging>jar
</packaging>
<packaging>jar</packaging>
<name>License3j</name>
<properties>
<sourceEncoding>UTF-8</sourceEncoding>
Expand Down Expand Up @@ -69,13 +68,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test
</scope>
</dependency>
<dependency>
<groupId>com.javax0.geci</groupId>
<artifactId>javageci-testengine</artifactId>
<version>1.6.5</version>
<scope>test
</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -127,6 +119,19 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.javax0.jamal</groupId>
<artifactId>jamal-maven-plugin</artifactId>
<version>2.1.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>jamal
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down
26 changes: 26 additions & 0 deletions src/main/jamal/FeatureMethods.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{%!@for [separator="\\s*\n\\s*" skipEmpty] ($type,$vType,$value) in `LOOP`
Binary|byte[]|value
String|String|value.getBytes(StandardCharsets.UTF_8)
Byte|Byte|new byte[]{value}
Short|Short|ByteBuffer.allocate(Short.BYTES).putShort(value).array()
Int|Integer|ByteBuffer.allocate(Integer.BYTES).putInt(value).array()
Long|Long|ByteBuffer.allocate(Long.BYTES).putLong(value).array()
Float|Float|ByteBuffer.allocate(Float.BYTES).putFloat(value).array()
Double|Double|ByteBuffer.allocate(Double.BYTES).putDouble(value).array()
BigInteger|BigInteger|value.toByteArray()
uuid|java.util.UUID|ByteBuffer.allocate(2 * Long.BYTES).putLong(value.getLeastSignificantBits()).putLong(value.getMostSignificantBits()).array()
Date|Date|ByteBuffer.allocate(Long.BYTES).putLong(value.getTime()).array()
`LOOP`=
/**
* Create a new {%@case:decap $type%} feature.
*
* @param name the name of the new feature
* @param value the value for the new feature. {@code null} value will throw an exception
* @return the newly created feature object
*{%@comment%}/
public static Feature {%@case:decap $type%}Feature(String name, $vType value) {
Objects.requireNonNull(value);
return new Feature(name, Type.{%@case:upper $type%}, $value);
}
%}
{%@java:insert to="../java/javax0/license3j/Feature.java" id="FeatureMethods"%}
21 changes: 21 additions & 0 deletions src/main/jamal/FeatureTypeEnum.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
private enum Type {{%@counter:define id=typeSerial%}\
{%!@for [separator="\\s*\n\\s*" skipEmpty]($type,$length,$cast,$stringer,$unstringer,$sep) in `LOOP`
binary|VARIABLE_LENGTH|byte[]|ba -> Base64.getEncoder().encodeToString((byte[]) ba)|enc -> Base64.getDecoder().decode(enc)|
string|VARIABLE_LENGTH|||s -> s|
byte|||b -> String.format("0x%02X", (Byte) b)|NumericParser.Byte::parse|
short||||NumericParser.Short::parse|
int|Integer.BYTES|Integer||NumericParser.Int::parse|
long||||NumericParser.Long::parse|
float||||Float::parseFloat|
double||||Double::parseDouble|
bigInteger|VARIABLE_LENGTH|||BigInteger::new|
bigDecimal|VARIABLE_LENGTH|||BigDecimal::new|
date|Long.BYTES||Feature::dateFormat|Feature::dateParse|
UUID|2 * Long.BYTES|java.util.UUID||java.util.UUID::fromString|;
`LOOP`=
{%@case:upper $type%}({%typeSerial%}, {%#if/$length/$length/{%@case:cap $type%}.BYTES%},
Feature::get{%@case:cap $type%},
(name, value) -> Create.{%@replace /$type/UUID/uuid%}Feature(name, ({%#if/$cast/$cast/{%@case:cap $type%}%}) value),
{%#if/$stringer/$stringer/Object::toString%}, $unstringer){%@if/$sep/$sep/,%}
%}
{%@java:insert to="../java/javax0/license3j/Feature.java" id="TypesEnum"%}
14 changes: 14 additions & 0 deletions src/main/jamal/Network.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{%!@for [separator="\\s*\n\\s*" skipEmpty]($rettype,$name,$exceptions) in
`LOOP`
String|getName|
byte[]|getHardwareAddress|SocketException
String|getDisplayName|
boolean|isLoopback|SocketException
boolean|isVirtual|SocketException
boolean|isPointToPoint|SocketException
`LOOP`=
public $rettype $name(){%#if/$exceptions/ throws $exceptions/%} {
return ni.$name();
}
%}
{%@java:insert to="../java/javax0/license3j/hardware/Network.java" id="Network"%}
15 changes: 15 additions & 0 deletions src/main/jamal/getType.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%!@for ($Type) in (Public,Private)= /**GENERATED CODE
* Get the byte representation of the {%@case:lower $Type%} key as it is returned
* by the underlying security library. It is NOT the byte array
* that contains the algorithm at the start. It is the key in raw
* format.
*
* @return the key as bytes
*{%@comment%}/
public byte[] get$Type() {
keyNotNull(pair.get$Type());
final var key = pair.get$Type();
return getKeyBytes(key);
}
%}\
{%@java:insert to="../java/javax0/license3j/crypto/LicenseKeyPair.java" id="getTypes"%}
21 changes: 21 additions & 0 deletions src/main/jamal/getTypeFeature.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{%@comment UUID and BigDecimal are handled separately, because they differ significantly%}\
{%!@for [separator="\\s*\n\\s*" skipEmpty]($Type,$return,$rType) in `LOOP`
Binary|value|byte[]
String|new String(value, StandardCharsets.UTF_8)|String
Byte|value[0]|byte
Short|ByteBuffer.wrap(value).getShort()|short
Int|ByteBuffer.wrap(value).getInt()|int
Long|ByteBuffer.wrap(value).getLong()|long
Float|ByteBuffer.wrap(value).getFloat()|float
Double|ByteBuffer.wrap(value).getDouble()|double
BigInteger|new BigInteger(value)|BigInteger
Date|new Date(ByteBuffer.wrap(value).getLong())|Date
`LOOP`=
public $rType get$Type() {
if (type != Type.{%@case:upper $Type%}) {
throw new IllegalArgumentException("Feature is not {%@case:upper $Type%}");
}
return $return;
}
%}\
{%@java:insert to="../java/javax0/license3j/Feature.java" id="getTypes"%}\
10 changes: 10 additions & 0 deletions src/main/jamal/isType.java.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// {%@rot13 TRARENGRQ PBQR%}
{%!@for $Type in (Binary,String,Byte,Short,Int,Long,Float,Double,BigInteger,BigDecimal,Date,UUID)=
/**
* @return {@code true} if the feature is of type $Type
*{%@ident%}/
public boolean is$Type() {
return type == Type.{%@case:upper $Type%};
}
%}\
{%@java:insert to="../java/javax0/license3j/Feature.java" id="isTypes"%}\
Loading

0 comments on commit 061d1ef

Please sign in to comment.