Omaha #3199 new edex.soap plugin

new plugin for soap utilities


Former-commit-id: 7c7f7f4f4a821a80d0bf6dcb7e59e3880a7bf4e2
This commit is contained in:
Brian Clements 2014-05-23 11:14:33 -05:00
parent 7da3d7461f
commit 09fba26a56
19 changed files with 312 additions and 10 deletions

View file

@ -4,7 +4,7 @@ architecture=x86_64
includegen.filter=raytheon|noaa\.nws|noaa\.gsd
# AWIPSII core repositores required for build
core.repositories=ufcore,ufcore-foss
core.repositories=ufcore,ufcore-foss,AWIPS2_foss
# Note: currently, there is a limit of 99 plugin directories.
dir.01=cave

View file

@ -102,4 +102,10 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.apache.commons.cxf"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -137,4 +137,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.soap"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -23,7 +23,8 @@ Require-Bundle: net.opengis;bundle-version="1.0.2",
org.eclipse.jetty;bundle-version="7.6.9",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.edex.log;bundle-version="1.12.1174",
com.raytheon.uf.common.http
com.raytheon.uf.common.http,
com.raytheon.uf.edex.soap;bundle-version="1.14.0"
Export-Package: com.raytheon.uf.edex.ogc.common,
com.raytheon.uf.edex.ogc.common.db,
com.raytheon.uf.edex.ogc.common.feature,

View file

@ -31,11 +31,11 @@ import org.apache.camel.Processor;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.log.cxf.RequestLogController;
import com.raytheon.uf.edex.ogc.common.stats.IStatsRecorder;
import com.raytheon.uf.edex.ogc.common.stats.OperationType;
import com.raytheon.uf.edex.ogc.common.stats.ServiceType;
import com.raytheon.uf.edex.ogc.common.stats.StatsRecorderFinder;
import com.raytheon.uf.edex.soap.RequestLogController;
/**
* HTTP Camel Processor for OGC REST Services

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.soap</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View file

@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EDEX Soap
Bundle-SymbolicName: com.raytheon.uf.edex.soap
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.apache.commons.cxf;bundle-version="2.5.10",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.sun.xml.bind;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.edex.soap

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -0,0 +1,153 @@
/**
* Copyright 09/24/12 Raytheon Company.
*
* Unlimited Rights
* This software was developed pursuant to Contract Number
* DTFAWA-10-D-00028 with the US Government. The US Governments rights
* in and to this copyrighted software are as specified in DFARS
* 252.227-7014 which was made part of the above contract.
*/
package com.raytheon.uf.edex.soap;
import java.io.InputStream;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.LoggingMessage;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.io.DelegatingInputStream;
import org.apache.cxf.message.Message;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* Web Services interceptor that logs incoming requests
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* September, 2013 behemmi Initial creation
* May 23, 2014 3199 bclement moved to edex.soap from edex.log
*
* </pre>
*
* @author behemmi
* @version 1.0
*/
public class CXFLogger extends org.apache.cxf.interceptor.LoggingInInterceptor {
protected IUFStatusHandler log = UFStatus.getHandler(this.getClass());
@Override
public void handleMessage(Message message) throws Fault {
if (writer != null ||
RequestLogController.getInstance().shouldLogRequestsInfo() &&
log.isPriorityEnabled(RequestLogController.getInstance().getRequestLogLevel())) {
logging(message);
}
}
/**
* implement custom content for incoming requests in our own log format
* @param message
* @throws Fault
*/
protected void logging(Message message) throws Fault {
if (message.containsKey(LoggingMessage.ID_KEY)) {
return;
}
String id = (String)message.getExchange().get(LoggingMessage.ID_KEY);
if (id == null) {
id = LoggingMessage.nextId();
message.getExchange().put(LoggingMessage.ID_KEY, id);
}
message.put(LoggingMessage.ID_KEY, id);
final LoggingMessage buffer
= new LoggingMessage("Inbound Message\n--------------------------", id);
Integer responseCode = (Integer)message.get(Message.RESPONSE_CODE);
if (responseCode != null) {
buffer.getResponseCode().append(responseCode);
}
String encoding = (String)message.get(Message.ENCODING);
if (encoding != null) {
buffer.getEncoding().append(encoding);
}
String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
if (httpMethod != null) {
buffer.getHttpMethod().append(httpMethod);
}
String ct = (String)message.get(Message.CONTENT_TYPE);
if (ct != null) {
buffer.getContentType().append(ct);
}
Object headers = message.get(Message.PROTOCOL_HEADERS);
if (headers != null) {
buffer.getHeader().append(headers);
}
String uri = (String)message.get(Message.REQUEST_URL);
if (uri != null) {
buffer.getAddress().append(uri);
String query = (String)message.get(Message.QUERY_STRING);
if (query != null) {
buffer.getAddress().append("?").append(query);
}
}
if (!isShowBinaryContent() && isBinaryContent(ct)) {
buffer.getMessage().append(BINARY_CONTENT_MESSAGE).append('\n');
log.handle(RequestLogController.getInstance().getRequestLogLevel(),
buffer.toString());
return;
}
InputStream is = message.getContent(InputStream.class);
if (is != null) {
CachedOutputStream bos = new CachedOutputStream();
if (threshold > 0) {
bos.setThreshold(threshold);
}
try {
// use the appropriate input stream and restore it later
InputStream bis = is instanceof DelegatingInputStream
? ((DelegatingInputStream)is).getInputStream() : is;
IOUtils.copyAndCloseInput(bis, bos);
bos.flush();
bis = bos.getInputStream();
// restore the delegating input stream or the input stream
if (is instanceof DelegatingInputStream) {
((DelegatingInputStream)is).setInputStream(bis);
} else {
message.setContent(InputStream.class, bis);
}
if (bos.getTempFile() != null) {
//large thing on disk...
buffer.getMessage().append("\nMessage (saved to tmp file):\n");
buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
}
if (bos.size() > limit) {
buffer.getMessage().append("(message truncated to " + limit + " bytes)\n");
}
writePayload(buffer.getPayload(), bos, encoding, ct);
bos.close();
} catch (Exception e) {
throw new Fault(e);
}
}
log.handle(RequestLogController.getInstance().getRequestLogLevel(),
buffer.toString());
}
}

