* Builds the configuration.
*/
public void configure() {
// initialize
this.indexReferences = new AsnIndexReferences();
this.operations = new AsnOperations();
AsnIndexReferences indexRefs = this.indexReferences;
ApplicationConfiguration appCfg = ApplicationContext.getInstance().getConfiguration();
CatalogConfiguration catCfg = appCfg.getCatalogConfiguration();
StringAttributeMap catParams = catCfg.getParameters();
LuceneConfig luceneCfg = catCfg.getLuceneConfig();
// API operations
AsnOperation op = new AsnOperation();
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnApiHandler");
op.setSubject(new AsnSubject(AsnConstants.APP_URN_PREFIX));
op.getSubject().setRequiresValuePart(false);
op.setPredicate(new AsnPredicate(AsnConstants.APP_URN_PREFIX+":assertion:operations"));
op.setAuthPolicy(new AsnAuthPolicy());
op.getAuthPolicy().setAuthenticationRequired(false);
op.getAuthPolicy().setQueryPrincipals(new AsnPrincipals());
op.getAuthPolicy().getQueryPrincipals().add(AsnConstants.PRINCIPAL_ANY);
this.operations.add(op);
// root index reference
String val = Val.chkStr(catParams.getValue("assertion.index.allowNonLocalResourceIds"));
this.allowNonLocalResourceIds = val.equalsIgnoreCase("true");
AsnIndexReference rootIndexRef = new AsnIndexReference();
val = Val.chkStr(catParams.getValue("assertion.index.enabled"));
rootIndexRef.setEnabled(!val.equalsIgnoreCase("false"));
val = Val.chkStr(catParams.getValue("assertion.index.location"));
rootIndexRef.setIndexLocation(val);
rootIndexRef.setUseNativeFSLockFactory(luceneCfg.getUseNativeFSLockFactory());
rootIndexRef.setWriteLockTimeout(luceneCfg.getWriteLockTimeout());
if (!rootIndexRef.getEnabled()) {
LOGGER.config("assertion.index.enabled=false");
return;
} else if (rootIndexRef.getIndexLocation().length() == 0) {
String msg = "The configured assertion.index.location parameter is invalid.";
msg += " Assertions will be disabled.";
LOGGER.warning(msg);
return;
}
this.areAssertionsEnabled = true;
// ratings
AsnIndexReference ratingIndexRef = this.makeIndexRef(catCfg,rootIndexRef,"rating");
if (ratingIndexRef.getEnabled()) {
indexRefs.add(ratingIndexRef);
this.configureRatings(catCfg,ratingIndexRef,ratingIndexRef.getName());
}
// comments
AsnIndexReference commentIndexRef = this.makeIndexRef(catCfg,rootIndexRef,"comment");
if (commentIndexRef.getEnabled()) {
indexRefs.add(commentIndexRef);
this.configureComments(catCfg,commentIndexRef,commentIndexRef.getName());
}
}