Skip to content

Instantly share code, notes, and snippets.

@r-brown
Last active August 29, 2015 14:12
Show Gist options
  • Save r-brown/9fe6fa117131a82ae2d9 to your computer and use it in GitHub Desktop.
Save r-brown/9fe6fa117131a82ae2d9 to your computer and use it in GitHub Desktop.
SWID Tag Generator (example 01)
// prepare SWID Tag processor
SwidProcessor processor = new DefaultSwidProcessor();
((DefaultSwidProcessor) processor).setEntitlementRequiredIndicator(true)
.setProductTitle("NetLicensing")
.setProductVersion("2.1.0", 2, 1, 0, 0)
.setSoftwareCreator("Labs64", "regid.2010-04.com.labs64")
.setSoftwareLicensor("Labs64", "regid.2010-04.com.labs64")
.setSoftwareId("NLIC", "regid.2010-04.com.labs64")
.setTagCreator("Labs64", "regid.2010-04.com.labs64");
// create builder and pass processor as build param
SwidBuilder builder = new SwidBuilder();
SoftwareIdentificationTagComplexType swidTag = builder.build(processor);
// output resulting object
SwidWriter writer = new SwidWriter();
StringWriter out = new StringWriter();
writer.write(swidTag, out);
System.out.println(out);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment