You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-user@ws.apache.org by David Ortega <do...@tid.es> on 2006/01/26 13:15:19 UTC

Question on notification for internal property change (similar problem)

Hi,

I saw in the list archives that someone had a similar problem...
I am using pubscribe 1.1 and I'm trying to invoke the notifications' 
sending from a method I put in my custom ResourceClass (you can see the 
code of this method at the end of this email)

My problem is that when there's some user subscribed to the proprerty I 
always get the same error:

     [java] Exception in thread "Notification Service Main Dispatcher" 
java.lang.RuntimeException: java.lang.RuntimeException: Failed to obtain 
subscription manager home.
     [java]     at 
org.apache.ws.notification.topics.impl.ResourcePropertyValueChangeListenerImpl.propertyChanged(ResourcePropertyValueChangeListenerImpl.java:82)
     [java]     at 
mypackage.MyPortResource.notifyAlarm(MyPortResource.java:297)
     ...
     ...
     [java] Caused by: java.lang.RuntimeException: Failed to obtain 
subscription manager home.
     [java]     at 
org.apache.ws.notification.base.SubscriptionManager.getSubscriptionManagerHome(SubscriptionManager.java:85)
     [java]     at 
org.apache.ws.notification.base.SubscriptionManager.getSubscriptions(SubscriptionManager.java:106)
     [java]     at 
org.apache.ws.notification.base.impl.NotificationProducerHelper.publish(NotificationProducerHelper.java:149)
     [java]     at 
org.celtic.madeira.nbi.AbstractMyPortResource.publish(AbstractMyPortResource.java:189)
     [java]     at 
org.apache.ws.notification.topics.impl.ResourcePropertyValueChangeListenerImpl.propertyChanged(ResourcePropertyValueChangeListenerImpl.java:78)
     [java]     ... 5 more
     [java] Caused by: org.apache.ws.resource.ResourceException: There 
is no resource home configured for a portComponent named 
SubscriptionManager.
     [java]     at 
org.apache.ws.resource.WsrfRuntime.getResourceHome(WsrfRuntime.java:263)
     [java]     at 
org.apache.ws.notification.base.SubscriptionManager.getSubscriptionManagerHome(SubscriptionManager.java:81)

Do you know what can be happening? I guess that it's impossible to 
access to the SubscriptionManager from there...
Is it possible to implement an external method which triggers the 
notifications' sending without using a SOAP request?

Thanks in advance,

David

----------------------------------
public void notifyAlarm(MyFMAlarm alarm)
    {
          
         //Getting the ResourceProperty

        org.apache.ws.resource.properties.ResourcePropertySet 
resourcePropertySet = 
((org.apache.ws.notification.base.NotificationProducerResource)this).getResourcePropertySet();
        org.apache.ws.resource.properties.ResourceProperty resourceProperty;
       
       
        resourceProperty = 
resourcePropertySet.get(MyPortPropertyQNames.FMALARM);
       

        //Creating new FMAlarmDocument to update the property
        FMAlarmDocument fmAlarmDoc = FMAlarmDocument.Factory.newInstance();
   
        //creating the actual alarm:
        FMAlarm newFmAlarm = fmAlarmDoc.addNewFMAlarm();
        newFmAlarm.setfield1(alarm.getfield1());
        ...
       
        //adding alarm data to doc
        fmAlarmDoc.setFMAlarm(newFmAlarm);
       
        //Updating FmAlarm Property
        resourceProperty.set(0,fmAlarmDoc);
       
        //get the "Changelistener" from this property
        ResourcePropertyValueChangeListenerImpl changeListener = 
(ResourcePropertyValueChangeListenerImpl)resourceProperty.getChangeListeners()[0];
        ResourcePropertyValueChangeEvent statusChangeEvent = new 
XmlBeansResourcePropertyValueChangeEvent(null, new Object[] { fmAlarmDoc });
        changeListener.propertyChanged(statusChangeEvent);     //Here is 
where it fails!!!

    }