
rapture.kernel.IndexApiImplWrapper Maven / Gradle / Ivy
/**
* The MIT License (MIT)
*
* Copyright (C) 2011-2016 Incapture Technologies LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* This is an autogenerated file. You should not edit this file as any changes
* will be overwritten.
*/
package rapture.kernel;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Map;
import rapture.common.api.IndexApi;
import rapture.common.CallingContext;
import rapture.common.RaptureEntitlementsContext;
import rapture.common.hooks.CallName;
import rapture.common.model.BasePayload;
import rapture.common.EntitlementSet;
import rapture.kernel.context.ContextValidator;
import rapture.common.model.IndexConfig;
import rapture.common.TableQuery;
import rapture.common.TableConfig;
import rapture.common.TableRecord;
import rapture.common.TableQueryResult;
import rapture.common.shared.index.CreateIndexPayload;
import rapture.common.shared.index.GetIndexPayload;
import rapture.common.shared.index.DeleteIndexPayload;
import rapture.common.shared.index.CreateTablePayload;
import rapture.common.shared.index.DeleteTablePayload;
import rapture.common.shared.index.GetTablePayload;
import rapture.common.shared.index.QueryTablePayload;
import rapture.common.shared.index.FindIndexPayload;
/**
* This class is a wrapper around the class {@link IndexApiImpl}. This is an auto-generated class that gives us the ability to add hooks such as entitlmeent
* checks before each function call in the implementation. Since we always want to call these hooks, an instance of this class should be used
* (in {@link Kernel}) instead of using the implementation directly.
* implementation directly.
*
*/
@SuppressWarnings("all")
public class IndexApiImplWrapper implements IndexApi, KernelApi {
private static final Logger log = Logger.getLogger(IndexApiImplWrapper.class);
private IndexApiImpl apiImpl;
public IndexApiImplWrapper(Kernel kernel) {
apiImpl = new IndexApiImpl(kernel);
}
/**
* Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
* @return {@link Index}
*/
public IndexApiImpl getTrusted() {
return apiImpl;
}
@Override
public void start() {
apiImpl.start();
}
/**
*
*/
@Override
public IndexConfig createIndex(CallingContext context, String indexUri, String config) {
long functionStartTime = System.currentTimeMillis();
CreateIndexPayload requestObj = new CreateIndexPayload();
requestObj.setContext(context);
requestObj.setIndexUri(indexUri);
requestObj.setConfig(config);
ContextValidator.validateContext(context, EntitlementSet.Index_createIndex, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_createIndex);
IndexConfig returnValue = apiImpl.createIndex(context, indexUri, config); Kernel.getApiHooksService().post(context, CallName.Index_createIndex);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.createIndex.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.createIndex.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public IndexConfig getIndex(CallingContext context, String indexUri) {
long functionStartTime = System.currentTimeMillis();
GetIndexPayload requestObj = new GetIndexPayload();
requestObj.setContext(context);
requestObj.setIndexUri(indexUri);
ContextValidator.validateContext(context, EntitlementSet.Index_getIndex, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_getIndex);
IndexConfig returnValue = apiImpl.getIndex(context, indexUri); Kernel.getApiHooksService().post(context, CallName.Index_getIndex);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.getIndex.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.getIndex.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void deleteIndex(CallingContext context, String indexUri) {
long functionStartTime = System.currentTimeMillis();
DeleteIndexPayload requestObj = new DeleteIndexPayload();
requestObj.setContext(context);
requestObj.setIndexUri(indexUri);
ContextValidator.validateContext(context, EntitlementSet.Index_deleteIndex, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_deleteIndex);
apiImpl.deleteIndex(context, indexUri); Kernel.getApiHooksService().post(context, CallName.Index_deleteIndex);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.deleteIndex.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.deleteIndex.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public TableConfig createTable(CallingContext context, String tableUri, String config) {
long functionStartTime = System.currentTimeMillis();
CreateTablePayload requestObj = new CreateTablePayload();
requestObj.setContext(context);
requestObj.setTableUri(tableUri);
requestObj.setConfig(config);
ContextValidator.validateContext(context, EntitlementSet.Index_createTable, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_createTable);
TableConfig returnValue = apiImpl.createTable(context, tableUri, config); Kernel.getApiHooksService().post(context, CallName.Index_createTable);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.createTable.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.createTable.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void deleteTable(CallingContext context, String tableUri) {
long functionStartTime = System.currentTimeMillis();
DeleteTablePayload requestObj = new DeleteTablePayload();
requestObj.setContext(context);
requestObj.setTableUri(tableUri);
ContextValidator.validateContext(context, EntitlementSet.Index_deleteTable, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_deleteTable);
apiImpl.deleteTable(context, tableUri); Kernel.getApiHooksService().post(context, CallName.Index_deleteTable);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.deleteTable.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.deleteTable.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public TableConfig getTable(CallingContext context, String indexURI) {
long functionStartTime = System.currentTimeMillis();
GetTablePayload requestObj = new GetTablePayload();
requestObj.setContext(context);
requestObj.setIndexURI(indexURI);
ContextValidator.validateContext(context, EntitlementSet.Index_getTable, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_getTable);
TableConfig returnValue = apiImpl.getTable(context, indexURI); Kernel.getApiHooksService().post(context, CallName.Index_getTable);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.getTable.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.getTable.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public List queryTable(CallingContext context, String indexURI, TableQuery query) {
long functionStartTime = System.currentTimeMillis();
QueryTablePayload requestObj = new QueryTablePayload();
requestObj.setContext(context);
requestObj.setIndexURI(indexURI);
requestObj.setQuery(query);
ContextValidator.validateContext(context, EntitlementSet.Index_queryTable, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_queryTable);
List returnValue = apiImpl.queryTable(context, indexURI, query); Kernel.getApiHooksService().post(context, CallName.Index_queryTable);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.queryTable.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.queryTable.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public TableQueryResult findIndex(CallingContext context, String indexUri, String query) {
long functionStartTime = System.currentTimeMillis();
FindIndexPayload requestObj = new FindIndexPayload();
requestObj.setContext(context);
requestObj.setIndexUri(indexUri);
requestObj.setQuery(query);
ContextValidator.validateContext(context, EntitlementSet.Index_findIndex, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Index_findIndex);
TableQueryResult returnValue = apiImpl.findIndex(context, indexUri, query); Kernel.getApiHooksService().post(context, CallName.Index_findIndex);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.findIndex.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.indexApi.findIndex.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy