[appengine-java] User Personal page

2010-10-04 Thread x_maras
Hi,


I'm new to the cloud and not an experienced developer.
For a course I have to make a web application using the GAE and I will
also use JAVA for it.


I did a few tutorials but I still have questions that don't let me
start with my project.


In my application I want people to be able to login (I have figured out
how to do it) and I also want to have different data presentation
depending to each user (this I don't know how to do it)
I have experience of php and mysql but it is my first time that I 'm
working with Datastore.


So I would like to know what can separate each user connected with a
google account.
Could I have something like the PHP session for checking if a user is
logged in?
How I could also make relationship in datastore objects like relating 2
sql tables for example.


I would be grateful if someone could give me this information or
provide me some links where I could find answers.

-- 
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] Datastore, Java, JSP, JSON, AJAX, Web Page. Is it going to work?

2010-10-06 Thread x_maras
Hi,

I am new to GAE and I want to make a web application page on it.
I was used to work with PHP for web applications but lately I am
struggling to get in the thinking of a GAE web application.

After reading tutorials and trying to do different things I came up
with a thinking how I want my project to be and how to make the
communication through the different layers. I will explain you my
thinking and I would like to tell me if am I in the right way and if I
am not I would like someone to put back into it.

e.g.

I thought to have a user @persistent class for storing the information
of a user, such as name, email(as a primary key), registration date
etc... (I will use the User class for logging in, but I want to keep
some data also for every user)

Then I need to create a java (dao) class that reads and inserts data
to the datastore "tables-objects". I thought to create a different one
for each @persistent class

Then Java files that execute the  functions from the DAO classes and
give information to the jsp files which through JSON give information
to the Ajax functions in the HTML page (which I was thinking also to
be the welcome-file in my web.xml)

So here comes the questions. Is something like this right? Is it going
to work? And if not what do you propose me to do.

Any links or examples are very very welcome.

-- 
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] Datastore, Java, JSP, JSON, AJAX, Web Page. Is it going to work?

2010-10-06 Thread x_maras
Hi,

I am new to GAE and I want to make a web application page on it.
I was used to work with PHP for web applications but lately I am
struggling to get in the thinking of a GAE web application.

After reading tutorials and trying to do different things I came up
with a thinking how I want my project to be and how to make the
communication through the different layers. I will explain you my
thinking and I would like to tell me if am I in the right way and if I
am not I would like someone to put back into it.

e.g.

I thought to have a user @persistent class for storing the information
of a user, such as name, email(as a primary key), registration date
etc... (I will use the User class for logging in, but I want to keep
some data also for every user)

Then I need to create a java (dao) class that reads and inserts data
to the datastore "tables-objects". I thought to create a different one
for each @persistent class

Then Java files that execute the  functions from the DAO classes and
give information to the jsp files which through JSON give information
to the Ajax functions in the HTML page (which I was thinking also to
be the welcome-file in my web.xml)

So here comes the questions. Is something like this right? Is it going
to work? And if not what do you propose me to do.

Any links or examples are very very welcome.

-- 
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] failure in simple JDO query

2010-10-07 Thread x_maras
Hi,

I was trying to do some simple JDO queries in order to find my way in
java google app engine.
I have an persistent object where I store information about users,
called UserData
I also have made a class DAO where I have methods for creating new
users for checking if a user exist and to show data for users.
I created 2 records successfully but I can't read them.
The error that I get is
HTTP ERROR 500

Problem accessing /. Reason:

com.awt.oat.dao.UserDao.showUserData()V
Caused by:

java.lang.NoSuchMethodError: com.awt.oat.dao.UserDao.showUserData()V
at org.apache.jsp.auction_jsp._jspService(auction_jsp.java:89)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

 and a lot more


I'm sure that I 'm doing something really stupid. Please someone to
help me...

Here is my DAO class code:

package com.awt.oat.dao;

import javax.jdo.PersistenceManager;
import com.awt.oat.PMF;
import com.awt.oat.model.UserData;
import com.google.appengine.api.users.User;
import javax.jdo.Query;
import java.util.List;
import java.util.Date;
import javax.jdo.JDOObjectNotFoundException;


public class UserDao {
public void createUser(String uniqueID, String userName, String email)
{
Date date = new Date();
UserData newUser = new UserData(uniqueID, userName, email, 
date);

PersistenceManager pm = PMF.get().getPersistenceManager();
try {
pm.makePersistent(newUser);
}finally {
pm.close();
}
}

public void showUserData(){

PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(UserData.class);

try{
List results = (List)query.execute();

if (results.iterator().hasNext()) {
for(UserData u : results){
System.out.println("" +
"username" + 
u.getUserName() + ""
+ "email" + 
u.getEmail() + "");
}
} else {
System.out.printf("No results in the datastore");
}
}finally{
query.closeAll();
}
}
}

and here my jsp file

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="com.awt.oat.dao.UserDao" %>
<%@ page import="java.io.*" %>


  

  
  
<%
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
%>
Hello, <%= user.getNickname() %>! (You can
sign out.)
<%
} else {
%>
Sign in
<%
}
UserDao dao = new UserDao();
//dao.createUser(user.getUserId(), user.getNickname(),
user.getEmail()); this one works creates new users in the database
dao.showUserData(); //this gives me error
%>
  


-- 
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: failure in simple JDO query

2010-10-08 Thread x_maras
hmm...
I did through eclipse...

