rapture.common.client.HttpLockApi 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 file is autogenerated and any changes will be overwritten.
*/
package rapture.common.client;
import java.util.List;
import java.util.Map;
import rapture.common.api.LockApi;
import rapture.common.api.ScriptLockApi;
import rapture.common.CallingContext;
import rapture.common.model.GeneralResponse;
import rapture.common.model.BasePayload;
import rapture.common.exception.RaptureException;
import rapture.common.impl.jackson.JacksonUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import org.apache.log4j.Logger;
import rapture.common.RaptureLockConfig;
import rapture.common.LockHandle;
import rapture.common.shared.lock.GetLockManagerConfigsPayload;
import rapture.common.shared.lock.CreateLockManagerPayload;
import rapture.common.shared.lock.LockManagerExistsPayload;
import rapture.common.shared.lock.GetLockManagerConfigPayload;
import rapture.common.shared.lock.DeleteLockManagerPayload;
import rapture.common.shared.lock.AcquireLockPayload;
import rapture.common.shared.lock.ReleaseLockPayload;
import rapture.common.shared.lock.ForceReleaseLockPayload;
@SuppressWarnings("all")
public class HttpLockApi extends BaseHttpApi implements LockApi, ScriptLockApi {
private static final Logger log = Logger.getLogger(HttpLockApi.class);
public HttpLockApi(HttpLoginApi login) {
super(login, "lock");
}
private static final class GetLockManagerConfigsTypeReference extends TypeReference> {
}
@Override
public List getLockManagerConfigs(CallingContext context, String managerUri) {
GetLockManagerConfigsPayload requestObj = new GetLockManagerConfigsPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
return doRequest(requestObj, "GETLOCKMANAGERCONFIGS", new GetLockManagerConfigsTypeReference()); }
private static final class CreateLockManagerTypeReference extends TypeReference {
}
@Override
public RaptureLockConfig createLockManager(CallingContext context, String managerUri, String config, String pathPosition) {
CreateLockManagerPayload requestObj = new CreateLockManagerPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
requestObj.setConfig(config);
requestObj.setPathPosition(pathPosition);
return doRequest(requestObj, "CREATELOCKMANAGER", new CreateLockManagerTypeReference()); }
private static final class LockManagerExistsTypeReference extends TypeReference {
}
@Override
public Boolean lockManagerExists(CallingContext context, String managerUri) {
LockManagerExistsPayload requestObj = new LockManagerExistsPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
return doRequest(requestObj, "LOCKMANAGEREXISTS", new LockManagerExistsTypeReference()); }
private static final class GetLockManagerConfigTypeReference extends TypeReference {
}
@Override
public RaptureLockConfig getLockManagerConfig(CallingContext context, String managerUri) {
GetLockManagerConfigPayload requestObj = new GetLockManagerConfigPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
return doRequest(requestObj, "GETLOCKMANAGERCONFIG", new GetLockManagerConfigTypeReference()); }
@Override
public void deleteLockManager(CallingContext context, String managerUri) {
DeleteLockManagerPayload requestObj = new DeleteLockManagerPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
doRequest(requestObj, "DELETELOCKMANAGER", null); }
private static final class AcquireLockTypeReference extends TypeReference {
}
@Override
public LockHandle acquireLock(CallingContext context, String managerUri, String lockName, long secondsToWait, long secondsToKeep) {
AcquireLockPayload requestObj = new AcquireLockPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
requestObj.setLockName(lockName);
requestObj.setSecondsToWait(secondsToWait);
requestObj.setSecondsToKeep(secondsToKeep);
return doRequest(requestObj, "ACQUIRELOCK", new AcquireLockTypeReference()); }
private static final class ReleaseLockTypeReference extends TypeReference {
}
@Override
public Boolean releaseLock(CallingContext context, String managerUri, String lockName, LockHandle lockHandle) {
ReleaseLockPayload requestObj = new ReleaseLockPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
requestObj.setLockName(lockName);
requestObj.setLockHandle(lockHandle);
return doRequest(requestObj, "RELEASELOCK", new ReleaseLockTypeReference()); }
@Override
public void forceReleaseLock(CallingContext context, String managerUri, String lockName) {
ForceReleaseLockPayload requestObj = new ForceReleaseLockPayload();
requestObj.setContext(context == null ? this.getContext() : context);
requestObj.setManagerUri(managerUri);
requestObj.setLockName(lockName);
doRequest(requestObj, "FORCERELEASELOCK", null); }
@Override
public List getLockManagerConfigs(String managerUri) {
return getLockManagerConfigs(null,managerUri); }
@Override
public RaptureLockConfig createLockManager(String managerUri, String config, String pathPosition) {
return createLockManager(null,managerUri,config,pathPosition); }
@Override
public Boolean lockManagerExists(String managerUri) {
return lockManagerExists(null,managerUri); }
@Override
public RaptureLockConfig getLockManagerConfig(String managerUri) {
return getLockManagerConfig(null,managerUri); }
@Override
public void deleteLockManager(String managerUri) {
deleteLockManager(null,managerUri); }
@Override
public LockHandle acquireLock(String managerUri, String lockName, long secondsToWait, long secondsToKeep) {
return acquireLock(null,managerUri,lockName,secondsToWait,secondsToKeep); }
@Override
public Boolean releaseLock(String managerUri, String lockName, LockHandle lockHandle) {
return releaseLock(null,managerUri,lockName,lockHandle); }
@Override
public void forceReleaseLock(String managerUri, String lockName) {
forceReleaseLock(null,managerUri,lockName); }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy