com.nesstar.api
Interface Server

All Superinterfaces:
NesstarObject, NesstarTreeObject

public interface Server
extends NesstarTreeObject

A representation of a Nesstar Server. The server is a container for statistical data and metadata in the form of studies. The studies are organised in one or more, possibly nested catalogues.

Since:
0.1

Method Summary
 Role createRole(String roleId, String label, String description)
          Create a new role.
 User createUser(String userId, String password, Role... roles)
          Create a new user on the server.
 void deleteUser(String userId)
          Delete a user on the server.
<T extends NesstarBankObject>
Bank<T>
getBank(Class<T> type)
          Gets a Bank implementation containing objects according to type.
 User getCurrentUser()
          Gets the current user.
 NesstarTreeNode getTreeRoot()
          Get the root node of the server's object tree.
 NesstarList<User> getUsersWithSpecifiedRole(Role role)
          Get a list of users associated with a specific role.
 boolean login(String username, String password)
          Login to the Nesstar server.
 void removeRole(String roleId)
          Remove a role from the server.
 
Methods inherited from interface com.nesstar.api.NesstarObject
getId, getLabel, getTimeStamp, reload, toURI
 

Method Detail

login

boolean login(String username,
              String password)
Login to the Nesstar server.

Parameters:
username - the User's id (for example "johnsmith").
password - the user's personal password.
Returns:
true if login was successful, false otherwise.

getCurrentUser

User getCurrentUser()
                    throws NotAuthorizedException,
                           IOException
Gets the current user.

Returns:
The currently logged in user in this context.
Throws:
NotAuthorizedException - If access was denied by the Nesstar server.
IOException - If there was an error while communicating with the server.
Since:
0.2

createUser

User createUser(String userId,
                String password,
                Role... roles)
                throws NotAuthorizedException,
                       IOException
Create a new user on the server.

Parameters:
userId - the User's id (for example "johnsmith").
password - the user's personal password.
roles - One or more roles attributed to the user.
Returns:
A new User on the server.
Throws:
NotAuthorizedException - If access was denied by the Nesstar server.
IOException - If there was an error while communicating with the server.
IllegalArgumentException - If no roles were supplied, or if a supplied role is associated with another server.
Since:
0.2
See Also:
on how to retrieve Role objects.

deleteUser

void deleteUser(String userId)
                throws NotAuthorizedException,
                       IOException
Delete a user on the server.

Parameters:
userId - the User's id (for example "johnsmith").
Throws:
NotAuthorizedException - If access was denied by the Nesstar server.
IOException - If there was an error while communicating with the server.
Since:
0.2

getUsersWithSpecifiedRole

NesstarList<User> getUsersWithSpecifiedRole(Role role)
                                            throws NotAuthorizedException,
                                                   IOException
Get a list of users associated with a specific role.

Parameters:
role - a role object
Returns:
A NesstarList list of User on the server.
Throws:
NotAuthorizedException - If access was denied by the Nesstar server.
IOException - If there was an error while communicating with the server.
Since:
0.2

createRole

Role createRole(String roleId,
                String label,
                String description)
                throws NotAuthorizedException,
                       IOException
Create a new role.

Parameters:
roleId - the identify of a role.
label - the human readable label of a role.
description - the free text description of role in detail.
Returns:
A Role object on the server.
Throws:
NotAuthorizedException - If access was denied by the Nesstar server.
IOException - If there was an error while communicating with the server.
Since:
0.2

removeRole

void removeRole(String roleId)
                throws NotAuthorizedException,
                       IOException
Remove a role from the server. The role will also be removed from all users associated with it.

Parameters:
roleId -
Throws:
NotAuthorizedException
IOException

getBank

<T extends NesstarBankObject> Bank<T> getBank(Class<T> type)
Gets a Bank implementation containing objects according to type.

Parameters:
type - The type of object to be contained in the bank.
Returns:
A Bank implementation containing all type objects on this server.
Since:
0.2

getTreeRoot

NesstarTreeNode getTreeRoot()
                            throws NotAuthorizedException,
                                   IOException
Get the root node of the server's object tree.

Returns:
A NesstarTreeNode representing the root of the tree.
Throws:
NotAuthorizedException - If the user isn't allowed to access the tree.
IOException - If an error occurred communicating with the server.


Copyright © 2011, NSD All rights reserved