Hi sam,

Samuel Meder wrote:

What's the rationale for this interface change?


its not really a change, its an enhancement. ian changed the topicPath attribute which was a list of QName in globus to a list of strings, cause the NameSpace in a TopicExpression never changes.
I added a method to get the TopicSpace of each Topic, so we are able to get the NameSpace.


Ok with that?

stefan

/Sam

On Tue, 2005-03-01 at 16:07 +0000, [EMAIL PROTECTED] wrote:


Author: lischke
Date: Tue Mar  1 08:07:51 2005
New Revision: 155798

URL: http://svn.apache.org/viewcvs?view=rev&rev=155798
Log:
added TopicSpace reference to Topic, to get NameSpace

Modified:
   incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceImpl.java
   
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicSpaceParser.java

Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java?view=diff&r1=155797&r2=155798
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java 
(original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java 
Tue Mar  1 08:07:51 2005
@@ -117,4 +117,18 @@
     */
    Iterator topicIterator();

+ /**
+ * Set the TopicSpace this Topic is part of
+ *
+ * @param topicSpace The TopicSpace this Topic is part of
+ */
+ void setTopicSpace( TopicSpace topicSpace );
+ + /**
+ * gets the TopicSpace this Topic is part of
+ *
+ * @return The TopicSpace this Topic is part of
+ */
+ TopicSpace getTopicSpace();
+
}


Modified: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java?view=diff&r1=155797&r2=155798
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
 (original)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
 Tue Mar  1 08:07:51 2005
@@ -18,6 +18,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpace;
import org.apache.ws.notification.topics.TopicExpression;
import org.apache.ws.notification.topics.TopicListener;

@@ -41,6 +42,7 @@
    protected String m_name;
    protected Object m_current;
    protected List m_topicPath; // ordered set of QNames
+    protected TopicSpace m_topicSpace;
    private static final Log LOG = LogFactory.getLog( TopicImpl.class.getName() 
);

    public void addTopic( Topic topic ) throws Exception
@@ -54,12 +56,14 @@

        List topicPath = new LinkedList();

-        if(m_topicPath!=null)
-            topicPath.addAll( m_topicPath );
+        topicPath.addAll( m_topicPath );
        topicPath.add( topic.getName() );

topic.setTopicPath( topicPath );
topic.addTopicListener( this );
+ + topic.setTopicSpace(m_topicSpace);
+ this.topicAdded( topic );
}


@@ -175,7 +179,10 @@
        this.m_listeners = listeners;
        this.m_name = name;
        this.m_current = current;
-        this.m_topicPath = topicPath;
+        if(topicPath==null){
+            this.m_topicPath = new java.util.LinkedList();
+            m_topicPath.add(name);
+        }
    }

public synchronized void topicAdded( Topic topic )
@@ -220,4 +227,12 @@
public String toString(){
return getName();
}
+ + public void setTopicSpace(TopicSpace topicSpace) {
+ m_topicSpace=topicSpace;
+ }
+ + public TopicSpace getTopicSpace() {
+ return m_topicSpace;
+ } }


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&r1=155797&r2=155798
==============================================================================
--- 
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 Mar  1 08:07:51 2005
@@ -52,6 +52,7 @@
    public void addTopic( Topic topic )
    {
        m_rootTopicMap.put( topic.getName(), topic );
+        topic.setTopicSpace(this);
    }

    public void removeTopic( Topic topic )

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicSpaceParser.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicSpaceParser.java?view=diff&r1=155797&r2=155798
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicSpaceParser.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicSpaceParser.java Tue Mar 1 08:07:51 2005
@@ -28,15 +28,15 @@
// Parse the input with the default (non-validating) parser
stack= new java.util.Stack();
try{
- SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
- //System.out.println("start parsing");
- saxParser.parse( is, handler );
- //System.out.println("end parsing");
-
+ SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
+ //System.out.println("start parsing");
+ saxParser.parse( is, handler );
+ //System.out.println("end parsing");
+ }catch(Exception e){
e.printStackTrace();
}
- return m_topicSpace; + return m_topicSpace;
}
public void startElement( String namespaceURI,
@@ -44,25 +44,25 @@
String qName, // qualified name
Attributes attrs ) throws SAXException {
try{
- //System.out.println("start element "+qName);
- if(qName.endsWith("topicSpace")){
- tns=attrs.getValue("targetNamespace");
- m_topicSpace=new TopicSpaceImpl(tns);
- //System.out.println("topicspace "+tns);
- }
- if(qName.endsWith("topic")){
- Topic t=new TopicImpl(attrs.getValue("name"));
- if(depth==0){
- m_topicSpace.addTopic(t); - stack.push(t);
- }else{
- Topic in = (Topic)stack.peek();
- in.addTopic(t);
- stack.push(t);
- } - //System.out.println(depth+" : "+attrs.getValue("name"));
- depth++;
- } + //System.out.println("start element "+qName);
+ if(qName.endsWith("topicSpace")){
+ tns=attrs.getValue("targetNamespace");
+ m_topicSpace=new TopicSpaceImpl(tns);
+ //System.out.println("topicspace "+tns);
+ }
+ if(qName.endsWith("topic")){
+ Topic t=new TopicImpl(attrs.getValue("name"));
+ if(depth==0){
+ m_topicSpace.addTopic(t);
+ stack.push(t);
+ }else{
+ Topic in = (Topic)stack.peek();
+ in.addTopic(t);
+ stack.push(t);
+ }
+ //System.out.println(depth+" : "+attrs.getValue("name"));
+ depth++;
+ }
}catch(Exception e){
e.printStackTrace();
}
@@ -77,7 +77,7 @@
depth--;
stack.pop();
}
-
- } + + }
}
}




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





--
My place : http://user.cs.tu-berlin.de/~lischke


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



Reply via email to