[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-12-08 Thread Shawn Smith
Attempting to use this code and I don't seem to be receiving the
unsolicited call back?  Is this still working for others?

On Oct 27, 1:28 am, yariv.snapir yariv.sna...@gmail.com wrote:
 Indeed it helped!

 Do you know of a way I can pass these IDs from the robot's code to the
 embed JS API (event listeners perhaps) - I need a way to save the ID
 of the newly created wave in my application...

 Thanks

 On Oct 26, 10:42 pm, Peter Svedberg peter.o.s.svedb...@gmail.com
 wrote:



  Hi all,

  Yes you will get the ids with a self added event, but you don't get a
  self added event when youcreateawavelet(wave) with a robot.

  Here's how tocreatea wave with a robot in java (assuming you have a
  handle on the currentwavelet):
 WaveletnewWave =wavelet.createWavelet(wavelet.getParticipants(),
  );

  After you submit the operations you will get an unsolicitied
  DOCUMENT_CHANGED event. I say unsolicited as you don't have to specify
  it in the capabilities.xml file.

  Look for the event in the servlet:
      for (Event e : bundle.getEvents()) {
        switch (e.getType()) {
         ...
         case DOCUMENT_CHANGED:
          processNewIds();
          break;
        ...
        }
      }

    public void processNewIds() {
      if (wavelet.hasDataDocument(_new_ids_)) {
        String newIds =wavelet.getDataDocument(_new_ids_);
        // do whatever with the new ids
      }
    }

  newIds looks like this:
  :wavesandbox.com!w+Sxz7uLZkCxk wavesandbox.com!conv+root b+Sxz7uLZkCxl
  \n
  strip the colon and split on   and you have waveId, waveletId and
  rootBlipId

  If we had specified a name for the writeback instead of the empty
  string it would have shown up before the colon.

  If you set the default logging level to INFO you'll see the event and
  the new ids data document in app engine's Logs view.

  Hope this helps
  -Peter

  On Oct 26, 7:58 pm, dLux d...@dlux.hu wrote:

   Just an idea to try, I'm not sure it works: add your robot to the
  wavelet, and then you'll get back a SELF_ADDED event. Then you'll have
   the ID. You can relay information with data documents of the main
   blip. Let me know if it works. (I'll probably need it soon also :) ).

   On Oct 25, 4:29 pm, David Nesting da...@fastolfe.net wrote:

On Sun, Oct 25, 2009 at 6:25 AM,yariv.snapir 
yariv.sna...@gmail.comwrote:

 produced the type of ID I need... (I got 'TBD0.8622343911850655' where
 the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\

The methods you use to respond to an event notification do not have
immediate results.  The operations are all batched up and sent back to 
the
server when you're done handling the event.  So, until that happens, 
all of
the IDs generated as youcreatenew blips/wavelets are TBD.  I don't
believe there's a way for you to get these IDs after the fact, unless 
you
left yourself some signal or annotation, and used some Yet To Be 
Developed
API to iterate over the wave again (after the conclusion of handling 
your
event) to find your signal and identify the content you added.

David

--

You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.




[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-12-08 Thread Shawn Smith
The DOCUMENT_CHANGED event now appears to require setup in the
capabilities.xml file.  I added it and that fixed up my issues.

S.

On Oct 26, 12:42 pm, Peter Svedberg peter.o.s.svedb...@gmail.com
wrote:
 Hi all,

 Yes you will get the ids with a self added event, but you don't get a
 self added event when youcreateawavelet(wave) with a robot.

 Here's how tocreatea wave with a robot in java (assuming you have a
 handle on the currentwavelet):WaveletnewWave 
 =wavelet.createWavelet(wavelet.getParticipants(),
 );

 After you submit the operations you will get an unsolicitied
 DOCUMENT_CHANGED event. I say unsolicited as you don't have to specify
 it in the capabilities.xml file.

 Look for the event in the servlet:
     for (Event e : bundle.getEvents()) {
       switch (e.getType()) {
        ...
        case DOCUMENT_CHANGED:
         processNewIds();
         break;
       ...
       }
     }

   public void processNewIds() {
     if (wavelet.hasDataDocument(_new_ids_)) {
       String newIds =wavelet.getDataDocument(_new_ids_);
       // do whatever with the new ids
     }
   }

 newIds looks like this:
 :wavesandbox.com!w+Sxz7uLZkCxk wavesandbox.com!conv+root b+Sxz7uLZkCxl
 \n
 strip the colon and split on   and you have waveId, waveletId and
 rootBlipId

 If we had specified a name for the writeback instead of the empty
 string it would have shown up before the colon.

 If you set the default logging level to INFO you'll see the event and
 the new ids data document in app engine's Logs view.

 Hope this helps
 -Peter

 On Oct 26, 7:58 pm, dLux d...@dlux.hu wrote:



  Just an idea to try, I'm not sure it works: add your robot to the
 wavelet, and then you'll get back a SELF_ADDED event. Then you'll have
  the ID. You can relay information with data documents of the main
  blip. Let me know if it works. (I'll probably need it soon also :) ).

  On Oct 25, 4:29 pm, David Nesting da...@fastolfe.net wrote:

   On Sun, Oct 25, 2009 at 6:25 AM, yariv.snapir 
   yariv.sna...@gmail.comwrote:

produced the type of ID I need... (I got 'TBD0.8622343911850655' where
the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\

   The methods you use to respond to an event notification do not have
   immediate results.  The operations are all batched up and sent back to the
   server when you're done handling the event.  So, until that happens, all 
   of
   the IDs generated as youcreatenew blips/wavelets are TBD.  I don't
   believe there's a way for you to get these IDs after the fact, unless you
   left yourself some signal or annotation, and used some Yet To Be Developed
   API to iterate over the wave again (after the conclusion of handling your
   event) to find your signal and identify the content you added.

   David

--

You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.




[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-27 Thread yariv.snapir

Indeed it helped!

Do you know of a way I can pass these IDs from the robot's code to the
embed JS API (event listeners perhaps) - I need a way to save the ID
of the newly created wave in my application...

Thanks

On Oct 26, 10:42 pm, Peter Svedberg peter.o.s.svedb...@gmail.com
wrote:
 Hi all,

 Yes you will get the ids with a self added event, but you don't get a
 self added event when you create a wavelet(wave) with a robot.

 Here's how to create a wave with a robot in java (assuming you have a
 handle on the current wavelet):
 Wavelet newWave = wavelet.createWavelet(wavelet.getParticipants(),
 );

 After you submit the operations you will get an unsolicitied
 DOCUMENT_CHANGED event. I say unsolicited as you don't have to specify
 it in the capabilities.xml file.

 Look for the event in the servlet:
     for (Event e : bundle.getEvents()) {
       switch (e.getType()) {
        ...
        case DOCUMENT_CHANGED:
         processNewIds();
         break;
       ...
       }
     }

   public void processNewIds() {
     if (wavelet.hasDataDocument(_new_ids_)) {
       String newIds = wavelet.getDataDocument(_new_ids_);
       // do whatever with the new ids
     }
   }

 newIds looks like this:
 :wavesandbox.com!w+Sxz7uLZkCxk wavesandbox.com!conv+root b+Sxz7uLZkCxl
 \n
 strip the colon and split on   and you have waveId, waveletId and
 rootBlipId

 If we had specified a name for the writeback instead of the empty
 string it would have shown up before the colon.

 If you set the default logging level to INFO you'll see the event and
 the new ids data document in app engine's Logs view.

 Hope this helps
 -Peter

 On Oct 26, 7:58 pm, dLux d...@dlux.hu wrote:

  Just an idea to try, I'm not sure it works: add your robot to the
  wavelet, and then you'll get back a SELF_ADDED event. Then you'll have
  the ID. You can relay information with data documents of the main
  blip. Let me know if it works. (I'll probably need it soon also :) ).

  On Oct 25, 4:29 pm, David Nesting da...@fastolfe.net wrote:

   On Sun, Oct 25, 2009 at 6:25 AM,yariv.snapir 
   yariv.sna...@gmail.comwrote:

produced the type of ID I need... (I got 'TBD0.8622343911850655' where
the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\

   The methods you use to respond to an event notification do not have
   immediate results.  The operations are all batched up and sent back to the
   server when you're done handling the event.  So, until that happens, all 
   of
   the IDs generated as you create new blips/wavelets are TBD.  I don't
   believe there's a way for you to get these IDs after the fact, unless you
   left yourself some signal or annotation, and used some Yet To Be Developed
   API to iterate over the wave again (after the conclusion of handling your
   event) to find your signal and identify the content you added.

   David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-26 Thread dLux

Just an idea to try, I'm not sure it works: add your robot to the
wavelet, and then you'll get back a SELF_ADDED event. Then you'll have
the ID. You can relay information with data documents of the main
blip. Let me know if it works. (I'll probably need it soon also :) ).

On Oct 25, 4:29 pm, David Nesting da...@fastolfe.net wrote:
 On Sun, Oct 25, 2009 at 6:25 AM, yariv.snapir yariv.sna...@gmail.comwrote:

  produced the type of ID I need... (I got 'TBD0.8622343911850655' where
  the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\

 The methods you use to respond to an event notification do not have
 immediate results.  The operations are all batched up and sent back to the
 server when you're done handling the event.  So, until that happens, all of
 the IDs generated as you create new blips/wavelets are TBD.  I don't
 believe there's a way for you to get these IDs after the fact, unless you
 left yourself some signal or annotation, and used some Yet To Be Developed
 API to iterate over the wave again (after the conclusion of handling your
 event) to find your signal and identify the content you added.

 David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-26 Thread Peter Svedberg

Hi all,

Yes you will get the ids with a self added event, but you don't get a
self added event when you create a wavelet(wave) with a robot.

Here's how to create a wave with a robot in java (assuming you have a
handle on the current wavelet):
Wavelet newWave = wavelet.createWavelet(wavelet.getParticipants(),
);

After you submit the operations you will get an unsolicitied
DOCUMENT_CHANGED event. I say unsolicited as you don't have to specify
it in the capabilities.xml file.

Look for the event in the servlet:
for (Event e : bundle.getEvents()) {
  switch (e.getType()) {
   ...
   case DOCUMENT_CHANGED:
processNewIds();
break;
  ...
  }
}

  public void processNewIds() {
if (wavelet.hasDataDocument(_new_ids_)) {
  String newIds = wavelet.getDataDocument(_new_ids_);
  // do whatever with the new ids
}
  }

newIds looks like this:
:wavesandbox.com!w+Sxz7uLZkCxk wavesandbox.com!conv+root b+Sxz7uLZkCxl
\n
strip the colon and split on   and you have waveId, waveletId and
rootBlipId

If we had specified a name for the writeback instead of the empty
string it would have shown up before the colon.

If you set the default logging level to INFO you'll see the event and
the new ids data document in app engine's Logs view.

Hope this helps
-Peter


On Oct 26, 7:58 pm, dLux d...@dlux.hu wrote:
 Just an idea to try, I'm not sure it works: add your robot to the
 wavelet, and then you'll get back a SELF_ADDED event. Then you'll have
 the ID. You can relay information with data documents of the main
 blip. Let me know if it works. (I'll probably need it soon also :) ).

 On Oct 25, 4:29 pm, David Nesting da...@fastolfe.net wrote:

  On Sun, Oct 25, 2009 at 6:25 AM, yariv.snapir yariv.sna...@gmail.comwrote:

   produced the type of ID I need... (I got 'TBD0.8622343911850655' where
   the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\

  The methods you use to respond to an event notification do not have
  immediate results.  The operations are all batched up and sent back to the
  server when you're done handling the event.  So, until that happens, all of
  the IDs generated as you create new blips/wavelets are TBD.  I don't
  believe there's a way for you to get these IDs after the fact, unless you
  left yourself some signal or annotation, and used some Yet To Be Developed
  API to iterate over the wave again (after the conclusion of handling your
  event) to find your signal and identify the content you added.

  David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-25 Thread yariv.snapir

Thanks. this helps!
I believe that we can establish that both in python and java we can
create a new **wavelet** but not a new standalone wave. IMHO, creating
a new wave would not be a task of a robot since a robot must be IN a
wave to actually run.
This should be part of the client (embed) API so that hosting
applications would be able to create new waves and manage this waves
in the context of the app...

Regards

Yariv

On Oct 23, 10:15 pm, Austin Chau (Google employee)
api.aus...@google.com wrote:
 Yes you can do that in Java.  The two client libraries mirror each other
 with respect to the underlying wire protocol.  To create new wave in Java
 you use this method from Wavelet -

 public Wavelet createWavelet(ListString participants,
 StringdataDocumentWriteBack
 );

 Austin



 On Fri, Oct 23, 2009 at 9:48 AM, heitzig-j heitzi...@web.de wrote:

  Is this also possible in Java? The corresponding classes AbstractRobot
  or AbstractRobotServlet do not seem to have a similar method like
  NewWave in python...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-25 Thread dLux

I disagree. I really would like my robot to create new waves for the
wave user. Of course somehow the wave user has to authorize the robot
to do that, but I have many use cases in my mind where robots has to
create waves.

Balázs

On Oct 25, 8:45 am, yariv.snapir yariv.sna...@gmail.com wrote:
 Thanks. this helps!
 I believe that we can establish that both in python and java we can
 create a new **wavelet** but not a new standalone wave. IMHO, creating
 a new wave would not be a task of a robot since a robot must be IN a
 wave to actually run.
 This should be part of the client (embed) API so that hosting
 applications would be able to create new waves and manage this waves
 in the context of the app...

 Regards

 Yariv

 On Oct 23, 10:15 pm, Austin Chau (Google employee)



 api.aus...@google.com wrote:
  Yes you can do that in Java.  The two client libraries mirror each other
  with respect to the underlying wire protocol.  To create new wave in Java
  you use this method from Wavelet -

  public Wavelet createWavelet(ListString participants,
  StringdataDocumentWriteBack
  );

  Austin

  On Fri, Oct 23, 2009 at 9:48 AM, heitzig-j heitzi...@web.de wrote:

   Is this also possible in Java? The corresponding classes AbstractRobot
   or AbstractRobotServlet do not seem to have a similar method like
   NewWave in python...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-25 Thread David Nesting
On Sun, Oct 25, 2009 at 6:25 AM, yariv.snapir yariv.sna...@gmail.comwrote:

 produced the type of ID I need... (I got 'TBD0.8622343911850655' where
 the ID needed looks more like: 'w+iFA2MNGuP'... I wonder what is the\


The methods you use to respond to an event notification do not have
immediate results.  The operations are all batched up and sent back to the
server when you're done handling the event.  So, until that happens, all of
the IDs generated as you create new blips/wavelets are TBD.  I don't
believe there's a way for you to get these IDs after the fact, unless you
left yourself some signal or annotation, and used some Yet To Be Developed
API to iterate over the wave again (after the conclusion of handling your
event) to find your signal and identify the content you added.

David

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-23 Thread heitzig-j

Is this also possible in Java? The corresponding classes AbstractRobot
or AbstractRobotServlet do not seem to have a similar method like
NewWave in python...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-23 Thread Austin Chau (Google employee)
Yes you can do that in Java.  The two client libraries mirror each other
with respect to the underlying wire protocol.  To create new wave in Java
you use this method from Wavelet -

public Wavelet createWavelet(ListString participants,
StringdataDocumentWriteBack
);

Austin

On Fri, Oct 23, 2009 at 9:48 AM, heitzig-j heitzi...@web.de wrote:


 Is this also possible in Java? The corresponding classes AbstractRobot
 or AbstractRobotServlet do not seem to have a similar method like
 NewWave in python...

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-13 Thread Ernie Turner

Thank you! This is exactly what I was trying to do, and your code work
great. A follow up question though. Do you know if it's possible to do
this without having a beginning wave to begin with? That is, is it
possible to create the 'context' variable just from the API? I've read
a few other posts about this and I haven't found anyone saying it was
possible.

Again, thanks for the sample code.

On Oct 10, 1:25 am, Daniel Faust soundlin...@gmail.com wrote:
 Oh, right, and you need to add
 __ from waveapi import robot_abstract __
 to your file

 On Oct 10, 9:24 am, Daniel Faust soundlin...@gmail.com wrote:



  Hi,

  I myself had trouble with this issue and saw that it was asked for
  several times. I found the solution and want to share it, so here it
  goes:

  def OnBlipSubmitted(properties, context):
    doc = context.GetBlipById(properties['blipId']).GetDocument()
    text = doc.GetText()
    if text.find('/createWave') == 0:
      _newWave       = robot_abstract.NewWave(context,
  context.GetRootWavelet().GetParticipants())
      _newWave.SetTitle(NewWave'sTitle)
      _newRootBlipId = _newWave.GetRootBlipId()
      _newRootBlip   = context.GetBlipById(_newRootBlipId)
      _newDocument   = _newRootBlip.GetDocument()
      _newDocument.AppendText(This is an additional Text)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: HowTo: Make a robot create a new Wave (Python)

2009-10-10 Thread Daniel Faust

Oh, right, and you need to add
__ from waveapi import robot_abstract __
to your file

On Oct 10, 9:24 am, Daniel Faust soundlin...@gmail.com wrote:
 Hi,

 I myself had trouble with this issue and saw that it was asked for
 several times. I found the solution and want to share it, so here it
 goes:

 def OnBlipSubmitted(properties, context):
   doc = context.GetBlipById(properties['blipId']).GetDocument()
   text = doc.GetText()
   if text.find('/createWave') == 0:
     _newWave       = robot_abstract.NewWave(context,
 context.GetRootWavelet().GetParticipants())
     _newWave.SetTitle(New Wave's Title)
     _newRootBlipId = _newWave.GetRootBlipId()
     _newRootBlip   = context.GetBlipById(_newRootBlipId)
     _newDocument   = _newRootBlip.GetDocument()
     _newDocument.AppendText(This is an additional Text)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---