Package com.esri.gpt.server.assertion.index

Examples of com.esri.gpt.server.assertion.index.AsnIndexReferences


 
    // optimize the assertion indexes
    AsnFactory asnFactory = AsnFactory.newFactory(null);
    AsnConfig asnConfig = asnFactory.getConfiguration();
    if (asnConfig.getAreAssertionsEnabled()) {
      AsnIndexReferences asnIndexRefs = asnConfig.getIndexReferences();
      if (asnIndexRefs != null) {
        for (AsnIndexReference asnIndexRef: asnIndexRefs.values()) {
          if ((asnIndexRef != null) && asnIndexRef.getEnabled()) {
            String asnLoc = asnIndexRef.getIndexLocation();
            LOGGER.fine("Optimizing assertion index: "+asnLoc);
            try {
              long asnStartMillis = System.currentTimeMillis();
View Full Code Here


   * 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());
    }

  }
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.assertion.index.AsnIndexReferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.