Skip to content

Commit

Permalink
Ready for the stable6 ?
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume committed May 23, 2009
1 parent 302cc1b commit fc0478a
Show file tree
Hide file tree
Showing 96 changed files with 1,400 additions and 1,373 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2008
Copyright 2009

Guillaume Bort(http://guillaume.bort.fr)
The Play! developers team (https://launchpad.net/~play-developers)
Expand Down
83 changes: 56 additions & 27 deletions framework/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@
<delete dir="tests-tmp" />
<delete file="play.jar" />
<delete file="src/play/version" />
<delete includeemptydirs="true">
<fileset dir="../samples-and-tests">
<include name="**/test-result/**"/>
<include name="**/tmp/**"/>
<include name="**/db/**"/>
<include name="**/attachments/**"/>
<include name="**/nbproject/**"/>
</fileset>
</delete>
</target>

<target name="version" unless="version">
<exec executable="bzr" outputproperty="bzrversion" errorproperty="bzrerror" failonerror="false" failifexecutionfails="false">
<arg value="revno" />
</exec>
<condition property="version" value="1.0-stable5-r${bzrversion}" else="1.0-stable5-localbuild">
<condition property="version" value="1.0-stable6-r${bzrversion}" else="1.0-stable6-localbuild">
<equals arg1="" arg2="${bzrerror}" trim="true" />
</condition>
<echo message="Version ${version}"></echo>
Expand Down Expand Up @@ -174,35 +183,55 @@
<!-- Launch all *Test.java -->

<target name="test" depends="jar" description="run tests suite">
<echo message="Forum application ... (wait)" />
<exec executable="${basedir}/../play.bat" osfamily="windows">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/forum"/>
</exec>
<exec executable="${basedir}/../play" osfamily="unix">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/forum"/>
</exec>
<condition property="playExtension" value=".bat">
<and><os family="windows"/></and>
</condition>
<condition property="playExtension" value="">
<and><os family="unix"/></and>
</condition>

<echo message="GWT application ... (wait)" />
<exec executable="${basedir}/../play.bat" osfamily="windows">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/with-gwt"/>
</exec>
<exec executable="${basedir}/../play" osfamily="unix">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/with-gwt"/>
</exec>
<echo message="Using ${basedir}/../play${playExtension}" />

<echo message="Jobs application ... (wait)" />
<exec executable="${basedir}/../play.bat" osfamily="windows">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/jobboard"/>
</exec>
<exec executable="${basedir}/../play" osfamily="unix">
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/just-test-cases"/>
</antcall>

<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/forum"/>
</antcall>

<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/with-gwt"/>
</antcall>

<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/jobboard"/>
</antcall>

<antcall target="test-success" />

</target>

<target name="test-success">
<echo message="*****************" />
<echo message="All test passed !" />
<echo message="*****************" />
</target>

<target name="play-test">
<echo message="play auto-test ${testAppPath} (wait)" />
<exec executable="${basedir}/../play${playExtension}" failonerror="true">
<arg value="auto-test"/>
<arg value="${basedir}/../samples-and-tests/jobboard"/>
<arg value="${testAppPath}"/>
</exec>
<available file="${testAppPath}/test-result/result.passed" property="${testAppPath}testPassed" />
<fail message="Last test has failed ! (Check results in file://${testAppPath}/test-result)">
<condition>
<not>
<isset property="${testAppPath}testPassed"/>
</not>
</condition>
</fail>
</target>

<target name="debug-test-single" depends="compile-tests" description="debug a single test">
Expand Down Expand Up @@ -246,7 +275,7 @@
<target name="package" depends="clean,version,jar,javadoc">
<mkdir dir="dist" />
<zip destfile="dist/play-${version}.zip" comment="Play! ${version}" update="false">
<zipfileset prefix="play-${version}" dir=".." includes="**/*" excludes=".*,.*/*,framework/dist/**,id,play,nbproject/**,**/.bzr/**,*.bzrignore,framework/classes/**,framework/tests-results/**" />
<zipfileset prefix="play-${version}" dir=".." includes="**/*" excludes=".*,.*/*,framework/dist/**,id,play,nbproject/**,**/.bzr/**,*.bzrignore,framework/classes/**,framework/tests-results/**,samples-and-tests/**/test-result,samples-and-tests/**/tmp,samples-and-tests/**/db,samples-and-tests/**/attachments" />
<zipfileset prefix="play-${version}" dir=".." includes="play" filemode="777" />
</zip>
</target>
Expand Down
Empty file modified framework/lib/oval-1.31.jar
100755 → 100644
Empty file.
15 changes: 15 additions & 0 deletions framework/src/ehcache.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd">

<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>

</ehcache>
1 change: 0 additions & 1 deletion framework/src/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ log4j.logger.org.hibernate=WARN
log4j.logger.DataNucleus=WARN
log4j.logger.org.apache.commons.httpclient=ERROR
log4j.logger.net.sf.oval.internal=ERROR
log4j.logger.net.sf.ehcache=ERROR

# Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
Expand Down
136 changes: 71 additions & 65 deletions framework/src/play/cache/EhCacheImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,55 @@
*/
public class EhCacheImpl implements CacheImpl {

private static EhCacheImpl uniqueInstance;
private EhCacheImpl() {
private static EhCacheImpl uniqueInstance;

private EhCacheImpl() {
this.cacheManager = CacheManager.create();
this.cacheManager.addCache("play");
this.cache = cacheManager.getCache("play");
}

public static EhCacheImpl getInstance() {
if(uniqueInstance == null)
uniqueInstance = new EhCacheImpl();
return uniqueInstance;
}
}

public static EhCacheImpl getInstance() {
if (uniqueInstance == null) {
uniqueInstance = new EhCacheImpl();
}
return uniqueInstance;
}
CacheManager cacheManager;

net.sf.ehcache.Cache cache;

public void add(String key, Object value, int expiration) {
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
}

public void clear() {
cache.removeAll();
}

public synchronized long decr(String key, int by) {
Element e = cache.get(key);
if (e == null) {
return -1;
}
long newValue = (Long) e.getValue() - by;
Element newE = new Element(key, newValue, e.getExpirationTime());
cache.put(newE);
return newValue;
}

public void delete(String key) {
cache.remove(key);
}

public Object get(String key) {
Element e = cache.get(key);
return (e == null) ? null : e.getValue();
}
if(cache.get(key) != null) {
return;
}
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
}

public void clear() {
cache.removeAll();
}

public synchronized long decr(String key, int by) {
Element e = cache.get(key);
if (e == null) {
return -1;
}
long newValue = ((Number) e.getValue()).longValue() - by;
Element newE = new Element(key, newValue, e.getExpirationTime());
cache.put(newE);
return newValue;
}

public void delete(String key) {
cache.remove(key);
}

public Object get(String key) {
Element e = cache.get(key);
return (e == null) ? null : e.getValue();
}

public Map<String, Object> get(String[] keys) {
Map<String, Object> result = new HashMap<String, Object>();
Expand All @@ -68,69 +70,73 @@ public Map<String, Object> get(String[] keys) {
}

public long incr(String key, int by) {
Element e = cache.get(key);
if (e == null) {
return -1;
}
long newValue = (Long) e.getValue() + by;
Element newE = new Element(key, newValue, e.getExpirationTime());
cache.put(newE);
return newValue;
Element e = cache.get(key);
if (e == null) {
return -1;
}
long newValue = ((Number) e.getValue()).longValue() + by;
Element newE = new Element(key, newValue, e.getExpirationTime());
cache.put(newE);
return newValue;

}

public void replace(String key, Object value, int expiration) {
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
if(cache.get(key) == null) {
return;
}
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
}

public boolean safeAdd(String key, Object value, int expiration) {
public boolean safeAdd(String key, Object value, int expiration) {
try {
set(key, value, expiration);
add(key, value, expiration);
return true;
} catch (Exception e) {
return false;
}
}
}

public boolean safeDelete(String key) {
public boolean safeDelete(String key) {
try {
delete(key);
return true;
} catch (Exception e) {
Logger.error(e.toString());
return false;
}
}
}

public boolean safeReplace(String key, Object value, int expiration) {
public boolean safeReplace(String key, Object value, int expiration) {
try {
replace(key, value, expiration);
return true;
} catch (Exception e) {
Logger.error(e.toString());
return false;
}
}
}

public boolean safeSet(String key, Object value, int expiration) {
public boolean safeSet(String key, Object value, int expiration) {
try {
set(key, value, expiration);
return true;
} catch (Exception e) {
Logger.error(e.toString());
return false;
}
}
}

public void set(String key, Object value, int expiration) {
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
Element element = new Element(key, value);
element.setTimeToLive(expiration);
cache.put(element);
}

public void stop() {
cacheManager.shutdown();
}
public void stop() {
System.out.println("CLOSE");
cache.removeAll();
}
}
5 changes: 4 additions & 1 deletion framework/src/play/data/binding/AlternativeDateFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public static AlternativeDateFormat getDefaultFormatter () {
"yyyyMMddhhmmss",
"dd'/'MM'/'yyyy",
"dd-MM-yyyy",
"ddMMyyyy"));
"ddMMyyyy",
"MMddyy",
"MM-dd-yy",
"MM'/'dd'/'yy"));
}
return dateformat.get();
}
Expand Down
Loading

0 comments on commit fc0478a

Please sign in to comment.