All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rapture.kernel.BootstrapApiImplWrapper Maven / Gradle / Ivy

There is a newer version: 3.0.4
Show 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.BootstrapApi;
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.shared.bootstrap.SetEmphemeralRepoPayload;

import rapture.common.shared.bootstrap.SetConfigRepoPayload;

import rapture.common.shared.bootstrap.SetSettingsRepoPayload;

import rapture.common.shared.bootstrap.MigrateConfigRepoPayload;

import rapture.common.shared.bootstrap.MigrateEphemeralRepoPayload;

import rapture.common.shared.bootstrap.MigrateSettingsRepoPayload;

import rapture.common.shared.bootstrap.GetConfigRepoPayload;

import rapture.common.shared.bootstrap.GetSettingsRepoPayload;

import rapture.common.shared.bootstrap.GetEphemeralRepoPayload;

import rapture.common.shared.bootstrap.RestartBootstrapPayload;

import rapture.common.shared.bootstrap.AddScriptClassPayload;

import rapture.common.shared.bootstrap.GetScriptClassesPayload;

import rapture.common.shared.bootstrap.DeleteScriptClassPayload;


/**
 * This class is a wrapper around the class {@link BootstrapApiImpl}. 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 BootstrapApiImplWrapper implements BootstrapApi, KernelApi {
    private static final Logger log = Logger.getLogger(BootstrapApiImplWrapper.class);
    private BootstrapApiImpl apiImpl;

    public BootstrapApiImplWrapper(Kernel kernel) {
        apiImpl = new BootstrapApiImpl(kernel);
    }

    /**
     * Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
     * @return {@link Bootstrap}
     */
    public BootstrapApiImpl getTrusted() {
        return apiImpl;
    }

    @Override
    public void start() {
        apiImpl.start();
    }

    /**
    * 
    */
    @Override
    public void setEmphemeralRepo(CallingContext context, String config) {
        long functionStartTime = System.currentTimeMillis();
       
        SetEmphemeralRepoPayload requestObj = new SetEmphemeralRepoPayload();
        requestObj.setContext(context);
        requestObj.setConfig(config);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_setEmphemeralRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_setEmphemeralRepo);
        apiImpl.setEmphemeralRepo(context, config);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_setEmphemeralRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setEmphemeralRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setEmphemeralRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void setConfigRepo(CallingContext context, String config) {
        long functionStartTime = System.currentTimeMillis();
       
        SetConfigRepoPayload requestObj = new SetConfigRepoPayload();
        requestObj.setContext(context);
        requestObj.setConfig(config);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_setConfigRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_setConfigRepo);
        apiImpl.setConfigRepo(context, config);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_setConfigRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setConfigRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setConfigRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void setSettingsRepo(CallingContext context, String config) {
        long functionStartTime = System.currentTimeMillis();
       
        SetSettingsRepoPayload requestObj = new SetSettingsRepoPayload();
        requestObj.setContext(context);
        requestObj.setConfig(config);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_setSettingsRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_setSettingsRepo);
        apiImpl.setSettingsRepo(context, config);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_setSettingsRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setSettingsRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.setSettingsRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void migrateConfigRepo(CallingContext context, String newConfig) {
        long functionStartTime = System.currentTimeMillis();
       
        MigrateConfigRepoPayload requestObj = new MigrateConfigRepoPayload();
        requestObj.setContext(context);
        requestObj.setNewConfig(newConfig);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_migrateConfigRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_migrateConfigRepo);
        apiImpl.migrateConfigRepo(context, newConfig);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_migrateConfigRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateConfigRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateConfigRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void migrateEphemeralRepo(CallingContext context, String newConfig) {
        long functionStartTime = System.currentTimeMillis();
       
        MigrateEphemeralRepoPayload requestObj = new MigrateEphemeralRepoPayload();
        requestObj.setContext(context);
        requestObj.setNewConfig(newConfig);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_migrateEphemeralRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_migrateEphemeralRepo);
        apiImpl.migrateEphemeralRepo(context, newConfig);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_migrateEphemeralRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateEphemeralRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateEphemeralRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void migrateSettingsRepo(CallingContext context, String newConfig) {
        long functionStartTime = System.currentTimeMillis();
       
        MigrateSettingsRepoPayload requestObj = new MigrateSettingsRepoPayload();
        requestObj.setContext(context);
        requestObj.setNewConfig(newConfig);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_migrateSettingsRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_migrateSettingsRepo);
        apiImpl.migrateSettingsRepo(context, newConfig);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_migrateSettingsRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateSettingsRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.migrateSettingsRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public String getConfigRepo(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetConfigRepoPayload requestObj = new GetConfigRepoPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_getConfigRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_getConfigRepo);
        String returnValue = apiImpl.getConfigRepo(context);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_getConfigRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getConfigRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getConfigRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public String getSettingsRepo(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetSettingsRepoPayload requestObj = new GetSettingsRepoPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_getSettingsRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_getSettingsRepo);
        String returnValue = apiImpl.getSettingsRepo(context);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_getSettingsRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getSettingsRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getSettingsRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public String getEphemeralRepo(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetEphemeralRepoPayload requestObj = new GetEphemeralRepoPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_getEphemeralRepo, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_getEphemeralRepo);
        String returnValue = apiImpl.getEphemeralRepo(context);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_getEphemeralRepo);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getEphemeralRepo.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getEphemeralRepo.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void restartBootstrap(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        RestartBootstrapPayload requestObj = new RestartBootstrapPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_restartBootstrap, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_restartBootstrap);
        apiImpl.restartBootstrap(context);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_restartBootstrap);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.restartBootstrap.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.restartBootstrap.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void addScriptClass(CallingContext context, String keyword, String className) {
        long functionStartTime = System.currentTimeMillis();
       
        AddScriptClassPayload requestObj = new AddScriptClassPayload();
        requestObj.setContext(context);
        requestObj.setKeyword(keyword);
        requestObj.setClassName(className);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_addScriptClass, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_addScriptClass);
        apiImpl.addScriptClass(context, keyword, className);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_addScriptClass);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.addScriptClass.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.addScriptClass.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public Map getScriptClasses(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetScriptClassesPayload requestObj = new GetScriptClassesPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_getScriptClasses, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_getScriptClasses);
        Map returnValue = apiImpl.getScriptClasses(context);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_getScriptClasses);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getScriptClasses.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.getScriptClasses.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public Boolean deleteScriptClass(CallingContext context, String keyword) {
        long functionStartTime = System.currentTimeMillis();
       
        DeleteScriptClassPayload requestObj = new DeleteScriptClassPayload();
        requestObj.setContext(context);
        requestObj.setKeyword(keyword);
        ContextValidator.validateContext(context, EntitlementSet.Bootstrap_deleteScriptClass, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Bootstrap_deleteScriptClass);
        Boolean returnValue = apiImpl.deleteScriptClass(context, keyword);    Kernel.getApiHooksService().post(context, CallName.Bootstrap_deleteScriptClass);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.deleteScriptClass.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.bootstrapApi.deleteScriptClass.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy