pfc-prolog-cvs Mailing List for pfc-prolix (Page 8)
Status: Beta
Brought to you by:
ivanfrade
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(77) |
Jun
(37) |
Jul
(152) |
Aug
(180) |
Sep
(45) |
Oct
|
Nov
|
Dec
|
---|
From: <iva...@us...> - 2003-08-14 23:03:08
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/beans In directory sc8-pr-cvs1:/tmp/cvs-serv21270 Added Files: LibraryBean.java LoginBean.java Log Message: Added beans to login information and library --- NEW FILE: LibraryBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.beans; import java.util.Collection; public class LibraryBean implements java.io.Serializable { private Collection programs; /** * Get the Programs value. * @return the Programs value. */ public Collection getPrograms() { return programs; } /** * Set the Programs value. * @param newPrograms The new Programs value. */ public void setPrograms(Collection newPrograms) { this.programs = newPrograms; } } --- NEW FILE: LoginBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.beans; public class LoginBean implements java.io.Serializable { private String loggedUser; private String permissions; /** * Get the Permissions value. * @return the Permissions value. */ public String getPermissions() { return permissions; } /** * Set the Permissions value. * @param newPermissions The new Permissions value. */ public void setPermissions(String newPermissions) { this.permissions = newPermissions; } /** * Get the LoggedUser value. * @return the LoggedUser value. */ public String getLoggedUser() { return loggedUser; } /** * Set the LoggedUser value. * @param newLoggedUser The new LoggedUser value. */ public void setLoggedUser(String newLoggedUser) { this.loggedUser = newLoggedUser; } public void reset() { loggedUser = ""; permissions = ""; } } |
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/interpreter/interfaces In directory sc8-pr-cvs1:/tmp/cvs-serv23988 Modified Files: PrologContext.java PrologInterpreter.java Substitution.java TreeElement.java Log Message: Fixed imports - now import only concrete classes Index: PrologContext.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/interpreter/interfaces/PrologContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrologContext.java 21 May 2003 10:40:09 -0000 1.3 --- PrologContext.java 14 Aug 2003 22:47:41 -0000 1.4 *************** *** 22,27 **** package org.asturlinux.frade.prolix.interpreter.interfaces; ! import org.asturlinux.frade.prolix.interpreter.exceptions.*; ! public interface PrologContext --- 22,30 ---- package org.asturlinux.frade.prolix.interpreter.interfaces; ! import org.asturlinux.frade.prolix.interpreter.exceptions.SyntaxException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.LexicalException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.ProgramAlreadyLoadedException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.ProgramNotLoadedException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.QueryNotLoadedException; public interface PrologContext Index: PrologInterpreter.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/interpreter/interfaces/PrologInterpreter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrologInterpreter.java 21 May 2003 10:40:10 -0000 1.3 --- PrologInterpreter.java 14 Aug 2003 22:47:41 -0000 1.4 *************** *** 21,25 **** **/ package org.asturlinux.frade.prolix.interpreter.interfaces; ! import org.asturlinux.frade.prolix.interpreter.exceptions.*; public interface PrologInterpreter --- 21,26 ---- **/ package org.asturlinux.frade.prolix.interpreter.interfaces; ! ! import org.asturlinux.frade.prolix.interpreter.exceptions.CreateException; public interface PrologInterpreter Index: Substitution.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/interpreter/interfaces/Substitution.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Substitution.java 21 May 2003 10:40:10 -0000 1.3 --- Substitution.java 14 Aug 2003 22:47:41 -0000 1.4 *************** *** 21,25 **** **/ package org.asturlinux.frade.prolix.interpreter.interfaces; ! import org.asturlinux.frade.prolix.interpreter.exceptions.*; public interface Substitution --- 21,25 ---- **/ package org.asturlinux.frade.prolix.interpreter.interfaces; ! public interface Substitution Index: TreeElement.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/interpreter/interfaces/TreeElement.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TreeElement.java 23 Jun 2003 17:15:00 -0000 1.5 --- TreeElement.java 14 Aug 2003 22:47:41 -0000 1.6 *************** *** 21,25 **** **/ package org.asturlinux.frade.prolix.interpreter.interfaces; - import org.asturlinux.frade.prolix.interpreter.exceptions.*; public interface TreeElement --- 21,24 ---- |
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb In directory sc8-pr-cvs1:/tmp/cvs-serv23214 Modified Files: StudentRoleBean.java TransformationControl.java TreeTraversors.java Added Files: AccessControlBean.java LibraryManagementBean.java Log Message: Added AccessContro and Library Management beans --- NEW FILE: AccessControlBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import org.asturlinux.frade.prolix.exceptions.NotEnoughtPermissionsException; import org.asturlinux.frade.prolix.exceptions.NoLoggedUserException; import org.asturlinux.frade.prolix.exceptions.FailedLoginException; import org.asturlinux.frade.prolix.exceptions.UsernameNotAvailableException; import org.asturlinux.frade.prolix.ejb.interfaces.UserLocalHome; import org.asturlinux.frade.prolix.ejb.interfaces.StudentRoleHome; import org.asturlinux.frade.prolix.ejb.interfaces.UserValue; import org.asturlinux.frade.prolix.ejb.interfaces.UserLocal; import org.asturlinux.frade.prolix.ejb.interfaces.StudentRole; import org.asturlinux.frade.prolix.ejb.interfaces.LibraryManagement; import org.asturlinux.frade.prolix.ejb.interfaces.LibraryManagementHome; import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; import javax.ejb.SessionBean; import javax.ejb.FinderException; import javax.naming.NamingException; import javax.ejb.EJBException; import javax.naming.InitialContext; import javax.ejb.SessionContext; import javax.ejb.CreateException; import java.rmi.RemoteException; /** * Iteration 1: This bean manages communication between JSP <-> interpreter * * * @ejb.bean name="ejb/AccessControl" * type="Stateful" * view-type="remote" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" * * @ejb.ejb-ref ejb-name="ejb/AccessControl" * view-type="remote" * ref-name="ejb/AccessControl" * @web.ejb-ref * description="Refactorized Prolix Main EJB" * name="AccessControl" * type="Session" * home="org.asturlinux.frade.prolix.ejb.sessionjb.AccessControlHome" * remote="org.asturlinux.frade.prolix.ejb.sessionjb.AccessControl" * * @jboss.ejb-ref-jndi ref-name="AccessControl" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" * **/ public abstract class AccessControlBean implements SessionBean { /** * Login / logout methods */ private UserLocal loggedUser = null; /** * @ejb.interface-method **/ public void login(String name, String pass) throws FailedLoginException { try { if (name.equals("admin")) ensureAdminUserCreated(); if (loggedUser != null) throw new FailedLoginException(); loggedUser = obtainUserHome().findByUserAndPass(name,pass); } catch (FinderException fe) { throw new FailedLoginException(); } catch (NamingException ne) { throw new FailedLoginException(); } catch (CreateException ce) { throw new FailedLoginException(); } } /** * @ejb.interface-method **/ public void logout() throws NoLoggedUserException { if (loggedUser == null) throw new NoLoggedUserException(); else loggedUser = null; } /** * @ejb.interface-method **/ public void signup(String username, String password) throws NamingException, javax.ejb.CreateException, UsernameNotAvailableException { createUser(username,password,Permissions.Student); try { login(username,password); } catch (FailedLoginException fe) { throw new EJBException("Cannot login before create user correctly!!!"); } } /** * @ejb.interface-method */ public void createProfessor(String username,String password) throws NamingException, javax.ejb.CreateException, UsernameNotAvailableException, NotEnoughtPermissionsException, NoLoggedUserException { verifyPermissions(Permissions.Administrator); createUser(username,password, Permissions.Professor + "," + Permissions.Student); } private void createUser(String username, String password, String rights) throws NamingException, javax.ejb.CreateException, UsernameNotAvailableException { if (username.equals("admin")) throw new UsernameNotAvailableException(); UserValue signmeup = new UserValue(); signmeup.setUser(username); signmeup.setPassword(password); signmeup.setPermissions(rights); try { UserLocal ul = obtainUserHome().findByUser(username); throw new UsernameNotAvailableException(); } catch (FinderException fe) { } obtainUserHome().create(signmeup); } private void ensureAdminUserCreated() throws NamingException, CreateException { try { UserLocal ul = obtainUserHome().findByUser("admin"); } catch (FinderException fe) { UserValue uv = new UserValue(); uv.setUser("admin"); uv.setPassword("admin"); uv.setPermissions(Permissions.Administrator + "," + Permissions.Professor + ","+ Permissions.Student); obtainUserHome().create(uv); } } /** * @ejb.interface-method */ public void changePassword(String newPasswd) throws NoLoggedUserException { if (loggedUser == null) throw new NoLoggedUserException(); loggedUser.setPassword(newPasswd); } /** * Private method to retrieve other bean factory */ private UserLocalHome obtainUserHome() throws NamingException { InitialContext ctx = new InitialContext(); UserLocalHome home = (UserLocalHome)ctx.lookup(UserLocalHome.JNDI_NAME); return home; } private StudentRoleHome obtainStudentRoleHome() throws NamingException { InitialContext ctx = new InitialContext(); StudentRoleHome home = (StudentRoleHome)ctx.lookup(StudentRoleHome.JNDI_NAME); return home; } private LibraryManagementHome obtainLibraryManagementHome() throws NamingException { InitialContext ctx = new InitialContext(); LibraryManagementHome home = (LibraryManagementHome)ctx.lookup(LibraryManagementHome.JNDI_NAME); return home; } /** * @ejb.interface-method **/ public void verifyPermissions(String required) throws NoLoggedUserException, NotEnoughtPermissionsException { if (loggedUser == null) { throw new NoLoggedUserException(); } if ( loggedUser.getPermissions().indexOf(required) == -1 ) throw new NotEnoughtPermissionsException(); } /** * Interaction with other session Beans * * http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Session3.html#63667 * */ private SessionContext context = null; public void setSessionContext(SessionContext ctx) { this.context = ctx; } private StudentRole studentUseCase = null; /** * @ejb.interface-method **/ public StudentRole getStudentRole() { try { if (studentUseCase == null) { studentUseCase = obtainStudentRoleHome().create(); studentUseCase.setAccessControl(context.getEJBObject()); } } catch (NamingException namingException) { throw new EJBException("Maaaal naming"); // FIXME } catch (CreateException createException) { throw new EJBException("Maaaal create"); // FIXME } catch (RemoteException e) { throw new EJBException("Maaaal remote"); // FIXME } return studentUseCase; } private LibraryManagement library = null; /** * @ejb.interface-method **/ public LibraryManagement getLibraryManagement() { try { if (library == null) { library = obtainLibraryManagementHome().create(); library.setAccessControl(context.getEJBObject()); } } catch (NamingException namingException) { throw new EJBException("Maaaal naming"); // FIXME } catch (CreateException createException) { throw new EJBException("Maaaal create"); // FIXME } catch (RemoteException e) { throw new EJBException("Maaaal remote"); // FIXME } return library; } public void ejbCreate() throws javax.ejb.CreateException { System.out.println( "AccessControlBean.ejbCreate()" ); } /** * @ejb.interface-method */ public UserLocal getLoggedUser() throws NoLoggedUserException { if (loggedUser == null) throw new NoLoggedUserException(); else return loggedUser; } /** * @ejb.interface-method */ public String getLoggedUserPermissions() throws NoLoggedUserException { if (loggedUser == null) throw new NoLoggedUserException(); else return loggedUser.getPermissions(); } } --- NEW FILE: LibraryManagementBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import javax.ejb.SessionBean; import org.asturlinux.frade.prolix.exceptions.NoLoggedUserException; import org.asturlinux.frade.prolix.exceptions.NotEnoughtPermissionsException; import org.asturlinux.frade.prolix.exceptions.CouldNotStoreProgramException; import org.asturlinux.frade.prolix.exceptions.CouldNotRetrieveProgramsException; import org.asturlinux.frade.prolix.exceptions.CouldNotRemoveProgramException; import org.asturlinux.frade.prolix.ejb.interfaces.AccessControl; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramValue; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramLocal; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramLocalHome; import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.ejb.CreateException; import java.rmi.RemoteException; import java.util.Collection; import javax.ejb.FinderException; import java.util.Iterator; import java.util.LinkedList; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramPK; import javax.ejb.RemoveException; /** * * @ejb.bean name="ejb/LibraryManagement" * type="Stateful" * view-type="remote" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/LibraryManagement" * * @ejb.ejb-ref ejb-name="ejb/LibraryManagement" * view-type="remote" * ref-name="ejb/LibraryManagement" * @web.ejb-ref * description="Refactorized Prolix Main EJB" * name="LibraryManagement" * type="Session" * home="org.asturlinux.frade.prolix.ejb.sessionjb.LibraryManagementHome" * remote="org.asturlinux.frade.prolix.ejb.sessionjb.LibraryManagement" * * @jboss.ejb-ref-jndi ref-name="LibraryManagement" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/LibraryManagement" * **/ public abstract class LibraryManagementBean implements SessionBean { private AccessControl login = null; /** * @ejb.create-method */ public void ejbCreate() throws javax.ejb.CreateException { System.out.println( "LibraryManagementBean.ejbCreate()" ); } /** * @ejb.interface-method */ public void setAccessControl(javax.ejb.EJBObject loginBean) { login = (AccessControl)loginBean; } /** * @ejb.interface-method */ public void addProgram(String title, String program, String comment) throws NotEnoughtPermissionsException, NoLoggedUserException, CouldNotStoreProgramException { try { //FIXME: check that login is not null (not required // if set it in postCreate method) login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new CouldNotStoreProgramException(); } ProgramValue pv = new ProgramValue(); pv.setTitle(title); pv.setSource(program); pv.setDescription(comment); try { ProgramLocal p = obtainProgramHome().create(pv,login.getLoggedUser()); } catch (NamingException ne) { throw new CouldNotStoreProgramException(); } catch (CreateException ce) { throw new CouldNotStoreProgramException(); } catch (RemoteException re) { throw new CouldNotStoreProgramException(); } } /** * @ejb.interface-method */ public Collection retrieveAllPrograms() throws NoLoggedUserException,NotEnoughtPermissionsException, CouldNotRetrieveProgramsException { try { //FIXME: check that login is not null (not required if // set it in postCreate() method) login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new CouldNotRetrieveProgramsException(); } Collection library = null; try { library = obtainProgramHome().findByAll(); System.out.println("LibraryManagement Bean: library contain programs"); } catch (FinderException fe) { throw new CouldNotRetrieveProgramsException(); } catch (CreateException ce) { throw new CouldNotRetrieveProgramsException(); } catch (NamingException ne) { throw new CouldNotRetrieveProgramsException(); } // Remote Collection resultToClient = new LinkedList(); Iterator iteratorBeans = library.iterator(); while (iteratorBeans.hasNext()) { ProgramLocal pl = (ProgramLocal)iteratorBeans.next(); resultToClient.add(pl.getProgramValue()); } return resultToClient; } /** * @ejb.interface-method */ public ProgramValue retrieveProgramByTitle(String title) throws CouldNotRetrieveProgramsException { //FIXME !!!CHECK PERMISSIONS!!! try { ProgramLocal p = obtainProgramHome().findByPK(title); ProgramValue result = p.getProgramValue(); return result; } catch (FinderException fe) { throw new CouldNotRetrieveProgramsException(); } catch (CreateException ce) { throw new CouldNotRetrieveProgramsException(); } catch (NamingException re) { throw new CouldNotRetrieveProgramsException(); } } /** * @ejb.interface-method */ public Collection retrieveUserPrograms() throws CouldNotRetrieveProgramsException, NoLoggedUserException { String userOnline; try { userOnline = login.getLoggedUser().getUser(); } catch (RemoteException re) { throw new CouldNotRetrieveProgramsException(); } Collection myPrograms; try { myPrograms= obtainProgramHome().findByUser(userOnline); } catch (FinderException fe) { return new LinkedList(); } catch (CreateException ce) { throw new CouldNotRetrieveProgramsException(); } catch (NamingException ne) { throw new CouldNotRetrieveProgramsException(); } Collection result = new LinkedList(); Iterator i = myPrograms.iterator(); while (i.hasNext()) { ProgramLocal p = (ProgramLocal)i.next(); ProgramValue pv = p.getProgramValue(); result.add(pv); } return result; } /** * @ejb.interface-method */ public void removeProgram(String programKey) throws CouldNotRemoveProgramException, NoLoggedUserException, NotEnoughtPermissionsException { try { //FIXME: check that login is not null (not required // if set it in postCreate method) login.verifyPermissions(Permissions.Student); obtainProgramHome().remove(new ProgramPK(programKey)); } catch (CreateException ne) { throw new CouldNotRemoveProgramException(); } catch (NamingException ne) { throw new CouldNotRemoveProgramException(); } catch (RemoveException re) { throw new CouldNotRemoveProgramException(); } catch (RemoteException re) { throw new CouldNotRemoveProgramException(); } } private ProgramLocalHome obtainProgramHome() throws CreateException, NamingException { InitialContext ctx = new InitialContext(); ProgramLocalHome home; home = (ProgramLocalHome)ctx.lookup(ProgramLocalHome.JNDI_NAME); return home; } } Index: StudentRoleBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/StudentRoleBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StudentRoleBean.java 7 Aug 2003 12:03:06 -0000 1.2 --- StudentRoleBean.java 14 Aug 2003 22:42:46 -0000 1.3 *************** *** 23,40 **** package org.asturlinux.frade.prolix.ejb.sessionjb; - import java.rmi.*; - import javax.naming.*; - import javax.ejb.*; - import java.util.*; import java.io.StringWriter; import java.io.Writer; - import org.asturlinux.frade.dummy.*; - import org.asturlinux.frade.prolix.interpreter.exceptions.*; - import org.asturlinux.frade.prolix.interpreter.interfaces.*; - import org.asturlinux.frade.prolix.exceptions.*; - //import org.asturlinux.frade.prolix.ejb.interfaces.UserLocalHome; - //import org.asturlinux.frade.prolix.ejb.interfaces.UserLocal; import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; ! import org.asturlinux.frade.prolix.ejb.interfaces.*; /** * --- 23,43 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; import java.io.StringWriter; import java.io.Writer; import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; ! import javax.ejb.SessionBean; ! import org.asturlinux.frade.dummy.PrologContextDummy; ! import org.asturlinux.frade.dummy.PrologInterpreterDummy; ! import java.rmi.RemoteException; ! import javax.ejb.EJBException; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; ! import org.asturlinux.frade.prolix.exceptions.NotEnoughtPermissionsException; ! import org.asturlinux.frade.prolix.ejb.interfaces.AccessControl; ! import org.asturlinux.frade.prolix.interpreter.exceptions.LexicalException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.SyntaxException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.QueryNotLoadedException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.ProgramNotLoadedException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.ProgramAlreadyLoadedException; ! import org.asturlinux.frade.prolix.exceptions.NoLoggedUserException; /** * *************** *** 67,71 **** private PrologContextDummy prologCtx; ! private CommonUseCase login = null; private boolean lastSolution = false; --- 70,74 ---- private PrologContextDummy prologCtx; ! private AccessControl login = null; private boolean lastSolution = false; *************** *** 75,79 **** public void loadProgram(String program) throws LexicalException, SyntaxException, ! NotEnoughtPermissionsException { try --- 78,82 ---- public void loadProgram(String program) throws LexicalException, SyntaxException, ! NotEnoughtPermissionsException, NoLoggedUserException { try *************** *** 128,132 **** public void loadConsult(String consult) throws LexicalException, SyntaxException, ! ProgramNotLoadedException, NotEnoughtPermissionsException { --- 131,136 ---- public void loadConsult(String consult) throws LexicalException, SyntaxException, ! ProgramNotLoadedException, NotEnoughtPermissionsException, ! NoLoggedUserException { *************** *** 164,168 **** public String nextSolution() throws ProgramNotLoadedException, QueryNotLoadedException, ! NotEnoughtPermissionsException { try --- 168,172 ---- public String nextSolution() throws ProgramNotLoadedException, QueryNotLoadedException, ! NotEnoughtPermissionsException, NoLoggedUserException { try *************** *** 197,201 **** public String step() throws ProgramNotLoadedException, QueryNotLoadedException, ! NotEnoughtPermissionsException { try --- 201,205 ---- public String step() throws ProgramNotLoadedException, QueryNotLoadedException, ! NotEnoughtPermissionsException, NoLoggedUserException { try *************** *** 244,248 **** * @ejb.create-method **/ ! // public void ejbCreate(CommonUseCaseBean common) public void ejbCreate() throws javax.ejb.CreateException --- 248,252 ---- * @ejb.create-method **/ ! // public void ejbCreate(AccessControlBean common) public void ejbCreate() throws javax.ejb.CreateException *************** *** 255,261 **** * @ejb.interface-method */ ! public void setCommonUseCase(javax.ejb.EJBObject commonUse) { ! login = (CommonUseCase)commonUse; } --- 259,265 ---- * @ejb.interface-method */ ! public void setAccessControl(javax.ejb.EJBObject accessc) { ! login = (AccessControl)accessc; } Index: TransformationControl.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/TransformationControl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TransformationControl.java 5 Aug 2003 19:17:06 -0000 1.1 --- TransformationControl.java 14 Aug 2003 22:42:46 -0000 1.2 *************** *** 22,30 **** package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.dummy.*; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; ! import org.asturlinux.frade.prolix.interpreter.interfaces.*; public class TransformationControl --- 22,31 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; ! import java.io.IOException; import java.io.StringWriter; import java.io.Writer; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; ! public class TransformationControl Index: TreeTraversors.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/TreeTraversors.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TreeTraversors.java 5 Aug 2003 19:17:06 -0000 1.1 --- TreeTraversors.java 14 Aug 2003 22:42:46 -0000 1.2 *************** *** 22,27 **** package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.dummy.*; ! import org.asturlinux.frade.prolix.interpreter.interfaces.*; public class TreeTraversors --- 22,30 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; ! ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElementVisitor; ! ! public class TreeTraversors *************** *** 34,37 **** --- 37,41 ---- // FIXME: Could be better not use recursivity + TreeElement[] sons = tree.getNextLevelElements(); |
From: <iva...@us...> - 2003-08-14 22:47:39
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb In directory sc8-pr-cvs1:/tmp/cvs-serv22732 Modified Files: UserBean.java Added Files: ProgramBean.java Log Message: Added new entity to programs --- NEW FILE: ProgramBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.entityjb; import javax.ejb.EntityBean; import javax.ejb.CreateException; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramValue; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramShortValue; import org.asturlinux.frade.prolix.ejb.interfaces.ProgramPK; import org.asturlinux.frade.prolix.ejb.interfaces.UserLocal; import org.asturlinux.frade.prolix.ejb.interfaces.UserValue; import java.util.Collection; import java.util.LinkedList; import java.lang.String; /** * Entity bean to programs * * @ejb.bean name="Program" * type="CMP" * local-jndi-name="org/asturlinux/frade/prolix/ejb/entityjb/ProgramLocal" * view-type="local" * * * @ejb.value-object name="Program" * match="*" * * @ejb.value-object name="ProgramShort" * match="short" * * @ejb.finder signature="java.util.Collection findByAll()" * unchecked="true" * query="SELECT OBJECT(p) FROM Program p" * * @ejb.finder signature="java.util.ProgramLocal findByPK(java.lang.String p)" * unchecked="true" * query="SELECT OBJECT(p) FROM Program p WHERE p.title = ?1" * * @ejb.finder signature="java.util.Collection findByUser(java.lang.String u)" * unchecked="true" * query="SELECT OBJECT(p) FROM Program p WHERE p.user.user = ?1" */ public abstract class ProgramBean implements EntityBean { /** * @ejb.create-method */ public ProgramPK ejbCreate(ProgramValue pv, UserLocal us) throws CreateException { setTitle(pv.getTitle()); setSource(pv.getSource()); setDescription(pv.getDescription()); return new ProgramPK(getTitle()); } public void ejbPostCreate(ProgramValue pv, UserLocal us) { setUser(us); } /************************ * Attribute methods ************************ */ /** * @ejb.pk-field * @ejb.persistent-field * @ejb.interface-method * * @jboss.jdbc-type VARCHAR * @jboss.sql-type VARCHAR(50) * * @ejb.value-object match="short" */ public abstract java.lang.String getTitle(); /** * @ejb.interface-method */ public abstract void setTitle(java.lang.String newtitle); /** * @ejb.persistent-field * @ejb.interface-method * * @jboss.jdbc-type BLOB * @jboss.sql-type BLOB * */ public abstract java.lang.String getSource(); /** * @ejb.interface-method */ public abstract void setSource(java.lang.String code); /** * @ejb.persistent-field * @ejb.interface-method * * @jboss.jdbc-type BLOB * @jboss.sql-type BLOB * * @ejb.value-object match="short" */ public abstract java.lang.String getDescription(); /** * @ejb.interface-method */ public abstract void setDescription(java.lang.String author); /** *********************** * Value methods ************************* */ /** * @ejb.interface-method */ public abstract ProgramValue getProgramValue(); public abstract void setProgramValue(ProgramValue value); /** * @ejb.interface-method */ public abstract ProgramShortValue getProgramShortValue(); public abstract void setProgramShortValue(ProgramShortValue value); /** * @ejb.value-object * aggregate="org.asturlinux.frade.prolix.ejb.interfaces.UserValue" * aggregate-name="User" * * @ejb.relation name="owns" * role-name="program_writen_by" * @jboss.relation related-pk-field="user" * fk-column="user" * * @ejb.interface-method */ public abstract UserLocal getUser(); /** * @ejb.interface-method */ public abstract void setUser(UserLocal c); } Index: UserBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb/UserBean.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UserBean.java 3 Aug 2003 21:35:32 -0000 1.4 --- UserBean.java 14 Aug 2003 22:39:46 -0000 1.5 *************** *** 22,27 **** package org.asturlinux.frade.prolix.ejb.entityjb; ! import javax.ejb.*; import org.asturlinux.frade.prolix.ejb.interfaces.UserPK; /** --- 22,29 ---- package org.asturlinux.frade.prolix.ejb.entityjb; ! import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; import org.asturlinux.frade.prolix.ejb.interfaces.UserPK; + import javax.ejb.EntityBean; + import javax.ejb.CreateException; /** *************** *** 34,45 **** * * ! * @ejb.value-object name="User" * match="*" * * @ejb.finder signature="org.asturlinux.frade.prolix.ejb.interfaces.UserLocal ! * findByLogin(java.lang.String idUser, java.lang.String pass)" * unchecked="true" * query="SELECT OBJECT(p) FROM User p ! * WHERE (p.user = ?1 AND p.pass = ?2)" * */ --- 36,54 ---- * * ! * @ejb.value-object name="User" * match="*" * * @ejb.finder signature="org.asturlinux.frade.prolix.ejb.interfaces.UserLocal ! * findByUserAndPass(java.lang.String idUser, ! * java.lang.String pass)" * unchecked="true" * query="SELECT OBJECT(p) FROM User p ! * WHERE (p.user = ?1 AND p.password = ?2)" ! * ! * @ejb.finder signature="org.asturlinux.frade.prolix.ejb.interfaces.UserLocal ! * findByUser(java.lang.String idUser)" ! * unchecked="true" ! * query="SELECT OBJECT(p) FROM User p ! * WHERE (p.user = ?1)" * */ *************** *** 58,62 **** public abstract String getUser(); - // setter not interfaz method public abstract void setUser(String idUser); --- 67,70 ---- *************** *** 69,75 **** * */ ! public abstract String getPass(); ! public abstract void setPass(String newPass); --- 77,86 ---- * */ ! public abstract String getPassword(); ! /** ! * @ejb.interface-method ! */ ! public abstract void setPassword(String newPass); *************** *** 88,99 **** /** ! * ??????? */ public UserPK ejbCreate(org.asturlinux.frade.prolix.ejb.interfaces.UserValue uv) throws CreateException { ! //setPass(uv.getPass()); ! //setUserValue(uv); ! return null; } --- 99,113 ---- /** ! * @ejb.create-method */ public UserPK ejbCreate(org.asturlinux.frade.prolix.ejb.interfaces.UserValue uv) throws CreateException { ! setPassword(uv.getPassword()); ! setUser(uv.getUser()); ! setPermissions(uv.getPermissions()); ! setUserValue(uv); ! System.out.println("Added user " + uv.getUser()); ! return new UserPK(getUser()); } *************** *** 101,109 **** { } ! public abstract org.asturlinux.frade.prolix.ejb.interfaces.UserValue getUserValue(); public abstract void setUserValue(org.asturlinux.frade.prolix.ejb.interfaces.UserValue value); } --- 115,145 ---- { } ! ! ! /** ! * @ejb.interface-method ! */ public abstract org.asturlinux.frade.prolix.ejb.interfaces.UserValue getUserValue(); public abstract void setUserValue(org.asturlinux.frade.prolix.ejb.interfaces.UserValue value); + + + /** + * @ejb.interface-method + * @ejb.relation name="owns" + * role-name="author_of" + */ + public abstract java.util.Collection getPrograms(); + + /** + * @ejb.interface-method + */ + public abstract void setPrograms(java.util.Collection programs); + + + // Dont required in 1:n relation + //* @jboss.relation related-pk-field="title" + //* fk-column="title" } |
From: <iva...@us...> - 2003-08-14 22:47:36
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans In directory sc8-pr-cvs1:/tmp/cvs-serv22305 Added Files: AddProgramFormBean.java ChangePasswordFormBean.java CreateProfessorFormBean.java LoadFromLibraryFormBean.java LoadMyProgramsFormBean.java ManageProgramsFormBean.java RegistryFormBean.java VisitLibraryFormBean.java Log Message: Added new formbeans - updated existent --- NEW FILE: AddProgramFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts.form name="addProgramForm" */ public class AddProgramFormBean extends ActionForm { private String title; private String description; /** * Gets the value of title * * @return the value of title */ public String getTitle() { return this.title; } /** * Sets the value of title * * @param argTitle Value to assign to this.title */ public void setTitle(String argTitle) { this.title = argTitle; } /** * Gets the value of description * * @return the value of description */ public String getDescription() { return this.description; } /** * Sets the value of description * * @param argDescription Value to assign to this.description */ public void setDescription(String argDescription) { this.description = argDescription; } public void reset(ActionMapping mapping, HttpServletRequest request) { } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((title == null) || (title.length() < 1)) errors.add("addprogram", new ActionError("error.void.title")); if ((description == null) || (description.length() < 1)) errors.add("addprogram", new ActionError("error.void.description")); return errors; } } --- NEW FILE: ChangePasswordFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts:form name="changePasswordForm" */ public class ChangePasswordFormBean extends ActionForm { private String newPassword; private String newPasswordConfirmation; /** * Get the NewPasswordConfirmation value. * @return the NewPasswordConfirmation value. */ public String getNewPasswordConfirmation() { return newPasswordConfirmation; } /** * Set the NewPasswordConfirmation value. * @param newNewPasswordConfirmation The new NewPasswordConfirmation value. */ public void setNewPasswordConfirmation(String newNewPasswordConfirmation) { this.newPasswordConfirmation = newNewPasswordConfirmation; } /** * Gets the value of password * * @return the value of password */ public String getNewPassword() { return this.newPassword; } /** * Sets the value of password * * @param argPassword Value to assign to this.password */ public void setNewPassword(String argPassword) { this.newPassword = argPassword; } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((newPassword == null) || (newPassword.length() < 1)) errors.add("change-password", new ActionError("error.void.passwd")); if ((newPasswordConfirmation == null) || (newPasswordConfirmation.length() < 1)) errors.add("change-password", new ActionError("error.void.passwd.confirmation")); if (! newPassword.equals(newPasswordConfirmation)) errors.add("change-password", new ActionError("error.passwd.mismatch")); return errors; } } --- NEW FILE: CreateProfessorFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts:form name="createProfessorForm" */ public class CreateProfessorFormBean extends ActionForm { private String username; private String password; private String passConfirmation; /** * Get the PassConfirmation value. * @return the PassConfirmation value. */ public String getPassConfirmation() { return passConfirmation; } /** * Set the PassConfirmation value. * @param newPassConfirmation The new PassConfirmation value. */ public void setPassConfirmation(String newPassConfirmation) { this.passConfirmation = newPassConfirmation; } /** * Gets the value of username * * @return the value of username */ public String getUsername() { return this.username; } /** * Sets the value of username * * @param argUsername Value to assign to this.username */ public void setUsername(String argUsername) { this.username = argUsername; } /** * Gets the value of password * * @return the value of password */ public String getPassword() { return this.password; } /** * Sets the value of password * * @param argPassword Value to assign to this.password */ public void setPassword(String argPassword) { this.password = argPassword; } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((username == null) || (username.length() < 1)) errors.add("registryProfessor", new ActionError("error.void.user")); if ((password == null) || (password.length() < 1)) errors.add("registryProfessor", new ActionError("error.void.passwd")); if ((passConfirmation == null) || (passConfirmation.length() < 1)) errors.add("registryProfessor", new ActionError("error.void.passwd.confirmation")); if (!passConfirmation.equals(password)) errors.add("registryProfessor", new ActionError("error.passwd.mismatch")); return errors; } } --- NEW FILE: LoadFromLibraryFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts.form name="loadFromLibraryForm" */ public class LoadFromLibraryFormBean extends ActionForm { private String programKey = null; /** * Gets the value of programKey * * @return the value of programKey */ public String getProgramKey() { return this.programKey; } /** * Sets the value of programKey * * @param argProgramKey Value to assign to this.programKey */ public void setProgramKey(String argProgramKey) { this.programKey = argProgramKey; } /** * Redefined methods */ public void reset(ActionMapping mapping, HttpServletRequest request) { programKey = null; } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); return errors; } } --- NEW FILE: LoadMyProgramsFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts.form name="loadMyProgramsForm" */ public class LoadMyProgramsFormBean extends ActionForm { /** * Redefined methods */ public void reset(ActionMapping mapping, HttpServletRequest request) { } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); return errors; } } --- NEW FILE: ManageProgramsFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts.form name="manageProgramsForm" */ public class ManageProgramsFormBean extends ActionForm { String actionToDo; /** * Get the ActionToDo value. * @return the ActionToDo value. */ public String getActionToDo() { return actionToDo; } /** * Set the ActionToDo value. * @param newActionToDo The new ActionToDo value. */ public void setActionToDo(String newActionToDo) { this.actionToDo = newActionToDo; } String programKey; /** * Get the ProgramKey value. * @return the ProgramKey value. */ public String getProgramKey() { return programKey; } /** * Set the ProgramKey value. * @param newProgramKey The new ProgramKey value. */ public void setProgramKey(String newProgramKey) { this.programKey = newProgramKey; } /** * Redefined methods */ public void reset(ActionMapping mapping, HttpServletRequest request) { programKey = null; actionToDo = null; } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((programKey == null) || (programKey.length() < 1)) errors.add("consult", new ActionError("error.program.key")); if ((actionToDo == null) || (actionToDo.length() < 1)) errors.add("consult", new ActionError("error.void.action")); return errors; } } --- NEW FILE: RegistryFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; /** * @struts:form name="registryForm" */ public class RegistryFormBean extends ActionForm { private String username; private String password; private String passConfirmation; /** * Get the PassConfirmation value. * @return the PassConfirmation value. */ public String getPassConfirmation() { return passConfirmation; } /** * Set the PassConfirmation value. * @param newPassConfirmation The new PassConfirmation value. */ public void setPassConfirmation(String newPassConfirmation) { this.passConfirmation = newPassConfirmation; } /** * Gets the value of username * * @return the value of username */ public String getUsername() { return this.username; } /** * Sets the value of username * * @param argUsername Value to assign to this.username */ public void setUsername(String argUsername) { this.username = argUsername; } /** * Gets the value of password * * @return the value of password */ public String getPassword() { return this.password; } /** * Sets the value of password * * @param argPassword Value to assign to this.password */ public void setPassword(String argPassword) { this.password = argPassword; } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((username == null) || (username.length() < 1)) errors.add("registry", new ActionError("error.void.user")); if ((password == null) || (password.length() < 1)) errors.add("registry", new ActionError("error.void.passwd")); if ((passConfirmation == null) || (passConfirmation.length() < 1)) errors.add("registry", new ActionError("error.void.passwd.confirmation")); if (!passConfirmation.equals(password)) errors.add("registry", new ActionError("error.passwd.mismatch")); return errors; } } --- NEW FILE: VisitLibraryFormBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.web.formbeans; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; /** * @struts.form name="visitLibraryForm" */ public class VisitLibraryFormBean extends ActionForm { /** * Redefined methods */ public void reset(ActionMapping mapping, HttpServletRequest request) { } public ActionErrors validate (ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); return errors; } } |
From: <iva...@us...> - 2003-08-14 22:23:26
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/servlets In directory sc8-pr-cvs1:/tmp/cvs-serv19468 Modified Files: SvgGenerator.java TreeServlet.java Log Message: Fixed null pointers - import only concrete classes Index: SvgGenerator.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/servlets/SvgGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SvgGenerator.java 1 Aug 2003 18:07:41 -0000 1.2 --- SvgGenerator.java 14 Aug 2003 22:15:36 -0000 1.3 *************** *** 8,12 **** import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; - import org.w3c.dom.*; import org.xml.sax.SAXException; import org.xml.sax.InputSource; --- 8,11 ---- *************** *** 17,21 **** --- 16,26 ---- import java.io.StringReader; import org.asturlinux.frade.prolix.web.servlets.NodeDrawData; + import org.w3c.dom.Document; + import org.w3c.dom.NodeList; + import org.w3c.dom.Node; + import org.w3c.dom.NamedNodeMap; + + //FIXME Can be passed xml String in constructor??? public class SvgGenerator { *************** *** 242,246 **** public String transform(String xmlString) { ! try { //FileReader xmlFile = new FileReader("/home/ivan/pfc/documentos/salida-prolix-treexml.xml"); --- 247,254 ---- public String transform(String xmlString) { ! ! if (xmlString == null) ! return null; ! try { //FileReader xmlFile = new FileReader("/home/ivan/pfc/documentos/salida-prolix-treexml.xml"); *************** *** 273,277 **** // parsing error return null; ! } catch (IOException e) { System.out.println("I/O Error: File Not Exist or Problems with Writers"); --- 281,285 ---- // parsing error return null; ! } //FIXME: Is necesary IOException here??? catch (IOException e) { System.out.println("I/O Error: File Not Exist or Problems with Writers"); Index: TreeServlet.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/servlets/TreeServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TreeServlet.java 2 Aug 2003 15:31:19 -0000 1.3 --- TreeServlet.java 14 Aug 2003 22:15:36 -0000 1.4 *************** *** 1,9 **** package org.asturlinux.frade.prolix.web.servlets; - import java.io.*; - import javax.servlet.*; - import javax.servlet.http.*; import org.asturlinux.frade.prolix.web.beans.CurrentStateBean; import org.asturlinux.frade.prolix.web.servlets.SvgGenerator; /** --- 1,13 ---- package org.asturlinux.frade.prolix.web.servlets; import org.asturlinux.frade.prolix.web.beans.CurrentStateBean; import org.asturlinux.frade.prolix.web.servlets.SvgGenerator; + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletResponse; + import javax.servlet.ServletException; + import java.io.IOException; + import javax.servlet.http.HttpSession; + import java.io.PrintWriter; + import javax.servlet.http.HttpServlet; /** *************** *** 26,31 **** PrintWriter out = response.getWriter(); SvgGenerator comeOn = new SvgGenerator(); ! //FIXME Current Result can be null ¿¿?? ! out.println(comeOn.transform(bean.getCurrentResult())); } --- 30,37 ---- PrintWriter out = response.getWriter(); SvgGenerator comeOn = new SvgGenerator(); ! if (bean.getCurrentResult() == null) ! out.println("You have only a query loaded. Try to do an step"); ! else ! out.println(comeOn.transform(bean.getCurrentResult())); } |
From: <iva...@us...> - 2003-08-14 22:20:39
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/consoleclient In directory sc8-pr-cvs1:/tmp/cvs-serv18531 Modified Files: ConsoleClient.java Interfaz.java Log Message: Updated console client to test some of new functionality Index: ConsoleClient.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/consoleclient/ConsoleClient.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ConsoleClient.java 6 Aug 2003 21:22:01 -0000 1.12 --- ConsoleClient.java 14 Aug 2003 22:07:14 -0000 1.13 *************** *** 22,35 **** package org.asturlinux.frade.prolix.consoleclient; ! import java.util.*; ! import java.rmi.*; ! import javax.naming.*; ! import javax.rmi.*; ! import java.io.*; ! import javax.ejb.*; ! import org.asturlinux.frade.prolix.ejb.interfaces.*; ! import org.asturlinux.frade.prolix.interpreter.exceptions.*; ! import org.asturlinux.frade.prolix.exceptions.*; ! /** * console-client of prolix interpreter --- 22,50 ---- package org.asturlinux.frade.prolix.consoleclient; ! import org.asturlinux.frade.prolix.ejb.interfaces.StudentRole; ! import org.asturlinux.frade.prolix.ejb.interfaces.LibraryManagement; ! import org.asturlinux.frade.prolix.ejb.interfaces.AccessControl; ! import org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome; ! import org.asturlinux.frade.prolix.interpreter.exceptions.QueryNotLoadedException; ! import org.asturlinux.frade.prolix.exceptions.NotEnoughtPermissionsException; ! import org.asturlinux.frade.prolix.exceptions.UsernameNotAvailableException; ! import org.asturlinux.frade.prolix.exceptions.NoLoggedUserException; ! import org.asturlinux.frade.prolix.exceptions.FailedLoginException; ! import org.asturlinux.frade.prolix.exceptions.CouldNotStoreProgramException; ! import javax.naming.InitialContext; ! import javax.naming.NamingException; ! import java.rmi.RemoteException; ! import java.io.BufferedReader; ! import org.asturlinux.frade.prolix.interpreter.exceptions.LexicalException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.SyntaxException; ! import java.io.IOException; ! import org.asturlinux.frade.prolix.interpreter.exceptions.ProgramNotLoadedException; ! import java.io.InputStreamReader; ! import java.util.Collection; ! import org.asturlinux.frade.prolix.exceptions.CouldNotRetrieveProgramsException; ! import java.util.Iterator; ! import org.asturlinux.frade.prolix.ejb.interfaces.ProgramValue; ! import org.asturlinux.frade.prolix.ejb.interfaces.ProgramShortValue; ! import org.asturlinux.frade.prolix.ejb.interfaces.UserValue; /** * console-client of prolix interpreter *************** *** 40,44 **** private StudentRole interpreter; ! private CommonUseCase login; public static void main(String args[]) { --- 55,59 ---- private StudentRole interpreter; ! private AccessControl login; public static void main(String args[]) { *************** *** 51,64 **** */ private void run() { ! try ! { ! // Obtain reference to home ! InitialContext ctx = new InitialContext(); ! CommonUseCaseHome home = (CommonUseCaseHome)ctx.lookup(CommonUseCaseHome.JNDI_NAME); ! // Create the interpreter bean ! login = home.create(); ! //login = CommonUseCaseUtil.getHome().create(); ! interpreter = login.getStudentRole(); ! } catch (NamingException ne) { --- 66,79 ---- */ private void run() { ! try { ! // Obtain reference to home ! InitialContext ctx = new InitialContext(); ! AccessControlHome home; ! home= (AccessControlHome)ctx.lookup(AccessControlHome.JNDI_NAME); ! // Create the interpreter bean ! login = home.create(); ! //login = AccessControlUtil.getHome().create(); ! interpreter = login.getStudentRole(); ! } catch (NamingException ne) { *************** *** 85,88 **** --- 100,109 ---- "NextSolution", "Logout", + "Sign up new user", + "Create professor", + "Change password", + "Add program to library", + "View programs in library", + "View my programs in library", "Exit"}; *************** *** 111,115 **** case 8: doLogout(); break; ! case 9: otherIteration = false; break; } --- 132,148 ---- case 8: doLogout(); break; ! case 9: signupNewUser(); ! break; ! case 10: signupProfessor(); ! break; ! case 11: changePassword(); ! break; ! case 12: addProgramToLibrary(); ! break; ! case 13: viewProgramsInLibrary(); ! break; ! case 14: viewMyProgramsInLibrary(); ! break; ! case 15: otherIteration = false; break; } *************** *** 136,142 **** try { ! //String input = new String(in.readLine()); ! System.out.println("now hardcoded program"); ! String input = new String("aosidfjoasidjf"); interpreter.loadProgram(input); } --- 169,173 ---- try { ! String input = new String(in.readLine()); interpreter.loadProgram(input); } *************** *** 158,161 **** --- 189,196 ---- System.out.println("Sorry, you don't have enought permissions"); } + catch (NoLoggedUserException notLogged) + { + System.out.println("You must login to execute this operation"); + } } *************** *** 206,209 **** --- 241,248 ---- System.out.println("Sorry, you don't have enought permissions"); } + catch (NoLoggedUserException notLogged) + { + System.out.println("You must login to execute this operation"); + } } *************** *** 247,250 **** --- 286,293 ---- System.out.println("Sorry, you don't have enought permissions"); } + catch (NoLoggedUserException notLogged) + { + System.out.println("You must login to execute this operation"); + } } *************** *** 273,276 **** --- 316,323 ---- System.out.println("Sorry, you don't have enought permissions"); } + catch (NoLoggedUserException notLogged) + { + System.out.println("You must login to execute this operation"); + } } *************** *** 312,314 **** --- 359,560 ---- } } + + private void signupNewUser() + { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + try { + System.out.println("Write your user name: "); + String id = new String(in.readLine()); + System.out.println("Write your password: "); + String pwd = new String(in.readLine()); + System.out.println("Repeat password: "); + String pwd2 = new String(in.readLine()); + try + { + if (pwd.equals(pwd2)) + login.signup(id,pwd); + else + System.out.println("Dont match 2 writed password"); + } + catch (javax.ejb.CreateException ce) + { + System.out.println("Error creating user"); + } + catch (NamingException ne) + { + System.out.println("Error naming exception"); + } + catch (UsernameNotAvailableException una) + { + System.out.println("Username already exist in system"); + } + } catch (IOException io) + { + System.out.println("IO error reading data"); + } + } + + private void signupProfessor() + { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + try { + System.out.println("Write your user name: "); + String id = new String(in.readLine()); + System.out.println("Write your password: "); + String pwd = new String(in.readLine()); + System.out.println("Repeat password: "); + String pwd2 = new String(in.readLine()); + try + { + if (pwd.equals(pwd2)) + login.createProfessor(id,pwd); + else + System.out.println("Dont match 2 writed password"); + } + catch (javax.ejb.CreateException ce) + { + System.out.println("Error creating user"); + } + catch (NamingException ne) + { + System.out.println("Error naming exception"); + } + catch (UsernameNotAvailableException una) + { + System.out.println("Username already exist in system"); + } + catch (NotEnoughtPermissionsException nep) + { + System.out.println("Only Administrator can use this operation"); + } + catch (NoLoggedUserException nlue) + { + System.out.println("You must login as admin to create professor"); + } + } catch (IOException io) + { + System.out.println("IO error reading data"); + } + } + + private void changePassword() + { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + try + { + System.out.println("Write your new password: "); + String newPass = new String(in.readLine()); + login.changePassword(newPass); + } + catch (IOException io) + { + System.out.println("IO error reading data"); + } + catch (NoLoggedUserException nlu) + { + System.out.println("You must login before change password"); + } + } + + private void addProgramToLibrary() + { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + + try + { + System.out.println("Title of your program: "); + String programTitle = new String(in.readLine()); + System.out.println("Code of program: "); + String programSource = new String(in.readLine()); + System.out.println("Short description of program: "); + String programDescription = new String(in.readLine()); + login.getLibraryManagement().addProgram(programTitle, + programSource, + programDescription); + } + catch (NotEnoughtPermissionsException nepe) + { + System.out.println("Don't have enought permissions????"); + } + catch (NoLoggedUserException nlue) + { + System.out.println("You must login before add program"); + } + catch (CouldNotStoreProgramException cnspe) + { + System.out.println("Error Storing program. Bad charm"); + } + catch (IOException io) + { + System.out.println("IO error reading data"); + } + } + + private void viewProgramsInLibrary() + { + + Collection programs; + try + { + LibraryManagement l = login.getLibraryManagement(); + programs = l.retrieveAllPrograms(); + if (programs == null) + return; + Iterator i = programs.iterator(); + while (i.hasNext()) + { + ProgramValue p = (ProgramValue)i.next(); + //UserValue[] u = p.getAuthors(); + System.out.println(p.getUser().getUser() + " " + + p.getTitle() + " " + + p.getDescription()); + } + } + catch (NoLoggedUserException nlue) + { + System.out.println("You must login to see content of library"); + } + catch (RemoteException re) + { + System.out.println("Remote Exception acceding library"); + } + catch (NotEnoughtPermissionsException nepe) + { + System.out.println("Not enought permissions"); + } + catch (CouldNotRetrieveProgramsException cnrpe) + { + System.out.println("Error retrieving programs"); + } + } + + private void viewMyProgramsInLibrary() + { + Collection programs; + try { + programs = login.getLibraryManagement().retrieveUserPrograms(); + if (programs == null) + return; + Iterator i = programs.iterator(); + while (i.hasNext()) + { + ProgramValue p = (ProgramValue)i.next(); + System.out.println( p.getTitle() + " " + + p.getDescription()); + } + } + catch (RemoteException re) + { + System.out.println("Remote error"); + } + catch (CouldNotRetrieveProgramsException cnrpe) + { + System.out.println("Error Retrieving programs"); + } + catch (NoLoggedUserException nlue) + { + System.out.println("You must login to see content of library"); + } + } + } Index: Interfaz.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/consoleclient/Interfaz.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Interfaz.java 29 Jun 2003 15:30:34 -0000 1.2 --- Interfaz.java 14 Aug 2003 22:07:14 -0000 1.3 *************** *** 23,27 **** package org.asturlinux.frade.prolix.consoleclient; ! import java.io.*; public class Interfaz --- 23,33 ---- package org.asturlinux.frade.prolix.consoleclient; ! import java.io.BufferedReader; ! import java.io.InputStreamReader; ! import java.io.IOException; ! import java.lang.NumberFormatException; ! ! ! public class Interfaz |
From: <iva...@us...> - 2003-08-14 22:20:23
|
Update of /cvsroot/pfc-prolog/prolix/web/WEB-INF In directory sc8-pr-cvs1:/tmp/cvs-serv17947/WEB-INF Added Files: checkLogin.tld Log Message: Some hard-work days without internet. Web side cuasi-completed --- NEW FILE: checkLogin.tld --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> <taglib> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> <short-name>checkLogin</short-name> <description>Tag library to Prolix Project</description> <tag> <name>checkLogin</name> <tag-class>org.asturlinux.frade.prolix.web.tags.CheckLoginTag </tag-class> <body-content>empty</body-content> <attribute> <name>requiredPermissions</name> <required>yes</required> </attribute> </tag> </taglib> |
From: <iva...@us...> - 2003-08-14 22:20:23
|
Update of /cvsroot/pfc-prolog/prolix/web In directory sc8-pr-cvs1:/tmp/cvs-serv17947 Modified Files: consult.jsp login.jsp program.jsp solutions.jsp tree.jsp Added Files: admin.jsp change-password.jsp error-permissions.jsp library.jsp my-library.jsp registry.jsp Log Message: Some hard-work days without internet. Web side cuasi-completed --- NEW FILE: admin.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- =========================================================== /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ ============================================================= --> <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, java.io.*,javax.ejb.*, org.asturlinux.frade.prolix.ejb.interfaces.*, org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %> <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/checkLogin.tld" prefix="prolix"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <prolix:checkLogin requiredPermissions="administrator"/> <html> <head> <title><bean:message key="title.main"/></title> <link rel="stylesheet" href="/prolixjsp/css/prolix.css" type="text/css"/> </head> <body> <h1><bean:message key="title.admin"/></h1> <html:form action="/actions/logout"> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> <hr align="left" size="1"> <html:form action="/actions/createProfessor"> <bean:message key="message.registry.professor"/><br> <bean:message key="message.input.user"/> <html:text property="username"/><br> <bean:message key="message.input.password"/> <html:password property="password"/><br> <bean:message key="message.input.password.again"/> <html:password property="passConfirmation"/><br> <html:submit><bean:message key="button.load"/></html:submit> <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> <html:errors/> </body> </html> --- NEW FILE: change-password.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- =========================================================== /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ ============================================================= --> <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, java.io.*,javax.ejb.*, org.asturlinux.frade.prolix.ejb.interfaces.*, org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %> <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/checkLogin.tld" prefix="prolix"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <jsp:useBean id="login" scope="session" class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <% String currentlyLoggedUser = login.getLoggedUser(); %> <prolix:checkLogin requiredPermissions="student"/> <html> <head> <title><bean:message key="title.main"/></title> <link rel="stylesheet" href="/prolixjsp/css/prolix.css" type="text/css"/> </head> <body> <h1><bean:message key="title.change.password"/></h1> <bean:message key="message.currently.logged.user"/> <%= currentlyLoggedUser %> <hr align="left" size="1"> <html:form action="/actions/changePassword"> <bean:message key="message.input.new.password"/> <html:password property="newPassword"/><br> <bean:message key="message.input.password.again"/> <html:password property="newPasswordConfirmation"/><br> <html:submit><bean:message key="button.load"/></html:submit> <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> <html:errors/> </body> </html> --- NEW FILE: error-permissions.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Error in permissions</title> </head> <body> <h1>Error in permissions</h1> <bean:message key="error.not.enought.permissions"/> <a href="/prolixjsp/login.jsp"> <bean:message key="message.go.login.page"/> </a> <hr> <address><a href="mailto:fr...@as...">Ivan Frade</a></address> <!-- Created: Thu Aug 14 13:27:04 CEST 2003 --> <!-- hhmts start --> Last modified: Thu Aug 14 13:32:24 CEST 2003 <!-- hhmts end --> </body> </html> --- NEW FILE: library.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- =========================================================== /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ ============================================================= --> <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, java.io.*,javax.ejb.*,org.asturlinux.frade.prolix.ejb.interfaces.*, org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %> <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ taglib uri="/WEB-INF/checkLogin.tld" prefix="prolix"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <jsp:useBean id="oldConsults" scope="session" class="org.asturlinux.frade.prolix.web.beans.LastConsultsBean" /> <jsp:useBean id="login" scope="session" class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <!-- Library Bean --> <jsp:useBean id="library" scope="session" class="org.asturlinux.frade.prolix.web.beans.LibraryBean" /> <% String currentlyLoggedUser = login.getLoggedUser(); %> <prolix:checkLogin requiredPermissions="student"/> <html> <head> <title><bean:message key="title.main"/></title> <link rel="stylesheet" href="/prolixjsp/css/prolix.css" type="text/css"/> </head> <!-- False consults to debug --> <body bgcolor="#768FDD"> <h1><bean:message key="title.library"/></h1> <html:form action="/actions/logout"> <bean:message key="message.currently.logged.user"/> <%= currentlyLoggedUser %> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> <table> <tr> <td> <logic:notEmpty name="library" property="programs"> <html:form action="/actions/loadFromLibrary"> <logic:iterate id="iterator" name="library" property="programs"> <tr> <table> <tr> <td> <input type=radio name="programKey" value="<%= ((ProgramValue)iterator).getTitle() %>"> </td> <td> <%= ((ProgramValue)iterator).getTitle() %> </td> <td> <%= ((ProgramValue)iterator).getDescription() %> </td> </tr> </table> </tr> </logic:iterate> <html:submit><bean:message key="button.load"/></html:submit> </html:form> </logic:notEmpty> <a href="/prolixjsp/program.jsp"> <bean:message key="message.go.load.program"/> </a> <html:form action="/actions/loadMyPrograms"> <html:submit> <bean:message key="message.go.my.library"/> </html:submit> </html:form> </td> </tr> </table> </body> </html> --- NEW FILE: my-library.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- =========================================================== /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ ============================================================= --> <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, java.io.*,javax.ejb.*,org.asturlinux.frade.prolix.ejb.interfaces.*, org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %> <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <jsp:useBean id="oldConsults" scope="session" class="org.asturlinux.frade.prolix.web.beans.LastConsultsBean" /> <jsp:useBean id="login" scope="session" class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <!-- Library Bean --> <jsp:useBean id="library" scope="session" class="org.asturlinux.frade.prolix.web.beans.LibraryBean" /> <% String currentlyLoggedUser = login.getLoggedUser(); %> <html> <head> <title><bean:message key="title.main"/></title> <link rel="stylesheet" href="/prolixjsp/css/prolix.css" type="text/css"/> </head> <!-- False consults to debug --> <body bgcolor="#768FDD"> <h1><bean:message key="title.library"/></h1> <html:form action="/actions/logout"> <bean:message key="message.currently.logged.user"/> <%= currentlyLoggedUser %> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> <table> <tr> <td> <logic:notEmpty name="library" property="programs"> <html:form action="/actions/managePrograms"> <logic:iterate id="iterator" name="library" property="programs"> <tr> <table> <tr> <td> <input type=radio name="programKey" value="<%= ((ProgramValue)iterator).getTitle() %>"> </td> <td> <%= ((ProgramValue)iterator).getTitle() %> </td> <td> <%= ((ProgramValue)iterator).getDescription() %> </td> </tr> </table> </tr> </logic:iterate> <bean:message key="message.actions.with.programs"/> <tr> <input type=radio name="actionToDo" value="modify"> <bean:message key="button.modify"/> <input type=radio name="actionToDo" value="delete"> <bean:message key="button.delete"/> </tr> <html:submit><bean:message key="button.load"/></html:submit> </html:form> </logic:notEmpty> <a href="/prolixjsp/program.jsp"> <bean:message key="message.go.load.program"/> </a> </td> </tr> </table> </body> </html> --- NEW FILE: registry.jsp --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- =========================================================== /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ ============================================================= --> <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, java.io.*,javax.ejb.*, org.asturlinux.frade.prolix.ejb.interfaces.*, org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %> <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <jsp:useBean id="login" scope="session" class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <html> <head> <title><bean:message key="title.main"/></title> <link rel="stylesheet" href="/prolixjsp/css/prolix.css" type="text/css"/> </head> <body> <h1><bean:message key="title.main"/></h1> <hr align="left" size="1"> <html:form action="/actions/registry"> <bean:message key="message.input.registry.data"/><br> <bean:message key="message.input.user"/> <html:text property="username"/><br> <bean:message key="message.input.password"/> <html:password property="password"/><br> <bean:message key="message.input.password.again"/> <html:password property="passConfirmation"/><br> <html:submit><bean:message key="button.load"/></html:submit> <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> <html:errors/> </body> </html> Index: consult.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/consult.jsp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** consult.jsp 7 Aug 2003 17:08:07 -0000 1.21 --- consult.jsp 14 Aug 2003 22:04:03 -0000 1.22 *************** *** 36,39 **** --- 36,40 ---- <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + <%@ taglib uri="/WEB-INF/checkLogin.tld" prefix="prolix"%> <jsp:useBean id="prologData" scope="session" *************** *** 43,58 **** class="org.asturlinux.frade.prolix.web.beans.LastConsultsBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <html> <head> --- 44,65 ---- class="org.asturlinux.frade.prolix.web.beans.LastConsultsBean" /> + <jsp:useBean id="login" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> + <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> + <% String currentlyLoggedUser = login.getLoggedUser(); %> + <prolix:checkLogin requiredPermissions="student"/> + <html> <head> *************** *** 67,70 **** --- 74,79 ---- <h1><bean:message key="title.consult"/></h1> <html:form action="/actions/logout"> + <bean:message key="message.currently.logged.user"/> + <%= currentlyLoggedUser %> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> *************** *** 87,90 **** --- 96,108 ---- <html:submit><bean:message key="message.load.other.program"/></html:submit> </html:form> + <hr align="left" size="1"> + <html:form action="/actions/addProgram"> + <bean:message key="message.title.program"/> + <html:text property="title" maxlength="50"/> + <bean:message key="message.description.program"/> + <html:text property="description" maxlength="50"/> + <html:submit><bean:message key="message.save.program"/></html:submit> + </html:form> + <html:errors/> </td> Index: login.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/login.jsp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** login.jsp 7 Aug 2003 17:08:07 -0000 1.4 --- login.jsp 14 Aug 2003 22:04:03 -0000 1.5 *************** *** 38,49 **** class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 38,52 ---- class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> + <jsp:useBean id="login" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> + <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> *************** *** 68,74 **** </html:form> ! <br>Este seria el enlace para registrarte: (un form a una pagina de registro donde te pide nombre, apellidos, e-mail, username y passwd ! <br><bean:message key="message.registry.now"/> ! <html:errors/> </body> --- 71,77 ---- </html:form> ! <br> ! <a href="/prolixjsp/registry.jsp"><bean:message key="message.registry.now"/></a> ! <a href="/prolixjsp/admin.jsp"><bean:message key="message.registry.professor"/></a> <html:errors/> </body> Index: program.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/program.jsp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** program.jsp 7 Aug 2003 17:08:07 -0000 1.14 --- program.jsp 14 Aug 2003 22:04:03 -0000 1.15 *************** *** 26,31 **** <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, ! java.io.*,javax.ejb.*, org.asturlinux.frade.prolix.ejb.interfaces.*, ! org.asturlinux.frade.prolix.interpreter.exceptions.*" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> --- 26,32 ---- <%@ page import="java.util.*,java.rmi.*,javax.naming.*,javax.rmi.*, ! java.io.*,javax.ejb.*,org.asturlinux.frade.prolix.ejb.interfaces.*, ! org.asturlinux.frade.prolix.interpreter.exceptions.*" ! %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> *************** *** 33,54 **** <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> ! <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> ! <html> <head> --- 34,71 ---- <%@ taglib uri="ejbtags" prefix="ejb" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> ! <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> ! <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> ! <%@ taglib uri="/WEB-INF/checkLogin.tld" prefix="prolix"%> <jsp:useBean id="prologData" scope="session" class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> + <jsp:useBean id="oldConsults" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LastConsultsBean" /> + + <jsp:useBean id="login" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> + <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> ! <!-- Library Bean --> ! <jsp:useBean id="library" scope="session" ! class="org.asturlinux.frade.prolix.web.beans.LibraryBean" /> ! ! <% String currentlyLoggedUser = login.getLoggedUser(); ! String programLoaded = prologData.getCurrentProgram(); %> ! ! <prolix:checkLogin requiredPermissions="student"/> ! <html> <head> *************** *** 60,63 **** --- 77,82 ---- <html:form action="/actions/logout"> + <bean:message key="message.currently.logged.user"/> + <%= currentlyLoggedUser %> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> *************** *** 66,76 **** <hr align="left" size="1"> <html:form action="/actions/loadProgram"> ! <html:textarea property="program" rows="20" cols="60"> ! <!-- FIXME write program --> </html:textarea> <br> <html:submit><bean:message key="button.load"/></html:submit> <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> <html:errors/> </body> </html> --- 85,105 ---- <hr align="left" size="1"> <html:form action="/actions/loadProgram"> ! <html:textarea property="program" rows="20" cols="60" ! value="<%= programLoaded %>"> </html:textarea> <br> <html:submit><bean:message key="button.load"/></html:submit> <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> + + <html:form action="/actions/visitLibrary"> + <html:submit><bean:message key="button.go.library"/></html:submit> + </html:form> + + <html:errors/> + + <a href="/prolixjsp/change-password.jsp"> + <bean:message key="message.change.password"/> + </a> </body> </html> Index: solutions.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/solutions.jsp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** solutions.jsp 7 Aug 2003 17:08:07 -0000 1.16 --- solutions.jsp 14 Aug 2003 22:04:03 -0000 1.17 *************** *** 41,53 **** class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 41,55 ---- class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> + <jsp:useBean id="login" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> *************** *** 57,60 **** --- 59,63 ---- String programLoaded = prologData.getCurrentProgram(); String queryLoaded = prologData.getCurrentConsult(); + String currentlyLoggedUser = login.getLoggedUser(); %> <html> *************** *** 66,69 **** --- 69,74 ---- <h1><bean:message key="title.resultText"/></h1> <html:form action="/actions/logout"> + <bean:message key="message.currently.logged.user"/> + <%= currentlyLoggedUser %> <html:submit><bean:message key="button.logout"/></html:submit> </html:form> Index: tree.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/tree.jsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tree.jsp 7 Aug 2003 17:08:07 -0000 1.3 --- tree.jsp 14 Aug 2003 22:04:03 -0000 1.4 *************** *** 39,54 **** class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> <html> <head> --- 39,59 ---- class="org.asturlinux.frade.prolix.web.beans.CurrentStateBean" /> + <jsp:useBean id="login" scope="session" + class="org.asturlinux.frade.prolix.web.beans.LoginBean"/> + <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControlHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/AccessControl" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.AccessControl" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> </ejb:useBean> + <% String currentlyLoggedUser = login.getLoggedUser(); %> + <html> <head> *************** *** 60,64 **** <h1><bean:message key="title.resultGraphic"/></h1> <html:form action="/actions/logout"> ! <html:submit><bean:message key="button.logout"/></html:submit> </html:form> --- 65,71 ---- <h1><bean:message key="title.resultGraphic"/></h1> <html:form action="/actions/logout"> ! <bean:message key="message.currently.logged.user"/> ! <%= currentlyLoggedUser %> ! <html:submit><bean:message key="button.logout"/></html:submit> </html:form> |
From: <iva...@us...> - 2003-08-07 17:08:11
|
Update of /cvsroot/pfc-prolog/prolix/etc In directory sc8-pr-cvs1:/tmp/cvs-serv23880/etc Modified Files: WebClientResources.properties Log Message: Adapted web pages to new server refactor - Removed guest access Index: WebClientResources.properties =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/etc/WebClientResources.properties,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** WebClientResources.properties 3 Aug 2003 21:35:31 -0000 1.12 --- WebClientResources.properties 7 Aug 2003 17:08:07 -0000 1.13 *************** *** 26,30 **** message.input.user=Usuario message.input.password=Password - message.free.access=Acceso libre message.registry.now=Registrate ahora title.main=Prolix --- 26,29 ---- |
From: <iva...@us...> - 2003-08-07 17:08:11
|
Update of /cvsroot/pfc-prolog/prolix/web In directory sc8-pr-cvs1:/tmp/cvs-serv23880/web Modified Files: consult.jsp login.jsp program.jsp solutions.jsp tree.jsp Log Message: Adapted web pages to new server refactor - Removed guest access Index: consult.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/consult.jsp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** consult.jsp 3 Aug 2003 15:58:42 -0000 1.20 --- consult.jsp 7 Aug 2003 17:08:07 -0000 1.21 *************** *** 45,54 **** <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMainHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMain" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 45,54 ---- <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> Index: login.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/login.jsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** login.jsp 6 Aug 2003 21:42:02 -0000 1.3 --- login.jsp 7 Aug 2003 17:08:07 -0000 1.4 *************** *** 71,77 **** <br><bean:message key="message.registry.now"/> - <br>Este seria el enlace para entrar como invitado: (con un form tonto) - <br><bean:message key="message.free.acess"/> - <html:errors/> </body> --- 71,74 ---- Index: program.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/program.jsp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** program.jsp 3 Aug 2003 15:58:42 -0000 1.13 --- program.jsp 7 Aug 2003 17:08:07 -0000 1.14 *************** *** 40,49 **** <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMainHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMain" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 40,49 ---- <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> Index: solutions.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/solutions.jsp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** solutions.jsp 3 Aug 2003 15:58:42 -0000 1.15 --- solutions.jsp 7 Aug 2003 17:08:07 -0000 1.16 *************** *** 44,53 **** <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMainHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMain" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 44,53 ---- <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> Index: tree.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/tree.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tree.jsp 3 Aug 2003 15:58:42 -0000 1.2 --- tree.jsp 7 Aug 2003 17:08:07 -0000 1.3 *************** *** 41,50 **** <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMainHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMain" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 41,50 ---- <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> |
From: <iva...@us...> - 2003-08-07 12:03:09
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb In directory sc8-pr-cvs1:/tmp/cvs-serv27903/src/org/asturlinux/frade/prolix/ejb/sessionjb Modified Files: StudentRoleBean.java Log Message: Added and corrected xdoclet tags. Now deploys webclient Index: StudentRoleBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/StudentRoleBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StudentRoleBean.java 6 Aug 2003 21:29:11 -0000 1.1 --- StudentRoleBean.java 7 Aug 2003 12:03:06 -0000 1.2 *************** *** 39,50 **** /** * ! * @ejb.bean name="ejb/StudentRole" * type="Stateful" * view-type="both" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/StudentRole" * ! * @ejb.ejb-ref ejb-name="ejb/StudentRole" ! * view-type="both" * ref-name="ejb/StudentRole" * @web.ejb-ref * description="Student Use Cases EJB" --- 39,51 ---- /** * ! * @ejb.bean name="StudentRole" * type="Stateful" * view-type="both" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/StudentRole" * ! * @ejb.ejb-ref ejb-name="StudentRole" ! * view-type="remote" * ref-name="ejb/StudentRole" + * * @web.ejb-ref * description="Student Use Cases EJB" *************** *** 54,59 **** * remote="org.asturlinux.frade.prolix.ejb.sessionjb.StudentRole" * **/ - public abstract class StudentRoleBean --- 55,61 ---- * remote="org.asturlinux.frade.prolix.ejb.sessionjb.StudentRole" * + * @jboss.ejb-ref-jndi ref-name="StudentRole" + * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/StudentRole" **/ public abstract class StudentRoleBean |
From: <iva...@us...> - 2003-08-07 11:55:20
|
Update of /cvsroot/pfc-prolog/prolix In directory sc8-pr-cvs1:/tmp/cvs-serv26864 Modified Files: build.xml Log Message: Correted some information in build.xml out of date Index: build.xml =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/build.xml,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** build.xml 6 Aug 2003 21:14:44 -0000 1.47 --- build.xml 7 Aug 2003 11:55:17 -0000 1.48 *************** *** 249,258 **** <deploymentdescriptor displayname="ProlixWebClient" ! description="Second approach to web client" sessiontimeout="30"> <contextparam ! name="ProlixMain" ! value="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain"/> <!-- XSLT tags --> --- 249,258 ---- <deploymentdescriptor displayname="ProlixWebClient" ! description="Third (at least) approach to web client" sessiontimeout="30"> <contextparam ! name="CommonUse" ! value="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUse"/> <!-- XSLT tags --> |
From: <iva...@us...> - 2003-08-06 21:42:04
|
Update of /cvsroot/pfc-prolog/prolix/web In directory sc8-pr-cvs1:/tmp/cvs-serv28502 Modified Files: login.jsp Log Message: Updated login to refactored server Index: login.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/login.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** login.jsp 3 Aug 2003 21:35:32 -0000 1.2 --- login.jsp 6 Aug 2003 21:42:02 -0000 1.3 *************** *** 40,49 **** <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMainHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.ProlixMain" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> --- 40,49 ---- <!-- Obtain Home reference--> <ejb:useHome id="prolixHome" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCaseHome" ! location="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" /> <!-- Obtain Bean reference. If don't exist, create new one --> <ejb:useBean id="interpreter" ! type="org.asturlinux.frade.prolix.ejb.interfaces.CommonUseCase" scope="session"> <ejb:createBean instance="<%= prolixHome.create() %>" /> |
From: <iva...@us...> - 2003-08-06 21:40:22
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans In directory sc8-pr-cvs1:/tmp/cvs-serv28167 Modified Files: LoadConsultFormBean.java LoadProgramFormBean.java LoginFormBean.java LogoutFormBean.java ResetProgramFormBean.java SolutionsFormBean.java StepFormBean.java Log Message: Updated imports to new xdoclet version Index: LoadConsultFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/LoadConsultFormBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LoadConsultFormBean.java 17 Jul 2003 17:55:17 -0000 1.2 --- LoadConsultFormBean.java 6 Aug 2003 21:40:19 -0000 1.3 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,30 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; /** Index: LoadProgramFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/LoadProgramFormBean.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LoadProgramFormBean.java 17 Jul 2003 17:55:17 -0000 1.5 --- LoadProgramFormBean.java 6 Aug 2003 21:40:19 -0000 1.6 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,30 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.ActionErrors; /** Index: LoginFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/LoginFormBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoginFormBean.java 3 Aug 2003 14:44:02 -0000 1.1 --- LoginFormBean.java 6 Aug 2003 21:40:19 -0000 1.2 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,30 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; /** Index: LogoutFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/LogoutFormBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogoutFormBean.java 3 Aug 2003 15:58:42 -0000 1.1 --- LogoutFormBean.java 6 Aug 2003 21:40:19 -0000 1.2 *************** *** 23,30 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** ! * @struts:form name="logoutForm" */ public class LogoutFormBean extends ActionForm --- 23,32 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; /** ! * @struts.form name="logoutForm" */ public class LogoutFormBean extends ActionForm Index: ResetProgramFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/ResetProgramFormBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ResetProgramFormBean.java 27 Jul 2003 14:15:32 -0000 1.1 --- ResetProgramFormBean.java 6 Aug 2003 21:40:19 -0000 1.2 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,29 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; /** Index: SolutionsFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/SolutionsFormBean.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SolutionsFormBean.java 27 Jul 2003 14:12:35 -0000 1.4 --- SolutionsFormBean.java 6 Aug 2003 21:40:19 -0000 1.5 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,29 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; /** Index: StepFormBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/formbeans/StepFormBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StepFormBean.java 27 Jul 2003 14:15:32 -0000 1.1 --- StepFormBean.java 6 Aug 2003 21:40:19 -0000 1.2 *************** *** 23,27 **** import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.*; /** --- 23,29 ---- import javax.servlet.http.HttpServletRequest; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; /** |
From: <iva...@us...> - 2003-08-06 21:33:14
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions In directory sc8-pr-cvs1:/tmp/cvs-serv26360 Modified Files: LoadConsultAction.java LoadProgramAction.java LoginAction.java LogoutAction.java ResetProgramAction.java SolutionAction.java StepAction.java Log Message: updated imports to new xdoclet version Index: LoadConsultAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/LoadConsultAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LoadConsultAction.java 2 Aug 2003 20:25:37 -0000 1.12 --- LoadConsultAction.java 6 Aug 2003 21:33:11 -0000 1.13 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 70,75 **** try { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! interpreter.loadConsult(consult); // Save in session current loaded consult --- 75,80 ---- try { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! login.getStudentRole().loadConsult(consult); // Save in session current loaded consult Index: LoadProgramAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/LoadProgramAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LoadProgramAction.java 2 Aug 2003 20:25:37 -0000 1.12 --- LoadProgramAction.java 6 Aug 2003 21:33:11 -0000 1.13 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 69,76 **** { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! if (interpreter != null) { ! interpreter.loadProgram(program); CurrentStateBean ib = (CurrentStateBean)session.getAttribute("prologData"); if (ib != null) --- 74,81 ---- { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! if (login != null) { ! login.getStudentRole().loadProgram(program); CurrentStateBean ib = (CurrentStateBean)session.getAttribute("prologData"); if (ib != null) Index: LoginAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/LoginAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoginAction.java 3 Aug 2003 14:44:01 -0000 1.1 --- LoginAction.java 6 Aug 2003 21:33:11 -0000 1.2 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 69,79 **** { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! if (interpreter != null) { ! interpreter.login(user,pass); } else ! errors.add("login",new ActionError("error.no.interpreter")); } catch (FailedLoginException notAuth) --- 74,84 ---- { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! if (login != null) { ! login.login(user,pass); } else ! errors.add("login",new ActionError("error.no.interpreter")); //FIXME Message error } catch (FailedLoginException notAuth) Index: LogoutAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/LogoutAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogoutAction.java 3 Aug 2003 15:58:42 -0000 1.1 --- LogoutAction.java 6 Aug 2003 21:33:11 -0000 1.2 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 66,73 **** { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! if (interpreter != null) { ! interpreter.logout(); } else --- 71,78 ---- { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! if (login != null) { ! login.logout(); } else Index: ResetProgramAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/ResetProgramAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ResetProgramAction.java 27 Jul 2003 14:15:32 -0000 1.1 --- ResetProgramAction.java 6 Aug 2003 21:33:11 -0000 1.2 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,35 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; Index: SolutionAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/SolutionAction.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SolutionAction.java 2 Aug 2003 20:25:37 -0000 1.9 --- SolutionAction.java 6 Aug 2003 21:33:11 -0000 1.10 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.Action; ! import org.apache.struts.action.ActionForward; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 73,83 **** { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! String result = interpreter.nextSolution(); CurrentStateBean data = (CurrentStateBean)session.getAttribute("prologData"); if (data != null) { data.setCurrentResult(result); ! boolean test = interpreter.isLastSolution(); System.out.println("DEBUG: es la ultima solucion " + test); --- 78,88 ---- { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! String result = login.getStudentRole().nextSolution(); CurrentStateBean data = (CurrentStateBean)session.getAttribute("prologData"); if (data != null) { data.setCurrentResult(result); ! boolean test = login.getStudentRole().isLastSolution(); System.out.println("DEBUG: es la ultima solucion " + test); Index: StepAction.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/web/actions/StepAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StepAction.java 2 Aug 2003 20:25:37 -0000 1.2 --- StepAction.java 6 Aug 2003 21:33:11 -0000 1.3 *************** *** 27,31 **** import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.*; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; --- 27,36 ---- import javax.servlet.http.*; import java.security.*; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.Action; import org.apache.struts.util.*; import org.asturlinux.frade.prolix.web.beans.*; *************** *** 69,79 **** { HttpSession session = request.getSession(); ! ProlixMain interpreter = (ProlixMain)session.getAttribute("interpreter"); ! String result = interpreter.step(); CurrentStateBean data = (CurrentStateBean)session.getAttribute("prologData"); if (data != null) { data.setCurrentResult(result); ! boolean test = interpreter.isLastSolution(); System.out.println("DEBUG: es la ultima solucion " + test); --- 74,84 ---- { HttpSession session = request.getSession(); ! CommonUseCase login = (CommonUseCase)session.getAttribute("interpreter"); ! String result = login.getStudentRole().step(); CurrentStateBean data = (CurrentStateBean)session.getAttribute("prologData"); if (data != null) { data.setCurrentResult(result); ! boolean test = login.getStudentRole().isLastSolution(); System.out.println("DEBUG: es la ultima solucion " + test); |
From: <iva...@us...> - 2003-08-06 21:30:54
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb In directory sc8-pr-cvs1:/tmp/cvs-serv25621 Modified Files: Permissions.java Log Message: removed guest permission level Index: Permissions.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb/Permissions.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Permissions.java 3 Aug 2003 21:35:32 -0000 1.1 --- Permissions.java 6 Aug 2003 21:30:52 -0000 1.2 *************** *** 26,30 **** public static final String Administrator = "administrator"; public static final String Professor = "professor"; - public static final String Guest = "guest"; public static final String Student = "student"; } --- 26,29 ---- |
From: <iva...@us...> - 2003-08-06 21:29:15
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb In directory sc8-pr-cvs1:/tmp/cvs-serv25043 Modified Files: CheckSolutionVisitor.java SimpleXmlVisitor.java TreeXmlVisitor.java Added Files: CommonUseCaseBean.java ProfessorRoleBean.java StudentRoleBean.java Removed Files: ProlixMainBean.java Log Message: Refactored ProlixMainBean in CommonUseCaseBean and StudentRoleBean. Updated imports to new xdoclet version --- NEW FILE: CommonUseCaseBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import java.rmi.*; import javax.naming.*; import javax.ejb.*; import java.util.*; import org.asturlinux.frade.prolix.exceptions.NotEnoughtPermissionsException; import org.asturlinux.frade.prolix.exceptions.NoLoggedUserException; import org.asturlinux.frade.prolix.exceptions.FailedLoginException; import org.asturlinux.frade.prolix.ejb.interfaces.*; import org.asturlinux.frade.prolix.ejb.interfaces.StudentRole; /** * Iteration 1: This bean manages communication between JSP <-> interpreter * * * @ejb.bean name="ejb/CommonUseCase" * type="Stateful" * view-type="remote" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" * * @ejb.ejb-ref ejb-name="ejb/CommonUseCase" * view-type="remote" * ref-name="ejb/CommonUseCase" * @web.ejb-ref * description="Refactorized Prolix Main EJB" * name="CommonUseCase" * type="Session" * home="org.asturlinux.frade.prolix.ejb.sessionjb.CommonUseCaseHome" * remote="org.asturlinux.frade.prolix.ejb.sessionjb.CommonUseCase" * * @jboss.ejb-ref-jndi ref-name="CommonUseCase" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/CommonUseCase" * **/ public abstract class CommonUseCaseBean implements SessionBean { /** * Login / logout methods */ private UserLocal loggedUser = null; /** * @ejb.interface-method **/ public void login(String name, String pass) throws FailedLoginException { try { if (loggedUser != null) throw new FailedLoginException(); loggedUser = obtainUserHome().findByLogin(name,pass); } catch (FinderException fe) { throw new FailedLoginException(); } catch (NamingException ne) { throw new FailedLoginException(); } } /** * @ejb.interface-method **/ public void logout() throws NoLoggedUserException { if (loggedUser == null) throw new NoLoggedUserException(); else loggedUser = null; } /** * Private method to retrieve other bean factory */ private UserLocalHome obtainUserHome() throws NamingException { InitialContext ctx = new InitialContext(); UserLocalHome home = (UserLocalHome)ctx.lookup(UserLocalHome.JNDI_NAME); return home; } private StudentRoleHome obtainStudentRoleHome() throws NamingException { InitialContext ctx = new InitialContext(); StudentRoleHome home = (StudentRoleHome)ctx.lookup(StudentRoleHome.JNDI_NAME); return home; } /** * @ejb.interface-method **/ public void verifyPermissions(String required) throws NotEnoughtPermissionsException { if (loggedUser == null) { throw new NotEnoughtPermissionsException(); } if ( loggedUser.getPermissions().indexOf(required) == -1 ) throw new NotEnoughtPermissionsException(); } /** * Interaction with other session Beans * * http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Session3.html#63667 * */ private SessionContext context = null; public void setSessionContext(SessionContext ctx) { this.context = ctx; } private StudentRole studentUseCase = null; /** * @ejb.interface-method **/ public StudentRole getStudentRole() { try { if (studentUseCase == null) { //InitialContext ctx = new InitialContext(); //StudentRoleHome home = (StudentRoleHome)ctx.lookup(StudentRoleHome.JNDI_NAME); studentUseCase = obtainStudentRoleHome().create(); studentUseCase.setCommonUseCase(context.getEJBObject()); //studentUseCase = StudentRoleUtil.getHome().create(this); } } catch (NamingException namingException) { throw new EJBException("Maaaal naming"); // FIXME } catch (CreateException createException) { throw new EJBException("Maaaal create"); // FIXME } catch (RemoteException e) { throw new EJBException("Maaaal remote"); // FIXME } // end of catch // end of catch return studentUseCase; } public void ejbCreate() throws javax.ejb.CreateException { System.out.println( "CommonUseCaseBean.ejbCreate()" ); } } --- NEW FILE: ProfessorRoleBean.java --- --- NEW FILE: StudentRoleBean.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import java.rmi.*; import javax.naming.*; import javax.ejb.*; import java.util.*; import java.io.StringWriter; import java.io.Writer; import org.asturlinux.frade.dummy.*; import org.asturlinux.frade.prolix.interpreter.exceptions.*; import org.asturlinux.frade.prolix.interpreter.interfaces.*; import org.asturlinux.frade.prolix.exceptions.*; //import org.asturlinux.frade.prolix.ejb.interfaces.UserLocalHome; //import org.asturlinux.frade.prolix.ejb.interfaces.UserLocal; import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; import org.asturlinux.frade.prolix.ejb.interfaces.*; /** * * @ejb.bean name="ejb/StudentRole" * type="Stateful" * view-type="both" * jndi-name="org/asturlinux/frade/prolix/ejb/sessionjb/StudentRole" * * @ejb.ejb-ref ejb-name="ejb/StudentRole" * view-type="both" * ref-name="ejb/StudentRole" * @web.ejb-ref * description="Student Use Cases EJB" * name="StudentRole" * type="Session" * home="org.asturlinux.frade.prolix.ejb.sessionjb.StudentRoleHome" * remote="org.asturlinux.frade.prolix.ejb.sessionjb.StudentRole" * **/ public abstract class StudentRoleBean implements SessionBean { private String _program; private String _consult; private PrologContextDummy prologCtx; private CommonUseCase login = null; private boolean lastSolution = false; /** * @ejb.interface-method **/ public void loadProgram(String program) throws LexicalException, SyntaxException, NotEnoughtPermissionsException { try { login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new NotEnoughtPermissionsException(); } _program = program; try { prologCtx.load(program); } catch (ProgramAlreadyLoadedException pale) { obtainPrologContext(); try { prologCtx.load(program); } catch (ProgramAlreadyLoadedException fatal) { /** * This exception can not be produced. * Error in Context Implementation. */ throw new EJBException(); } } } /** * @ejb.interface-method **/ public String getProgram() throws ProgramNotLoadedException { if (_program == null) throw new ProgramNotLoadedException(); return _program; } /** * @ejb.interface-method **/ public void loadConsult(String consult) throws LexicalException, SyntaxException, ProgramNotLoadedException, NotEnoughtPermissionsException { try { login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new NotEnoughtPermissionsException(); } _consult = consult; //FIXME Could be prologCtx == null? prologCtx.consult(consult); } /** * @ejb.interface-method **/ public String getCurrentConsult() throws QueryNotLoadedException { if (_consult == null) throw new QueryNotLoadedException(); return _consult; } /** * @ejb.interface-method */ public String nextSolution() throws ProgramNotLoadedException, QueryNotLoadedException, NotEnoughtPermissionsException { try { login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new NotEnoughtPermissionsException(); } CheckSolutionVisitor visitor = new CheckSolutionVisitor(); TreeElement treeResult; TreeTraversors tt = new TreeTraversors(); do { treeResult = prologCtx.step(); tt.visitLastNode(treeResult,visitor); } while (!visitor.getIsSolution() && !treeResult.isCompletlyExplored()); setLastSolution(treeResult.isCompletlyExplored()); TransformationControl tc = new TransformationControl(); return tc.transformToTreeXml(treeResult); } /** * @ejb.interface-method **/ public String step() throws ProgramNotLoadedException, QueryNotLoadedException, NotEnoughtPermissionsException { try { login.verifyPermissions(Permissions.Student); } catch (RemoteException re) { throw new NotEnoughtPermissionsException(); } TreeElement treeResult = prologCtx.step(); if (treeResult == null) //FIXME Can be possible? setLastSolution(false); else setLastSolution(treeResult.isCompletlyExplored()); // FIXME: cache results TransformationControl tc = new TransformationControl(); return tc.transformToTreeXml(treeResult); } /** * @ejb.interface-method **/ public boolean isLastSolution() { return lastSolution; } private void setLastSolution(boolean newValue) { System.out.println("DEBUG: setLastSolution " + newValue); lastSolution = newValue; } /* ******************************************************* * Extra interpreter funcionality ******************************************************* */ /** * Inicializa el bean * * @ejb.create-method **/ // public void ejbCreate(CommonUseCaseBean common) public void ejbCreate() throws javax.ejb.CreateException { System.out.println( "StudentRoleBean.ejbCreate()" ); obtainPrologContext(); } /** * @ejb.interface-method */ public void setCommonUseCase(javax.ejb.EJBObject commonUse) { login = (CommonUseCase)commonUse; } private void obtainPrologContext() { PrologInterpreterDummy pi = new PrologInterpreterDummy(); try { prologCtx = (PrologContextDummy)pi.createContext(); } catch (org.asturlinux.frade.prolix.interpreter.exceptions.CreateException ce) { /** * Fatal Error: something wrong with JVM */ throw new EJBException(); } } /** * No tag */ public void ejbPassivate() { //FIXME: Loose state System.out.println("Pasivome"); prologCtx = null; } public void ejbActivate() { obtainPrologContext(); } } Index: CheckSolutionVisitor.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/CheckSolutionVisitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CheckSolutionVisitor.java 20 Jul 2003 17:55:01 -0000 1.1 --- CheckSolutionVisitor.java 6 Aug 2003 21:29:11 -0000 1.2 *************** *** 1,5 **** package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.*; --- 1,6 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElementVisitor; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; Index: SimpleXmlVisitor.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/SimpleXmlVisitor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SimpleXmlVisitor.java 19 Jul 2003 19:37:51 -0000 1.4 --- SimpleXmlVisitor.java 6 Aug 2003 21:29:11 -0000 1.5 *************** *** 23,27 **** package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.*; import java.io.Writer; --- 23,29 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElementVisitor; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; ! import org.asturlinux.frade.prolix.interpreter.interfaces.Substitution; import java.io.Writer; Index: TreeXmlVisitor.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/TreeXmlVisitor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TreeXmlVisitor.java 27 Jul 2003 14:03:05 -0000 1.2 --- TreeXmlVisitor.java 6 Aug 2003 21:29:11 -0000 1.3 *************** *** 23,27 **** package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.*; import java.io.Writer; import java.util.HashMap; --- 23,29 ---- package org.asturlinux.frade.prolix.ejb.sessionjb; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElementVisitor; ! import org.asturlinux.frade.prolix.interpreter.interfaces.TreeElement; ! import org.asturlinux.frade.prolix.interpreter.interfaces.Substitution; import java.io.Writer; import java.util.HashMap; --- ProlixMainBean.java DELETED --- |
From: <iva...@us...> - 2003-08-06 21:22:04
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/consoleclient In directory sc8-pr-cvs1:/tmp/cvs-serv23458 Modified Files: ConsoleClient.java Log Message: Updated console client to refactored server Index: ConsoleClient.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/consoleclient/ConsoleClient.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ConsoleClient.java 2 Aug 2003 20:29:17 -0000 1.11 --- ConsoleClient.java 6 Aug 2003 21:22:01 -0000 1.12 *************** *** 39,43 **** public class ConsoleClient { ! private ProlixMain interpreter; public static void main(String args[]) { --- 39,44 ---- public class ConsoleClient { ! private StudentRole interpreter; ! private CommonUseCase login; public static void main(String args[]) { *************** *** 54,60 **** // Obtain reference to home InitialContext ctx = new InitialContext(); ! ProlixMainHome home = (ProlixMainHome)ctx.lookup(ProlixMainHome.JNDI_NAME); // Create the interpreter bean ! interpreter = home.create(); } catch (NamingException ne) --- 55,63 ---- // Obtain reference to home InitialContext ctx = new InitialContext(); ! CommonUseCaseHome home = (CommonUseCaseHome)ctx.lookup(CommonUseCaseHome.JNDI_NAME); // Create the interpreter bean ! login = home.create(); ! //login = CommonUseCaseUtil.getHome().create(); ! interpreter = login.getStudentRole(); } catch (NamingException ne) *************** *** 133,137 **** try { ! String input = new String(in.readLine()); interpreter.loadProgram(input); } --- 136,142 ---- try { ! //String input = new String(in.readLine()); ! System.out.println("now hardcoded program"); ! String input = new String("aosidfjoasidjf"); interpreter.loadProgram(input); } *************** *** 280,284 **** System.out.println("Write your password: "); String pwd = new String(in.readLine()); ! interpreter.login(id,pwd); } catch (IOException io) --- 285,289 ---- System.out.println("Write your password: "); String pwd = new String(in.readLine()); ! login.login(id,pwd); } catch (IOException io) *************** *** 296,300 **** try { ! interpreter.logout(); } catch (NoLoggedUserException nlue) --- 301,305 ---- try { ! login.logout(); } catch (NoLoggedUserException nlue) |
From: <iva...@us...> - 2003-08-06 21:17:08
|
Update of /cvsroot/pfc-prolog/prolix/etc In directory sc8-pr-cvs1:/tmp/cvs-serv22424 Modified Files: servlets.xml Log Message: Removed information now generated by xdoclet Index: servlets.xml =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/etc/servlets.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** servlets.xml 2 Aug 2003 15:41:39 -0000 1.4 --- servlets.xml 6 Aug 2003 21:17:05 -0000 1.5 *************** *** 29,36 **** ! <!-- Added xdoclet tags in source, but seems don't work --> <servlet> <servlet-name>treeServlet</servlet-name> <servlet-class>org.asturlinux.frade.prolix.web.servlets.TreeServlet</servlet-class> ! ! </servlet> --- 29,36 ---- ! <!-- Added xdoclet tags in source <servlet> <servlet-name>treeServlet</servlet-name> <servlet-class>org.asturlinux.frade.prolix.web.servlets.TreeServlet</servlet-class> ! </servlet> ! --> |
From: <iva...@us...> - 2003-08-06 21:14:46
|
Update of /cvsroot/pfc-prolog/prolix In directory sc8-pr-cvs1:/tmp/cvs-serv21976 Modified Files: build.xml Log Message: Divided in two tasks xdoclet code generation. Corrected some dependences Index: build.xml =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/build.xml,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** build.xml 2 Aug 2003 20:30:52 -0000 1.46 --- build.xml 6 Aug 2003 21:14:44 -0000 1.47 *************** *** 80,86 **** <available property="jboss.present" file="${jboss.home}/bin/run.jar"/> <antcall target="wrong-jboss"/> ! <antcall target="check-xdoclet"/> ! <available property="xdoclet.present" file="${xdoclet.home}/lib/xdoclet.jar"/> ! <antcall target="wrong-xdoclet"/> </target> --- 80,86 ---- <available property="jboss.present" file="${jboss.home}/bin/run.jar"/> <antcall target="wrong-jboss"/> ! <!-- <antcall target="check-xdoclet"/> --> ! <!-- <available property="xdoclet.present" file="${xdoclet.home}/lib/xdoclet.jar"/> ! <antcall target="wrong-xdoclet"/> --> </target> *************** *** 112,118 **** <property name="package.path" value="org/asturlinux/frade/prolix" /> <property name="src.dir" value="${basedir}/src"/> - <property name="src.main.dir" - value="${src.dir}/${package.path}"/> - <property name="src.ejb.dir" value="${src.dir}"/> <property name="lib.dir" value="${basedir}/lib"/> --- 112,115 ---- *************** *** 143,155 **** <path id="xdoclet.path"> ! <pathelement location="${ant.home}/lib/ant.jar" /> ! <!-- AS Maybe necessary for Ant 1.5 and XDoclet 1.3 ! <pathelement location="${ant.home}/lib/xmlParserAPIs.jar" /> ! <pathelement location="${ant.home}/lib/xercesImpl.jar" /> ! <pathelement location="${ant.home}/lib/bcel.jar" /> ! <pathelement location="${xdoclet.home}/lib/xjavadoc.jar" /> ! --> ! <pathelement location="${xdoclet.home}/lib/xdoclet.jar" /> ! <pathelement location="${jboss.client}/log4j.jar" /> </path> --- 140,144 ---- <path id="xdoclet.path"> ! <fileset dir="${xdoclet.home}/lib"/> </path> *************** *** 193,247 **** <!-- =================================================================== --> ! <target name="xdoclet-generate" depends="init"> <taskdef ! name="ejbdoclet" ! classname="xdoclet.ejb.EjbDocletTask" ! > <classpath refid="xdoclet.path"/> </taskdef> ! ! <ejbdoclet ! sourcepath="${src.ejb.dir}" ! destdir="${build.generate.dir}" ! classpathref="base.path" ! excludedtags="@version,@author" ! ejbspec="${ejb.version}" ! force="${xdoclet.force}" ! mergedir="${src.resources.dir}/xdoclet" ! > ! <fileset dir="${src.ejb.dir}"> ! <include name="**/*Bean.java"/> ! </fileset> ! <packageSubstitution packages="sessionjb,entityjb" substituteWith="interfaces"/> <dataobject/> <remoteinterface/> ! <localinterface/> <homeinterface/> <localhomeinterface/> - <entitypk/> - <!-- <entigtybmp/> --> <entitycmp/> <session/> <valueobject/> <!-- Beans Deployment descriptor --> ! <deploymentdescriptor destdir="${build.generate.ejb-conf}/META-INF"/> <!-- AS 4/29/02 Do not validate XML files because JBoss 3.0 message driven will report an wrong error because it uses the wrong jboss.dtd --> ! <jboss version="${jboss.version}" ! xmlencoding="UTF-8" ! typemapping="${type.mapping}" ! datasource="${datasource.name}" ! destdir="${build.generate.ejb-conf}/META-INF" ! validateXml="false" ! /> </ejbdoclet> <taskdef ! name="webdoclet" ! classname="xdoclet.web.WebDocletTask" ! > <classpath refid="xdoclet.path"/> </taskdef> --- 182,235 ---- <!-- =================================================================== --> ! <target name="xdoclet-generate-ejb" depends="init,prepare"> ! <taskdef ! name="ejbdoclet" ! classname="xdoclet.modules.ejb.EjbDocletTask"> <classpath refid="xdoclet.path"/> </taskdef> ! ! <ejbdoclet ! destdir="${build.generate.dir}" ! force="${xdoclet.force}"> ! <fileset dir="${src.dir}"/> ! <packageSubstitution ! packages="sessionjb,entityjb" ! substituteWith="interfaces"/> ! <dataobject/> + <entitypk/> <remoteinterface/> ! <localinterface/> <homeinterface/> <localhomeinterface/> <entitycmp/> <session/> <valueobject/> + <utilobject/> + <!-- Beans Deployment descriptor --> ! <deploymentdescriptor ! destdir="${build.generate.ejb-conf}/META-INF"/> <!-- AS 4/29/02 Do not validate XML files because JBoss 3.0 message driven will report an wrong error because it uses the wrong jboss.dtd --> ! <jboss ! version="${jboss.version}" ! xmlencoding="UTF-8" ! typemapping="${type.mapping}" ! datasource="${datasource.name}" ! destdir="${build.generate.ejb-conf}/META-INF" ! validateXml="false" /> </ejbdoclet> + </target> + + <target name="xdoclet-generate-web" depends="init,prepare"> <taskdef ! name="webdoclet" ! classname="xdoclet.modules.web.WebDocletTask"> <classpath refid="xdoclet.path"/> </taskdef> *************** *** 252,280 **** <webdoclet ! sourcepath="${src.ejb.dir}" ! destdir="${build.generate.web-conf}/WEB-INF" ! classpathref="base.path" ! excludedtags="@version,@author" ! force="${xdoclet.force}" ! mergedir="${src.resources.dir}/xdoclet" ! > ! <fileset dir="${src.ejb.dir}"> ! <include name="**/*Action.java"/> ! </fileset> ! <fileset dir="${src.ejb.dir}"> ! <include name="**/*Bean.java"/> ! </fileset> ! <fileset dir="${src.ejb.dir}"> ! <include name="**/*Servlet.java"/> ! </fileset> <deploymentdescriptor ! displayname="ProlixWebClient" ! description="Second approach to web client" ! sessiontimeout="30"> <contextparam name="ProlixMain" ! value="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain"> ! </contextparam> <!-- XSLT tags --> --- 240,258 ---- <webdoclet ! destdir="${build.generate.web-conf}/WEB-INF" ! excludedtags="@version,@author" ! force="${xdoclet.force}" ! mergedir="${src.resources.dir}/xdoclet"> ! ! <fileset dir="${src.dir}"/> <deploymentdescriptor ! displayname="ProlixWebClient" ! description="Second approach to web client" ! sessiontimeout="30"> ! <contextparam name="ProlixMain" ! value="org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMain"/> <!-- XSLT tags --> *************** *** 356,362 **** <!-- =================================================================== --> ! <target name="compile" depends="xdoclet-generate"> ! <mkdir dir="${build.classes.dir}"/> ! <mkdir dir="${build.generate.dir}"/> <javac destdir="${build.classes.dir}" --- 334,338 ---- <!-- =================================================================== --> ! <target name="compile" depends="prepare,xdoclet-generate-ejb,xdoclet-generate-web"> <javac destdir="${build.classes.dir}" *************** *** 366,370 **** classpathref="base.path" > ! <src path="${src.ejb.dir}"/> <src path="${build.generate.dir}"/> </javac> --- 342,346 ---- classpathref="base.path" > ! <src path="${src.dir}"/> <src path="${build.generate.dir}"/> </javac> *************** *** 376,383 **** <!-- =================================================================== --> ! <target name="jar" depends="prepare-build,package-webclient,package-server,package-consoleclient"> </target> ! <target name="prepare-build"> <mkdir dir="${dist.dir}"/> </target> --- 352,361 ---- <!-- =================================================================== --> ! <target name="jar" depends="package-webclient,package-server,package-consoleclient"> </target> ! <target name="prepare"> ! <mkdir dir="${build.classes.dir}"/> ! <mkdir dir="${build.generate.dir}"/> <mkdir dir="${dist.dir}"/> </target> *************** *** 458,463 **** todir="${build.classes.dir}/${package.path}/web"/> - - <!-- Doing the same with war-task --> <war warfile="${dist.dir}/${war.file}" webxml="${build.generate.web-conf}/WEB-INF/web.xml" --- 436,439 ---- *************** *** 481,488 **** dir="${build.generate.web-conf}/WEB-INF" includes="*.xml" > </webinf> </war> - </target> --- 457,464 ---- dir="${build.generate.web-conf}/WEB-INF" includes="*.xml" + excludes="**/web.xml" > </webinf> </war> </target> |
From: <iva...@us...> - 2003-08-05 19:17:09
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb In directory sc8-pr-cvs1:/tmp/cvs-serv9346/src/org/asturlinux/frade/prolix/ejb/sessionjb Modified Files: ProlixMainBean.java Added Files: TransformationControl.java TreeTraversors.java Log Message: Refactorized ProlixMainBean. Moved traversors code and transformations to xml control to auxiliar classes --- NEW FILE: TransformationControl.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import org.asturlinux.frade.dummy.*; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import org.asturlinux.frade.prolix.interpreter.interfaces.*; public class TransformationControl { public String transformToSolutionXml(TreeElement tree) { Writer writer = new StringWriter(); try { // FIXME: generate appropiate xml headers (<?xml> and doctype) // generate opening tag if ( tree.isCompletlyExplored() ) writer.write("<tree completelyExplored=\"yes\">\n"); else writer.write("<tree>\n"); SimpleXmlVisitor visitor = new SimpleXmlVisitor(writer); // process recursively the tree TreeTraversors tt = new TreeTraversors(); tt.visitPreOrder(tree,visitor); // generate end tag writer.write("</tree>\n"); } catch(java.io.IOException ex) { ex.printStackTrace(); } return writer.toString(); } public String transformToTreeXml(TreeElement tree) { Writer nodes = new StringWriter(); Writer transitions = new StringWriter(); try { // FIXME: generate appropiate xml headers (<?xml> and doctype) // generate opening tag if ( tree.isCompletlyExplored() ) nodes.write("<tree completelyExplored=\"yes\">\n"); else nodes.write("<tree completelyExplored=\"no\">\n"); TreeXmlVisitor visitor = new TreeXmlVisitor(nodes,transitions); // process recursively the tree TreeTraversors tt = new TreeTraversors(); tt.visitPreOrder(tree,visitor); // generate end tag transitions.write("</tree>\n"); nodes.write(transitions.toString()); } catch(java.io.IOException ex) { System.out.println("ERROR: ProlixMainBean - Something wrong with StringWriters"); } return nodes.toString(); } } --- NEW FILE: TreeTraversors.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.sessionjb; import org.asturlinux.frade.dummy.*; import org.asturlinux.frade.prolix.interpreter.interfaces.*; public class TreeTraversors { /** * Apply visitor to last node in tree */ public void visitLastNode(TreeElement tree, TreeElementVisitor visitor) { // FIXME: Could be better not use recursivity TreeElement[] sons = tree.getNextLevelElements(); // FIXME: dont must be required check if sons == null if ( sons != null ) { if ( sons.length > 0 ) visitLastNode(sons[sons.length-1],visitor); else tree.accept(visitor); } else tree.accept(visitor); return; } /** * Apply visitor to all nodes in tree using inorder path */ public void visitPostOrder(TreeElement tree, TreeElementVisitor visitor) { /** * recursive pattern */ if (tree == null) return; TreeElement[] sons = tree.getNextLevelElements(); if (sons != null) //FIXME: Must not be required { for (int i = 0; i < sons.length; i++) visitPostOrder(sons[i],visitor); } /** * node "treatment" using visitor pattern. * visitor write node's xml. */ System.out.println("DEBUG: Exploring node: " + tree.getQuery()); tree.accept(visitor); } public void visitPreOrder(TreeElement tree, TreeElementVisitor visitor) { /** * recursive pattern */ if (tree == null) return; /** * Node treatmet */ tree.accept(visitor); TreeElement[] sons = tree.getNextLevelElements(); if (sons != null) //FIXME: Must not be required { for (int i = 0; i < sons.length; i++) visitPreOrder(sons[i],visitor); } } } Index: ProlixMainBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMainBean.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ProlixMainBean.java 3 Aug 2003 21:35:32 -0000 1.28 --- ProlixMainBean.java 5 Aug 2003 19:17:06 -0000 1.29 *************** *** 78,82 **** throws LexicalException, SyntaxException, NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Guest); _program = program; --- 78,82 ---- throws LexicalException, SyntaxException, NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Student); _program = program; *************** *** 156,168 **** TreeElement treeResult; do { treeResult = prologCtx.step(); ! visitLastNode(treeResult,visitor); } while (!visitor.getIsSolution() && !treeResult.isCompletlyExplored()); setLastSolution(treeResult.isCompletlyExplored()); ! return transformToTreeXml(treeResult); } --- 156,170 ---- TreeElement treeResult; + TreeTraversors tt = new TreeTraversors(); do { treeResult = prologCtx.step(); ! tt.visitLastNode(treeResult,visitor); } while (!visitor.getIsSolution() && !treeResult.isCompletlyExplored()); setLastSolution(treeResult.isCompletlyExplored()); ! TransformationControl tc = new TransformationControl(); ! return tc.transformToTreeXml(treeResult); } *************** *** 185,189 **** // FIXME: cache results ! return transformToTreeXml(treeResult); } --- 187,192 ---- // FIXME: cache results ! TransformationControl tc = new TransformationControl(); ! return tc.transformToTreeXml(treeResult); } *************** *** 230,384 **** } - /** *************************************************** - * Transformation control - ** ***************************************************/ - - - private String transformToSolutionXml(TreeElement tree) - { - Writer writer = new StringWriter(); - - try - { - - // FIXME: generate appropiate xml headers (<?xml> and doctype) - - // generate opening tag - if ( tree.isCompletlyExplored() ) - writer.write("<tree completelyExplored=\"yes\">\n"); - else - writer.write("<tree>\n"); - - SimpleXmlVisitor visitor = - new SimpleXmlVisitor(writer); - - // process recursively the tree - visitPreOrder(tree,visitor); - - // generate end tag - writer.write("</tree>\n"); - - } - catch(java.io.IOException ex) - { - ex.printStackTrace(); - } - - return writer.toString(); - } - - private String transformToTreeXml(TreeElement tree) - { - Writer nodes = new StringWriter(); - Writer transitions = new StringWriter(); - try { - - // FIXME: generate appropiate xml headers (<?xml> and doctype) - - // generate opening tag - if ( tree.isCompletlyExplored() ) - nodes.write("<tree completelyExplored=\"yes\">\n"); - else - nodes.write("<tree completelyExplored=\"no\">\n"); - - - TreeXmlVisitor visitor = - new TreeXmlVisitor(nodes,transitions); - - // process recursively the tree - visitPreOrder(tree,visitor); - - // generate end tag - transitions.write("</tree>\n"); - nodes.write(transitions.toString()); - } - catch(java.io.IOException ex) { - System.out.println("ERROR: ProlixMainBean - Something wrong with StringWriters"); - } - return nodes.toString(); - - } - - - /** ************************************************ - * Paths - * ************************************************/ - - - /** - * Apply visitor to last node in tree - */ - private void visitLastNode(TreeElement tree, TreeElementVisitor visitor) - { - - // FIXME: Could be better not use recursivity - TreeElement[] sons = tree.getNextLevelElements(); - - // FIXME: dont must be required check if sons == null - if ( sons != null ) - { - if ( sons.length > 0 ) - visitLastNode(sons[sons.length-1],visitor); - else - tree.accept(visitor); - } - else - tree.accept(visitor); - - return; - } - - /** - * Apply visitor to all nodes in tree using inorder path - */ - private void visitPostOrder(TreeElement tree, TreeElementVisitor visitor) - { - /** - * recursive pattern - */ - - if (tree == null) - return; - - TreeElement[] sons = tree.getNextLevelElements(); - if (sons != null) //FIXME: Must not be required - { - for (int i = 0; i < sons.length; i++) - visitPostOrder(sons[i],visitor); - } - /** - * node "treatment" using visitor pattern. - * visitor write node's xml. - */ - System.out.println("DEBUG: Exploring node: " + tree.getQuery()); - tree.accept(visitor); - } - - private void visitPreOrder(TreeElement tree, TreeElementVisitor visitor) - { - /** - * recursive pattern - */ - - if (tree == null) - return; - - /** - * Node treatmet - */ - tree.accept(visitor); - - TreeElement[] sons = tree.getNextLevelElements(); - if (sons != null) //FIXME: Must not be required - { - for (int i = 0; i < sons.length; i++) - visitPreOrder(sons[i],visitor); - } - } - - /** ************************************** - * Activate - Pasivate Methods - * **************************************/ - /** --- 233,236 ---- *************** *** 398,405 **** } - /* *********************************** - * Login Logout methods - ********************************** **/ private UserLocal loggedUser = null; --- 250,257 ---- } + /** ************************************* + * Login / Logout methods + * **************************************/ private UserLocal loggedUser = null; *************** *** 450,459 **** } ! private void verifyPermissions(String required) throws NotEnoughtPermissionsException { if (! loggedUser.getPermissions().matches("*"+required+"*")) throw new NotEnoughtPermissionsException(); } - } --- 302,318 ---- } ! public void verifyPermissions(String required) throws NotEnoughtPermissionsException { + if (loggedUser == null) + { + if (required.equals(Permissions.Student)) + return; + else + throw new NotEnoughtPermissionsException(); + } + if (! loggedUser.getPermissions().matches("*"+required+"*")) throw new NotEnoughtPermissionsException(); } } |
From: <iva...@us...> - 2003-08-03 21:35:35
|
Update of /cvsroot/pfc-prolog/prolix/web In directory sc8-pr-cvs1:/tmp/cvs-serv22275/web Modified Files: login.jsp Log Message: Updated users management schema - Addded Permissions class with constants Index: login.jsp =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/web/login.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** login.jsp 3 Aug 2003 14:44:02 -0000 1.1 --- login.jsp 3 Aug 2003 21:35:32 -0000 1.2 *************** *** 67,70 **** --- 67,77 ---- <html:reset> <bean:message key="button.clear"/></html:reset> </html:form> + + <br>Este seria el enlace para registrarte: (un form a una pagina de registro donde te pide nombre, apellidos, e-mail, username y passwd + <br><bean:message key="message.registry.now"/> + + <br>Este seria el enlace para entrar como invitado: (con un form tonto) + <br><bean:message key="message.free.acess"/> + <html:errors/> </body> |
From: <iva...@us...> - 2003-08-03 21:35:35
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb In directory sc8-pr-cvs1:/tmp/cvs-serv22275/src/org/asturlinux/frade/prolix/ejb/entityjb Modified Files: UserBean.java Added Files: Permissions.java Log Message: Updated users management schema - Addded Permissions class with constants --- NEW FILE: Permissions.java --- /** * * Copyright 2003 Ivan Frade * * This file is part of Prolix. * * Prolix is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Prolix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prolix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ package org.asturlinux.frade.prolix.ejb.entityjb; public class Permissions { public static final String Administrator = "administrator"; public static final String Professor = "professor"; public static final String Guest = "guest"; public static final String Student = "student"; } Index: UserBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/entityjb/UserBean.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UserBean.java 2 Aug 2003 20:22:58 -0000 1.3 --- UserBean.java 3 Aug 2003 21:35:32 -0000 1.4 *************** *** 53,60 **** * * @jboss.jdbc-type VARCHAR ! * @jboss.sql-type VARCHAR(10) * */ - public abstract String getUser(); --- 53,59 ---- * * @jboss.jdbc-type VARCHAR ! * @jboss.sql-type VARCHAR(100) * */ public abstract String getUser(); *************** *** 67,71 **** * * @jboss.jdbc-type VARCHAR ! * @jboss.sql-type VARCHAR(10) * */ --- 66,70 ---- * * @jboss.jdbc-type VARCHAR ! * @jboss.sql-type VARCHAR(100) * */ *************** *** 73,76 **** --- 72,89 ---- public abstract void setPass(String newPass); + + + /** + * @ejb.persistent-field + * @ejb.interface-method + * + * @jboss.jdbc-type VARCHAR + * @jboss.sql-type VARCHAR(100) + * + */ + public abstract String getPermissions(); + + public abstract void setPermissions(String newPermissions); + /** |
From: <iva...@us...> - 2003-08-03 21:35:35
|
Update of /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb In directory sc8-pr-cvs1:/tmp/cvs-serv22275/src/org/asturlinux/frade/prolix/ejb/sessionjb Modified Files: ProlixMainBean.java Log Message: Updated users management schema - Addded Permissions class with constants Index: ProlixMainBean.java =================================================================== RCS file: /cvsroot/pfc-prolog/prolix/src/org/asturlinux/frade/prolix/ejb/sessionjb/ProlixMainBean.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ProlixMainBean.java 2 Aug 2003 20:28:18 -0000 1.27 --- ProlixMainBean.java 3 Aug 2003 21:35:32 -0000 1.28 *************** *** 35,38 **** --- 35,39 ---- import org.asturlinux.frade.prolix.ejb.interfaces.UserLocalHome; import org.asturlinux.frade.prolix.ejb.interfaces.UserLocal; + import org.asturlinux.frade.prolix.ejb.entityjb.Permissions; /** *************** *** 77,81 **** throws LexicalException, SyntaxException, NotEnoughtPermissionsException { ! verifyPermissions(); _program = program; --- 78,82 ---- throws LexicalException, SyntaxException, NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Guest); _program = program; *************** *** 122,126 **** ProgramNotLoadedException, NotEnoughtPermissionsException { ! verifyPermissions(); _consult = consult; --- 123,127 ---- ProgramNotLoadedException, NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Student); _consult = consult; *************** *** 150,154 **** NotEnoughtPermissionsException { ! verifyPermissions(); CheckSolutionVisitor visitor = new CheckSolutionVisitor(); --- 151,155 ---- NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Student); CheckSolutionVisitor visitor = new CheckSolutionVisitor(); *************** *** 174,178 **** NotEnoughtPermissionsException { ! verifyPermissions(); TreeElement treeResult = prologCtx.step(); --- 175,179 ---- NotEnoughtPermissionsException { ! verifyPermissions(Permissions.Student); TreeElement treeResult = prologCtx.step(); *************** *** 449,457 **** } ! private void verifyPermissions() throws NotEnoughtPermissionsException { ! //FIXME: Very simple permission schema ! if (loggedUser == null) throw new NotEnoughtPermissionsException(); } --- 450,457 ---- } ! private void verifyPermissions(String required) throws NotEnoughtPermissionsException { ! if (! loggedUser.getPermissions().matches("*"+required+"*")) throw new NotEnoughtPermissionsException(); } |