Package org.apache.ws.notification.base

Examples of org.apache.ws.notification.base.Subscription


      {
         LOG.error( "Subscribe failed due to internal error: " + ne );
         throw new BaseFaultException( NAMESPACE_SET, "Subscribe failed due to internal server error." );
      }

      Subscription subscription = null;
      try
      {
         subscription =
            subscriptionHome.create( SubscriptionResource.class,
                                     new XmlBeansEndpointReference( request.getConsumerReference(  ) ),
                                     producerEPR,
                                     initialTerminationTime,
                                     subPolicy,
                                     precondition,
                                     selector,
                                     getResource(  ).getID(  ),
                                     ( (AbstractResourceContext) getResourceContext(  ) ).getResourceHomeLocation(  ),
                                     topicExpr,
                                     useNotify,
                                     (WsnNamespaceVersionHolder) getNamespaceSet(  ) );
      }
      catch ( Exception e )
      {
         LOG.error( "Subscribe failed due to internal error: " + e );
         if ( LOG.isDebugEnabled(  ) )
         {
            e.printStackTrace(  );
         }

         throw new SubscribeCreationFailedFaultException( NAMESPACE_SET );
      }

      SubscriptionTopicListener subscriptionTopicListener = new SubscriptionTopicListener( subscription );
      for ( int i = 0; i < topics.length; i++ )
      {
         topics[i].addTopicListener( subscriptionTopicListener );
      }

      SubscribeResponseDocument                   subscribeResponseDoc =
         SubscribeResponseDocument.Factory.newInstance(  );
      SubscribeResponseDocument.SubscribeResponse subscribeResponse =
         subscribeResponseDoc.addNewSubscribeResponse(  );
      subscriptionEPR =
         (EndpointReferenceType) ( (XmlObjectWrapper) subscription.getEndpointReference(  ) ).getXmlObject(  );
      subscribeResponse.setSubscriptionReference( subscriptionEPR );
      return subscribeResponseDoc;
   }
View Full Code Here


    *
    * @return DOCUMENT_ME
    */
   public PauseSubscriptionResponseDocument pauseSubscription( PauseSubscriptionDocument requestDoc )
   {
      Subscription subscription = (Subscription) getResource(  );
      try
      {
         subscription.pause(  );
      }
      catch ( Exception e )
      {
         throw new PauseFailedFaultException( NAMESPACE_SET,
                                              "Pause failed on subscription: " + subscription.getID(  ) );
      }

      return createPauseSubscriptionResponseDocument(  );
   }
View Full Code Here

    *
    * @return DOCUMENT_ME
    */
   public ResumeSubscriptionResponseDocument resumeSubscription( ResumeSubscriptionDocument requestDoc )
   {
      Subscription subscription = (Subscription) getResource(  );
      try
      {
         subscription.resume(  );
      }
      catch ( Exception e )
      {
         throw new ResumeFailedFaultException( NAMESPACE_SET,
                                               "Resume failed on subscription: " + subscription.getID(  ) );
      }

      return createResumeSubscriptionResponseDocument(  );
   }
View Full Code Here

                                                         EndpointReference.class,
                                                         Object.class,
                                                         String.class,
                                                         TopicExpression.class
                                                      } );
         Subscription subscription =
            (Subscription) constructor.newInstance( new Object[]
                                                    {
                                                       consumerReference,
                                                       producerReference,
                                                       producerId,
                                                       producerHomeLocation,
                                                       topicExpression
                                                    } );
         subscription.setTerminationTime( initialTerminationTime );
         subscription.setUseNotify( useNotify );
         subscription.setSelector( selector );
         subscription.setPrecondition( precondition );
         subscription.setPolicy( policy );
         subscription.init(  ); // initialize resource properties
         String            id              = (String) subscription.getID(  );
         EndpointReference subscriptionEPR = getEndpointReference( id );

         //do this here (rather than in find() ) since we need the EPR to be returned on the subscribe request.
         subscription.setEndpointReference( subscriptionEPR );
         add( subscription );
         return subscription;
      }
      catch ( Exception e )
      {
View Full Code Here

                EndpointReference.class,
                EndpointReference.class,
                ResourceKey.class,
                String.class,
                TopicExpression.class} );
            Subscription subscription = (Subscription) constructor.newInstance(
                    new Object[]{consumerReference, producerReference, producerKey, producerHomeLocation,
                                 topicExpression} );
            subscription.setTerminationTime( initialTerminationTime );
            subscription.setUseNotify( useNotify );
            subscription.setSelector( selector );
            subscription.setPrecondition( precondition );
            subscription.setPolicy( policy );
            subscription.init()// initialize resource properties
            String id = (String) subscription.getID();
            SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName() ), id );
            EndpointReference subscriptionEPR = getEndpointReference( getSubscriptionAddress( producerReference ),
                    resourceKey, nsSet.getAddressingNamespace() );
            subscription.setEndpointReference( subscriptionEPR );
            add( resourceKey, subscription );
            return subscription;
        }
        catch ( Exception e )
        {
View Full Code Here

        catch ( NamingException ne )
        {
            LOG.error( "Subscribe failed due to internal error: " + ne );
            throw new BaseFaultException( NAMESPACE_SET, "Subscribe failed due to internal server error." );
        }
        Subscription subscription = null;
        try
        {
            subscription = subscriptionHome.create( SubscriptionResource.class,
                            new XmlBeansEndpointReference( request.getConsumerReference() ), producerEPR, initialTerminationTime,
                            subPolicy, precondition, selector, getResourceKey(),
                            ( (AbstractResourceContext) getResourceContext() ).getResourceHomeLocation(), topicExpr, useNotify, (WsnNamespaceVersionHolder) getNamespaceSet() );
        }
        catch ( Exception e )
        {
            LOG.error( "Subscribe failed due to internal error: " + e );
            if ( LOG.isDebugEnabled() )
            {
                e.printStackTrace( );
            }
            throw new SubscribeCreationFailedFaultException( NAMESPACE_SET );
        }
        SubscriptionTopicListener subscriptionTopicListener = new SubscriptionTopicListener( subscription );
        for ( int i = 0; i < topics.length; i++ )
        {
            topics[i].addTopicListener( subscriptionTopicListener );
        }
        SubscribeResponseDocument subscribeResponseDoc = SubscribeResponseDocument.Factory.newInstance();
        SubscribeResponseDocument.SubscribeResponse subscribeResponse = subscribeResponseDoc.addNewSubscribeResponse();
        subscriptionEPR = (EndpointReferenceType) ( (XmlObjectWrapper) subscription.getEndpointReference() ).getXmlObject();
        subscribeResponse.setSubscriptionReference( subscriptionEPR );
        return subscribeResponseDoc;
    }
View Full Code Here

        super( resourceContext );
    }

    public PauseSubscriptionResponseDocument pauseSubscription( PauseSubscriptionDocument requestDoc )
    {
        Subscription subscription = (Subscription) getResource();
        try
        {
            subscription.pause();
        }
        catch ( Exception e )
        {
            throw new PauseFailedFaultException( NAMESPACE_SET,
                    "Pause failed on subscription: " + subscription.getID() );
        }
        return createPauseSubscriptionResponseDocument();
    }
View Full Code Here

        return createPauseSubscriptionResponseDocument();
    }

    public ResumeSubscriptionResponseDocument resumeSubscription( ResumeSubscriptionDocument requestDoc )
    {
        Subscription subscription = (Subscription) getResource();
        try
        {
            subscription.resume();
        }
        catch ( Exception e )
        {
            throw new ResumeFailedFaultException( NAMESPACE_SET,
                    "Resume failed on subscription: " + subscription.getID() );
        }
        return createResumeSubscriptionResponseDocument();
    }
View Full Code Here

   public Subscription create( EndpointReference producerRef,
                               EndpointReference consumerRef,
                               TopicExpression   topicExpr )
   throws ResourceException
   {
      Subscription subscription = new SubscriptionResource( producerRef, consumerRef, topicExpr );
      add( subscription );
      return subscription;
   }
View Full Code Here

                                                     + " object into an XmlObject.", e );
      }

      for ( int i = 0; i < subscriptions.length; i++ )
      {
         Subscription subscription = subscriptions[i];
         try
         {
            notify( subscription, topicExpr, msgXBean );
         }
         catch ( Exception e )
View Full Code Here

TOP

Related Classes of org.apache.ws.notification.base.Subscription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.