[gee-svn] SF.net SVN: gabel: [183] trunk/gee/war/ajax
Status: Alpha
Brought to you by:
alllee
|
From: <al...@us...> - 2006-05-24 18:18:26
|
Revision: 183 Author: alllee Date: 2006-05-24 11:17:59 -0700 (Wed, 24 May 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=183&view=rev Log Message: ----------- adding Sessions, AuthenticationTokens, GeeAdministrators to the admin portion of the webapp. Still refining the ExperimentConfiguration fiasco, need to make a concrete page that lets you create/edit/delete experiment configurations and consent forms soon. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java trunk/gee/src/java/edu/indiana/psych/gee/dao/ExperimentConfigurationDao.java trunk/gee/src/java/edu/indiana/psych/gee/dao/HibernateExperimentConfigurationDao.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java trunk/gee/war/WEB-INF/applicationContext.xml trunk/gee/war/WEB-INF/classes/gee-admin.xml trunk/gee/war/WEB-INF/classes/webwork.properties trunk/gee/war/admin/listExperiments.jsp trunk/gee/war/ajax/status.ajax trunk/gee/war/includes/header.jsp Added Paths: ----------- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/bean/AuthenticationToken.java trunk/gee/src/java/edu/indiana/psych/gee/bean/GeeAdministrator.java trunk/gee/src/java/edu/indiana/psych/gee/session/ trunk/gee/src/java/edu/indiana/psych/gee/session/SessionData.java trunk/gee/src/java/edu/indiana/psych/gee/session/SessionDataAware.java Removed Paths: ------------- trunk/gee/src/java/edu/indiana/psych/gee/action/AdminAction.java Modified: trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-05-24 18:17:59 UTC (rev 183) @@ -1,7 +1,5 @@ package edu.indiana.psych.gee; -import java.util.List; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -10,8 +8,8 @@ import edu.indiana.psych.gee.event.EventChannel; import edu.indiana.psych.gee.net.DispatcherFactory; import edu.indiana.psych.gee.net.ServerDispatcher; +import edu.indiana.psych.gee.service.ExperimentConfigurationService; import edu.indiana.psych.gee.service.ExperimentService; -import edu.indiana.psych.gee.service.ExperimentConfigurationService; import edu.indiana.psych.gee.time.Duration; /** @@ -38,8 +36,10 @@ private String name; private C configuration; - private ExperimentRoundParameters currentParameters; +// private ExperimentRoundParameters currentParameters; + private C defaultConfiguration; + public AbstractExperiment() { channel = new EventChannel(); dispatcher = DispatcherFactory.getInstance().createServerDispatcher(channel); @@ -59,6 +59,15 @@ } this.configuration = configuration; } + + public C getDefaultConfiguration() { + return defaultConfiguration; + } + + public void setDefaultConfiguration(C defaultConfiguration) { + this.defaultConfiguration = defaultConfiguration; + } + public synchronized void start() throws ExperimentLifecycleException { if ( isRunning() ) { @@ -143,20 +152,8 @@ // XXX: not using Iterators here because that'd impose // call-only-once semantics unless we jumped more hoops public String getNextRoundInstructions() { - if (currentParameters == null) { - currentParameters = configuration.getCurrentParameters(); - if (currentParameters == null) { - // FIXME: allow the user to specify configuration here instead - // of throwing an exception. - throw new ExperimentLifecycleException("No experimental rounds have been configured."); - } - return currentParameters.getSpecialInstructions(); - } - // need a non-mutating way to access the special instructions on deck. - List<ExperimentRoundParameters> allParameters = configuration.getAllParameters(); - int nextIndex = (allParameters.indexOf(currentParameters) + 1) % allParameters.size(); -// nextIndex = nextIndex % allParameters.size(); - return allParameters.get(nextIndex).getSpecialInstructions(); + return configuration.getNextRoundInstructions(); + } public void setExperimentService(ExperimentService experimentService) { @@ -164,6 +161,15 @@ this.experimentService.remove(this); } this.experimentService = experimentService; + if (configuration == null) { + configuration = getDefaultConfiguration(); + if (configuration == null) { + // no default configuration available either.. don't add this experiment to the + // experiment service! + getLogger().warn("No configurations available for: " + this); + return; + } + } experimentService.add(this); } @@ -203,4 +209,8 @@ } }); } + + public void setConfigurationService(ExperimentConfigurationService configurationService) { +// this.configurationService = configurationService; + } } Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-05-24 18:17:59 UTC (rev 183) @@ -9,13 +9,16 @@ /** * $Id: Exp $ * - * + * All GEE experiment configurations should follow this contract. * * @author <a href='al...@cs...'>Allen Lee</a> * @version $Revision: $ */ public interface ExperimentConfiguration<T extends ExperimentRoundParameters> { + + public Long getId(); + public void setId(Long id); public List<T> getAllParameters(); public void setAllParameters(List<T> allParameters); @@ -37,6 +40,8 @@ public String getDescription(); public void setDescription(String description); + + public String getNextRoundInstructions(); public boolean isTriggeredExperiment(); public void setTriggeredExperiment(boolean triggered); @@ -44,7 +49,3 @@ public InetSocketAddress getServerAddress(); } -/* - * $Log: $ - */ - Deleted: trunk/gee/src/java/edu/indiana/psych/gee/action/AdminAction.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/AdminAction.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/AdminAction.java 2006-05-24 18:17:59 UTC (rev 183) @@ -1,95 +0,0 @@ -package edu.indiana.psych.gee.action; - -import java.util.List; -import java.util.Set; - -import edu.indiana.psych.gee.Experiment; -import edu.indiana.psych.gee.ExperimentConfiguration; -import edu.indiana.psych.gee.ExperimentRoundParameters; - -/** - * $Id$ - * - * Allows the user to administer experiments. Administrative actions include - * configuring, starting and stopping experiments as well as attaching to - * experiments as a bystander and viewing experiment statuses. - * - * @author <a href='al...@cs...'>Allen Lee</a> - * @version $Revision$ - */ - -@SuppressWarnings("serial") -public class AdminAction extends GeeAction { - - - private Set<Experiment> experiments; - private Experiment experiment; - private String experimentName; - - private ExperimentConfiguration configuration; - - public String authenticate() { - - return SUCCESS; - } - - public String configure() { - for (ExperimentRoundParameters parameter: getAllParameters()) { - getLogger().warn("XXX: Returning: " + parameter); - } - // load experiment and various pieces of configuration information? - return SUCCESS; - } - - public String start() { - getLogger().debug("Starting: " + experimentName); - getExperiment().start(); - return SUCCESS; - } - - public String status() { - getLogger().debug("Retrieving status for: " + experimentName); - return SUCCESS; - } - - public String stop() { - Experiment experiment = getExperiment(); - getLogger().debug("Stopping: " + experimentName + ": " + experiment); - experiment.stop(); - return SUCCESS; - } - - public String listExperiments() { - return SUCCESS; - } - - public String createExperiment() { - - return SUCCESS; - } - - public ExperimentConfiguration getConfiguration() { - return getExperiment().getConfiguration(); - } - - public List<? extends ExperimentRoundParameters> getAllParameters() { - return getConfiguration().getAllParameters(); - } - - public Set<Experiment> getExperiments() { - if (experiments == null || experiments.isEmpty()) { - experiments = getExperimentService().getAllExperiments(); - } - return experiments; - } - - public Experiment getExperiment() { - return experiment; - } - - public void setExperimentName(String experimentName) { - this.experimentName = experimentName; - this.experiment = getExperimentService().find(experimentName); - } - -} Copied: trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java (from rev 182, trunk/gee/src/java/edu/indiana/psych/gee/action/AdminAction.java) =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,95 @@ +package edu.indiana.psych.gee.action; + +import java.util.List; +import java.util.Set; + +import edu.indiana.psych.gee.Experiment; +import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentRoundParameters; + +/** + * $Id$ + * + * Allows the user to administer experiments. Administrative actions include + * configuring, starting and stopping experiments as well as attaching to + * experiments as a bystander and viewing experiment statuses. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision$ + */ + +@SuppressWarnings("serial") +public class ManageExperiment extends GeeAction { + + + private Set<Experiment> experiments; + private Experiment experiment; + private String experimentName; + + private ExperimentConfiguration configuration; + + public String authenticate() { + + return SUCCESS; + } + + public String configure() { + for (ExperimentRoundParameters parameter: getAllParameters()) { + getLogger().warn("XXX: Returning: " + parameter); + } + // load experiment and various pieces of configuration information? + return SUCCESS; + } + + public String start() { + getLogger().debug("Starting: " + experimentName); + getExperiment().start(); + return NONE; + } + + public String status() { + getLogger().debug("Retrieving status for: " + experimentName); + return SUCCESS; + } + + public String stop() { + Experiment experiment = getExperiment(); + getLogger().debug("Stopping: " + experimentName + ": " + experiment); + experiment.stop(); + return NONE; + } + + public String listExperiments() { + return SUCCESS; + } + + public String createExperiment() { + + return SUCCESS; + } + + public ExperimentConfiguration getConfiguration() { + return getExperiment().getConfiguration(); + } + + public List<? extends ExperimentRoundParameters> getAllParameters() { + return getConfiguration().getAllParameters(); + } + + public Set<Experiment> getExperiments() { + if (experiments == null || experiments.isEmpty()) { + experiments = getExperimentService().getAllExperiments(); + } + return experiments; + } + + public Experiment getExperiment() { + return experiment; + } + + public void setExperimentName(String experimentName) { + this.experimentName = experimentName; + this.experiment = getExperimentService().find(experimentName); + } + +} Added: trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,36 @@ +package edu.indiana.psych.gee.action; + +import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentRoundParameters; + +/** + * $Id$ + * + * WebWork Action used to manage experiment configurations. + * + * @author <a href='ano...@gm...'>Allen Lee</a> + * @version $Revision$ + */ + +@SuppressWarnings("serial") +public class ManageExperimentConfiguration extends GeeAction { + + private ExperimentConfiguration<? extends ExperimentRoundParameters> configuration; + + public String save() { + getConfigurationService().persist(configuration); + return SUCCESS; + } + + public String delete() { + getConfigurationService().delete(configuration); + return SUCCESS; + } + + + + public void setConfiguration(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { + this.configuration = configuration; + } + +} Property changes on: trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java ___________________________________________________________________ Name: svn:keywords + Date Revision Id Added: trunk/gee/src/java/edu/indiana/psych/gee/bean/AuthenticationToken.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/bean/AuthenticationToken.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/bean/AuthenticationToken.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,78 @@ +package edu.indiana.psych.gee.bean; + +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * $Id$ + * + * A persistent token used to mark all data submitted by a given user. + * + * @author <a href='ano...@gm...'>Allen Lee</a> + * @version $Revision$ + */ + +@Entity +@Table(name = "gee_administrator_sessions") +public class AuthenticationToken { + + public final static AuthenticationToken INVALID = new AuthenticationToken(); + + private Long id = Long.valueOf(-1); + + private GeeAdministrator geeAdministrator; + + private Date creationTime; + + public static AuthenticationToken create(GeeAdministrator user) { + if (user == null) { + throw new IllegalArgumentException( + "Attempt to create an AuthenticationToken with a null User."); + } + AuthenticationToken token = new AuthenticationToken(); + token.setGeeAdministrator(user); + token.setCreationTime(new Date()); + return token; + } + + @Temporal(TemporalType.TIMESTAMP) + public Date getCreationTime() { + return creationTime; + } + + public void setCreationTime(Date date) { + this.creationTime = date; + } + + @Id + @GeneratedValue + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @ManyToOne + public GeeAdministrator getGeeAdministrator() { + return geeAdministrator; + } + + public void setGeeAdministrator(GeeAdministrator user) { + this.geeAdministrator = user; + } + + @Transient + public boolean isValid() { + return this != INVALID && geeAdministrator != null; + } +} Property changes on: trunk/gee/src/java/edu/indiana/psych/gee/bean/AuthenticationToken.java ___________________________________________________________________ Name: svn:keywords + Date Revision Id Modified: trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java 2006-05-24 18:17:59 UTC (rev 183) @@ -13,6 +13,8 @@ import javax.persistence.Table; import javax.persistence.Transient; +import org.hibernate.annotations.Proxy; + import edu.indiana.psych.gee.ExperimentConfiguration; import edu.indiana.psych.gee.ExperimentLifecycleException; import edu.indiana.psych.gee.ExperimentRoundParameters; @@ -33,6 +35,7 @@ @Entity @Inheritance(strategy=InheritanceType.JOINED) @Table(name="experiment_configuration") +@Proxy(proxyClass=ExperimentConfiguration.class) public abstract class ExperimentConfigurationEntity<T extends ExperimentRoundParameters> implements ExperimentConfiguration<T> { @@ -137,6 +140,20 @@ } return currentParameters; } + + @Transient + public synchronized String getNextRoundInstructions() { + if (currentParameters == null) { + return getAllParameters().get(0).getSpecialInstructions(); + } + return currentParameters.getSpecialInstructions(); + } +// need a non-mutating way to access the special instructions on deck. +// List<ExperimentRoundParameters> allParameters = configuration.getAllParameters(); +// int nextIndex = (allParameters.indexOf(currentParameters) + 1) % allParameters.size(); +// nextIndex = nextIndex % allParameters.size(); +// return allParameters.get(nextIndex).getSpecialInstructions(); +// } public String getClientJarName() { return clientJarName; Added: trunk/gee/src/java/edu/indiana/psych/gee/bean/GeeAdministrator.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/bean/GeeAdministrator.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/bean/GeeAdministrator.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,159 @@ +package edu.indiana.psych.gee.bean; + +import java.util.Date; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * $Id$ + * + * Represents an gee administrator that has the ability to perform any operation under the + * admin namespace. At the moment this includes start/stop experiments, modify + * experiment configuration information. + * + * @author <a href='ano...@gm...'>Allen Lee</a> + * @version $Revision$ + */ + +@Entity +@Table(name = "gee_administrator") +public class GeeAdministrator { + + @Id + @GeneratedValue + private Long id = Long.valueOf(-1); + + @Temporal(TemporalType.TIMESTAMP) + @Column(nullable = false) + private Date dateCreated; + + @Column(nullable = false) + private String firstName; + + @Column(nullable = false) + private String lastName; + + private String middleInitial; + + @Column(nullable = false) + private String emailAddress; + + @Column(nullable = false) + private String institution; + + @Column(nullable = false, unique = true) + private String username; + + @OneToMany(mappedBy = "geeAdministrator") + private Set<AuthenticationToken> userSessions; + private String password; + private transient String passwordConfirmation; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + @Transient + public String getFullName() { + return String.format("%s %s. %s", firstName, middleInitial, + lastName, username); + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getInstitution() { + return institution; + } + + public void setInstitution(String institution) { + this.institution = institution; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getMiddleInitial() { + return middleInitial; + } + + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public String getPasswordConfirmation() { + return passwordConfirmation; + } + + public void setPasswordConfirmation(String passwordConfirmation) { + this.passwordConfirmation = passwordConfirmation; + } + + public Set<AuthenticationToken> getUserSessions() { + return userSessions; + } + + public void setUserSessions(Set<AuthenticationToken> userSessions) { + this.userSessions = userSessions; + } + + public String toString() { + return getFullName(); + } + +} Property changes on: trunk/gee/src/java/edu/indiana/psych/gee/bean/GeeAdministrator.java ___________________________________________________________________ Name: svn:keywords + Date Revision Id Modified: trunk/gee/src/java/edu/indiana/psych/gee/dao/ExperimentConfigurationDao.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/dao/ExperimentConfigurationDao.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/dao/ExperimentConfigurationDao.java 2006-05-24 18:17:59 UTC (rev 183) @@ -3,6 +3,7 @@ import org.springframework.transaction.annotation.Transactional; import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentRoundParameters; /** * $Id$ @@ -17,10 +18,12 @@ @Transactional public interface ExperimentConfigurationDao { - public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Integer id); + public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Long id); public <E extends ExperimentConfiguration> E find(final Class<E> configurationClass, final String experimentName); - public void persist(ExperimentConfiguration configuration); + public void persist(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration); + + public void delete(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration); } Modified: trunk/gee/src/java/edu/indiana/psych/gee/dao/HibernateExperimentConfigurationDao.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/dao/HibernateExperimentConfigurationDao.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/dao/HibernateExperimentConfigurationDao.java 2006-05-24 18:17:59 UTC (rev 183) @@ -10,6 +10,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentRoundParameters; /** * $Id: Exp $ @@ -25,7 +26,7 @@ private final Log logger = LogFactory.getLog(getClass()); - public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Integer id) { + public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Long id) { return configurationClass.cast(getHibernateTemplate().get(configurationClass, id)); } @@ -33,7 +34,6 @@ return configurationClass.cast( getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { - logger.warn("doInHibernate session is: " + session.hashCode()); Criteria criteria = session.createCriteria(configurationClass); criteria.add(Restrictions.eq("experimentName", experimentName)); return criteria.uniqueResult(); @@ -41,8 +41,12 @@ })); } - public void persist(ExperimentConfiguration configuration) { - getHibernateTemplate().saveOrUpdate(configuration); + public void persist(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { + getHibernateTemplate().saveOrUpdate(configuration); } + public void delete(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { + getHibernateTemplate().delete(configuration); + } + } Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-05-24 18:17:59 UTC (rev 183) @@ -8,8 +8,10 @@ import javax.persistence.OneToMany; import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; -import javax.persistence.Transient; +import org.hibernate.annotations.Proxy; + +import edu.indiana.psych.gee.ExperimentConfiguration; import edu.indiana.psych.gee.bean.ExperimentConfigurationEntity; /** @@ -24,11 +26,11 @@ @Entity @PrimaryKeyJoinColumn(name="experiment_configuration_id") @Table(name="forager_configuration") +@Proxy(proxyClass=ExperimentConfiguration.class) public class ForagerConfiguration extends ExperimentConfigurationEntity<ForagerExperimentParameters> { private List<ForagerExperimentParameters> allParameters; - public ForagerConfiguration() { } Modified: trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java 2006-05-24 18:17:59 UTC (rev 183) @@ -1,6 +1,7 @@ package edu.indiana.psych.gee.service; import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentRoundParameters; import edu.indiana.psych.gee.dao.ExperimentConfigurationDao; /** @@ -18,8 +19,10 @@ private ExperimentConfigurationDao experimentConfigurationDao; // private ConsentFormDao consentFormDao; + - public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Integer id) { + + public <E extends ExperimentConfiguration> E find(Class<E> configurationClass, Long id) { return experimentConfigurationDao.find(configurationClass, id); } @@ -38,9 +41,13 @@ return experimentConfigurationDao.find(configurationClass, experimentName); } - public void persist(ExperimentConfiguration configuration) { + public void persist(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { experimentConfigurationDao.persist(configuration); } + + public void delete(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { + experimentConfigurationDao.delete(configuration); + } public void setExperimentConfigurationDao(ExperimentConfigurationDao experimentConfigurationDao) { this.experimentConfigurationDao = experimentConfigurationDao; Added: trunk/gee/src/java/edu/indiana/psych/gee/session/SessionData.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/session/SessionData.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/session/SessionData.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,40 @@ +package edu.indiana.psych.gee.session; + +import edu.indiana.psych.gee.bean.AuthenticationToken; +import edu.indiana.psych.gee.bean.GeeAdministrator; + +/** + * $Id$ + * + * This class maintains all necessary state for a given session with a User. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision$ + */ + +public class SessionData { + + private AuthenticationToken authenticationToken; + + public GeeAdministrator getUser() { + return (isAuthenticated()) + ? authenticationToken.getGeeAdministrator() + : null; + } + + public AuthenticationToken getAuthenticationToken() { + return authenticationToken; + } + + public void clearAuthenticationToken() { + authenticationToken = null; + } + + public void setAuthenticationToken(AuthenticationToken token) { + this.authenticationToken = token; + } + + public boolean isAuthenticated() { + return authenticationToken != null && authenticationToken.isValid(); + } +} Property changes on: trunk/gee/src/java/edu/indiana/psych/gee/session/SessionData.java ___________________________________________________________________ Name: svn:keywords + Date Revision Id Added: trunk/gee/src/java/edu/indiana/psych/gee/session/SessionDataAware.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/session/SessionDataAware.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/session/SessionDataAware.java 2006-05-24 18:17:59 UTC (rev 183) @@ -0,0 +1,39 @@ +package edu.indiana.psych.gee.session; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * $Id$ + * + * This interface marks all classes that should be given a piece of SessionData. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision$ + */ + +public interface SessionDataAware { + + public void setSessionData(SessionData data); + + + public static abstract class Base implements SessionDataAware { + private Log logger = LogFactory.getLog(getClass()); + private SessionData data; + public void setSessionData(SessionData data) { + this.data = data; + } + public SessionData getSessionData() { + return data; + } + protected Log getLogger() { + return logger; + } + } + +} + + +/* + * $Log: $ + */ Property changes on: trunk/gee/src/java/edu/indiana/psych/gee/session/SessionDataAware.java ___________________________________________________________________ Name: svn:keywords + Date Revision Id Modified: trunk/gee/war/WEB-INF/applicationContext.xml =================================================================== --- trunk/gee/war/WEB-INF/applicationContext.xml 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/WEB-INF/applicationContext.xml 2006-05-24 18:17:59 UTC (rev 183) @@ -82,13 +82,13 @@ <property name='triggeredExperiment' value='true'/> </bean> <bean id="forager-web" class="edu.indiana.psych.gee.forager.ForagerExperiment"> - <constructor-arg ref="defaultForagerWebConfiguration"/> - <constructor-arg ref="configurationService"/> + <property name="defaultConfiguration" ref="defaultForagerWebConfiguration"/> + <property name="configurationService" ref='configurationService'/> <property name="experimentService" ref="experimentService"/> </bean> <bean id="forager-experiment" class="edu.indiana.psych.gee.forager.ForagerExperiment"> - <constructor-arg ref="defaultForagerExperimentConfiguration"/> - <constructor-arg ref="configurationService"/> + <property name="defaultConfiguration" ref="defaultForagerExperimentConfiguration"/> + <property name="configurationService" ref='configurationService'/> <property name="experimentService" ref="experimentService"/> </bean> </beans> Modified: trunk/gee/war/WEB-INF/classes/gee-admin.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-24 18:17:59 UTC (rev 183) @@ -8,30 +8,14 @@ admin package o' actions and urls. define the login filter here? --> <package name="admin" extends="default" namespace="/admin"> - <action name="index" class="edu.indiana.psych.gee.action.AdminAction" method="authenticate"> + + <action name="index" class="edu.indiana.psych.gee.action.AuthenticateAction" method="authenticate"> <result name="success" type="freemarker">listExperiments.jsp</result> <result name="error">error.jsp</result> </action> - <action name="configure" class="edu.indiana.psych.gee.action.AdminAction" method="configure"> - <result name="success" type="freemarker">configureExperiment.jsp</result> - </action> - <action name="list" class="edu.indiana.psych.gee.action.AdminAction" method="listExperiments"> + <action name="experiment" class="edu.indiana.psych.gee.action.ManageExperiment"> <result name="success" type="freemarker">listExperiments.jsp</result> - <result name="error">error.jsp</result> + <result name="input">configureExperiment.jsp</result> </action> - <action name="create" class="edu.indiana.psych.gee.action.AdminAction" method="createExperiment"> - <result name="success" type="redirect">listExperiments.jsp</result> - <result name="input">createExperiment.jsp</result> - </action> - <action name="start" class="edu.indiana.psych.gee.action.AdminAction" method="start"> - <result name="success" type="freemarker">listExperiments.jsp</result> - </action> - <action name="stop" class="edu.indiana.psych.gee.action.AdminAction" method="stop"> - <result name="success" type="freemarker">listExperiments.jsp</result> - </action> - <action name="updateExperimentConfiguration" class="edu.indiana.psych.gee.action.UpdateExperimentConfiguration"> - <interceptor-ref name="prepareStack"/> - <result name="success" type="freemarker">configureExperiment.jsp</result> - </action> </package> </xwork> Modified: trunk/gee/war/WEB-INF/classes/webwork.properties =================================================================== --- trunk/gee/war/WEB-INF/classes/webwork.properties 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/WEB-INF/classes/webwork.properties 2006-05-24 18:17:59 UTC (rev 183) @@ -1,4 +1,3 @@ webwork.objectFactory=spring webwork.devMode=true - webwork.ui.theme=ajax Modified: trunk/gee/war/admin/listExperiments.jsp =================================================================== --- trunk/gee/war/admin/listExperiments.jsp 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/admin/listExperiments.jsp 2006-05-24 18:17:59 UTC (rev 183) @@ -1,6 +1,5 @@ <head> <meta name="lastModifiedDate" content="$Date$"/> -<@ww.head theme="ajax"/> <title>Experiment Statuses</title> </head> <body> @@ -24,22 +23,15 @@ <td width="10%"><span class='highlight'>${name}</span></td> <td width="50%">${description}</td> <td width="15%"> - <@ww.div id="status" href="/ajax/status.action?experimentName=${name}" listenTopics="start, stop"> - ${running?string("running", "not running")} - </@ww.div> + ${running?string("running", "not running")} </td> <td width="25%"> ( - <@ww.a id="start" href="start.action?experimentName=${name}" notifyTopics="start"> - Start - </@ww.a> + <a href="experiment!start.action?experimentName=${name}">Start<a> | - <@ww.a id="stop" href='stop.action?experimentName=${name}' notifyTopics="stop" > - Stop - </@ww.a> + <a href='experiment!stop.action?experimentName=${name}'>Stop<a> | - <a href='<@ww.url action="configure" experimentName="${name}" />'> - Edit</a> + <a href='experiment!configure.action?experimentName=${name}'>Edit</a> ) </td> </tr> Modified: trunk/gee/war/ajax/status.ajax =================================================================== --- trunk/gee/war/ajax/status.ajax 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/ajax/status.ajax 2006-05-24 18:17:59 UTC (rev 183) @@ -1 +1 @@ -<font color='brown'>${experiment.running?string("running", "not running")}</font> +<font color="blue">${experiment.running?string("running", "not running")}</font> Modified: trunk/gee/war/includes/header.jsp =================================================================== --- trunk/gee/war/includes/header.jsp 2006-05-19 00:48:18 UTC (rev 182) +++ trunk/gee/war/includes/header.jsp 2006-05-24 18:17:59 UTC (rev 183) @@ -1,12 +1,4 @@ <%@ taglib prefix="ww" uri="webwork" %> -<head> -<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> -</script> -<script type="text/javascript"> -_uacct = "UA-321755-2"; -urchinTracker(); -</script> -</head> <TABLE BGCOLOR="#A4B5C5" CELLPADDING="4" CELLSPACING="0" WIDTH="100%" BORDER="0"> <TR> <TD><img src='images/gee.png'/><b>Group Experiments Environment</b></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |