|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.fosstrak.tdt.TDTEngine
public class TDTEngine
This class provides methods for translating an electronic product code (EPC) between various levels of representation including BINARY, TAG_ENCODING, PURE_IDENTITY and LEGACY formats. An additional output level ONS_HOSTNAME may be defined for some coding schemes.
Constructor Summary | |
---|---|
TDTEngine()
Constructor for a new Tag Data Translation engine. |
|
TDTEngine(java.lang.String confdir)
Deprecated. |
|
TDTEngine(java.net.URL auxiliarydir,
java.util.Set<java.net.URL> schemeslist,
boolean absolute)
Constructor for a new Tag Data Translation engine. |
|
TDTEngine(java.net.URL auxiliarydir,
java.net.URL schemesdir)
Constructor for a new Tag Data Translation engine. |
Method Summary | |
---|---|
void |
addListOfGCPs(java.io.InputStream source)
adds a list of global company prefixes (GCPs) to the current list of GCPs. |
java.lang.String |
bin2dec(java.lang.String binary)
Converts a binary string into a large integer (numeric string) |
java.lang.String |
bin2hex(java.lang.String binary)
Converts a binary string to a hexadecimal string |
java.lang.String |
convert(java.lang.String input,
LevelTypeList inputLevel,
java.lang.String tagLength,
java.util.Map<java.lang.String,java.lang.String> inputParameters,
LevelTypeList outputLevel)
Translates the input string of a specified input level to a specified outbound level of the same coding scheme. |
java.lang.String |
convert(java.lang.String input,
java.util.Map<java.lang.String,java.lang.String> inputParameters,
LevelTypeList outputLevel)
The convert method translates a String input to a specified outbound level of the same coding scheme. |
java.lang.String |
convertBinaryEPCToPureIdentityEPC(java.lang.String binary)
converts a binary EPC to a pure identity representation. |
java.lang.String |
convertGLNandSerialToPureIdentityEPC(java.lang.String gln,
java.lang.String serial)
converts a GLN and serial to the pure identity representation of an EPC. |
java.lang.String |
convertGLNandSerialToPureIdentityEPC(java.lang.String gln,
java.lang.String serial,
int gcpLength)
converts a GLN and serial to the pure identity representation of an EPC. |
java.lang.String |
convertGTINandSerialToPureIdentityEPC(java.lang.String gtin,
java.lang.String serial)
converts a GTIN and serial number to the pure identity representation of an EPC. |
java.lang.String |
convertGTINandSerialToPureIdentityEPC(java.lang.String gtin,
java.lang.String serial,
int gcpLength)
converts a GTIN and serial number to the pure identity representation of an EPC. |
java.lang.String |
convertHexEPCToPureIdentityEPC(java.lang.String binary)
converts a binary EPC in hex notation to a pure identity representation. |
java.util.List<java.lang.String> |
convertPureIdentityEPCToGTINandSerial(java.lang.String EPC)
converts a pure identity EPC to gtin and serial. |
java.lang.String |
convertPureIdentityEPCToSSCC(java.lang.String EPC)
converts a pure identity EPC to gtin and serial. |
java.lang.String |
convertSSCCToPureIdentityEPC(java.lang.String sscc)
converts a SSCC to the pure identity representation of an EPC. |
java.lang.String |
convertSSCCToPureIdentityEPC(java.lang.String sscc,
int gcpLength)
converts a SSCC to the pure identity representation of an EPC. |
java.lang.String |
dec2bin(java.lang.String decimal)
Converts a large integer (numeric string) to a binary string |
java.lang.String |
hex2bin(java.lang.String hex)
Converts a hexadecimal string to a binary string |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Deprecated public TDTEngine(java.lang.String confdir) throws java.io.FileNotFoundException, javax.xml.bind.MarshalException, javax.xml.bind.ValidationException, TDTException
confdir
- the string value of the path to a configuration directory
consisting of two subdirectories, schemes
and
auxiliary
.
When the class TDTEngine is constructed, the path to a local
directory must be specified, by passing it as a single string
parameter to the constructor method, e.g.
TDTEngine engine = new TDTEngine("/opt/TDT");
The specified directory must contain two subdirectories named
auxiliary and schemes. The Tag Data Translation definition
files for the various coding schemes should be located inside
the subdirectory called schemes
. Any auxiliary
lookup files (such as ManagerTranslation.xml
)
should be located inside the subdirectory called
auxiliary
.
Files within the schemes directory ending in .xml
are read in and unmarshalled using JAXB.
java.io.FileNotFoundException
javax.xml.bind.MarshalException
javax.xml.bind.ValidationException
TDTException
public TDTEngine() throws java.io.IOException, javax.xml.bind.JAXBException
java.io.IOException
- thrown if the url is unreachable
javax.xml.bind.JAXBException
- thrown if the schemes could not be parsedpublic TDTEngine(java.net.URL auxiliarydir, java.net.URL schemesdir) throws java.io.IOException, javax.xml.bind.JAXBException
auxiliarydir
- URL to the directory containing auxiliary files such as the GEPC64Table,
"ManagerTranslation.xml"schemesdir
- URL to the directory containing the schemes, all files ending in xml are
read and parsed
java.io.IOException
- thrown if the url is unreachable
javax.xml.bind.JAXBException
- thrown if the files could not be parsedpublic TDTEngine(java.net.URL auxiliarydir, java.util.Set<java.net.URL> schemeslist, boolean absolute) throws javax.xml.bind.JAXBException, java.io.IOException
auxiliarydir
- URL to the directory containing auxiliary files such as the GEPC64Table,
"ManagerTranslation.xml"schemeslist
- set containing several urls pointing to directories containing
the schemes. All files ending in xml are read and parsed.absolute
- true if the given URLs are absolute
java.io.IOException
- thrown if the url is unreachable
javax.xml.bind.JAXBException
- thrown if the files could not be parsedMethod Detail |
---|
public java.lang.String convert(java.lang.String input, LevelTypeList inputLevel, java.lang.String tagLength, java.util.Map<java.lang.String,java.lang.String> inputParameters, LevelTypeList outputLevel)
Note that this version of the method requires that the user specify the input level, rather than searching for it. However it still automatically finds the scheme used.
input
- input tag codinginputLevel
- level such as BINARY, or TAG_ENCODING.tagLength
- tag length such as VALUE_64 or VALUE_96.inputParameters
- a map with any additional properties.outputLevel
- required output level.
public java.lang.String convert(java.lang.String input, java.util.Map<java.lang.String,java.lang.String> inputParameters, LevelTypeList outputLevel)
input
- the identifier to be converted.inputParameters
- additional parameters which need to be provided because they
cannot always be determined from the input value alone.
Examples include the taglength, companyprefixlength and filter
values.outputLevel
- the outbound level required for the ouput. Permitted values
include BINARY, TAG_ENCODING, PURE_IDENTITY, LEGACY and
ONS_HOSTNAME.
public java.lang.String bin2dec(java.lang.String binary)
public java.lang.String dec2bin(java.lang.String decimal)
public java.lang.String hex2bin(java.lang.String hex)
public java.lang.String bin2hex(java.lang.String binary)
public void addListOfGCPs(java.io.InputStream source) throws java.io.IOException
inputstream
- a reference to a source of GCPs
java.io.IOException
public java.lang.String convertGTINandSerialToPureIdentityEPC(java.lang.String gtin, java.lang.String serial)
public java.lang.String convertGTINandSerialToPureIdentityEPC(java.lang.String gtin, java.lang.String serial, int gcpLength)
public java.util.List<java.lang.String> convertPureIdentityEPCToGTINandSerial(java.lang.String EPC)
public java.lang.String convertSSCCToPureIdentityEPC(java.lang.String sscc)
public java.lang.String convertSSCCToPureIdentityEPC(java.lang.String sscc, int gcpLength)
public java.lang.String convertPureIdentityEPCToSSCC(java.lang.String EPC)
public java.lang.String convertGLNandSerialToPureIdentityEPC(java.lang.String gln, java.lang.String serial)
public java.lang.String convertGLNandSerialToPureIdentityEPC(java.lang.String gln, java.lang.String serial, int gcpLength)
public java.lang.String convertBinaryEPCToPureIdentityEPC(java.lang.String binary)
public java.lang.String convertHexEPCToPureIdentityEPC(java.lang.String binary)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |