[google-appengine] Re: Remote API + File API

2011-08-18 Thread Wen (Google)
I read the doc. you pointed out as such:  when "out.close()" was
called, the "writeChannel" was not closed; when "readChannel.close()"
was called, the "reader" itself was not closed.  So, looks like you
only need to do one or the other.  It may have to do with how closing
is implemented on the channels.

So remove "out.close()", and see if the exception would go away.


Wen


On Aug 18, 7:05 am, André Salvati  wrote:
> Hi,
>
> Maybe I've misunderstood docs, but I thought it was possible an
> external application to integrate with App Engine by creating a file
> in Blobstore. Am I doing something wrong?? Any way to accomplish
> this??
>
> http://code.google.com/appengine/docs/java/blobstore/overview.html#Wr...
>
> Thanks.
>
> Code:
>
> public class RemoteAPI {
>
>     public static void main(String[] args) throws IOException {
>
>         String username = "x...@gmail.com";
>         String password = "x";
>
>         RemoteApiOptions options = new RemoteApiOptions()
>                 .server("primepartes.appspot.com", 443)
>             .credentials(username, password);
>         RemoteApiInstaller installer = new RemoteApiInstaller();
>         installer.install(options);
>
>         FileService fileService = FileServiceFactory.getFileService();
>         BlobstoreService blobstoreService =
> BlobstoreServiceFactory.getBlobstoreService();
>
>         AppEngineFile file = fileService.createNewBlobFile("text/
> plain");
>
>         FileWriteChannel writeChannel =
> fileService.openWriteChannel(file, true);
>
>         PrintWriter out = new
> PrintWriter(Channels.newWriter(writeChannel, "UTF8"));
>         out.println("The woods are lovely dark and deep.");
>         out.println("But I have promises to keep.");
>
>         out.close();
>         writeChannel.closeFinally(); // This line throwns the excepion
> bellow
>
> ..
>
> java.lang.IllegalStateException: The current request does not hold the
> exclusive lock.
>         at
> com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java:
> 315)
>         at
> com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteC 
> hannelImpl.java:
> 78)
>         at br.com.teste.RemoteAPI.main(RemoteAPI.java:82)

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



[google-appengine] Re: Remote API + File API

2011-08-22 Thread André Salvati
Without "out.close()" throws this exception on or
"writeChannel.closeFinally()":

Exception in thread "main" java.lang.IllegalStateException: The
current request does not hold the exclusive lock.
at
com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java:
315)
at
com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteChannelImpl.java:
78)
at br.com.teste.RemoteAPI.main(RemoteAPI.java:94)


Excuse me, bill is not enabled for my app, but exception should be
clear about this.

"Note: The Blobstore API is only available for apps with billing
enabled. You still get an amount of quota for free, but billing must
be enabled to use it."

http://code.google.com/appengine/docs/quotas.html#Blobstore

Thanks.



