Thread: [gee-svn] SF.net SVN: gabel: [122] trunk/gee/war/WEB-INF
Status: Alpha
Brought to you by:
alllee
|
From: <al...@us...> - 2006-02-28 07:00:17
|
Revision: 122 Author: alllee Date: 2006-02-27 23:00:11 -0800 (Mon, 27 Feb 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=122&view=rev Log Message: ----------- starting the long road towards persistent experiment configuration. Modified Paths: -------------- trunk/gee/war/WEB-INF/applicationContext.xml trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml Added Paths: ----------- trunk/gee/war/WEB-INF/dwr.xml trunk/gee/war/WEB-INF/jdbc.properties Modified: trunk/gee/war/WEB-INF/applicationContext.xml =================================================================== --- trunk/gee/war/WEB-INF/applicationContext.xml 2006-02-28 04:34:13 UTC (rev 121) +++ trunk/gee/war/WEB-INF/applicationContext.xml 2006-02-28 07:00:11 UTC (rev 122) @@ -1,5 +1,32 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- +vim:sts=2:sw=2: +--> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="autodetect"> - <bean id="experimentService" class="edu.indiana.psych.gee.service.ExperimentService"/> + <bean id="propertyConfigurer" + class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="location" value="/WEB-INF/jdbc.properties"/> + </bean> + <bean id="mysqlDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="com.mysql.jdbc.Driver"/> + <property name="url" value="jdbc:mysql://localhost/${geedb.name}"/> + <property name="username" value="${geedb.user}"/> + <property name="password" value="${geedb.password}"/> + </bean> + <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <property name="configLocation" value="WEB-INF/hibernate-session-factory-config.xml"/> + <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.cglib.use_reflection_optimizer">false</prop> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> + <prop key="hibernate.show_sql">true</prop> + </props> + </property> + <property name="dataSource"> + <ref bean="mysqlDataSource"/> + </property> + </bean> + <bean id="experimentService" class="edu.indiana.psych.gee.service.ExperimentService"/> </beans> Added: trunk/gee/war/WEB-INF/dwr.xml =================================================================== --- trunk/gee/war/WEB-INF/dwr.xml (rev 0) +++ trunk/gee/war/WEB-INF/dwr.xml 2006-02-28 07:00:11 UTC (rev 122) @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- +vim:sts=2:sw=2: +--> +<!DOCTYPE dwr PUBLIC + "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" + "http://www.getahead.ltd.uk/dwr/dwr10.dtd"> +<dwr> + <allow> + <create creator="new" javascript="validator"> + <param name="class" value="com.opensymphony.webwork.validators.DWRValidator"/> + </create> + <convert converter="bean" match="com.opensymphony.xwork.ValidationAwareSupport"/> + </allow> + + <signatures> + <![CDATA[ + import java.util.Map; + import com.opensymphony.webwork.validators.DWRValidator; + + DWRValidator.doPost(String, String, Map<String, String>); + ]]> + </signatures> +</dwr> Modified: trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml =================================================================== --- trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml 2006-02-28 04:34:13 UTC (rev 121) +++ trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml 2006-02-28 07:00:11 UTC (rev 122) @@ -1,3 +1,7 @@ +<?xml version="1.0"?> +<!-- +vim:sts=2:sw=2: +--> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd "> @@ -3,9 +7,8 @@ <hibernate-configuration> <session-factory> - <!-- place mappings here - <mapping package="edu.iupui.cmg.parsnp.om.assay"/> - <mapping class="edu.iupui.cmg.parsnp.om.assay.AssayImpl"/> - <mapping class="edu.iupui.cmg.parsnp.om.assay.AssaySnpImpl"/> - --> + <mapping package="edu.indiana.psych.gee"/> + <mapping class="edu.indiana.psych.gee.ConsentForm"/> + <mapping package="edu.indiana.psych.gee.forager"/> + <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> </session-factory> </hibernate-configuration> Added: trunk/gee/war/WEB-INF/jdbc.properties =================================================================== --- trunk/gee/war/WEB-INF/jdbc.properties (rev 0) +++ trunk/gee/war/WEB-INF/jdbc.properties 2006-02-28 07:00:11 UTC (rev 122) @@ -0,0 +1,7 @@ +# replace these with custom database user/pass +# the database name +geedb.name=gee +# a username with privileges to admin experiments +geedb.user=dummy-user +# admin's db password +geedb.password=dummy-password This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-04 07:01:40
|
Revision: 132 Author: alllee Date: 2006-03-03 23:01:38 -0800 (Fri, 03 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=132&view=rev Log Message: ----------- convention > overly-verbose names Added Paths: ----------- trunk/gee/war/WEB-INF/hibernate.cfg.xml Removed Paths: ------------- trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml Deleted: trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml =================================================================== --- trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml 2006-03-04 04:18:13 UTC (rev 131) +++ trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml 2006-03-04 07:01:38 UTC (rev 132) @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<!-- -vim:sts=2:sw=2: ---> -<!DOCTYPE hibernate-configuration PUBLIC - "-//Hibernate/Hibernate Configuration DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd "> -<hibernate-configuration> - <session-factory> - <mapping package="edu.indiana.psych.gee"/> - <mapping class="edu.indiana.psych.gee.ConsentForm"/> - <mapping package="edu.indiana.psych.gee.forager"/> - <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> - </session-factory> -</hibernate-configuration> - Copied: trunk/gee/war/WEB-INF/hibernate.cfg.xml (from rev 130, trunk/gee/war/WEB-INF/hibernate-session-factory-config.xml) =================================================================== --- trunk/gee/war/WEB-INF/hibernate.cfg.xml (rev 0) +++ trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-04 07:01:38 UTC (rev 132) @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +vim:sts=2:sw=2: +--> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd "> +<hibernate-configuration> + <session-factory> + <mapping package="edu.indiana.psych.gee"/> + <mapping class="edu.indiana.psych.gee.ConsentForm"/> + <mapping package="edu.indiana.psych.gee.forager"/> + <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> + </session-factory> +</hibernate-configuration> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-04 18:50:31
|
Revision: 136 Author: alllee Date: 2006-03-04 10:50:24 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=136&view=rev Log Message: ----------- fixing persistent classes. Having problems mapping generic classes the way I want to - I'd like to make it easy to subclass ExperimentConfigurationEntity as a generic class and get a lot of default behavior for free by parameterizing the superclass with the particular ExperimentRoundParameters type that your specific ExperimentConfiguration will use and maintain a collection of. That way each subclass wouldn't have to reimplement getAllParameters() to return the specific a specifically-typed Collection that you want, instead the framework provides all that for you. Unfortunately this may not be possible.. 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/ExperimentConfigurationEntity.java trunk/gee/src/java/edu/indiana/psych/gee/ExperimentParametersEntity.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java trunk/gee/war/WEB-INF/hibernate.cfg.xml Modified: trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-04 18:50:24 UTC (rev 136) @@ -52,7 +52,7 @@ "not support hot-reconfiguration yet"); } this.configuration = configuration; - allParameters = configuration.getAllExperimentRoundParameters(); + allParameters = configuration.getAllParameters(); } public synchronized void start() throws ExperimentLifecycleException { Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-03-04 18:50:24 UTC (rev 136) @@ -34,15 +34,8 @@ public boolean isTriggeredExperiment(); - /** - * Returns the directory containing all experiment configuration files for - * the Experiment with this ExperimentConfiguration. - * @return - */ - public File getExperimentConfigurationDirectory(); + public List<T> getAllParameters(); - public List<T> getAllExperimentRoundParameters(); - public ExperimentRoundParameters getCurrentParameters(); public String getDescription(); Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-04 18:50:24 UTC (rev 136) @@ -6,10 +6,18 @@ import java.util.List; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.MappedSuperclass; import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Transient; +import edu.indiana.psych.gee.forager.*; + /** * $Id$ * @@ -22,23 +30,34 @@ */ @Entity -@MappedSuperclass +@Table(name="experiment_configuration") +@Inheritance(strategy=InheritanceType.JOINED) public abstract class ExperimentConfigurationEntity<T extends ExperimentRoundParameters> implements ExperimentConfiguration { private final static String DEFAULT_SERVER_ADDRESS = "groups.psych.indiana.edu"; + + private long id = -1; + + private String description; + private String experimentName; + private String clientJarName; - private T currentParameters; - private final List<T> allParameters = new ArrayList<T>(); + + private ForagerExperimentParameters currentParameters; +// private List<T> allParameters; + private List<ForagerExperimentParameters> allParameters; private InetSocketAddress serverAddress; - private int port; + private int serverPort; private String serverName; + private boolean triggeredExperiment; public ExperimentConfigurationEntity(String serverName, int port) { - this.serverName = serverName; - this.port = port; + setServerName(serverName); + setServerPort(port); } + @Transient public synchronized InetSocketAddress getServerAddress() { // FIXME: return configuration address instead? if (serverAddress == null) { @@ -55,28 +74,56 @@ // be configurable. return DEFAULT_SERVER_ADDRESS; } + + @Id @GeneratedValue + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } public int getServerPort() { - return port; + return serverPort; } + + public void setServerPort(int serverPort) { + this.serverPort = serverPort; + } + + public String getServerName() { + return serverName; + } + public void setServerName(String serverName) { + this.serverName = serverName; + } + public boolean isTriggeredExperiment() { // TODO Auto-generated method stub - return false; + return triggeredExperiment; } - public File getExperimentConfigurationDirectory() { - // TODO Auto-generated method stub - return null; - } + public void setTriggeredExperiment(boolean triggeredExperiment) { + this.triggeredExperiment = triggeredExperiment; + } - @OneToMany(targetEntity=ExperimentParametersEntity.class) - @JoinColumn(name="configuration_id") - public List<T> getAllExperimentRoundParameters() { + +// @OneToMany(targetEntity=ExperimentParametersEntity.class) +// @OneToMany(targetEntity=ForagerExperimentParameters.class) + // @JoinColumn(name="configuration_id") + @Transient + public List<ForagerExperimentParameters> getAllParameters() { return allParameters; } + + public void setAllParameters(List<ForagerExperimentParameters> allParameters) { + this.allParameters = allParameters; + } - public synchronized T getCurrentParameters() { + @Transient + public synchronized ForagerExperimentParameters getCurrentParameters() { if (currentParameters == null) { if (allParameters.isEmpty()) { throw new ExperimentLifecycleException("No experiment round parameters available for : " + getExperimentName()); Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentParametersEntity.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentParametersEntity.java 2006-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentParametersEntity.java 2006-03-04 18:50:24 UTC (rev 136) @@ -1,9 +1,13 @@ package edu.indiana.psych.gee; import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; import javax.persistence.MappedSuperclass; +import javax.persistence.Table; +import javax.persistence.Transient; /** * $Id: Exp$ @@ -15,13 +19,23 @@ */ @Entity -@MappedSuperclass +@Table(name="experiment_parameters") +@Inheritance(strategy=InheritanceType.JOINED) public abstract class ExperimentParametersEntity implements ExperimentRoundParameters { + private long id = -1; + private ExperimentConfiguration configuration; - @ManyToOne(targetEntity=ExperimentConfigurationEntity.class) - @JoinColumn(name="configuration_id", nullable=false) + @Id @GeneratedValue + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + public ExperimentConfiguration getConfiguration() { return 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-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-04 18:50:24 UTC (rev 136) @@ -1,9 +1,14 @@ package edu.indiana.psych.gee.forager; +import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; +import javax.persistence.Transient; import edu.indiana.psych.gee.ExperimentConfigurationEntity; import edu.indiana.psych.gee.forager.client.ForagerApplet; @@ -19,12 +24,13 @@ * @version $Revision$ */ @Entity +@Inheritance(strategy=InheritanceType.JOINED) +@DiscriminatorValue("forager") +@PrimaryKeyJoinColumn(name="forager_configuration_id") @Table(name="forager_configuration") public class ForagerConfiguration extends ExperimentConfigurationEntity<ForagerExperimentParameters> { + - - private long id = -1; - public ForagerConfiguration(String serverName, int port) { super(serverName, port); } @@ -48,21 +54,10 @@ return new ForagerConfiguration(getDefaultServerAddress(), 25000); } + @Transient public Duration getDelayBetweenRounds() { return Duration.create(30); } - - @Id @GeneratedValue - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - - } 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-04 07:38:23 UTC (rev 135) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java 2006-03-04 18:50:24 UTC (rev 136) @@ -5,10 +5,17 @@ import java.util.List; import java.util.Properties; +import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; +import javax.persistence.JoinColumn; import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.ManyToOne; +import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; +import javax.persistence.ManyToOne; import javax.persistence.Transient; import org.hibernate.annotations.Proxy; @@ -19,32 +26,26 @@ import edu.indiana.psych.gee.time.Duration; @Entity +@Inheritance(strategy=InheritanceType.JOINED) +@DiscriminatorValue("forager") +@PrimaryKeyJoinColumn(name="forager_parameters_id") +@Proxy(proxyClass=ExperimentRoundParameters.class) @Table(name="forager_parameters") -@Proxy(proxyClass=ExperimentRoundParameters.class) public class ForagerExperimentParameters extends ExperimentParametersEntity { - private final ForagerConfiguration foragerConfiguration; + private ForagerAgentConfiguration agentConfiguration; - /** - * @param configuration - */ + private String name; + private int foodSpoilDuration; + private double foodRate; + + ForagerExperimentParameters(ForagerConfiguration configuration) { - foragerConfiguration = configuration; + setConfiguration(configuration); } - long id = -1; - String name; - int foodSpoilDuration; - double foodRate; - ForagerAgentConfiguration agentConfiguration; - - @Id @GeneratedValue - public long getId() { - return id; - } - public int getMinimumParticipants() { // FIXME: replace with configuration value. return 5; @@ -69,11 +70,13 @@ return "Very special instructions"; } + @Transient public Properties getProperties() { // TODO Auto-generated method stub return new Properties(); } + @Transient public Dimension getBoardSize() { // TODO Auto-generated method stub return new Dimension(600, 600); @@ -88,20 +91,25 @@ return 5; } + @Transient public Visibility getSubjectVisibility() { return Visibility.FULL; } + @Transient public Visibility getFoodVisibility() { return Visibility.FULL; } + @Transient public Duration getRoundDuration() { return Duration.create(240); } - public ExperimentConfiguration getConfiguration() { - return foragerConfiguration; + @ManyToOne(targetEntity=ForagerConfiguration.class) + @JoinColumn(name="configuration_id", nullable=false) + public ForagerConfiguration getConfiguration() { + return (ForagerConfiguration) super.getConfiguration(); } @Transient @@ -117,10 +125,6 @@ this.name = name; } - public void setId(long id) { - this.id = id; - } - public int getFoodSpoilDuration() { return foodSpoilDuration; } Modified: trunk/gee/war/WEB-INF/hibernate.cfg.xml =================================================================== --- trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-04 07:38:23 UTC (rev 135) +++ trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-04 18:50:24 UTC (rev 136) @@ -9,7 +9,9 @@ <session-factory> <mapping package="edu.indiana.psych.gee"/> <mapping class="edu.indiana.psych.gee.ConsentForm"/> + <mapping class="edu.indiana.psych.gee.ExperimentParametersEntity"/> <mapping package="edu.indiana.psych.gee.forager"/> + <mapping class="edu.indiana.psych.gee.forager.ForagerExperimentParameters"/> <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> </session-factory> </hibernate-configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-05 01:18:28
|
Revision: 140 Author: alllee Date: 2006-03-04 17:18:24 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=140&view=rev Log Message: ----------- it'll be easier to maintain this if we don't have to worry about auto-committing this file with user/pass info. Rename to jdbc.properties with the appropriate information at deployment time. Added Paths: ----------- trunk/gee/war/WEB-INF/jdbc.properties.example Removed Paths: ------------- trunk/gee/war/WEB-INF/jdbc.properties Deleted: trunk/gee/war/WEB-INF/jdbc.properties =================================================================== --- trunk/gee/war/WEB-INF/jdbc.properties 2006-03-04 21:02:42 UTC (rev 139) +++ trunk/gee/war/WEB-INF/jdbc.properties 2006-03-05 01:18:24 UTC (rev 140) @@ -1,7 +0,0 @@ -# replace these with custom database user/pass -# the database name -geedb.name=gee -# a username with privileges to admin experiments -geedb.user=dummy-user -# admin's db password -geedb.password=dummy-password Copied: trunk/gee/war/WEB-INF/jdbc.properties.example (from rev 137, trunk/gee/war/WEB-INF/jdbc.properties) =================================================================== --- trunk/gee/war/WEB-INF/jdbc.properties.example (rev 0) +++ trunk/gee/war/WEB-INF/jdbc.properties.example 2006-03-05 01:18:24 UTC (rev 140) @@ -0,0 +1,7 @@ +# replace these with custom database user/pass +# the database name +geedb.name=gee +# a username with privileges to admin experiments +geedb.user=dummy-user +# admin's db password +geedb.password=dummy-password This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-05 04:55:24
|
Revision: 142 Author: alllee Date: 2006-03-04 20:55:19 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=142&view=rev Log Message: ----------- trying to fix the mapping relationship between forager configuration and forager experiment parameters. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java trunk/gee/war/WEB-INF/hibernate.cfg.xml Modified: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-05 04:40:28 UTC (rev 141) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-05 04:55:19 UTC (rev 142) @@ -13,6 +13,7 @@ import javax.persistence.Table; import javax.persistence.Transient; +import org.hibernate.annotations.Proxy; /** * $Id$ @@ -26,8 +27,9 @@ */ @Entity +@Inheritance(strategy=InheritanceType.JOINED) @Table(name="experiment_configuration") -@Inheritance(strategy=InheritanceType.JOINED) +@Proxy(proxyClass=ExperimentConfiguration.class) public abstract class ExperimentConfigurationEntity<T extends ExperimentRoundParameters> implements ExperimentConfiguration<T> { Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-05 04:40:28 UTC (rev 141) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-05 04:55:19 UTC (rev 142) @@ -12,6 +12,9 @@ import javax.persistence.Table; import javax.persistence.Transient; +import org.hibernate.annotations.Proxy; + +import edu.indiana.psych.gee.ExperimentConfiguration; import edu.indiana.psych.gee.ExperimentConfigurationEntity; import edu.indiana.psych.gee.forager.client.ForagerApplet; import edu.indiana.psych.gee.time.Duration; @@ -30,6 +33,7 @@ @DiscriminatorValue("forager") @PrimaryKeyJoinColumn(name="experiment_configuration_id") @Table(name="forager_configuration") +@Proxy(proxyClass=ExperimentConfiguration.class) public class ForagerConfiguration extends ExperimentConfigurationEntity<ForagerExperimentParameters> { private List<ForagerExperimentParameters> allParameters; 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-05 04:40:28 UTC (rev 141) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperimentParameters.java 2006-03-05 04:55:19 UTC (rev 142) @@ -5,16 +5,11 @@ import java.util.List; import java.util.Properties; -import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; import javax.persistence.Transient; -import javax.persistence.*; import org.hibernate.annotations.Proxy; @@ -23,14 +18,10 @@ import edu.indiana.psych.gee.time.Duration; @Entity -@Inheritance(strategy=InheritanceType.JOINED) -@DiscriminatorValue("forager") -@PrimaryKeyJoinColumn(name="forager_parameters_id") -@Proxy(proxyClass=ExperimentRoundParameters.class) @Table(name="forager_parameters") +@Proxy(proxyClass=ExperimentRoundParameters.class) public class ForagerExperimentParameters implements ExperimentRoundParameters { - private ForagerAgentConfiguration agentConfiguration; private ForagerConfiguration configuration; @@ -40,7 +31,7 @@ private long id = -1; - ForagerExperimentParameters(ForagerConfiguration configuration) { + public ForagerExperimentParameters(ForagerConfiguration configuration) { setConfiguration(configuration); } Modified: trunk/gee/war/WEB-INF/hibernate.cfg.xml =================================================================== --- trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-05 04:40:28 UTC (rev 141) +++ trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-05 04:55:19 UTC (rev 142) @@ -9,7 +9,7 @@ <session-factory> <mapping package="edu.indiana.psych.gee"/> <mapping class="edu.indiana.psych.gee.ConsentForm"/> - <mapping class="edu.indiana.psych.gee.ExperimentParametersEntity"/> + <mapping class="edu.indiana.psych.gee.ExperimentConfigurationEntity"/> <mapping package="edu.indiana.psych.gee.forager"/> <mapping class="edu.indiana.psych.gee.forager.ForagerExperimentParameters"/> <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-05 07:40:47
|
Revision: 146 Author: alllee Date: 2006-03-04 23:40:40 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=146&view=rev Log Message: ----------- using spring to manage more of our objects. AbstractExperiment now gets the ExperimentService injected into it via Spring, when it receives the ExperimentService it adds itself to the ExperimentService. This means that actual experiments must be listed as beans in applicationContext.xml now. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentService.java trunk/gee/war/WEB-INF/applicationContext.xml Modified: trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-05 06:47:09 UTC (rev 145) +++ trunk/gee/src/java/edu/indiana/psych/gee/AbstractExperiment.java 2006-03-05 07:40:40 UTC (rev 146) @@ -10,6 +10,7 @@ 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.ExperimentService; import edu.indiana.psych.gee.time.Duration; /** @@ -28,7 +29,10 @@ private Thread serverThread; private boolean running; + + private ExperimentService service; + private String name; private T configuration; private ExperimentRoundParameters currentParameters; @@ -99,7 +103,10 @@ } public String getName() { - return getConfiguration().getExperimentName(); + if (name == null) { + name = getConfiguration().getExperimentName(); + } + return name; } public boolean equals(Object object) { @@ -145,6 +152,14 @@ // nextIndex = nextIndex % allParameters.size(); return allParameters.get(nextIndex).getSpecialInstructions(); } + + public void setExperimentService(ExperimentService service) { + if (this.service != null) { + this.service.remove(this); + } + this.service = service; + service.add(this); + } protected void transmit(Event event) { Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-05 06:47:09 UTC (rev 145) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-05 07:40:40 UTC (rev 146) @@ -41,10 +41,6 @@ super(serverName, port); } - public static ForagerConfiguration getDefaultConfiguration() { - return new ForagerConfiguration(getDefaultServerAddress(), 25000); - } - @Transient public Duration getDelayBetweenRounds() { return Duration.create(30); 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-05 06:47:09 UTC (rev 145) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerExperiment.java 2006-03-05 07:40:40 UTC (rev 146) @@ -26,6 +26,7 @@ import edu.indiana.psych.gee.net.ClientReadyEvent; import edu.indiana.psych.gee.net.ConnectionEvent; import edu.indiana.psych.gee.net.Dispatcher; +import edu.indiana.psych.gee.service.ExperimentService; import edu.indiana.psych.gee.time.Duration; import edu.indiana.psych.gee.util.GeeUtils; @@ -65,9 +66,9 @@ private boolean roundRunning; public ForagerExperiment(ForagerConfiguration configuration) { + addEventProcessors(); getLogger().debug("Creating a new ForagerExperiment with configuration: " + configuration); setConfiguration(configuration); - addEventProcessors(); this.delayBetweenRounds = configuration.getDelayBetweenRounds(); } Modified: trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentService.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentService.java 2006-03-05 06:47:09 UTC (rev 145) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentService.java 2006-03-05 07:40:40 UTC (rev 146) @@ -22,23 +22,18 @@ */ public class ExperimentService { - private final static Map<String, Experiment> allExperiments = - new HashMap<String, Experiment>(); + private final Map<String, Experiment> allExperiments = + new HashMap<String, Experiment>() { + public Experiment get(String key) { + if (key == null) { + return Experiment.NULL; + } + return super.get(key); + } + }; private final Log logger = LogFactory.getLog(getClass()); - public ExperimentService() { - logger.debug("instantiating ExperimentService : " + this); - synchronized (ExperimentService.class) { - if ( allExperiments.isEmpty() ) { - allExperiments.put(null, Experiment.NULL); - // FIXME: use ioc to grab a default forager configuration. - add(new ForagerExperiment(ForagerConfiguration.getDefaultConfiguration())); - // add(new SocialChoiceExperiment()); - } - } - } - public boolean start(String experimentName) { find(experimentName).start(); return available(experimentName); @@ -55,6 +50,16 @@ allExperiments.put(experiment.getName(), experiment); } + public void remove(Experiment experiment) { + if (experiment == null) { + logger.warn("Trying to remove a null experiment from ExperimentService - ignoring"); + return; + } + if ( allExperiments.remove(experiment.getName()) == null ) { + logger.warn("Tried to remove " + experiment + " which doesn't exist in ExperimentService"); + } + } + public Experiment find(String name) { Experiment experiment = allExperiments.get(name); if (experiment == null) { Modified: trunk/gee/war/WEB-INF/applicationContext.xml =================================================================== --- trunk/gee/war/WEB-INF/applicationContext.xml 2006-03-05 06:47:09 UTC (rev 145) +++ trunk/gee/war/WEB-INF/applicationContext.xml 2006-03-05 07:40:40 UTC (rev 146) @@ -4,6 +4,7 @@ --> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="autodetect"> + <!-- persistence layer beans --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="/WEB-INF/jdbc.properties"/> @@ -28,5 +29,20 @@ <ref bean="mysqlDataSource"/> </property> </bean> + <!-- application layer beans --> <bean id="experimentService" class="edu.indiana.psych.gee.service.ExperimentService"/> + <bean id="defaultForagerConfiguration" class="edu.indiana.psych.gee.forager.ForagerConfiguration"> + <constructor-arg value="groups.psych.indiana.edu"/> + <constructor-arg type="int"><value>26000</value></constructor-arg> + <property name="experimentName" value="forager"/> + <property name="description" + value="The Forager experiment explores how individuals allocate themselves + in a world with scarce resources"/> + <property name='clientJarName' value='forager-client.jar'/> + <property name='clientMainClass' value='edu.indiana.psych.gee.forager.ForagerApplet'/> + </bean> + <bean id="forager-web" class="edu.indiana.psych.gee.forager.ForagerExperiment"> + <constructor-arg ref="defaultForagerConfiguration"/> + <property name="experimentService" ref="experimentService"/> + </bean> </beans> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-03-23 06:44:06
|
Revision: 168 Author: alllee Date: 2006-03-22 22:43:54 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=168&view=rev Log Message: ----------- adding ExperimentConfiguration interface back into the mix now that I sort of understand how to use WW to automagically populate form parameters for instances of ExperimentConfiguration - use the Preparable interface for that. Still have some residual problems though... of course. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/action/GeeAction.java trunk/gee/src/java/edu/indiana/psych/gee/action/UpdateExperimentConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java trunk/gee/war/WEB-INF/classes/gee-admin.xml trunk/gee/war/WEB-INF/classes/xwork.xml trunk/gee/war/WEB-INF/hibernate.cfg.xml trunk/gee/war/WEB-INF/sitemesh.xml Added Paths: ----------- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java Removed Paths: ------------- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java Deleted: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-03-23 06:43:54 UTC (rev 168) @@ -1,188 +0,0 @@ -package edu.indiana.psych.gee; - -import java.net.InetSocketAddress; -import java.util.Iterator; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; -import javax.persistence.Transient; - -import edu.indiana.psych.gee.time.Duration; - -/** - * $Id$ - * - * Provides hibernate object/relational annotations for fields common to most - * ExperimentConfigurations, things like consent forms, experiment names, and - * a Collection of ExperimentRoundParameters. - * - * - * @author Allen Lee - * @version $Revision$ - */ - -@Entity -@Inheritance(strategy=InheritanceType.JOINED) -@Table(name="experiment_configuration") -public class ExperimentConfiguration<T extends ExperimentRoundParameters> { - - // this should be a configurable property.. - private final static String DEFAULT_SERVER_HOST_NAME = "groups.psych.indiana.edu"; - - // persistent fields - private Long id = Long.valueOf(-1); - private String description; - private String experimentName; - private String clientJarName; - private String clientMainClass; - private int worldHeight; - private int worldWidth; - private ConsentForm consentForm; - private int serverPort; - private String serverName; - private boolean triggeredExperiment; - // generated transient fields, no need to persist. - private transient InetSocketAddress serverAddress; - private transient T currentParameters; - private transient Iterator<T> parametersIterator; - - public ExperimentConfiguration() { - this(DEFAULT_SERVER_HOST_NAME, -1); - } - - public ExperimentConfiguration(String serverName, int port) { - setServerName(serverName); - setServerPort(port); - } - - @Transient - public synchronized InetSocketAddress getServerAddress() { - // FIXME: return configuration address instead? - if (serverAddress == null) { - serverAddress = new InetSocketAddress(serverName, getServerPort()); - if (serverAddress.isUnresolved()) { - // default should be specified via config file. - serverAddress = new InetSocketAddress(DEFAULT_SERVER_HOST_NAME, getServerPort()); - } - } - return serverAddress; - } - - @Id @GeneratedValue - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public int getServerPort() { - return serverPort; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - public String getServerName() { - return serverName; - } - - public void setServerName(String serverName) { - this.serverName = serverName; - } - - public boolean isTriggeredExperiment() { - // TODO Auto-generated method stub - return triggeredExperiment; - } - - public void setTriggeredExperiment(boolean triggeredExperiment) { - this.triggeredExperiment = triggeredExperiment; - } - - @ManyToOne - public ConsentForm getConsentForm() { - return consentForm; - } - public void setConsentForm(ConsentForm consentForm) { - this.consentForm = consentForm; - } - - // advances the parameters iterator or resets it. - public void updateCurrentParameters() { - if (parametersIterator == null || ! parametersIterator.hasNext()) { - parametersIterator = getAllParameters().iterator(); - } - currentParameters = parametersIterator.next(); - } - - @Transient - public synchronized T getCurrentParameters() { - List<T> allParameters = getAllParameters(); - if (currentParameters == null) { - if (allParameters.isEmpty()) { - throw new ExperimentLifecycleException("No experiment round parameters available for : " + getExperimentName()); - } - currentParameters = allParameters.get(0); - } - return currentParameters; - } - - - @Transient - public List<T> getAllParameters() { - throw new UnsupportedOperationException("Subclasses must override getAllParameters."); - } - - @Transient - public void setAllParameters(List<T> allParameters) { - throw new UnsupportedOperationException("Subclasses must override setAllParameters."); - } - - public String getClientJarName() { - return clientJarName; - } - - public void setClientJarName(String clientJarName) { - this.clientJarName = clientJarName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getExperimentName() { - return experimentName; - } - - public void setExperimentName(String experimentName) { - this.experimentName = experimentName; - } - - public String getClientMainClass() { - return clientMainClass; - } - - public void setClientMainClass(String clientMainClass) { - this.clientMainClass = clientMainClass; - } - - @Transient - public Duration getDelayBetweenRounds() { - return Duration.create(30); - } -} Added: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java 2006-03-23 06:43:54 UTC (rev 168) @@ -0,0 +1,47 @@ +package edu.indiana.psych.gee; + +import java.util.List; +import java.net.InetSocketAddress; + +import edu.indiana.psych.gee.time.Duration; + +/** + * $Id: Exp $ + * + * @author <a href='al...@cs...'>Allen Lee</a> + * @version $Revision: $ + */ + +public interface ExperimentConfiguration<T extends ExperimentRoundParameters> { + + public List<T> getAllParameters(); + public void setAllParameters(List<T> allParameters); + public T getCurrentParameters(); + + public String getServerName(); + public void setServerName(String serverName); + + public String getExperimentName(); + public void setExperimentName(String experimentName); + + public int getServerPort(); + public void setServerPort(int serverPort); + + public ConsentForm getConsentForm(); + public void setConsentForm(ConsentForm consentForm); + + public Duration getDelayBetweenRounds(); + + public String getDescription(); + public void setDescription(String description); + + public boolean isTriggeredExperiment(); + public void setTriggeredExperiment(boolean triggered); + + public InetSocketAddress getServerAddress(); + +} +/* + * $Log: $ + */ + Copied: trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java (from rev 166, trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfiguration.java) =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java (rev 0) +++ trunk/gee/src/java/edu/indiana/psych/gee/ExperimentConfigurationEntity.java 2006-03-23 06:43:54 UTC (rev 168) @@ -0,0 +1,191 @@ +package edu.indiana.psych.gee; + +import java.net.InetSocketAddress; +import java.util.Iterator; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Transient; + +import edu.indiana.psych.gee.time.Duration; + +/** + * $Id$ + * + * Provides hibernate object/relational annotations for fields common to most + * ExperimentConfigurations, things like consent forms, experiment names, and + * a Collection of ExperimentRoundParameters. + * + * + * @author Allen Lee + * @version $Revision$ + */ + +@Entity +@Inheritance(strategy=InheritanceType.JOINED) +@Table(name="experiment_configuration") +public abstract class ExperimentConfigurationEntity<T extends ExperimentRoundParameters> +implements ExperimentConfiguration<T> { + + // this should be a configurable property.. + private final static String DEFAULT_SERVER_HOST_NAME = "groups.psych.indiana.edu"; + + // persistent fields + private Long id = Long.valueOf(-1); + private String description; + private String experimentName; + private String clientJarName; + private String clientMainClass; + private int worldHeight; + private int worldWidth; + private ConsentForm consentForm; + private int serverPort; + private String serverName; + private boolean triggeredExperiment; + // generated transient fields, no need to persist. + private transient InetSocketAddress serverAddress; + private transient T currentParameters; + private transient Iterator<T> parametersIterator; + + public ExperimentConfigurationEntity() { + this(DEFAULT_SERVER_HOST_NAME, -1); + } + + public ExperimentConfigurationEntity(String serverName, int port) { + setServerName(serverName); + setServerPort(port); + } + + @Transient + public synchronized InetSocketAddress getServerAddress() { + // FIXME: return configuration address instead? + if (serverAddress == null) { + serverAddress = new InetSocketAddress(serverName, getServerPort()); + if (serverAddress.isUnresolved()) { + // default should be specified via config file. + serverAddress = new InetSocketAddress(DEFAULT_SERVER_HOST_NAME, getServerPort()); + } + } + return serverAddress; + } + + @Id @GeneratedValue + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public int getServerPort() { + return serverPort; + } + + public void setServerPort(int serverPort) { + this.serverPort = serverPort; + } + + public String getServerName() { + return serverName; + } + + public void setServerName(String serverName) { + this.serverName = serverName; + } + + public boolean isTriggeredExperiment() { + // TODO Auto-generated method stub + return triggeredExperiment; + } + + public void setTriggeredExperiment(boolean triggeredExperiment) { + this.triggeredExperiment = triggeredExperiment; + } + + @ManyToOne + public ConsentForm getConsentForm() { + return consentForm; + } + public void setConsentForm(ConsentForm consentForm) { + this.consentForm = consentForm; + } + + // advances the parameters iterator or resets it. + public void updateCurrentParameters() { + if (parametersIterator == null || ! parametersIterator.hasNext()) { + parametersIterator = getAllParameters().iterator(); + } + currentParameters = parametersIterator.next(); + } + + @Transient + public synchronized T getCurrentParameters() { + List<T> allParameters = getAllParameters(); + if (currentParameters == null) { + if (allParameters.isEmpty()) { + throw new ExperimentLifecycleException("No experiment round parameters available for : " + getExperimentName()); + } + currentParameters = allParameters.get(0); + } + return currentParameters; + } + + + /* + @Transient + public List<T> getAllParameters() { + throw new UnsupportedOperationException("Subclasses must override getAllParameters."); + } + + @Transient + public void setAllParameters(List<T> allParameters) { + throw new UnsupportedOperationException("Subclasses must override setAllParameters."); + } + */ + + public String getClientJarName() { + return clientJarName; + } + + public void setClientJarName(String clientJarName) { + this.clientJarName = clientJarName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getExperimentName() { + return experimentName; + } + + public void setExperimentName(String experimentName) { + this.experimentName = experimentName; + } + + public String getClientMainClass() { + return clientMainClass; + } + + public void setClientMainClass(String clientMainClass) { + this.clientMainClass = clientMainClass; + } + + @Transient + public Duration getDelayBetweenRounds() { + return Duration.create(30); + } +} Modified: trunk/gee/src/java/edu/indiana/psych/gee/action/GeeAction.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/GeeAction.java 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/GeeAction.java 2006-03-23 06:43:54 UTC (rev 168) @@ -6,6 +6,7 @@ import com.opensymphony.xwork.ActionSupport; import edu.indiana.psych.gee.service.ExperimentService; +import edu.indiana.psych.gee.service.ExperimentConfigurationService; /** * $Id$ @@ -22,16 +23,26 @@ private final Log logger = LogFactory.getLog(getClass()); private ExperimentService experimentService; + private ExperimentConfigurationService configurationService; protected Log getLogger() { return logger; } - + protected ExperimentService getExperimentService() { return experimentService; } + protected ExperimentConfigurationService getConfigurationService() { + return configurationService; + } + public void setExperimentService(ExperimentService experimentService) { this.experimentService = experimentService; } + + public void setConfigurationService(ExperimentConfigurationService configurationService) { + this.configurationService = configurationService; + } + } Modified: trunk/gee/src/java/edu/indiana/psych/gee/action/UpdateExperimentConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/action/UpdateExperimentConfiguration.java 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/src/java/edu/indiana/psych/gee/action/UpdateExperimentConfiguration.java 2006-03-23 06:43:54 UTC (rev 168) @@ -2,6 +2,8 @@ import java.util.List; +import com.opensymphony.xwork.Preparable; + import edu.indiana.psych.gee.Experiment; import edu.indiana.psych.gee.ExperimentRoundParameters; import edu.indiana.psych.gee.ExperimentConfiguration; @@ -10,11 +12,13 @@ /** * $Id: Exp $ * + * WW action handling changes made to experiment configurations. + * * @author <a href='al...@cs...'>Allen Lee</a> * @version $Revision: $ */ -public class UpdateExperimentConfiguration extends GeeAction { +public class UpdateExperimentConfiguration extends GeeAction implements Preparable { private String experimentName; @@ -22,26 +26,26 @@ public String execute() { getLogger().debug("XXX: updating experiment configuration: " + configuration); + getConfigurationService().persist(configuration); return SUCCESS; } + public void prepare() throws Exception { + this.configuration = getExperimentService().find(experimentName).getConfiguration(); + } + public ExperimentConfiguration getConfiguration() { return configuration; } - public List<? extends ExperimentRoundParameters> getAllParameters() { - getLogger().warn("XXX: Returning: " + configuration.getAllParameters()); - return configuration.getAllParameters(); - } - + /* public void setConfiguration(ExperimentConfiguration configuration) { this.configuration = configuration; } + */ public void setExperimentName(String experimentName) { getLogger().warn("XXX: setting experiment name: " + experimentName); this.experimentName = experimentName; - this.configuration = getExperimentService().find(experimentName).getConfiguration(); - } } Modified: trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java =================================================================== --- trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/src/java/edu/indiana/psych/gee/forager/ForagerConfiguration.java 2006-03-23 06:43:54 UTC (rev 168) @@ -10,7 +10,7 @@ import javax.persistence.Table; import javax.persistence.Transient; -import edu.indiana.psych.gee.ExperimentConfiguration; +import edu.indiana.psych.gee.ExperimentConfigurationEntity; /** * $Id$ @@ -24,7 +24,7 @@ @Entity @PrimaryKeyJoinColumn(name="experiment_configuration_id") @Table(name="forager_configuration") -public class ForagerConfiguration extends ExperimentConfiguration<ForagerExperimentParameters> { +public class ForagerConfiguration extends ExperimentConfigurationEntity<ForagerExperimentParameters> { private List<ForagerExperimentParameters> allParameters; Modified: trunk/gee/war/WEB-INF/classes/gee-admin.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/war/WEB-INF/classes/gee-admin.xml 2006-03-23 06:43:54 UTC (rev 168) @@ -30,6 +30,7 @@ <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> Modified: trunk/gee/war/WEB-INF/classes/xwork.xml =================================================================== --- trunk/gee/war/WEB-INF/classes/xwork.xml 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/war/WEB-INF/classes/xwork.xml 2006-03-23 06:43:54 UTC (rev 168) @@ -5,30 +5,35 @@ <!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.1.dtd"> <xwork> <include file="webwork-default.xml"/> - <package name="default" extends="webwork-default"> <interceptors> - <interceptor-stack name="geeDefaultStack"> - <interceptor-ref name="exception"/> + <interceptor-stack name="prepareStack"> + <interceptor-ref name="params"/> + <interceptor-ref name="prepare"/> + <interceptor-ref name="exception"/> + <interceptor-ref name="servlet-config"/> + <interceptor-ref name="params"/> + </interceptor-stack> + <interceptor-stack name="geeDefaultStack"> + <interceptor-ref name="exception"/> <!-- <interceptor-ref name="alias"/> --> - <interceptor-ref name="servlet-config"/> - <interceptor-ref name="prepare"/> + <interceptor-ref name="servlet-config"/> + <interceptor-ref name="prepare"/> <!-- <interceptor-ref name="i18n"/> --> - <interceptor-ref name="chain"/> + <interceptor-ref name="chain"/> <!-- <interceptor-ref name="model-driven"/> --> <!-- <interceptor-ref name="fileUpload"/> --> - <interceptor-ref name="static-params"/> - <interceptor-ref name="params"/> - <interceptor-ref name="conversionError"/> - <interceptor-ref name="validation"> - <param name="excludeMethods">input,back,cancel</param> - </interceptor-ref> - <interceptor-ref name="workflow"> - <param name="excludeMethods">input,back,cancel</param> - </interceptor-ref> - </interceptor-stack> - </interceptors> - +<!-- <interceptor-ref name="static-params"/> --> + <interceptor-ref name="params"/> + <interceptor-ref name="conversionError"/> + <interceptor-ref name="validation"> + <param name="excludeMethods">input,back,cancel</param> + </interceptor-ref> + <interceptor-ref name="workflow"> + <param name="excludeMethods">input,back,cancel</param> + </interceptor-ref> + </interceptor-stack> + </interceptors> <default-interceptor-ref name="geeDefaultStack"/> <!-- the start page lists all available experiments --> <action name="index" class="edu.indiana.psych.gee.action.ListExperiments"> @@ -45,8 +50,6 @@ <result name="input">consent.jsp</result> </action> </package> - <include file="gee-ajax.xml"/> <include file="gee-admin.xml"/> - </xwork> Modified: trunk/gee/war/WEB-INF/hibernate.cfg.xml =================================================================== --- trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/war/WEB-INF/hibernate.cfg.xml 2006-03-23 06:43:54 UTC (rev 168) @@ -9,7 +9,7 @@ <session-factory> <mapping package="edu.indiana.psych.gee"/> <mapping class="edu.indiana.psych.gee.ConsentForm"/> - <mapping class="edu.indiana.psych.gee.ExperimentConfiguration"/> + <mapping class="edu.indiana.psych.gee.ExperimentConfigurationEntity"/> <mapping package="edu.indiana.psych.gee.forager"/> <mapping class="edu.indiana.psych.gee.forager.ForagerAgentConfiguration"/> <mapping class="edu.indiana.psych.gee.forager.ForagerConfiguration"/> Modified: trunk/gee/war/WEB-INF/sitemesh.xml =================================================================== --- trunk/gee/war/WEB-INF/sitemesh.xml 2006-03-23 05:38:49 UTC (rev 167) +++ trunk/gee/war/WEB-INF/sitemesh.xml 2006-03-23 06:43:54 UTC (rev 168) @@ -3,21 +3,15 @@ vim:sts=2:sw=2: --> <sitemesh> - <property name="decorators.file" value="/WEB-INF/decorators.xml" /> - <excludes file="${decorators.file}" /> - - <page-parsers> - <parser content-type="text/html" - class="com.opensymphony.module.sitemesh.parser.FastPageParser" /> - <parser content-type="text/html;charset=ISO-8859-1" - class="com.opensymphony.module.sitemesh.parser.FastPageParser" /> - </page-parsers> - - <decorator-mappers> - <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper"> - <param name="config" value="${decorators.file}" /> - </mapper> - </decorator-mappers> + <property name="decorators.file" value="/WEB-INF/decorators.xml"/> + <excludes file="${decorators.file}"/> + <page-parsers> + <parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.FastPageParser"/> + <parser content-type="text/html;charset=ISO-8859-1" class="com.opensymphony.module.sitemesh.parser.FastPageParser"/> + </page-parsers> + <decorator-mappers> + <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper"> + <param name="config" value="${decorators.file}"/> + </mapper> + </decorator-mappers> </sitemesh> - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-04-23 03:38:49
|
Revision: 171 Author: alllee Date: 2006-04-22 20:38:39 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=171&view=rev Log Message: ----------- better namage for reusing this webapplication structure down the road. Modified Paths: -------------- trunk/gee/war/WEB-INF/applicationContext.xml trunk/gee/war/WEB-INF/jdbc.properties.example Modified: trunk/gee/war/WEB-INF/applicationContext.xml =================================================================== --- trunk/gee/war/WEB-INF/applicationContext.xml 2006-04-13 00:46:54 UTC (rev 170) +++ trunk/gee/war/WEB-INF/applicationContext.xml 2006-04-23 03:38:39 UTC (rev 171) @@ -16,9 +16,9 @@ <bean id="mysqlDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> - <property name="url" value="jdbc:mysql://localhost/${geedb.name}"/> - <property name="username" value="${geedb.user}"/> - <property name="password" value="${geedb.password}"/> + <property name="url" value="jdbc:mysql://localhost/${db.name}"/> + <property name="username" value="${db.user}"/> + <property name="password" value="${db.password}"/> </bean> <!-- hibernate beans, session factory and transaction manager --> Modified: trunk/gee/war/WEB-INF/jdbc.properties.example =================================================================== --- trunk/gee/war/WEB-INF/jdbc.properties.example 2006-04-13 00:46:54 UTC (rev 170) +++ trunk/gee/war/WEB-INF/jdbc.properties.example 2006-04-23 03:38:39 UTC (rev 171) @@ -1,7 +1,7 @@ # replace these with custom database user/pass # the database name -geedb.name=gee +db.name=gee # a username with privileges to admin experiments -geedb.user=dummy-user +db.user=dummy-user # admin's db password -geedb.password=dummy-password +db.password=dummy-password This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <al...@us...> - 2006-05-17 00:06:17
|
Revision: 175 Author: alllee Date: 2006-05-16 17:06:07 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/gabel/?rev=175&view=rev Log Message: ----------- making the webapp deployable again, fixing Spring wiring. Modified Paths: -------------- trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java trunk/gee/war/WEB-INF/applicationContext.xml 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-17 00:00:59 UTC (rev 174) +++ trunk/gee/src/java/edu/indiana/psych/gee/service/ExperimentConfigurationService.java 2006-05-17 00:06:07 UTC (rev 175) @@ -17,7 +17,7 @@ public class ExperimentConfigurationService { - private HibernateExperimentConfigurationDao experimentConfigurationDao; + private ExperimentConfigurationDao experimentConfigurationDao; private ConsentFormDao consentFormDao; public <E extends ExperimentConfiguration> E load(Class<E> configurationClass, InputStream stream) { @@ -48,7 +48,7 @@ experimentConfigurationDao.persist(configuration); } - public void setExperimentConfigurationDao(HibernateExperimentConfigurationDao experimentConfigurationDao) { + public void setExperimentConfigurationDao(ExperimentConfigurationDao experimentConfigurationDao) { this.experimentConfigurationDao = experimentConfigurationDao; } Modified: trunk/gee/war/WEB-INF/applicationContext.xml =================================================================== --- trunk/gee/war/WEB-INF/applicationContext.xml 2006-05-17 00:00:59 UTC (rev 174) +++ trunk/gee/war/WEB-INF/applicationContext.xml 2006-05-17 00:06:07 UTC (rev 175) @@ -53,7 +53,7 @@ <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- persistence layer daos--> - <bean id="experimentConfigurationDao" class="edu.indiana.psych.gee.service.ExperimentConfigurationDao"> + <bean id="experimentConfigurationDao" class="edu.indiana.psych.gee.service.HibernateExperimentConfigurationDao"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="consentFormDao" class="edu.indiana.psych.gee.service.HibernateConsentFormDao"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |