Index: src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoPanel.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoPanel.java (revision 1768) +++ src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoPanel.java (working copy) @@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Text; import org.teiid.core.util.StringUtil; import com.metamatrix.core.util.I18nUtil; +import com.metamatrix.modeler.dqp.ui.DqpUiConstants; import com.metamatrix.modeler.dqp.ui.DqpUiPlugin; import com.metamatrix.modeler.dqp.ui.DqpUiStringUtil; import com.metamatrix.ui.internal.InternalUiConstants; @@ -43,6 +44,7 @@ private static final String I18N_PREFIX = I18nUtil.getPropertyPrefix(WarDeploymentInfoDialog.class); protected static final String INITIAL_MESSAGE = getString("initialMessage"); //$NON-NLS-1$ private static final String SECURITY_OPTIONS_GROUP = getString("securityOptionsGroup"); //$NON-NLS-1$ + private static final String GENERAL_OPTIONS_GROUP = getString("generalOptionsGroup"); //$NON-NLS-1$ private static final String BASIC_OPTIONS_GROUP = getString("basicOptionsGroup"); //$NON-NLS-1$ private static final String WS_SECURITY_OPTIONS_GROUP = getString("wsSecurityOptionsGroup"); //$NON-NLS-1$ @@ -63,8 +65,10 @@ public static final String NOSECURITY = getString("noSecurityButton"); //$NON-NLS-1$ public static final String BASIC = getString("basicButton"); //$NON-NLS-1$ public static final String WSSE = getString("wsSecurityButton"); //$NON-NLS-1$ + public static final String MTOM = getString("mtomButton"); //$NON-NLS-1$ protected Text txfJNDIName; protected Button noSecurityButton, basicSecurityButton, wsSecurityButton; + protected Button mtomButton; private Button warBrowseButton; private Button restoreDefaultButton; @@ -168,7 +172,7 @@ } else this.noSecurityButton.setSelection(true); } catch (RuntimeException err) { - DqpUiPlugin.UTIL.log(err); + DqpUiConstants.UTIL.log(err); } } @@ -363,6 +367,24 @@ this.txfSecurityPassword.setEnabled(false); } + final Group generalOptionsGroup = WidgetFactory.createGroup(pnlContents, + GENERAL_OPTIONS_GROUP, + GridData.FILL_HORIZONTAL, + 3); + { + + this.mtomButton = WidgetFactory.createCheckBox(generalOptionsGroup, MTOM, false); + text = getString("mtomTooltip"); //$NON-NLS-1$ + this.mtomButton.setToolTipText(text); + this.mtomButton.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected( final SelectionEvent event ) { + handleMtomButtonSelected(); + } + }); + } + // namespace Label this.NAMESPACE = getString("namespaceLabel"); //$NON-NLS-1$ WidgetFactory.createLabel(pnlContents, GridData.HORIZONTAL_ALIGN_BEGINNING, 1, this.NAMESPACE); @@ -391,7 +413,7 @@ handleWarBrowseSourceSelected(); } }); - + } void setConnectionTypeModified() { @@ -417,6 +439,7 @@ text = getString("restoreDefaultTooltip"); //$NON-NLS-1$ this.restoreDefaultButton.setToolTipText(text); this.restoreDefaultButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected( final SelectionEvent event ) { restoreDefaultButtonPressed(); } @@ -430,6 +453,7 @@ private void addListeners() { ModifyListener modifyListener = new ModifyListener() { + @Override public void modifyText( ModifyEvent theEvent ) { validatePage(); setWarFileNameInDialog(); @@ -452,12 +476,7 @@ dialog.setWarFileName(txfContext.getText()); } - /** - * restore default values for text fields. - * - * @since 7.1 - */ - private void restoreDefaultButtonPressed() { + void restoreDefaultButtonPressed() { this.txfWarFileDeploymentLocation.setText(WarDataserviceModel.getInstance().getWarFilenameDefault()); this.txfContext.setText(WarDataserviceModel.getInstance().getContextNameDefault()); this.txfHost.setText(WarDataserviceModel.getInstance().getHostNameDefault()); @@ -467,6 +486,7 @@ this.noSecurityButton.setSelection(true); this.basicSecurityButton.setSelection(false); this.wsSecurityButton.setSelection(false); + this.mtomButton.setSelection(false); this.txfSecurityRealm.setText(StringUtil.Constants.EMPTY_STRING); this.txfSecurityRealm.setEnabled(false); this.txfSecurityRole.setText(StringUtil.Constants.EMPTY_STRING); @@ -491,6 +511,14 @@ } /** + * @since 7.5 + */ + void handleMtomButtonSelected() { + boolean selection = this.mtomButton.getSelection(); + WarDataserviceModel.getInstance().setUseMtom(selection); + } + + /** * @since 7.1.1 */ void noSecurityButtonSelected() { Index: src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDialog.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDialog.java (revision 1768) +++ src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDialog.java (working copy) @@ -29,6 +29,7 @@ import org.teiid.designer.dqp.webservice.war.WebArchiveBuilderFactory; import com.metamatrix.core.util.I18nUtil; import com.metamatrix.modeler.core.workspace.ModelResource; +import com.metamatrix.modeler.dqp.ui.DqpUiConstants; import com.metamatrix.modeler.dqp.ui.DqpUiPlugin; import com.metamatrix.modeler.webservice.WebServicePlugin; import com.metamatrix.ui.internal.util.WidgetFactory; @@ -80,7 +81,7 @@ this.theVdb = theVdb; this.wsModelResourcearrayList = wsModelResources; this.initialStatus = initialStatus; - deploymentStatus = new Status(IStatus.OK, DqpUiPlugin.PLUGIN_ID, IStatus.OK, "WAR file created successfully", null);//$NON-NLS-1$ + deploymentStatus = new Status(IStatus.OK, DqpUiConstants.PLUGIN_ID, IStatus.OK, "WAR file created successfully", null);//$NON-NLS-1$ } // ///////////////////////////////////////////////////////////////////////////////////////////// @@ -123,7 +124,7 @@ } protected static String getString( final String id ) { - return DqpUiPlugin.UTIL.getString(I18N_PREFIX + id); + return DqpUiConstants.UTIL.getString(I18N_PREFIX + id); } @Override @@ -145,6 +146,7 @@ // create VDB resource final IRunnableWithProgress op = new IRunnableWithProgress() { + @Override public void run( final IProgressMonitor monitor ) throws InvocationTargetException { try { execute(monitor); @@ -161,14 +163,13 @@ if (err instanceof InvocationTargetException) { err = ((InvocationTargetException)err).getTargetException(); } - DqpUiPlugin.UTIL.log(err); + DqpUiConstants.UTIL.log(err); } } @Override public int open() { - // TODO Auto-generated method stub int rc = super.open(); if (rc != CANCEL) { @@ -192,17 +193,17 @@ } if (createWar) { - monitor.beginTask(DqpUiPlugin.UTIL.getString(CREATING_WAR_FILE_MESSAGE_ID, warFileName), 100); + monitor.beginTask(DqpUiConstants.UTIL.getString(CREATING_WAR_FILE_MESSAGE_ID, warFileName), 100); deploymentStatus = webArchiveBuilder.createWebArchive(WarDataserviceModel.getInstance().getProperties(), monitor); // log status - DqpUiPlugin.UTIL.log(deploymentStatus); + DqpUiConstants.UTIL.log(deploymentStatus); setMessage(deploymentStatus.getMessage(), deploymentStatus.getSeverity()); super.okPressed(); } } catch (RuntimeException err) { // BusyCursor.endBusy(); - DqpUiPlugin.UTIL.log(err); + DqpUiConstants.UTIL.log(err); setMessage("Error while generating the WAR file check log for detail message.", InternalModelerWarUiConstants.ERROR); //$NON-NLS-1$ } } @@ -231,6 +232,7 @@ loadTnsDefault(); loadJndiNameDefault(); loadSecurityTypeDefault(); + loadUseMTOMDefault(); WarDataserviceModel.getInstance().setVdbFile(theVdb); WarDataserviceModel.getInstance().setWsModelResourcearrayList(wsModelResourcearrayList); @@ -249,7 +251,20 @@ String warDir = WebServicePlugin.getDefaultWarFileSaveLocation(); WarDataserviceModel.getInstance().setWarFilenameDefault(warDir); } catch (Throwable theThrowable) { - DqpUiPlugin.UTIL.log(theThrowable); + DqpUiConstants.UTIL.log(theThrowable); + } + } + + /** + * set default war file location + * + * @since 7.5 + */ + private void loadUseMTOMDefault() { + try { + WarDataserviceModel.getInstance().setUseMtom(false); + } catch (Throwable theThrowable) { + DqpUiConstants.UTIL.log(theThrowable); } } @@ -271,7 +286,7 @@ WarDataserviceModel.getInstance().setContextNameDefault(name); } catch (Throwable theThrowable) { - DqpUiPlugin.UTIL.log(theThrowable); + DqpUiConstants.UTIL.log(theThrowable); } } @@ -308,7 +323,7 @@ * @since 7.1 */ private void loadJndiNameDefault() { - WarDataserviceModel.getInstance().setJndiNameDefault("java:{REPLACE_WITH_VDB_JNDI_NAME}");//$NON-NLS-1$ + WarDataserviceModel.getInstance().setJndiNameDefault("{REPLACE_WITH_VDB_JNDI_NAME}");//$NON-NLS-1$ } /** Index: src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDataPage.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDataPage.java (revision 1768) +++ src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDeploymentInfoDataPage.java (working copy) @@ -16,7 +16,7 @@ import org.teiid.core.util.FileUtils; import org.teiid.designer.dqp.webservice.war.WebArchiveBuilder; import org.teiid.designer.dqp.webservice.war.WebArchiveBuilderFactory; -import com.metamatrix.modeler.dqp.ui.DqpUiPlugin; +import com.metamatrix.modeler.dqp.ui.DqpUiConstants; /** * @since 7.1 @@ -48,7 +48,7 @@ protected void validatePage() { boolean isValid = validateContext() && validatePort() && validateHost() && validateJNDI() && validateTNS() - && validateWARFileFolder() && validateSecurityRole() && validateSecurityRealm() + && validateWARFileFolder() && validateSecurityRole() && validateSecurityRealm() && validateSecurityUsername() && validateSecurityPassword(); if (!isValid) { @@ -67,7 +67,7 @@ private void createStatus( int statusCode, String msg, int validationStatusCode ) { - status = new Status(statusCode, DqpUiPlugin.PLUGIN_ID, validationStatusCode, msg, null); + status = new Status(statusCode, DqpUiConstants.PLUGIN_ID, validationStatusCode, msg, null); } /** @@ -181,7 +181,7 @@ return true; } - + /** * validate target security realm * @@ -191,22 +191,22 @@ private boolean validateSecurityRealm() { String text = txfSecurityRealm.getText(); - if (this.basicSecurityButton.getSelection()){ - - if (text == null || text.length() == 0) { + if (this.basicSecurityButton.getSelection()) { + + if (text == null || text.length() == 0) { ERROR_MESSAGE = getString("securityRealmMessage");//$NON-NLS-1$ createStatus(IStatus.ERROR, ERROR_MESSAGE, InternalModelerWarUiConstants.VALIDATEREALM); return false; } } - + WarDataserviceModel.getInstance().setSecurityRealmDefault(text); this.settings.put(this.SECURITY_REALM, text); return true; } - + /** * validate security username * @@ -216,22 +216,22 @@ private boolean validateSecurityUsername() { String text = txfSecurityUsername.getText(); - if (this.wsSecurityButton.getSelection()){ - - if (text == null || text.length() == 0) { + if (this.wsSecurityButton.getSelection()) { + + if (text == null || text.length() == 0) { ERROR_MESSAGE = getString("securityUsernameMessage");//$NON-NLS-1$ createStatus(IStatus.ERROR, ERROR_MESSAGE, InternalModelerWarUiConstants.VALIDATEUSERNAME); return false; } } - + WarDataserviceModel.getInstance().setSecurityUsernameDefault(text); this.settings.put(this.SECURITY_USERNAME, text); return true; } - + /** * validate security password * @@ -240,23 +240,23 @@ */ private boolean validateSecurityPassword() { - String text = txfSecurityPassword.getText(); - if (this.wsSecurityButton.getSelection()){ - - if (text == null || text.length() == 0) { + String text = txfSecurityPassword.getText(); + if (this.wsSecurityButton.getSelection()) { + + if (text == null || text.length() == 0) { ERROR_MESSAGE = getString("securityPasswordMessage");//$NON-NLS-1$ createStatus(IStatus.ERROR, ERROR_MESSAGE, InternalModelerWarUiConstants.VALIDATEPASSWORD); return false; } } - + WarDataserviceModel.getInstance().setSecurityPasswordDefault(text); this.settings.put(this.SECURITY_PASSWORD, text); return true; } - + /** * validate target security role * @@ -266,16 +266,16 @@ private boolean validateSecurityRole() { String text = txfSecurityRole.getText(); - if (this.basicSecurityButton.getSelection()){ - - if (text == null || text.length() == 0) { + if (this.basicSecurityButton.getSelection()) { + + if (text == null || text.length() == 0) { ERROR_MESSAGE = getString("securityRoleMessage");//$NON-NLS-1$ createStatus(IStatus.ERROR, ERROR_MESSAGE, InternalModelerWarUiConstants.VALIDATEREALM); return false; } } - + WarDataserviceModel.getInstance().setSecurityRoleDefault(text); this.settings.put(this.SECURITY_ROLE, text); Index: src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDataserviceModel.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDataserviceModel.java (revision 1768) +++ src/org/teiid/designer/dqp/webservice/war/ui/wizards/WarDataserviceModel.java (working copy) @@ -31,6 +31,7 @@ private String securityRole; private String securityUsername; private String securityPassword; + private boolean useMtom; private String warFilenameDefault; private String hostNameDefault; @@ -43,6 +44,7 @@ private String securityRoleDefault; private String securityUsernameDefault; private String securityPasswordDefault; + private boolean useMtomDefault; private IFile theVdb; private ArrayList wsModelResourceArrayList; @@ -200,7 +202,7 @@ * @since 7.1 */ public void setJndiNameDefault( String jndiNameDefault ) { - // this.jndiNameDefault = jndiNameDefault; + this.jndiNameDefault = jndiNameDefault; this.jndiName = jndiNameDefault; } @@ -502,6 +504,34 @@ } /** + * @param useMtomDefault Sets useMtomDefault to the specified value. + */ + public void setUseMtomDefault( boolean useMtomDefault ) { + this.useMtomDefault = useMtomDefault; + } + + /** + * @return useMtomDefault + */ + public boolean getUseMtomDefault() { + return useMtomDefault; + } + + /** + * @param useMtom Sets useMtom to the specified value. + */ + public void setUseMtom( boolean useMtom ) { + this.useMtom = useMtom; + } + + /** + * @return useMtom + */ + public boolean getUseMtom() { + return useMtom; + } + + /** * @return * @since 7.1 */ @@ -520,8 +550,9 @@ properties.put(WebArchiveBuilderConstants.PROPERTY_SECURITY_REALM, this.getSecurityRealm()); properties.put(WebArchiveBuilderConstants.PROPERTY_SECURITY_ROLE, this.getSecurityRole()); properties.put(WebArchiveBuilderConstants.PROPERTY_SECURITY_USERNAME, this.getSecurityUsername()); - properties.put(WebArchiveBuilderConstants.PROPERTY_SECURITY_PASSWORD, this.getSecurityPassword()); + properties.put(WebArchiveBuilderConstants.PROPERTY_USE_MTOM, this.getUseMtom()); return properties; } + } Index: src/org/teiid/designer/dqp/webservice/war/DefaultWebArchiveBuilderImpl.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/DefaultWebArchiveBuilderImpl.java (revision 1775) +++ src/org/teiid/designer/dqp/webservice/war/DefaultWebArchiveBuilderImpl.java (working copy) @@ -24,14 +24,12 @@ import java.util.List; import java.util.Map; import java.util.Properties; - import javax.tools.JavaCompiler; +import javax.tools.JavaCompiler.CompilationTask; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.StandardLocation; import javax.tools.ToolProvider; -import javax.tools.JavaCompiler.CompilationTask; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -49,7 +47,6 @@ import org.eclipse.xsd.util.XSDParser; import org.teiid.core.util.StringUtil; import org.teiid.designer.dqp.webservice.war.ui.wizards.WarDeploymentInfoPanel; - import com.metamatrix.core.modeler.util.FileUtils; import com.metamatrix.core.util.TempDirectory; import com.metamatrix.modeler.core.types.DatatypeConstants; @@ -69,892 +66,774 @@ */ public class DefaultWebArchiveBuilderImpl implements WebArchiveBuilder { - private IPath webServicePluginPath = null; - private List ports = new ArrayList(); - private Map operationToProcedureMap = new HashMap(); - private String wsdlFilename = StringUtil.Constants.EMPTY_STRING; + private IPath webServicePluginPath = null; + private List ports = new ArrayList(); + private Map operationToProcedureMap = new HashMap(); + private String wsdlFilename = StringUtil.Constants.EMPTY_STRING; + private static final String JNDI_PREFIX = "java:"; //$NON-NLS-1$ - // ============================================================= - // Constants - // ============================================================= - private static final String I18N_PREFIX = "WebArchiveBuilder."; //$NON-NLS-1$ - private static final String TASK_CREATE_DIRECTORIES = getString("taskCreateDirectory"); //$NON-NLS-1$ - private static final String TASK_COPYING_FILES = getString("taskCopyingFiles"); //$NON-NLS-1$ - private static final String TASK_CREATING_WSDL_FILE = getString("taskCreatingWSDLFile"); //$NON-NLS-1$ - private static final String TASK_CREATING_WAR_ARCHIVE = getString("taskCreatingWarArchive"); //$NON-NLS-1$ - private static final String TASK_COPYING_WAR_FILE = getString("taskCopyingWarFile"); //$NON-NLS-1$ - private static final String TASK_CLEANUP = getString("taskCleanup"); //$NON-NLS-1$ + // ============================================================= + // Constants + // ============================================================= + private static final String I18N_PREFIX = "WebArchiveBuilder."; //$NON-NLS-1$ + private static final String TASK_CREATE_DIRECTORIES = getString("taskCreateDirectory"); //$NON-NLS-1$ + private static final String TASK_COPYING_FILES = getString("taskCopyingFiles"); //$NON-NLS-1$ + private static final String TASK_CREATING_WSDL_FILE = getString("taskCreatingWSDLFile"); //$NON-NLS-1$ + private static final String TASK_CREATING_WAR_ARCHIVE = getString("taskCreatingWarArchive"); //$NON-NLS-1$ + private static final String TASK_COPYING_WAR_FILE = getString("taskCopyingWarFile"); //$NON-NLS-1$ + private static final String TASK_CLEANUP = getString("taskCleanup"); //$NON-NLS-1$ - /** - * This constructor is package protected, so that only the factory can call - * it. - * - * @since 7.1 - */ - public DefaultWebArchiveBuilderImpl() { - } + /** + * This constructor is package protected, so that only the factory can call it. + * + * @since 7.1 + */ + public DefaultWebArchiveBuilderImpl() { + } - /** - * @param ports - * Sets ports to the specified value. These names are used for - * the dynamic generation of servlets in the web.xml, the - * jbossws-cxf.xml endpoints and the wsprovider java files. - */ - public void setPorts(List ports) { - this.ports = ports; - } + /** + * @param ports Sets ports to the specified value. These names are used for the dynamic generation of servlets in the web.xml, + * the jbossws-cxf.xml endpoints and the wsprovider java files. + */ + public void setPorts( List ports ) { + this.ports = ports; + } - /** - * @return ports - */ - public List getPorts() { - return ports; - } + /** + * @return ports + */ + public List getPorts() { + return ports; + } - /** - * @return operationToProcedureMap - */ - public Map getOperationToProcedureMap() { - return operationToProcedureMap; - } + /** + * @return operationToProcedureMap + */ + public Map getOperationToProcedureMap() { + return operationToProcedureMap; + } - /** - * @param operationToProcedureMap - * Sets operationToProcedureMap to the specified value. - */ - public void setOperationToProcedureMap( - Map operationToProcedureMap) { - this.operationToProcedureMap = operationToProcedureMap; - } + /** + * @param operationToProcedureMap Sets operationToProcedureMap to the specified value. + */ + public void setOperationToProcedureMap( Map operationToProcedureMap ) { + this.operationToProcedureMap = operationToProcedureMap; + } - public IStatus validateContextName(String contextName) { + @Override + public IStatus validateContextName( String contextName ) { - try { - final String URL_BASE = "http://www.teiid.org/"; //$NON-NLS-1$ - final URLValidator urlValidator = new URLValidator(); + try { + final String URL_BASE = "http://www.teiid.org/"; //$NON-NLS-1$ + final URLValidator urlValidator = new URLValidator(); - // Check for invalid characters - String[] invalidChars = new String[] { "/" //$NON-NLS-1$ - , "\\" //$NON-NLS-1$ - , StringUtil.Constants.SPACE }; - final String invalidChar = validateInvalidCharactersInContextName( - contextName, invalidChars); + // Check for invalid characters + String[] invalidChars = new String[] {"/" //$NON-NLS-1$ + , "\\" //$NON-NLS-1$ + , StringUtil.Constants.SPACE}; + final String invalidChar = validateInvalidCharactersInContextName(contextName, invalidChars); - // Perform validation - if (invalidChar != null) { + // Perform validation + if (invalidChar != null) { - String msg = null; - if (StringUtil.Constants.SPACE.equals(invalidChar)) { - msg = getString("ContextNameValidationFailed_InvalidSpace"); //$NON-NLS-1$ - } else { - final Object[] params = new Object[] { invalidChar }; - msg = getString( - "ContextNameValidationFailed_InvalidCharacter", params); //$NON-NLS-1$ - } + String msg = null; + if (StringUtil.Constants.SPACE.equals(invalidChar)) { + msg = getString("ContextNameValidationFailed_InvalidSpace"); //$NON-NLS-1$ + } else { + final Object[] params = new Object[] {invalidChar}; + msg = getString("ContextNameValidationFailed_InvalidCharacter", params); //$NON-NLS-1$ + } - return new Status( - IStatus.ERROR, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, - msg, null); - } else if (StringUtil.Constants.EMPTY_STRING.equals(contextName)) { + return new Status(IStatus.ERROR, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, msg, null); + } else if (StringUtil.Constants.EMPTY_STRING.equals(contextName)) { - final String msg = getString("ContextNameValidationFailed_Empty"); //$NON-NLS-1$ - return new Status( - IStatus.ERROR, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, - msg, null); - } else if (!urlValidator.isValidValue(URL_BASE + contextName)) { + final String msg = getString("ContextNameValidationFailed_Empty"); //$NON-NLS-1$ + return new Status(IStatus.ERROR, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, msg, null); + } else if (!urlValidator.isValidValue(URL_BASE + contextName)) { - final String msg = getString("ContextNameValidationFailed"); //$NON-NLS-1$ - return new Status( - IStatus.ERROR, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, - msg, null); - } else { + final String msg = getString("ContextNameValidationFailed"); //$NON-NLS-1$ + return new Status(IStatus.ERROR, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, msg, null); + } else { - final String msg = getString("ContextNameValidationSucceeded"); //$NON-NLS-1$ - return new Status( - IStatus.OK, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_SUCCEEDED, - msg, null); - } - } catch (Exception e) { + final String msg = getString("ContextNameValidationSucceeded"); //$NON-NLS-1$ + return new Status(IStatus.OK, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_SUCCEEDED, msg, null); + } + } catch (Exception e) { - final String msg = getString("ContextNameValidationFailed"); //$NON-NLS-1$ - return new Status( - IStatus.ERROR, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, - msg, e); - } - } + final String msg = getString("ContextNameValidationFailed"); //$NON-NLS-1$ + return new Status(IStatus.ERROR, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_CONTEXT_NAME_VALIDATION_FAILED, msg, e); + } + } - /** - * @see com.metamatrix.modeler.dataservices.lds.WebArchiveBuilder#createWebArchive(java.io.InputStream, - * java.util.Map) - * @since 7.1 - */ - public IStatus createWebArchive(Properties properties, - IProgressMonitor monitor) { + /** + * @see com.metamatrix.modeler.dataservices.lds.WebArchiveBuilder#createWebArchive(java.io.InputStream, java.util.Map) + * @since 7.1 + */ + @Override + public IStatus createWebArchive( Properties properties, + IProgressMonitor monitor ) { - try { + try { - // Get and validate the context name. - final String contextName = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); - IStatus status = validateContextName(contextName); + // Get and validate the context name. + final String contextName = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); + IStatus status = validateContextName(contextName); - if (IStatus.ERROR == status.getSeverity()) { + if (IStatus.ERROR == status.getSeverity()) { - throw new Exception(status.getException()); - } + throw new Exception(status.getException()); + } - // Get the build directory and create it if it doesn't already - // exist. - final String webServicePluginPath = getWSPluginInstallPath() - .toOSString(); - final String buildDirectoryName = webServicePluginPath - + File.separator + WebArchiveBuilderConstants.BUILD_DIR; - File buildDirectory = new File(buildDirectoryName); - buildDirectory.mkdir(); + // Get the build directory and create it if it doesn't already + // exist. + final String webServicePluginPath = getWSPluginInstallPath().toOSString(); + final String buildDirectoryName = webServicePluginPath + File.separator + WebArchiveBuilderConstants.BUILD_DIR; + File buildDirectory = new File(buildDirectoryName); + buildDirectory.mkdir(); - monitor.subTask(TASK_CREATE_DIRECTORIES); - // Get the work directory, create it (in case it is not there) and - // try to empty it. - final String workDirectoryName = buildDirectoryName - + File.separator + WebArchiveBuilderConstants.WORK_DIR; - File workDirectory = new File(workDirectoryName); - workDirectory.mkdir(); - FileUtils.removeChildrenRecursively(workDirectory); - // Create the temporary directory. - final TempDirectory tempDir = TempDirectory - .getTempDirectory(workDirectoryName); - final String tempDirectoryName = tempDir.getPath(); - // Create context directory. - final String contextDirectoryName = tempDirectoryName - + File.separator + contextName; - final File contextDirectory = new File(contextDirectoryName); - contextDirectory.mkdir(); - // Create the images directory. - final String imagesDirectoryName = contextDirectoryName - + File.separator + "images"; //$NON-NLS-1$ - final File imagesDirectory = new File(imagesDirectoryName); - imagesDirectory.mkdir(); - // Create the WEB-INF directory. - final String webInfDirectoryName = contextDirectoryName - + File.separator + "WEB-INF"; //$NON-NLS-1$ - final File webInfDirectory = new File(webInfDirectoryName); - webInfDirectory.mkdir(); - // Create the classes directory. - final String webInfClassesDirectoryName = webInfDirectoryName - + File.separator + "classes"; //$NON-NLS-1$ - // Create the classes directory. - final String webInfLibDirectoryName = webInfDirectoryName - + File.separator + "lib"; //$NON-NLS-1$ - final File webInfClassesDirectory = new File( - webInfClassesDirectoryName); - final File webInfLibDirectory = new File(webInfLibDirectoryName); - webInfLibDirectory.mkdir(); - webInfClassesDirectory.mkdir(); - monitor.worked(10); + monitor.subTask(TASK_CREATE_DIRECTORIES); + // Get the work directory, create it (in case it is not there) and + // try to empty it. + final String workDirectoryName = buildDirectoryName + File.separator + WebArchiveBuilderConstants.WORK_DIR; + File workDirectory = new File(workDirectoryName); + workDirectory.mkdir(); + FileUtils.removeChildrenRecursively(workDirectory); + // Create the temporary directory. + final TempDirectory tempDir = TempDirectory.getTempDirectory(workDirectoryName); + final String tempDirectoryName = tempDir.getPath(); + // Create context directory. + final String contextDirectoryName = tempDirectoryName + File.separator + contextName; + final File contextDirectory = new File(contextDirectoryName); + contextDirectory.mkdir(); + // Create the images directory. + final String imagesDirectoryName = contextDirectoryName + File.separator + "images"; //$NON-NLS-1$ + final File imagesDirectory = new File(imagesDirectoryName); + imagesDirectory.mkdir(); + // Create the WEB-INF directory. + final String webInfDirectoryName = contextDirectoryName + File.separator + "WEB-INF"; //$NON-NLS-1$ + final File webInfDirectory = new File(webInfDirectoryName); + webInfDirectory.mkdir(); + // Create the classes directory. + final String webInfClassesDirectoryName = webInfDirectoryName + File.separator + "classes"; //$NON-NLS-1$ + // Create the classes directory. + final String webInfLibDirectoryName = webInfDirectoryName + File.separator + "lib"; //$NON-NLS-1$ + final File webInfClassesDirectory = new File(webInfClassesDirectoryName); + final File webInfLibDirectory = new File(webInfLibDirectoryName); + webInfLibDirectory.mkdir(); + webInfClassesDirectory.mkdir(); + monitor.worked(10); - monitor.subTask(TASK_CREATING_WSDL_FILE); - // Create WSDL file - generateWsdl(properties, webInfClassesDirectory); + monitor.subTask(TASK_CREATING_WSDL_FILE); + // Create WSDL file + generateWsdl(properties, webInfClassesDirectory); - monitor.subTask(TASK_COPYING_FILES); - // Copy the Web files. - getWebFiles(contextDirectory, webInfDirectory); + monitor.subTask(TASK_COPYING_FILES); + // Copy the Web files. + getWebFiles(contextDirectory, webInfDirectory); - if (properties.getProperty( - WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals( - WarDeploymentInfoPanel.BASIC)) { - // Replace the variables in the jboss-web.xml file. - replaceJBossWebXmlVariables( - webInfDirectoryName, - properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_REALM)); - } + if (properties.getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals(WarDeploymentInfoPanel.BASIC)) { + // Replace the variables in the jboss-web.xml file. + replaceJBossWebXmlVariables(webInfDirectoryName, + properties.getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_REALM)); + } - // Replace the variables in the web.xml file. - replaceWebXmlVariables(webInfDirectoryName, properties, contextName); - // Replace the variables in the jbossws-cxf.xml file. - replaceJBossWSCXFVariables(webInfDirectoryName, properties); - // Create properties file and write to classes root. - createPropertiesFile(webInfClassesDirectory, properties); - // Create and compile Provider files (one per port). - createProviderJavaClasses(webInfLibDirectory, - webInfClassesDirectory, properties); + // Replace the variables in the web.xml file. + replaceWebXmlVariables(webInfDirectoryName, properties, contextName); + // Replace the variables in the jbossws-cxf.xml file. + replaceJBossWSCXFVariables(webInfDirectoryName, properties); + // Create properties file and write to classes root. + createPropertiesFile(webInfClassesDirectory, properties); + // Create and compile Provider files (one per port). + createProviderJavaClasses(webInfLibDirectory, webInfClassesDirectory, properties); - monitor.worked(10); + monitor.worked(10); - monitor.subTask(TASK_CREATING_WAR_ARCHIVE); - // ZIP everything in the context directory into the new WAR file. - final String warFileName = tempDirectoryName + File.separator - + contextName + ".war"; //$NON-NLS-1$ - AntTasks.zip(contextDirectoryName, warFileName); - monitor.worked(20); + monitor.subTask(TASK_CREATING_WAR_ARCHIVE); + // ZIP everything in the context directory into the new WAR file. + final String warFileName = tempDirectoryName + File.separator + contextName + ".war"; //$NON-NLS-1$ + AntTasks.zip(contextDirectoryName, warFileName); + monitor.worked(20); - // Get the target directory. If it doesn't exist, create it. - final String newWarFileDir = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION); - File newWarDir = new File(newWarFileDir); - if (!newWarDir.exists()) { - newWarDir.mkdir(); - } + // Get the target directory. If it doesn't exist, create it. + final String newWarFileDir = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION); + File newWarDir = new File(newWarFileDir); + if (!newWarDir.exists()) { + newWarDir.mkdir(); + } - monitor.subTask(TASK_COPYING_WAR_FILE); - // Move the temporary WAR file to its destination. - final File warFile = new File(warFileName); - final String newWarFileName = getFileName( - (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION), - contextName + ".war"); //$NON-NLS-1$ - File newWarFile = new File(newWarFileName); - if (newWarFile.exists()) { - if (!newWarFile.delete()) { - String msg = getString("WebArchiveCreationFailed_CouldNotDeleteExistingWARFile"); //$NON-NLS-1$ - throw new Exception(msg); - } - } - if (!warFile.renameTo(newWarFile)) { - String msg = getString("WebArchiveCreationFailed_CouldNotSaveWARFile"); //$NON-NLS-1$ - throw new Exception(msg); - } - // Delete the temp directory. - monitor.subTask(TASK_CLEANUP); - tempDir.remove(); - monitor.worked(5); - } catch (Exception e) { + monitor.subTask(TASK_COPYING_WAR_FILE); + // Move the temporary WAR file to its destination. + final File warFile = new File(warFileName); + final String newWarFileName = getFileName((String)properties.get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION), + contextName + ".war"); //$NON-NLS-1$ + File newWarFile = new File(newWarFileName); + if (newWarFile.exists()) { + if (!newWarFile.delete()) { + String msg = getString("WebArchiveCreationFailed_CouldNotDeleteExistingWARFile"); //$NON-NLS-1$ + throw new Exception(msg); + } + } + if (!warFile.renameTo(newWarFile)) { + String msg = getString("WebArchiveCreationFailed_CouldNotSaveWARFile"); //$NON-NLS-1$ + throw new Exception(msg); + } + // Delete the temp directory. + monitor.subTask(TASK_CLEANUP); + tempDir.remove(); + monitor.worked(5); + } catch (Exception e) { - final String msg = getString("WebArchiveCreationFailed"); //$NON-NLS-1$ - final IStatus status = new Status( - IStatus.ERROR, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_WAR_FILE_CREATION_FAILED, - msg, e); + final String msg = getString("WebArchiveCreationFailed"); //$NON-NLS-1$ + final IStatus status = new Status(IStatus.ERROR, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_WAR_FILE_CREATION_FAILED, msg, e); - // Log the error. - WebServicePlugin.Util.log(status); + // Log the error. + WebServicePlugin.Util.log(status); - return status; - } + return status; + } - // Creating the WAR file was successful - final String msg = getString("WebArchiveCreationSucceeded"); //$NON-NLS-1$ - final IStatus status = new Status( - IStatus.OK, - WebServicePlugin.PLUGIN_ID, - WebArchiveBuilderConstants.STATUS_CODE_WAR_FILE_CREATION_SUCCEEDED, - msg, null); + // Creating the WAR file was successful + final String msg = getString("WebArchiveCreationSucceeded"); //$NON-NLS-1$ + final IStatus status = new Status(IStatus.OK, WebServicePlugin.PLUGIN_ID, + WebArchiveBuilderConstants.STATUS_CODE_WAR_FILE_CREATION_SUCCEEDED, msg, null); - return status; - } + return status; + } - public boolean targetWarFileExists(Properties properties) { - boolean fileExists = false; + @Override + public boolean targetWarFileExists( Properties properties ) { + boolean fileExists = false; - // Get and validate the context name. - final String contextName = properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); - IStatus status = validateContextName(contextName); + // Get and validate the context name. + final String contextName = properties.getProperty(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); + IStatus status = validateContextName(contextName); - if (IStatus.ERROR == status.getSeverity()) { - fileExists = true; - return fileExists; - } + if (IStatus.ERROR == status.getSeverity()) { + fileExists = true; + return fileExists; + } - final String newWarFileName = getFileName( - (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION), - contextName + ".war"); //$NON-NLS-1$ + final String newWarFileName = getFileName((String)properties.get(WebArchiveBuilderConstants.PROPERTY_WAR_FILE_SAVE_LOCATION), + contextName + ".war"); //$NON-NLS-1$ - fileExists = (new File(newWarFileName)).exists(); + fileExists = (new File(newWarFileName)).exists(); - return fileExists; - } + return fileExists; + } - protected static String getString(final String id) { - return WebServicePlugin.Util.getString(I18N_PREFIX + id); - } + protected static String getString( final String id ) { + return WebServicePlugin.Util.getString(I18N_PREFIX + id); + } - protected static String getString(final String id, final Object[] params) { - return WebServicePlugin.Util.getString(I18N_PREFIX + id, params); - } + protected static String getString( final String id, + final Object[] params ) { + return WebServicePlugin.Util.getString(I18N_PREFIX + id, params); + } - /** - * This method validates if any of the specified invalid characters are in - * the input context then a null value will be returned. Note: the - * characters are in String format. - * - * @param contextName - * @param chars - * @return - * @since 7.1 - */ - private String validateInvalidCharactersInContextName(String contextName, - String[] invalidChars) { + /** + * This method validates if any of the specified invalid characters are in the input context then a null value will be + * returned. Note: the characters are in String format. + * + * @param contextName + * @param chars + * @return + * @since 7.1 + */ + private String validateInvalidCharactersInContextName( String contextName, + String[] invalidChars ) { - int numChars = invalidChars.length; - for (int charCounter = 0; charCounter < numChars; charCounter++) { - final String invalidChar = invalidChars[charCounter]; + int numChars = invalidChars.length; + for (int charCounter = 0; charCounter < numChars; charCounter++) { + final String invalidChar = invalidChars[charCounter]; - if (contextName.indexOf(invalidChar) >= 0) { - return invalidChar; - } - } + if (contextName.indexOf(invalidChar) >= 0) { + return invalidChar; + } + } - return null; - } + return null; + } - /** - * Returns a file name for the specified path and name. - * - * @param path - * @param name - * @return - * @since 7.1 - */ - private String getFileName(String path, String name) { + /** + * Returns a file name for the specified path and name. + * + * @param path + * @param name + * @return + * @since 7.1 + */ + private String getFileName( String path, + String name ) { - String fileName = path; - if (!fileName.endsWith("/") && !fileName.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ + String fileName = path; + if (!fileName.endsWith("/") && !fileName.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ - fileName = fileName + File.separator; - } - fileName = fileName + name; + fileName = fileName + File.separator; + } + fileName = fileName + name; - return fileName; - } + return fileName; + } - /** - * Copies Web files into the WAR build directory structure. - * - * @param contextDirectory - * @param webInfDirectory - * @since 7.1 - */ - private void getWebFiles(File contextDirectory, File webInfDirectory) - throws Exception { + /** + * Copies Web files into the WAR build directory structure. + * + * @param contextDirectory + * @param webInfDirectory + * @since 7.1 + */ + private void getWebFiles( File contextDirectory, + File webInfDirectory ) throws Exception { - // Copy all of the Web files - final String webLibPath = getWebLibDirectoryPath(); - final String webAppsDirectoryName = webLibPath + File.separator - + "webapps"; //$NON-NLS-1$ - final File webAppsDirectory = new File(webAppsDirectoryName); - FileUtils.copyRecursively(webAppsDirectory, contextDirectory, null, - false); - } + // Copy all of the Web files + final String webLibPath = getWebLibDirectoryPath(); + final String webAppsDirectoryName = webLibPath + File.separator + "webapps"; //$NON-NLS-1$ + final File webAppsDirectory = new File(webAppsDirectoryName); + FileUtils.copyRecursively(webAppsDirectory, contextDirectory, null, false); + } - /** - * Replace the variables in the web.xml file with their appropriate values. - * - * @param webInfDirectoryName - * @param properties - * @param contextName - * @since 7.1 - */ - protected void replaceWebXmlVariables(String webInfDirectoryName, - Properties properties, String contextName) { + /** + * Replace the variables in the web.xml file with their appropriate values. + * + * @param webInfDirectoryName + * @param properties + * @param contextName + * @since 7.1 + */ + protected void replaceWebXmlVariables( String webInfDirectoryName, + Properties properties, + String contextName ) { - // Replace variables in the web.xml file. - File webXmlFile = new File(webInfDirectoryName + File.separator - + "web.xml"); //$NON-NLS-1$ + // Replace variables in the web.xml file. + File webXmlFile = new File(webInfDirectoryName + File.separator + "web.xml"); //$NON-NLS-1$ - // Update for Basic Auth if HTTPBasic security is selected - if (properties.getProperty( - WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals( - WarDeploymentInfoPanel.BASIC)) { - String realm = properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_REALM); - String role = properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_ROLE); + // Update for Basic Auth if HTTPBasic security is selected + if (properties.getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals(WarDeploymentInfoPanel.BASIC)) { + String realm = properties.getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_REALM); + String role = properties.getProperty(WebArchiveBuilderConstants.PROPERTY_SECURITY_ROLE); - AntTasks.replace(webXmlFile, - "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - AntTasks.replace(webXmlFile, - "", StringUtil.Constants.EMPTY_STRING); //$NON-NLS-1$ - } + AntTasks.replace(webXmlFile, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + AntTasks.replace(webXmlFile, "", StringUtil.Constants.EMPTY_STRING); //$NON-NLS-1$ + } - AntTasks.replace(webXmlFile, "${warname}", contextName); //$NON-NLS-1$ - AntTasks.replace(webXmlFile, - "${servlets}", createServletTags(getPorts())); //$NON-NLS-1$ - } + AntTasks.replace(webXmlFile, "${warname}", contextName); //$NON-NLS-1$ + AntTasks.replace(webXmlFile, "${servlets}", createServletTags(getPorts())); //$NON-NLS-1$ + } - /** - * Replace the variables in the web.xml file with their appropriate values. - * - * @param webInfDirectoryName - * @param properties - * @param contextName - * @since 7.1 - */ - protected void replaceJBossWebXmlVariables(String webInfDirectoryName, - String securityDomain) { + /** + * Replace the variables in the web.xml file with their appropriate values. + * + * @param webInfDirectoryName + * @param properties + * @param contextName + * @since 7.1 + */ + protected void replaceJBossWebXmlVariables( String webInfDirectoryName, + String securityDomain ) { - // Replace variables in the jboss-web.xml file. - File jbossWebXmlFile = new File(webInfDirectoryName + File.separator - + "jboss-web.xml"); //$NON-NLS-1$ + // Replace variables in the jboss-web.xml file. + File jbossWebXmlFile = new File(webInfDirectoryName + File.separator + "jboss-web.xml"); //$NON-NLS-1$ - String securityDomainNode = "java:/jaas/" + securityDomain + ""; //$NON-NLS-1$ //$NON-NLS-2$ + String securityDomainNode = "java:/jaas/" + securityDomain + ""; //$NON-NLS-1$ //$NON-NLS-2$ - AntTasks - .replace( - jbossWebXmlFile, - "", securityDomainNode); //$NON-NLS-1$ - } + AntTasks.replace(jbossWebXmlFile, + "", securityDomainNode); //$NON-NLS-1$ + } - /** - * Replace the variables in the jbossws-cxf.xml file with their appropriate - * values. - * - * @param webInfDirectoryName - * @param properties - * @since 7.1 - */ - protected void replaceJBossWSCXFVariables(String webInfDirectoryName, - Properties properties) { + /** + * Replace the variables in the jbossws-cxf.xml file with their appropriate values. + * + * @param webInfDirectoryName + * @param properties + * @since 7.1 + */ + protected void replaceJBossWSCXFVariables( String webInfDirectoryName, + Properties properties ) { - // Replace variables in the jbossws-cxf.xml file. - File jbossWSCxfXMLFile = new File(webInfDirectoryName + File.separator - + "jbossws-cxf.xml"); //$NON-NLS-1$ + // Replace variables in the jbossws-cxf.xml file. + File jbossWSCxfXMLFile = new File(webInfDirectoryName + File.separator + "jbossws-cxf.xml"); //$NON-NLS-1$ - AntTasks - .replace( - jbossWSCxfXMLFile, - "${jaxws.endpoint}", createEndpointTags(properties, getPorts())); //$NON-NLS-1$ + AntTasks.replace(jbossWSCxfXMLFile, "${jaxws.endpoint}", createEndpointTags(properties, getPorts())); //$NON-NLS-1$ - if (isWSSecurity(properties)) { - AntTasks.replace(jbossWSCxfXMLFile, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } + if (isWSSecurity(properties)) { + AntTasks.replace(jbossWSCxfXMLFile, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } - } + } - /** - * Create the teiidsoap.properties file. - * - * @param webInfClassesDirectory - * @param properties - * @since 7.1 - */ - protected void createPropertiesFile(File webInfClassesDirectory, - Properties properties) throws IOException { + /** + * Create the teiidsoap.properties file. + * + * @param webInfClassesDirectory + * @param properties + * @since 7.1 + */ + protected void createPropertiesFile( File webInfClassesDirectory, + Properties properties ) throws IOException { - // Create teiidsoap.properties file - File teiisSoapProperties = new File(webInfClassesDirectory - + File.separator + "teiidsoap.properties"); //$NON-NLS-1$ - String jndiValue = properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_JNDI_NAME); + // Create teiidsoap.properties file + File teiisSoapProperties = new File(webInfClassesDirectory + File.separator + "teiidsoap.properties"); //$NON-NLS-1$ + String jndiValue = properties.getProperty(WebArchiveBuilderConstants.PROPERTY_JNDI_NAME); - FileWriter fstream = null; - BufferedWriter out = null; - try { - // Create file - fstream = new FileWriter(teiisSoapProperties); - out = new BufferedWriter(fstream); - Iterator it = operationToProcedureMap.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry) it.next(); - out.write(pairs.getKey() + "=" + pairs.getValue() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - } - out.write(WebArchiveBuilderConstants.PROPERTY_JNDI_NAME - + "=" + jndiValue); //$NON-NLS-1$ - } finally { - // Close the output stream - out.close(); - } - } + if (jndiValue != null && !jndiValue.startsWith(JNDI_PREFIX)) { + jndiValue = JNDI_PREFIX + jndiValue; + } - /** - * Create the WSProvider java classes (one for each port) - * - * @param webInfClassesDirectory - * @param properties - * @since 7.1 - */ - protected void createProviderJavaClasses(File webInfLibDirectory, - File webInfClassesDirectory, Properties properties) - throws IOException { + FileWriter fstream = null; + BufferedWriter out = null; + try { + // Create file + fstream = new FileWriter(teiisSoapProperties); + out = new BufferedWriter(fstream); + Iterator it = operationToProcedureMap.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pairs = (Map.Entry)it.next(); + out.write(pairs.getKey() + "=" + pairs.getValue() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + out.write(WebArchiveBuilderConstants.PROPERTY_JNDI_NAME + "=" + jndiValue); //$NON-NLS-1$ + } finally { + // Close the output stream + out.close(); + } + } - String pathToProviders = "/org" + File.separator + "teiid" + File.separator + "soap" + File.separator + "provider"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String pathToCallback = "/org" + File.separator + "teiid" + File.separator + "soap" + File.separator + "wsse"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String pathToPlugin = "/org" + File.separator + "teiid" + File.separator + "soap"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - final String tns = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); - String vdbFileName = properties - .getProperty(WebArchiveBuilderConstants.PROPERTY_VDB_FILE_NAME); - File vdbFile = new File(FileUtils - .getFilenameWithoutExtension(vdbFileName)); + /** + * Create the WSProvider java classes (one for each port) + * + * @param webInfClassesDirectory + * @param properties + * @since 7.1 + */ + protected void createProviderJavaClasses( File webInfLibDirectory, + File webInfClassesDirectory, + Properties properties ) throws IOException { - List portProviders = new ArrayList(); - for (String port : getPorts()) { - String providerJavaFilePath = webInfClassesDirectory - .getCanonicalPath() - + pathToProviders + File.separator + port + ".java"; //$NON-NLS-1$ - FileUtils.copy(webInfClassesDirectory.getCanonicalPath() - + pathToProviders + File.separator - + "ProviderTemplate.java", //$NON-NLS-1$ - providerJavaFilePath, true); - File providerJavaFile = new File(providerJavaFilePath); - portProviders.add(providerJavaFile); - AntTasks.replace(providerJavaFile, "${className}", port); //$NON-NLS-1$ - AntTasks.replace(providerJavaFile, "${targetNamespace}", tns); //$NON-NLS-1$ - AntTasks.replace(providerJavaFile, "${portName}", port); //$NON-NLS-1$ - AntTasks.replace(providerJavaFile, - "${serviceName}", vdbFile.getName()); //$NON-NLS-1$ - AntTasks.replace(providerJavaFile, - "${wsdlFileName}", this.wsdlFilename); //$NON-NLS-1$ - } + String pathToProviders = "/org" + File.separator + "teiid" + File.separator + "soap" + File.separator + "provider"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + String pathToCallback = "/org" + File.separator + "teiid" + File.separator + "soap" + File.separator + "wsse"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + String pathToPlugin = "/org" + File.separator + "teiid" + File.separator + "soap"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + final String tns = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); + String vdbFileName = properties.getProperty(WebArchiveBuilderConstants.PROPERTY_VDB_FILE_NAME); + File vdbFile = new File(FileUtils.getFilenameWithoutExtension(vdbFileName)); - File template = new File(webInfClassesDirectory.getCanonicalPath() - + pathToProviders + File.separator + "ProviderTemplate.java"); //$NON-NLS-1$ + List portProviders = new ArrayList(); + for (String port : getPorts()) { + String providerJavaFilePath = webInfClassesDirectory.getCanonicalPath() + pathToProviders + File.separator + port + + ".java"; //$NON-NLS-1$ + FileUtils.copy(webInfClassesDirectory.getCanonicalPath() + pathToProviders + File.separator + "ProviderTemplate.java", //$NON-NLS-1$ + providerJavaFilePath, + true); + File providerJavaFile = new File(providerJavaFilePath); + portProviders.add(providerJavaFile); + AntTasks.replace(providerJavaFile, "${className}", port); //$NON-NLS-1$ + AntTasks.replace(providerJavaFile, "${targetNamespace}", tns); //$NON-NLS-1$ + AntTasks.replace(providerJavaFile, "${portName}", port); //$NON-NLS-1$ + AntTasks.replace(providerJavaFile, "${serviceName}", vdbFile.getName()); //$NON-NLS-1$ + AntTasks.replace(providerJavaFile, "${wsdlFileName}", this.wsdlFilename); //$NON-NLS-1$ + } - File soapPlugin = new File(webInfClassesDirectory.getCanonicalPath() - + pathToPlugin + File.separator + "SoapPlugin.java"); //$NON-NLS-1$ + File template = new File(webInfClassesDirectory.getCanonicalPath() + pathToProviders + File.separator + + "ProviderTemplate.java"); //$NON-NLS-1$ - File teiidProvider = new File(webInfClassesDirectory.getCanonicalPath() - + pathToProviders + File.separator + "TeiidWSProvider.java"); //$NON-NLS-1$ + File soapPlugin = new File(webInfClassesDirectory.getCanonicalPath() + pathToPlugin + File.separator + "SoapPlugin.java"); //$NON-NLS-1$ - File usernameCallback = new File(webInfClassesDirectory - .getCanonicalPath() - + pathToCallback - + File.separator - + "UsernamePasswordCallback.java"); //$NON-NLS-1$ + File teiidProvider = new File(webInfClassesDirectory.getCanonicalPath() + pathToProviders + File.separator + + "TeiidWSProvider.java"); //$NON-NLS-1$ - if (isWSSecurity(properties)) { - AntTasks - .replace( - usernameCallback, - "${username}", (String) properties.get(WebArchiveBuilderConstants.PROPERTY_SECURITY_USERNAME)); //$NON-NLS-1$ - AntTasks - .replace( - usernameCallback, - "${password}", (String) properties.get(WebArchiveBuilderConstants.PROPERTY_SECURITY_PASSWORD)); //$NON-NLS-1$ - } + File usernameCallback = new File(webInfClassesDirectory.getCanonicalPath() + pathToCallback + File.separator + + "UsernamePasswordCallback.java"); //$NON-NLS-1$ - template.delete(); - // Compile classes - JavaCompiler compilerTool = ToolProvider.getSystemJavaCompiler(); - if (compilerTool != null) { - StandardJavaFileManager fileManager = compilerTool - .getStandardFileManager(null, null, null); + if (isWSSecurity(properties)) { + AntTasks.replace(usernameCallback, + "${username}", (String)properties.get(WebArchiveBuilderConstants.PROPERTY_SECURITY_USERNAME)); //$NON-NLS-1$ + AntTasks.replace(usernameCallback, + "${password}", (String)properties.get(WebArchiveBuilderConstants.PROPERTY_SECURITY_PASSWORD)); //$NON-NLS-1$ + } - String pathToWSSEJar = webInfLibDirectory.getCanonicalPath() - + File.separator + "wss4j.jar"; //$NON-NLS-1$ + template.delete(); + // Compile classes + JavaCompiler compilerTool = ToolProvider.getSystemJavaCompiler(); + if (compilerTool != null) { + StandardJavaFileManager fileManager = compilerTool.getStandardFileManager(null, null, null); - File wsseJar = new File(pathToWSSEJar); - List classPaths = Arrays.asList(wsseJar); - fileManager.setLocation(StandardLocation.CLASS_PATH, classPaths); + String pathToWSSEJar = webInfLibDirectory.getCanonicalPath() + File.separator + "wss4j.jar"; //$NON-NLS-1$ - // prepare the source files to compile - List sourceFileList = new ArrayList(); - sourceFileList.add(soapPlugin); - sourceFileList.add(teiidProvider); - if (isWSSecurity(properties)) { - sourceFileList.add(usernameCallback); - } - for (File providerClass : portProviders) { - sourceFileList.add(providerClass); - } + File wsseJar = new File(pathToWSSEJar); + List classPaths = Arrays.asList(wsseJar); + fileManager.setLocation(StandardLocation.CLASS_PATH, classPaths); - Iterable compilationUnits = fileManager - .getJavaFileObjectsFromFiles(sourceFileList); - CompilationTask task = compilerTool.getTask(null, fileManager, - null, null, null, compilationUnits); - task.call(); - fileManager.close(); + // prepare the source files to compile + List sourceFileList = new ArrayList(); + sourceFileList.add(soapPlugin); + sourceFileList.add(teiidProvider); + if (isWSSecurity(properties)) { + sourceFileList.add(usernameCallback); + } + for (File providerClass : portProviders) { + sourceFileList.add(providerClass); + } - // Cleanup wsse.jar. Only needed for dynamic compilation. - wsseJar.delete(); - webInfLibDirectory.delete(); - } - } + Iterable compilationUnits = fileManager.getJavaFileObjectsFromFiles(sourceFileList); + CompilationTask task = compilerTool.getTask(null, fileManager, null, null, null, compilationUnits); + task.call(); + fileManager.close(); - private boolean isWSSecurity(Properties properties) { - return properties - .get(WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals( - WarDeploymentInfoPanel.WSSE); - } + // Cleanup wsse.jar. Only needed for dynamic compilation. + wsseJar.delete(); + webInfLibDirectory.delete(); + } + } - /** - * Return the path to the lib directory - * - * @return - * @throws Exception - * @since 7.1 - */ - private String getWebLibDirectoryPath() throws Exception { - final String webServicePluginPath = getWSPluginInstallPath() - .toOSString(); - final String webServiceLibFolder = webServicePluginPath - + File.separator + "war_resources"; //$NON-NLS-1$ - if (new File(webServiceLibFolder).exists()) { - return webServiceLibFolder; - } - final String msg = WebServicePlugin.Util - .getString( - "DefaultWebArchiveBuilderImpl.web_lib_directory_does_not_exist", webServiceLibFolder); //$NON-NLS-1$ - WebServicePlugin.Util.log(IStatus.ERROR, msg); - throw new FileNotFoundException(msg); - } + private boolean isWSSecurity( Properties properties ) { + return properties.get(WebArchiveBuilderConstants.PROPERTY_SECURITY_TYPE).equals(WarDeploymentInfoPanel.WSSE); + } - public IPath getWSPluginInstallPath() throws IOException { - if (this.webServicePluginPath == null) { - URL url = FileLocator.find(WebServicePlugin.getInstance() - .getBundle(), new Path(""), null); //$NON-NLS-1$ - url = FileLocator.toFileURL(url); - this.webServicePluginPath = new Path(url.getFile()); - } + private boolean isUseMTOM( Properties properties ) { + return properties.get(WebArchiveBuilderConstants.PROPERTY_USE_MTOM).equals(Boolean.TRUE); + } - return (IPath) this.webServicePluginPath.clone(); - } + /** + * Return the path to the lib directory + * + * @return + * @throws Exception + * @since 7.1 + */ + private String getWebLibDirectoryPath() throws Exception { + final String webServicePluginPath = getWSPluginInstallPath().toOSString(); + final String webServiceLibFolder = webServicePluginPath + File.separator + "war_resources"; //$NON-NLS-1$ + if (new File(webServiceLibFolder).exists()) { + return webServiceLibFolder; + } + final String msg = WebServicePlugin.Util.getString("DefaultWebArchiveBuilderImpl.web_lib_directory_does_not_exist", webServiceLibFolder); //$NON-NLS-1$ + WebServicePlugin.Util.log(IStatus.ERROR, msg); + throw new FileNotFoundException(msg); + } - class URLValidator implements Serializable { - /** + public IPath getWSPluginInstallPath() throws IOException { + if (this.webServicePluginPath == null) { + URL url = FileLocator.find(WebServicePlugin.getInstance().getBundle(), new Path(""), null); //$NON-NLS-1$ + url = FileLocator.toFileURL(url); + this.webServicePluginPath = new Path(url.getFile()); + } + + return (IPath)this.webServicePluginPath.clone(); + } + + class URLValidator implements Serializable { + /** */ - private static final long serialVersionUID = -4756137226908808631L; + private static final long serialVersionUID = -4756137226908808631L; - public boolean isValidValue(Object value) { - if (value instanceof String) { - try { - new URL(value.toString()); - } catch (MalformedURLException e) { - return false; - } - return true; - } else if (value instanceof URL) { - return true; - } else { - return false; - } - } - } + public boolean isValidValue( Object value ) { + if (value instanceof String) { + try { + new URL(value.toString()); + } catch (MalformedURLException e) { + return false; + } + return true; + } else if (value instanceof URL) { + return true; + } else { + return false; + } + } + } - public void generateWsdl(Properties properties, File classesFolder) - throws IOException { + public void generateWsdl( Properties properties, + File classesFolder ) throws IOException { - BasicWsdlGenerator wsdlGenerator = new BasicWsdlGenerator(); - ModelResource wsModel = null; - final String contextName = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); - final String host = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WAR_HOST); - final String port = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WAR_PORT); - final String tns = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); - final ArrayList modelsArrayList = (ArrayList) properties - .get(WebArchiveBuilderConstants.PROPERTY_VDB_WS_MODELS); - String webServiceName = contextName; - for (ModelResource webServiceModel : modelsArrayList) { - try { - wsModel = webServiceModel; - wsdlGenerator.addWebServiceModel(webServiceModel - .getEmfResource()); - ArrayList dependentSchemas = new ArrayList(); - IResource[] iResources = WorkspaceResourceFinderUtil - .getDependentResources(webServiceModel.getResource()); - getAllDependentSchemas(iResources, dependentSchemas); - for (IResource iResource : dependentSchemas) { - if (ModelIdentifier.isSchemaModel(iResource)) { - // Copy the XSD file to the classes folder - XSDSchema xsdSchema = importSchema(iResource - .getLocationURI().toString()); + BasicWsdlGenerator wsdlGenerator = new BasicWsdlGenerator(); + ModelResource wsModel = null; + final String contextName = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); + final String host = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WAR_HOST); + final String port = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WAR_PORT); + final String tns = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); + final ArrayList modelsArrayList = (ArrayList)properties.get(WebArchiveBuilderConstants.PROPERTY_VDB_WS_MODELS); + String webServiceName = contextName; + for (ModelResource webServiceModel : modelsArrayList) { + try { + wsModel = webServiceModel; + wsdlGenerator.addWebServiceModel(webServiceModel.getEmfResource()); + ArrayList dependentSchemas = new ArrayList(); + IResource[] iResources = WorkspaceResourceFinderUtil.getDependentResources(webServiceModel.getResource()); + getAllDependentSchemas(iResources, dependentSchemas); + for (IResource iResource : dependentSchemas) { + if (ModelIdentifier.isSchemaModel(iResource)) { + // Copy the XSD file to the classes folder + XSDSchema xsdSchema = importSchema(iResource.getLocationURI().toString()); - // Check for an import of the global data types schema - if (containsGlobalDataTypeImport(xsdSchema)) { - // Copy the builtInDataTypes.xsd file to the war - Resource builtInDataypesResource = ModelerSdtPlugin - .getBuiltInTypesResource(); - FileUtils.copy(new File(builtInDataypesResource - .getURI().path()), classesFolder, true); - // Copy iResource to classesFolder - File xsd = new File(iResource.getLocation() - .toOSString()); - FileUtils.copy(xsd, classesFolder, true); - // Get handle to new file in classesFolder - File xsdCopy = new File(classesFolder.getPath() - + "/" + iResource.getName()); //$NON-NLS-1$ - // Replace the schemaLocation of the global data - // types schema import with the relative path to xsd - AntTasks - .replace( - xsdCopy, - "schemaLocation=\"http://www.metamatrix.com/metamodels/SimpleDatatypes-instance\"", //$NON-NLS-1$ - "schemaLocation=\"builtInDataTypes.xsd\""); //$NON-NLS-1$ - } else { - FileUtils.copy(new File(iResource.getLocation() - .toOSString()), classesFolder, true); - } + // Check for an import of the global data types schema + if (containsGlobalDataTypeImport(xsdSchema)) { + // Copy the builtInDataTypes.xsd file to the war + Resource builtInDataypesResource = ModelerSdtPlugin.getBuiltInTypesResource(); + FileUtils.copy(new File(builtInDataypesResource.getURI().path()), classesFolder, true); + // Copy iResource to classesFolder + File xsd = new File(iResource.getLocation().toOSString()); + FileUtils.copy(xsd, classesFolder, true); + // Get handle to new file in classesFolder + File xsdCopy = new File(classesFolder.getPath() + "/" + iResource.getName()); //$NON-NLS-1$ + // Replace the schemaLocation of the global data + // types schema import with the relative path to xsd + AntTasks.replace(xsdCopy, + "schemaLocation=\"http://www.metamatrix.com/metamodels/SimpleDatatypes-instance\"", //$NON-NLS-1$ + "schemaLocation=\"builtInDataTypes.xsd\""); //$NON-NLS-1$ + } else { + FileUtils.copy(new File(iResource.getLocation().toOSString()), classesFolder, true); + } - wsdlGenerator.addXsdModel(importSchema(iResource. - getLocationURI().toString()), iResource - .getLocation()); - } - } - } catch (ModelWorkspaceException e) { - throw new RuntimeException(e.getMessage()); - } - } + wsdlGenerator.addXsdModel(importSchema(iResource.getLocationURI().toString()), iResource.getLocation()); + } + } + } catch (ModelWorkspaceException e) { + throw new RuntimeException(e.getMessage()); + } + } - wsdlGenerator.setName(webServiceName); - wsdlGenerator.setTargetNamespace(tns); - wsdlGenerator - .setUrlRootForReferences(StringUtil.Constants.EMPTY_STRING); - wsdlGenerator - .setUrlSuffixForReferences(StringUtil.Constants.EMPTY_STRING); - wsdlGenerator - .setUrlForWsdlService("http://" + host + ":" + port + "/" + contextName + "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - final IStatus status = wsdlGenerator - .generate(new NullProgressMonitor()); + wsdlGenerator.setName(webServiceName); + wsdlGenerator.setTargetNamespace(tns); + wsdlGenerator.setUrlRootForReferences(StringUtil.Constants.EMPTY_STRING); + wsdlGenerator.setUrlSuffixForReferences(StringUtil.Constants.EMPTY_STRING); + wsdlGenerator.setUrlForWsdlService("http://" + host + ":" + port + "/" + contextName + "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + final IStatus status = wsdlGenerator.generate(new NullProgressMonitor()); - // nothing more to do if an error is expected - if (status.getSeverity() == IStatus.ERROR) { - throw new RuntimeException("Unable to generate WSDL"); //$NON-NLS-1$ - } + // nothing more to do if an error is expected + if (status.getSeverity() == IStatus.ERROR) { + throw new RuntimeException("Unable to generate WSDL"); //$NON-NLS-1$ + } - String fileName = webServiceName + ".wsdl"; //$NON-NLS-1$ - wsdlFilename = fileName; - try { - // Create our WSDL file and write to it - OutputStream stream = new FileOutputStream(new File(classesFolder, - fileName)); - wsdlGenerator.write(stream); - // Get an iFile instance to refresh our workspace - IFile iFile = wsModel.getModelProject().getProject().getFile( - fileName); - iFile.refreshLocal(IResource.DEPTH_INFINITE, - new NullProgressMonitor()); - setPorts(wsdlGenerator.getPorts()); - setOperationToProcedureMap(wsdlGenerator - .getOperationToProcedureMap()); + String fileName = webServiceName + ".wsdl"; //$NON-NLS-1$ + wsdlFilename = fileName; + try { + // Create our WSDL file and write to it + OutputStream stream = new FileOutputStream(new File(classesFolder, fileName)); + wsdlGenerator.write(stream); + // Get an iFile instance to refresh our workspace + IFile iFile = wsModel.getModelProject().getProject().getFile(fileName); + iFile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + setPorts(wsdlGenerator.getPorts()); + setOperationToProcedureMap(wsdlGenerator.getOperationToProcedureMap()); - } catch (IOException e) { - throw new RuntimeException(e.getMessage()); - } catch (CoreException e) { - throw new RuntimeException(e.getMessage()); - } + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } catch (CoreException e) { + throw new RuntimeException(e.getMessage()); + } - } + } - public static boolean containsGlobalDataTypeImport(final XSDSchema schema) { - boolean containsImport = false; - if (schema != null) { - final List contents = schema.getContents(); - for (int i = 0; i < contents.size(); i++) { - final Object content = contents.get(i); - if (content instanceof XSDImport) { - if (DatatypeConstants.BUILTIN_DATATYPES_URI - .equals(((XSDImport) content).getNamespace())) { - containsImport = true; - break; - } - } - } + public static boolean containsGlobalDataTypeImport( final XSDSchema schema ) { + boolean containsImport = false; + if (schema != null) { + final List contents = schema.getContents(); + for (int i = 0; i < contents.size(); i++) { + final Object content = contents.get(i); + if (content instanceof XSDImport) { + if (DatatypeConstants.BUILTIN_DATATYPES_URI.equals(((XSDImport)content).getNamespace())) { + containsImport = true; + break; + } + } + } - } - return containsImport; - } + } + return containsImport; + } - private void getAllDependentSchemas(IResource[] iResources, - ArrayList dependentSchemas) { + private void getAllDependentSchemas( IResource[] iResources, + ArrayList dependentSchemas ) { - // Add discovered dependent schemas - for (IResource iResource : iResources) { - if (ModelIdentifier.isSchemaModel(iResource)) { - dependentSchemas.add(iResource); - } - } + // Add discovered dependent schemas + for (IResource iResource : iResources) { + if (ModelIdentifier.isSchemaModel(iResource)) { + dependentSchemas.add(iResource); + } + } - // Now iterate through the dependent schemas and find their dependent - // resources, if any - for (IResource iResource : iResources) { - IResource[] moreIResources = WorkspaceResourceFinderUtil - .getDependentResources(iResource); - if (moreIResources.length > 0) { - getAllDependentSchemas(moreIResources, dependentSchemas); - } - } + // Now iterate through the dependent schemas and find their dependent + // resources, if any + for (IResource iResource : iResources) { + IResource[] moreIResources = WorkspaceResourceFinderUtil.getDependentResources(iResource); + if (moreIResources.length > 0) { + getAllDependentSchemas(moreIResources, dependentSchemas); + } + } - } + } - public XSDSchema importSchema(String path) { - XSDParser parser = new XSDParser(null); - parser.parse(path); - XSDSchema schema = parser.getSchema(); - schema.setSchemaLocation(path); - return schema; - } + public XSDSchema importSchema( String path ) { + XSDParser parser = new XSDParser(null); + parser.parse(path); + XSDSchema schema = parser.getSchema(); + schema.setSchemaLocation(path); + return schema; + } - private String createServletTags(List tags) { - StringBuffer servletTags = new StringBuffer(); - String startServlet = "\t\n"; //$NON-NLS-1$ - String endServlet = "\t\n"; //$NON-NLS-1$ - String startServletName = "\t\t"; //$NON-NLS-1$ - String endServletName = "\n"; //$NON-NLS-1$ - String startServletClass = "\t\torg.teiid.soap.provider."; //$NON-NLS-1$ - String endServletClass = "\n\t\t1\n"; //$NON-NLS-1$ - String startServletMapping = "\t\n"; //$NON-NLS-1$ - String endServletMapping = "\t\n"; //$NON-NLS-1$ - String startUrlPattern = "\t\t/"; //$NON-NLS-1$ - String endUrlPattern = "\n"; //$NON-NLS-1$ + private String createServletTags( List tags ) { + StringBuffer servletTags = new StringBuffer(); + String startServlet = "\t\n"; //$NON-NLS-1$ + String endServlet = "\t\n"; //$NON-NLS-1$ + String startServletName = "\t\t"; //$NON-NLS-1$ + String endServletName = "\n"; //$NON-NLS-1$ + String startServletClass = "\t\torg.teiid.soap.provider."; //$NON-NLS-1$ + String endServletClass = "\n\t\t1\n"; //$NON-NLS-1$ + String startServletMapping = "\t\n"; //$NON-NLS-1$ + String endServletMapping = "\t\n"; //$NON-NLS-1$ + String startUrlPattern = "\t\t/"; //$NON-NLS-1$ + String endUrlPattern = "\n"; //$NON-NLS-1$ - for (String port : tags) { - servletTags.append(startServlet).append(startServletName).append( - port).append(endServletName); - servletTags.append(startServletClass).append(port).append( - endServletClass).append(endServlet); - servletTags.append(startServletMapping).append(startServletName) - .append(port).append(endServletName); - servletTags.append(startUrlPattern).append(port).append( - endUrlPattern).append(endServletMapping); - } + for (String port : tags) { + servletTags.append(startServlet).append(startServletName).append(port).append(endServletName); + servletTags.append(startServletClass).append(port).append(endServletClass).append(endServlet); + servletTags.append(startServletMapping).append(startServletName).append(port).append(endServletName); + servletTags.append(startUrlPattern).append(port).append(endUrlPattern).append(endServletMapping); + } - return servletTags.toString(); - } + return servletTags.toString(); + } - private String createEndpointTags(Properties properties, List tags) { + private String createEndpointTags( Properties properties, + List tags ) { - final String contextName = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); - final String tns = (String) properties - .get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); + final String contextName = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_CONTEXT_NAME); + final String tns = (String)properties.get(WebArchiveBuilderConstants.PROPERTY_WSDL_TNS); - StringBuffer endpointTags = new StringBuffer(); - String startJaxwsEndpoint = "\t\n"; //$NON-NLS-1$ - String serviceName = " serviceName=\"s:"; //$NON-NLS-1$ - String implementor = "\n\t\timplementor=\"org.teiid.soap.provider."; //$NON-NLS-1$ - String wsdlLocation = " \n\t\twsdlLocation=\"classpath:"; //$NON-NLS-1$ - String namespace = " xmlns:s=\""; //$NON-NLS-1$ - String wsseInterceptor1 = "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; //$NON-NLS-1$ + StringBuffer endpointTags = new StringBuffer(); + String startJaxwsEndpoint = "\t\n"; //$NON-NLS-1$ + String serviceName = " serviceName=\"s:"; //$NON-NLS-1$ + String implementor = "\n\t\timplementor=\"org.teiid.soap.provider."; //$NON-NLS-1$ + String wsdlLocation = " \n\t\twsdlLocation=\"classpath:"; //$NON-NLS-1$ + String namespace = " xmlns:s=\""; //$NON-NLS-1$ + String wsseInterceptor1 = "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; //$NON-NLS-1$ + String useMTOM = "\t\t\n\t\t\t\n\t\t\n"; //$NON-NLS-1$ - for (String port : tags) { - endpointTags.append(startJaxwsEndpoint) - .append("\"").append(port).append("\"").append(serviceName); //$NON-NLS-1$ //$NON-NLS-2$ - endpointTags.append(contextName).append("\""); //$NON-NLS-1$ - endpointTags - .append(implementor) - .append(port) - .append("\"").append(wsdlLocation).append(wsdlFilename).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ - endpointTags.append(namespace).append(tns).append("\">\n"); //$NON-NLS-1$ - if (isWSSecurity(properties)) { - endpointTags.append(wsseInterceptor1).append(wsseInterceptor2); - } - endpointTags.append(endJaxwsEndpoint); - } + for (String port : tags) { + endpointTags.append(startJaxwsEndpoint).append("\"").append(port).append("\"").append(serviceName); //$NON-NLS-1$ //$NON-NLS-2$ + endpointTags.append(contextName).append("\""); //$NON-NLS-1$ + endpointTags.append(implementor).append(port).append("\"").append(wsdlLocation).append(wsdlFilename).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ + endpointTags.append(namespace).append(tns).append("\">\n"); //$NON-NLS-1$ + if (isWSSecurity(properties)) { + endpointTags.append(wsseInterceptor1).append(wsseInterceptor2); + } + if (isUseMTOM(properties)) { + endpointTags.append(useMTOM); + } + endpointTags.append(endJaxwsEndpoint); + } - return endpointTags.toString(); - } + return endpointTags.toString(); + } } Index: src/org/teiid/designer/dqp/webservice/war/WebArchiveBuilderConstants.java =================================================================== --- src/org/teiid/designer/dqp/webservice/war/WebArchiveBuilderConstants.java (revision 1768) +++ src/org/teiid/designer/dqp/webservice/war/WebArchiveBuilderConstants.java (working copy) @@ -77,6 +77,11 @@ public static final String PROPERTY_SECURITY_PASSWORD = "securityPassword"; //$NON-NLS-1$ /** + * Property indicating the MTOM should be used for the response + */ + public static final String PROPERTY_USE_MTOM = "mtom"; //$NON-NLS-1$ + + /** * Property indicating the VDB file to include in the WAR file. */ public static final String PROPERTY_VDB_FILE_NAME = "VdbFileName"; //$NON-NLS-1$ Index: src/com/metamatrix/modeler/dqp/ui/i18n.properties =================================================================== --- src/com/metamatrix/modeler/dqp/ui/i18n.properties (revision 1768) +++ src/com/metamatrix/modeler/dqp/ui/i18n.properties (working copy) @@ -345,11 +345,14 @@ WarDeploymentInfoDialog.portErrorMessage=Enter valid port number. WarDeploymentInfoDialog.creatingWarFileMessage=Creating war file {0} WarDeploymentInfoDialog.securityOptionsGroup=Security +WarDeploymentInfoDialog.generalOptionsGroup=General Options WarDeploymentInfoDialog.basicOptionsGroup=HTTPBasic Options WarDeploymentInfoDialog.wsSecurityOptionsGroup=WS-Security Options WarDeploymentInfoDialog.noSecurityButton=None WarDeploymentInfoDialog.basicButton=HTTPBasic WarDeploymentInfoDialog.wsSecurityButton=WS-Security (Username Token) +WarDeploymentInfoDialog.mtomButton=Enable MTOM +WarDeploymentInfoDialog.mtomTooltip=If selected, MTOM will be enabled for the web service endpoint(s). You will also need to update your output schema accordingly by adding the xmlns:xmime="http://www.w3.org/2005/05/xmlmim" schema and adding type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream" to the output element you wish to optimize. WarDeploymentInfoDialog.warFilePleaseEnterFile.message=Please enter a location to save the WAR file. WarDeploymentInfoDialog.warFileSaveFolderNameProblem.message=The WAR file save location is invalid. WarDeploymentInfoDialog.warFileSaveFolderExistsButPermissionProblem.message=The WAR file save location is valid, but has insufficient permissions. @@ -514,7 +517,7 @@ PasswordProvider.missingPasswordMessage=The data source for model "{0}" requires a password. \nThe referenced connection profile is "{1}." -RuntimeAssistant.previewDisabledNoTeiidInstanceMsg = In order to preview: \n\t1) the preview preference must be enabled, and \n\t2) a Teiid server must exist. \n\nWould like to enable preview and create a Teiid instance so that you can run preview? +RuntimeAssistant.previewDisabledNoTeiidInstanceMsg = In order to preview\: \n\t1) the preview preference must be enabled, and \n\t2) a Teiid server must exist. \n\nWould like to enable preview and create a Teiid instance so that you can run preview? RuntimeAssistant.previewDisabledMsg = In order to preview, the preview preference must be enabled. Would like to enable preview so that you can run preview? RuntimeAssistant.noTeiidInstanceMsg = In order to preview, a Teiid instance must exist. Would like to create a Teiid instance so that you can run preview? RuntimeAssistant.confirmEnablePreviewTitle = Confirm Enable Preview