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,48 +40,53 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
require.config({ $.ajax(
baseUrl: "js/" {
}); url: "restServices/archivaServices/commonServices/devMode",
// CacheBust is for dev purpose use false in prod env ! success:function(data){
var options = { require.config({
AlwaysPreserveOrder:true, baseUrl: "js/"
BasePath:"js/", });
explicit_preloading:false, // CacheBust is for dev purpose use false in prod env !
CacheBust:true var options = {
}; AlwaysPreserveOrder:true,
$LAB.setGlobalDefaults(options); BasePath:"js/",
$LAB explicit_preloading:false,
.script("jquery.tmpl.js").wait() CacheBust:data=='true'
.script("archiva/utils.js").wait() };
.script("jquery.i18n.properties-1.0.9.js").wait() $LAB.setGlobalDefaults(options);
.script("archiva/i18nload.js").wait() $LAB
.script("jquery.cookie.1.0.0.js").wait() .script("jquery.tmpl.js").wait()
.script("knockout-debug.js").wait() .script("archiva/utils.js").wait()
.script("jquery-ui-1.8.16.custom.min.js").wait() .script("jquery.i18n.properties-1.0.9.js").wait()
.script("jquery.validate.js").wait() .script("archiva/i18nload.js").wait()
.script("jquery.json-2.3.min.js").wait() .script("jquery.cookie.1.0.0.js").wait()
.script("archiva/main-tmpl.js").wait() .script("knockout-debug.js").wait()
.script("archiva/repositories.js").wait() .script("jquery-ui-1.8.16.custom.min.js").wait()
.script("redback/operation.js").wait() .script("jquery.validate.js").wait()
.script("redback/redback-tmpl.js").wait() .script("jquery.json-2.3.min.js").wait()
.script("bootstrap-tabs.js") .script("archiva/main-tmpl.js").wait()
.script("bootstrap-modal.js") .script("archiva/repositories.js").wait()
.script("bootstrap-alerts.js") .script("redback/operation.js").wait()
.script("bootstrap-dropdown.js") .script("redback/redback-tmpl.js").wait()
.script("bootstrap-twipsy.js") .script("bootstrap-tabs.js")
.script("bootstrap-popover.js") .script("bootstrap-modal.js")
.script("knockout.simpleGrid.js") .script("bootstrap-alerts.js")
.script("knockout.mapping-latest.debug.js") .script("bootstrap-dropdown.js")
.script("redback/user.js").wait() .script("bootstrap-twipsy.js")
.script("redback/users.js").wait() .script("bootstrap-popover.js")
.script("redback/redback.js").wait() .script("knockout.simpleGrid.js")
.script("redback/register.js").wait() .script("knockout.mapping-latest.debug.js")
.script("redback/permission.js").wait() .script("redback/user.js").wait()
.script("redback/resource.js").wait() .script("redback/users.js").wait()
.script("redback/roles.js").wait() .script("redback/redback.js").wait()
.script("archiva/main.js"); .script("redback/register.js").wait()
.script("redback/permission.js").wait()
.script("redback/resource.js").wait()
.script("redback/roles.js").wait()
.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>