Search in sources :

Example 1 with Welcome

use of org.neo4j.shell.Welcome in project neo4j by neo4j.

the class AbstractClient method sayHi.

protected void sayHi(ShellServer server) throws RemoteException, ShellException {
    Welcome welcome = server.welcome(initialSession);
    id = welcome.getId();
    prompt = welcome.getPrompt();
    if (!welcome.getMessage().isEmpty()) {
        getOutput().println(welcome.getMessage());
    }
}
Also used : Welcome(org.neo4j.shell.Welcome)

Example 2 with Welcome

use of org.neo4j.shell.Welcome in project neo4j by neo4j.

the class GraphDatabaseShellServer method welcome.

@Override
public Welcome welcome(Map<String, Serializable> initialSession) throws RemoteException, ShellException {
    try (org.neo4j.graphdb.Transaction transaction = graphDb.beginTx()) {
        Welcome welcome = super.welcome(initialSession);
        transaction.success();
        return welcome;
    } catch (RuntimeException e) {
        throw new RemoteException(e.getMessage(), e);
    }
}
Also used : Welcome(org.neo4j.shell.Welcome) RemoteException(java.rmi.RemoteException)

Example 3 with Welcome

use of org.neo4j.shell.Welcome in project neo4j by neo4j.

the class SimpleAppServer method welcome.

@Override
public Welcome welcome(Map<String, Serializable> initialSession) throws RemoteException, ShellException {
    Serializable clientId = newClientId();
    if (clientSessions.containsKey(clientId)) {
        throw new IllegalStateException("Client " + clientId + " already initialized");
    }
    Session session = newSession(clientId, initialSession);
    clientSessions.put(clientId, session);
    try {
        String message = noWelcome(initialSession) ? "" : getWelcomeMessage();
        return new Welcome(message, clientId, getPrompt(session));
    } catch (ShellException e) {
        throw new RemoteException(e.getMessage());
    }
}
Also used : Serializable(java.io.Serializable) Welcome(org.neo4j.shell.Welcome) RemoteException(java.rmi.RemoteException) ShellException(org.neo4j.shell.ShellException) Session(org.neo4j.shell.Session)

Aggregations

Welcome (org.neo4j.shell.Welcome)3 RemoteException (java.rmi.RemoteException)2 Serializable (java.io.Serializable)1 Session (org.neo4j.shell.Session)1 ShellException (org.neo4j.shell.ShellException)1