[appengine-java] can a child be persisted without a parent?

2009-12-16 Thread aswath satrasala
I have the following two classes.
Tenant and Party.
A tenant has a list.
A party has a Tenant.

Question:   How can I enforce that a party cannot be persisted with out a
Tenant

-Aswath


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Tenant {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key="gae.encoded-pk",
value="true")
private String id;

@Persistent
@Extension(vendorName = "datanucleus", key="gae.pk-name", value="true")
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Persistent(mappedBy = "parent", dependentElement = "true")
@Element(dependent = "true")
private List partys = new ArrayList();

public void add(Party party) {
partys.add(party);
}

public List getPartys() {
return partys;
}

public String getId() {
return id;
}

public void setId(String name) {
this.id = name;
}

}


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Party {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

public Key getKey() {
return key;
}

public void setKey(Key key) {
this.key = key;
}

@Persistent private String organizationName;
@Persistent private String firstName;
@Persistent private String lastName;

@Persistent
private Tenant parent;

public String getOrganizationName() {
return organizationName;
}

public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}

public Tenant getParent() {
return parent;
}

public void setParent(Tenant parent) {
this.parent = parent;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}
}

--

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




Re: [appengine-java] How to retrieve the system generated key

2009-12-16 Thread Rusty Wright
See also http://xrl.in/411y and scroll down to makePersistent; "It must be 
called in the context of an active transaction, or a JDOUserException is 
thrown."


Saurabh Mehta wrote:
> Hi,
> 
> How can we get the value of a newly created key (system-generated), as
> soon as after we save the entity.
> 
> In other words, is it possible to do something like this?
> 
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> private Key key;
> .
> .
> .
> .
> public Key save(OBJ obj)   {
>  PersistenceManager pm = PMF.get().getPersistenceManager();
>  pm.makePersistent(obj);
>  return obj.getKey();
> }
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
> 
> 

--

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




Re: [appengine-java] Re: Performance of Data Store

2009-12-16 Thread Brian Hayward
I added items one at a time until I got to 30, then I did the empty,
so I'm pretty sure it wasn't a load request, this is normal.
Child entities have 4 fields with one being a list of Strings.
There is one index and it is 9% of the overall space.

Thanks,
Brian


On Thu, Dec 17, 2009 at 1:25 AM, Richard  wrote:
> It's probably that expensive. There are many surprises when using the
> datastore! I'd really like to get to grips with exactly what is
> causing what performance issues because it still feels a bit
> uncharted.
>
> Possibilities:
> Check if this speeds up if you call it a number of times in a row.
> Your app might have to load. I'm finding that it unloads very quickly
> now - a few minutes, whereas it seemed to take up to 20 min before. I
> also feel like repeated calls of a similar kind seem to run faster.
> When I turn logging onto "Info" level, I see a few exceptions when
> some parts wake up, like queues. Those don't happen after the first
> call.
>
> How many 'columns' do your children have? Each of those have to be
> indexed. You can specify that the datastore ignores some columns for
> indexing. Do your children have list properties? If so, that expands
> the indexes a lot.  Look at your data stats to see how much indexes
> are taking up compared to data, which should hint at how much the
> store is doing behind the scenes.
>
> Regards,
> Richard
>
> On Dec 17, 7:40 am, Brian Hayward  wrote:
>> Am I doing something wrong here?
>>
>> Parent class with an owned one-to-many relationship containing 30
>> children. calling clear() on the collection and then makePersistent()
>> on the parent was:
>>
>> 1646ms 5065cpu_ms 4560api_cpu_ms
>>
>> Is it really this expensive?  I have timing around the above two
>> steps, my logs reported that part alone as 1552ms.
>>
>> Thanks,
>> Brian
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] How to retrieve the system generated key

2009-12-16 Thread Rusty Wright
I think you may need a transaction, http://xrl.in/411x

PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();

{users code to persist objects}

tx.commit();
}
finally
{
if (tx.isActive())
{
tx.rollback();
}
}
pm.close();


Saurabh Mehta wrote:
> Hi,
> 
> How can we get the value of a newly created key (system-generated), as
> soon as after we save the entity.
> 
> In other words, is it possible to do something like this?
> 
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> private Key key;
> .
> .
> .
> .
> public Key save(OBJ obj)   {
>  PersistenceManager pm = PMF.get().getPersistenceManager();
>  pm.makePersistent(obj);
>  return obj.getKey();
> }
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
> 
> 

--

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




[appengine-java] Re: Performance of Data Store

2009-12-16 Thread Richard
It's probably that expensive. There are many surprises when using the
datastore! I'd really like to get to grips with exactly what is
causing what performance issues because it still feels a bit
uncharted.

Possibilities:
Check if this speeds up if you call it a number of times in a row.
Your app might have to load. I'm finding that it unloads very quickly
now - a few minutes, whereas it seemed to take up to 20 min before. I
also feel like repeated calls of a similar kind seem to run faster.
When I turn logging onto "Info" level, I see a few exceptions when
some parts wake up, like queues. Those don't happen after the first
call.

How many 'columns' do your children have? Each of those have to be
indexed. You can specify that the datastore ignores some columns for
indexing. Do your children have list properties? If so, that expands
the indexes a lot.  Look at your data stats to see how much indexes
are taking up compared to data, which should hint at how much the
store is doing behind the scenes.

Regards,
Richard

On Dec 17, 7:40 am, Brian Hayward  wrote:
> Am I doing something wrong here?
>
> Parent class with an owned one-to-many relationship containing 30
> children. calling clear() on the collection and then makePersistent()
> on the parent was:
>
> 1646ms 5065cpu_ms 4560api_cpu_ms
>
> Is it really this expensive?  I have timing around the above two
> steps, my logs reported that part alone as 1552ms.
>
> Thanks,
> Brian

--

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




[appengine-java] How to retrieve the system generated key

2009-12-16 Thread Saurabh Mehta
Hi,

How can we get the value of a newly created key (system-generated), as
soon as after we save the entity.

In other words, is it possible to do something like this?

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
.
.
.
.
public Key save(OBJ obj)   {
 PersistenceManager pm = PMF.get().getPersistenceManager();
 pm.makePersistent(obj);
 return obj.getKey();
}

--

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




[appengine-java] Performance of Data Store

2009-12-16 Thread Brian Hayward
Am I doing something wrong here?

Parent class with an owned one-to-many relationship containing 30
children. calling clear() on the collection and then makePersistent()
on the parent was:

1646ms 5065cpu_ms 4560api_cpu_ms

Is it really this expensive?  I have timing around the above two
steps, my logs reported that part alone as 1552ms.

Thanks,
Brian

--

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




[appengine-java] Finding abandoned child entities

2009-12-16 Thread Brian Hayward
So I read in the documentation that deleting parents via the admin
console will create abandoned children because owned relationships are
managed by JDO.  Is there a query that can find abandoned children of
a given kind?

Thanks,
Brian

--

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




Re: [appengine-java] Where is jdoconfig.xml? Ref:JDO PersistanceManagerFactory "transactions-optional" failure

2009-12-16 Thread Ikai L (Google)
The Eclipse plugin actually does create a copy of jdoconfig.xml when you
create a new App Engine project under src/META-INF. This should
automatically be copied as needed when you build. Did you create your
project using the plugin, or by hand?

On Tue, Dec 15, 2009 at 2:41 AM, Blessed Geek  wrote:

>
> When I read the java section of
> http://code.google.com/appengine/docs/java/datastore/overview.html,
>
> there is no mention of jdoconfig.xml and the need of it being in
> war/WEB-INF/classes/META-INF/ .
>
> I followed this document as recommended, get the pmf factory singleton
> and then bam!
> I am hit with the verbose as described in:
>
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/8b7677449f9a1f64/670b1b7c1b24d3de?#670b1b7c1b24d3de
>
> I searched (using find -name) and found a few copies of jdoconfig.xml
> at the demos in the gae eclipse plugin directory. I copied it over to
> the war and my problem was solved.
>
> I am using gae plugin 1.2.6, gwt 2 on karmic 64, galileo.
>
> Questions:
> 1. why gae plugin did not copy jdoconfig.xml to where it is needed?
>
> 2. otherwise, is
> http://code.google.com/appengine/docs/java/datastore/overview.html
> defective in its instructions in not mentioning I need jdoconfig
> somewhere in the war, or it presumes I am super-knowledgeable about
> jdo first before I should even try it?
>
> 3. Is it proper practice to have programmers look for jdoconfig.xml
> not  anywhere "more formal" but in the demos?
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

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




Re: [appengine-java] Re: Copy production datastore to local_db.bin?

2009-12-16 Thread Ikai L (Google)
Here's a blog post my teammate Wesley (also on this team) wrote:

http://wesc.livejournal.com/1743.html

Sounds a bit like what is going on with your script.

On Fri, Dec 11, 2009 at 6:46 PM, Dominik Steiner <
dominik.j.stei...@googlemail.com> wrote:

> Thanks again Ikai for your help and fast reply.
>
> It might not help that I'm a Python newbie here, but still not able to get
> this going with the code you sent me, still the error it gives me is
>
>   File "exporter.py", line 26, in decodeIfNotNone
> return utf8_string.decode("utf-8")
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/encodings/utf_8.py",
> line 16, in decode
> return codecs.utf_8_decode(input, errors, True)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
> position 7: ordinal not in range(128)
>
> My product exporter looks like this
>
> def decodeIfNotNone(utf8_string):
>   if utf8_string:
>  return utf8_string.decode("utf-8")
>   else:
> return ""
>
> class ProductExporter(bulkloader.Exporter):
> def __init__(self):
> bulkloader.Exporter.__init__(self, 'Product',
>  [('name', decodeIfNotNone, None),
>   ('userId', str, None),
>   ('shop', decodeIfNotNone, None),
>   ('brand', decodeIfNotNone, None),
>   ('model', decodeIfNotNone, None),
>   ('contact', decodeIfNotNone, None),
>   ('imageId', str, None),
>   ('userNickName', decodeIfNotNone,
> None),
>   ('price', str, None),
>   ('registeredDate', str, None),
>   ('validUntilDate', str, None),
>   ('ratingCount', str, None),
>   ('ratingTotal', str, None),
>   ('rating', str, None),
>   ('commentCount', str, None),
>   ('description', decodeIfNotNone,
> None)
>  ])
> exporters = [ProductExporter]
>
> after reading this great article on unicode and python I also tried the
> following
>
> http://boodebr.org/main/python/all-about-python-and-unicode
>
>  return unicode(utf8_string, 'utf-8')
>
> but that gives me
>
>   File "exporter.py", line 26, in decodeIfNotNone
> return unicode(utf8_string, 'utf-8')
> TypeError: decoding Unicode is not supported
>
> Again I'm stucked here, there seems to have been a similar issue with the
> bulkuploader
>
> http://code.google.com/p/googleappengine/issues/detail?id=157
>
> but not sure if that applies to my exporter issue here too? (besides that
> it's already marked as fixed)
>
> Thanks for any further guidance you can give me
>
> Dominik
>
> That doesn't look like correct Python syntax to me. Lambda expressions are
> limited to a single expression (
> http://docs.python.org/tutorial/controlflow.html). I am pretty sure that
> just takes a callable, so you can do this:
>
> def decodeIfNotNone(utf8_string):
>   if utf8_string:
>  return utf8_string.decode("utf-8")
>   else:
> return ""
>
> Then pass this callable as the second parameter to the method:
>
> ('brand', decodeIfNotNone, None),
>
> Let me know if this works for you.
>
> On Thu, Dec 10, 2009 at 5:40 PM, Dominik Steiner <
> dominik.j.stei...@googlemail.com> wrote:
>
>> Thanks Ikai again for the fast reply.
>>  (
>> I tried the following
>>
>>  ('brand', lambda x: x.decode('utf-8'), ""),
>>
>> so changing the default value from None to "" but that didn't help
>>
>> Then tried the following
>>
>>  ('brand', if x is not None: lambda x: x.decode('utf-8'), ""),
>>
>> but this threw a syntax error.
>>
>> Is there anyway to check that the value is not null in order to decode it?
>>
>> Thanks
>>
>> Dominik
>>
>> It's basically the equivalent of a Null Pointer exception. This syntax:
>>
>> lambda x: x.someMethod()
>>
>> Is an inline anonymous function call. If x is None as opposed to blank
>> String, you will not be able to call methods on it.
>>
>> On Thu, Dec 10, 2009 at 1:45 PM, Dominik Steiner <
>> dominik.j.stei...@googlemail.com> wrote:
>>
>>> Thanks Ikai for the fast response,
>>>
>>> yes, some unicode characters might be the issue here as my data is in
>>> Spanish. I tried your suggestion and now have an exporter.py that looks like
>>> this
>>>
>>> from google.appengine.ext import db
>>>
>>> class Product(db.Model):
>>>   userId = db.StringProperty()
>>>   name = db.StringProperty()
>>>   shop = db.StringProperty()
>>>   brand = db.StringProperty()
>>>   model = db.StringProperty()
>>>   contact = db.StringProperty()
>>>   imageId = db.StringProperty()
>>>   userNickName = db.StringProperty()
>>>   p

[appengine-java] Re: error 409

2009-12-16 Thread m seleron
Hi.

Somewhere of the message
I think the display as appcfg rollback.

Follow this thread:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/7beadad55307cca5/fa488c86eca1a788?hl=en&lnk=gst&q=rollback+deploy#fa488c86eca1a788

If 409 is generated by rollback
Please execute it again for a while after time.

Please try
thanks.



On 12月16日, 午後11:23, megha saddi  wrote:
> I cancel the deployment of application inbetween and now whenever i
> try to redeploy the application on google appengine , an error message
> occurs
> 409 Conflict and saying another transaction is in process..
> Kindly tell me how to resolve this issue and redeploy that application

--

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




Re: [appengine-java] One to many with JPA

2009-12-16 Thread Max Ross (Google)
I'd recommend reading this blog post - it contains everything you need to
know to persist a one-to-many with JPA:

http://gae-java-persistence.blogspot.com/2009/10/creating-bidrectional-owned-one-to-many.html

Max

On Wed, Dec 16, 2009 at 2:21 PM, Richard  wrote:

> Hi guys,
>
>  I try to persist a one to many relationship but I get the following
> error (It's my first app):
>
> Caused by: java.lang.IllegalStateException: Field
> "fr.beasymptotic.bookmark.client.model.BookmarkUser.bookmarks"
> contains a persistable object that isnt persistent, but the field
> doesnt allow cascade-persist!
>
>
> What's wrong here :
>
> @Entity
> public class Bookmark implements Serializable {
>/**
> *
> */
>private static final long serialVersionUID =
> -5148690849535943792L;
>
>@Id
>@GeneratedValue(strategy = GenerationType.IDENTITY)
>@Extension(vendorName="datanucleus", key="gae.encoded-pk",
> value="true")
>private String id;
>
>@Basic
>private String link;
>@Basic
>private String shortName;
>
> ...
>
> }
>
>
>
> @Entity
> public class BookmarkUser implements Serializable {
>/**
> *
> */
>private static final long serialVersionUID =
> -4970721952298475845L;
>
>@Id
>@GeneratedValue(strategy = GenerationType.IDENTITY)
>private Long id;
>
>@Basic
>private String userUIDFromGoogle;
>
>@Basic
>private List bookmarks;
> ...
>
> }
>
> Thanks,
> Richard
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] Re: help! output Image to a webpage

2009-12-16 Thread Yiming Li
Thank you! it works perfectly!



On Wed, Dec 16, 2009 at 12:24 PM, andy  wrote:
> You need to do this differently. Serve one HTML page that includes
>  tags for your X pictures. The src url for
> the pictures then points to a servlet that take the URL parameter of
> the picture ID, load the data and write it to the stream.
>
> Servlet code also needs to set the content type to "image/jpg" or
> whatever your binary format is:
>
> response.setContentType(pic.getMimeType());
> response.getOutputStream().write(pic.getImage().getBytes());
>
>
>
>
> On Dec 16, 12:18 pm, Yiming Li  wrote:
>> Hi all,
>>         I am testing the Image Api, what I am trying to do is to
>> display the following on the page:
>>         picture name1
>>         picture1
>>         picture name2
>>         picture2
>>         ...
>>
>>         the code is:
>>         public void doGet(HttpServletRequest req, HttpServletResponse resp)
>>                         throws IOException {
>>               try {
>>                         resp.getOutputStream().print("picture name12");
>>                         
>> resp.getOutputStream().write(picture1.getImageData());
>>                         resp.getOutputStream().flush();
>>
>>                         resp.getOutputStream().print("picture name2");
>>                         
>> resp.getOutputStream().write(picture2.getImageData());
>>                         resp.getOutputStream().flush();
>>
>>                         ...
>>                 } catch (IOException e) {
>>                         e.printStackTrace();
>>                 }
>>         }
>>
>>          I know there is something wrong in this code, because when I
>> execute it, the web browser download a page which contains the string
>> "picture1" and the raw data of picture1...
>>          Any help is greatly appreciated!
>>
>> Yiming
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




[appengine-java] One to many with JPA

2009-12-16 Thread Richard
Hi guys,

  I try to persist a one to many relationship but I get the following
error (It's my first app):

Caused by: java.lang.IllegalStateException: Field
"fr.beasymptotic.bookmark.client.model.BookmarkUser.bookmarks"
contains a persistable object that isnt persistent, but the field
doesnt allow cascade-persist!


What's wrong here :

@Entity
public class Bookmark implements Serializable {
/**
 *
 */
private static final long serialVersionUID =
-5148690849535943792L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String id;

@Basic
private String link;
@Basic
private String shortName;

...

}



@Entity
public class BookmarkUser implements Serializable {
/**
 *
 */
private static final long serialVersionUID =
-4970721952298475845L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Basic
private String userUIDFromGoogle;

@Basic
private List bookmarks;
...

}

Thanks,
Richard

--

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




[appengine-java] Use Blobstore Java API with GWT

2009-12-16 Thread Henry
Hi Guys,

Im trying to upload images using the new Blobstore API to the app
engine with GWT.

Ive created a FormPanel() to upload the images to the app engine, but
when im trying to set up the action in the form using
BlobstoreService, i cant because the import com.google.appengine
cannot be resolved.

My question is: how can I set up the action on the form using the
BlobstoreService?? I've this code in the client side:

import com.google.appengine.api.blobstore.BlobstoreService;

FormPanel form = new FormPanel();
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
form.setAction(blobstoreService.createUploadUrl("handizo/
upload"));

error: import com.google.appengine cannot be resolved.

Ive also tried to setup the action without the BlobstoreService, but
when the form is read in the server side using the BlobstoreService:

private BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();

protected void doPost(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {

Map blobs = 
blobstoreService.getUploadedBlobs(req);
BlobKey blobKey = blobs.get("myFile");

if (blobKey == null) {
resp.sendRedirect("/");
} else {
resp.sendRedirect("/serve?blob-key=" + 
blobKey.getKeyString());
}

I've this other error saying me that I've to set up the action using
the BlobstoreService.

Error: Must be called from a blob upload callback request.
at
com.google.appengine.api.blobstore.BlobstoreServiceImpl.getUploadedBlobs
(BlobstoreServiceImpl.java:97)
at com.handizo.server.service.FileUploadAnnouncementServlet.doPost
(FileUploadAnnouncementServlet.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

So its possible to user the BlobstoreService with GWT by the moment??

Thanks in advance :-)

--

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




[appengine-java] Billing Setup Started since November 30

2009-12-16 Thread Peter Ondruska
My application is in Billing Setup Started since November 30. Is there
anything I should do in order my application to become billed? My card
is fine (already did other purchases using Checkout since then).

--

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




[appengine-java] Re: bulk download error 403

2009-12-16 Thread lembas
I get exactly the same error when I try to bulkupload with this
command:
appcfg.py upload_data --auth_domain=mydomain.com --db_filename=skip --
url=http://remote.latest.myprogram.appspot.com/remote_api --no_cookies
--has_header --config_file=loader.py --filename=kind.csv --kind=Kind
myprogram

On Dec 17, 12:37 am, lembas  wrote:
> Hi,
>
> I have a java app on myprogram.appspot.com.
> I use google eclipse plugin to deploy it.(Eclipse 3.5, App Engine SDK
> 1.3.0, GWT SDK 2.0.0)
> I set the version to bulkload and deployed it.
> Now I have bulkload.latest.myprogram.appspot.com as I can see 
> onhttps://appengine.google.com/deployment?app_id=myprogram
>
> I try to bulkdownload data to my app but cannot succeed.
>
> I use:
> bulkloader.py --dump --batch_size=5 --kind=Kind --
> auth_domain=mydomain.com --url=http://
> bulkload.latest.myprogram.appspot.com/remote_api --filename=dump.sql3
> myprogram
>
> when I execute this command it asks my an email and a password. I
> enter ad...@mydomain.com and its password but the result is:
> [ERROR   ] Exception during authentication
> Traceback (most recent call last):
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \bulkload
> er.py", line 2985, in Run
>     request_manager.Authenticate()
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \bulkload
> er.py", line 1152, in Authenticate
>     remote_api_stub.MaybeInvokeAuthentication()
>   File "C:\Program Files\Google\google_appengine\google\appengine\ext
> \remote_api
> \remote_api_stub.py", line 494, in MaybeInvokeAuthentication
>     datastore_stub._server.Send(datastore_stub._path, payload=None)
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \appengin
> e_rpc.py", line 344, in Send
>     f = self.opener.open(req)
>   File "C:\Python26\lib\urllib2.py", line 389, in open
>     response = meth(req, response)
>   File "C:\Python26\lib\urllib2.py", line 502, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "C:\Python26\lib\urllib2.py", line 427, in error
>     return self._call_chain(*args)
>   File "C:\Python26\lib\urllib2.py", line 361, in _call_chain
>     result = func(*args)
>   File "C:\Python26\lib\urllib2.py", line 510, in http_error_default
>     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> HTTPError: HTTP Error 403: Forbidden
> [INFO    ] Authentication Failed
>
> I got exactly the same error above when I tried downloading with this
> command:
> appcfg.py download_data --auth_domain=mydomain.com --url=http://
> bulkload.latest.myprogram.appspot.com/remote_api --
> config_file=exporter.py --filename=kind_data_archive.csv --kind=Kind
> myprogram
>
> If I enter my gmail.com account and password, which I use to deploy
> the app in google eclipse plugin, the error is:
> Invalid username or password.
> Please enter login credentials for
> bukload.latest.myprogram.appspot.com
>
> My app.yaml in myprogram folder is:
> application: myprogram
> version: bulkload
> runtime: python
> api_version: 1
>
> handlers:
> - url: /remote_api
>   script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
>   login: admin
>
> Any help? Or should I ask it on google-appengine-python group or
> google-appengine group?
>
> Thanks.

--

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




[appengine-java] Re: Cannot deploy files because of space(s) in file path

2009-12-16 Thread tha
I've submitted the ticket 
http://code.google.com/p/googleappengine/issues/detail?id=2525
to track this issue.


On Dec 16, 5:08 pm, Raphael André Bauer
 wrote:
> that's not really a bug i guess. the problem is the space character.
> depending how your system is configured and depending how the target
> system is configured a space is not always a space.
>
> if you play around with encoding on your machine i am pretty sure you
> will get it to run "somehow".
>
> in short: do never use a "space" character in your urls and you will
> avoid a bunch of problems...
>
> ra
>
> On Wed, Dec 16, 2009 at 7:23 AM, tha  wrote:
> > I have the following files in my webapp:
>
> > \WEB-INF\web.xml
> > \WEB-INF\appengine-web.xml
> > \publish\Application Files\index.html
> > \publish\Application_Files\index.html
> > ...
>
> > When I use appcfg.cmd to upload, everything seems OK, I see no error.
> > But when I try to access
>
> > http://.appspot.com/publish/Application%20Files/index.html
> > I see a 404 error
>
> > while http://.appspot.com/publish/Application_Files/index.html
> > works correctly.
>
> > Is this a bug or not? Any workaround solution? (I have to have use the
> > name with space)
>
> > Thank you in advance!
>
> > Thai
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.

--

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




[appengine-java] bulk download error 403

2009-12-16 Thread lembas
Hi,

I have a java app on myprogram.appspot.com.
I use google eclipse plugin to deploy it.(Eclipse 3.5, App Engine SDK
1.3.0, GWT SDK 2.0.0)
I set the version to bulkload and deployed it.
Now I have bulkload.latest.myprogram.appspot.com as I can see on
https://appengine.google.com/deployment?app_id=myprogram

I try to bulkdownload data to my app but cannot succeed.

I use:
bulkloader.py --dump --batch_size=5 --kind=Kind --
auth_domain=mydomain.com --url=http://
bulkload.latest.myprogram.appspot.com/remote_api --filename=dump.sql3
myprogram

when I execute this command it asks my an email and a password. I
enter ad...@mydomain.com and its password but the result is:
[ERROR   ] Exception during authentication
Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\tools
\bulkload
er.py", line 2985, in Run
request_manager.Authenticate()
  File "C:\Program Files\Google\google_appengine\google\appengine\tools
\bulkload
er.py", line 1152, in Authenticate
remote_api_stub.MaybeInvokeAuthentication()
  File "C:\Program Files\Google\google_appengine\google\appengine\ext
\remote_api
\remote_api_stub.py", line 494, in MaybeInvokeAuthentication
datastore_stub._server.Send(datastore_stub._path, payload=None)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools
\appengin
e_rpc.py", line 344, in Send
f = self.opener.open(req)
  File "C:\Python26\lib\urllib2.py", line 389, in open
response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 502, in http_response
'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 427, in error
return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 361, in _call_chain
result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 510, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
[INFO] Authentication Failed

I got exactly the same error above when I tried downloading with this
command:
appcfg.py download_data --auth_domain=mydomain.com --url=http://
bulkload.latest.myprogram.appspot.com/remote_api --
config_file=exporter.py --filename=kind_data_archive.csv --kind=Kind
myprogram

If I enter my gmail.com account and password, which I use to deploy
the app in google eclipse plugin, the error is:
Invalid username or password.
Please enter login credentials for
bukload.latest.myprogram.appspot.com

My app.yaml in myprogram folder is:
application: myprogram
version: bulkload
runtime: python
api_version: 1

handlers:
- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
  login: admin

Any help? Or should I ask it on google-appengine-python group or
google-appengine group?

Thanks.

--

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




[appengine-java] URLFetch appends a content-type header even when there is no content

2009-12-16 Thread san1t1
I am trying to use GAE to POST to a resource that throws a Content-
Type unsupported (through a 401)

This is because the POST contains no body content, and my thus the
server does not need a content type specified in the HTTP request - it
rejects requests that specify any content-type header at all.

However, URLFetch is appending a Content-Type header of x-www-form-
urlencoded to the request (as per docs here -
http://code.google.com/appengine/docs/java/urlfetch/overview.html)

I don't like this at all, but while I guess it's OK for POSTs that
contain data, it should not be appended for POSTs that do not. I feel
this is a bug in GAE. What does anyone else think?

--

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




[appengine-java] Re: where I should put the Task Queue code?

2009-12-16 Thread pg
Although I am working with Python, I also found the official
documentation rather messy.

Perhaps this can help: 
http://code-in-order.blogspot.com/2009/12/google-app-engine-task-queue-with.html

rgds
pg

--

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




[appengine-java] Re: java.lang.NullPointerException cannot be cast to javax.servlet.ServletException

2009-12-16 Thread polyurethan
Hey there,

I still get this ClassCastException. When will the JVM be fixed?
It's Dec and the issue was raised in Jul. Is there any progress?

Thanks,
Alexander

On Oct 22, 10:13 am, Marc Guillemot  wrote:
> Don,
>
> I've tried to produce a unit test to open an issue for Jasper... and failed.
>
> I'm now quite sure that this is a bug in the JVM used for GAE.
>
> The JavaDoc of AccessController.doPrivileged (which is a native method)
> says that it propagates unchecked exceptions and throws a
> PrivilegedActionException only if a *checked* exception was thrown.
> Therefore Jasper code is correct not to await a RuntimeException as a
> PrivilegedActionException can't contain a NullPointerException and GAE's
> JVM is buggy here.
>
> Cheers,
> Marc.
>
> Don Schwarz a écrit :> Ah, you're right actually.  I hadn't looked closely 
> enough at that bug.
>
> > We'll have to get the Jasper guys to fix that and then upgrade.
>
> > Thanks,
> > Don
>
> > On Mon, Oct 19, 2009 at 10:39 AM, Marc Guillemot  > > wrote:
>
> >     This seems to be a really old issue that relates to something
> >     different... or do you mean that GAE uses a 5 years old version of
> >     Jasper?
>
> >     I've just look at the current sources of PageContextImpl
> >    http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/jasper/r...
> >     and it seems to me that the problem still exists there.
>
> >     Cheers,
> >     Marc.
>
> >     Don Schwarz a écrit :
> >      > Yes, this is:
>
> >      >https://issues.apache.org/bugzilla/show_bug.cgi?id=31171
>
> >      > We need to bundle a later version of Jasper with the App Engine
> >     SDK to
> >      > fix this.
>
> >      > On Mon, Oct 19, 2009 at 10:24 AM, Marc Guillemot
> >     mailto:mguille...@yahoo.fr>
> >      > >> wrote:
>
> >      >     Hi,
>
> >      >     any progress on this issue?
>
> >      >     Is it possible that it comes from a bug in Jasper, not able
> >     to recognize
> >      >     RuntimeException occurring in a PrivilegedExceptionAction?
>
> >      >     // org.apache.jasper.runtime.PageContextImpl
>
> >      >     public void handlePageException(final Throwable t) throws
> >     IOException,
> >      >         ServletException {
> >      >       if (t == null)
> >      >         throw new NullPointerException("null Throwable");
>
> >      >       if (SecurityUtil.isPackageProtectionEnabled()) {
> >      >         try {
> >      >           AccessController.doPrivileged(
> >      >               new PrivilegedExceptionAction() {
> >      >             public Void run() throws Exception {
> >      >               doHandlePageException(t);
> >      >               return null;
> >      >             }
> >      >           });
> >      >         } catch (PrivilegedActionException e) {
> >      >           Exception ex = e.getException();
> >      >           if (ex instanceof IOException) {
> >      >             throw (IOException) ex;
> >      >           } else {
> >      >             throw (ServletException) ex; <-- here?
> >      >           }
> >      >         }
> >      >       } else {
> >      >         doHandlePageException(t);
> >      >       }
>
> >      >     }
>
> >      >     Cheers,
> >      >     Marc.
>
> >      >     Toby Reyelts a écrit :
> >      >      > There's an outstanding issue in the version of Jasper App
> >     Engine is
> >      >      > currently using that can cause exceptions escaping a JSP to be
> >      >      > incorrectly cast to ServletException. As a temporary
> >     workaround,
> >      >     you can
> >      >      > wrap the body of your JSP in a try-catch block to get the
> >     actual
> >      >     exception.
>
> >      >      > On Thu, Jul 30, 2009 at 1:13 PM, Blessed Geek
> >      >     mailto:blessedg...@gmail.com>
> >     >
> >      >      >  >       >     
> >    http://cuckooberra.blessed-are-the-geek.com/TableMgr/TableMgr.jsp
>
> >      >      >     Any idea what this error log means? LoggedIn.jsp is a
> >     rather
> >      >     simple
> >      >      >     jsp, getting a temp authtoken and exchanging it for a
> >      >     permanent one.
> >      >      >     My app runs fine on local eclipse plugin, but on
> >     deployment
> >      >     this error
> >      >      >     resulted.
>
> >      >      >     07-30 07:30AM 49.848
> >      >      >     /TableMgr/LoggedIn.jsp
> >      >      >     java.lang.ClassCastException:
> >     java.lang.NullPointerException
> >      >     cannot be
> >      >      >     cast to javax.servlet.ServletException
> >      >      >            at
> >      >     org.apache.jasper.runtime.PageContextImpl.handlePageException
> >      >      >     (PageContextImpl.java:754)

--

You received this mes

Re: [appengine-java] Re: Datastore String limit: 500 characters or 500 bytes, which is it?

2009-12-16 Thread Ikai L (Google)
Jeff,

The limit should be 500 bytes.

On Mon, Dec 14, 2009 at 4:24 PM, Jeff Schnitzer  wrote:

> Can anyone comment on this in an official capacity?
>
> I can write some code to test actual behavior, but I'd really rather
> know the defined behavior.
>
> Thanks,
> Jeff
>
> On Fri, Dec 11, 2009 at 2:41 AM, Jeff Schnitzer 
> wrote:
> > The javadocs for Text say the datastore limit is 500 characters:
> >
> >
> http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Text.html
> >
> > The JDO docs say 500 bytes:
> >
> >
> http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Core_Value_Types
> >
> > The python docs for StringProperty say the limit is 500 bytes:
> >
> >
> http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringProperty
> >
> > S what happens if I try to save a Java (utf-16) String which
> > expands after utf-8 encoding to, say, the worst case scenario of 2000
> > bytes?
> >
> > Thanks,
> > Jeff
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

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




[appengine-java] Re: help! output Image to a webpage

2009-12-16 Thread andy
You need to do this differently. Serve one HTML page that includes
 tags for your X pictures. The src url for
the pictures then points to a servlet that take the URL parameter of
the picture ID, load the data and write it to the stream.

Servlet code also needs to set the content type to "image/jpg" or
whatever your binary format is:

response.setContentType(pic.getMimeType());
response.getOutputStream().write(pic.getImage().getBytes());




On Dec 16, 12:18 pm, Yiming Li  wrote:
> Hi all,
>         I am testing the Image Api, what I am trying to do is to
> display the following on the page:
>         picture name1
>         picture1
>         picture name2
>         picture2
>         ...
>
>         the code is:
>         public void doGet(HttpServletRequest req, HttpServletResponse resp)
>                         throws IOException {
>               try {
>                         resp.getOutputStream().print("picture name12");
>                         resp.getOutputStream().write(picture1.getImageData());
>                         resp.getOutputStream().flush();
>
>                         resp.getOutputStream().print("picture name2");
>                         resp.getOutputStream().write(picture2.getImageData());
>                         resp.getOutputStream().flush();
>
>                         ...
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 }
>         }
>
>          I know there is something wrong in this code, because when I
> execute it, the web browser download a page which contains the string
> "picture1" and the raw data of picture1...
>          Any help is greatly appreciated!
>
> Yiming

--

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




[appengine-java] Re: BlobstoreService, No image data is available.

2009-12-16 Thread andy
The resize without accessing the dimensions works.

  Image oldImage = ImagesServiceFactory.makeImageFromBlob(bi.getBlobKey
());
  ImagesService imagesService = ImagesServiceFactory.getImagesService
();
  Transform resize = ImagesServiceFactory.makeResize(128, 128);
  Image newImage = imagesService.applyTransform(resize, oldImage);

Interesting that it's not a full fledged image when created from a
blob key. It would be nice if you could transform from one blob object
to a new one. In other words upload an image and save different
resolutions in the blob store and maybe even delete the original. With
the current service you have to transform and store in a different
table and adhere to the 1MB limit. Is this correct? Is there any plan
for storing custom data in the blob (transformed or created in the
app)?

Thanks

--

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




[appengine-java] help! output Image to a webpage

2009-12-16 Thread Yiming Li
Hi all,
I am testing the Image Api, what I am trying to do is to
display the following on the page:
picture name1
picture1
picture name2
picture2
...

the code is:
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
  try {
resp.getOutputStream().print("picture name12");
resp.getOutputStream().write(picture1.getImageData());
resp.getOutputStream().flush();

resp.getOutputStream().print("picture name2");
resp.getOutputStream().write(picture2.getImageData());
resp.getOutputStream().flush();

...
} catch (IOException e) {
e.printStackTrace();
}
}

 I know there is something wrong in this code, because when I
execute it, the web browser download a page which contains the string
"picture1" and the raw data of picture1...
 Any help is greatly appreciated!

Yiming

--

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




Re: [appengine-java] Dynamically create classes using JPA/JDO and bytecode instrumentation

2009-12-16 Thread Toby Reyelts
One other thing you might consider is using the native App Engine datastore,
since it's already schemaless. You can even mix and match using the native
API and JDO/JPA.

On Wed, Dec 16, 2009 at 1:30 AM, Bombay Goose  wrote:

> Hello All,
>
> I am doing a feasibility study of whether we can develop our application on
> appengine or not.
>
> Our application has a requirement where we have to create tables
> dynamically, without restarting the application.
>
> Is that possible in Appengine?
>
> Datanucleus supports this through JDO, with some byte code instrumentation.
> More info -
> http://www.jpox.org/servlet/wiki/pages/viewpage.action?pageId=6619188
>
> Is it possible through JPA? if yes, does appengine allow it?
>  if not, does Appengine allow Bytecode instrumentation so that we can
> create classes dynamically according to the link above using JDO.
>
> Any help is greatly appreciated.
>
> Thanks,
>
> G
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

--

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




[appengine-java] Re: Dynamically create classes using JPA/JDO and bytecode instrumentation

2009-12-16 Thread datanucleus
> they were coming out with JPA 2.0 with metadata APIs.

JPA2 "metamodel" API is actually a way of accessing what is there, not
a way of defining the metadata. JDO Metadata API on the other hand
allows you to access as well as set the metadata. Consequently you
won't be able to use JPA2 to do what you want here

--

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




[appengine-java] Re: any plans for deferred.defer in Java?

2009-12-16 Thread David Chandler
Thanks, Vince.

Regarding a way to access the Guice injector, I've figured out I can
simply create and access the injector via a static factory, so no
changes are needed to Deferred or Deferrable. This works for AppEngine
since there is only one WAR per JVM. If there were more than web app,
I'm not sure whether Guice ServletModules would work, but that's not
an issue for now.

/dmc
http://turbomanage.wordpress.com

On Dec 2, 2:47 pm, Vince Bonfanti  wrote:
> The behavior you're reporting is exactly the opposite of what I'm seeing.
> For me, deserialization always fails on the dev server and always works in
> production. What I'm seeing on the dev server is that the bytes retrieved
> from the task payload (req.getInputStream) are not the same bytes that are
> sent; the result is the StreamCorruptedException. Again, though, I only see
> this on the dev server and never in production. Can you send me an example
> that fails in production? I'd like to understand what's going on before
> applying the Base64 encoder workaround.
>
> I'm not at all familiar with Guice, but I think I understand what you're
> trying to do. One thought I've had is that we could pass the
> HttpServletRequest object to the doTask() method. This would allow you to
> add attributes (objects) to the HttpServletRequest within your Guice filter
> and then retrieve them within your doTask() method.
>
> Vince
>
> On Fri, Nov 27, 2009 at 7:53 PM, David Chandler wrote:
>
> > I've solved the serialization problems by Base64 encoding the
> > serialized task before calling payload() and decoding it in the
> > deserialize(HttpServletRequest) method. I'm guessing something in the
> > task queue chain (either task queue payload storage or the servlet
> > call when task is run) has problems transmitting the binary data, as
> > the exception I was getting at one point was a
> > java.io.StreamCorruptedException.
>
> > I'll send another patch to Vince. My solution works, but I'm not
> > completely satisfied that I've diagnosed the problem correctly. I used
> > Apache commons-codec for Base64. Is it safe to use com.sun.misc
> > instead? I see it in appengine.repackaged chain, as well, but don't
> > see it as part of an official Google API.
>
> > Somewhat related, I've wired up the Deferred servlet through the
> > GuiceFilter so I can pass a Guice injector to Deferrable tasks. Since
> > the task objects are not created through Guice, but rather by
> > deserializing, I modified doTask() to accept an additional Injector
> > argument. We probably don't want that in the official version of
> > Deferrable, though.
>
> > Is there a better way for my Deferrable classes to get access to a
> > Guice "context"? I'm trying to avoid Guice.createInjector(), as it
> > results in a duplicate PersistenceManagerFactory being created since
> > other servlets are also being served through Guice.
>
> > Thank you,
> > /dmc
>
> > On Nov 27, 5:42 pm, David Chandler  wrote:
> > > Jeff,
>
> > > I'm seeing problems with deserialization, too, when deployed on
> > > AppEngine. In dev, I can deserialize(serialize(task)) and it works
> > > just fine, but not so in AppEngine. I get the same error whether the
> > > task payload is the serialized Deferrable task itself or just the Key
> > > with the task in the db, but I haven't yet figured out which is the
> > > cause of the problem.
>
> > > The error I'm getting on AppEngine is invalid type code: 00 in
> > > Deferred.deserialize method. I've tried Base64 encoding after
> > > serialization in case it's related to special binary escape sequences
> > > that happen to be in the serialized object stream but still no
> > > success.
>
> > > I'm pretty sure AppEngine has written some custom code to do
> > > serialization because I previously got an AppEngine acess control
> > > exception when calling enableResolveObject(true) in a subclass of
> > > ObjectInputStream, and I'm wondering if that's in play somehow...
>
> > > /dmc

--

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




[appengine-java] Re: Collections usge in Appengine Java

2009-12-16 Thread Icarus
I added defaultFetchGroup=true to get this working.

On Dec 9, 10:18 pm, andy stevko  wrote:
> Sorry for not seeing this earlier - I missed your reply post in the mail
> stream.
>
> FetchGroups are documented 
> athttp://www.datanucleus.org/products/accessplatform_1_1/jdo/fetchgroup...
>
> The xml metadata they show is generated by the @FetchGroup annotation which
> is documented 
> athttp://www.datanucleus.org/products/accessplatform_1_1/jdo/annotation...
>
> Strings and other basic java.lang types are in the default fetch group.
> User defined types need to be added to a user named fetch group (or may be
> added to the default group).
>
> HTH,
> --Andy
>
> On Thu, Dec 3, 2009 at 11:10 PM, Avis developer
> wrote:
>
> > Sir thanks for the reply , but pl help me sir, am jus a beginner, can
> > u pls be elaborate, thanks for spending ur time and effort
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
>

--

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




[appengine-java] Re: The local development login form should accept GET as well as POST

2009-12-16 Thread David Chandler
+1

On Dec 15, 5:13 am, Nacho Coloma  wrote:
> This is just a thought: would it be possible to make the login form in
> the local environment accept GET as well as POST? This way I could add
> bookmarks to my browser to login directly, instead of making ugly
> javascript hacks to get a one-click login to the three accounts of my
> typical use cases.
>
> Another option would be a "remember me" button, but I suppose that's
> out of the question.
>
> Best regards,
>
> Nacho.

--

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




Re: [appengine-java] Re: TaskQueue and null host name

2009-12-16 Thread Max Ross (Google)
Yup, it's a bug.  Would you mind filing it in the issue tracker?  I'll get
it sorted out for the next release.

Thanks,
Max

On Wed, Dec 16, 2009 at 9:34 AM, Max Ross (Google) <
maxr+appeng...@google.com > wrote:

> Interesting, let me take a look.
>
>
> On Tue, Dec 15, 2009 at 6:47 PM, Millisecond wrote:
>
>> It's in a normal doGet method of a servlet.
>>
>> Re-enabled it to double-check that I was failing on the version in
>> doGet (originally I had it in an init() method) and ran into something
>> that may be the cause.
>>
>> If I request the servlet from http://localhost:8080/ it fails, the
>> same servlet also responds to http://localhost:8080/Index and there it
>> works fine.
>>
>> I can't see anything in my code making it fail from the "bare" URL,
>> but there is a fair amount going on in that servlet.  I was just doing
>> it there for expediency while testing, can't see any good reason to
>> enqueue something from / anyway so should be fine.
>>
>> Thanks,
>> -C
>>
>>
>>
>> On Dec 15, 6:26 pm, "Max Ross (Google)" 
>> 
>> >
>> wrote:
>> > Where is your code that adds the task to the queue?  Is it being run
>> during
>> > server initializaiton, perhaps as part of a static block or a
>> LoadOnStartup
>> > servlet?
>> >
>> > Thanks,
>> > Max
>> >
>> > On Tue, Dec 15, 2009 at 8:27 AM, Millisecond 
>> wrote:
>> > > Hello,
>> >
>> > > I'm just testing out super basic TaskQueue stuff in the dev
>> > > environment and running into an exception I just can't seem to shake.
>> >
>> > > Code:
>> >
>> > > Queue queue = QueueFactory.getQueue("mail-queue");
>> > > queue.add(url("/api/RunMonitor"));
>> >
>> > > Exception:
>> >
>> > > java.lang.IllegalArgumentException: Host name may not be null
>> > >at org.apache.commons.httpclient.HttpHost.(Unknown
>> Source)
>> > >at org.apache.commons.httpclient.HttpHost.(Unknown
>> Source)
>> > >at org.apache.commons.httpclient.HttpMethodBase.setURI(Unknown
>> > > Source)
>> > >at org.apache.commons.httpclient.HttpMethodBase.(Unknown
>> > > Source)
>> > >at
>> org.apache.commons.httpclient.methods.ExpectContinueMethod.
>> > > (Unknown Source)
>> > >at
>> > > org.apache.commons.httpclient.methods.EntityEnclosingMethod.
>> > > (Unknown Source)
>> > >at
>> org.apache.commons.httpclient.methods.PostMethod.(Unknown
>> > > Source)
>> > >at com.google.appengine.api.urlfetch.dev.LocalURLFetchService
>> > > $RedirectablePostMethod.(LocalURLFetchService.java:348)
>> > >at com.google.appengine.api.urlfetch.dev.LocalURLFetchService
>> > > $4.buildMethod(LocalURLFetchService.java:95)
>> >
>> > > I've tried this about half a dozen ways, starting with different --
>> > > address parameters thinking something wasn't picking up right on the
>> > > default 0.0.0.0 argument and on 1.2.8 and 1.3 versions.
>> >
>> > > The same code works fine if I publish to to production and run it
>> > > there.
>> >
>> > > My environment:
>> > > -OSX
>> > > -IntelliJ w/plugin
>> > > -JDK1.6
>> >
>> > > Thanks!
>> > > -Millisecond
>> >
>> > > --
>> >
>> > > You received this message because you are subscribed to the Google
>> Groups
>> > > "Google App Engine for Java" group.
>> > > To post to this group, send email to
>> > > google-appengine-j...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > google-appengine-java+unsubscr...@googlegroups.com
>> 
>> >
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/google-appengine-java?hl=en.
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
>>
>

--

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




[appengine-java] Re: Dynamically create classes using JPA/JDO and bytecode instrumentation

2009-12-16 Thread datanucleus
> I want to go ahead with JPA because that is a standard pushed by Sun itself.

JDO is also a JCP standard, blah blah.

> If I add annotations and load the class, I will *NOT* have to *RESTART* the 
> server.
> If I make changes to XML metadata file, I will have to *RESTART* the server.
> Are those correct assumptions?

That wiki page tells you that things need to be in your own
ClassLoader. I don't see any restart necessity

> By the way, I attended Sun's Virtual conference yesterday and they were
> coming out with JPA 2.0 with metadata APIs.
> Hopefully that gets incorporated in Datanucleus soon.

DataNucleus has many things of JPA2 ... just that GAE/J uses an old
version of DataNucleus.

--

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




Re: [appengine-java] Re: TaskQueue and null host name

2009-12-16 Thread Max Ross (Google)
Interesting, let me take a look.

On Tue, Dec 15, 2009 at 6:47 PM, Millisecond  wrote:

> It's in a normal doGet method of a servlet.
>
> Re-enabled it to double-check that I was failing on the version in
> doGet (originally I had it in an init() method) and ran into something
> that may be the cause.
>
> If I request the servlet from http://localhost:8080/ it fails, the
> same servlet also responds to http://localhost:8080/Index and there it
> works fine.
>
> I can't see anything in my code making it fail from the "bare" URL,
> but there is a fair amount going on in that servlet.  I was just doing
> it there for expediency while testing, can't see any good reason to
> enqueue something from / anyway so should be fine.
>
> Thanks,
> -C
>
>
>
> On Dec 15, 6:26 pm, "Max Ross (Google)" 
> 
> >
> wrote:
> > Where is your code that adds the task to the queue?  Is it being run
> during
> > server initializaiton, perhaps as part of a static block or a
> LoadOnStartup
> > servlet?
> >
> > Thanks,
> > Max
> >
> > On Tue, Dec 15, 2009 at 8:27 AM, Millisecond 
> wrote:
> > > Hello,
> >
> > > I'm just testing out super basic TaskQueue stuff in the dev
> > > environment and running into an exception I just can't seem to shake.
> >
> > > Code:
> >
> > > Queue queue = QueueFactory.getQueue("mail-queue");
> > > queue.add(url("/api/RunMonitor"));
> >
> > > Exception:
> >
> > > java.lang.IllegalArgumentException: Host name may not be null
> > >at org.apache.commons.httpclient.HttpHost.(Unknown Source)
> > >at org.apache.commons.httpclient.HttpHost.(Unknown Source)
> > >at org.apache.commons.httpclient.HttpMethodBase.setURI(Unknown
> > > Source)
> > >at org.apache.commons.httpclient.HttpMethodBase.(Unknown
> > > Source)
> > >at
> org.apache.commons.httpclient.methods.ExpectContinueMethod.
> > > (Unknown Source)
> > >at
> > > org.apache.commons.httpclient.methods.EntityEnclosingMethod.
> > > (Unknown Source)
> > >at
> org.apache.commons.httpclient.methods.PostMethod.(Unknown
> > > Source)
> > >at com.google.appengine.api.urlfetch.dev.LocalURLFetchService
> > > $RedirectablePostMethod.(LocalURLFetchService.java:348)
> > >at com.google.appengine.api.urlfetch.dev.LocalURLFetchService
> > > $4.buildMethod(LocalURLFetchService.java:95)
> >
> > > I've tried this about half a dozen ways, starting with different --
> > > address parameters thinking something wasn't picking up right on the
> > > default 0.0.0.0 argument and on 1.2.8 and 1.3 versions.
> >
> > > The same code works fine if I publish to to production and run it
> > > there.
> >
> > > My environment:
> > > -OSX
> > > -IntelliJ w/plugin
> > > -JDK1.6
> >
> > > Thanks!
> > > -Millisecond
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengine-java+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] com.google.appengine.api.datastore.Text with JPA

2009-12-16 Thread Max Ross (Google)
Try adding @Basic.  More info here:
http://code.google.com/appengine/docs/java/datastore/usingjpa.html#Class_and_Field_Annotations

On Tue, Dec 15, 2009 at 11:55 PM, Compi  wrote:

> Hey Everyone,
>
> I can't seem to get this working.  How do you save and read
> com.google.appengine.api.datastore.Text in google appengine with JPA,
> NOT JDO!!
>
> I have a simple POJO (Simplified example):
>
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
>
> import com.google.appengine.api.datastore.Text;
>
> @Entity
> public class NewsItem implements Serializable {
>@Id
>@GeneratedValue(strategy = GenerationType.IDENTITY)
>private Long id;
>private Text content;
>private Date created;
>private String title;
>private String user;
>
>public NewsItem(Text content, Date created, String title, String
> user) {
>super();
>this.content = content;
>this.created = created;
>this.title = title;
>this.user = user;
>}
>
>public Text getContent() {
>return content;
>}
>
>public void setContent(Text content) {
>this.content = content;
>}
> }
>
>
> Which I save in my dao:
>
> @Repository("newsItemDao")
> @Transactional
> public class NewsItemDao implements Dao {
>private EntityManager entityManager = EMF.getEntityManager();
>
>
>@Override
>public void save(NewsItem entity) {
>EntityTransaction tx = entityManager.getTransaction();
>tx.begin();
>entityManager.persist(entity);
>entityManager.flush();
>clearCache();
>tx.commit();
>}
> }
>
>
>
> But in my dashboard I can't find the content, so I think it's not
> saved, and so I can't retrieve it.
>
> Can someone help me.
>
> Thx
> Compi
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] Introducing App Engine SDK 1.3.0

2009-12-16 Thread Matt Farnell
doh, never thought to try that, I guess I do need some more sleep :)

thanks Jason and Vince for your help, that fixed the problem!

On Wed, Dec 16, 2009 at 8:46 AM, Jason Parekh  wrote:

> Hi Matt,
>
> You'll need to go to Help > Available software, expand the "Google
> Update Site for Eclipse 3.4", and select the App Engine SDK from
> there.
>
> Hope that helps,
> jason
>
> On Wed, Dec 16, 2009 at 11:37 AM, Matt Farnell  wrote:
> > Hi Jason,
> > It could be just me but when I try and update to 1.3.0 from 1.2.8 in
> eclipse
> > by clicking Help -> Software Updates -> Update I don't get any updates
> for
> > google appengine, thats how I have always in the past got updates but I
> seem
> > to be stuck on 1.2.8, 1.3.0 isn't coming through the eclipse updates (I
> know
> > I can add the SDK manually but I'd prefer the automagical way)
> > Is this a known issue or just me?
> > thanks,
> > Matt
> >
> > On Mon, Dec 14, 2009 at 8:00 PM, Jason (Google) 
> wrote:
> >>
> >> Hi Everyone. We just released version 1.3.0 of the App Engine SDK for
> >> both Python and Java. The most notable change is the new experimental
> >> Blobstore API which allows billed apps to store files up to 50 MB. The
> >> release also includes some performance tweaks to the Java runtime.
> >>
> >> Blog post:
> >>
> http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-released-including.html
> >>
> >> Release notes:
> >> Python: http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes
> >> Java:
> http://code.google.com/p/googleappengine/wiki/SdkForJavaReleaseNotes
> >>
> >> Cheers!
> >> - Jason
> >>
> >> --
> >>
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to
> >> google-appengine-j...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-appengine-java+unsubscr...@googlegroups.com
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/google-appengine-java?hl=en.
> >>
> >>
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-appengine-java?hl=en.
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] Re: Dynamically create classes using JPA/JDO and bytecode instrumentation

2009-12-16 Thread Bombay Goose
Thanks Datanucleus team,

I want to go ahead with JPA because that is a standard pushed by Sun itself.

Follow up question to the JPA -

If I add annotations and load the class, I will *NOT* have to *RESTART* the
server.
If I make changes to XML metadata file, I will have to *RESTART* the server.

Are those correct assumptions?

By the way, I attended Sun's Virtual conference yesterday and they were
coming out with JPA 2.0 with metadata APIs.

Hopefully that gets incorporated in Datanucleus soon.

Thanks for all the help
On Wed, Dec 16, 2009 at 4:41 AM, datanucleus wrote:

> > Is it possible through JPA? if yes, does appengine allow it?
>
> JPA doesn't provide a metadata API, so you'd have to extend that
> provided example to add on either annotations to the generated
> classes, or XML metadata file generation.
>
> >  if not, does Appengine allow Bytecode instrumentation so that we can
> > create classes dynamically according to the link above using JDO.
>
> GAE/J provides access to JDO hence you can use anything that goes with
> it, obviously including bytecode enhancement (since that is what the
> DataNucleus enhancer already does with GAE/J)
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




[appengine-java] Re: First Request High CPU

2009-12-16 Thread Valters Vingolds
I find it interesting that Glassfish will return 503 error (Service
Unavailable) and will show informative message while it is busy
loading the application.
Then user knows that he(or she) needs to reload the page in browser,
and the app will come up.

I guess from free service we can't ask that application will be always
on hot standby, loaded in memory and ready to go.
But then again, 30seconds appengine cold startup for a Rails
appliation stack (JRuby and Rails3.0pre) is just killing.

I wonder if it's just particularly bad today... but on my testing app,
it seems that ever other request times out (is killed by the 30
seconds HardDeadlineExceededError) as app stack is trying to spin
itself up.

--

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




[appengine-java] com.google.appengine.api.datastore.Text with JPA

2009-12-16 Thread Compi
Hey Everyone,

I can't seem to get this working.  How do you save and read
com.google.appengine.api.datastore.Text in google appengine with JPA,
NOT JDO!!

I have a simple POJO (Simplified example):

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import com.google.appengine.api.datastore.Text;

@Entity
public class NewsItem implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Text content;
private Date created;
private String title;
private String user;

public NewsItem(Text content, Date created, String title, String
user) {
super();
this.content = content;
this.created = created;
this.title = title;
this.user = user;
}

public Text getContent() {
return content;
}

public void setContent(Text content) {
this.content = content;
}
}


Which I save in my dao:

@Repository("newsItemDao")
@Transactional
public class NewsItemDao implements Dao {
private EntityManager entityManager = EMF.getEntityManager();


@Override
public void save(NewsItem entity) {
EntityTransaction tx = entityManager.getTransaction();
tx.begin();
entityManager.persist(entity);
entityManager.flush();
clearCache();
tx.commit();
}
}



But in my dashboard I can't find the content, so I think it's not
saved, and so I can't retrieve it.

Can someone help me.

Thx
Compi

--

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




[appengine-java] error 409

2009-12-16 Thread megha saddi
I cancel the deployment of application inbetween and now whenever i
try to redeploy the application on google appengine , an error message
occurs
409 Conflict and saying another transaction is in process..
Kindly tell me how to resolve this issue and redeploy that application

--

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




Re: [appengine-java] Introducing App Engine SDK 1.3.0

2009-12-16 Thread Jason Parekh
Hi Matt,

You'll need to go to Help > Available software, expand the "Google
Update Site for Eclipse 3.4", and select the App Engine SDK from
there.

Hope that helps,
jason

On Wed, Dec 16, 2009 at 11:37 AM, Matt Farnell  wrote:
> Hi Jason,
> It could be just me but when I try and update to 1.3.0 from 1.2.8 in eclipse
> by clicking Help -> Software Updates -> Update I don't get any updates for
> google appengine, thats how I have always in the past got updates but I seem
> to be stuck on 1.2.8, 1.3.0 isn't coming through the eclipse updates (I know
> I can add the SDK manually but I'd prefer the automagical way)
> Is this a known issue or just me?
> thanks,
> Matt
>
> On Mon, Dec 14, 2009 at 8:00 PM, Jason (Google)  wrote:
>>
>> Hi Everyone. We just released version 1.3.0 of the App Engine SDK for
>> both Python and Java. The most notable change is the new experimental
>> Blobstore API which allows billed apps to store files up to 50 MB. The
>> release also includes some performance tweaks to the Java runtime.
>>
>> Blog post:
>> http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-released-including.html
>>
>> Release notes:
>> Python: http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes
>> Java: http://code.google.com/p/googleappengine/wiki/SdkForJavaReleaseNotes
>>
>> Cheers!
>> - Jason
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

--

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




Re: [appengine-java] Introducing App Engine SDK 1.3.0

2009-12-16 Thread Vince Bonfanti
I had the same issue, so instead I went to "Help->Install New Software...",
then selected the Google App Engine site from the "Work with..." menu; then
it allowed me to select SDK 1.3.0.

Vince

On Wed, Dec 16, 2009 at 11:37 AM, Matt Farnell  wrote:

> Hi Jason,
>
> It could be just me but when I try and update to 1.3.0 from 1.2.8 in
> eclipse by clicking Help -> Software Updates -> Update I don't get any
> updates for google appengine, thats how I have always in the past got
> updates but I seem to be stuck on 1.2.8, 1.3.0 isn't coming through the
> eclipse updates (I know I can add the SDK manually but I'd prefer the
> automagical way)
>
> Is this a known issue or just me?
>
> thanks,
> Matt
>
>
>

--

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




Re: [appengine-java] Introducing App Engine SDK 1.3.0

2009-12-16 Thread Matt Farnell
Hi Jason,

It could be just me but when I try and update to 1.3.0 from 1.2.8 in eclipse
by clicking Help -> Software Updates -> Update I don't get any updates for
google appengine, thats how I have always in the past got updates but I seem
to be stuck on 1.2.8, 1.3.0 isn't coming through the eclipse updates (I know
I can add the SDK manually but I'd prefer the automagical way)

Is this a known issue or just me?

thanks,
Matt

On Mon, Dec 14, 2009 at 8:00 PM, Jason (Google)  wrote:

> Hi Everyone. We just released version 1.3.0 of the App Engine SDK for
> both Python and Java. The most notable change is the new experimental
> Blobstore API which allows billed apps to store files up to 50 MB. The
> release also includes some performance tweaks to the Java runtime.
>
> Blog post:
> http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-released-including.html
>
> Release notes:
> Python: http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes
> Java: http://code.google.com/p/googleappengine/wiki/SdkForJavaReleaseNotes
>
> Cheers!
> - Jason
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] Re: BlobstoreService, No image data is available.

2009-12-16 Thread Don Schwarz
Yes, you don't have access to the dimensions of the uploaded image.
 Luckily, if you're just trying to create a thumbnail you don't need them --
the resize transformation preserves the aspect ratio automatically.  You
just need to pass in the maximum width and maximum height.

On Tue, Dec 15, 2009 at 11:28 PM, m seleron  wrote:

> Hi,
>
> I tried a little.
> I think that it is issue though I can try only with local.
>
> In oldImage of the return value of makeImageFromBlob,
> oldImage#imageData is null.
>
> As a result,
> I think that ImageImpl#updateDimensions is causing an exception.
> It is called in getWidth etc.
>
> thanks.
>
>
> On 12月16日, 午前9:53, Andreas Oesterer  wrote:
> > I'm trying to scale an image after upload (in the doPost method). The
> > blob key seems to be ok and the image is served ok after the upload.
> >
> > Image oldImage = ImagesServiceFactory.makeImageFromBlob(bk);
> > double aspectRatio = (double) oldImage.getWidth()  / (double)
> > oldImage.getHeight();
> >
> > ->
> >
> > java.lang.UnsupportedOperationException: No image data is available.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




[appengine-java] Re: Can we use Enums as fields in Data classes

2009-12-16 Thread dantuluri
Thanks, the article is really helpful.

On Dec 15, 4:06 pm, David Chandler  wrote:
> Seehttp://turbomanage.wordpress.com/2009/12/04/persisting-enums-with-app...
>
> HTH,
> /dmc
>
> On Dec 14, 5:35 pm, dantuluri  wrote:
>
> > Hi,
>
> >    Can we use java enums as @Persistent data fields in the Data
> > classes? There is no tutorial that talks about java enums being used
> > in the Data classes.
>
> > Thanks,
> > Prasad

--

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




[appengine-java] Many "Request was aborted after waiting too long to attempt to service your request" errors

2009-12-16 Thread Fabrizio
Hello,

I have a cron job (1/m).  I get many random errors like:
12-16 06:43AM 34.115 /"myurl.."   500 10020ms 0cpu_ms 0kb
"Request was aborted after waiting too long to attempt to service your
request. Most likely, this indicates that you have reached your
simultaneous dynamic request limit. This is almost always due to
excessively high latency in your app."

I think it's not caused by "simultaneous dynamic request limit". I
make only 1 request/minute.
I also noticed an high time (more than 1ms).


When it works, the log is like this:
  12-16 06:48AM 20.059 /"myurl..."   200 156ms 191cpu_ms
95api_cpu_ms 0kb


Why some requests work and other crash? I don't change anything
between them.


   Fabrizio

--

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




[appengine-java] Re: Dynamically create classes using JPA/JDO and bytecode instrumentation

2009-12-16 Thread datanucleus
> Is it possible through JPA? if yes, does appengine allow it?

JPA doesn't provide a metadata API, so you'd have to extend that
provided example to add on either annotations to the generated
classes, or XML metadata file generation.

>      if not, does Appengine allow Bytecode instrumentation so that we can
> create classes dynamically according to the link above using JDO.

GAE/J provides access to JDO hence you can use anything that goes with
it, obviously including bytecode enhancement (since that is what the
DataNucleus enhancer already does with GAE/J)

--

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




Re: [appengine-java] Cannot deploy files because of space(s) in file path

2009-12-16 Thread Raphael André Bauer
that's not really a bug i guess. the problem is the space character.
depending how your system is configured and depending how the target
system is configured a space is not always a space.

if you play around with encoding on your machine i am pretty sure you
will get it to run "somehow".

in short: do never use a "space" character in your urls and you will
avoid a bunch of problems...

ra

On Wed, Dec 16, 2009 at 7:23 AM, tha  wrote:
> I have the following files in my webapp:
>
> \WEB-INF\web.xml
> \WEB-INF\appengine-web.xml
> \publish\Application Files\index.html
> \publish\Application_Files\index.html
> ...
>
> When I use appcfg.cmd to upload, everything seems OK, I see no error.
> But when I try to access
>
> http://.appspot.com/publish/Application%20Files/index.html
> I see a 404 error
>
> while http://.appspot.com/publish/Application_Files/index.html
> works correctly.
>
> Is this a bug or not? Any workaround solution? (I have to have use the
> name with space)
>
> Thank you in advance!
>
> Thai
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>

--

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




Re: [appengine-java] com.google.appengine.api.datastore.DatastoreNeedIndexException

2009-12-16 Thread Dmitry Anipko
Jason,

thanks for the info, this solved the problem.

I've noticed however that the index building can take some time after
the application has been deployed - is there any way to control that /
prevent the new version of the application from being used if the
indices are not ready yet? (Otherwise the app is guaranteed to produce
errors if customers start using it when the indices are not yet fully
ready)



On Tue, Dec 15, 2009 at 4:16 PM, Jason (Google)  wrote:
> Hi Dmitry. What's your app ID?
> Indexes are auto-generated by the SDK when you run a query locally that
> requires a custom index. If you don't run a particular query locally and it
> uses multiple sort orders or otherwise requires a custom index, then the
> index won't be generated in datastore-indexes-auto.xml and you'll see an
> exception in production. You can see which indexes are created and serving
> for your app by clicking "Datastore Indexes" in your app's Admin Console.
> For now, I suggest adding the index definitions contained in your exception
> to your datastore-indexes.xml file, re-deploying your app, waiting for the
> indexes to build, and seeing if that fixes your problem.
> - Jason
>
> On Sun, Dec 13, 2009 at 10:00 PM, Dmitry Anipko 
> wrote:
>>
>> Hello,
>>
>> our application recently started producing exceptions like:
>>
>> com.google.appengine.api.datastore.DatastoreNeedIndexException: no
>> matching index found..      > ancestor="false" source="manual">
>>       
>>       
>>   
>>
>> or
>>
>> Server error 1:
>> com.google.appengine.api.datastore.DatastoreNeedIndexException: no
>> matching index found..      > kind="SketchCommentThread" ancestor="true" source="manual">
>>       
>>   
>>
>> for different tables in the data store. Our app doesn't use explicit
>> index configuration / don't have datastore-indexes.xml .
>>
>> On the local development server the auto generated xml for these two
>> tables looks like:
>>
>> 
>>
>> 
>>
>>   
>>   > source="auto">
>>       
>>   
>>
>>   
>>   > source="auto">
>>       
>>       
>>   
>>
>> 
>>
>>
>> I wonder if anybody faced similar issues / can shed some light on how
>> to deal with that?
>>
>> Thank you,
>> Dmitry
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

--

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




[appengine-java] Re: Datastore String limit: 500 characters or 500 bytes, which is it?

2009-12-16 Thread Jeff Schnitzer
Hello?

I've now bugged this:
http://code.google.com/p/googleappengine/issues/detail?id=2519

Jeff

On Mon, Dec 14, 2009 at 4:24 PM, Jeff Schnitzer  wrote:
> Can anyone comment on this in an official capacity?
>
> I can write some code to test actual behavior, but I'd really rather
> know the defined behavior.
>
> Thanks,
> Jeff
>
> On Fri, Dec 11, 2009 at 2:41 AM, Jeff Schnitzer  wrote:
>> The javadocs for Text say the datastore limit is 500 characters:
>>
>> http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Text.html
>>
>> The JDO docs say 500 bytes:
>>
>> http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Core_Value_Types
>>
>> The python docs for StringProperty say the limit is 500 bytes:
>>
>> http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringProperty
>>
>> S what happens if I try to save a Java (utf-16) String which
>> expands after utf-8 encoding to, say, the worst case scenario of 2000
>> bytes?
>>
>> Thanks,
>> Jeff
>>
>

--

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