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 ) String getAllI18nResources( @QueryParam( "locale" ) String locale )
throws ArchivaRestServiceException; 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 ); IOUtils.closeQuietly( inputStream );
} }
} }
public Boolean devMode()
{
return Boolean.getBoolean( "archiva.devMode" );
}
} }

View File

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

View File

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

View File

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

View File

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