Author: scamp
Date: Tue Jan 25 09:57:59 2005
New Revision: 126406

URL: http://svn.apache.org/viewcvs?view=rev&rev=126406
Log:
updated for topics
Added:
   incubator/hermes/trunk/src/java/org/apache/ws/util/JNDIConstants.java
Removed:
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicList.java
Modified:
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
   (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
   Tue Jan 25 09:57:59 2005
@@ -19,6 +19,7 @@
 import org.apache.ws.resource.properties.query.QueryExpression;

 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;

 import org.apache.ws.notification.topics.TopicExpression;

+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;

 

 /**

  * Interface to be implemented by subscription resources. Exposes the 
information

@@ -63,4 +64,7 @@
      */

     Resource getResource() throws Exception;

 

+    void setEpr(EndpointReferenceType epr);

+

+    EndpointReferenceType getEpr();

 }


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
      (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
      Tue Jan 25 09:57:59 2005
@@ -79,6 +79,8 @@
     protected Calendar m_creationTime;

     protected String m_id = null;

 

+    protected EndpointReferenceType m_epr;

+

     transient protected ResourcePropertySet m_propSet;

 

     private static final UuidGenerator UUID_GEN =

@@ -303,7 +305,7 @@
                         SimpleSubscriptionTopicListener lt =

                                 (SimpleSubscriptionTopicListener) listener;

                         Object subKey =

-                                lt.getSubscriptionResourceKey().getValue();

+                                lt.getSubscription().getID();

                         if ( subKey.equals( m_id ) )

                         {

                             topicListenerIterator.remove();

@@ -342,5 +344,13 @@
         return null;  //To change body of implemented methods use File | 
Settings | File Templates.

     }

 

+    public EndpointReferenceType getEpr()

+    {

+        return m_epr;

+    }

 

+    public void setEpr(EndpointReferenceType epr)

+    {

+        m_epr = epr;

+    }

 }


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java
  (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/SubscriptionHome.java
  Tue Jan 25 09:57:59 2005
@@ -61,7 +61,7 @@
         return find( resourceContext.getResourceKey() );

     }

 