On Oct 8, 3:11 am, Arnold  wrote:
> May be try restarting the development mode server.
>
> On Oct 7, 8:42 pm, x_maras  wrote:
>
>
>
> > Hi,
>
> > I was trying to do some simple JDO queries in order to find my way in
> > java google app engine.
> > I have an persistent object where I store information about users,
> > called UserData
> > I also have made a class DAO where I have methods for creating new
> > users for checking if a user exist and to show data for users.
> > I created 2 records successfully but I can't read them.
> > The error that I get is
> > HTTP ERROR 500
>
> > Problem accessing /. Reason:
>
> >     com.awt.oat.dao.UserDao.showUserData()V
> > Caused by:
>
> > java.lang.NoSuchMethodError: com.awt.oat.dao.UserDao.showUserData()V
> >         at org.apache.jsp.auction_jsp._jspService(auction_jsp.java:89)
> >         at 
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> > 
> >  and a lot more
> > 
>
> > I'm sure that I 'm doing something really stupid. Please someone to
> > help me...
>
> > Here is my DAO class code:
>
> > package com.awt.oat.dao;
>
> > import javax.jdo.PersistenceManager;
> > import com.awt.oat.PMF;
> > import com.awt.oat.model.UserData;
> > import com.google.appengine.api.users.User;
> > import javax.jdo.Query;
> > import java.util.List;
> > import java.util.Date;
> > import javax.jdo.JDOObjectNotFoundException;
>
> > public class UserDao {
> >         public void createUser(String uniqueID, String userName, String 
> > email)
> > {
> >                 Date date = new Date();
> >                 UserData newUser = new UserData(uniqueID, userName, email, 
> > date);
>
> >                 PersistenceManager pm = PMF.get().getPersistenceManager();
> >         try {
> >             pm.makePersistent(newUser);
> >         }finally {
> >             pm.close();
> >         }
> >         }
>
> >         public void showUserData(){
>
> >                 PersistenceManager pm = PMF.get().getPersistenceManager();
> >                 Query query = pm.newQuery(UserData.class);
>
> >             try{
> >                 List results = (List)query.execute();
>
> >                 if (results.iterator().hasNext()) {
> >                         for(UserData u : results){
> >                                 System.out.println("" +
> >                                                 "username" 
> > + u.getUserName() + ""
> >                                                 + "email" 
> > + u.getEmail() + " > table>");
> >                         }
> >                 } else {
> >                         System.out.printf("No results in the 
> > datastore");
> >                 }
> >             }finally{
> >                 query.closeAll();
> >             }
> >         }
>
> > }
>
> > and here my jsp file
>
> > <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> > <%@ page import="java.util.List" %>
> > <%@ page import="javax.jdo.PersistenceManager" %>
> > <%@ page import="com.google.appengine.api.users.User" %>
> > <%@ page import="com.google.appengine.api.users.UserService" %>
> > <%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
> > <%@ page import="com.awt.oat.dao.UserDao" %>
> > <%@ page import="java.io.*" %>
>
> > 
> >   
> >     
> >   
> >   
> > <%
> >     UserService userService = UserServiceFactory.getUserService();
> >     User user = userService.getCurrentUser();
> >     if (user != null) {
> > %>
> > Hello, <%= user.getNickname() %>! (You can
> > sign out.)
> > <%
> >     } else {
> > %>
> > Sign in
> > <%
> >     }
> >         UserDao dao = new UserDao();
> >         //dao.createUser(user.getUserId(), user.getNickname(),
> > user.getEmail()); this one works creates new users in the database
> >         dao.showUserData(); //this gives me error
> > %>
> >   
> > 

-- 
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, Java, JSP, JSON, AJAX, Web Page. Is it going to work?

2010-10-08 Thread x_maras
Dear Stevko,

First of all, thank you for your answer.
Could you help me a little bit with fundamentals of this?
I am using eclipse to create my google app engine structure.
I know html, javascript, ajax. I have also learned google datastore
and I m not that bad in java... I have read JSON
But I'm missing some connection between them.
I found about json rpc - java but I don't know how to use it in google
app engine...

Kind regards,

Dinos

On Oct 7, 2:11 am, andy stevko  wrote:
> Hi  x_maras,
>
> re: using email as a primary 
> keyhttp://code.google.com/appengine/docs/java/users/overview.html
> The User object exposes a unique user ID that is guaranteed to be stable for
> the lifetime of the user's account, even if the email address is changed.
> You can use this value in a datastore entity key or property value.
>
> re: Datastore, Java, JSP, JSON, AJAX, Web Page
> Writing a RESTful service that can respond to AJAX requests with JSON
> payloads is very much a mainstream way to do things on app-engine.
> Be careful to keep the processing response times really short. The max
> response time is 30 seconds, the sweet spot is to average about 1 second
> response time.
>
> Happy Coding,
> --Stevko
>
>
>
> On Wed, Oct 6, 2010 at 4:34 PM, x_maras  wrote:
> > Hi,
>
> > I am new to GAE and I want to make a web application page on it.
> > I was used to work with PHP for web applications but lately I am
> > struggling to get in the thinking of a GAE web application.
>
> > After reading tutorials and trying to do different things I came up
> > with a thinking how I want my project to be and how to make the
> > communication through the different layers. I will explain you my
> > thinking and I would like to tell me if am I in the right way and if I
> > am not I would like someone to put back into it.
>
> > e.g.
>
> > I thought to have a user @persistent class for storing the information
> > of a user, such as name, email(as a primary key), registration date
> > etc... (I will use the User class for logging in, but I want to keep
> > some data also for every user)
>
> > Then I need to create a java (dao) class that reads and inserts data
> > to the datastore "tables-objects". I thought to create a different one
> > for each @persistent class
>
> > Then Java files that execute the  functions from the DAO classes and
> > give information to the jsp files which through JSON give information
> > to the Ajax functions in the HTML page (which I was thinking also to
> > be the welcome-file in my web.xml)
>
> > So here comes the questions. Is something like this right? Is it going
> > to work? And if not what do you propose me to do.
>
> > Any links or examples are very very welcome.
>
> > --
> > 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 > 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.