You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2004/07/13 11:08:19 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event NotificationTrigger.java Subscriber.java
luetzkendorf 2004/07/13 02:08:19
Modified: src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Log:
some changes to satisfy the notification test cases
Revision Changes Path
1.11 +51 -35 jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/NotificationTrigger.java
Index: NotificationTrigger.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/NotificationTrigger.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
+++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
@@ -80,6 +80,8 @@
}
public boolean removeSubscriber(Subscriber subscriber) {
+ Domain.log("Removing subscriber with ID: "+subscriber.getId(), LOG_CHANNEL, Logger.INFO);
+ subscriber.getLifetime().cancel();
return subscribers.remove(subscriber);
}
@@ -122,8 +124,11 @@
private void notifySubscribers(EventCollection collection) {
Map subscriberEnumerations = new HashMap();
- ContentEvent[] update = EventCollectionFilter.getChangedContents(collection);
List matchingSubscribers = new ArrayList();
+
+ // get subscribers with matching notification types
+ // (and remember events)
+ ContentEvent[] update = EventCollectionFilter.getChangedContents(collection);
for ( int i = 0; i < update.length; i++ ) {
matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE, update[i]));
}
@@ -136,34 +141,42 @@
matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE, delete[i]));
}
// FIXME: Add methods for MOVE, and NEW_MAIL (??) to get full exchange notification compliance
+
+ // notifiy subscribers
for ( Iterator i = matchingSubscribers.iterator(); i.hasNext(); ) {
- final Subscriber subscriber = (Subscriber)i.next();
- if ( subscriber.getNotificationDelay() == 0 ) {
- // send notification without delay
- List idList = (List)subscriberEnumerations.get(subscriber.getCallback());
- if ( idList == null ) {
- idList = new ArrayList();
- subscriberEnumerations.put(subscriber.getCallback(), idList);
- }
- Integer subscriberId = new Integer(subscriber.getId());
- if ( !idList.contains(subscriberId) ) {
- idList.add(subscriberId);
- }
- } else {
- // send delayed notification
- TimerTask notifyTask = subscriber.getNotify();
- if ( notifyTask == null ) {
- Domain.log("Starting notification delay: "+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
- notifyTask = new TimerTask() {
- public void run() {
- notifySubscriber(subscriber.getCallback(), String.valueOf(subscriber.getId()));
- subscriber.setNotify(null);
- }
- };
- subscriber.setNotify(notifyTask);
- timer.schedule(notifyTask, subscriber.getNotificationDelay()*1000);
- }
- }
+ final Subscriber subscriber = (Subscriber)i.next();
+
+ // skip subscribers that has no callback (we can't notify them)
+ if (!subscriber.hasCallback()) continue;
+
+ if ( subscriber.getNotificationDelay() == 0 ) {
+ // send notification without delay
+ List idList = (List)subscriberEnumerations.get(subscriber.getCallback());
+ if ( idList == null ) {
+ idList = new ArrayList();
+ subscriberEnumerations.put(subscriber.getCallback(), idList);
+ }
+ Integer subscriberId = new Integer(subscriber.getId());
+ if ( !idList.contains(subscriberId) ) {
+ idList.add(subscriberId);
+ }
+ } else {
+ // send delayed notification
+ TimerTask notifyTask = subscriber.getNotify();
+ if ( notifyTask == null ) {
+ Domain.log("Starting notification delay: "+subscriber.getNotificationDelay(),
+ LOG_CHANNEL, Logger.INFO);
+ notifyTask = new TimerTask() {
+ public void run() {
+ notifySubscriber(subscriber.getCallback(),
+ String.valueOf(subscriber.getId()));
+ subscriber.setNotify(null);
+ }
+ };
+ subscriber.setNotify(notifyTask);
+ timer.schedule(notifyTask, subscriber.getNotificationDelay()*1000);
+ }
+ }
}
for ( Iterator i = subscriberEnumerations.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry = (Map.Entry)i.next();
@@ -185,14 +198,16 @@
}
}
- private void notifySubscriber(String callback, String subscribers) {
+ protected void notifySubscriber(String callback, String subscribers) {
if ( callback.startsWith(TCP_PROTOCOL) ) {
Domain.log("Notify subscribers with adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL, Logger.INFO);
NotifyMethod notifyMethod = new NotifyMethod(callback.toString());
notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE, subscribers);
try {
URL url = new URL(callback);
- int state = notifyMethod.execute(new HttpState(), new HttpConnection(url.getHost(), url.getPort()));
+ notifyMethod.execute(
+ new HttpState(), new HttpConnection(url.getHost(),
+ url.getPort()!=-1 ? url.getPort() : 80));
} catch (IOException e) {
Domain.log("Notification of subscriber '"+callback.toString()+"' failed!");
}
@@ -203,7 +218,8 @@
String notification = "NOTIFY "+callback+" HTTP/1.1\nSubscription-id: "+subscribers;
byte[] buf = notification.getBytes();
InetAddress address = InetAddress.getByName(url.getHost());
- DatagramPacket packet = new DatagramPacket(buf, buf.length, address, url.getPort());
+ DatagramPacket packet = new DatagramPacket(
+ buf, buf.length, address, url.getPort()!=-1 ? url.getPort() : 80);
socket.send(packet);
} catch (IOException e) {
Domain.log("Notification of subscriber '"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
1.9 +11 -7 jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscriber.java
Index: Subscriber.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscriber.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
+++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
@@ -90,9 +90,9 @@
// check if event matches notification-type
// see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_notification_type_header.asp
// for details
- if ( notificationType.equals(type) ||
- ( type.equals(NEW_MEMBER) && notificationType.equals(UPDATE) && depth == 1 ) ||
- ( type.equals(DELETE) && notificationType.equals(UPDATE) && depth == 1 ) ){
+ if ( type.equalsIgnoreCase(notificationType) ||
+ ( type.equalsIgnoreCase(NEW_MEMBER) && notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
+ ( type.equalsIgnoreCase(DELETE) && notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
String eventUri = event.getUri();
if ( eventUri != null && uri != null ) {
if ( depth == 0 && eventUri.equals(uri.toString()) ) return true;
@@ -107,6 +107,10 @@
return false;
}
+ public boolean hasCallback() {
+ return this.callback != null && this.callback.length() > 0;
+ }
+
public String getCallback() {
return callback;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Posted by Stefan Lützkendorf <lu...@apache.org>.
Ragia, see my comments. Regards
Ragia wrote:
> Thanx Stefan..well it seems I will work with the source files I downloaded
> from the jakarta site
> So far I have to questions:
>
> 1. I need to integrate WEBDAV to my content management system, and found no
> developer documentation on the slide link, is there any such documentation
> any where???
Sorry but documentation is currently quite poor. Try the wiki and search
or query the mailing list look at the sources, thats all we have.
>
> 2. I tried to deploy the slide.war to oc4j but found no hints to do so, I
slide.war is a web application and requires a WebContainer. If oc4j is a
WebContainer *it* should document how to install a web application.
J2EE integration is currently under development (I think).
> tried to compile the source file on JDeveloper
> but it just gives me an internal compiler error, Did any body try that??
Don't know. Not me.
>
> Thanx a lot!
>
> -----Original Message-----
> From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 12:39 PM
> To: Slide Developers Mailing List
> Subject: Re: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> I now people that use a perl-sript for accessing cvs via viewcvs.
>
> please have a look at
> http://lists.gnu.org/archive/html/emacs-devel/2003-08/msg00023.html
>
> I have never used it, but it sounds promissing.
>
> The ViewCVS access of the Slide source your found at
> http://cvs.apache.org/viewcvs.cgi/jakarta-slide/
>
> I hope this helps,
> Stefan
>
> Ragia wrote:
>
>>Thanx for ur concerns,
>>
>>Well, yes we are behind a firewall
>>
>>I tried "telnet cvs.apache.org 2401" & it says:
>>
>>Connecting To cvs.apache.org...Could not open a connection to host on
>>port
>>2401
>>: Connect failed
>>
>>Is that mean that I have no chance ever ? :(
>>
>>-----Original Message-----
>>From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
>>Sent: Tuesday, July 13, 2004 11:56 AM
>>To: Slide Developers Mailing List
>>Subject: Re: cvs commit:
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>NotificationTrigger.java Subscriber.java
>>
>>Seems to be a network problem,
>>
>>are you behind a firewall?
>>do you get a connection if you try "telnet cvs.apache.org 2401" ?
>>
>>Ragia wrote:
>>
>>
>>>Thanx for the reply!!
>>>
>>>I tried what you kindly suggested but in vain
>>>
>>>Here it is the result
>>>
>>>cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>>jakarta-slide
>>>
>>>***** CVS exited normally with code 1 *****
>>>
>>>cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No
>>>connection could be made because the target machine actively refused it.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
>>>Sent: Tuesday, July 13, 2004 11:34 AM
>>>To: Slide Developers Mailing List
>>>Subject: Re: cvs commit:
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>>NotificationTrigger.java Subscriber.java
>>>
>>>Did you set Authentication to pserver
>>>
>>>try the following on the console
>>> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>>jakarta-slide
>>>
>>>
>>>
>>>Ragia wrote:
>>>
>>>
>>>
>>>>How to connect to CVs
>>>>I used wincvs GUI but it doesnot connect ever I use the the CVs root
>>>>anoncvs@cvs.apache.org:/home/cvspublic
>>>>
>>>>It says that server refused the connection???
>>>>
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
>>>>Sent: Tuesday, July 13, 2004 11:08 AM
>>>>To: jakarta-slide-cvs@apache.org
>>>>Subject: cvs commit:
>>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>>>NotificationTrigger.java Subscriber.java
>>>>
>>>>luetzkendorf 2004/07/13 02:08:19
>>>>
>>>>Modified: src/webdav/server/org/apache/slide/webdav/event
>>>> NotificationTrigger.java Subscriber.java
>>>>Log:
>>>>some changes to satisfy the notification test cases
>>>>
>>>>Revision Changes Path
>>>>1.11 +51 -35
>>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notific
>>>>a
>>>>tionTr
>>>>igger.java
>>>>
>>>>Index: NotificationTrigger.java
>>>>===================================================================
>>>>RCS file:
>>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/eve
>>>>n
>>>>t/Noti
>>>>ficationTrigger.java,v
>>>>retrieving revision 1.10
>>>>retrieving revision 1.11
>>>>diff -u -r1.10 -r1.11
>>>>--- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
>>>>+++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
>>>>@@ -80,6 +80,8 @@
>>>> }
>>>>
>>>> public boolean removeSubscriber(Subscriber subscriber) {
>>>>+ Domain.log("Removing subscriber with ID:
>>>>+ "+subscriber.getId(),
>>>>LOG_CHANNEL, Logger.INFO);
>>>>+ subscriber.getLifetime().cancel();
>>>> return subscribers.remove(subscriber);
>>>> }
>>>>
>>>>@@ -122,8 +124,11 @@
>>>>
>>>> private void notifySubscribers(EventCollection collection) {
>>>> Map subscriberEnumerations = new HashMap();
>>>>- ContentEvent[] update =
>>>>EventCollectionFilter.getChangedContents(collection);
>>>> List matchingSubscribers = new ArrayList();
>>>>+
>>>>+ // get subscribers with matching notification types
>>>>+ // (and remember events)
>>>>+ ContentEvent[] update =
>>>>EventCollectionFilter.getChangedContents(collection);
>>>> for ( int i = 0; i < update.length; i++ ) {
>>>>
>>>>matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
>>>>update[i]));
>>>> }
>>>>@@ -136,34 +141,42 @@
>>>>
>>>>matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
>>>>delete[i]));
>>>> }
>>>> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
>>>>full exchange notification compliance
>>>>+
>>>>+ // notifiy subscribers
>>>> for ( Iterator i = matchingSubscribers.iterator();
>>>>i.hasNext(); ) {
>>>>- final Subscriber subscriber = (Subscriber)i.next();
>>>>- if ( subscriber.getNotificationDelay() == 0 ) {
>>>>- // send notification without delay
>>>>- List idList =
>>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>>>- if ( idList == null ) {
>>>>- idList = new ArrayList();
>>>>-
>>>>subscriberEnumerations.put(subscriber.getCallback(), idList);
>>>>- }
>>>>- Integer subscriberId = new
>>>>Integer(subscriber.getId());
>>>>- if ( !idList.contains(subscriberId) ) {
>>>>- idList.add(subscriberId);
>>>>- }
>>>>- } else {
>>>>- // send delayed notification
>>>>- TimerTask notifyTask = subscriber.getNotify();
>>>>- if ( notifyTask == null ) {
>>>>- Domain.log("Starting notification delay:
>>>>"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
>>>>- notifyTask = new TimerTask() {
>>>>- public void run() {
>>>>-
>>>>notifySubscriber(subscriber.getCallback(),
>>>>String.valueOf(subscriber.getId()));
>>>>- subscriber.setNotify(null);
>>>>- }
>>>>- };
>>>>- subscriber.setNotify(notifyTask);
>>>>- timer.schedule(notifyTask,
>>>>subscriber.getNotificationDelay()*1000);
>>>>- }
>>>>- }
>>>>+ final Subscriber subscriber = (Subscriber)i.next();
>>>>+
>>>>+ // skip subscribers that has no callback (we can't
>>>>+ notify
>>>>them)
>>>>+ if (!subscriber.hasCallback()) continue;
>>>>+
>>>>+ if ( subscriber.getNotificationDelay() == 0 ) {
>>>>+ // send notification without delay
>>>>+ List idList =
>>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>>>+ if ( idList == null ) {
>>>>+ idList = new ArrayList();
>>>>+
>>>>+ subscriberEnumerations.put(subscriber.getCallback(),
>>>>idList);
>>>>+ }
>>>>+ Integer subscriberId = new Integer(subscriber.getId());
>>>>+ if ( !idList.contains(subscriberId) ) {
>>>>+ idList.add(subscriberId);
>>>>+ }
>>>>+ } else {
>>>>+ // send delayed notification
>>>>+ TimerTask notifyTask = subscriber.getNotify();
>>>>+ if ( notifyTask == null ) {
>>>>+ Domain.log("Starting notification delay:
>>>>"+subscriber.getNotificationDelay(),
>>>>+ LOG_CHANNEL, Logger.INFO);
>>>>+ notifyTask = new TimerTask() {
>>>>+ public void run() {
>>>>+ notifySubscriber(subscriber.getCallback(),
>>>>+ String.valueOf(subscriber.getId()));
>>>>+ subscriber.setNotify(null);
>>>>+ }
>>>>+ };
>>>>+ subscriber.setNotify(notifyTask);
>>>>+ timer.schedule(notifyTask,
>>>>subscriber.getNotificationDelay()*1000);
>>>>+ }
>>>>+ }
>>>> }
>>>> for ( Iterator i =
>>>>subscriberEnumerations.entrySet().iterator();
>>>>i.hasNext(); ) {
>>>> Map.Entry entry = (Map.Entry)i.next(); @@ -185,14
>>>>+198,16 @@
>>>> }
>>>> }
>>>>
>>>>- private void notifySubscriber(String callback, String subscribers)
>>>
>>>{
>>>
>>>
>>>
>>>>+ protected void notifySubscriber(String callback, String
>>>
>>>subscribers)
>>>
>>>
>>>
>>>>{
>>>> if ( callback.startsWith(TCP_PROTOCOL) ) {
>>>> Domain.log("Notify subscribers with
>>>>adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
>>>
>>>Logger.INFO);
>>>
>>>
>>>
>>>> NotifyMethod notifyMethod = new
>>>>NotifyMethod(callback.toString());
>>>>
>>>>notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
>>>>subscribers);
>>>> try {
>>>> URL url = new URL(callback);
>>>>- int state = notifyMethod.execute(new HttpState(), new
>>>>HttpConnection(url.getHost(), url.getPort()));
>>>>+ notifyMethod.execute(
>>>>+ new HttpState(), new
>>>
>>>HttpConnection(url.getHost(),
>>>
>>>
>>>
>>>>+ url.getPort()!=-1 ? url.getPort() :
>>>>+ 80));
>>>> } catch (IOException e) {
>>>> Domain.log("Notification of subscriber
>>>>'"+callback.toString()+"' failed!");
>>>> }
>>>>@@ -203,7 +218,8 @@
>>>> String notification = "NOTIFY "+callback+"
>>>>HTTP/1.1\nSubscription-id: "+subscribers;
>>>> byte[] buf = notification.getBytes();
>>>> InetAddress address =
>>>>InetAddress.getByName(url.getHost());
>>>>- DatagramPacket packet = new DatagramPacket(buf,
>>>>buf.length, address, url.getPort());
>>>>+ DatagramPacket packet = new DatagramPacket(
>>>>+ buf, buf.length, address, url.getPort()!=-1 ?
>>>>url.getPort() : 80);
>>>> socket.send(packet);
>>>> } catch (IOException e) {
>>>> Domain.log("Notification of subscriber
>>>>'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>>>>
>>>>
>>>>
>>>>1.9 +11 -7
>>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscri
>>>>b
>>>>er.jav
>>>>a
>>>>
>>>>Index: Subscriber.java
>>>>===================================================================
>>>>RCS file:
>>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/eve
>>>>n
>>>>t/Subs
>>>>criber.java,v
>>>>retrieving revision 1.8
>>>>retrieving revision 1.9
>>>>diff -u -r1.8 -r1.9
>>>>--- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
>>>>+++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
>>>>@@ -90,9 +90,9 @@
>>>> // check if event matches notification-type
>>>> // see
>>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/
>>>>w
>>>>ss/_we
>>>>bdav_notification_type_header.asp
>>>> // for details
>>>>- if ( notificationType.equals(type) ||
>>>>- ( type.equals(NEW_MEMBER) &&
>>>
>>>notificationType.equals(UPDATE)
>>>
>>>
>>>
>>>>&& depth == 1 ) ||
>>>>- ( type.equals(DELETE) &&
>>>
>>>notificationType.equals(UPDATE) &&
>>>
>>>>depth == 1 ) ){
>>>>+ if ( type.equalsIgnoreCase(notificationType) ||
>>>>+ ( type.equalsIgnoreCase(NEW_MEMBER) &&
>>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
>>>>+ ( type.equalsIgnoreCase(DELETE) &&
>>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
>>>> String eventUri = event.getUri();
>>>> if ( eventUri != null && uri != null ) {
>>>> if ( depth == 0 &&
>>>
>>>eventUri.equals(uri.toString()) ) return
>>>
>>>
>>>
>>>>true;
>>>>@@ -107,6 +107,10 @@
>>>> return false;
>>>> }
>>>>
>>>>+ public boolean hasCallback() {
>>>>+ return this.callback != null && this.callback.length() > 0;
>>>>+ }
>>>>+
>>>> public String getCallback() {
>>>> return callback;
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>>
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event NotificationTrigger.java Subscriber.java
Posted by Ragia <ra...@asset.com.eg>.
Thanx Stefan..well it seems I will work with the source files I downloaded
from the jakarta site
So far I have to questions:
1. I need to integrate WEBDAV to my content management system, and found no
developer documentation on the slide link, is there any such documentation
any where???
2. I tried to deploy the slide.war to oc4j but found no hints to do so, I
tried to compile the source file on JDeveloper
but it just gives me an internal compiler error, Did any body try that??
Thanx a lot!
-----Original Message-----
From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
Sent: Tuesday, July 13, 2004 12:39 PM
To: Slide Developers Mailing List
Subject: Re: cvs commit:
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
I now people that use a perl-sript for accessing cvs via viewcvs.
please have a look at
http://lists.gnu.org/archive/html/emacs-devel/2003-08/msg00023.html
I have never used it, but it sounds promissing.
The ViewCVS access of the Slide source your found at
http://cvs.apache.org/viewcvs.cgi/jakarta-slide/
I hope this helps,
Stefan
Ragia wrote:
> Thanx for ur concerns,
>
> Well, yes we are behind a firewall
>
> I tried "telnet cvs.apache.org 2401" & it says:
>
> Connecting To cvs.apache.org...Could not open a connection to host on
> port
> 2401
> : Connect failed
>
> Is that mean that I have no chance ever ? :(
>
> -----Original Message-----
> From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:56 AM
> To: Slide Developers Mailing List
> Subject: Re: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> Seems to be a network problem,
>
> are you behind a firewall?
> do you get a connection if you try "telnet cvs.apache.org 2401" ?
>
> Ragia wrote:
>
>>Thanx for the reply!!
>>
>>I tried what you kindly suggested but in vain
>>
>>Here it is the result
>>
>> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>jakarta-slide
>>
>>***** CVS exited normally with code 1 *****
>>
>>cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No
>>connection could be made because the target machine actively refused it.
>>
>>
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
>>Sent: Tuesday, July 13, 2004 11:34 AM
>>To: Slide Developers Mailing List
>>Subject: Re: cvs commit:
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>NotificationTrigger.java Subscriber.java
>>
>>Did you set Authentication to pserver
>>
>>try the following on the console
>> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>jakarta-slide
>>
>>
>>
>>Ragia wrote:
>>
>>
>>>How to connect to CVs
>>>I used wincvs GUI but it doesnot connect ever I use the the CVs root
>>>anoncvs@cvs.apache.org:/home/cvspublic
>>>
>>>It says that server refused the connection???
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
>>>Sent: Tuesday, July 13, 2004 11:08 AM
>>>To: jakarta-slide-cvs@apache.org
>>>Subject: cvs commit:
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>>NotificationTrigger.java Subscriber.java
>>>
>>>luetzkendorf 2004/07/13 02:08:19
>>>
>>> Modified: src/webdav/server/org/apache/slide/webdav/event
>>> NotificationTrigger.java Subscriber.java
>>> Log:
>>> some changes to satisfy the notification test cases
>>>
>>> Revision Changes Path
>>> 1.11 +51 -35
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notific
>>>a
>>>tionTr
>>>igger.java
>>>
>>> Index: NotificationTrigger.java
>>> ===================================================================
>>> RCS file:
>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/eve
>>>n
>>>t/Noti
>>>ficationTrigger.java,v
>>> retrieving revision 1.10
>>> retrieving revision 1.11
>>> diff -u -r1.10 -r1.11
>>> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
>>> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
>>> @@ -80,6 +80,8 @@
>>> }
>>>
>>> public boolean removeSubscriber(Subscriber subscriber) {
>>> + Domain.log("Removing subscriber with ID:
>>> + "+subscriber.getId(),
>>>LOG_CHANNEL, Logger.INFO);
>>> + subscriber.getLifetime().cancel();
>>> return subscribers.remove(subscriber);
>>> }
>>>
>>> @@ -122,8 +124,11 @@
>>>
>>> private void notifySubscribers(EventCollection collection) {
>>> Map subscriberEnumerations = new HashMap();
>>> - ContentEvent[] update =
>>>EventCollectionFilter.getChangedContents(collection);
>>> List matchingSubscribers = new ArrayList();
>>> +
>>> + // get subscribers with matching notification types
>>> + // (and remember events)
>>> + ContentEvent[] update =
>>>EventCollectionFilter.getChangedContents(collection);
>>> for ( int i = 0; i < update.length; i++ ) {
>>>
>>>matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
>>>update[i]));
>>> }
>>> @@ -136,34 +141,42 @@
>>>
>>>matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
>>>delete[i]));
>>> }
>>> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
>>>full exchange notification compliance
>>> +
>>> + // notifiy subscribers
>>> for ( Iterator i = matchingSubscribers.iterator();
>>>i.hasNext(); ) {
>>> - final Subscriber subscriber = (Subscriber)i.next();
>>> - if ( subscriber.getNotificationDelay() == 0 ) {
>>> - // send notification without delay
>>> - List idList =
>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>> - if ( idList == null ) {
>>> - idList = new ArrayList();
>>> -
>>>subscriberEnumerations.put(subscriber.getCallback(), idList);
>>> - }
>>> - Integer subscriberId = new
>>>Integer(subscriber.getId());
>>> - if ( !idList.contains(subscriberId) ) {
>>> - idList.add(subscriberId);
>>> - }
>>> - } else {
>>> - // send delayed notification
>>> - TimerTask notifyTask = subscriber.getNotify();
>>> - if ( notifyTask == null ) {
>>> - Domain.log("Starting notification delay:
>>>"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
>>> - notifyTask = new TimerTask() {
>>> - public void run() {
>>> -
>>>notifySubscriber(subscriber.getCallback(),
>>>String.valueOf(subscriber.getId()));
>>> - subscriber.setNotify(null);
>>> - }
>>> - };
>>> - subscriber.setNotify(notifyTask);
>>> - timer.schedule(notifyTask,
>>>subscriber.getNotificationDelay()*1000);
>>> - }
>>> - }
>>> + final Subscriber subscriber = (Subscriber)i.next();
>>> +
>>> + // skip subscribers that has no callback (we can't
>>> + notify
>>>them)
>>> + if (!subscriber.hasCallback()) continue;
>>> +
>>> + if ( subscriber.getNotificationDelay() == 0 ) {
>>> + // send notification without delay
>>> + List idList =
>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>> + if ( idList == null ) {
>>> + idList = new ArrayList();
>>> +
>>> + subscriberEnumerations.put(subscriber.getCallback(),
>>>idList);
>>> + }
>>> + Integer subscriberId = new Integer(subscriber.getId());
>>> + if ( !idList.contains(subscriberId) ) {
>>> + idList.add(subscriberId);
>>> + }
>>> + } else {
>>> + // send delayed notification
>>> + TimerTask notifyTask = subscriber.getNotify();
>>> + if ( notifyTask == null ) {
>>> + Domain.log("Starting notification delay:
>>>"+subscriber.getNotificationDelay(),
>>> + LOG_CHANNEL, Logger.INFO);
>>> + notifyTask = new TimerTask() {
>>> + public void run() {
>>> + notifySubscriber(subscriber.getCallback(),
>>> + String.valueOf(subscriber.getId()));
>>> + subscriber.setNotify(null);
>>> + }
>>> + };
>>> + subscriber.setNotify(notifyTask);
>>> + timer.schedule(notifyTask,
>>>subscriber.getNotificationDelay()*1000);
>>> + }
>>> + }
>>> }
>>> for ( Iterator i =
>>>subscriberEnumerations.entrySet().iterator();
>>>i.hasNext(); ) {
>>> Map.Entry entry = (Map.Entry)i.next(); @@ -185,14
>>>+198,16 @@
>>> }
>>> }
>>>
>>> - private void notifySubscriber(String callback, String subscribers)
>>
>>{
>>
>>
>>> + protected void notifySubscriber(String callback, String
>>
>>subscribers)
>>
>>
>>>{
>>> if ( callback.startsWith(TCP_PROTOCOL) ) {
>>> Domain.log("Notify subscribers with
>>>adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
>>
>>Logger.INFO);
>>
>>
>>> NotifyMethod notifyMethod = new
>>>NotifyMethod(callback.toString());
>>>
>>>notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
>>>subscribers);
>>> try {
>>> URL url = new URL(callback);
>>> - int state = notifyMethod.execute(new HttpState(), new
>>>HttpConnection(url.getHost(), url.getPort()));
>>> + notifyMethod.execute(
>>> + new HttpState(), new
>>
>>HttpConnection(url.getHost(),
>>
>>
>>> + url.getPort()!=-1 ? url.getPort() :
>>> + 80));
>>> } catch (IOException e) {
>>> Domain.log("Notification of subscriber
>>>'"+callback.toString()+"' failed!");
>>> }
>>> @@ -203,7 +218,8 @@
>>> String notification = "NOTIFY "+callback+"
>>>HTTP/1.1\nSubscription-id: "+subscribers;
>>> byte[] buf = notification.getBytes();
>>> InetAddress address =
>>>InetAddress.getByName(url.getHost());
>>> - DatagramPacket packet = new DatagramPacket(buf,
>>>buf.length, address, url.getPort());
>>> + DatagramPacket packet = new DatagramPacket(
>>> + buf, buf.length, address, url.getPort()!=-1 ?
>>>url.getPort() : 80);
>>> socket.send(packet);
>>> } catch (IOException e) {
>>> Domain.log("Notification of subscriber
>>>'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>>>
>>>
>>>
>>> 1.9 +11 -7
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscri
>>>b
>>>er.jav
>>>a
>>>
>>> Index: Subscriber.java
>>> ===================================================================
>>> RCS file:
>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/eve
>>>n
>>>t/Subs
>>>criber.java,v
>>> retrieving revision 1.8
>>> retrieving revision 1.9
>>> diff -u -r1.8 -r1.9
>>> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
>>> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
>>> @@ -90,9 +90,9 @@
>>> // check if event matches notification-type
>>> // see
>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/
>>>w
>>>ss/_we
>>>bdav_notification_type_header.asp
>>> // for details
>>> - if ( notificationType.equals(type) ||
>>> - ( type.equals(NEW_MEMBER) &&
>>
>>notificationType.equals(UPDATE)
>>
>>
>>>&& depth == 1 ) ||
>>> - ( type.equals(DELETE) &&
>>
>>notificationType.equals(UPDATE) &&
>>
>>>depth == 1 ) ){
>>> + if ( type.equalsIgnoreCase(notificationType) ||
>>> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
>>> + ( type.equalsIgnoreCase(DELETE) &&
>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
>>> String eventUri = event.getUri();
>>> if ( eventUri != null && uri != null ) {
>>> if ( depth == 0 &&
>>
>>eventUri.equals(uri.toString()) ) return
>>
>>
>>>true;
>>> @@ -107,6 +107,10 @@
>>> return false;
>>> }
>>>
>>> + public boolean hasCallback() {
>>> + return this.callback != null && this.callback.length() > 0;
>>> + }
>>> +
>>> public String getCallback() {
>>> return callback;
>>> }
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Posted by Stefan Lützkendorf <lu...@apache.org>.
I now people that use a perl-sript for accessing cvs via viewcvs.
please have a look at
http://lists.gnu.org/archive/html/emacs-devel/2003-08/msg00023.html
I have never used it, but it sounds promissing.
The ViewCVS access of the Slide source your found at
http://cvs.apache.org/viewcvs.cgi/jakarta-slide/
I hope this helps,
Stefan
Ragia wrote:
> Thanx for ur concerns,
>
> Well, yes we are behind a firewall
>
> I tried "telnet cvs.apache.org 2401" & it says:
>
> Connecting To cvs.apache.org...Could not open a connection to host on port
> 2401
> : Connect failed
>
> Is that mean that I have no chance ever ? :(
>
> -----Original Message-----
> From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:56 AM
> To: Slide Developers Mailing List
> Subject: Re: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> Seems to be a network problem,
>
> are you behind a firewall?
> do you get a connection if you try "telnet cvs.apache.org 2401" ?
>
> Ragia wrote:
>
>>Thanx for the reply!!
>>
>>I tried what you kindly suggested but in vain
>>
>>Here it is the result
>>
>> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>jakarta-slide
>>
>>***** CVS exited normally with code 1 *****
>>
>>cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No
>>connection could be made because the target machine actively refused it.
>>
>>
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
>>Sent: Tuesday, July 13, 2004 11:34 AM
>>To: Slide Developers Mailing List
>>Subject: Re: cvs commit:
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>NotificationTrigger.java Subscriber.java
>>
>>Did you set Authentication to pserver
>>
>>try the following on the console
>> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
>>jakarta-slide
>>
>>
>>
>>Ragia wrote:
>>
>>
>>>How to connect to CVs
>>>I used wincvs GUI but it doesnot connect ever I use the the CVs root
>>>anoncvs@cvs.apache.org:/home/cvspublic
>>>
>>>It says that server refused the connection???
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
>>>Sent: Tuesday, July 13, 2004 11:08 AM
>>>To: jakarta-slide-cvs@apache.org
>>>Subject: cvs commit:
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>>NotificationTrigger.java Subscriber.java
>>>
>>>luetzkendorf 2004/07/13 02:08:19
>>>
>>> Modified: src/webdav/server/org/apache/slide/webdav/event
>>> NotificationTrigger.java Subscriber.java
>>> Log:
>>> some changes to satisfy the notification test cases
>>>
>>> Revision Changes Path
>>> 1.11 +51 -35
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notifica
>>>tionTr
>>>igger.java
>>>
>>> Index: NotificationTrigger.java
>>> ===================================================================
>>> RCS file:
>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>>t/Noti
>>>ficationTrigger.java,v
>>> retrieving revision 1.10
>>> retrieving revision 1.11
>>> diff -u -r1.10 -r1.11
>>> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
>>> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
>>> @@ -80,6 +80,8 @@
>>> }
>>>
>>> public boolean removeSubscriber(Subscriber subscriber) {
>>> + Domain.log("Removing subscriber with ID: "+subscriber.getId(),
>>>LOG_CHANNEL, Logger.INFO);
>>> + subscriber.getLifetime().cancel();
>>> return subscribers.remove(subscriber);
>>> }
>>>
>>> @@ -122,8 +124,11 @@
>>>
>>> private void notifySubscribers(EventCollection collection) {
>>> Map subscriberEnumerations = new HashMap();
>>> - ContentEvent[] update =
>>>EventCollectionFilter.getChangedContents(collection);
>>> List matchingSubscribers = new ArrayList();
>>> +
>>> + // get subscribers with matching notification types
>>> + // (and remember events)
>>> + ContentEvent[] update =
>>>EventCollectionFilter.getChangedContents(collection);
>>> for ( int i = 0; i < update.length; i++ ) {
>>>
>>>matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
>>>update[i]));
>>> }
>>> @@ -136,34 +141,42 @@
>>>
>>>matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
>>>delete[i]));
>>> }
>>> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
>>>full exchange notification compliance
>>> +
>>> + // notifiy subscribers
>>> for ( Iterator i = matchingSubscribers.iterator();
>>>i.hasNext(); ) {
>>> - final Subscriber subscriber = (Subscriber)i.next();
>>> - if ( subscriber.getNotificationDelay() == 0 ) {
>>> - // send notification without delay
>>> - List idList =
>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>> - if ( idList == null ) {
>>> - idList = new ArrayList();
>>> -
>>>subscriberEnumerations.put(subscriber.getCallback(), idList);
>>> - }
>>> - Integer subscriberId = new
>>>Integer(subscriber.getId());
>>> - if ( !idList.contains(subscriberId) ) {
>>> - idList.add(subscriberId);
>>> - }
>>> - } else {
>>> - // send delayed notification
>>> - TimerTask notifyTask = subscriber.getNotify();
>>> - if ( notifyTask == null ) {
>>> - Domain.log("Starting notification delay:
>>>"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
>>> - notifyTask = new TimerTask() {
>>> - public void run() {
>>> -
>>>notifySubscriber(subscriber.getCallback(),
>>>String.valueOf(subscriber.getId()));
>>> - subscriber.setNotify(null);
>>> - }
>>> - };
>>> - subscriber.setNotify(notifyTask);
>>> - timer.schedule(notifyTask,
>>>subscriber.getNotificationDelay()*1000);
>>> - }
>>> - }
>>> + final Subscriber subscriber = (Subscriber)i.next();
>>> +
>>> + // skip subscribers that has no callback (we can't notify
>>>them)
>>> + if (!subscriber.hasCallback()) continue;
>>> +
>>> + if ( subscriber.getNotificationDelay() == 0 ) {
>>> + // send notification without delay
>>> + List idList =
>>>(List)subscriberEnumerations.get(subscriber.getCallback());
>>> + if ( idList == null ) {
>>> + idList = new ArrayList();
>>> + subscriberEnumerations.put(subscriber.getCallback(),
>>>idList);
>>> + }
>>> + Integer subscriberId = new Integer(subscriber.getId());
>>> + if ( !idList.contains(subscriberId) ) {
>>> + idList.add(subscriberId);
>>> + }
>>> + } else {
>>> + // send delayed notification
>>> + TimerTask notifyTask = subscriber.getNotify();
>>> + if ( notifyTask == null ) {
>>> + Domain.log("Starting notification delay:
>>>"+subscriber.getNotificationDelay(),
>>> + LOG_CHANNEL, Logger.INFO);
>>> + notifyTask = new TimerTask() {
>>> + public void run() {
>>> + notifySubscriber(subscriber.getCallback(),
>>> + String.valueOf(subscriber.getId()));
>>> + subscriber.setNotify(null);
>>> + }
>>> + };
>>> + subscriber.setNotify(notifyTask);
>>> + timer.schedule(notifyTask,
>>>subscriber.getNotificationDelay()*1000);
>>> + }
>>> + }
>>> }
>>> for ( Iterator i =
>>>subscriberEnumerations.entrySet().iterator();
>>>i.hasNext(); ) {
>>> Map.Entry entry = (Map.Entry)i.next();
>>> @@ -185,14 +198,16 @@
>>> }
>>> }
>>>
>>> - private void notifySubscriber(String callback, String subscribers)
>>
>>{
>>
>>
>>> + protected void notifySubscriber(String callback, String
>>
>>subscribers)
>>
>>
>>>{
>>> if ( callback.startsWith(TCP_PROTOCOL) ) {
>>> Domain.log("Notify subscribers with
>>>adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
>>
>>Logger.INFO);
>>
>>
>>> NotifyMethod notifyMethod = new
>>>NotifyMethod(callback.toString());
>>>
>>>notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
>>>subscribers);
>>> try {
>>> URL url = new URL(callback);
>>> - int state = notifyMethod.execute(new HttpState(), new
>>>HttpConnection(url.getHost(), url.getPort()));
>>> + notifyMethod.execute(
>>> + new HttpState(), new
>>
>>HttpConnection(url.getHost(),
>>
>>
>>> + url.getPort()!=-1 ? url.getPort() : 80));
>>> } catch (IOException e) {
>>> Domain.log("Notification of subscriber
>>>'"+callback.toString()+"' failed!");
>>> }
>>> @@ -203,7 +218,8 @@
>>> String notification = "NOTIFY "+callback+"
>>>HTTP/1.1\nSubscription-id: "+subscribers;
>>> byte[] buf = notification.getBytes();
>>> InetAddress address =
>>>InetAddress.getByName(url.getHost());
>>> - DatagramPacket packet = new DatagramPacket(buf,
>>>buf.length, address, url.getPort());
>>> + DatagramPacket packet = new DatagramPacket(
>>> + buf, buf.length, address, url.getPort()!=-1 ?
>>>url.getPort() : 80);
>>> socket.send(packet);
>>> } catch (IOException e) {
>>> Domain.log("Notification of subscriber
>>>'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>>>
>>>
>>>
>>> 1.9 +11 -7
>>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscrib
>>>er.jav
>>>a
>>>
>>> Index: Subscriber.java
>>> ===================================================================
>>> RCS file:
>>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>>t/Subs
>>>criber.java,v
>>> retrieving revision 1.8
>>> retrieving revision 1.9
>>> diff -u -r1.8 -r1.9
>>> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
>>> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
>>> @@ -90,9 +90,9 @@
>>> // check if event matches notification-type
>>> // see
>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/w
>>>ss/_we
>>>bdav_notification_type_header.asp
>>> // for details
>>> - if ( notificationType.equals(type) ||
>>> - ( type.equals(NEW_MEMBER) &&
>>
>>notificationType.equals(UPDATE)
>>
>>
>>>&& depth == 1 ) ||
>>> - ( type.equals(DELETE) &&
>>
>>notificationType.equals(UPDATE) &&
>>
>>>depth == 1 ) ){
>>> + if ( type.equalsIgnoreCase(notificationType) ||
>>> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
>>> + ( type.equalsIgnoreCase(DELETE) &&
>>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
>>> String eventUri = event.getUri();
>>> if ( eventUri != null && uri != null ) {
>>> if ( depth == 0 &&
>>
>>eventUri.equals(uri.toString()) ) return
>>
>>
>>>true;
>>> @@ -107,6 +107,10 @@
>>> return false;
>>> }
>>>
>>> + public boolean hasCallback() {
>>> + return this.callback != null && this.callback.length() > 0;
>>> + }
>>> +
>>> public String getCallback() {
>>> return callback;
>>> }
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event NotificationTrigger.java Subscriber.java
Posted by Ragia <ra...@asset.com.eg>.
Thanx for ur concerns,
Well, yes we are behind a firewall
I tried "telnet cvs.apache.org 2401" & it says:
Connecting To cvs.apache.org...Could not open a connection to host on port
2401
: Connect failed
Is that mean that I have no chance ever ? :(
-----Original Message-----
From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
Sent: Tuesday, July 13, 2004 11:56 AM
To: Slide Developers Mailing List
Subject: Re: cvs commit:
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Seems to be a network problem,
are you behind a firewall?
do you get a connection if you try "telnet cvs.apache.org 2401" ?
Ragia wrote:
> Thanx for the reply!!
>
> I tried what you kindly suggested but in vain
>
> Here it is the result
>
> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
> jakarta-slide
>
> ***** CVS exited normally with code 1 *****
>
> cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No
> connection could be made because the target machine actively refused it.
>
>
>
>
>
>
>
> -----Original Message-----
> From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:34 AM
> To: Slide Developers Mailing List
> Subject: Re: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> Did you set Authentication to pserver
>
> try the following on the console
> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
> jakarta-slide
>
>
>
> Ragia wrote:
>
>>How to connect to CVs
>>I used wincvs GUI but it doesnot connect ever I use the the CVs root
>>anoncvs@cvs.apache.org:/home/cvspublic
>>
>>It says that server refused the connection???
>>
>>
>>
>>-----Original Message-----
>>From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
>>Sent: Tuesday, July 13, 2004 11:08 AM
>>To: jakarta-slide-cvs@apache.org
>>Subject: cvs commit:
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>NotificationTrigger.java Subscriber.java
>>
>>luetzkendorf 2004/07/13 02:08:19
>>
>> Modified: src/webdav/server/org/apache/slide/webdav/event
>> NotificationTrigger.java Subscriber.java
>> Log:
>> some changes to satisfy the notification test cases
>>
>> Revision Changes Path
>> 1.11 +51 -35
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notifica
>>tionTr
>>igger.java
>>
>> Index: NotificationTrigger.java
>> ===================================================================
>> RCS file:
>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>t/Noti
>>ficationTrigger.java,v
>> retrieving revision 1.10
>> retrieving revision 1.11
>> diff -u -r1.10 -r1.11
>> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
>> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
>> @@ -80,6 +80,8 @@
>> }
>>
>> public boolean removeSubscriber(Subscriber subscriber) {
>> + Domain.log("Removing subscriber with ID: "+subscriber.getId(),
>>LOG_CHANNEL, Logger.INFO);
>> + subscriber.getLifetime().cancel();
>> return subscribers.remove(subscriber);
>> }
>>
>> @@ -122,8 +124,11 @@
>>
>> private void notifySubscribers(EventCollection collection) {
>> Map subscriberEnumerations = new HashMap();
>> - ContentEvent[] update =
>>EventCollectionFilter.getChangedContents(collection);
>> List matchingSubscribers = new ArrayList();
>> +
>> + // get subscribers with matching notification types
>> + // (and remember events)
>> + ContentEvent[] update =
>>EventCollectionFilter.getChangedContents(collection);
>> for ( int i = 0; i < update.length; i++ ) {
>>
>>matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
>>update[i]));
>> }
>> @@ -136,34 +141,42 @@
>>
>>matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
>>delete[i]));
>> }
>> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
>>full exchange notification compliance
>> +
>> + // notifiy subscribers
>> for ( Iterator i = matchingSubscribers.iterator();
>>i.hasNext(); ) {
>> - final Subscriber subscriber = (Subscriber)i.next();
>> - if ( subscriber.getNotificationDelay() == 0 ) {
>> - // send notification without delay
>> - List idList =
>>(List)subscriberEnumerations.get(subscriber.getCallback());
>> - if ( idList == null ) {
>> - idList = new ArrayList();
>> -
>>subscriberEnumerations.put(subscriber.getCallback(), idList);
>> - }
>> - Integer subscriberId = new
>>Integer(subscriber.getId());
>> - if ( !idList.contains(subscriberId) ) {
>> - idList.add(subscriberId);
>> - }
>> - } else {
>> - // send delayed notification
>> - TimerTask notifyTask = subscriber.getNotify();
>> - if ( notifyTask == null ) {
>> - Domain.log("Starting notification delay:
>>"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
>> - notifyTask = new TimerTask() {
>> - public void run() {
>> -
>>notifySubscriber(subscriber.getCallback(),
>>String.valueOf(subscriber.getId()));
>> - subscriber.setNotify(null);
>> - }
>> - };
>> - subscriber.setNotify(notifyTask);
>> - timer.schedule(notifyTask,
>>subscriber.getNotificationDelay()*1000);
>> - }
>> - }
>> + final Subscriber subscriber = (Subscriber)i.next();
>> +
>> + // skip subscribers that has no callback (we can't notify
>>them)
>> + if (!subscriber.hasCallback()) continue;
>> +
>> + if ( subscriber.getNotificationDelay() == 0 ) {
>> + // send notification without delay
>> + List idList =
>>(List)subscriberEnumerations.get(subscriber.getCallback());
>> + if ( idList == null ) {
>> + idList = new ArrayList();
>> + subscriberEnumerations.put(subscriber.getCallback(),
>>idList);
>> + }
>> + Integer subscriberId = new Integer(subscriber.getId());
>> + if ( !idList.contains(subscriberId) ) {
>> + idList.add(subscriberId);
>> + }
>> + } else {
>> + // send delayed notification
>> + TimerTask notifyTask = subscriber.getNotify();
>> + if ( notifyTask == null ) {
>> + Domain.log("Starting notification delay:
>>"+subscriber.getNotificationDelay(),
>> + LOG_CHANNEL, Logger.INFO);
>> + notifyTask = new TimerTask() {
>> + public void run() {
>> + notifySubscriber(subscriber.getCallback(),
>> + String.valueOf(subscriber.getId()));
>> + subscriber.setNotify(null);
>> + }
>> + };
>> + subscriber.setNotify(notifyTask);
>> + timer.schedule(notifyTask,
>>subscriber.getNotificationDelay()*1000);
>> + }
>> + }
>> }
>> for ( Iterator i =
>>subscriberEnumerations.entrySet().iterator();
>>i.hasNext(); ) {
>> Map.Entry entry = (Map.Entry)i.next();
>> @@ -185,14 +198,16 @@
>> }
>> }
>>
>> - private void notifySubscriber(String callback, String subscribers)
>
> {
>
>> + protected void notifySubscriber(String callback, String
>
> subscribers)
>
>>{
>> if ( callback.startsWith(TCP_PROTOCOL) ) {
>> Domain.log("Notify subscribers with
>>adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
>
> Logger.INFO);
>
>> NotifyMethod notifyMethod = new
>>NotifyMethod(callback.toString());
>>
>>notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
>>subscribers);
>> try {
>> URL url = new URL(callback);
>> - int state = notifyMethod.execute(new HttpState(), new
>>HttpConnection(url.getHost(), url.getPort()));
>> + notifyMethod.execute(
>> + new HttpState(), new
>
> HttpConnection(url.getHost(),
>
>> + url.getPort()!=-1 ? url.getPort() : 80));
>> } catch (IOException e) {
>> Domain.log("Notification of subscriber
>>'"+callback.toString()+"' failed!");
>> }
>> @@ -203,7 +218,8 @@
>> String notification = "NOTIFY "+callback+"
>>HTTP/1.1\nSubscription-id: "+subscribers;
>> byte[] buf = notification.getBytes();
>> InetAddress address =
>>InetAddress.getByName(url.getHost());
>> - DatagramPacket packet = new DatagramPacket(buf,
>>buf.length, address, url.getPort());
>> + DatagramPacket packet = new DatagramPacket(
>> + buf, buf.length, address, url.getPort()!=-1 ?
>>url.getPort() : 80);
>> socket.send(packet);
>> } catch (IOException e) {
>> Domain.log("Notification of subscriber
>>'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>>
>>
>>
>> 1.9 +11 -7
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscrib
>>er.jav
>>a
>>
>> Index: Subscriber.java
>> ===================================================================
>> RCS file:
>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>t/Subs
>>criber.java,v
>> retrieving revision 1.8
>> retrieving revision 1.9
>> diff -u -r1.8 -r1.9
>> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
>> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
>> @@ -90,9 +90,9 @@
>> // check if event matches notification-type
>> // see
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/w
>>ss/_we
>>bdav_notification_type_header.asp
>> // for details
>> - if ( notificationType.equals(type) ||
>> - ( type.equals(NEW_MEMBER) &&
>
> notificationType.equals(UPDATE)
>
>>&& depth == 1 ) ||
>> - ( type.equals(DELETE) &&
>
> notificationType.equals(UPDATE) &&
>
>>depth == 1 ) ){
>> + if ( type.equalsIgnoreCase(notificationType) ||
>> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
>> + ( type.equalsIgnoreCase(DELETE) &&
>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
>> String eventUri = event.getUri();
>> if ( eventUri != null && uri != null ) {
>> if ( depth == 0 &&
>
> eventUri.equals(uri.toString()) ) return
>
>>true;
>> @@ -107,6 +107,10 @@
>> return false;
>> }
>>
>> + public boolean hasCallback() {
>> + return this.callback != null && this.callback.length() > 0;
>> + }
>> +
>> public String getCallback() {
>> return callback;
>> }
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Posted by Stefan Lützkendorf <lu...@apache.org>.
Seems to be a network problem,
are you behind a firewall?
do you get a connection if you try "telnet cvs.apache.org 2401" ?
Ragia wrote:
> Thanx for the reply!!
>
> I tried what you kindly suggested but in vain
>
> Here it is the result
>
> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
> jakarta-slide
>
> ***** CVS exited normally with code 1 *****
>
> cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No connection
> could be made because the target machine actively refused it.
>
>
>
>
>
>
>
> -----Original Message-----
> From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:34 AM
> To: Slide Developers Mailing List
> Subject: Re: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> Did you set Authentication to pserver
>
> try the following on the console
> cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
> jakarta-slide
>
>
>
> Ragia wrote:
>
>>How to connect to CVs
>>I used wincvs GUI but it doesnot connect ever I use the the CVs root
>>anoncvs@cvs.apache.org:/home/cvspublic
>>
>>It says that server refused the connection???
>>
>>
>>
>>-----Original Message-----
>>From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
>>Sent: Tuesday, July 13, 2004 11:08 AM
>>To: jakarta-slide-cvs@apache.org
>>Subject: cvs commit:
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
>>NotificationTrigger.java Subscriber.java
>>
>>luetzkendorf 2004/07/13 02:08:19
>>
>> Modified: src/webdav/server/org/apache/slide/webdav/event
>> NotificationTrigger.java Subscriber.java
>> Log:
>> some changes to satisfy the notification test cases
>>
>> Revision Changes Path
>> 1.11 +51 -35
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notifica
>>tionTr
>>igger.java
>>
>> Index: NotificationTrigger.java
>> ===================================================================
>> RCS file:
>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>t/Noti
>>ficationTrigger.java,v
>> retrieving revision 1.10
>> retrieving revision 1.11
>> diff -u -r1.10 -r1.11
>> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
>> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
>> @@ -80,6 +80,8 @@
>> }
>>
>> public boolean removeSubscriber(Subscriber subscriber) {
>> + Domain.log("Removing subscriber with ID: "+subscriber.getId(),
>>LOG_CHANNEL, Logger.INFO);
>> + subscriber.getLifetime().cancel();
>> return subscribers.remove(subscriber);
>> }
>>
>> @@ -122,8 +124,11 @@
>>
>> private void notifySubscribers(EventCollection collection) {
>> Map subscriberEnumerations = new HashMap();
>> - ContentEvent[] update =
>>EventCollectionFilter.getChangedContents(collection);
>> List matchingSubscribers = new ArrayList();
>> +
>> + // get subscribers with matching notification types
>> + // (and remember events)
>> + ContentEvent[] update =
>>EventCollectionFilter.getChangedContents(collection);
>> for ( int i = 0; i < update.length; i++ ) {
>>
>>matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
>>update[i]));
>> }
>> @@ -136,34 +141,42 @@
>>
>>matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
>>delete[i]));
>> }
>> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
>>full exchange notification compliance
>> +
>> + // notifiy subscribers
>> for ( Iterator i = matchingSubscribers.iterator();
>>i.hasNext(); ) {
>> - final Subscriber subscriber = (Subscriber)i.next();
>> - if ( subscriber.getNotificationDelay() == 0 ) {
>> - // send notification without delay
>> - List idList =
>>(List)subscriberEnumerations.get(subscriber.getCallback());
>> - if ( idList == null ) {
>> - idList = new ArrayList();
>> -
>>subscriberEnumerations.put(subscriber.getCallback(), idList);
>> - }
>> - Integer subscriberId = new
>>Integer(subscriber.getId());
>> - if ( !idList.contains(subscriberId) ) {
>> - idList.add(subscriberId);
>> - }
>> - } else {
>> - // send delayed notification
>> - TimerTask notifyTask = subscriber.getNotify();
>> - if ( notifyTask == null ) {
>> - Domain.log("Starting notification delay:
>>"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
>> - notifyTask = new TimerTask() {
>> - public void run() {
>> -
>>notifySubscriber(subscriber.getCallback(),
>>String.valueOf(subscriber.getId()));
>> - subscriber.setNotify(null);
>> - }
>> - };
>> - subscriber.setNotify(notifyTask);
>> - timer.schedule(notifyTask,
>>subscriber.getNotificationDelay()*1000);
>> - }
>> - }
>> + final Subscriber subscriber = (Subscriber)i.next();
>> +
>> + // skip subscribers that has no callback (we can't notify
>>them)
>> + if (!subscriber.hasCallback()) continue;
>> +
>> + if ( subscriber.getNotificationDelay() == 0 ) {
>> + // send notification without delay
>> + List idList =
>>(List)subscriberEnumerations.get(subscriber.getCallback());
>> + if ( idList == null ) {
>> + idList = new ArrayList();
>> + subscriberEnumerations.put(subscriber.getCallback(),
>>idList);
>> + }
>> + Integer subscriberId = new Integer(subscriber.getId());
>> + if ( !idList.contains(subscriberId) ) {
>> + idList.add(subscriberId);
>> + }
>> + } else {
>> + // send delayed notification
>> + TimerTask notifyTask = subscriber.getNotify();
>> + if ( notifyTask == null ) {
>> + Domain.log("Starting notification delay:
>>"+subscriber.getNotificationDelay(),
>> + LOG_CHANNEL, Logger.INFO);
>> + notifyTask = new TimerTask() {
>> + public void run() {
>> + notifySubscriber(subscriber.getCallback(),
>> + String.valueOf(subscriber.getId()));
>> + subscriber.setNotify(null);
>> + }
>> + };
>> + subscriber.setNotify(notifyTask);
>> + timer.schedule(notifyTask,
>>subscriber.getNotificationDelay()*1000);
>> + }
>> + }
>> }
>> for ( Iterator i =
>>subscriberEnumerations.entrySet().iterator();
>>i.hasNext(); ) {
>> Map.Entry entry = (Map.Entry)i.next();
>> @@ -185,14 +198,16 @@
>> }
>> }
>>
>> - private void notifySubscriber(String callback, String subscribers)
>
> {
>
>> + protected void notifySubscriber(String callback, String
>
> subscribers)
>
>>{
>> if ( callback.startsWith(TCP_PROTOCOL) ) {
>> Domain.log("Notify subscribers with
>>adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
>
> Logger.INFO);
>
>> NotifyMethod notifyMethod = new
>>NotifyMethod(callback.toString());
>>
>>notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
>>subscribers);
>> try {
>> URL url = new URL(callback);
>> - int state = notifyMethod.execute(new HttpState(), new
>>HttpConnection(url.getHost(), url.getPort()));
>> + notifyMethod.execute(
>> + new HttpState(), new
>
> HttpConnection(url.getHost(),
>
>> + url.getPort()!=-1 ? url.getPort() : 80));
>> } catch (IOException e) {
>> Domain.log("Notification of subscriber
>>'"+callback.toString()+"' failed!");
>> }
>> @@ -203,7 +218,8 @@
>> String notification = "NOTIFY "+callback+"
>>HTTP/1.1\nSubscription-id: "+subscribers;
>> byte[] buf = notification.getBytes();
>> InetAddress address =
>>InetAddress.getByName(url.getHost());
>> - DatagramPacket packet = new DatagramPacket(buf,
>>buf.length, address, url.getPort());
>> + DatagramPacket packet = new DatagramPacket(
>> + buf, buf.length, address, url.getPort()!=-1 ?
>>url.getPort() : 80);
>> socket.send(packet);
>> } catch (IOException e) {
>> Domain.log("Notification of subscriber
>>'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>>
>>
>>
>> 1.9 +11 -7
>>jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscrib
>>er.jav
>>a
>>
>> Index: Subscriber.java
>> ===================================================================
>> RCS file:
>>/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
>>t/Subs
>>criber.java,v
>> retrieving revision 1.8
>> retrieving revision 1.9
>> diff -u -r1.8 -r1.9
>> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
>> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
>> @@ -90,9 +90,9 @@
>> // check if event matches notification-type
>> // see
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/w
>>ss/_we
>>bdav_notification_type_header.asp
>> // for details
>> - if ( notificationType.equals(type) ||
>> - ( type.equals(NEW_MEMBER) &&
>
> notificationType.equals(UPDATE)
>
>>&& depth == 1 ) ||
>> - ( type.equals(DELETE) &&
>
> notificationType.equals(UPDATE) &&
>
>>depth == 1 ) ){
>> + if ( type.equalsIgnoreCase(notificationType) ||
>> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
>> + ( type.equalsIgnoreCase(DELETE) &&
>>notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
>> String eventUri = event.getUri();
>> if ( eventUri != null && uri != null ) {
>> if ( depth == 0 &&
>
> eventUri.equals(uri.toString()) ) return
>
>>true;
>> @@ -107,6 +107,10 @@
>> return false;
>> }
>>
>> + public boolean hasCallback() {
>> + return this.callback != null && this.callback.length() > 0;
>> + }
>> +
>> public String getCallback() {
>> return callback;
>> }
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event NotificationTrigger.java Subscriber.java
Posted by Ragia <ra...@asset.com.eg>.
Thanx for the reply!!
I tried what you kindly suggested but in vain
Here it is the result
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
jakarta-slide
***** CVS exited normally with code 1 *****
cvs [checkout aborted]: connect to cvs.apache.org:2401 failed: No connection
could be made because the target machine actively refused it.
-----Original Message-----
From: Stefan Lützkendorf [mailto:luetzkendorf@apache.org]
Sent: Tuesday, July 13, 2004 11:34 AM
To: Slide Developers Mailing List
Subject: Re: cvs commit:
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Did you set Authentication to pserver
try the following on the console
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
jakarta-slide
Ragia wrote:
> How to connect to CVs
> I used wincvs GUI but it doesnot connect ever I use the the CVs root
> anoncvs@cvs.apache.org:/home/cvspublic
>
> It says that server refused the connection???
>
>
>
> -----Original Message-----
> From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:08 AM
> To: jakarta-slide-cvs@apache.org
> Subject: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> luetzkendorf 2004/07/13 02:08:19
>
> Modified: src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
> Log:
> some changes to satisfy the notification test cases
>
> Revision Changes Path
> 1.11 +51 -35
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Notifica
> tionTr
> igger.java
>
> Index: NotificationTrigger.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
> t/Noti
> ficationTrigger.java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
> @@ -80,6 +80,8 @@
> }
>
> public boolean removeSubscriber(Subscriber subscriber) {
> + Domain.log("Removing subscriber with ID: "+subscriber.getId(),
> LOG_CHANNEL, Logger.INFO);
> + subscriber.getLifetime().cancel();
> return subscribers.remove(subscriber);
> }
>
> @@ -122,8 +124,11 @@
>
> private void notifySubscribers(EventCollection collection) {
> Map subscriberEnumerations = new HashMap();
> - ContentEvent[] update =
> EventCollectionFilter.getChangedContents(collection);
> List matchingSubscribers = new ArrayList();
> +
> + // get subscribers with matching notification types
> + // (and remember events)
> + ContentEvent[] update =
> EventCollectionFilter.getChangedContents(collection);
> for ( int i = 0; i < update.length; i++ ) {
>
> matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
> update[i]));
> }
> @@ -136,34 +141,42 @@
>
> matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
> delete[i]));
> }
> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get
> full exchange notification compliance
> +
> + // notifiy subscribers
> for ( Iterator i = matchingSubscribers.iterator();
> i.hasNext(); ) {
> - final Subscriber subscriber = (Subscriber)i.next();
> - if ( subscriber.getNotificationDelay() == 0 ) {
> - // send notification without delay
> - List idList =
> (List)subscriberEnumerations.get(subscriber.getCallback());
> - if ( idList == null ) {
> - idList = new ArrayList();
> -
> subscriberEnumerations.put(subscriber.getCallback(), idList);
> - }
> - Integer subscriberId = new
> Integer(subscriber.getId());
> - if ( !idList.contains(subscriberId) ) {
> - idList.add(subscriberId);
> - }
> - } else {
> - // send delayed notification
> - TimerTask notifyTask = subscriber.getNotify();
> - if ( notifyTask == null ) {
> - Domain.log("Starting notification delay:
> "+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
> - notifyTask = new TimerTask() {
> - public void run() {
> -
> notifySubscriber(subscriber.getCallback(),
> String.valueOf(subscriber.getId()));
> - subscriber.setNotify(null);
> - }
> - };
> - subscriber.setNotify(notifyTask);
> - timer.schedule(notifyTask,
> subscriber.getNotificationDelay()*1000);
> - }
> - }
> + final Subscriber subscriber = (Subscriber)i.next();
> +
> + // skip subscribers that has no callback (we can't notify
> them)
> + if (!subscriber.hasCallback()) continue;
> +
> + if ( subscriber.getNotificationDelay() == 0 ) {
> + // send notification without delay
> + List idList =
> (List)subscriberEnumerations.get(subscriber.getCallback());
> + if ( idList == null ) {
> + idList = new ArrayList();
> + subscriberEnumerations.put(subscriber.getCallback(),
> idList);
> + }
> + Integer subscriberId = new Integer(subscriber.getId());
> + if ( !idList.contains(subscriberId) ) {
> + idList.add(subscriberId);
> + }
> + } else {
> + // send delayed notification
> + TimerTask notifyTask = subscriber.getNotify();
> + if ( notifyTask == null ) {
> + Domain.log("Starting notification delay:
> "+subscriber.getNotificationDelay(),
> + LOG_CHANNEL, Logger.INFO);
> + notifyTask = new TimerTask() {
> + public void run() {
> + notifySubscriber(subscriber.getCallback(),
> + String.valueOf(subscriber.getId()));
> + subscriber.setNotify(null);
> + }
> + };
> + subscriber.setNotify(notifyTask);
> + timer.schedule(notifyTask,
> subscriber.getNotificationDelay()*1000);
> + }
> + }
> }
> for ( Iterator i =
> subscriberEnumerations.entrySet().iterator();
> i.hasNext(); ) {
> Map.Entry entry = (Map.Entry)i.next();
> @@ -185,14 +198,16 @@
> }
> }
>
> - private void notifySubscriber(String callback, String subscribers)
{
> + protected void notifySubscriber(String callback, String
subscribers)
> {
> if ( callback.startsWith(TCP_PROTOCOL) ) {
> Domain.log("Notify subscribers with
> adress='"+callback+"' via TCP with id's "+subscribers, LOG_CHANNEL,
Logger.INFO);
> NotifyMethod notifyMethod = new
> NotifyMethod(callback.toString());
>
> notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
> subscribers);
> try {
> URL url = new URL(callback);
> - int state = notifyMethod.execute(new HttpState(), new
> HttpConnection(url.getHost(), url.getPort()));
> + notifyMethod.execute(
> + new HttpState(), new
HttpConnection(url.getHost(),
> + url.getPort()!=-1 ? url.getPort() : 80));
> } catch (IOException e) {
> Domain.log("Notification of subscriber
> '"+callback.toString()+"' failed!");
> }
> @@ -203,7 +218,8 @@
> String notification = "NOTIFY "+callback+"
> HTTP/1.1\nSubscription-id: "+subscribers;
> byte[] buf = notification.getBytes();
> InetAddress address =
> InetAddress.getByName(url.getHost());
> - DatagramPacket packet = new DatagramPacket(buf,
> buf.length, address, url.getPort());
> + DatagramPacket packet = new DatagramPacket(
> + buf, buf.length, address, url.getPort()!=-1 ?
> url.getPort() : 80);
> socket.send(packet);
> } catch (IOException e) {
> Domain.log("Notification of subscriber
> '"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>
>
>
> 1.9 +11 -7
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscrib
> er.jav
> a
>
> Index: Subscriber.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/even
> t/Subs
> criber.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
> @@ -90,9 +90,9 @@
> // check if event matches notification-type
> // see
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/w
> ss/_we
> bdav_notification_type_header.asp
> // for details
> - if ( notificationType.equals(type) ||
> - ( type.equals(NEW_MEMBER) &&
notificationType.equals(UPDATE)
> && depth == 1 ) ||
> - ( type.equals(DELETE) &&
notificationType.equals(UPDATE) &&
> depth == 1 ) ){
> + if ( type.equalsIgnoreCase(notificationType) ||
> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
> notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
> + ( type.equalsIgnoreCase(DELETE) &&
> notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
> String eventUri = event.getUri();
> if ( eventUri != null && uri != null ) {
> if ( depth == 0 &&
eventUri.equals(uri.toString()) ) return
> true;
> @@ -107,6 +107,10 @@
> return false;
> }
>
> + public boolean hasCallback() {
> + return this.callback != null && this.callback.length() > 0;
> + }
> +
> public String getCallback() {
> return callback;
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Posted by Stefan Lützkendorf <lu...@apache.org>.
Did you set Authentication to pserver
try the following on the console
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout jakarta-slide
Ragia wrote:
> How to connect to CVs
> I used wincvs GUI but it doesnot connect ever
> I use the the CVs root anoncvs@cvs.apache.org:/home/cvspublic
>
> It says that server refused the connection???
>
>
>
> -----Original Message-----
> From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
> Sent: Tuesday, July 13, 2004 11:08 AM
> To: jakarta-slide-cvs@apache.org
> Subject: cvs commit:
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
>
> luetzkendorf 2004/07/13 02:08:19
>
> Modified: src/webdav/server/org/apache/slide/webdav/event
> NotificationTrigger.java Subscriber.java
> Log:
> some changes to satisfy the notification test cases
>
> Revision Changes Path
> 1.11 +51 -35
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/NotificationTr
> igger.java
>
> Index: NotificationTrigger.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Noti
> ficationTrigger.java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
> +++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
> @@ -80,6 +80,8 @@
> }
>
> public boolean removeSubscriber(Subscriber subscriber) {
> + Domain.log("Removing subscriber with ID: "+subscriber.getId(),
> LOG_CHANNEL, Logger.INFO);
> + subscriber.getLifetime().cancel();
> return subscribers.remove(subscriber);
> }
>
> @@ -122,8 +124,11 @@
>
> private void notifySubscribers(EventCollection collection) {
> Map subscriberEnumerations = new HashMap();
> - ContentEvent[] update =
> EventCollectionFilter.getChangedContents(collection);
> List matchingSubscribers = new ArrayList();
> +
> + // get subscribers with matching notification types
> + // (and remember events)
> + ContentEvent[] update =
> EventCollectionFilter.getChangedContents(collection);
> for ( int i = 0; i < update.length; i++ ) {
> matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
> update[i]));
> }
> @@ -136,34 +141,42 @@
> matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
> delete[i]));
> }
> // FIXME: Add methods for MOVE, and NEW_MAIL (??) to get full
> exchange notification compliance
> +
> + // notifiy subscribers
> for ( Iterator i = matchingSubscribers.iterator(); i.hasNext(); )
> {
> - final Subscriber subscriber = (Subscriber)i.next();
> - if ( subscriber.getNotificationDelay() == 0 ) {
> - // send notification without delay
> - List idList =
> (List)subscriberEnumerations.get(subscriber.getCallback());
> - if ( idList == null ) {
> - idList = new ArrayList();
> -
> subscriberEnumerations.put(subscriber.getCallback(), idList);
> - }
> - Integer subscriberId = new
> Integer(subscriber.getId());
> - if ( !idList.contains(subscriberId) ) {
> - idList.add(subscriberId);
> - }
> - } else {
> - // send delayed notification
> - TimerTask notifyTask = subscriber.getNotify();
> - if ( notifyTask == null ) {
> - Domain.log("Starting notification delay:
> "+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
> - notifyTask = new TimerTask() {
> - public void run() {
> -
> notifySubscriber(subscriber.getCallback(),
> String.valueOf(subscriber.getId()));
> - subscriber.setNotify(null);
> - }
> - };
> - subscriber.setNotify(notifyTask);
> - timer.schedule(notifyTask,
> subscriber.getNotificationDelay()*1000);
> - }
> - }
> + final Subscriber subscriber = (Subscriber)i.next();
> +
> + // skip subscribers that has no callback (we can't notify
> them)
> + if (!subscriber.hasCallback()) continue;
> +
> + if ( subscriber.getNotificationDelay() == 0 ) {
> + // send notification without delay
> + List idList =
> (List)subscriberEnumerations.get(subscriber.getCallback());
> + if ( idList == null ) {
> + idList = new ArrayList();
> + subscriberEnumerations.put(subscriber.getCallback(),
> idList);
> + }
> + Integer subscriberId = new Integer(subscriber.getId());
> + if ( !idList.contains(subscriberId) ) {
> + idList.add(subscriberId);
> + }
> + } else {
> + // send delayed notification
> + TimerTask notifyTask = subscriber.getNotify();
> + if ( notifyTask == null ) {
> + Domain.log("Starting notification delay:
> "+subscriber.getNotificationDelay(),
> + LOG_CHANNEL, Logger.INFO);
> + notifyTask = new TimerTask() {
> + public void run() {
> + notifySubscriber(subscriber.getCallback(),
> + String.valueOf(subscriber.getId()));
> + subscriber.setNotify(null);
> + }
> + };
> + subscriber.setNotify(notifyTask);
> + timer.schedule(notifyTask,
> subscriber.getNotificationDelay()*1000);
> + }
> + }
> }
> for ( Iterator i = subscriberEnumerations.entrySet().iterator();
> i.hasNext(); ) {
> Map.Entry entry = (Map.Entry)i.next();
> @@ -185,14 +198,16 @@
> }
> }
>
> - private void notifySubscriber(String callback, String subscribers) {
> + protected void notifySubscriber(String callback, String subscribers)
> {
> if ( callback.startsWith(TCP_PROTOCOL) ) {
> Domain.log("Notify subscribers with adress='"+callback+"' via
> TCP with id's "+subscribers, LOG_CHANNEL, Logger.INFO);
> NotifyMethod notifyMethod = new
> NotifyMethod(callback.toString());
> notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
> subscribers);
> try {
> URL url = new URL(callback);
> - int state = notifyMethod.execute(new HttpState(), new
> HttpConnection(url.getHost(), url.getPort()));
> + notifyMethod.execute(
> + new HttpState(), new HttpConnection(url.getHost(),
> + url.getPort()!=-1 ? url.getPort() : 80));
> } catch (IOException e) {
> Domain.log("Notification of subscriber
> '"+callback.toString()+"' failed!");
> }
> @@ -203,7 +218,8 @@
> String notification = "NOTIFY "+callback+"
> HTTP/1.1\nSubscription-id: "+subscribers;
> byte[] buf = notification.getBytes();
> InetAddress address =
> InetAddress.getByName(url.getHost());
> - DatagramPacket packet = new DatagramPacket(buf,
> buf.length, address, url.getPort());
> + DatagramPacket packet = new DatagramPacket(
> + buf, buf.length, address, url.getPort()!=-1 ?
> url.getPort() : 80);
> socket.send(packet);
> } catch (IOException e) {
> Domain.log("Notification of subscriber
> '"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
>
>
>
> 1.9 +11 -7
> jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscriber.jav
> a
>
> Index: Subscriber.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subs
> criber.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
> +++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
> @@ -90,9 +90,9 @@
> // check if event matches notification-type
> // see
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_we
> bdav_notification_type_header.asp
> // for details
> - if ( notificationType.equals(type) ||
> - ( type.equals(NEW_MEMBER) && notificationType.equals(UPDATE)
> && depth == 1 ) ||
> - ( type.equals(DELETE) && notificationType.equals(UPDATE) &&
> depth == 1 ) ){
> + if ( type.equalsIgnoreCase(notificationType) ||
> + ( type.equalsIgnoreCase(NEW_MEMBER) &&
> notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
> + ( type.equalsIgnoreCase(DELETE) &&
> notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
> String eventUri = event.getUri();
> if ( eventUri != null && uri != null ) {
> if ( depth == 0 && eventUri.equals(uri.toString()) )
> return true;
> @@ -107,6 +107,10 @@
> return false;
> }
>
> + public boolean hasCallback() {
> + return this.callback != null && this.callback.length() > 0;
> + }
> +
> public String getCallback() {
> return callback;
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/event NotificationTrigger.java Subscriber.java
Posted by Ragia <ra...@asset.com.eg>.
How to connect to CVs
I used wincvs GUI but it doesnot connect ever
I use the the CVs root anoncvs@cvs.apache.org:/home/cvspublic
It says that server refused the connection???
-----Original Message-----
From: luetzkendorf@apache.org [mailto:luetzkendorf@apache.org]
Sent: Tuesday, July 13, 2004 11:08 AM
To: jakarta-slide-cvs@apache.org
Subject: cvs commit:
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
luetzkendorf 2004/07/13 02:08:19
Modified: src/webdav/server/org/apache/slide/webdav/event
NotificationTrigger.java Subscriber.java
Log:
some changes to satisfy the notification test cases
Revision Changes Path
1.11 +51 -35
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/NotificationTr
igger.java
Index: NotificationTrigger.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Noti
ficationTrigger.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NotificationTrigger.java 12 May 2004 11:09:47 -0000 1.10
+++ NotificationTrigger.java 13 Jul 2004 09:08:18 -0000 1.11
@@ -80,6 +80,8 @@
}
public boolean removeSubscriber(Subscriber subscriber) {
+ Domain.log("Removing subscriber with ID: "+subscriber.getId(),
LOG_CHANNEL, Logger.INFO);
+ subscriber.getLifetime().cancel();
return subscribers.remove(subscriber);
}
@@ -122,8 +124,11 @@
private void notifySubscribers(EventCollection collection) {
Map subscriberEnumerations = new HashMap();
- ContentEvent[] update =
EventCollectionFilter.getChangedContents(collection);
List matchingSubscribers = new ArrayList();
+
+ // get subscribers with matching notification types
+ // (and remember events)
+ ContentEvent[] update =
EventCollectionFilter.getChangedContents(collection);
for ( int i = 0; i < update.length; i++ ) {
matchingSubscribers.addAll(getSubscribers(Subscriber.UPDATE,
update[i]));
}
@@ -136,34 +141,42 @@
matchingSubscribers.addAll(getSubscribers(Subscriber.DELETE,
delete[i]));
}
// FIXME: Add methods for MOVE, and NEW_MAIL (??) to get full
exchange notification compliance
+
+ // notifiy subscribers
for ( Iterator i = matchingSubscribers.iterator(); i.hasNext(); )
{
- final Subscriber subscriber = (Subscriber)i.next();
- if ( subscriber.getNotificationDelay() == 0 ) {
- // send notification without delay
- List idList =
(List)subscriberEnumerations.get(subscriber.getCallback());
- if ( idList == null ) {
- idList = new ArrayList();
-
subscriberEnumerations.put(subscriber.getCallback(), idList);
- }
- Integer subscriberId = new
Integer(subscriber.getId());
- if ( !idList.contains(subscriberId) ) {
- idList.add(subscriberId);
- }
- } else {
- // send delayed notification
- TimerTask notifyTask = subscriber.getNotify();
- if ( notifyTask == null ) {
- Domain.log("Starting notification delay:
"+subscriber.getNotificationDelay(), LOG_CHANNEL, Logger.INFO);
- notifyTask = new TimerTask() {
- public void run() {
-
notifySubscriber(subscriber.getCallback(),
String.valueOf(subscriber.getId()));
- subscriber.setNotify(null);
- }
- };
- subscriber.setNotify(notifyTask);
- timer.schedule(notifyTask,
subscriber.getNotificationDelay()*1000);
- }
- }
+ final Subscriber subscriber = (Subscriber)i.next();
+
+ // skip subscribers that has no callback (we can't notify
them)
+ if (!subscriber.hasCallback()) continue;
+
+ if ( subscriber.getNotificationDelay() == 0 ) {
+ // send notification without delay
+ List idList =
(List)subscriberEnumerations.get(subscriber.getCallback());
+ if ( idList == null ) {
+ idList = new ArrayList();
+ subscriberEnumerations.put(subscriber.getCallback(),
idList);
+ }
+ Integer subscriberId = new Integer(subscriber.getId());
+ if ( !idList.contains(subscriberId) ) {
+ idList.add(subscriberId);
+ }
+ } else {
+ // send delayed notification
+ TimerTask notifyTask = subscriber.getNotify();
+ if ( notifyTask == null ) {
+ Domain.log("Starting notification delay:
"+subscriber.getNotificationDelay(),
+ LOG_CHANNEL, Logger.INFO);
+ notifyTask = new TimerTask() {
+ public void run() {
+ notifySubscriber(subscriber.getCallback(),
+ String.valueOf(subscriber.getId()));
+ subscriber.setNotify(null);
+ }
+ };
+ subscriber.setNotify(notifyTask);
+ timer.schedule(notifyTask,
subscriber.getNotificationDelay()*1000);
+ }
+ }
}
for ( Iterator i = subscriberEnumerations.entrySet().iterator();
i.hasNext(); ) {
Map.Entry entry = (Map.Entry)i.next();
@@ -185,14 +198,16 @@
}
}
- private void notifySubscriber(String callback, String subscribers) {
+ protected void notifySubscriber(String callback, String subscribers)
{
if ( callback.startsWith(TCP_PROTOCOL) ) {
Domain.log("Notify subscribers with adress='"+callback+"' via
TCP with id's "+subscribers, LOG_CHANNEL, Logger.INFO);
NotifyMethod notifyMethod = new
NotifyMethod(callback.toString());
notifyMethod.addRequestHeader(H_SUBSCRIPTION_ID_RESPONSE,
subscribers);
try {
URL url = new URL(callback);
- int state = notifyMethod.execute(new HttpState(), new
HttpConnection(url.getHost(), url.getPort()));
+ notifyMethod.execute(
+ new HttpState(), new HttpConnection(url.getHost(),
+ url.getPort()!=-1 ? url.getPort() : 80));
} catch (IOException e) {
Domain.log("Notification of subscriber
'"+callback.toString()+"' failed!");
}
@@ -203,7 +218,8 @@
String notification = "NOTIFY "+callback+"
HTTP/1.1\nSubscription-id: "+subscribers;
byte[] buf = notification.getBytes();
InetAddress address =
InetAddress.getByName(url.getHost());
- DatagramPacket packet = new DatagramPacket(buf,
buf.length, address, url.getPort());
+ DatagramPacket packet = new DatagramPacket(
+ buf, buf.length, address, url.getPort()!=-1 ?
url.getPort() : 80);
socket.send(packet);
} catch (IOException e) {
Domain.log("Notification of subscriber
'"+callback.toString()+"' failed!", LOG_CHANNEL, Logger.ERROR);
1.9 +11 -7
jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subscriber.jav
a
Index: Subscriber.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/event/Subs
criber.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Subscriber.java 2 Jul 2004 12:04:28 -0000 1.8
+++ Subscriber.java 13 Jul 2004 09:08:18 -0000 1.9
@@ -90,9 +90,9 @@
// check if event matches notification-type
// see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_we
bdav_notification_type_header.asp
// for details
- if ( notificationType.equals(type) ||
- ( type.equals(NEW_MEMBER) && notificationType.equals(UPDATE)
&& depth == 1 ) ||
- ( type.equals(DELETE) && notificationType.equals(UPDATE) &&
depth == 1 ) ){
+ if ( type.equalsIgnoreCase(notificationType) ||
+ ( type.equalsIgnoreCase(NEW_MEMBER) &&
notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ||
+ ( type.equalsIgnoreCase(DELETE) &&
notificationType.equalsIgnoreCase(UPDATE) && depth > 0 ) ){
String eventUri = event.getUri();
if ( eventUri != null && uri != null ) {
if ( depth == 0 && eventUri.equals(uri.toString()) )
return true;
@@ -107,6 +107,10 @@
return false;
}
+ public boolean hasCallback() {
+ return this.callback != null && this.callback.length() > 0;
+ }
+
public String getCallback() {
return callback;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org