-    public EndpointReferenceType create(  Class subscriptionResourceClass,

+    public Subscription create(  Class subscriptionResourceClass,

                                  EndpointReferenceType consumerReference,

                                  EndpointReferenceType producerReference,

                                  Calendar initialTerminationTime,

@@ -96,12 +96,13 @@
             SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( 
QName.valueOf( getResourceKeyName()), id);

             add( resourceKey, subscription );

             epr = getEPR(resourceKey, producerReference);

+            subscription.setEpr(epr);

         }

         catch ( Exception e )

         {

             throw new JAXRPCException( e );

         }

-        return epr;

+        return subscription;

     }

    public EndpointReferenceType getEPR( ResourceKey resourceKey, 
EndpointReferenceType producerReference )

     {


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java
    (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v1_2/porttype/impl/NotificationProducerPortTypeImpl.java
    Tue Jan 25 09:57:59 2005
@@ -17,14 +17,20 @@
 

 import org.apache.ws.notification.topics.TopicExpression;

 import org.apache.ws.notification.base.Subscription;

+import org.apache.ws.notification.base.NotificationProducerResource;

 import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;

 import org.apache.ws.notification.base.impl.SubscriptionHome;

 import org.apache.ws.notification.base.v1_2.impl.Subscription1_2Resource;

 import 
org.apache.ws.notification.base.v1_2.porttype.NotificationProducerPortType;

 import org.apache.ws.notification.topics.TopicExpression;

+import org.apache.ws.notification.topics.TopicSpaceSet;

+import org.apache.ws.notification.topics.Topic;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;

+import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener;

 import org.apache.ws.resource.ResourceContext;

 import org.apache.ws.resource.ResourceContextException;

 import org.apache.ws.resource.Resource;

+import org.apache.ws.resource.ResourceException;

 import org.apache.ws.resource.properties.query.QueryExpression;

 import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;

 import 
org.apache.ws.resource.properties.v1_2.porttype.impl.AbstractResourcePropertiesPortType;

@@ -41,9 +47,13 @@
 import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;

 

 import javax.xml.rpc.JAXRPCException;

+import javax.xml.soap.SOAPException;

 import javax.naming.Context;

 import javax.naming.InitialContext;

+import javax.naming.NamingException;

 import java.util.Calendar;

+import java.util.Collection;

+import java.util.Iterator;

 

 /**

  * An implementation of the WS-BaseNotification NotificationProducer portType.

@@ -68,13 +78,43 @@
         QueryExpression precondition = new XmlBeansQueryExpression( 
request.getPrecondition() );

         QueryExpression selector = new XmlBeansQueryExpression( 
request.getSelector() );

         XmlObject subPolicy = request.getSubscriptionPolicy();

-        TopicExpression topicExpr = new XmlBeansTopicExpression( 
request.getTopicExpression() );

-        boolean useNotify = request.getUseNotify();

-        EndpointReferenceType producerEPR = buildEPR( getResourceContext() );

-

-        Context initialContext = new InitialContext(  );

-        SubscriptionHome subscriptionHome = (SubscriptionHome) 
initialContext.lookup( SubscriptionHome.HOME_LOCATION );

-        EndpointReferenceType epr = 
subscriptionHome.create(Subscription1_2Resource.class, consumerEPR, 
producerEPR, initialTerminationTime,subPolicy, precondition, 
selector,getResourceKey(), "",topicExpr,useNotify );

+        EndpointReferenceType epr = null;

+        try

+        {

+            TopicExpression topicExpr = new XmlBeansTopicExpression( 
request.getTopicExpression() );

+            boolean useNotify = request.getUseNotify();

+            EndpointReferenceType producerEPR = buildEPR( getResourceContext() 
);

+

+            Context initialContext = new InitialContext(  );

+            SubscriptionHome subscriptionHome = (SubscriptionHome) 
initialContext.lookup( SubscriptionHome.HOME_LOCATION );

+            Subscription subscription = 
subscriptionHome.create(Subscription1_2Resource.class, consumerEPR, 
producerEPR, initialTerminationTime,subPolicy, precondition, 
selector,getResourceKey(), "",topicExpr,useNotify );

+            epr = subscription.getEpr();

+

+            NotificationProducerResource resource = 
(NotificationProducerResource) getResource();

+            TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet();

+

+            Collection collection = null;

+            try

+            {

+                collection = 
topicSpaceSet.evaluateExpression(topicExpr,getResourceContext().getSOAPMessage().getSOAPPart().getEnvelope());

+            }

+            catch (TopicExpressionException e)

+            {

+                throw new JAXRPCException("An exception occurred during 
subscription. ", e);

+            }

+            //add listeners

+            for (Iterator iterator = collection.iterator(); 
iterator.hasNext();)

+            {

+                Topic topic = (Topic) iterator.next();

+                topic.addTopicListener(new 
SimpleSubscriptionTopicListener(subscription));

+            }

+        }

+        catch (Exception e)

+        {

+            throw new JAXRPCException("An exception occurred during 
subscribing. ", e);

+        }

+

+

         SubscribeResponseDocument subscribeResponseDocument = 
SubscribeResponseDocument.Factory.newInstance();

         SubscribeResponseDocument.SubscribeResponse subscribeResponse = 
subscribeResponseDocument.addNewSubscribeResponse();

         subscribeResponse.setSubscriptionReference( epr);


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java
     (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java
     Tue Jan 25 09:57:59 2005
@@ -50,8 +50,7 @@
      * @throws TopicExpressionException if any other error occurs
      */
     public Collection resolve( TopicExpression expression,
-                               TopicSpace topicSpace,
-                               Element nsContext )
+                               TopicSpace topicSpace )
             throws UnsupportedTopicExpressionDialectException,
             TopicExpressionResolutionException,
             InvalidTopicExpressionException,

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
   (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
   Tue Jan 25 09:57:59 2005
@@ -15,6 +15,10 @@
  
*=============================================================================*/

 package org.apache.ws.notification.topics;

 

+import 
org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;

+

 import java.util.Collection;

 import java.util.Iterator;

 import java.util.List;

@@ -62,7 +66,7 @@
      *                                  if the topic expression is invalid

      * @throws TopicExpressionException if any other error occurs

      */

-    Collection getTopics( TopicExpression topicExpression )

+    Collection getTopics( TopicExpression topicExpression ) throws 
TopicExpressionException, TopicExpressionResolutionException

             /* throws UnsupportedTopicExpressionDialectException, 
TopicExpressionResolutionException, InvalidTopicExpressionException, 
TopicExpressionException */;

 

     /**


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
        (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
        Tue Jan 25 09:57:59 2005
@@ -15,6 +15,12 @@
  
*=============================================================================*/

 package org.apache.ws.notification.topics;

 

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;

+

+import javax.xml.soap.SOAPEnvelope;

+import java.util.Collection;

+

 /**

  * The set of topic spaces that a particular NotificationProducer supports.

  *

@@ -31,4 +37,5 @@
 

     TopicSpace[] getTopicSpaces();

 

+    Collection evaluateExpression(TopicExpression topicExpr, SOAPEnvelope 
envelope) throws TopicExpressionException;

 }


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
 (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
 Tue Jan 25 09:57:59 2005
@@ -15,44 +15,29 @@
  */
 package org.apache.ws.notification.topics.impl;
 
-import java.util.List;
-import java.io.Serializable;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.xml.rpc.Stub;
-
+import org.apache.axis.message.addressing.EndpointReferenceType;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.axis.message.addressing.EndpointReferenceType;
-
-import org.apache.wsrf.ResourceException;
-import org.apache.wsrf.ResourceHome;
-import org.apache.wsrf.ResourceKey;
-import org.apache.wsrf.Subscription;
-import org.apache.wsrf.Topic;
-import org.apache.wsrf.topicexpression.TopicExpressionEngine;
-import org.apache.wsrf.topicexpression.TopicExpressionEvaluator;
-import org.apache.wsrf.TopicListener;
-import org.apache.wsrf.utils.Resources;
-import org.apache.wsrf.impl.security.authentication.Constants;
-import org.apache.wsrf.impl.security.authorization.NoAuthorization;
-import org.apache.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.topics.Topic;
 import org.apache.ws.notification.topics.TopicListener;
-import org.globus.util.I18n;
+import org.apache.ws.notification.topics.TopicExpressionEngine;
+import org.apache.ws.notification.topics.TopicExpressionEvaluator;
+import org.apache.ws.notification.topics.TopicExpression;
+import org.apache.ws.pubsub.NotificationConsumer;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
 
-import org.oasis.wsn.NotificationConsumer;
-import org.oasis.wsn.NotificationMessageHolderType;
-import org.oasis.wsn.TopicExpressionType;
-import org.oasis.wsn.WSBaseNotificationServiceAddressingLocator;
-import org.oasis.wsn.Notify;
+import javax.xml.rpc.Stub;
+import java.io.Serializable;
+import java.util.List;
 
 /**
  * Topic listener implementation that will trigger notifications when a topic
  * changes. To be used in conjunction with the SimpleSubscription class.
  *
- * @see org.apache.wsrf.impl.notification.SimpleSubscription
+ * @see SimpleSubscription
  */
 public class SimpleSubscriptionTopicListener implements TopicListener,
                                                         Serializable
@@ -61,42 +46,25 @@
     private static Log logger =
         LogFactory.getLog(SimpleSubscriptionTopicListener.class.getName());
 
-    private static I18n i18n = I18n.getI18n(Resources.class.getName());
-
-    private ResourceKey key;
-    private String homeLocation;
     private transient NotificationConsumer consumerPort = null;
     private transient WSBaseNotificationServiceAddressingLocator locator =
         null;
+    private Subscription m_subscription;
 
     /**
      * Construct a listener instance.
      *
-     * @param key          The key for the subscription resource associated 
with
-     *                     this listener.
-     * @param homeLocation The JNDI location of the subscription resource home
+     * @param Subscription the subscription which is being wrapped in a 
listener
      */
     public SimpleSubscriptionTopicListener(
-        ResourceKey key,
-        String homeLocation)
+        Subscription subscription)
     {
-        this.key = key;
-        this.homeLocation = homeLocation;
+        this.m_subscription = subscription;
     }
 
     public void topicChanged(Topic topic)
     {
-        Subscription subscription = null;
-        try
-        {
-            subscription = this.getSubscription();
-        }
-        catch(ResourceException e)
-        {
-            logger.warn(i18n.getMessage("subscriptionFindFailed",
-                                        this.key.getValue()));
-            logger.debug("", e);
-        }
+        Subscription subscription = m_subscription;
 
         if (subscription != null) {
             try
@@ -107,50 +75,27 @@
             }
             catch(Exception e)
             {
-                logger.warn(i18n.getMessage("notificationFailed",
-                                            this.key.getValue()));
+                logger.warn("notificationFailed"+    subscription);
                 logger.debug("", e);
             }
         }
     }
 
     public void topicAdded(Topic topic)
