/*
 * Copyright (c) 2013-2014 Obidea
 *
 * 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.obidea.semantika.sesame;

import java.io.File;

import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.ValueFactoryImpl;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;

import com.obidea.semantika.queryanswer.QueryEvaluationException;
import com.obidea.semantika.queryanswer.SparqlQueryEngine;

public class SemantikaVirtualRepository implements Repository
{
   private SparqlQueryEngine mQueryEngine;

   public SemantikaVirtualRepository(SparqlQueryEngine queryEngine)
   {
      mQueryEngine = queryEngine;
   }

   @Override
   public RepositoryConnection getConnection() throws RepositoryException
   {
      return new SemantikaRepositoryConnection(this);
   }

   /* package */SparqlQueryEngine getQueryEngine()
   {
      return mQueryEngine;
   }

   @Override
   public File getDataDir()
   {
      return null; // no data directory
   }

   @Override
   public ValueFactory getValueFactory()
   {
      return ValueFactoryImpl.getInstance();
   }

   @Override
   public void initialize() throws RepositoryException
   {
      try {
         mQueryEngine.start();
      }
      catch (QueryEvaluationException e) {
         throw new RepositoryException(e);
      }
   }

   @Override
   public boolean isInitialized()
   {
      return mQueryEngine.isStarted();
   }

   @Override
   public boolean isWritable() throws RepositoryException
   {
      return false;
   }

   @Override
   public void setDataDir(File arg0)
   {
      // NO-OP
   }

   @Override
   public void shutDown() throws RepositoryException
   {
      try {
         mQueryEngine.stop();
      }
      catch (QueryEvaluationException e) {
         throw new RepositoryException(e);
      }
   }
}

@@ -925,33 +925,29 @@
 nswer.QueryE
-valuation
+ngine
 Exception;%0Ai
@@ -1808,33 +1808,29 @@
 atch (QueryE
-valuation
+ngine
 Exception e)
@@ -2308,17 +2308,13 @@
 eryE
-valuation
+ngine
 Exce

Update the exception class.