/*=============================================================================*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*=============================================================================*/
package org.apache.ws.eventing;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.ws.addressing.*;
/**
* DOCUMENT_ME
*
* @version $Revision: 1.8 $
* @author $author$
*/
public class EchoConsumer
implements org.apache.ws.pubsub.NotificationConsumer
{
private EndpointReference epr;
/**
* Creates a new {@link EchoConsumer} object.
*
* @param epr DOCUMENT_ME
*
* @throws org.apache.axis.types.URI.MalformedURIException DOCUMENT_ME
*/
public EchoConsumer( String epr )
throws org.apache.axis.types.URI.MalformedURIException
{
org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType e =
org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType.Factory.newInstance( );
org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI auri =
org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI.Factory.newInstance( );
auri.setStringValue( epr );
e.setAddress( auri );
//wrapper
this.epr = new XmlBeansEndpointReference( e );
}
/**
* DOCUMENT_ME
*
* @param epr DOCUMENT_ME
*/
public void setEPR( EndpointReference epr )
{
this.epr = epr;
}
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*/
public EndpointReference getEPR( )
{
return epr;
}
/**
* DOCUMENT_ME
*
* @param mode DOCUMENT_ME
*/
public void setMode( int mode )
{
}
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*/
public int getMode( )
{
return 0;
}
/**
* DOCUMENT_ME
*
* @param subscription DOCUMENT_ME
* @param status DOCUMENT_ME
* @param reason DOCUMENT_ME
*/
public void end( org.apache.ws.pubsub.Subscription subscription,
java.net.URI status,
String reason )
{
System.out.println( "end notification" );
}
/**
* DOCUMENT_ME
*
* @param subscription DOCUMENT_ME
* @param message DOCUMENT_ME
*/
public void notify( org.apache.ws.pubsub.Subscription subscription,
Object message )
{
try
{
SOAPEnvelope env = (SOAPEnvelope) message;
System.out.println( "--got notification --" );
System.out.println( env.toString( ) );
}
catch ( Exception e )
{
e.printStackTrace( );
}
}
}