You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sh...@apache.org on 2008/03/26 10:48:36 UTC
svn commit: r641227 - in /geronimo/devtools/eclipse-plugin/trunk/plugins:
org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/
org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/
org.apache.geronimo.st....
Author: shivahr
Date: Wed Mar 26 02:48:33 2008
New Revision: 641227
URL: http://svn.apache.org/viewvc?rev=641227&view=rev
Log:
Consolidate marshalDeploymentPlan and unmarshalDeploymentPlan into JAXBUtils (this was also done in "svn commit: r640912", but then some of it got lost during "svn commit: r641128")
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java?rev=641227&r1=641226&r2=641227&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java Wed Mar 26 02:48:33 2008
@@ -41,10 +41,14 @@
private static JAXBContext jaxbContext;
{
try {
- jaxbContext = JAXBContext.newInstance("org.apache.geronimo.xml.ns.j2ee.web_2_0:"
- + "org.apache.geronimo.xml.ns.j2ee.application_2:"
- + "org.apache.geronimo.xml.ns.deployment_1:" + "org.apache.geronimo.xml.ns.naming_1:"
- + "org.apache.geronimo.xml.ns.security_2", Activator.class.getClassLoader());
+ jaxbContext = JAXBContext.newInstance(
+ "org.apache.geronimo.jee.connector:" +
+ "org.apache.geronimo.jee.openejb:" +
+ "org.apache.geronimo.jee.web:" +
+ "org.apache.geronimo.jee.application:" +
+ "org.apache.geronimo.jee.deployment:" +
+ "org.apache.geronimo.jee.naming:" +
+ "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
} catch (JAXBException e) {
Trace.tracePoint("JAXBException", "JAXBContext.newInstance");
e.printStackTrace();
@@ -76,8 +80,6 @@
} catch (JAXBException e) {
e.printStackTrace();
} catch (CoreException e) {
- e.printStackTrace();
- } catch (Exception e) {
e.printStackTrace();
}
return null;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java?rev=641227&r1=641226&r2=641227&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java Wed Mar 26 02:48:33 2008
@@ -16,10 +16,7 @@
*/
package org.apache.geronimo.st.v21.core;
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
import org.apache.geronimo.jee.application.Application;
import org.apache.geronimo.jee.connector.Connector;
@@ -29,7 +26,7 @@
import org.apache.geronimo.jee.web.WebApp;
import org.apache.geronimo.st.core.GeronimoUtils;
import org.apache.geronimo.st.core.internal.Trace;
-//port org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.server.core.IModule;
@@ -203,21 +200,7 @@
Trace.tracePoint("ENTRY", "GeronimoV21Utils.getApplicationDeploymentPlan", file);
if (file.getName().equals(APP_PLAN_NAME) && file.exists()) {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
- Unmarshaller ums = jaxbContext.createUnmarshaller();
- JAXBElement plan = (JAXBElement)ums.unmarshal( file.getContents() );
- return plan;
- } catch ( JAXBException e ) {
- e.printStackTrace();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- return null;
+ return JAXBUtils.unmarshalDeploymentPlan(file);
}
Trace.tracePoint("EXIT", "GeronimoV21Utils.getApplicationDeploymentPlan", null);
@@ -228,20 +211,7 @@
Trace.tracePoint("ENTRY", "GeronimoV21Utils.getWebDeploymentPlan", file);
if (file.getName().equals(WEB_PLAN_NAME) && file.exists()) {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment", Activator.class.getClassLoader() );
- Unmarshaller ums = jaxbContext.createUnmarshaller();
- JAXBElement plan = (JAXBElement)ums.unmarshal( file.getContents() );
- return plan;
- } catch ( JAXBException e ) {
- e.printStackTrace();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- return null;
+ return JAXBUtils.unmarshalDeploymentPlan(file);
}
Trace.tracePoint("EXIT", "GeronimoV21Utils.getWebDeploymentPlan", null);
@@ -252,22 +222,7 @@
Trace.tracePoint("ENTRY", "GeronimoV21Utils.getOpenEjbDeploymentPlan", file);
if (file.getName().equals(OPENEJB_PLAN_NAME) && file.exists()) {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.openejb:" +
- "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
- Unmarshaller ums = jaxbContext.createUnmarshaller();
- JAXBElement plan = (JAXBElement)ums.unmarshal( file.getContents() );
- return plan;
- } catch ( JAXBException e ) {
- e.printStackTrace();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- return null;
+ return JAXBUtils.unmarshalDeploymentPlan(file);
}
Trace.tracePoint("EXIT", "GeronimoV21Utils.getOpenEjbDeploymentPlan", null);
@@ -278,22 +233,7 @@
Trace.tracePoint("ENTRY", "GeronimoV21Utils.getConnectorDeploymentPlan", file);
if (file.getName().equals(CONNECTOR_PLAN_NAME) && file.exists()) {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.connector:" +
- "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
- Unmarshaller ums = jaxbContext.createUnmarshaller();
- JAXBElement plan = (JAXBElement)ums.unmarshal( file.getContents() );
- return plan;
- } catch ( JAXBException e ) {
- e.printStackTrace();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- return null;
+ return JAXBUtils.unmarshalDeploymentPlan(file);
}
Trace.tracePoint("EXIT", "GeronimoV21Utils.getConnectorDeploymentPlan", null);
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java?rev=641227&r1=641226&r2=641227&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java Wed Mar 26 02:48:33 2008
@@ -74,25 +74,5 @@
}
return null;
}
-
-//
-// public static JAXBElement unmarshalDeploymentPlan( IFile file ) {
-// try {
-// JAXBContext jb = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
-// "org.apache.geronimo.jee.application:" +
-// "org.apache.geronimo.jee.deployment:" +
-// "org.apache.geronimo.jee.naming:" +
-// "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
-// Unmarshaller ums = jb.createUnmarshaller();
-// JAXBElement plan = (JAXBElement)ums.unmarshal( file.getContents() );
-// return plan;
-// } catch ( JAXBException e ) {
-// e.printStackTrace();
-// } catch ( CoreException e ) {
-// e.printStackTrace();
-// } catch ( Exception e ) {
-// e.printStackTrace();
-// }
-// return null;
-// }
+
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java?rev=641227&r1=641226&r2=641227&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java Wed Mar 26 02:48:33 2008
@@ -16,15 +16,7 @@
*/
package org.apache.geronimo.st.v21.core.operations;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.net.MalformedURLException;
-
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
import org.apache.geronimo.jee.application.Application;
import org.apache.geronimo.jee.connector.Connector;
@@ -34,8 +26,8 @@
import org.apache.geronimo.jee.deployment.Environment;
import org.apache.geronimo.jee.openejb.GeronimoEjbJar;
import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
import org.apache.geronimo.st.core.operations.DeploymentPlanCreationOperation;
-import org.apache.geronimo.st.v21.core.Activator;
import org.apache.geronimo.st.v21.core.DeploymentPlanInstallConfig;
import org.apache.geronimo.st.v21.core.internal.Trace;
import org.eclipse.core.resources.IFile;
@@ -44,9 +36,9 @@
/**
* <strong>V21DeploymentPlanCreationOperation</strong>
- * is invoked when projects are created the are to be deployment on the 2.1
+ * is invoked when projects are created that are to be deployment on the 2.1
* version of the Geronimo server. One of these Geronimo-specific deployment
- * plans is created as a result is inserted into the user's Eclipse workspace in
+ * plans is created as a result and is inserted into the user's Eclipse workspace in
* the appropriate folder:
*
* <ol>
@@ -59,16 +51,10 @@
* Remaining TODO Task(s):
*
* <ol>
- * <li>Use the Eclipse framework IResource interface to create the files
- * above -- otherwise the user will have to refresh their workspace for the
- * contents of the file to display, and an "Out of sync" message will be
- * displayed.
* <li>JUnit testcases
* <li>JAXBElement warning messages
* <li>How to invoke Service Deployment Plan
* <li>How to invoke App Client Deployment Plan
- * <li>Consolidate marshalDeploymentPlan and unmarshalDeploymentPlan into
- * JAXBModelUtils for each specific Geronimo-specific deployment plan
* </ol>
*
* @version $Rev: 509704 $ $Date: 2007-02-20 13:42:24 -0500 (Tue, 20 Feb 2007) $
@@ -88,48 +74,20 @@
* @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createGeronimoApplicationDeploymentPlan(org.eclipse.core.resources.IFile)
*/
public JAXBElement createGeronimoApplicationDeploymentPlan(IFile dpFile) {
- Trace.tracePoint("Entry", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", dpFile);
-
+ Trace.tracePoint("Entry",
+ "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", dpFile);
+
org.apache.geronimo.jee.application.ObjectFactory applicationFactory = new org.apache.geronimo.jee.application.ObjectFactory();
Application application = applicationFactory.createApplication();
-
+
application.setApplicationName(getProject().getName());
application.setEnvironment(getConfigEnvironment());
-
- JAXBElement jaxbElement = null;
- try {
-
- //
- // Create JAXBContext with a context path containing the packages of all the
- // classes for the geronimo-application.xml file
- //
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
-
- jaxbElement = applicationFactory.createApplication(application);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.marshal(jaxbElement, new FileOutputStream( new File( dpFile.getLocationURI().toURL().getFile() )));
-
- }
- catch( JAXBException jaxbException ) {
- Trace.tracePoint("JAXBException", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", dpFile.getFullPath() );
- jaxbException.printStackTrace();
- }
- catch( FileNotFoundException fileNotFoundException ) {
- Trace.tracePoint("FileNotFoundException", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", dpFile.getFullPath() );
- fileNotFoundException.printStackTrace();
- }
- catch( MalformedURLException malformedURLException ) {
- Trace.tracePoint("MalformedURLException", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", dpFile.getFullPath() );
- malformedURLException.printStackTrace();
- }
-
- Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan", applicationFactory.createApplication(application));
+
+ JAXBElement jaxbElement = applicationFactory.createApplication(application);
+ JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);
+
+ Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createGeronimoApplicationDeploymentPlan",
+ applicationFactory.createApplication(application));
return applicationFactory.createApplication(application);
}
@@ -140,46 +98,18 @@
* @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createGeronimoWebDeploymentPlan(org.eclipse.core.resources.IFile)
*/
public JAXBElement createGeronimoWebDeploymentPlan(IFile dpFile) {
- Trace.tracePoint("Entry", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", dpFile, dpFile.getFullPath() );
+ Trace.tracePoint("Entry", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan",
+ dpFile, dpFile.getFullPath());
org.apache.geronimo.jee.web.ObjectFactory webFactory = new org.apache.geronimo.jee.web.ObjectFactory();
WebApp web = webFactory.createWebApp();
-
- web.setContextRoot( "/" + getProject().getName() );
- web.setEnvironment( getConfigEnvironment() );
-
- JAXBElement jaxbElement = null;
- try {
-
- //
- // Create JAXBContext with a context path containing the packages of all the
- // classes for the geronimo-web.xml file
- //
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment", Activator.class.getClassLoader() );
-
- jaxbElement = webFactory.createWebApp(web);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.marshal(jaxbElement, new FileOutputStream( new File( dpFile.getLocationURI().toURL().getFile() )));
-
- }
- catch( JAXBException jaxbException ) {
- Trace.tracePoint("JAXBException", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", dpFile.getFullPath() );
- jaxbException.printStackTrace();
- }
- catch( FileNotFoundException fileNotFoundException ) {
- Trace.tracePoint("FileNotFoundException", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", dpFile.getFullPath() );
- fileNotFoundException.printStackTrace();
- }
- catch( MalformedURLException malformedURLException ) {
- Trace.tracePoint("MalformedURLException", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", dpFile.getFullPath() );
- malformedURLException.printStackTrace();
- }
-
+
+ web.setContextRoot("/" + getProject().getName());
+ web.setEnvironment(getConfigEnvironment());
+
+ JAXBElement jaxbElement = webFactory.createWebApp(web);
+ JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);
+
Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", jaxbElement);
return jaxbElement;
}
@@ -197,44 +127,12 @@
GeronimoEjbJar ejbJar = ejbFactory.createGeronimoEjbJar();
ejbJar.setEnvironment(getConfigEnvironment());
-
- JAXBElement jaxbElement = null;
- try {
-
- //
- // Create JAXBContext with a context path containing the packages of all the
- // classes for the openejb-jar.xml
- //
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.openejb:" +
- "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
-
- jaxbElement = ejbFactory.createEjbJar(ejbJar);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.marshal(jaxbElement, new FileOutputStream( new File( dpFile.getLocationURI().toURL().getFile() )));
-
- }
- catch( JAXBException jaxbException ) {
- Trace.tracePoint("JAXBException", "V21DeploymentPlanCreationOperation.createOpenEjbDeploymentPlan", dpFile.getFullPath() );
- jaxbException.printStackTrace();
- }
- catch( FileNotFoundException fileNotFoundException ) {
- Trace.tracePoint("FileNotFoundException", "V21DeploymentPlanCreationOperation.createOpenEjbDeploymentPlan", dpFile.getFullPath() );
- fileNotFoundException.printStackTrace();
- }
- catch( MalformedURLException malformedURLException ) {
- Trace.tracePoint("MalformedURLException", "V21DeploymentPlanCreationOperation.createOpenEjbDeploymentPlan", dpFile.getFullPath() );
- malformedURLException.printStackTrace();
- }
-
+
+ JAXBElement jaxbElement = ejbFactory.createEjbJar(ejbJar);
+ JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);
+
Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createOpenEjbDeploymentPlan", jaxbElement);
return jaxbElement;
-
}
@@ -245,49 +143,17 @@
*/
public JAXBElement createConnectorDeploymentPlan(IFile dpFile) {
Trace.tracePoint("Entry", "V21DeploymentPlanCreationOperation.createConnectorDeploymentPlan", dpFile);
-
+
org.apache.geronimo.jee.connector.ObjectFactory connectorFactory = new org.apache.geronimo.jee.connector.ObjectFactory();
Connector connector = connectorFactory.createConnector();
-
+
connector.setEnvironment(getConfigEnvironment());
-
- JAXBElement jaxbElement = null;
- try {
-
- //
- // Create JAXBContext with a context path containing the packages of all the
- // classes for the geronimo-ra.xml
- //
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.connector:" +
- "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
-
- jaxbElement = connectorFactory.createConnector(connector);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.marshal(jaxbElement, new FileOutputStream( new File( dpFile.getLocationURI().toURL().getFile() )));
-
- }
- catch( JAXBException jaxbException ) {
- Trace.tracePoint("JAXBException", "V21DeploymentPlanCreationOperation.createConnectorDeploymentPlan", dpFile.getFullPath() );
- jaxbException.printStackTrace();
- }
- catch( FileNotFoundException fileNotFoundException ) {
- Trace.tracePoint("FileNotFoundException", "V21DeploymentPlanCreationOperation.createConnectorDeploymentPlan", dpFile.getFullPath() );
- fileNotFoundException.printStackTrace();
- }
- catch( MalformedURLException malformedURLException ) {
- Trace.tracePoint("MalformedURLException", "V21DeploymentPlanCreationOperation.createConnectorDeploymentPlan", dpFile.getFullPath() );
- malformedURLException.printStackTrace();
- }
-
+
+ JAXBElement jaxbElement = connectorFactory.createConnector(connector);
+ JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);
+
Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createConnectorDeploymentPlan", jaxbElement);
return jaxbElement;
-
}
@@ -296,41 +162,14 @@
org.apache.geronimo.jee.deployment.ObjectFactory serviceFactory = new org.apache.geronimo.jee.deployment.ObjectFactory();
org.apache.geronimo.jee.deployment.Module module = serviceFactory.createModule();
-
+
module.setEnvironment(getConfigEnvironment());
-
- JAXBElement jaxbElement = null;
- try {
-
- JAXBContext jaxbContext = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
-
- jaxbElement = serviceFactory.createModule(module);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.marshal(jaxbElement, new FileOutputStream( new File( dpFile.getLocationURI().toURL().getFile() )));
-
- }
- catch( JAXBException jaxbException ) {
- Trace.tracePoint("JAXBException", "V21DeploymentPlanCreationOperation.createServiceDeploymentPlan", dpFile.getFullPath() );
- jaxbException.printStackTrace();
- }
- catch( FileNotFoundException fileNotFoundException ) {
- Trace.tracePoint("FileNotFoundException", "V21DeploymentPlanCreationOperation.createServiceDeploymentPlan", dpFile.getFullPath() );
- fileNotFoundException.printStackTrace();
- }
- catch( MalformedURLException malformedURLException ) {
- Trace.tracePoint("MalformedURLException", "V21DeploymentPlanCreationOperation.createServiceDeploymentPlan", dpFile.getFullPath() );
- malformedURLException.printStackTrace();
- }
-
+
+ JAXBElement jaxbElement = serviceFactory.createModule(module);
+ JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);
+
Trace.tracePoint("Exit ", "V21DeploymentPlanCreationOperation.createServiceDeploymentPlan", jaxbElement);
return jaxbElement;
-
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java?rev=641227&r1=641226&r2=641227&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java Wed Mar 26 02:48:33 2008
@@ -16,20 +16,18 @@
*/
package org.apache.geronimo.st.v21.ui.editors;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
+import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
import org.apache.geronimo.st.ui.CommonMessages;
import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
import org.apache.geronimo.st.ui.editors.AbstractGeronimoFormContentLoader;
import org.apache.geronimo.st.v21.core.GeronimoV21Utils;
import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
-import org.apache.geronimo.st.v21.ui.Activator;
import org.apache.geronimo.st.v21.ui.pages.AppGeneralPage;
import org.apache.geronimo.st.v21.ui.pages.ConnectorOverviewPage;
import org.apache.geronimo.st.v21.ui.pages.DeploymentPage;
@@ -37,7 +35,6 @@
import org.apache.geronimo.st.v21.ui.pages.NamingFormPage;
import org.apache.geronimo.st.v21.ui.pages.SecurityPage;
import org.apache.geronimo.st.v21.ui.pages.WebGeneralPage;
-import org.apache.geronimo.jee.security.Security;
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -102,13 +99,7 @@
}
public void saveDeploymentPlan(JAXBElement deploymentPlan, IFile file) throws IOException, JAXBException {
- JAXBContext jb = JAXBContext.newInstance( "org.apache.geronimo.jee.web:" +
- "org.apache.geronimo.jee.application:" +
- "org.apache.geronimo.jee.deployment:" +
- "org.apache.geronimo.jee.naming:" +
- "org.apache.geronimo.jee.security", Activator.class.getClassLoader() );
- jb.createMarshaller().marshal( deploymentPlan, new FileOutputStream( new File( file.getLocationURI().toURL().getFile()) ) );
- //jb.createMarshaller().marshal( deploymentPlan, new File( file.getLocationURI().toURL().getFile()) );
+ JAXBUtils.marshalDeploymentPlan(deploymentPlan, file);
}
protected FormPage getWebNamingPage(FormEditor editor) {