View file

@ -7,7 +7,7 @@
* in and to this copyrighted software are as specified in DFARS
* 252.227-7014 which was made part of the above contract.
*/
package com.raytheon.uf.edex.ogc.common.soap;
package com.raytheon.uf.edex.soap;
import java.io.IOException;
import java.io.InputStream;
@ -41,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus;
* ------------ ---------- ----------- --------------------------
* Jan 28, 2013 bclement Initial creation
* 5/2/2014 #3192 bhillip Minor fix for CXF upgrade to 2.7.10
* May 23, 2014 3199 bclement moved to edex.soap from edex.ogc.common
*
* </pre>
*

View file

@ -7,7 +7,7 @@
* in and to this copyrighted software are as specified in DFARS
* 252.227-7014 which was made part of the above contract.
*/
package com.raytheon.uf.edex.ogc.common.soap;
package com.raytheon.uf.edex.soap;
import java.util.Arrays;
import java.util.HashMap;
@ -34,6 +34,7 @@ import com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 21, 2012 bclement Initial creation
* May 23, 2014 3199 bclement moved to edex.soap from edex.ogc.common
*
* </pre>
*

View file

@ -0,0 +1,75 @@
/**
* Copyright 09/24/12 Raytheon Company.
*
* Unlimited Rights
* This software was developed pursuant to Contract Number
* DTFAWA-10-D-00028 with the US Government. The US Governments rights
* in and to this copyrighted software are as specified in DFARS
* 252.227-7014 which was made part of the above contract.
*/
package com.raytheon.uf.edex.soap;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Singleton to control how incoming request information is logged. Implemented
* as a singleton to allow runtime control from a Web Client
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* September, 2013 behemmi Initial creation
* May 23, 2014 3199 bclement moved to edex.soap from edex.log
*
* </pre>
*
* @author behemmi
* @version 1.0
*/
public class RequestLogController {
private static RequestLogController instance = null;
private Priority requestLogLevel;
private boolean shouldLogRequestsInfo;
private RequestLogController(){
requestLogLevel = Priority.DEBUG;
shouldLogRequestsInfo = true;
}
public static RequestLogController getInstance() {
if(instance == null) {
instance = new RequestLogController();
}
return instance;
}
public Priority getRequestLogLevel() {
return requestLogLevel;
}
public void setRequestLogLevel(Priority requestLogLevel) {
this.requestLogLevel = requestLogLevel;
}
public boolean shouldLogRequestsInfo() {
return getShouldLogRequestsInfo();
}
/**
* Traditional getter for Jackson serialization.
*
* @return shouldLogRequestsInfo - if this logger is enabled
*/
public boolean getShouldLogRequestsInfo() {
return shouldLogRequestsInfo;
}
public void setShouldLogRequestsInfo(boolean shouldLogRequestsInfo) {
this.shouldLogRequestsInfo = shouldLogRequestsInfo;
}
}

View file

@ -23,7 +23,8 @@ Require-Bundle: org.geotools;bundle-version="2.6.4",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
org.apache.commons.collections;bundle-version="3.2.0",
org.apache.commons.cxf;bundle-version="1.0.0",
com.raytheon.uf.common.http
com.raytheon.uf.common.http,
com.raytheon.uf.edex.soap;bundle-version="1.14.0"
Export-Package: com.raytheon.uf.edex.wfs,
com.raytheon.uf.edex.wfs.feature,
com.raytheon.uf.edex.wfs.filter,

View file

@ -9,7 +9,7 @@
</bean>
<bean id="wfsSoapService"
class="com.raytheon.uf.edex.ogc.common.soap.JaxWsConfigServerFactoryBean"
class="com.raytheon.uf.edex.soap.JaxWsConfigServerFactoryBean"
init-method="create">
<property name="serviceClass" value="com.raytheon.uf.edex.wfs.soap2_0_0.Wfs" />
<property name="address" value="http://0.0.0.0:8086/wfs2.0.0" />

View file

@ -3,7 +3,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="wfsWsdlInterceptor"
class="com.raytheon.uf.edex.ogc.common.soap.CustomWsdlInterceptor">
class="com.raytheon.uf.edex.soap.CustomWsdlInterceptor">
<constructor-arg value="META-INF/wsdl/wfs.wsdl" />
</bean>

View file

@ -66,7 +66,7 @@ import com.raytheon.uf.edex.wfs.soap2_0_0.util.DescribeFeatureTypeResponseType;
* @version 1.0
*/
@GZIP
@InInterceptors(interceptors = "com.raytheon.uf.edex.log.cxf.CXFLogger")
@InInterceptors(interceptors = "com.raytheon.uf.edex.soap.CXFLogger")
@WebService(name = "wfs", targetNamespace = "http://www.opengis.net/wfs/requests/2.0")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)

View file

@ -35,7 +35,6 @@ import net.opengis.wfs.v_2_0_0.WFSCapabilitiesType;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.log.cxf.RequestLogController;
import com.raytheon.uf.edex.ogc.common.http.EndpointInfo;
import com.raytheon.uf.edex.ogc.common.soap.AbstractOwsService;
import com.raytheon.uf.edex.ogc.common.soap.ServiceExceptionReport;
@ -43,6 +42,7 @@ import com.raytheon.uf.edex.ogc.common.stats.IStatsRecorder;
import com.raytheon.uf.edex.ogc.common.stats.OperationType;
import com.raytheon.uf.edex.ogc.common.stats.ServiceType;
import com.raytheon.uf.edex.ogc.common.stats.StatsRecorderFinder;
import com.raytheon.uf.edex.soap.RequestLogController;
import com.raytheon.uf.edex.wfs.WfsException;
import com.raytheon.uf.edex.wfs.WfsException.Code;
import com.raytheon.uf.edex.wfs.request.DescFeatureTypeReq;