Package org.apache.ws.notification.base.impl

Source Code of org.apache.ws.notification.base.impl.UnitResource

/*=============================================================================*
*  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.notification.base.impl;

import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.notification.base.NotificationProducerResource;
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
import org.apache.ws.resource.PropertiesResource;
import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import org.apache.ws.resource.properties.ResourcePropertySet;
import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationProducerRPDocument;

/**
* @author Sal Campana
*/
public class UnitResource
   implements PropertiesResource,
              NotificationProducerResource
{
   /** DOCUMENT_ME */
   public static final String                      TOPIC_NAME            = "test";

   /** DOCUMENT_ME */
   ResourcePropertySet                             m_resourcePropertySet;
   private EndpointReference                       m_epr;
   private Object                                  m_id;

   /** DOCUMENT_ME */
   org.apache.ws.notification.topics.TopicSpaceSet m_topicSpaceSet =
      new org.apache.ws.notification.topics.impl.TopicSpaceSetImpl( true );

   /**
    * DOCUMENT_ME
    *
    * @param epr DOCUMENT_ME
    */
   public void setEndpointReference( EndpointReference epr )
   {
      m_epr = epr;
   }

   /**
    * DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    */
   public EndpointReference getEndpointReference(  )
   {
      return m_epr;
   }

   /**
    * DOCUMENT_ME
    *
    * @param resourceId DOCUMENT_ME
    */
   public void setID( Object resourceId )
   {
      m_id = resourceId;
   }

   /**
    * DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    */
   public Object getID(  )
   {
      return m_id;
   }

   /**
    * DOCUMENT_ME
    *
    * @param resourcePropertySet DOCUMENT_ME
    */
   public void setResourcePropertySet( ResourcePropertySet resourcePropertySet )
   {
      m_resourcePropertySet = resourcePropertySet;
   }

   /**
    * DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    */
   public ResourcePropertySet getResourcePropertySet(  )
   {
      return m_resourcePropertySet;
   }

   /**
    * DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    */
   public org.apache.ws.notification.topics.TopicSpaceSet getTopicSpaceSet(  )
   {
      return m_topicSpaceSet;
   }

   /**
    * DOCUMENT_ME
    *
    * @param resourceTerminationListener DOCUMENT_ME
    */
   public void addTerminationListener( ResourceTerminationListener resourceTerminationListener )
   {
   }

   /**
    * DOCUMENT_ME
    */
   public void destroy(  )
   {
   }

   /**
    * DOCUMENT_ME
    */
   public void init(  )
   {
      NotificationProducerRPDocument notificationProducerRPDocument =
         NotificationProducerRPDocument.Factory.newInstance(  );
      notificationProducerRPDocument.addNewNotificationProducerRP(  );
      m_resourcePropertySet = new XmlBeansResourcePropertySet( notificationProducerRPDocument );

      org.apache.ws.resource.properties.ResourceProperty topicProp =
         getResourcePropertySet(  ).get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_TOPIC );
      topicProp.setCallback( new org.apache.ws.notification.base.TopicResourcePropertyCallback( getTopicSpaceSet(  ) ) );

      org.apache.ws.resource.properties.ResourceProperty fixedTopicSetProp =
         getResourcePropertySet(  ).get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET );
      fixedTopicSetProp.setCallback( new org.apache.ws.notification.base.FixedTopicSetResourcePropertyCallback( getTopicSpaceSet(  ) ) );

      org.apache.ws.resource.properties.ResourceProperty topicExpressionDialectsProp =
         getResourcePropertySet(  ).get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS );
      topicExpressionDialectsProp.setCallback( new org.apache.ws.notification.base.TopicExpressionDialectsResourcePropertyCallback(  ) );

      TopicSpaceImpl topicSpace = new TopicSpaceImpl( UnitExampleHome.TARGET_NAMESPACE );
      try
      {
         topicSpace.addTopic( TOPIC_NAME );
         getTopicSpaceSet(  ).addTopicSpace( topicSpace );
         org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics( getResourcePropertySet(  ),
                                                                                                 getTopicSpaceSet(  ) );
      }
      catch ( Exception e )
      {
         throw new javax.xml.rpc.JAXRPCException( "Unable to init the ResourceProperty Changed topics. Cause: "
                                                  + e.getLocalizedMessage(  ), e );
      }
   }
}
TOP

Related Classes of org.apache.ws.notification.base.impl.UnitResource

TOP
Copyright © 2018 www.massapi.com. 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.