-    {
+    {         //todo
     }
 
     public void topicRemoved(Topic topic)
-    {
+    {        //todo
     }
 
-    public Subscription getSubscription() throws ResourceException
-    {
-        ResourceHome home = null;
-        try
-        {
-            Context initialContext = new InitialContext();
-            home = (ResourceHome) initialContext.lookup(this.homeLocation);
-        }
-        catch(Exception e)
-        {
-            throw new ResourceException(
-                i18n.getMessage("subscriptionFindFailed",
-                                this.key.getValue()), e);
-        }
-        return (Subscription) home.find(key);
-    }
 
-    /**
-     * @return String the JNDI location of the Home of the subscription
-     */
-    public String getSubscriptionHomeLocation() {
-        return this.homeLocation;
-    }
 
     /**
-     * @return String the resource key of the subscription
+     * @return Subscription
      */
-    public ResourceKey getSubscriptionResourceKey() {
-        return this.key;
+    public Subscription getSubscription() {
+        return this.m_subscription;
     }
 
 
@@ -173,19 +118,22 @@
             if(!subscription.isPaused())
             {
                 EndpointReferenceType consumerEPR =
-                    subscription.getConsumerReference();
+                    subscription.getNotificationConsumer().getEPR();
                 if(subscription.getUseNotify())
                 {
-                    ClientSecurityDescriptor descriptor =
-                        subscription.getSecurityProperties();
-                    setPort(descriptor, consumerEPR);
-                    Notify notification = new Notify();
+                    setPort(consumerEPR);
+                    NotifyDocument.Notify notification 
=NotifyDocument.Notify.Factory.newInstance();
                     EndpointReferenceType producerEndpoint =
-                        subscription.getProducerReference();
+                        subscription.getNotificationProducer().getEPR();
                     TopicExpressionEngine engine =
                         TopicExpressionEngineImpl.getInstance();
-                    TopicExpressionType tp = subscription.getTopicExpression();
-                    String dialect = tp.getDialect().toString();
+                    TopicExpression topicExpressionIntf = 
subscription.getTopicExpression();
+
+                    TopicExpressionType tp = 
TopicExpressionType.Factory.newInstance();
+                    //todo
+
+
+                    String dialect = 
topicExpressionIntf.getDialect().toString();
                     TopicExpressionEvaluator evaluator =
                         engine.getEvaluator(dialect);
                     TopicExpressionType topicExpression =
@@ -210,43 +158,11 @@
     //TODO: revisit this from perf angle, don't thing we need to regenerate
     // the stub quite as aggressively
     private void setPort(
-        ClientSecurityDescriptor descriptor,
+
         EndpointReferenceType consumerEPR)
         throws Exception
     {
-        if(descriptor != null)
-        {
-            if(descriptor.getGSISecureConv() != null)
-            {
-                logger.debug("Security properties not null: secure conv");
-                // cannot reuse locator
-                WSBaseNotificationServiceAddressingLocator
-                    loc = new WSBaseNotificationServiceAddressingLocator();
-                this.consumerPort =
-                    loc.getNotificationConsumerPort(consumerEPR);
-            }
-            else
-            {
-                // resuse locator, not port
-                logger.debug("Security properties not null: not secure conv");
-                setPort(false, consumerEPR);
-            }
-            logger.debug("Setting security properties");
-            Stub portStub = (Stub) this.consumerPort;
-            // set authz to NoAuthz by default. Could be overridden if
-            // authorization property is set in the security
-            // descriptor
-            if(descriptor.getAuthz() == null)
-            {
-                descriptor.setAuthz(NoAuthorization.getInstance());
-            }
-            portStub._setProperty(Constants.CLIENT_DESCRIPTOR, descriptor);
-        }
-        else
-        {
-            logger.debug("Security properties null");
             setPort(true, consumerEPR);
-        }
     }
 
     private synchronized void setPort(

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
  (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
  Tue Jan 25 09:57:59 2005
@@ -32,6 +32,11 @@
 import org.apache.ws.notification.topics.TopicExpression;
 import org.apache.ws.notification.topics.v1_2.Topics1_2Constants;
 import org.apache.ws.notification.topics.TopicExpression;
+import 
org.apache.ws.notification.topics.topicexpression.impl.UnsupportedTopicExpressionDialectException;
+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException;
+import 
org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;
+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
 
 /**
  * Topic expression evalutor for the "Simple" topic dialect.
@@ -52,7 +57,7 @@
                InvalidTopicExpressionException,
                TopicExpressionException
     {
-        QName topicName = (QName) ((TopicExpressionType) expr).getValue();
+        QName topicName = expr..getValue();
 
         LOG.debug("Looking for topic with namespace: " +
                      topicName.getNamespaceURI() + " and local part " +
@@ -75,6 +80,23 @@
     public String[] getDialects()
     {
         return SUPPORTED_DIALECTS;
+    }
+
+    /**
+     * Converts the expression from dialect specific form to a ordered list of 
QNames. This method throws an exception
+     * if the expression does not evaluate to a concrete topic path.
+     *
+     * @param expression object passed by client representing the topic 
expression
+     * @return a list of QNames describing the concrete topic path
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not 
supported
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public List getConcreteTopicPath(TopicExpression expression) throws 
UnsupportedTopicExpressionDialectException, InvalidTopicExpressionException, 
TopicExpressionException
+    {
+        return null;
     }
 
     public List getConcreteTopicPath(TopicExpressionType expression)

Deleted: 
/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicList.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicList.java?view=auto&rev=126405
==============================================================================

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java
       (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java
       Tue Jan 25 09:57:59 2005
@@ -26,6 +26,8 @@
 import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
 import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException;
 import org.apache.ws.util.jndi.JNDIUtils;
+import org.apache.ws.util.JNDIConstants;
+import org.apache.ws.resource.JndiConstants;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -46,8 +48,8 @@
  */
 public class TopicExpressionEngineImpl implements TopicExpressionEngine
 {
-    //private static String TOPIC_EXPRESSION_EVALUATOR_CONTEXT =
-    //        Constants.JNDI_BASE_NAME + "/topic/eval";
+    private static String TOPIC_EXPRESSION_EVALUATOR_CONTEXT =
+            JndiConstants.CONTEXT_NAME_BASE + "/topic/eval";
 
     private static final Log LOG =
             LogFactory.getLog( TopicExpressionEngineImpl.class.getName() );
@@ -71,11 +73,11 @@
         try
         {
             context = new InitialContext();
-            return (TopicExpressionEngine) context.lookup( 
Constants.DEFAULT_TOPIC_EXPRESSION_ENGINE );
+            return (TopicExpressionEngine) context.lookup( 
JNDIConstants.DEFAULT_TOPIC_EXPRESSION_ENGINE );
         }
         catch ( NamingException e )
         {
-            LOG.error( i18n.getMessage( "topicEngineConfigError" ), e );
+            LOG.error( "topicEngineConfigError" + e );
         }
         return null;
     }
@@ -105,7 +107,7 @@
         }
         catch ( NamingException e )
         {
-            LOG.error( i18n.getMessage( "topicEngineInitError" ), e );
+            LOG.error( "topicEngineInitError" + e );
         }
         finally
         {
@@ -141,7 +143,7 @@
     }
 
     public synchronized Collection resolveTopicExpression( TopicExpression 
topicExpression,
-                                                           TopicSpace 
topicList )
+                                                           TopicSpace 
topicSpace )
             throws 
org.apache.ws.notification.topics.topicexpression.impl.UnsupportedTopicExpressionDialectException,
             TopicExpressionResolutionException,
             InvalidTopicExpressionException,
@@ -149,13 +151,13 @@
     {
         if ( topicExpression == null )
         {
-            throw new InvalidTopicExpressionException( i18n.getMessage( 
"nullArgument", "topicExpression" ) );
+            throw new InvalidTopicExpressionException(  
"nullArgument"+"topicExpression"  );
         }
 
         if ( topicExpression.getDialect() == null )
         {
             throw new 
org.apache.ws.notification.topics.topicexpression.impl.UnsupportedTopicExpressionDialectException(
-                    i18n.getMessage( "nullArgument", "topicExpression.dialect" 
) );
+                     "nullArgument"+"topicExpression.dialect"  );
         }
 
         String dialect = topicExpression.getDialect().toString();
@@ -183,7 +185,7 @@
             }
             throw new UnsupportedTopicExpressionDialectException();
         }
-        return evaluator.resolve( topicExpression, topicList );
+        return evaluator.resolve( topicExpression, topicSpace );
     }
 
     public synchronized List getConcretePath( TopicExpression topicExpression )
@@ -195,13 +197,13 @@
         if ( topicExpression == null )
         {
             throw new 
org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException(
-                    i18n.getMessage( "nullArgument", "topicExpression" ) );
+                    "nullArgument"+ "topicExpression" );
         }
 
         if ( topicExpression.getDialect() == null )
         {
             throw new 
org.apache.ws.notification.topics.topicexpression.impl.UnsupportedTopicExpressionDialectException(
-                    i18n.getMessage( "nullArgument", "topicExpression.dialect" 
) );
+                     "nullArgument"+ "topicExpression.dialect" );
         }
 
         String dialect = topicExpression.getDialect().toString();

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java
  (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java
  Tue Jan 25 09:57:59 2005
@@ -19,12 +19,18 @@
 import org.apache.ws.notification.topics.TopicExpression;

 import org.apache.ws.notification.topics.TopicSpace;

 import org.apache.ws.notification.topics.TopicListener;

+import org.apache.ws.notification.topics.TopicExpressionEngine;

+import 
org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.UnsupportedTopicExpressionDialectException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;

 

 import java.util.Collection;

 import java.util.HashMap;

 import java.util.Iterator;

 import java.util.List;

 import java.util.Map;

+import java.net.URI;

 

 /**

  * TODO

@@ -33,6 +39,8 @@
 {

     private String m_namespaceURI;

     private Map m_rootTopicMap = new HashMap();

+    private static TopicExpressionEngine m_topicExpressionEngine =

+        TopicExpressionEngineImpl.getInstance();

 

     public TopicSpaceImpl( String namespaceURI )

     {

@@ -54,10 +62,9 @@
         m_rootTopicMap.remove( topic.getName() );

     }

 

-    public Collection getTopics( TopicExpression topicExpression )

-            /* throws UnsupportedTopicExpressionDialectException, 
TopicExpressionResolutionException, InvalidTopicExpressionException, 
TopicExpressionException */

+    public Collection getTopics( TopicExpression topicExpression ) throws 
TopicExpressionException, TopicExpressionResolutionException

     {

-        return null;  // TODO

+        return  
m_topicExpressionEngine.resolveTopicExpression(topicExpression, this);

     }

 

     public Topic getTopic( List topicPath )


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java?view=diff&rev=126406&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java&r1=126405&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java&r2=126406
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java
       (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java
       Tue Jan 25 09:57:59 2005
@@ -1,13 +1,19 @@
 package org.apache.ws.notification.topics.impl;

 

-import org.apache.ws.notification.topics.TopicSpaceSet;

-import org.apache.ws.notification.topics.TopicSpace;

 import org.apache.ws.notification.topics.Topic;

-

-import java.util.List;

-import java.util.Map;

+import org.apache.ws.notification.topics.TopicExpression;

+import org.apache.ws.notification.topics.TopicSpace;

+import org.apache.ws.notification.topics.TopicSpaceSet;

+import 
org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;

+import org.apache.xml.utils.PrefixResolverDefault;

+import org.w3c.dom.Text;

+

+import javax.xml.rpc.JAXRPCException;

+import javax.xml.soap.SOAPEnvelope;

+import java.util.Collection;

 import java.util.Hashtable;

 import java.util.Iterator;

+import java.util.Map;

 

 

 /**

@@ -50,5 +56,30 @@
     public TopicSpace[] getTopicSpaces()

     {

         return (TopicSpace[]) m_topicSpaces.values().toArray(new 
TopicSpace[0]);

+    }

+

+    public Collection evaluateExpression(TopicExpression topicExpr, 
SOAPEnvelope envelope)

+            throws TopicExpressionException

+    {

+        if(envelope == null)

+        {

+            throw new JAXRPCException("The SOAPEnvelope cannot be null.  
Unable to evaluate TopicExpression");

+        }

+        Text content = (Text) topicExpr.getContent();

+        String nodeValue = content.getNodeValue();

+        String prefix = nodeValue.substring(0, nodeValue.indexOf(":"));

+        if(prefix == null || prefix.equals(""))

+        {

+            throw new JAXRPCException("Unable to determine namespace prefix 
for: " + nodeValue);

+        }

+        PrefixResolverDefault prefixResolver = new 
PrefixResolverDefault(envelope);

+        String namespaceForPrefix = 
prefixResolver.getNamespaceForPrefix(prefix);

+        if(namespaceForPrefix == null || namespaceForPrefix.equals(""))

+        {

+            throw new JAXRPCException("Unable to determine namespace for 
prefix: " + prefix);

+        }

+

+        TopicSpace topicSpace = getTopicSpace(namespaceForPrefix);

+        return topicSpace.getTopics(topicExpr);

     }

 }


Added: incubator/hermes/trunk/src/java/org/apache/ws/util/JNDIConstants.java
Url: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/util/JNDIConstants.java?view=auto&rev=126406
==============================================================================
--- (empty file)
+++ incubator/hermes/trunk/src/java/org/apache/ws/util/JNDIConstants.java       
Tue Jan 25 09:57:59 2005
@@ -0,0 +1,15 @@
+package org.apache.ws.util;

+

+import org.apache.ws.resource.JndiConstants;

+

+/**

+ * @author Sal Campana

+ */

+public interface JNDIConstants

+{

+       /**

+     * JNDI path to the default topic expression engine

+     */

+    public static final String DEFAULT_TOPIC_EXPRESSION_ENGINE =

+        JndiConstants.CONTEXT_NAME_BASE + 
"/topic/ContainerTopicExpressionEngine";

+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to