/*
 * Copyright 2012 Netflix, Inc.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.netflix.exhibitor.core.index;

import com.netflix.exhibitor.core.Exhibitor;
import com.netflix.exhibitor.core.activity.Activity;
import com.netflix.exhibitor.core.activity.ActivityLog;
import com.netflix.exhibitor.core.config.StringConfigs;
import java.io.File;

public class IndexProcessorActivity implements Activity
{
    private Exhibitor exhibitor;

    public IndexProcessorActivity(Exhibitor exhibitor)
    {
        this.exhibitor = exhibitor;
    }

    @Override
    public void completed(boolean wasSuccessful)
    {
    }

    @Override
    public Boolean call() throws Exception
    {
        try
        {
            File            indexDirectory = new File(exhibitor.getConfigManager().getConfig().getString(StringConfigs.LOG_INDEX_DIRECTORY), "exhibitor-" + System.currentTimeMillis());
            IndexProcessor  processor = new IndexProcessor(exhibitor);
            processor.process(indexDirectory);
        }
        catch ( Exception e )
        {
            exhibitor.getLog().add(ActivityLog.Type.ERROR, "Building Index", e);
        }
        return null;
    }
}

@@ -1240,76 +1240,22 @@
     
+S
 tr
-y%0A        %7B%0A            File            indexDirectory = new File(
+ing path = 
 exhi
@@ -1335,16 +1335,278 @@
 RECTORY)
+;%0A%0A        if ( path == null )%0A        %7B%0A            exhibitor.getLog().add(ActivityLog.Type.ERROR, %22No index directory set in config%22);%0A        %7D%0A        else%0A        %7B%0A            try%0A            %7B%0A                File            indexDirectory = new File(path
 , %22exhib
@@ -1643,16 +1643,20 @@
 lis());%0A
+    
         
@@ -1730,16 +1730,20 @@
         
+  
+  
 processo
@@ -1769,34 +1769,42 @@
 ctory);%0A        
-%7D%0A
+    %7D%0A    
         catch ( 
@@ -1817,34 +1817,42 @@
 ion e )%0A        
+ 
-%7B%0A
+   %7B%0A    
             exhi
@@ -1916,33 +1916,48 @@
 x%22, e);%0A        
-%7D
+    %7D%0A        %7D%0A
 %0A        return 

Check for configured index directory