All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.persistence.tools.dbws.JSR109WebServicePackager Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Mike Norman - May 26 2008, creating packager for JAX-WS RI
 ******************************************************************************/
 package org.eclipse.persistence.tools.dbws;

// javase imports
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

//EclipseLink imports
import static org.eclipse.persistence.internal.xr.Util.WEB_INF_DIR;
import static org.eclipse.persistence.tools.dbws.DBWSPackager.ArchiveUse.noArchive;
import static org.eclipse.persistence.tools.dbws.Util.WEB_XML_FILENAME;

/**
 * 

* INTERNAL: WebServicePackager extends {@link ProviderPackager}. It is responsible for generating
* the simplified JSR-109 files to deploy the service. *

 * \--- ${stageDir} root directory
 *    |   ...                   -- files generated by parent class
 *    |   web.xml               -- conform to JSR-154 Servlet 2.5
 * 
* * @author Mike Norman - [email protected] * @since EclipseLink 1.x */ public class JSR109WebServicePackager extends ProviderPackager { public static final String WEB_XML_PREAMBLE = "\n" + "\n" + " \n" + " _dbws.ProviderListener\n" + " \n" + " \n" + " _dbws.DBWSProvider\n" + " _dbws.DBWSProvider\n" + " 0\n" + " \n" + " \n" + " _dbws.DBWSProvider\n" + " "; public static final String WEB_XML_URL_PATTERN = "\n" + " \n" + ""; public JSR109WebServicePackager() { this(new WarArchiver(), "wse", noArchive); } protected JSR109WebServicePackager(Archiver archiver, String packagerLabel, ArchiveUse useJavaArchive) { super(archiver, packagerLabel, useJavaArchive); } @Override public Archiver buildDefaultArchiver() { return new WarArchiver(this); } @Override public OutputStream getWebXmlStream() throws FileNotFoundException { return new FileOutputStream(new File(stageDir, WEB_XML_FILENAME)); } @Override public void writeWebXml(OutputStream webXmlStream, DBWSBuilder dbwsBuilder) { StringBuilder sb = new StringBuilder(WEB_XML_PREAMBLE); sb.append(dbwsBuilder.getContextRoot()); sb.append(WEB_XML_URL_PATTERN); OutputStreamWriter osw = new OutputStreamWriter(new BufferedOutputStream(webXmlStream)); try { osw.write(sb.toString()); osw.flush(); } catch (IOException e) {/* ignore */} } @Override public String getWSDLPathPrefix() { return WEB_INF_DIR + super.getWSDLPathPrefix(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy