/*
* Copyright 2001-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.
*/
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
/**
*
* @author Stefan Lischke
*/
public class GUIConsumer implements org.apache.ws.pubsub.NotificationConsumer{
NotificationListModel comp;
private EndpointReference epr;
public GUIConsumer(String epr){
//TODO decouple epr
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();
//org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType e = org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType.Factory.newInstance();
//org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI auri = org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI.Factory.newInstance();
auri.setStringValue(epr);
e.setAddress(auri);
//wrapper
this.epr= new XmlBeansEndpointReference(e);
}
/** Creates a new instance of PopUpConsumer */
public GUIConsumer(String epr, NotificationListModel comp) {
this(epr);
this.comp=comp;
}
public void notify(org.apache.ws.pubsub.Subscription subscription, Object message ){
try{
// String m = (String)message;
// comp.addData(new notentry(((org.apache.ws.eventing.Subscription)subscription).getID().toString(),m));
comp.addData(message);
}catch(Exception e){
e.printStackTrace();
}
}
public void end(org.apache.ws.pubsub.Subscription subscription, java.net.URI status, String reason) {
System.out.println("Killed Subscription "+reason);
comp.removeData(subscription);
}
public EndpointReference getEPR() {
return this.epr;
}
}