[google-appengine] XMPP Presence: getPresence and isAvailable don't work? sendPresence with PROBE is asynchronous?

2011-11-10 Thread Artem Kuroptev
Hello everyone.

I would appreciate if somebody can clarify these things:

1. XMPPService.getPresence(..).isAvailable() constantly returns
'false' as of today. Is that a temporary behavior, or this methods
don't work anymore?

2. Is sendPresence method with PROBE PresenceType asynchronous?

3. Is that correct, that now there is no way to check JID presence
(whether user online) synchronously?

I have tried to read the docs. As been noted in Version 1.5.5 release
notes:
##
In the XMPP API, getPresence() is deprecated in favor of using the
inbound presence handlers documented in
http://code.google.com/appengine/docs/java/xmpp/overview.html#Handling_User_Presence.
##
and getPresence marked as deprecated in the current SDK. But in Java
world "deprecated" usually used to change syntax or semantics, and
leave incorrect method to maintain legacy. But not to mark method as
"non working". So it is unclear what really happened with
'getPresence(..).isAvailable()'.

Thanks.

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



[google-appengine] Re: XMPP Presence: getPresence and isAvailable don't work? sendPresence with PROBE is asynchronous?

2011-11-11 Thread Artem Kuroptev
'isAvailable' still does not work for me.

Anyhow, banishing of synchronous 'isAvailable' method means a pretty
big change. Previously, recipient's JID was all needed, to send a xmpp
message. From now on, GAE application have to maintain a 'roster' with
statuses of the subscribers. And now it is unable to check recipient's
status, and send a message. Status have to be already stored in
roster. And app must handle 'error' xmpp responses to adjust that
statuses. BTW, there is no methods nor classes in the current GAE Java
SDK to parse 'error' stanzas.

On Nov 10, 6:12 pm, Artem Kuroptev  wrote:
> Hello everyone.
>
> I would appreciate if somebody can clarify these things:
>
> 1. XMPPService.getPresence(..).isAvailable() constantly returns
> 'false' as of today. Is that a temporary behavior, or this methods
> don't work anymore?
>
> 2. Is sendPresence method with PROBE PresenceType asynchronous?
>
> 3. Is that correct, that now there is no way to check JID presence
> (whether user online) synchronously?
>
> I have tried to read the docs. As been noted in Version 1.5.5 release
> notes:
> ##
> In the XMPP API, getPresence() is deprecated in favor of using the
> inbound presence handlers documented 
> inhttp://code.google.com/appengine/docs/java/xmpp/overview.html#Handlin
> ##
> and getPresence marked as deprecated in the current SDK. But in Java
> world "deprecated" usually used to change syntax or semantics, and
> leave incorrect method to maintain legacy. But not to mark method as
> "non working". So it is unclear what really happened with
> 'getPresence(..).isAvailable()'.
>
> Thanks.

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



[google-appengine] ApiProxy.getCurrentEnvironment().getAppId() returns incorrect app ID

2012-09-08 Thread Artem Kuroptev
Hello,

I am trying to get an id of my app using 
'ApiProxy.getCurrentEnvironment().getAppId()'.

But the code returns application id with 's~' prefix. Which, I believe, 
somehow related to HDR datastore.

How do I receive a clear id of my application in run-time? I don't really 
want cut the prefix from the string, because that would looks like a hack.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/htKSv-SVFWEJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] ApiProxy.getCurrentEnvironment().getAppId() returns incorrect app ID

2012-09-13 Thread Artem Kuroptev
It's the same code. getAppId is not available in static context.

On Wednesday, September 12, 2012 7:00:13 AM UTC+4, Brian Michelich wrote:
>
> Have you tried this? 
>
>
> https://developers.google.com/appengine/docs/java/appidentity/overview#Identifying_Itself
>  
>
> The Application ID can be found in the ApiProxy.Environment.getAppId() 
> method. 
>
>
> On Sat, Sep 8, 2012 at 8:05 AM, Artem Kuroptev 
> > 
> wrote: 
> > Hello, 
> > 
> > I am trying to get an id of my app using 
> > 'ApiProxy.getCurrentEnvironment().getAppId()'. 
> > 
> > But the code returns application id with 's~' prefix. Which, I believe, 
> > somehow related to HDR datastore. 
> > 
> > How do I receive a clear id of my application in run-time? I don't 
> really 
> > want cut the prefix from the string, because that would looks like a 
> hack. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Google App Engine" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/google-appengine/-/htKSv-SVFWEJ. 
> > To post to this group, send email to 
> > google-a...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > google-appengi...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/google-appengine?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/kB--oiJbKmoJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] dev_appserver.cmd & transactions on multiple entity groups only allowed in High Replication & applications datastore.default_high_rep_job_policy_unapplied_job_pct

2013-01-31 Thread Artem Kuroptev
Hello, 

I am using latest Java SDK 1.7.4, and the following command to start dev 
server:

%java.home%\bin\java 
-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=20 -cp 
"%~dp0\..\lib\appengine-tools-api.jar" ^
com.google.appengine.tools.KickStart ^
   com.google.appengine.tools.development.DevAppServerMain %*

(as in 
https://developers.google.com/appengine/docs/java/tools/devserver#Using_the_Datastore
 
)

Yet, log says on a first request to DataStore :

INFO: Local Datastore initialized:
Type: Master/Slave
[..]

Then, I get an exception:

31.01.2013 19:16:02 org.datanucleus.transaction.Transaction rollback
SEVERE: Operation rollback failed on resource: 
org.datanucleus.store.appengine.DatastoreXAResource@404eb2, error code 
UNKNOWN and transaction: [DataNucleus Transaction, ID=Xid=, enlisted 
resources=[org.datanucleus.store.appengine.DatastoreXAResource@404eb2]]
31.01.2013 19:16:02 com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /themepark/post
java.lang.IllegalArgumentException: transactions on multiple entity groups 
only allowed in High Replication applications
[..]

I have following lines in \META-INF\jdoconfig.xml:



How do I make dev_appserver.cmd emulate High Replication Datastore?
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] xmpp.parseMessage(request) has a problem with non-latin characters?

2009-09-08 Thread Artem Kuroptev

I have created a simple echo xmpp chat bot at gaechat...@appspot.com.
It works fine for latin characters and I get blank squareы for non-
latin. Ihave tried to use
request.setCharacterEncoding("utf-8");
as a first call at doPost, but that doesn't work.
I guess XMPPService.parseMessage method do not takes into account the
encoding of POST request. Probably it is possible to parse post
request by myself (without XMPPService) and to brute force the
character encoding used by requester in Google backed. But if there is
a better way?

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



[google-appengine] Re: xmpp.parseMessage(request) has a problem with non-latin characters?

2009-09-09 Thread Artem Kuroptev

There sure is, if xmpp reffers XMPPService instnce :-) The source code
follows.
I have made screenshot with Google Talk also:
http://farm4.static.flickr.com/3533/3902870863_a935be9197.jpg

-
public class ChatBotServlet extends HttpServlet
{
private static final Logger log = Logger.getLogger
(ChatBotServlet.class.getName());

private static final String JABBER_ID = "gaechat...@appspot.com";
private JID myJID = null;


public void init() throws ServletException
{
myJID = new JID(JABBER_ID);
}

protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
//request.setCharacterEncoding("utf-8");
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Message msg = xmpp.parseMessage(request);

JID fromJid = msg.getFromJid();
String body = msg.getBody();

final String msgBody = "From: "+fromJid+", Text: "+body;
log.info("xmpp received: " + msgBody);
final Message outmsg = new MessageBuilder()
.withRecipientJids(fromJid)
.withBody(msgBody)
.build();

boolean messageSent = false;

if (xmpp.getPresence(fromJid).isAvailable())
{
SendResponse status = xmpp.sendMessage(outmsg);
messageSent = (status.getStatusMap().get(fromJid) ==
SendResponse.Status.SUCCESS);

}

if (!messageSent)
{
log.warning("outgoing message hasn't been sent to: " +
fromJid);
}

}

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
//throw new ServletException("doGet is not supported");
}
}
-

On Sep 9, 2:37 pm, "Nick Johnson (Google)" 
wrote:
> Hi Artem,
> There is no 'xmpp.parseMessage' method. What method/class are you referring
> to? Can you please paste the code you're using, and the exception (if any)
> you're getting?
>
> -Nick Johnson
>
> On Tue, Sep 8, 2009 at 3:23 PM, Artem Kuroptev  wrote:
>
> > I have created a simple echo xmpp chat bot at gaechat...@appspot.com.
> > It works fine for latin characters and I get blank squareы for non-
> > latin. Ihave tried to use
> > request.setCharacterEncoding("utf-8");
> > as a first call at doPost, but that doesn't work.
> > I guess XMPPService.parseMessage method do not takes into account the
> > encoding of POST request. Probably it is possible to parse post
> > request by myself (without XMPPService) and to brute force the
> > character encoding used by requester in Google backed. But if there is
> > a better way?
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine

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



[google-appengine] Re: xmpp.parseMessage(request) has a problem with non-latin characters?

2009-09-10 Thread Artem Kuroptev

There is a principal thing to find - if a body of POST request to
servlet contains valid unicode data.
1. POST body contains valid data. Then we can get it in binary form
and then parse with apache commons or something like that. It will
require to guess the encoding of post request.
2. POST contains malformed data. We can do nothing, it all on Google
engineers.



On Sep 10, 6:06 pm, gusto  wrote:
> The same problem.
>  However if I send message from web interface in development mode (/
> _ah/admin/xmpp), it works fine.
>

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



[google-appengine] Re: xmpp.parseMessage(request) has a problem with non-latin characters?

2009-09-13 Thread Artem Kuroptev

I have found just now that this issue has been reported even earlier
than I started this topic.
Here the URL:
http://code.google.com/p/googleappengine/issues/detail?id=2072

On Sep 11, 10:56 am, Ivan Frolov  wrote:
> I've checked the request.
>
> Here's the fragment.
>
> --=_Part_16732_4260695.1252651666846
> Content-Type: text/plain; charset="UTF-8"
> Content-Disposition: form-data; name="from"
>
> *...@***.**/Work067E4040
> --=_Part_16732_4260695.1252651666846
> Content-Type: text/plain; charset="UTF-8"
> Content-Disposition: form-data; name="to"
>
> *...@***.appspotchat.com
> --=_Part_16732_4260695.1252651666846
> Content-Type: text/plain; charset="UTF-8"
> Content-Disposition: form-data; name="body"
>
> a a
> --=_Part_16732_4260695.1252651666846
> Content-Type: text/xml; charset="UTF-8"
> Content-Disposition: form-data; name="stanza"
>
>  from="*...@***.**/Work067E4040" xmlns:cli="jabber:client"> xmlns="jabber:x:event"> xmlns="http://jabber.org/protocol/chatstates"/>a???a xmlns="http://jabber.org/protocol/xhtml-im";> xmlns="http://www.w3.org/1999/xhtml";>a???a value="disabled" xmlns:nos="google:nosave"/> xmlns:arc="http://jabber.org/protocol/archive"/>
> --=_Part_16732_4260695.1252651666846--
>
> Letters between 'a' characters are not displayed correctly and have code
> 65533.
> So the request itself comes malformed. I guess we should fire bug.
>
> ---
> Ivan Frolovhttp://www.frolov.md
>
> On Thu, Sep 10, 2009 at 21:22, Artem Kuroptev  wrote:
>
> > There is a principal thing to find - if a body of POST request to
> > servlet contains valid unicode data.
> > 1. POST body contains valid data. Then we can get it in binary form
> > and then parse with apache commons or something like that. It will
> > require to guess the encoding of post request.
> > 2. POST contains malformed data. We can do nothing, it all on Google
> > engineers.
>
> > On Sep 10, 6:06 pm, gusto  wrote:
> > > The same problem.
> > >  However if I send message from web interface in development mode (/
> > > _ah/admin/xmpp), it works fine.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] How to apply an "unique" constrain to a field of a class using JDO annotations?

2009-09-13 Thread Artem Kuroptev

I'have tried to make a field of a class "unique" using different
combinations of JDO annotations. Never successfully.
Here is one of my variations:
---
@Uniques({...@unique(name="MYCONST_1", members={"userJID"})})
@Unique(name="MYCONST_2", members={"userJID"})
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;

@Persistent
@Unique(name="MYUSERJID_IDX")
private String userJID;

[..]
---

Is there any way to apply "unique" constrain to a field of a class
using JDO annotations?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Adding a field to the existing JDO class

2009-10-19 Thread Artem Kuroptev

I have a class with JDO annotations in it. There is a number of
entities of that class already in Data Store. I need to add a new
field to the class. Is it safe for the data to add a new field to JDO
class? Will my entities stay available with 'null' returned for the
new field or they will be erased?

Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Adding a field to the existing JDO class

2009-10-19 Thread Artem Kuroptev

Thank you, Roy. I've updated jdo class and everything goes as
described.

On Oct 19, 6:24 pm, Roy Smith  wrote:
> The old entities will still be there. If your field types are objects (Long,
> Boolean, etc) they will return null. If they are base types (int, boolean)
> you will get an error.
>
> On Mon, Oct 19, 2009 at 3:15 PM, Artem Kuroptev  wrote:
>
> > I have a class with JDO annotations in it. There is a number of
> > entities of that class already in Data Store. I need to add a new
> > field to the class. Is it safe for the data to add a new field to JDO
> > class? Will my entities stay available with 'null' returned for the
> > new field or they will be erased?
>
> > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---