On 18 ago, 17:35, "Wen (Google)"  wrote:
> I read the doc. you pointed out as such:  when "out.close()" was
> called, the "writeChannel" was not closed; when "readChannel.close()"
> was called, the "reader" itself was not closed.  So, looks like you
> only need to do one or the other.  It may have to do with how closing
> is implemented on the channels.
>
> So remove "out.close()", and see if the exception would go away.
>
> Wen
>
> On Aug 18, 7:05 am, André Salvati  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Maybe I've misunderstood docs, but I thought it was possible an
> > external application to integrate with App Engine by creating a file
> > in Blobstore. Am I doing something wrong?? Any way to accomplish
> > this??
>
> >http://code.google.com/appengine/docs/java/blobstore/overview.html#Wr...
>
> > Thanks.
>
> > Code:
>
> > public class RemoteAPI {
>
> >     public static void main(String[] args) throws IOException {
>
> >         String username = "x...@gmail.com";
> >         String password = "x";
>
> >         RemoteApiOptions options = new RemoteApiOptions()
> >                 .server("primepartes.appspot.com", 443)
> >             .credentials(username, password);
> >         RemoteApiInstaller installer = new RemoteApiInstaller();
> >         installer.install(options);
>
> >         FileService fileService = FileServiceFactory.getFileService();
> >         BlobstoreService blobstoreService =
> > BlobstoreServiceFactory.getBlobstoreService();
>
> >         AppEngineFile file = fileService.createNewBlobFile("text/
> > plain");
>
> >         FileWriteChannel writeChannel =
> > fileService.openWriteChannel(file, true);
>
> >         PrintWriter out = new
> > PrintWriter(Channels.newWriter(writeChannel, "UTF8"));
> >         out.println("The woods are lovely dark and deep.");
> >         out.println("But I have promises to keep.");
>
> >         out.close();
> >         writeChannel.closeFinally(); // This line throwns the excepion
> > bellow
>
> > ..
>
> > java.lang.IllegalStateException: The current request does not hold the
> > exclusive lock.
> >         at
> > com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java:
> > 315)
> >         at
> > com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteC 
> > hannelImpl.java:
> > 78)
> >         at br.com.teste.RemoteAPI.main(RemoteAPI.java:82)

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



[google-appengine] Re: Remote API + File API

2011-12-09 Thread Ronoaldo José de Lana Pereira
Sorry to revive an old thread 

Even when billing is enabled, this seems to be a problem, because 
remote_api will issue diferent requests and the closeFinally() request 
won't have the lock anyway, after you create the file.

Any way to acomplish this?

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



[google-appengine] Re: Remote API + File API

2012-01-02 Thread ken.wainwright - gerzump.com
I have exactly the same problem, and when I set "lock = true;
writeChannel = fileService.openWriteChannel(file, 
lock);"
I get a "com.google.appengine.api.files.LockException" - did you ever
resolve this issue.



On Dec 9 2011, 5:45 pm, Ronoaldo José de Lana Pereira
 wrote:
> Sorry to revive an old thread
>
> Even when billing is enabled, this seems to be a problem, because
> remote_api will issue diferent requests and the closeFinally() request
> won't have the lock anyway, after you create the file.
>
> Any way to acomplish this?

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



[google-appengine] Re: Remote API + File API

2012-11-22 Thread Abdul Nasir
If you want to read a file from the cloud storage, it works fine. but 
writing creates problem. have you solved this issue? If yes, please guide 
me.

On Thursday, August 18, 2011 10:05:20 PM UTC+8, André Salvati wrote:
>
> Hi, 
>
> Maybe I've misunderstood docs, but I thought it was possible an 
> external application to integrate with App Engine by creating a file 
> in Blobstore. Am I doing something wrong?? Any way to accomplish 
> this?? 
>
>
> http://code.google.com/appengine/docs/java/blobstore/overview.html#Writing_Files_to_the_Blobstore
>  
>
> Thanks. 
>
> Code: 
>
> public class RemoteAPI { 
>
> public static void main(String[] args) throws IOException { 
>
> String username = "xx...@gmail.com "; 
> String password = "x"; 
>
>
> RemoteApiOptions options = new RemoteApiOptions() 
> .server("primepartes.appspot.com", 443) 
> .credentials(username, password); 
> RemoteApiInstaller installer = new RemoteApiInstaller(); 
> installer.install(options); 
>
> FileService fileService = FileServiceFactory.getFileService(); 
> BlobstoreService blobstoreService = 
> BlobstoreServiceFactory.getBlobstoreService(); 
>
> AppEngineFile file = fileService.createNewBlobFile("text/ 
> plain"); 
>
> FileWriteChannel writeChannel = 
> fileService.openWriteChannel(file, true); 
>
> PrintWriter out = new 
> PrintWriter(Channels.newWriter(writeChannel, "UTF8")); 
> out.println("The woods are lovely dark and deep."); 
> out.println("But I have promises to keep."); 
>
> out.close(); 
> writeChannel.closeFinally(); // This line throwns the excepion 
> bellow 
>
> .. 
>
> java.lang.IllegalStateException: The current request does not hold the 
> exclusive lock. 
> at 
> com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java: 
> 315) 
> at 
> com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteChannelImpl.java:
>  
>
> 78) 
> at br.com.teste.RemoteAPI.main(RemoteAPI.java:82) 
>
>

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



[google-appengine] Re: Remote API + File API

2013-01-26 Thread Andrew Kunkel
I am really hoping to find an answer for this.  I have been searching for 
the last week without any luck.  I really need a method to add large 
numbers of images on a regular basis from a remote location and this looks 
like it could be a solution if I could get past the exception.

On Thursday, November 22, 2012 4:31:59 AM UTC-5, Abdul Nasir wrote:
>
> If you want to read a file from the cloud storage, it works fine. but 
> writing creates problem. have you solved this issue? If yes, please guide 
> me.
>
> On Thursday, August 18, 2011 10:05:20 PM UTC+8, André Salvati wrote:
>>
>> Hi, 
>>
>> Maybe I've misunderstood docs, but I thought it was possible an 
>> external application to integrate with App Engine by creating a file 
>> in Blobstore. Am I doing something wrong?? Any way to accomplish 
>> this?? 
>>
>>
>> http://code.google.com/appengine/docs/java/blobstore/overview.html#Writing_Files_to_the_Blobstore
>>  
>>
>> Thanks. 
>>
>> Code: 
>>
>> public class RemoteAPI { 
>>
>> public static void main(String[] args) throws IOException { 
>>
>> String username = "xx...@gmail.com"; 
>> String password = "x"; 
>>
>>
>> RemoteApiOptions options = new RemoteApiOptions() 
>> .server("primepartes.appspot.com", 443) 
>> .credentials(username, password); 
>> RemoteApiInstaller installer = new RemoteApiInstaller(); 
>> installer.install(options); 
>>
>> FileService fileService = FileServiceFactory.getFileService(); 
>> BlobstoreService blobstoreService = 
>> BlobstoreServiceFactory.getBlobstoreService(); 
>>
>> AppEngineFile file = fileService.createNewBlobFile("text/ 
>> plain"); 
>>
>> FileWriteChannel writeChannel = 
>> fileService.openWriteChannel(file, true); 
>>
>> PrintWriter out = new 
>> PrintWriter(Channels.newWriter(writeChannel, "UTF8")); 
>> out.println("The woods are lovely dark and deep."); 
>> out.println("But I have promises to keep."); 
>>
>> out.close(); 
>> writeChannel.closeFinally(); // This line throwns the excepion 
>> bellow 
>>
>> .. 
>>
>> java.lang.IllegalStateException: The current request does not hold the 
>> exclusive lock. 
>> at 
>> com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java: 
>>
>> 315) 
>> at 
>> com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteChannelImpl.java:
>>  
>>
>> 78) 
>> at br.com.teste.RemoteAPI.main(RemoteAPI.java:82) 
>>
>>

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




[google-appengine] Re: Remote API + File API

2013-01-26 Thread Stuart Langley
Why not just use the Google Cloud Storages APIs then to upload directly to 
a bucket that you then access from you GAE application?

On Sunday, 27 January 2013 01:37:34 UTC+11, Andrew Kunkel wrote:
>
> I am really hoping to find an answer for this.  I have been searching for 
> the last week without any luck.  I really need a method to add large 
> numbers of images on a regular basis from a remote location and this looks 
> like it could be a solution if I could get past the exception.
>
> On Thursday, November 22, 2012 4:31:59 AM UTC-5, Abdul Nasir wrote:
>>
>> If you want to read a file from the cloud storage, it works fine. but 
>> writing creates problem. have you solved this issue? If yes, please guide 
>> me.
>>
>> On Thursday, August 18, 2011 10:05:20 PM UTC+8, André Salvati wrote:
>>>
>>> Hi, 
>>>
>>> Maybe I've misunderstood docs, but I thought it was possible an 
>>> external application to integrate with App Engine by creating a file 
>>> in Blobstore. Am I doing something wrong?? Any way to accomplish 
>>> this?? 
>>>
>>>
>>> http://code.google.com/appengine/docs/java/blobstore/overview.html#Writing_Files_to_the_Blobstore
>>>  
>>>
>>> Thanks. 
>>>
>>> Code: 
>>>
>>> public class RemoteAPI { 
>>>
>>> public static void main(String[] args) throws IOException { 
>>>
>>> String username = "xx...@gmail.com"; 
>>> String password = "x"; 
>>>
>>>
>>> RemoteApiOptions options = new RemoteApiOptions() 
>>> .server("primepartes.appspot.com", 443) 
>>> .credentials(username, password); 
>>> RemoteApiInstaller installer = new RemoteApiInstaller(); 
>>> installer.install(options); 
>>>
>>> FileService fileService = FileServiceFactory.getFileService(); 
>>> BlobstoreService blobstoreService = 
>>> BlobstoreServiceFactory.getBlobstoreService(); 
>>>
>>> AppEngineFile file = fileService.createNewBlobFile("text/ 
>>> plain"); 
>>>
>>> FileWriteChannel writeChannel = 
>>> fileService.openWriteChannel(file, true); 
>>>
>>> PrintWriter out = new 
>>> PrintWriter(Channels.newWriter(writeChannel, "UTF8")); 
>>> out.println("The woods are lovely dark and deep."); 
>>> out.println("But I have promises to keep."); 
>>>
>>> out.close(); 
>>> writeChannel.closeFinally(); // This line throwns the excepion 
>>> bellow 
>>>
>>> .. 
>>>
>>> java.lang.IllegalStateException: The current request does not hold the 
>>> exclusive lock. 
>>> at 
>>> com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java: 
>>>
>>> 315) 
>>> at 
>>> com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteChannelImpl.java:
>>>  
>>>
>>> 78) 
>>> at br.com.teste.RemoteAPI.main(RemoteAPI.java:82) 
>>>
>>>

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