add a system property to configure lab js cache for script loading: true in dev env

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-23 22:32:45 +00:00
parent 57ae3fdc6a
commit ad26a0d39e
6 changed files with 77 additions and 42 deletions

View File

@ -59,4 +59,10 @@ public interface CommonServices
*/
String getAllI18nResources( @QueryParam( "locale" ) String locale )
throws ArchivaRestServiceException;
@Path( "devMode" )
@GET
@Produces( { MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
Boolean devMode();
}

View File

@ -168,4 +168,9 @@ public class DefaultCommonServices
IOUtils.closeQuietly( inputStream );
}
}
public Boolean devMode()
{
return Boolean.getBoolean( "archiva.devMode" );
}
}

View File

@ -39,6 +39,8 @@ public class ArchivaRuntimeInfo
private long timestamp;
private boolean devMode;
@Inject
public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties )
@ -46,6 +48,7 @@ public class ArchivaRuntimeInfo
this.version = (String) archivaRuntimeProperties.get( "archiva.version" );
this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
this.timestamp = NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) );
this.devMode = Boolean.getBoolean( "archiva.devMode" );
}
public String getVersion()
@ -78,6 +81,16 @@ public class ArchivaRuntimeInfo
this.timestamp = timestamp;
}
public boolean isDevMode()
{
return devMode;
}
public void setDevMode( boolean devMode )
{
this.devMode = devMode;
}
@Override
public String toString()
{
@ -86,6 +99,7 @@ public class ArchivaRuntimeInfo
sb.append( "{version='" ).append( version ).append( '\'' );
sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
sb.append( ", timestamp=" ).append( timestamp );
sb.append( ", devMode=" ).append( devMode );
sb.append( '}' );
return sb.toString();
}

View File

@ -34,6 +34,7 @@
<tomcatContextXml>${basedir}/src/test/tomcat/tomcat-context.xml</tomcatContextXml>
<tomcatRunPort>9091</tomcatRunPort>
<tomcatRunPath>/archiva</tomcatRunPath>
<archiva.devMode>true</archiva.devMode>
</properties>
<dependencies>
@ -544,6 +545,7 @@
<redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
<archiva.devMode>${archiva.devMode}</archiva.devMode>
</systemProperties>
</configuration>
<dependencies>
@ -576,6 +578,7 @@
</redback.admin.creation.file>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
<archiva.devMode>${archiva.devMode}</archiva.devMode>
</systemProperties>
</configuration>
<dependencies>
@ -606,6 +609,7 @@
<redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
<archiva.devMode>${archiva.devMode}</archiva.devMode>
</systemProperties>
</configuration>
<dependencies>

View File

@ -40,6 +40,10 @@
</div>
<script type="text/javascript">
$.ajax(
{
url: "restServices/archivaServices/commonServices/devMode",
success:function(data){
require.config({
baseUrl: "js/"
});
@ -48,7 +52,7 @@
AlwaysPreserveOrder:true,
BasePath:"js/",
explicit_preloading:false,
CacheBust:true
CacheBust:data=='true'
};
$LAB.setGlobalDefaults(options);
$LAB
@ -81,7 +85,8 @@
.script("redback/resource.js").wait()
.script("redback/roles.js").wait()
.script("archiva/main.js");
}
})
</script>
</html>

View File

@ -351,6 +351,7 @@
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<appserver.home>${project.build.directory}/appserver-base</appserver.home>
<derby.system.home>${project.build.directory}</derby.system.home>
<archiva.devMode>true</archiva.devMode>
</systemProperties>
<contextFile>src/test/${container.name}/Catalina/localhost/archiva.xml</contextFile>
<useNaming>true</useNaming>