Lapetus Systems Ltd

 

HOW-TO

HOW CAN I WORK WITH THE JUT PLUGIN

JUT is enabled in two ways in IDEA.

  • In the right-click popup menu of the editor
  • With the CNTRL-ALT-SHIFT-J key
Both of these methods will provide a popup menu of static functions, with the ability to see the JavaDoc, Test Code and Templates.
JAVADOC is also enabled for all functions and classes of JUT. Just click on the class and press SHIFT-F1.

 

 

HOW DO I USE JUT IN MY APPLICATION

The JUT API JAR file is included in the plugin directory under the API directory. It can also be downloaded from www.lapetus-ltd.com.
Note: the plugin directory is either under the IDEA program directory, or in your user home directory under .IntelliJXX/Config. On the Mac OS X it may be under user_home/library/caches/intellijXXX.
During development the plugin JUT API can be used, which is loaded into your IDE. This means that all debug runs will automatically function without further a do.
To release your application, the API referenced above needs to be included in your build process.

 

 

HOW DO I CHANGE THE CODE TEMPLATES

The JUT Code templates are included in the plugin directory, in a file called CodeTemplate.xml.
Note: the plugin directory is either under the IDEA program directory, or in your user home directory under .IntelliJXX/Config. On the Mac OS X it may be under user_home/library/caches/intellijXXX.

Add an ENTRY element for every code template you wish to include. These templates are then shown in the JUT popup menu.

 

 

HOW DO I USE THE XML MARSHAL and UNMARSHAL

Before we can marshal, we need to create a Java class that represents and processes our XML structure.
Once that is done, reading, writing and processing the XML data is as easy as setting and getting information from a Java class.

So, let us see exactly how that is done:

We create a XSD file, which holds the structure of our XML document.

Now that the XSD file is created, we can generate the Java class(es) with the XJC command.
Here is an example of XJC in an ANT build script, and here is an example of a MAVEN pom that instantiates XJC.

After generating the Java Classes from the XSD, we are in a position to write some very easy code, based on a very solid foundation.
To marshal to a file, we would do the following:

  MyGeneratedType mgt = new MyGeneratedType();
  mgt.setSomething("ABC");
  ObjectFactory of = new ObjectFactory();
  TLptsXmlUtil.marshal("name.of.file.to.write.xml",MyGeneratedType.class,of.createMyGeneratedType(mgt));

To unmarshal a file, we would do the following:

  MyGeneratedType mgt = (MyGeneratedType)TLptsXmlUtil.marshal("name.of.file.to.read.xml",MyGeneratedType.class);
  String mySomething = mgt.getSomething();
 

HOW DOES THE CRYPTO FOREIGN MECHANISM WORK

Before we answer this question. lets just say a word about the Private-Public Key pairs.
Private-Public key pairs allow for encryption/decryption of data by two parties, with one set of cipher keys.
The keys are generated by one or both parties using a cipher mechanism like RSA.
Thereafter the private key is kept safe and never given to anyone. The public key is freely distributed for encryption purposes only.
This encryption process is known as ASYMMETRIC, whereas a fixed "secret" key, used by both parties, is known as SYMMETRIC.

So now we can get back to the original question: the foreign mechanism works on the fact that only the holder of the private key can "unlock" the data encrypted by another party with the public key of the generated Private-Public Key Pair.
In most cases, and due to the extensive processing required by key pairs, SYMMETRIC keys are secretly exchanged at the beginning of a data exchange, and then both parties encrypt and decrypt based on that.