plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/jaxbmodel/operations/JAXB21Utils.java [102:157]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception {
        try {
            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.setListener(marshallerListener);

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.newDocument(); 

            marshaller.marshal(jaxbElement, doc);

            TransformerFactory xf = TransformerFactory.newInstance();
            try {
            	xf.setAttribute("indent-number", new Integer(4));
            } catch (IllegalArgumentException iae) {
                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
            }
            Transformer xformer = xf.newTransformer();
            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 

            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
            NamespacePrefix.processPrefix(doc);

            xformer.transform(new DOMSource(doc), out);
            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
            if(file.exists()) {
                file.setContents(inBuffer, true, false, null);
            } else {
                prepareFolder(file.getParent());
                file.create(inBuffer, true, null);
            }
        } catch (JAXBException jaxbException) {
            Trace.tracePoint("JAXBException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
            throw jaxbException;
        } catch (CoreException coreException) {
            Trace.tracePoint("CoreException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
            throw coreException;
        } catch (ParserConfigurationException e) {
        	Trace.tracePoint("ParserConfigurationException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
        	throw e;
		} catch (TransformerConfigurationException e) {
			Trace.tracePoint("TransformerConfigurationException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		} catch (UnsupportedEncodingException e) {
			Trace.tracePoint("UnsupportedEncodingException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		} catch (TransformerException e) {
			Trace.tracePoint("TransformerException", Activator.logOperations, "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		}
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/j2ee/jaxbmodel/operations/JAXB11Utils.java [98:153]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception {
        try {
            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.setListener(marshallerListener);

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.newDocument(); 

            marshaller.marshal(jaxbElement, doc);

            TransformerFactory xf = TransformerFactory.newInstance();
            try {
            	xf.setAttribute("indent-number", new Integer(4));
            } catch (IllegalArgumentException iae) {
                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
            }
            Transformer xformer = xf.newTransformer();
            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 

            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
            NamespacePrefix.processPrefix(doc);

            xformer.transform(new DOMSource(doc), out);
            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
            if(file.exists()) {
                file.setContents(inBuffer, true, false, null);
            } else {
                prepareFolder(file.getParent());
                file.create(inBuffer, true, null);
            }
        } catch (JAXBException jaxbException) {
            Trace.tracePoint("JAXBException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
            throw jaxbException;
        } catch (CoreException coreException) {
            Trace.tracePoint("CoreException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
            throw coreException;
        } catch (ParserConfigurationException e) {
        	Trace.tracePoint("ParserConfigurationException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
        	throw e;
		} catch (TransformerConfigurationException e) {
			Trace.tracePoint("TransformerConfigurationException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		} catch (UnsupportedEncodingException e) {
			Trace.tracePoint("UnsupportedEncodingException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		} catch (TransformerException e) {
			Trace.tracePoint("TransformerException", Activator.logOperations, "JAXB11Utils.marshalDeploymentPlan()", file.getFullPath());
			throw e;
		}
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



