I am still stuck on getting layers working with a custom checksum, so just checking in on this in case it has gotten buried too deep.
Thank you. -----Original Message----- From: Mark Kozak <mark.ko...@adeptus-cs.com> Sent: Tuesday, October 29, 2024 9:09 AM To: users@daffodil.apache.org Subject: RE: Where to put custom checksum for use as a layer? Jar is attached. Zipped for email filters. -----Original Message----- From: Steve Lawrence <slawre...@apache.org> Sent: Tuesday, October 29, 2024 7:43 AM To: users@daffodil.apache.org Subject: Re: Where to put custom checksum for use as a layer? Is it possible to share the jar? I'm not sure what could be wrong, but having the jar might make it easier to figure out. On 2024-10-28 11:21 PM, Mark Kozak wrote: > I was missing the > META-INF/services/org.apache.daffodil.runtime1.layers.api.Layer file, but > even after adding that to the build and verifying it is included in the jar > file, I am still getting the same error. > > I started with Daffodil 3.8.0 but just tried going to 3.9.0 in the > hopes of getting more debug information, but nothing changed, > > -----Original Message----- > From: Steve Lawrence <slawre...@apache.org> > Sent: Monday, October 28, 2024 6:43 PM > To: users@daffodil.apache.org > Subject: Re: Where to put custom checksum for use as a layer? > > Another thing to check is the Daffodil version you're using. The layer API > was overhauled in Daffodil 3.8.0, so if you're using a layer written for the > new layer API (which the latest version of IPv4ChecksumLayer is) it won't be > found by older versions of Daffodil. You'll either need a newer version of > Daffodil or an older version of the layer. > > On 2024-10-28 06:26 PM, Mike Beckerle wrote: >> It seems to be searching for the right thing, but unable to find it >> on the classpath. >> >> Are you perhaps just missing the metadata to tell the Java SPI loader >> that the class is to be dynamically loaded from your jar? >> >> The jar must have a file: >> META-INF/services/org.apache.daffodil.runtime1.layers.api.Layer >> >> The name is the name of the dynamically loaded base class. >> >> That file contains the name of the dynamic class such as: >> >> com.owlcyberdefense.dfdl.IPv4ChecksumLayer >> >> In the EthernetIP project, this META-INF lives under >> src/main/resources where it gets packaged into the jar file. >> >> >> >> >> On Mon, Oct 28, 2024 at 1:02 PM Mark Kozak <mark.ko...@adeptus-cs.com >> <mailto:mark.ko...@adeptus-cs.com>> wrote: >> >> I feel I am so close to the solution and the tip on the >> DAFFODIL_CLASSPATH >> environment variable was the last missing step. But unfortunately I am >> still >> getting the following error: >> >> [error] Schema Definition Error: The dfdlx:layer >> '{urn:com.owlcyberdefense.dfdl.IPv4Checksum}IPv4Checksum' was not found. >> Available choices are: >> {urn:org.apache.daffodil.layers.lineFolded}lineFolded_IMF, >> {urn:org.apache.daffodil.layers.lineFolded}lineFolded_iCalendar, >> {urn:org.apache.daffodil.layers.base64_MIME}base64_MIME, >> {urn:org.apache.daffodil.layers.gzip}gzip, >> {urn:org.apache.daffodil.layers.fixedLength}fixedLength, >> {urn:org.apache.daffodil.layers.byteSwap}twobyteswap, >> {urn:org.apache.daffodil.layers.byteSwap}fourbyteswap, >> {urn:org.apache.daffodil.layers.boundaryMark}boundaryMark >> >> Here is what've done so far: >> >> 1 - packaged the scala code for IPv4Checksum as a jar file named >> ipv4checksumlayer_2.12-1.0.jar. Using this code just to see if I can >> get >> daffodil to see the class >> 2 - Verified the jar file contains the class named >> IPv4ChecksumLayer.class in >> the path com\owlcyberdefense\dfdl\ >> 3 - set the DAFFODIL_CLASSPATH environment variable to the location of >> the jar >> file. >> 4 - pasted the following lines into my schema file: >> >> xmlns:chksum="urn:com.owlcyberdefense.dfdl.IPv4Checksum" >> <xs:import namespace="urn:com.owlcyberdefense.dfdl.IPv4Checksum" >> schemaLocation="IPv4ChecksumLayer.dfdl.xsd"/> >> >> <sequence > >> <xs:annotation> >> <xs:appinfo source="http://www.ogf.org/dfdl/ <http:// >> www.ogf.org/dfdl/>"> >> <dfdl:newVariableInstance ref="chksum:IPv4Checksum"/> >> </xs:appinfo> >> </xs:annotation> >> <xs:sequence dfdl:ref="chksum:IPv4ChecksumLayer"> >> <xs:sequence> >> <xs:element name="Checksum" >> type="chksum:IPv4Checksum"/> >> </xs:sequence> >> </xs:sequence> >> </sequence> >> >> >> >> >> -----Original Message----- >> From: Steve Lawrence <slawre...@apache.org >> <mailto:slawre...@apache.org>> >> Sent: Friday, October 25, 2024 1:30 PM >> To: users@daffodil.apache.org <mailto:users@daffodil.apache.org> >> Subject: Re: Where to put custom checksum for use as a layer? >> >> You need to build your layer into a .jar file and then put that on >> Daffodil's >> classpath. >> >> If you're use the Daffodil CLI, you can add jars to the CLI classpath by >> setting the DAFFODIL_CLASSPATH environment variable, for example: >> >> export DAFFODIL_CLASSPATH="/path/to/custom/checksum/layer.jar" >> daffodil parse -s schema.dfdl.xsd ... >> >> If instead you're running TDML tests using SBT, a common technique is to >> publish the layer jar to a local repository, then add it as a >> dependency to >> the schema project that uses it. For example, you could do this to >> publish >> locally: >> >> cd /layer-project >> sbt publishLocal >> >> And add this to your schema project build.sbt file: >> >> libraryDependencies ++= Seq( >> "org.example" % "layer-project" % "1.0.0" >> ) >> >> And then just run "sbt test" from the schema project. SBT will find the >> locally published layer and automatically add it to the classpath when >> running >> tests. >> >> >> >> On 2024-10-25 12:51 PM, Mark Kozak wrote: >> > Hello folks, >> > >> > I have a custom checksum calculator I need to run on an entity. I >> have been >> > studying the ethernetIP example <https://github.com/DFDLSchemas/ >> ethernetIP <https://github.com/DFDLSchemas/ethernetIP>> >> > and >> > the layers documentation <https://daffodil.apache.org/layers >> <https:// >> daffodil.apache.org/layers>>, but am unable >> > to >> > figure out where to place my scala implementation for it to be >> found. Is >> > there >> > some documentation I am missing? >> > >> > Thanks as always for the support, >> > >> > Mark >> > >> > Mark Kozak >> > >> > Director of Engineering >> > >> > Adeptus Cyber Solutions >> > >> > Adeptus-CS.com >> > >> >
smime.p7s
Description: S/MIME cryptographic signature