
rapture.kernel.ScriptApiImplWrapper 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.ScriptApi;
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.ScriptResult;
import rapture.common.RaptureScriptLanguage;
import rapture.common.ScriptInterface;
import rapture.common.RaptureFolderInfo;
import rapture.common.RaptureSnippet;
import rapture.common.RaptureScript;
import rapture.common.RaptureScriptPurpose;
import rapture.common.shared.script.CreateScriptPayload;
import rapture.common.shared.script.CreateScriptLinkPayload;
import rapture.common.shared.script.RemoveScriptLinkPayload;
import rapture.common.shared.script.DoesScriptExistPayload;
import rapture.common.shared.script.DeleteScriptPayload;
import rapture.common.shared.script.GetScriptNamesPayload;
import rapture.common.shared.script.GetScriptPayload;
import rapture.common.shared.script.GetInterfacePayload;
import rapture.common.shared.script.PutScriptPayload;
import rapture.common.shared.script.PutRawScriptPayload;
import rapture.common.shared.script.RunScriptPayload;
import rapture.common.shared.script.RunScriptExtendedPayload;
import rapture.common.shared.script.CheckScriptPayload;
import rapture.common.shared.script.CreateREPLSessionPayload;
import rapture.common.shared.script.DestroyREPLSessionPayload;
import rapture.common.shared.script.EvaluateREPLPayload;
import rapture.common.shared.script.ArchiveOldREPLSessionsPayload;
import rapture.common.shared.script.CreateSnippetPayload;
import rapture.common.shared.script.GetSnippetChildrenPayload;
import rapture.common.shared.script.DeleteSnippetPayload;
import rapture.common.shared.script.GetSnippetPayload;
import rapture.common.shared.script.ListScriptsByUriPrefixPayload;
import rapture.common.shared.script.DeleteScriptsByUriPrefixPayload;
/**
* This class is a wrapper around the class {@link ScriptApiImpl}. 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 ScriptApiImplWrapper implements ScriptApi, KernelApi {
private static final Logger log = Logger.getLogger(ScriptApiImplWrapper.class);
private ScriptApiImpl apiImpl;
public ScriptApiImplWrapper(Kernel kernel) {
apiImpl = new ScriptApiImpl(kernel);
}
/**
* Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
* @return {@link Script}
*/
public ScriptApiImpl getTrusted() {
return apiImpl;
}
@Override
public void start() {
apiImpl.start();
}
/**
*
*/
@Override
public RaptureScript createScript(CallingContext context, String scriptURI, RaptureScriptLanguage language, RaptureScriptPurpose purpose, String script) {
long functionStartTime = System.currentTimeMillis();
CreateScriptPayload requestObj = new CreateScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
requestObj.setLanguage(language);
requestObj.setPurpose(purpose);
requestObj.setScript(script);
ContextValidator.validateContext(context, EntitlementSet.Script_createScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_createScript);
RaptureScript returnValue = apiImpl.createScript(context, scriptURI, language, purpose, script); Kernel.getApiHooksService().post(context, CallName.Script_createScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void createScriptLink(CallingContext context, String fromScriptURI, String toScriptURI) {
long functionStartTime = System.currentTimeMillis();
CreateScriptLinkPayload requestObj = new CreateScriptLinkPayload();
requestObj.setContext(context);
requestObj.setFromScriptURI(fromScriptURI);
requestObj.setToScriptURI(toScriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_createScriptLink, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_createScriptLink);
apiImpl.createScriptLink(context, fromScriptURI, toScriptURI); Kernel.getApiHooksService().post(context, CallName.Script_createScriptLink);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createScriptLink.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createScriptLink.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public void removeScriptLink(CallingContext context, String fromScriptURI) {
long functionStartTime = System.currentTimeMillis();
RemoveScriptLinkPayload requestObj = new RemoveScriptLinkPayload();
requestObj.setContext(context);
requestObj.setFromScriptURI(fromScriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_removeScriptLink, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_removeScriptLink);
apiImpl.removeScriptLink(context, fromScriptURI); Kernel.getApiHooksService().post(context, CallName.Script_removeScriptLink);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.removeScriptLink.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.removeScriptLink.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public Boolean doesScriptExist(CallingContext context, String scriptURI) {
long functionStartTime = System.currentTimeMillis();
DoesScriptExistPayload requestObj = new DoesScriptExistPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_doesScriptExist, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_doesScriptExist);
Boolean returnValue = apiImpl.doesScriptExist(context, scriptURI); Kernel.getApiHooksService().post(context, CallName.Script_doesScriptExist);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.doesScriptExist.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.doesScriptExist.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void deleteScript(CallingContext context, String scriptUri) {
long functionStartTime = System.currentTimeMillis();
DeleteScriptPayload requestObj = new DeleteScriptPayload();
requestObj.setContext(context);
requestObj.setScriptUri(scriptUri);
ContextValidator.validateContext(context, EntitlementSet.Script_deleteScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_deleteScript);
apiImpl.deleteScript(context, scriptUri); Kernel.getApiHooksService().post(context, CallName.Script_deleteScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public List getScriptNames(CallingContext context, String scriptURI) {
long functionStartTime = System.currentTimeMillis();
GetScriptNamesPayload requestObj = new GetScriptNamesPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_getScriptNames, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_getScriptNames);
List returnValue = apiImpl.getScriptNames(context, scriptURI); Kernel.getApiHooksService().post(context, CallName.Script_getScriptNames);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getScriptNames.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getScriptNames.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public RaptureScript getScript(CallingContext context, String scriptURI) {
long functionStartTime = System.currentTimeMillis();
GetScriptPayload requestObj = new GetScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_getScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_getScript);
RaptureScript returnValue = apiImpl.getScript(context, scriptURI); Kernel.getApiHooksService().post(context, CallName.Script_getScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public ScriptInterface getInterface(CallingContext context, String scriptURI) {
long functionStartTime = System.currentTimeMillis();
GetInterfacePayload requestObj = new GetInterfacePayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_getInterface, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_getInterface);
ScriptInterface returnValue = apiImpl.getInterface(context, scriptURI); Kernel.getApiHooksService().post(context, CallName.Script_getInterface);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getInterface.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getInterface.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public RaptureScript putScript(CallingContext context, String scriptURI, RaptureScript script) {
long functionStartTime = System.currentTimeMillis();
PutScriptPayload requestObj = new PutScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
requestObj.setScript(script);
ContextValidator.validateContext(context, EntitlementSet.Script_putScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_putScript);
RaptureScript returnValue = apiImpl.putScript(context, scriptURI, script); Kernel.getApiHooksService().post(context, CallName.Script_putScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.putScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.putScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public RaptureScript putRawScript(CallingContext context, String scriptURI, String content, String language, String purpose, List param_types, List param_names) {
long functionStartTime = System.currentTimeMillis();
PutRawScriptPayload requestObj = new PutRawScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
requestObj.setContent(content);
requestObj.setLanguage(language);
requestObj.setPurpose(purpose);
requestObj.setParam_types(param_types);
requestObj.setParam_names(param_names);
ContextValidator.validateContext(context, EntitlementSet.Script_putRawScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_putRawScript);
RaptureScript returnValue = apiImpl.putRawScript(context, scriptURI, content, language, purpose, param_types, param_names); Kernel.getApiHooksService().post(context, CallName.Script_putRawScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.putRawScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.putRawScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public String runScript(CallingContext context, String scriptURI, Map parameters) {
long functionStartTime = System.currentTimeMillis();
RunScriptPayload requestObj = new RunScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
requestObj.setParameters(parameters);
ContextValidator.validateContext(context, EntitlementSet.Script_runScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_runScript);
String returnValue = apiImpl.runScript(context, scriptURI, parameters); Kernel.getApiHooksService().post(context, CallName.Script_runScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.runScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.runScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public ScriptResult runScriptExtended(CallingContext context, String scriptURI, Map parameters) {
long functionStartTime = System.currentTimeMillis();
RunScriptExtendedPayload requestObj = new RunScriptExtendedPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
requestObj.setParameters(parameters);
ContextValidator.validateContext(context, EntitlementSet.Script_runScriptExtended, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_runScriptExtended);
ScriptResult returnValue = apiImpl.runScriptExtended(context, scriptURI, parameters); Kernel.getApiHooksService().post(context, CallName.Script_runScriptExtended);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.runScriptExtended.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.runScriptExtended.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public String checkScript(CallingContext context, String scriptURI) {
long functionStartTime = System.currentTimeMillis();
CheckScriptPayload requestObj = new CheckScriptPayload();
requestObj.setContext(context);
requestObj.setScriptURI(scriptURI);
ContextValidator.validateContext(context, EntitlementSet.Script_checkScript, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_checkScript);
String returnValue = apiImpl.checkScript(context, scriptURI); Kernel.getApiHooksService().post(context, CallName.Script_checkScript);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.checkScript.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.checkScript.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public String createREPLSession(CallingContext context) {
long functionStartTime = System.currentTimeMillis();
CreateREPLSessionPayload requestObj = new CreateREPLSessionPayload();
requestObj.setContext(context);
ContextValidator.validateContext(context, EntitlementSet.Script_createREPLSession, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_createREPLSession);
String returnValue = apiImpl.createREPLSession(context); Kernel.getApiHooksService().post(context, CallName.Script_createREPLSession);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createREPLSession.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createREPLSession.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void destroyREPLSession(CallingContext context, String sessionId) {
long functionStartTime = System.currentTimeMillis();
DestroyREPLSessionPayload requestObj = new DestroyREPLSessionPayload();
requestObj.setContext(context);
requestObj.setSessionId(sessionId);
ContextValidator.validateContext(context, EntitlementSet.Script_destroyREPLSession, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_destroyREPLSession);
apiImpl.destroyREPLSession(context, sessionId); Kernel.getApiHooksService().post(context, CallName.Script_destroyREPLSession);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.destroyREPLSession.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.destroyREPLSession.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public String evaluateREPL(CallingContext context, String sessionId, String line) {
long functionStartTime = System.currentTimeMillis();
EvaluateREPLPayload requestObj = new EvaluateREPLPayload();
requestObj.setContext(context);
requestObj.setSessionId(sessionId);
requestObj.setLine(line);
ContextValidator.validateContext(context, EntitlementSet.Script_evaluateREPL, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_evaluateREPL);
String returnValue = apiImpl.evaluateREPL(context, sessionId, line); Kernel.getApiHooksService().post(context, CallName.Script_evaluateREPL);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.evaluateREPL.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.evaluateREPL.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void archiveOldREPLSessions(CallingContext context, Long ageInMinutes) {
long functionStartTime = System.currentTimeMillis();
ArchiveOldREPLSessionsPayload requestObj = new ArchiveOldREPLSessionsPayload();
requestObj.setContext(context);
requestObj.setAgeInMinutes(ageInMinutes);
ContextValidator.validateContext(context, EntitlementSet.Script_archiveOldREPLSessions, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_archiveOldREPLSessions);
apiImpl.archiveOldREPLSessions(context, ageInMinutes); Kernel.getApiHooksService().post(context, CallName.Script_archiveOldREPLSessions);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.archiveOldREPLSessions.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.archiveOldREPLSessions.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public RaptureSnippet createSnippet(CallingContext context, String snippetURI, String snippet) {
long functionStartTime = System.currentTimeMillis();
CreateSnippetPayload requestObj = new CreateSnippetPayload();
requestObj.setContext(context);
requestObj.setSnippetURI(snippetURI);
requestObj.setSnippet(snippet);
ContextValidator.validateContext(context, EntitlementSet.Script_createSnippet, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_createSnippet);
RaptureSnippet returnValue = apiImpl.createSnippet(context, snippetURI, snippet); Kernel.getApiHooksService().post(context, CallName.Script_createSnippet);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createSnippet.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.createSnippet.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public List getSnippetChildren(CallingContext context, String prefix) {
long functionStartTime = System.currentTimeMillis();
GetSnippetChildrenPayload requestObj = new GetSnippetChildrenPayload();
requestObj.setContext(context);
requestObj.setPrefix(prefix);
ContextValidator.validateContext(context, EntitlementSet.Script_getSnippetChildren, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_getSnippetChildren);
List returnValue = apiImpl.getSnippetChildren(context, prefix); Kernel.getApiHooksService().post(context, CallName.Script_getSnippetChildren);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getSnippetChildren.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getSnippetChildren.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void deleteSnippet(CallingContext context, String snippetURI) {
long functionStartTime = System.currentTimeMillis();
DeleteSnippetPayload requestObj = new DeleteSnippetPayload();
requestObj.setContext(context);
requestObj.setSnippetURI(snippetURI);
ContextValidator.validateContext(context, EntitlementSet.Script_deleteSnippet, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_deleteSnippet);
apiImpl.deleteSnippet(context, snippetURI); Kernel.getApiHooksService().post(context, CallName.Script_deleteSnippet);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteSnippet.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteSnippet.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public RaptureSnippet getSnippet(CallingContext context, String snippetURI) {
long functionStartTime = System.currentTimeMillis();
GetSnippetPayload requestObj = new GetSnippetPayload();
requestObj.setContext(context);
requestObj.setSnippetURI(snippetURI);
ContextValidator.validateContext(context, EntitlementSet.Script_getSnippet, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_getSnippet);
RaptureSnippet returnValue = apiImpl.getSnippet(context, snippetURI); Kernel.getApiHooksService().post(context, CallName.Script_getSnippet);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getSnippet.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.getSnippet.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public Map listScriptsByUriPrefix(CallingContext context, String scriptUri, int depth) {
long functionStartTime = System.currentTimeMillis();
ListScriptsByUriPrefixPayload requestObj = new ListScriptsByUriPrefixPayload();
requestObj.setContext(context);
requestObj.setScriptUri(scriptUri);
requestObj.setDepth(depth);
ContextValidator.validateContext(context, EntitlementSet.Script_listScriptsByUriPrefix, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_listScriptsByUriPrefix);
Map returnValue = apiImpl.listScriptsByUriPrefix(context, scriptUri, depth); Kernel.getApiHooksService().post(context, CallName.Script_listScriptsByUriPrefix);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.listScriptsByUriPrefix.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.listScriptsByUriPrefix.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public List deleteScriptsByUriPrefix(CallingContext context, String scriptUri) {
long functionStartTime = System.currentTimeMillis();
DeleteScriptsByUriPrefixPayload requestObj = new DeleteScriptsByUriPrefixPayload();
requestObj.setContext(context);
requestObj.setScriptUri(scriptUri);
ContextValidator.validateContext(context, EntitlementSet.Script_deleteScriptsByUriPrefix, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Script_deleteScriptsByUriPrefix);
List returnValue = apiImpl.deleteScriptsByUriPrefix(context, scriptUri); Kernel.getApiHooksService().post(context, CallName.Script_deleteScriptsByUriPrefix);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteScriptsByUriPrefix.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.scriptApi.deleteScriptsByUriPrefix.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy