Main purpose Main functionality - NetBeans Wiki

Main purpose Main functionality - NetBeans Wiki

JAXB Wizard• After the wizard is run, the user shall be able to access the properties entered inthe wizard and change them.Representation in project• There shall be a new Folder node under the project called "Data binding". Underthis node there shall be a sub node "JAXB". Under this node there shall be onenode for each time the wizard was run on an XSD, e.g. Data Binding > JAXB >xsd1.xsd. These nodes are called jaxb nodes.• The jaxb node will have the following right-click menu:o "Refresh": providing an option to refresh the XSD if the XSD was copiedfrom another location. This option brings up a question dialog boxexplaining what will happen and allows the user to cancel the operation.o "Configuration": providing access to the configuration options. Theseconfiguration options are similar to those provided in the wizard.ooUse of generated code"Generate": generates the java code and compiles"Delete": providing the option to delete. Deleting a jaxb node removes allchanges that was done by the wizard for that XSD.• The generated classes should show up in the auto-completion feature of the Javaeditor. In order for this it may be necessary to build the project first.• Runtime libraries for marshaling/unmarshaling XML shall be automaticallypackaged in the project. Runtime libraries show up in the Libraries node.• There shall be a right-click action in the Java code that inserts some code tounmarshal an XML document into a JAXB generated class.o The menu is "Data Binding" with sub menu "Unmarshal JAXB object"o The menu option brings up a dialog where the user can select the jaxbnode; given the node it provides a list of classes in the associated packageo The inserted code is as follows:RMSWarehouseOrder obj = null;try {JAXBContext jaxbctx =JAXBContext.newInstance("");Unmarshaller unmarshaller =jaxbctx.createUnmarshaller();obj = (RMSWarehouseOrder) unmarshallerin.unmarshal(newFile("your path here"));} catch (JAXBException e) {// TODO handle exceptione.printStackTrace();}Here RMSWarehouseOrder is the selected class and"" is the package associated with the node.• Likewise there will be a similar option for marshaling a JAXB object:Page 2 of 7

JAXB WizardoooThe menu is "Data Binding" with sub menu "Marshal JAXB object"The menu option brings up a dialog where the user can select the jaxbnodeThe inserted code is as follows:try {JAXBContext jaxbctx =JAXBContext.newInstance("");Marshaller marshallerout = jaxbctx.createMarshaller();// TODO provide writerPrintWriter w = new PrintWriter(System.out);marshallerout.marshal(objectToMarshal, w);} catch (JAXBException e) {// TODO handle exceptione.printStackTrace();}Builds• The user shall be able to build the project from the command line through Ant.This should be suitable for a multi-user environment where there is no conventionon installation or checkout directories.o Consequently the jaxb binaries shall be part of the NBM or NetBeansinstallation. It is preferred to use the libraries from the web services client.o The jaxb binaries should be updateable but this does not need to beoenabled through a GUIIf the correct NBM is not installed, the build script shall notify the user ofthis.• Generated java files and classes are considered build artefacts and should not bepart of the project that will normally be checked in into CVS. One of the reasonsfor this is that this is necessary to facilitate environments where XSDs aredynamically generated or are changed often.• There shall be new targets in Ant to generate the codeExtenders• The nbm shall be delivered with a number of yet to be defined jaxb extenders.• The user shall be able to add his own jaxb extenders. These extenders may bemade available through a user-specified directory. Being able to build the projectfrom the command line may require the user to have a convention of the extenderlocation. Provisions to make this easy should be in build-impl.xml and build.xml.Packaging• The wizard will be made available through an NBM file.Page 3 of 7

JAXB WizardScreen flow:Project Node -> New -> Java XML Bindings or OtherJAXB Wizard is invoked thru Right click menu on Project node or File-> NewPage 4 of 7

JAXB WizardWizard dialog.JAXB Wizard dialog captures all the information needed for XJC ant task. LikeSchema files, Binding files, Catalog file and any options.Page 5 of 7

JAXB WizardSchema NodeSchema node will have below actions.Refresh – Refreshes Schema files from original location as in Webservices nodes.Customize JAXB options – Allow user to modify JAXB options by showing JAXBWizard dialog.Delete – Delete this node along with all the schema, binding and catalog files associated.Schema file NodeSchema file node will have below actions.Open – Opens the Schema file in the editor.Refresh – Refreshes the Schema file from original location as in Webservices.Delete – Delete this schema file.Page 7 of 7

More magazines by this user
Similar magazines