Download MASTER THESIS
Transcript
Chapter 6. Java technologies 6.2 JAXB XML manipulation is one of the most performed operations nowadays, more importantly due to web services, whose communication is basically built on XML technology. Java Architecture for XML Binding is a framework for simple manipulation with XML in Java and can be simply described as "ORM for XML". The framework does most of the XML heavy-lifting for user in a way that the user does not need to know anything about differences between SAX and DOM parsing [19]. With JAXB technology the user defines or specifies a XML schema, by which is performed so called binding. It means that for specified XML schema are generated Java classes, which are afterwards used for reading existing XML files in a process called unmarshalling. The opposite process, when we store initialized objects of binded classes is called marshalling. Basic usage assumes a XML schema defined in a XSD file, for which are generated Java classes using JAXB libraries. The libraries are available either in JDK 6 and higher, or stand-alone for separate download and usage. Another option is to define the XML schema in a Java code by a developer using annotations. Marshalling and unmarshalling is by default handled by a developer’s code, but with technologies like Spring it is simple to make the framework handle the marshalling/unmarshalling process by itself. With Spring framework, annotations have become a powerful tool, which gives us option to handle XML files easily, while keeping the code clean with all the semantics in one place. An example of creating and reading a XML file using JAXB is available in appendix A. 6.3 Apache Maven Maintaining a software project is a significant part of the development process. A developer needs to create a project structure, take care of required library dependencies, deploy a created application and so on. Taking care of these operations manually could be difficult, but fortunately there is a way to automate them, like with Apache Maven [5]. Apache Maven depends on its Project Object Model (POM) stored in a pom.xml configuration file. It contains projects meta-information, like 13