Thread: [gee-svn] SF.net SVN: gabel: [113] trunk/gee/war/WEB-INF/classes
Status: Alpha
Brought to you by:
alllee
|
From: <al...@us...> - 2006-02-26 22:23:38
|
Revision: 113 Author: alllee Date: 2006-02-26 14:23:29 -0800 (Sun, 26 Feb 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=113&view=rev Log Message: ----------- folding PrepareConsentForm action into StartExperiment to reduce code duplication. Modifying xwork.xml action mappings accordingly to go to specific methods within startExperiment. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/action/StartExperiment.java trunk/gee/war/WEB-INF/classes/xwork.xml Removed Paths: ------------- trunk/gee/src/java/edu/indiana/psych/gee/action/PrepareConsentForm.java Deleted: trunk/gee/src/java/edu/indiana/psych/gee/action/PrepareConsentForm.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/PrepareConsentForm.java 2006-02-26 22:02:44 UTC (rev 112) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/PrepareConsentForm.java 2006-02-26 22:23:29 UTC (rev 113) @@ -1,95 +0,0 @@ -package edu.indiana.psych.gee.action; - -import edu.indiana.psych.gee.ConsentForm; -import edu.indiana.psych.gee.Experiment; - -/** - * $Id$ - * - * @author <a href='al...@cs...'>Allen Lee</a> - * @version $Revision$ - */ - -@SuppressWarnings("serial") -public class PrepareConsentForm extends GeeAction { - - private String experimentName; - - private ConsentForm consentForm; - - private String message; - - public String execute() { - Experiment experiment = getExperimentService().find(experimentName); - if (experiment == Experiment.NULL) { - // FIXME: this String does not belong here at all, should be - // presentation-layer. Could provide a list and link of possible - // spelling corrections even? - message = String.format("There doesn't appear to be an experiment named '%s'.", experimentName); - return ERROR; - } - consentForm = experiment.getConsentForm(); - return SUCCESS; - } - - public void setExperimentName(String experimentName) { - this.experimentName = experimentName; - } - - public String getExperimentName() { - return experimentName; - } - - public String getMessage() { - return message; - } - - public ConsentForm getConsentForm() { - return consentForm; - } - -} -/* - * $Log$ - * Revision 1.4 2006/02/23 21:12:32 alllee - * extracting WebWork/xwork dependency to GeeAction base class. Currently supplies a logger and an ExperimentService (set by Spring) to subclasses. - * - * Revision 1.3 2006/02/02 23:17:25 alllee - * finally got validation working. here's the steps I had to take beyond dumping - * a FooAction-validation.xml in the appropriate path: - * 1. configure xwork.xml's start action to handle input results - this gets - * invoked when validation fails. Because we keep passing around the - * experiment name and other state across multiple pages, the result type - * should be "chain". The location of the result should be the name of - * another action. - * 2. the error message gets automagically inserted by webwork, nice! - * 3. added .errorMessage css to automagically colorize errors on a field. - * - * Revision 1.2 2006/01/17 08:34:54 alllee - * adding more presentation layer functionality, dynamic consent form is all set, - * but still need to hook in validation for the name. - * - * Revision 1.1 2006/01/17 02:51:40 alllee - * adding Action to load the consent form for the given experiment. - * - * Revision 1.4 2006/01/14 00:36:00 alllee - * adding a brief client message if StartExperiments fails. That class is not an - * optimal place to store those kind of messages, forces recompilation in order - * to change the message. Lift to a configuration later, there should be a - * webwork way to store messages. - * - * Revision 1.3 2006/01/13 09:30:54 alllee - * almost have experiments running - the StartExperiment action has all the - * information it needs and can start the experiment, but the startExperiment - * page is failing because forager-client.jar isn't there. Next step - make - * forager-client.jar there. - * - * Revision 1.2 2006/01/13 07:40:12 alllee - * starting to display experiment metadata through the page. still need to fill - * in the link to actually start and begin participating in an experiment. - * - * Revision 1.1 2005/12/21 21:47:27 alllee - * adding ant task to build web components and stubbed out XWork actions. - * - */ - Modified: trunk/gee/src/java/edu/indiana/psych/gee/action/StartExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/StartExperiment.java 2006-02-26 22:02:44 UTC (rev 112) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/StartExperiment.java 2006-02-26 22:23:29 UTC (rev 113) @@ -20,17 +20,15 @@ private ConsentForm consentForm; private String message; - public String execute() { - Experiment experiment = getExperiment(); - if (experiment == Experiment.NULL) { - // FIXME: this String does not belong here at all, should be - // presentation-layer. Could provide a list and link of possible - // spelling corrections even? - message = String.format("There doesn't appear to be an experiment named '%s'.", experimentName); - return ERROR; - } + public String prepare() { + consentForm = getExperiment().getConsentForm(); + return SUCCESS; + } + + public String start() { // FIXME: start up on a new port if it's already running? - experiment.start(); + prepare(); + getExperiment().start(); return SUCCESS; } @@ -43,9 +41,6 @@ } public ConsentForm getConsentForm() { - if (consentForm == null) { - consentForm = getExperiment().getConsentForm(); - } return consentForm; } Modified: trunk/gee/war/WEB-INF/classes/xwork.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/xwork.xml 2006-02-26 22:02:44 UTC (rev 112) +++ trunk/gee/war/WEB-INF/classes/xwork.xml 2006-02-26 22:23:29 UTC (rev 113) @@ -1,65 +1,72 @@ -<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.1.dtd"> +<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" + "http://www.opensymphony.com/xwork/xwork-1.1.dtd"> <xwork> - <include file="webwork-default.xml"/> - - <!-- - <include file="config-browser.xml"/> - - <include file="xwork-continuations.xml"/> - - <include file="xwork-tags.xml"/> - - <include file="xwork-validation.xml" /> - - <include file="xwork-actionchaining.xml" /> - - <include file="xwork-ajax.xml" /> - --> - - <package name="default" extends="webwork-default"> - <default-interceptor-ref name="defaultStack"/> - <!-- the start page lists all available experiments --> - <action name="index" class="edu.indiana.psych.gee.action.ListExperiments"> - <result>index.jsp</result> - </action> - <action name="start" class="edu.indiana.psych.gee.action.StartExperiment"> - <result name="success">startExperiment.jsp</result> - <result name="error">error.jsp</result> - <result name="input">getConsent.jsp</result> - </action> - <action name="consent" class="edu.indiana.psych.gee.action.PrepareConsentForm"> - <result name="success">getConsent.jsp</result> - <result name="input">getConsent.jsp</result> - <result name="error">error.jsp</result> - </action> - <action name='contact'> - <result>contact.jsp</result> - </action> - </package> - <package name="admin" extends="default" namespace="/admin"> - <action name="index" class="edu.indiana.psych.gee.action.AdminAction" 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="error" type="chain">configure</result> - <result name="success">configureExperiment.jsp</result> - </action> - <action name="list" class="edu.indiana.psych.gee.action.AdminAction" method="listExperiments"> - <result name="success" type="freemarker">listExperiments.jsp</result> - <result name="error">error.jsp</result> - </action> - <action name="create" class="edu.indiana.psych.gee.action.AdminAction" method="createExperiment"> - <result 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 type="freemarker">listExperiments.jsp</result> - </action> - <action name="stop" class="edu.indiana.psych.gee.action.AdminAction" method="stop"> - <result type="freemarker">listExperiments.jsp</result> - </action> - </package> - -</xwork> + <include file="webwork-default.xml"/> + + <!-- + <include file="config-browser.xml"/> + + <include file="xwork-continuations.xml"/> + + <include file="xwork-tags.xml"/> + + <include file="xwork-validation.xml" /> + + <include file="xwork-actionchaining.xml" /> + + <include file="xwork-ajax.xml" /> + --> + + <package name="default" extends="webwork-default"> + <default-interceptor-ref name="defaultStack"/> + <!-- the start page lists all available experiments --> + <action name="index" class="edu.indiana.psych.gee.action.ListExperiments"> + <result>index.jsp</result> + </action> + <action name="start" class="edu.indiana.psych.gee.action.StartExperiment" method="start"> + <result name="success">startExperiment.jsp</result> + <result name="error">error.jsp</result> + <result name="input">getConsent.jsp</result> + </action> + <action name="consent" class="edu.indiana.psych.gee.action.StartExperiment" method="prepare"> + <result name="success">getConsent.jsp</result> + <result name="input">getConsent.jsp</result> + <result name="error">error.jsp</result> + </action> + <action name='contact'> + <result>contact.jsp</result> + </action> + </package> + <package name="admin" extends="default" namespace="/admin"> + <action name="index" class="edu.indiana.psych.gee.action.AdminAction" + 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="error" type="chain">configure</result> + <result name="success">configureExperiment.jsp</result> + </action> + <action name="list" class="edu.indiana.psych.gee.action.AdminAction" + method="listExperiments"> + <result name="success" type="freemarker">listExperiments.jsp</result> + <result name="error">error.jsp</result> + </action> + <action name="create" class="edu.indiana.psych.gee.action.AdminAction" + method="createExperiment"> + <result 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 type="freemarker">listExperiments.jsp</result> + </action> + <action name="stop" class="edu.indiana.psych.gee.action.AdminAction" + method="stop"> + <result type="freemarker">listExperiments.jsp</result> + </action> + </package> + +</xwork> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-09 06:16:03
|
Revision: 156 Author: alllee Date: 2006-03-08 22:15:53 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=156&view=rev Log Message: ----------- adding services and DAOs for consent forms and experiment configuration, minor hygiene on ExperimentConfigurationEntity. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/ConsentForm.java trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java trunk/gee/war/WEB-INF/classes/log4j.properties Added Paths: ----------- trunk/gee/src/java/edu/indiana/psych/gee/service/ConsentFormDao.java trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationDao.java trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java Modified: trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-09 06:15:53 UTC (rev 156) @@ -52,7 +52,7 @@ } if ( isRunning() ) { throw new UnsupportedOperationException("AbstractExperiment does " + - "not support hot-reconfiguration yet"); + "not support reconfiguration while running yet"); } this.configuration = configuration; } Modified: trunk/gee/src/java/edu/indiana/psych/gee/ConsentForm.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ConsentForm.java 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/src/java/edu/indiana/psych/gee/ConsentForm.java 2006-03-09 06:15:53 UTC (rev 156) @@ -24,7 +24,8 @@ @Table(name="consent_form") public class ConsentForm { - private int id = -1; + // are longs overkill? + private Long id = Long.valueOf(-1); private String description; private String deception; @@ -38,10 +39,10 @@ private Date irbDateApproved; @Id @GeneratedValue - public int getId() { + public Long getId() { return id; } - public void setId(int id) { + public void setId(Long id) { this.id = id; } public String getBenefits() { Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-09 06:15:53 UTC (rev 156) @@ -19,8 +19,11 @@ /** * $Id$ * - * Helps specific ExperimentConfiguration-S read in their configuration data - * from a variety of sources. + * Provides hibernate object/relational annotations for fields common to most + * ExperimentConfigurations, things like consent forms, experiment names, and + * a Collection of ExperimentRoundParameters. If you don't want to store your + * configuration information in a database, subclass + * ExperimentConfigurationFile instead (which isn't written yet ;-). * * * @author Allen Lee @@ -37,7 +40,7 @@ private final static String DEFAULT_SERVER_ADDRESS = "groups.psych.indiana.edu"; // persistent fields - private long id = -1; + private Long id = Long.valueOf(-1); private String description; private String experimentName; private String clientJarName; @@ -46,17 +49,21 @@ private int serverPort; private String serverName; private boolean triggeredExperiment; - // transient fields + // transient fields (vaguely remember reading somewhere that it's better + // to place these on the accessor methods instead, figure out if this is + // the case) + @Transient private InetSocketAddress serverAddress; + @Transient private T currentParameters; - private @Transient Iterator<T> parametersIterator; + @Transient + private Iterator<T> parametersIterator; public ExperimentConfigurationEntity(String serverName, int port) { setServerName(serverName); setServerPort(port); } - @Transient public synchronized InetSocketAddress getServerAddress() { // FIXME: return configuration address instead? if (serverAddress == null) { @@ -75,11 +82,11 @@ } @Id @GeneratedValue - public long getId() { + public Long getId() { return id; } - public void setId(long id) { + public void setId(Long id) { this.id = id; } @@ -108,8 +115,7 @@ this.triggeredExperiment = triggeredExperiment; } - @ManyToOne(targetEntity=ConsentForm.class) - @JoinColumn(name="consent_id") + @ManyToOne public ConsentForm getConsentForm() { return consentForm; } @@ -125,7 +131,6 @@ currentParameters = parametersIterator.next(); } - @Transient public synchronized T getCurrentParameters() { List<T> allParameters = getAllParameters(); if (currentParameters == null) { Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java 2006-03-09 06:15:53 UTC (rev 156) @@ -64,6 +64,8 @@ private boolean roundRunning; + // FIXME: instead, need to find configurations from + // ExperimentConfigurationDao, yes? public ForagerExperiment(ForagerConfiguration configuration) { addEventProcessors(); getLogger().debug("Creating a new ForagerExperiment with configuration: " + configuration); Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java 2006-03-09 06:15:53 UTC (rev 156) @@ -23,7 +23,7 @@ private ForagerAgentConfiguration agentConfiguration; private ForagerConfiguration configuration; - private long id = -1; + private Long id = Long.valueOf(-1L); private String name; private int foodSpoilDuration; private double foodRate; @@ -37,11 +37,11 @@ private String specialInstructions; @Id @GeneratedValue - public long getId() { + public Long getId() { return id; } - public void setId(long id) { + public void setId(Long id) { this.id = id; } Added: trunk/gee/src/java/edu/indiana/psych/gee/service/ConsentFormDao.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/service/ConsentFormDao.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ConsentFormDao.java 2006-03-09 06:15:53 UTC (rev 156) @@ -0,0 +1,27 @@ +package edu.indiana.psych.gee.service; + +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import edu.indiana.psych.gee.ConsentForm; + +/** + * $Id: Exp $ + * + * Hibernate data access object for consent forms. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision: $ + */ + +public class ConsentFormDao extends HibernateDaoSupport { + + + public ConsentForm find(Integer id) { + return (ConsentForm) getHibernateTemplate().get(ConsentForm.class, id); + } + + public void update(ConsentForm consentForm) { + getHibernateTemplate().saveOrUpdate(consentForm); + } + +} Added: trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationDao.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationDao.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationDao.java 2006-03-09 06:15:53 UTC (rev 156) @@ -0,0 +1,28 @@ +package edu.indiana.psych.gee.service; + +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentConfigurationEntity; + +/** + * $Id: Exp $ + * + * Data access object for persisting experiment configurations, should also + * take care of experiment round parameters. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision: $ + */ + +public class ExperimentConfigurationDao extends HibernateDaoSupport { + + public <E extends ExperimentConfigurationEntity> E find(Class<E> configurationClass, Integer id) { + return configurationClass.cast(getHibernateTemplate().get(configurationClass, id)); + } + + public void update(ExperimentConfiguration configuration) { + getHibernateTemplate().saveOrUpdate(configuration); + } + +} Added: trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java 2006-03-09 06:15:53 UTC (rev 156) @@ -0,0 +1,41 @@ +package edu.indiana.psych.gee.service; + +import java.io.InputStream; + +import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentConfigurationEntity; + +/** + * $Id: Exp $ + * + * Handles requests for manipulating experiment configurations, this includes + * database and flat file persistence, uploading new experiment + * configurations, and other editing, etc. + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision: $ + */ + +public class ExperimentConfigurationService { + + private ExperimentConfigurationDao experimentConfigurationDao; + + public <E extends ExperimentConfiguration> E load(Class<E> configurationClass, InputStream stream) { + + return null; + } + + public <E extends ExperimentConfigurationEntity> E find(Class<E> configurationClass, Integer id) { + return experimentConfigurationDao.find(configurationClass, id); + } + + + public void update(ExperimentConfiguration configuration) { + experimentConfigurationDao.update(configuration); + } + + public void setExperimentConfigurationDao(ExperimentConfigurationDao experimentConfigurationDao) { + this.experimentConfigurationDao = experimentConfigurationDao; + } + +} Modified: trunk/gee/war/WEB-INF/classes/log4j.properties =================================================================== --- trunk/gee/war/WEB-INF/classes/log4j.properties 2006-03-09 05:27:32 UTC (rev 155) +++ trunk/gee/war/WEB-INF/classes/log4j.properties 2006-03-09 06:15:53 UTC (rev 156) @@ -7,6 +7,9 @@ # Spring Stuff log4j.logger.org.springframework=INFO +# turn off introspection crap from freemarker beans +log4j.logger.freemarker.beans=WARN + # commons digester crap log4j.logger.org.apache.commons.digester=ERROR log4j.logger.org.hibernate=DEBUG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-05-25 00:11:00
|
Revision: 184 Author: alllee Date: 2006-05-24 17:10:55 -0700 (Wed, 24 May 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=184&view=rev Log Message: ----------- adding notion of a experiment Identifer to ExperimentConfiguration, and fixing errors in xwork configuration. Still grinding away on editing experiment configurations via the web. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java trunk/gee/war/WEB-INF/classes/gee-admin.xml Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-05-24 18:17:59 UTC (rev 183) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-05-25 00:10:55 UTC (rev 184) @@ -27,8 +27,22 @@ public String getServerName(); public void setServerName(String serverName); + /** + * Returns a user friendly name for the experiment. This can be duplicated for several + * experiment instances (e.g., forager or social choice experiments have a variety of potential names). + * @return + */ public String getExperimentName(); public void setExperimentName(String experimentName); + + /** + * Returns a unique String name/identifier for the experiment configured by this ExperimentConfiguration object, + * e.g., forager-experiment, forager-web. + * + * @return a unique String identifier for this Experiment. + */ + public String getExperimentIdentifier(); + public void setExperimentIdentifier(String experimentIdentifier); public int getServerPort(); public void setServerPort(int serverPort); Modified: trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java 2006-05-24 18:17:59 UTC (rev 183) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperiment.java 2006-05-25 00:10:55 UTC (rev 184) @@ -23,22 +23,17 @@ 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; + configuration = getExperiment().getConfiguration(); + return INPUT; } public String start() { @@ -84,12 +79,11 @@ } public Experiment getExperiment() { - return experiment; + return getExperimentService().find(experimentName); } public void setExperimentName(String experimentName) { this.experimentName = experimentName; - this.experiment = getExperimentService().find(experimentName); } } 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-24 18:17:59 UTC (rev 183) +++ trunk/gee/src/java/edu/indiana/psych/gee/bean/ExperimentConfigurationEntity.java 2006-05-25 00:10:55 UTC (rev 184) @@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.List; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -46,6 +47,7 @@ private Long id = Long.valueOf(-1); private String description; private String experimentName; + private String experimentIdentifier; private String clientJarName; private String clientMainClass; private ConsentForm consentForm; @@ -171,6 +173,7 @@ this.description = description; } + @Column(nullable=false) public String getExperimentName() { return experimentName; } @@ -191,4 +194,13 @@ public Duration getDelayBetweenRounds() { return Duration.create(30); } + + @Column(nullable=false, unique=true) + public String getExperimentIdentifier() { + return experimentIdentifier; + } + + public void setExperimentIdentifier(String experimentIdentifier) { + this.experimentIdentifier = experimentIdentifier; + } } Modified: trunk/gee/war/WEB-INF/classes/gee-admin.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-24 18:17:59 UTC (rev 183) +++ trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-25 00:10:55 UTC (rev 184) @@ -8,14 +8,17 @@ 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.AuthenticateAction" method="authenticate"> + <action name="index" class="edu.indiana.psych.gee.action.ManageExperiment" method="authenticate"> <result name="success" type="freemarker">listExperiments.jsp</result> <result name="error">error.jsp</result> </action> <action name="experiment" class="edu.indiana.psych.gee.action.ManageExperiment"> <result name="success" type="freemarker">listExperiments.jsp</result> - <result name="input">configureExperiment.jsp</result> + <result name="input" type="freemarker">configureExperiment.jsp</result> </action> + <action name="configuration" class="edu.indiana.psych.gee.action.ManageExperimentConfiguration"> + <result name="success" type="freemarker">listExperimentConfigurations.jsp</result> + <result name="input" type="freemarker">configureExperiment.jsp</result> + </action> </package> </xwork> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-05-31 23:57:33
|
Revision: 187 Author: alllee Date: 2006-05-31 16:57:30 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=187&view=rev Log Message: ----------- experiment configurations now editable from the web, now to add experiment parameters into the mix. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java trunk/gee/war/WEB-INF/classes/gee-admin.xml Modified: trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java 2006-05-31 22:53:54 UTC (rev 186) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/ManageExperimentConfiguration.java 2006-05-31 23:57:30 UTC (rev 187) @@ -1,5 +1,7 @@ package edu.indiana.psych.gee.action; +import com.opensymphony.xwork.Preparable; + import edu.indiana.psych.gee.ExperimentConfiguration; import edu.indiana.psych.gee.ExperimentRoundParameters; @@ -13,16 +15,19 @@ */ @SuppressWarnings("serial") -public class ManageExperimentConfiguration extends GeeAction { +public class ManageExperimentConfiguration extends GeeAction implements Preparable { private ExperimentConfiguration<? extends ExperimentRoundParameters> configuration; - private String configurationId; + private Long configurationId; private String configurationClass; + public void prepare() { + configuration = findConfiguration(getConfigurationId()); + } + public String save() { if (configuration == null) { - configuration = findConfiguration(getConfigurationId()); getLogger().warn("Trying to save a null configuration, ignoring.."); return INPUT; } @@ -52,12 +57,22 @@ public ExperimentConfiguration<? extends ExperimentRoundParameters> getConfiguration() { return configuration; } + + /* + public void setConfiguration(ExperimentConfiguration<? extends ExperimentRoundParameters> configuration) { + this.configuration = configuration; + } + */ public Long getConfigurationId() { - return Long.valueOf(configurationId); + return configurationId; } + + public void setConfigurationClass(String configurationClass) { + this.configurationClass = configurationClass; + } - public void setConfigurationId(String configurationId) { + public void setConfigurationId(Long configurationId) { this.configurationId = configurationId; } @@ -70,16 +85,12 @@ try { return Class.forName(configurationClass); } - catch (ClassNotFoundException e) { + catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); - getLogger().error("Could not find class:" + configurationClass); + getLogger().error("Unable to load class:" + configurationClass); return null; } } - public void setConfigurationClass(String configurationClass) { - this.configurationClass = configurationClass; - } - -} + } Modified: trunk/gee/war/WEB-INF/classes/gee-admin.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-31 22:53:54 UTC (rev 186) +++ trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-05-31 23:57:30 UTC (rev 187) @@ -17,7 +17,8 @@ <result name="input" type="freemarker">configureExperiment.jsp</result> </action> <action name="configuration" class="edu.indiana.psych.gee.action.ManageExperimentConfiguration"> - <result name="success" type="freemarker">listExperimentConfigurations.jsp</result> + <interceptor-ref name="paramsPrepareParamsStack"/> + <result name="success" type="freemarker">configureExperiment.jsp</result> <result name="input" type="freemarker">configureExperiment.jsp</result> </action> </package> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |