<commit_before>/*
 * $Log: WebServiceListener.java,v $
 * Revision 1.14  2011-06-20 13:20:11  L190409
 * added configwarning for old style call model, using servicedispatcher-proxy
 *
 * Revision 1.13  2011/05/26 11:34:12  <NAME> <<EMAIL>>
 * corrected default for application fault handling
 *
 * Revision 1.12  2011/05/19 15:11:03  <NAME> <<EMAIL>>
 * now extends PushingListenerAdapter
 *
 * Revision 1.11  2011/02/21 18:07:10  <NAME> <<EMAIL>>
 * implemented HasPhysicalDestinationName
 *
 * Revision 1.10  2007/10/17 09:07:24  <NAME> <<EMAIL>>
 * removed unused imports
 *
 * Revision 1.9  2007/10/08 12:18:20  <NAME> <<EMAIL>>
 * changed HashMap to Map where possible
 *
 * Revision 1.8  2007/10/03 08:39:05  <NAME> <<EMAIL>>
 * changed HashMap to Map
 *
 * Revision 1.7  2007/02/12 13:55:57  <NAME> <<EMAIL>>
 * Logger from LogUtil
 *
 * Revision 1.6  2006/01/05 14:18:57  <NAME> <<EMAIL>>
 * updated javadoc
 *
 * Revision 1.5  2005/07/19 14:49:54  <NAME> <<EMAIL>>
 * implementing serviceClient2
 * added attribute applicationFaultsAsSoapFaults
 *
 * Revision 1.4  2005/04/26 09:26:52  <NAME> <<EMAIL>>
 * added serviceNamespaceURI attribute
 *
 * Revision 1.3  2004/09/09 14:49:19  <NAME> <<EMAIL>>
 * removed unused variable declarations
 *
 * Revision 1.2  2004/08/23 13:08:14  <NAME> <<EMAIL>>
 * updated JavaDoc
 *
 * Revision 1.1  2004/08/23 07:13:40  <NAME> <<EMAIL>>
 * renamed WebServiceMessagePusher to WebServiceListener
 *
 * Revision 1.2  2004/08/09 13:54:13  <NAME> <<EMAIL>>
 * changed ServiceClient to MessageHandler
 *
 * Revision 1.1  2004/07/15 07:40:43  <NAME> <<EMAIL>>
 * introduction of http package
 *
 * Revision 1.2  2004/06/30 12:34:13  <NAME> <<EMAIL>>
 * added (dummy) setter for exceptionlistener
 *
 * Revision 1.1  2004/06/22 12:12:52  <NAME> <<EMAIL>>
 * introduction of MessagePushers and PushingReceivers
 *
 */
package nl.nn.adapterframework.http;

import java.io.Serializable;

import nl.nn.adapterframework.configuration.ConfigurationException;
import nl.nn.adapterframework.configuration.ConfigurationWarnings;
import nl.nn.adapterframework.core.HasPhysicalDestination;
import nl.nn.adapterframework.core.IPushingListener;
import nl.nn.adapterframework.receivers.ServiceDispatcher;
import nl.nn.adapterframework.util.ClassUtils;

import org.apache.commons.lang.StringUtils;

/**
 * Implementation of a {@link IPushingListener} that enables a {@link nl.nn.adapterframework.receivers.GenericReceiver}
 * to receive messages as a web-service.
 * <p><b>Configuration:</b>
 * <table border="1">
 * <tr><th>attributes</th><th>description</th><th>default</th></tr>
 * <tr><td>className</td><td>nl.nn.adapterframework.http.WebServiceListener</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setName(String) name}</td><td>name of the listener as known to the adapter</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setServiceNamespaceURI(String) serviceNamespaceURI}</td><td>namespace of the service that is provided by the adapter of this listener</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setApplicationFaultsAsSoapFaults(boolean) applicationFaultsAsSoapFaults}</td><td>Controls the behavior when an application-fault occurrs: 
 *   <table>
 *     <tr><td><code>true</code></td><td>errors are returned as a SOAP-fault</td></tr>
 *     <tr><td><code>false</code></td><td>errors are returned in error message generated by the IBIS error message formatter</td></tr>
 *   </table>
 * </td><td>true</td></tr>
 * </table>
 * @author  <NAME> 
 * @version Id
 */
public class WebServiceListener extends PushingListenerAdapter implements Serializable, HasPhysicalDestination {

	private String serviceNamespaceURI;

	/**
	 * initialize listener and register <code>this</code> to the JNDI
	 */
	public void configure() throws ConfigurationException {
		super.configure();
		try {
			if (StringUtils.isNotEmpty(getServiceNamespaceURI())) {
				log.debug("registering listener ["+getName()+"] with ServiceDispatcher by serviceNamespaceURI ["+getServiceNamespaceURI()+"]");
				ServiceDispatcher.getInstance().registerServiceClient(getServiceNamespaceURI(), this);
			} else {
				log.debug("registering listener ["+getName()+"] with ServiceDispatcher");
				ServiceDispatcher.getInstance().registerServiceClient(getName(), this);
				ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
				String msg = ClassUtils.nameOf(this) +"["+getName()+"]: calling webservices via de ServiceDispatcher_ServiceProxy is deprecated. Please specify a serviceNamespaceURI and modify the call accordingly";
				configWarnings.add(log, msg);
			}
		} catch (Exception e){
			throw new ConfigurationException(e);
		}
	}

	public String getPhysicalDestinationName() {
		if (StringUtils.isNotEmpty(getServiceNamespaceURI())) {<commit_msg>temporarily disabled deprecation warning<commit_after>/*
 * $Log: WebServiceListener.java,v $
 * Revision 1.15  2011-08-22 09:45:33  L190409
 * temporarily disabled deprecation warning
 *
 * Revision 1.14  2011/06/20 13:20:11  <NAME> <<EMAIL>>
 * added configwarning for old style call model, using servicedispatcher-proxy
 *
 * Revision 1.13  2011/05/26 11:34:12  <NAME> <<EMAIL>>
 * corrected default for application fault handling
 *
 * Revision 1.12  2011/05/19 15:11:03  <NAME> <<EMAIL>>
 * now extends PushingListenerAdapter
 *
 * Revision 1.11  2011/02/21 18:07:10  <NAME> <<EMAIL>>
 * implemented HasPhysicalDestinationName
 *
 * Revision 1.10  2007/10/17 09:07:24  <NAME> <<EMAIL>>
 * removed unused imports
 *
 * Revision 1.9  2007/10/08 12:18:20  <NAME> <<EMAIL>>
 * changed HashMap to Map where possible
 *
 * Revision 1.8  2007/10/03 08:39:05  <NAME> <<EMAIL>>
 * changed HashMap to Map
 *
 * Revision 1.7  2007/02/12 13:55:57  <NAME> <<EMAIL>>
 * Logger from LogUtil
 *
 * Revision 1.6  2006/01/05 14:18:57  <NAME> <<EMAIL>>
 * updated javadoc
 *
 * Revision 1.5  2005/07/19 14:49:54  <NAME> <<EMAIL>>
 * implementing serviceClient2
 * added attribute applicationFaultsAsSoapFaults
 *
 * Revision 1.4  2005/04/26 09:26:52  <NAME> <<EMAIL>>
 * added serviceNamespaceURI attribute
 *
 * Revision 1.3  2004/09/09 14:49:19  <NAME> <<EMAIL>>
 * removed unused variable declarations
 *
 * Revision 1.2  2004/08/23 13:08:14  <NAME> <<EMAIL>>
 * updated JavaDoc
 *
 * Revision 1.1  2004/08/23 07:13:40  <NAME> <<EMAIL>>
 * renamed WebServiceMessagePusher to WebServiceListener
 *
 * Revision 1.2  2004/08/09 13:54:13  <NAME> <<EMAIL>>
 * changed ServiceClient to MessageHandler
 *
 * Revision 1.1  2004/07/15 07:40:43  <NAME> <<EMAIL>>
 * introduction of http package
 *
 * Revision 1.2  2004/06/30 12:34:13  <NAME> <<EMAIL>>
 * added (dummy) setter for exceptionlistener
 *
 * Revision 1.1  2004/06/22 12:12:52  <NAME> <<EMAIL>>
 * introduction of MessagePushers and PushingReceivers
 *
 */
package nl.nn.adapterframework.http;

import java.io.Serializable;

import nl.nn.adapterframework.configuration.ConfigurationException;
import nl.nn.adapterframework.configuration.ConfigurationWarnings;
import nl.nn.adapterframework.core.HasPhysicalDestination;
import nl.nn.adapterframework.core.IPushingListener;
import nl.nn.adapterframework.receivers.ServiceDispatcher;
import nl.nn.adapterframework.util.ClassUtils;

import org.apache.commons.lang.StringUtils;

/**
 * Implementation of a {@link IPushingListener} that enables a {@link nl.nn.adapterframework.receivers.GenericReceiver}
 * to receive messages as a web-service.
 * <p><b>Configuration:</b>
 * <table border="1">
 * <tr><th>attributes</th><th>description</th><th>default</th></tr>
 * <tr><td>className</td><td>nl.nn.adapterframework.http.WebServiceListener</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setName(String) name}</td><td>name of the listener as known to the adapter</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setServiceNamespaceURI(String) serviceNamespaceURI}</td><td>namespace of the service that is provided by the adapter of this listener</td><td>&nbsp;</td></tr>
 * <tr><td>{@link #setApplicationFaultsAsSoapFaults(boolean) applicationFaultsAsSoapFaults}</td><td>Controls the behavior when an application-fault occurrs: 
 *   <table>
 *     <tr><td><code>true</code></td><td>errors are returned as a SOAP-fault</td></tr>
 *     <tr><td><code>false</code></td><td>errors are returned in error message generated by the IBIS error message formatter</td></tr>
 *   </table>
 * </td><td>true</td></tr>
 * </table>
 * @author  <NAME> 
 * @version Id
 */
public class WebServiceListener extends PushingListenerAdapter implements Serializable, HasPhysicalDestination {

	private String serviceNamespaceURI;
	private boolean nag=false; // controls warning about deprecated call via ServiceDispatcher_ServiceProxy 

	/**
	 * initialize listener and register <code>this</code> to the JNDI
	 */
	public void configure() throws ConfigurationException {
		super.configure();
		try {
			if (StringUtils.isNotEmpty(getServiceNamespaceURI())) {
				log.debug("registering listener ["+getName()+"] with ServiceDispatcher by serviceNamespaceURI ["+getServiceNamespaceURI()+"]");
				ServiceDispatcher.getInstance().registerServiceClient(getServiceNamespaceURI(), this);
			} else {
				log.debug("registering listener ["+getName()+"] with ServiceDispatcher");
				ServiceDispatcher.getInstance().registerServiceClient(getName(), this);
				if (nag) { 
					ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
					String msg = ClassUtils.nameOf(this) +"["+getName()+"]: calling webservices via de ServiceDispatcher_ServiceProxy is deprecated. Please specify a serviceNamespaceURI and modify the call accordingly";
					configWarnings.add(log, msg);
				}
			}
		} catch (Exception e){
			throw new ConfigurationException(e);
		}
	}

	public String getPhysicalDestinationName() {
		if (StringUtils.isNotEmpty(getServiceNamespaceURI())) {
{'fraction_non_alphanumeric': 0.13977725554306733, 'fraction_numerical': 0.06324716460611014, 'mean_word_length': 4.882211538461538, 'pattern_counts': {'":': 0, '<': 240, '<?xml version=': 0, '>': 240, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4891600', 'n_tokens_mistral': 3561, 'n_tokens_neox': 3080, 'n_words': 759}