Search in sources :

Example 1 with PluginRestricted

use of com.cinchapi.concourse.server.plugin.PluginRestricted in project concourse by cinchapi.

the class ConcourseServer method start.

/**
 * Start the server.
 *
 * @throws TTransportException
 */
@PluginRestricted
public void start() throws TTransportException {
    for (Engine engine : engines.values()) {
        engine.start();
    }
    httpServer.start();
    pluginManager.start();
    Thread mgmtThread = new Thread(() -> {
        mgmtServer.serve();
    }, "management-server");
    mgmtThread.setDaemon(true);
    mgmtThread.start();
    System.out.println("The Concourse server has started");
    server.serve();
}
Also used : Engine(com.cinchapi.concourse.server.storage.Engine) PluginRestricted(com.cinchapi.concourse.server.plugin.PluginRestricted)

Example 2 with PluginRestricted

use of com.cinchapi.concourse.server.plugin.PluginRestricted in project concourse by cinchapi.

the class ConcourseServer method stop.

/**
 * Stop the server.
 */
@PluginRestricted
public void stop() {
    if (server.isServing()) {
        mgmtServer.stop();
        server.stop();
        pluginManager.stop();
        httpServer.stop();
        for (Engine engine : engines.values()) {
            engine.stop();
        }
        numEnginesInitialized.set(0);
        System.out.println("The Concourse server has stopped");
    }
}
Also used : Engine(com.cinchapi.concourse.server.storage.Engine) PluginRestricted(com.cinchapi.concourse.server.plugin.PluginRestricted)

Example 3 with PluginRestricted

use of com.cinchapi.concourse.server.plugin.PluginRestricted in project concourse by cinchapi.

the class ConcourseServer method invokeManagement.

@Override
@PluginRestricted
public ComplexTObject invokeManagement(String method, List<ComplexTObject> params, AccessToken creds) throws TException {
    Object[] args = new Object[params.size() + 1];
    for (int i = 0; i < params.size(); ++i) {
        ComplexTObject arg = params.get(i);
        args[i] = arg.getJavaObject();
    }
    args[args.length - 1] = creds;
    try {
        Object result = Reflection.callIf(invoked -> Reflection.isDeclaredAnnotationPresentInHierarchy(invoked, ClientInvokable.class), this, method, args);
        return ComplexTObject.fromJavaObject(result);
    } catch (IllegalStateException e) {
        throw new ManagementException("The requested method invocation is either invalid or not " + "eligble for client-side invocation");
    } catch (Exception e) {
        throw new ManagementException(e.getMessage());
    }
}
Also used : ClientInvokable(com.cinchapi.concourse.server.management.ClientInvokable) ManagementException(com.cinchapi.concourse.thrift.ManagementException) ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) TransactionStateException(com.cinchapi.concourse.server.storage.TransactionStateException) SecurityException(com.cinchapi.concourse.thrift.SecurityException) TransactionException(com.cinchapi.concourse.thrift.TransactionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) DuplicateEntryException(com.cinchapi.concourse.thrift.DuplicateEntryException) MalformedObjectNameException(javax.management.MalformedObjectNameException) InsufficientAtomicityException(com.cinchapi.concourse.server.ops.InsufficientAtomicityException) TException(org.apache.thrift.TException) TTransportException(org.apache.thrift.transport.TTransportException) AtomicStateException(com.cinchapi.concourse.server.storage.AtomicStateException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ManagementException(com.cinchapi.concourse.thrift.ManagementException) ParseException(com.cinchapi.concourse.thrift.ParseException) MBeanRegistrationException(javax.management.MBeanRegistrationException) PluginRestricted(com.cinchapi.concourse.server.plugin.PluginRestricted)

Example 4 with PluginRestricted

use of com.cinchapi.concourse.server.plugin.PluginRestricted in project concourse by cinchapi.

the class ConcourseServer method stage.

@Override
@TranslateClientExceptions
@PluginRestricted
@VerifyAccessToken
public TransactionToken stage(AccessToken creds, String env) throws TException {
    TransactionToken token = new TransactionToken(creds, Time.now());
    Transaction transaction = getEngine(env).startTransaction();
    transactions.put(token, transaction);
    Logger.info("Started Transaction {}", transaction);
    return token;
}
Also used : Transaction(com.cinchapi.concourse.server.storage.Transaction) TransactionToken(com.cinchapi.concourse.thrift.TransactionToken) PluginRestricted(com.cinchapi.concourse.server.plugin.PluginRestricted) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Aggregations

PluginRestricted (com.cinchapi.concourse.server.plugin.PluginRestricted)4 Engine (com.cinchapi.concourse.server.storage.Engine)2 TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)1 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)1 ClientInvokable (com.cinchapi.concourse.server.management.ClientInvokable)1 InsufficientAtomicityException (com.cinchapi.concourse.server.ops.InsufficientAtomicityException)1 AtomicStateException (com.cinchapi.concourse.server.storage.AtomicStateException)1 Transaction (com.cinchapi.concourse.server.storage.Transaction)1 TransactionStateException (com.cinchapi.concourse.server.storage.TransactionStateException)1 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)1 DuplicateEntryException (com.cinchapi.concourse.thrift.DuplicateEntryException)1 ManagementException (com.cinchapi.concourse.thrift.ManagementException)1 ParseException (com.cinchapi.concourse.thrift.ParseException)1 SecurityException (com.cinchapi.concourse.thrift.SecurityException)1 TObject (com.cinchapi.concourse.thrift.TObject)1 TransactionException (com.cinchapi.concourse.thrift.TransactionException)1 TransactionToken (com.cinchapi.concourse.thrift.TransactionToken)1 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1