/Users/detro/workspace-nb/JAEBI/src/java/org/jaebi/test/server/service/MainTestServicePackage.java

Vai alla documentazione di questo file.
00001 /*
00002  * MainTestServicePackage.java
00003  *
00004  * Created on June 11, 2005, 11:49 AM
00005  *
00006  * To change this template, choose Tools | Options and locate the template under
00007  * the Source Creation and Management node. Right-click the template and choose
00008  * Open. You can then make changes to the template in the Source Editor.
00009  */
00010 
00011 package org.jaebi.test.server.service;
00012 
00013 import java.io.File;
00014 
00015 import org.jaebi.server.service.BackEndHandler;
00016 import org.jaebi.server.service.BackEndHandlerImpl;
00017 import org.jaebi.server.service.XRequestCommand;
00018 import org.jaebi.server.service.XRequestCommandFactory;
00019 import org.jaebi.server.service.exception.BackEndHandlerInitException;
00020 import org.jaebi.server.service.exception.CommandCreationException;
00021 import org.jaebi.server.service.exception.CommandExecException;
00022 import org.jaebi.server.service.exception.XRequestCommandFactoryInitException;
00023 import org.jaebi.server.service.xml.JAXBMarshallerWrapper;
00024 import org.jaebi.server.service.xml.JAXBMarshallerWrapperImpl;
00025 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperInitException;
00026 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperMarshallException;
00027 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperUnmarshallException;
00028 import org.jaebi.server.service.xml.xrequest.Xrequest;
00029 import org.jaebi.server.service.xml.xresponse.Xresponse;
00030 
00035 public class MainTestServicePackage {
00036     
00040     public static void main(String[] args) {
00041         BackEndHandler beh = null;
00042         JAXBMarshallerWrapper marshWrap;
00043         
00044         Xrequest newReq = null;
00045         Xresponse newRes = null;
00046         
00047         File sourceFile = new File("/Users/detro/workspace-nb/L2-Project-JAEBI/xrequest-example.xml");
00048         XRequestCommandFactory commFact;
00049         XRequestCommand newCommand = null;
00050         
00051         String result = null;
00052         
00053         
00054         try {
00055             beh = new BackEndHandlerImpl();
00056         } catch ( BackEndHandlerInitException behie ) {
00057             System.out.println("Errore: " + behie);
00058             behie.printStackTrace();
00059         }
00060         
00061         try {
00062             marshWrap = new JAXBMarshallerWrapperImpl("org.jaebi.server.service.xml.xrequest");
00063             newReq = (Xrequest)marshWrap.unmarshall(sourceFile);
00064         } catch ( JAXBMarshallerWrapperInitException inite) {
00065             inite.printStackTrace();
00066         } catch ( JAXBMarshallerWrapperUnmarshallException unmarshe) {
00067             unmarshe.printStackTrace();
00068         }
00069         
00070         try {
00071             commFact = new XRequestCommandFactory(beh);
00072             newCommand = commFact.createCommand(newReq);
00073         } catch ( XRequestCommandFactoryInitException inite) {
00074             inite.printStackTrace();
00075         } catch ( CommandCreationException cce) {
00076             cce.printStackTrace();
00077         }
00078         
00079         System.out.println("Command Creato: \n" + newCommand );
00080         
00081         try {
00082             newRes = (Xresponse)newCommand.execute();
00083         } catch ( CommandExecException cee ) {
00084             cee.printStackTrace();
00085         }
00086         
00087         try {
00088             JAXBMarshallerWrapper marshWrapResp = new JAXBMarshallerWrapperImpl("org.jaebi.server.service.xml.xresponse");
00089             marshWrapResp.setFormattedMarshalling(true);
00090             result = marshWrapResp.marshall(newRes);
00091         } catch ( JAXBMarshallerWrapperInitException inite) {
00092             inite.printStackTrace();
00093         } catch ( JAXBMarshallerWrapperMarshallException marshe) {
00094             marshe.printStackTrace();
00095         }
00096         
00097         System.out.println("Risultato Command: \n" + result);
00098     }
00099     
00100 }

Generato il Mon Jun 27 22:50:38 2005 per JAEBI - JAva Enterprice BackEnd Interfacement da  doxygen 1.4.3