SREE repository corruption
From PTAGISWiki
Marton says that this is how we are doing the calls:
For reference here are the commands used to programmatically modify/delete/create a report template:
RepletRegistry reg = RepletRegistry.getRegistry(); AnalyticRepository re = (new SreeEnv()).getRepletRepository();
Deletes an old report
// 1. removes the physical file
File fOrgTemplate = new File(templatePath);
fOrgTemplate.delete();
// 2. removes the registry entry
reg.removeReplet(fullReportName);
reg.save();
// 3. removes the schedule associated with this report if any
ScheduleTask theTask = re.getScheduleTask(taskName);
if (theTask!=null) { re.removeScheduleTask(m_oPrincipal, taskName); }
Adds a new report
// 4. creates the actual .srt template file called saveTemplateName
// 5. adds the sql command as a replet request
RepletRequest theRequest = new RepletRequest(RepletRequest.INIT);
theRequest.setParameter("sql", sReportSql);
// 6. registers the replet
reg.register(fullReportName, "inetsoft.sree.TemplateReplet", "", null,
"default", 1, theRequest, null);
reg.setTemplate(fullReportName, saveTemplateName);
reg.save();
Charvi: The code should be wrapped in an invoked thread.
import inetsoft.report.internal.*;
import inetsoft.util.*;
threadGroup = new ThreadGroup("Report Server");
KeyRing.setKey(threadGroup,sreeHome);
Tool.invokeThread(threadGroup, new Runnable()){
// put the code here that accesses the repository
// put everything from getregistry to save in here
// the whole loop
}
Should make sure that you get a global instance.
Marton: this sounds like it will work in a single machine, but how do we resolve contention when we have two machines sharing the same filesystem?
Charvi: multiple JVMs are OK as long as you use a unique threadGroup name: sreeHome
Marton: the 7.0 docs say you don't have to use clear anymore and that it could cause corruption. Is that true?
Charvi: Yes.
Marton: how can you tell which registry you have gotten, to verify.
Charvi: you could print the hashcode. But testing the content is best.
