How to access gmail inbox using GAE - google-app-engine

We are trying to access gmail inbox from our application in Java. We can read inbox, message, add label, but we are in progress to achieve all the desired functionality.
Our conclusions:
-javax.mail embedded in GAE SDK doesn't work, we can't get the content of e-mail, it returns always null (as expected to not work with IMAP protocol).
With the package mail.jar (https://java.net/projects/javamail/pages/Home), the libraries throws an error because there are two libraries with the same name. (javax)
We investigated and we found a solution on Google Groups consisting in copy the files from javamail.jar to our WEB-INF/classes directory in to our project.
After that, javamail library works but com.sun package is not recognized by our project (eclipse) so we can't get the content of an attachment indeed we need to use "com.sun.mail.util" package.
How can add this libraries to our project?
We use:
App Engine Java SDK 1.7.7
GWT 2.5.1
Java Sun 1.6
Eclipse 3.7.2

You should make sure for recieving emails you should turn on the inbound mail services to true
<inbound-services>
<service>mail</service>
</inbound-services>
There is more configuration details that you can read thro in the documentation.,
Recieve email

Related

Need to know the way to work with Apache Camel

I am new to Apache Camel. I have read several documentation of it and went through the examples (only of XML DSL) that Apache provide with its jar. I have a spring MVC project running over tomcat, and in the same project I need to include an Integration Framework. I have installed JBoss plugin for tooling so that I can drag and drop components but palette isn't showing any component but a message 'A palette is not working'. So, please suggest me how should I proceed to implement the same. For now I am referring Camel in Action. And, if possible, then provide an example to send a https request to any URL with some header parameters and transform its response and print it on console or write it to any file or give another https request to any other URL with the payload.
you mentioned that you installed the JBoss plugin for tooling, do you mean that you installed the JBoss Fuse Tooling?
Which version of Eclipse or JBoss Developer Studio are you using? Which OS are you using?
In Fuse Tooling, several examples are provided based on archetypes, I let you check the "CHAPTER 5. CREATING A NEW FUSE PROJECT" in
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.2.1/pdf/Tooling_User_Guide/Red_Hat_JBoss_Fuse-6.2.1-Tooling_User_Guide-en-US.pdf

Google Cloud Endpoint Client Library Generation Not Working

I am trying to generate my first Google Cloud Endpoint and am having trouble generating the client libraries.
First I try doing it with the GPE. It generates an endpoints-libs folder in the Eclipse project with a bunch of files. The readme.html says, "The generated service-specific library can be found in the top level directory of the zip file: google-api-services-mayapp-v1-rev20140417180959-1.16.0-rc.jar". There is no such file generated.
Second, I try to generate with the appengine-sdk. It creates myapp-v1-java.zip, which contains the same files and structure that GPE generates, but I don't see any JAR in there that would contain my endpoints.
I'm using Eclipse Juno Release 2 and GPE 3.5.1. Just did a Check Updates and I appear to be up to date.
NOTE: I am not using Maven and prefer to continue not using it if possible.
How does one generate the client libraries?
I have found no explanation and assume the problem is that the GPE has been updated and the documentation is old.
What has worked for me is to follow this video which an Android client being build to use an endpoint:
https://www.youtube.com/watch?v=NU_wNR_UUn4
The video shows that one must build the endpoint client libraries (from GPE). That generates some source files in the endpoints-lib. Those source files are then copied to the client app.
In my case I was building a Java client app. I followed the instructions for build and Android client app, which are here:
https://developers.google.com/appengine/docs/java/endpoints/consume_android
That shows how to call the service from an Android app. Specifically, it shows how to use the source classes that were copied to the client app from the endpoints-lib. I had to make a few small adjustments. In the end it seems to work.

An API for creating and managing Google Cloud Console projects?

I believe there is an undocumented Google API available to create and manage Google Cloud Console (and App Engine) projects on behalf of third party users.
Does anyone know how to use it?
I think older versions of the Google Eclipse Plugin obtained an OAuth2 token in the (undocumented) scope https://www.googleapis.com/auth/appengine.admin, and this allowed it to generate a Cloud Console project on your behalf. The latest version doesn't seem to do this. App Engine's own appcfg.py also uses this scope, but doesn't seem to do much more than deploy the code - I'm looking to change core settings for the project, such as Name, Redirect URLs, and Web Origins.
Any information would be appreciated.
I maintain a WordPress plugin providing secure Google Apps Login for end users, and currently have to give detailed instructions to admins for creating a new Cloud Console project manually, and entering settings such as Redirect URL. Ideally, I would create a simple on-line service to do all of this for them.
Thank you!
It is possible to programmatically create a new Developer Console project on behalf of a Google Account (yes, you read that right). You do so in a very roundabout way:
Request the https://www.googleapis.com/auth/drive.scripts scope from the user (standard OAuth 2.0 flow).
Use the Drive API's drive.insert method to create a new file with a mimetype of application/vnd.google-apps.script.
Somehow try to get the project ID, maybe by uploading some Apps Script code? This is the part that I was never able to figure out.
A little known fact is that every Google Apps Script project has a hidden Developer Console project associated with it. This project is not shown in the list of projects, but it does exist. It is created automatically when the user starts a new Apps Script project, and the drive.insert method is enough to cause this to happen.
How do you get to the hidden project? Well, the only way I know of is to open the Apps Script project from the Drive website, open the "Resources > Advanced Google Services" dialog, and click the link to the Developer Console. You'll find the project ID in the URL.
Aside from not being shown in your list of projects and not being able to use App Engine, this is a normal Developer Console project. You can add additional OAuth client credentials, service accounts, Compute Engine instances, etc. And of course once you have a project ID, all of the various management APIs will work: creating new virtual machines, making use of a service account's impersonation ability, etc.

creating a filter using the gdata java client library and email settings api

This is my first time with google apis and I am having trouble implementing the email settings api in eclipse .Please tell me exactly which jar files are to be included and how ? I am getting GmailSettingsService class not found error.Please Help
Thank you
From here:
Didn't you ever want some kind of tool to create new Google Data projects in seconds? Google Data Java Client Eclipse
Plug-in is now available for use.
Using this plug-in you can create a new Java project to interact with
any Google Data API of your choice. Now, you don't need to worry about
setting up the dependencies for your Google Data project. This plug-in
handles all the dependencies and also provides you with an option to
download the external dependencies. It also creates a boiler plate
code to interact with the API that you are interested in. This will
give a quick start to all the newbies.

possible to eliminate JDO/JPA-related JARs from GAE project if using Twig/Objectify/etc?

In my Google App Engine project, I'm currently using Twig for accessing the Datastore (but I suspect my question would be relevant for other 3rd party libs like SimpleDS, Objectify, etc.).
I was thinking that I should be able to delete some or all of the following JARs from my WEB-INF/lib folder:
datanucleus-appengine-[...].jar
datanucleus-core-[...].jar
datanucleus-jpa-[...].jar
geronimo-jpa_[...].jar
geronimo-jta_[...].jar
jdo2-api-[...].jar
But when I do, I get errors from Eclipse complaining that "The App Engine SDK JAR is missing in the WEB-INF/lib directory".
Is it really necessary to retain all these (unused) JARs?
If you're using the Google Plugin for Eclipse you can delete these JARs and then open the Properties for your Google Web Application project and open the Google > App Engine and then uncheck the Use datanucleus JDO/JPA to access the datastore. In fact, unchecking this box actually deletes these JARs for you.
I don't think you can delete them from the project (as you have said, eclipse starts to complain), but I've heard you don't have to upload them to your app, as long as you upload from the command line. This has the advantage that at startup your app won't have to load them up.
There are some details of uploading to app engine via the command line here and confirmation that you can do this here
If you manage to do this I would appreciate it it if you post links to the instructions you followed or post what you needed to do, as I have this on my todo list as well, but only got as far as seeing if it was possible. Thanks!

Resources