
rapture.kernel.SysApiImplWrapper Maven / Gradle / Ivy
The newest version!
/**
* 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.SysApi;
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.RaptureFolderInfo;
import rapture.common.NodeEnum;
import rapture.common.ChildrenTransferObject;
import rapture.common.model.DocumentWithMeta;
import rapture.common.ConnectionInfo;
import rapture.common.shared.sys.RetrieveSystemConfigPayload;
import rapture.common.shared.sys.WriteSystemConfigPayload;
import rapture.common.shared.sys.RemoveSystemConfigPayload;
import rapture.common.shared.sys.GetSystemFoldersPayload;
import rapture.common.shared.sys.GetAllTopLevelReposPayload;
import rapture.common.shared.sys.ListByUriPrefixPayload;
import rapture.common.shared.sys.GetChildrenPayload;
import rapture.common.shared.sys.GetAllChildrenPayload;
import rapture.common.shared.sys.GetFolderInfoPayload;
import rapture.common.shared.sys.GetConnectionInfoPayload;
import rapture.common.shared.sys.PutConnectionInfoPayload;
import rapture.common.shared.sys.SetConnectionInfoPayload;
import rapture.common.shared.sys.GetSysDocumentMetaPayload;
/**
* This class is a wrapper around the class {@link SysApiImpl}. 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 SysApiImplWrapper implements SysApi, KernelApi {
private static final Logger log = Logger.getLogger(SysApiImplWrapper.class);
private SysApiImpl apiImpl;
public SysApiImplWrapper(Kernel kernel) {
apiImpl = new SysApiImpl(kernel);
}
/**
* Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
* @return {@link Sys}
*/
public SysApiImpl getTrusted() {
return apiImpl;
}
@Override
public void start() {
apiImpl.start();
}
/**
*
*/
@Override
public String retrieveSystemConfig(CallingContext context, String area, String path) {
long functionStartTime = System.currentTimeMillis();
RetrieveSystemConfigPayload requestObj = new RetrieveSystemConfigPayload();
requestObj.setContext(context);
requestObj.setArea(area);
requestObj.setPath(path);
ContextValidator.validateContext(context, EntitlementSet.Sys_retrieveSystemConfig, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_retrieveSystemConfig);
String returnValue = apiImpl.retrieveSystemConfig(context, area, path); Kernel.getApiHooksService().post(context, CallName.Sys_retrieveSystemConfig);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.retrieveSystemConfig.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.retrieveSystemConfig.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public String writeSystemConfig(CallingContext context, String area, String path, String content) {
long functionStartTime = System.currentTimeMillis();
WriteSystemConfigPayload requestObj = new WriteSystemConfigPayload();
requestObj.setContext(context);
requestObj.setArea(area);
requestObj.setPath(path);
requestObj.setContent(content);
ContextValidator.validateContext(context, EntitlementSet.Sys_writeSystemConfig, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_writeSystemConfig);
String returnValue = apiImpl.writeSystemConfig(context, area, path, content); Kernel.getApiHooksService().post(context, CallName.Sys_writeSystemConfig);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.writeSystemConfig.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.writeSystemConfig.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void removeSystemConfig(CallingContext context, String area, String path) {
long functionStartTime = System.currentTimeMillis();
RemoveSystemConfigPayload requestObj = new RemoveSystemConfigPayload();
requestObj.setContext(context);
requestObj.setArea(area);
requestObj.setPath(path);
ContextValidator.validateContext(context, EntitlementSet.Sys_removeSystemConfig, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_removeSystemConfig);
apiImpl.removeSystemConfig(context, area, path); Kernel.getApiHooksService().post(context, CallName.Sys_removeSystemConfig);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.removeSystemConfig.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.removeSystemConfig.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public List getSystemFolders(CallingContext context, String area, String path) {
long functionStartTime = System.currentTimeMillis();
GetSystemFoldersPayload requestObj = new GetSystemFoldersPayload();
requestObj.setContext(context);
requestObj.setArea(area);
requestObj.setPath(path);
ContextValidator.validateContext(context, EntitlementSet.Sys_getSystemFolders, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getSystemFolders);
List returnValue = apiImpl.getSystemFolders(context, area, path); Kernel.getApiHooksService().post(context, CallName.Sys_getSystemFolders);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getSystemFolders.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getSystemFolders.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public List getAllTopLevelRepos(CallingContext context) {
long functionStartTime = System.currentTimeMillis();
GetAllTopLevelReposPayload requestObj = new GetAllTopLevelReposPayload();
requestObj.setContext(context);
ContextValidator.validateContext(context, EntitlementSet.Sys_getAllTopLevelRepos, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getAllTopLevelRepos);
List returnValue = apiImpl.getAllTopLevelRepos(context); Kernel.getApiHooksService().post(context, CallName.Sys_getAllTopLevelRepos);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getAllTopLevelRepos.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getAllTopLevelRepos.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public ChildrenTransferObject listByUriPrefix(CallingContext context, String raptureURI, String marker, int depth, Long maximum, Long millisUntilCacheExpiry) {
long functionStartTime = System.currentTimeMillis();
ListByUriPrefixPayload requestObj = new ListByUriPrefixPayload();
requestObj.setContext(context);
requestObj.setRaptureURI(raptureURI);
requestObj.setMarker(marker);
requestObj.setDepth(depth);
requestObj.setMaximum(maximum);
requestObj.setMillisUntilCacheExpiry(millisUntilCacheExpiry);
ContextValidator.validateContext(context, EntitlementSet.Sys_listByUriPrefix, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_listByUriPrefix);
ChildrenTransferObject returnValue = apiImpl.listByUriPrefix(context, raptureURI, marker, depth, maximum, millisUntilCacheExpiry); Kernel.getApiHooksService().post(context, CallName.Sys_listByUriPrefix);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.listByUriPrefix.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.listByUriPrefix.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public ChildrenTransferObject getChildren(CallingContext context, String raptureURI) {
long functionStartTime = System.currentTimeMillis();
GetChildrenPayload requestObj = new GetChildrenPayload();
requestObj.setContext(context);
requestObj.setRaptureURI(raptureURI);
ContextValidator.validateContext(context, EntitlementSet.Sys_getChildren, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getChildren);
ChildrenTransferObject returnValue = apiImpl.getChildren(context, raptureURI); Kernel.getApiHooksService().post(context, CallName.Sys_getChildren);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getChildren.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getChildren.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public ChildrenTransferObject getAllChildren(CallingContext context, String raptureURI, String marker, Long maximum) {
long functionStartTime = System.currentTimeMillis();
GetAllChildrenPayload requestObj = new GetAllChildrenPayload();
requestObj.setContext(context);
requestObj.setRaptureURI(raptureURI);
requestObj.setMarker(marker);
requestObj.setMaximum(maximum);
ContextValidator.validateContext(context, EntitlementSet.Sys_getAllChildren, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getAllChildren);
ChildrenTransferObject returnValue = apiImpl.getAllChildren(context, raptureURI, marker, maximum); Kernel.getApiHooksService().post(context, CallName.Sys_getAllChildren);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getAllChildren.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getAllChildren.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public NodeEnum getFolderInfo(CallingContext context, String raptureURI) {
long functionStartTime = System.currentTimeMillis();
GetFolderInfoPayload requestObj = new GetFolderInfoPayload();
requestObj.setContext(context);
requestObj.setRaptureURI(raptureURI);
ContextValidator.validateContext(context, EntitlementSet.Sys_getFolderInfo, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getFolderInfo);
NodeEnum returnValue = apiImpl.getFolderInfo(context, raptureURI); Kernel.getApiHooksService().post(context, CallName.Sys_getFolderInfo);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getFolderInfo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getFolderInfo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public Map getConnectionInfo(CallingContext context, String connectionType) {
long functionStartTime = System.currentTimeMillis();
GetConnectionInfoPayload requestObj = new GetConnectionInfoPayload();
requestObj.setContext(context);
requestObj.setConnectionType(connectionType);
ContextValidator.validateContext(context, EntitlementSet.Sys_getConnectionInfo, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getConnectionInfo);
Map returnValue = apiImpl.getConnectionInfo(context, connectionType); Kernel.getApiHooksService().post(context, CallName.Sys_getConnectionInfo);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getConnectionInfo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getConnectionInfo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void putConnectionInfo(CallingContext context, String connectionType, ConnectionInfo connectionInfo) {
long functionStartTime = System.currentTimeMillis();
PutConnectionInfoPayload requestObj = new PutConnectionInfoPayload();
requestObj.setContext(context);
requestObj.setConnectionType(connectionType);
requestObj.setConnectionInfo(connectionInfo);
ContextValidator.validateContext(context, EntitlementSet.Sys_putConnectionInfo, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_putConnectionInfo);
apiImpl.putConnectionInfo(context, connectionType, connectionInfo); Kernel.getApiHooksService().post(context, CallName.Sys_putConnectionInfo);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.putConnectionInfo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.putConnectionInfo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public void setConnectionInfo(CallingContext context, String connectionType, ConnectionInfo connectionInfo) {
long functionStartTime = System.currentTimeMillis();
SetConnectionInfoPayload requestObj = new SetConnectionInfoPayload();
requestObj.setContext(context);
requestObj.setConnectionType(connectionType);
requestObj.setConnectionInfo(connectionInfo);
ContextValidator.validateContext(context, EntitlementSet.Sys_setConnectionInfo, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_setConnectionInfo);
apiImpl.setConnectionInfo(context, connectionType, connectionInfo); Kernel.getApiHooksService().post(context, CallName.Sys_setConnectionInfo);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.setConnectionInfo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.setConnectionInfo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public DocumentWithMeta getSysDocumentMeta(CallingContext context, String raptureURI) {
long functionStartTime = System.currentTimeMillis();
GetSysDocumentMetaPayload requestObj = new GetSysDocumentMetaPayload();
requestObj.setContext(context);
requestObj.setRaptureURI(raptureURI);
ContextValidator.validateContext(context, EntitlementSet.Sys_getSysDocumentMeta, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Sys_getSysDocumentMeta);
DocumentWithMeta returnValue = apiImpl.getSysDocumentMeta(context, raptureURI); Kernel.getApiHooksService().post(context, CallName.Sys_getSysDocumentMeta);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getSysDocumentMeta.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.sysApi.getSysDocumentMeta.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy