summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/LookupManager.java
blob: ce1268eca7a2d045542300b174b4f8a851596622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.c2kernel.lookup;

import java.security.NoSuchAlgorithmException;

import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectCannotBeUpdated;
import com.c2kernel.common.ObjectNotFoundException;

/**
 * @author abranson
 *
 */
public interface LookupManager extends Lookup {
	
	/**
	 * Called when a server starts up. The Lookup implementation should ensure that the initial structure of its directory is valid, and create it on first boot.
	 * 
	 * @throws ObjectNotFoundException When initialization data is not found
	 */
	public void initializeDirectory() throws ObjectNotFoundException;
	
	// Path management
	
	/**
	 * Register a new a Path in the directory.
	 * 
	 * @param newPath The path to add
	 * @throws ObjectCannotBeUpdated When there is an error writing to the directory
	 * @throws ObjectAlreadyExistsException When the Path has already been registered
	 */
	public void add(Path newPath) throws ObjectCannotBeUpdated, ObjectAlreadyExistsException;

	/**
	 * Remove a Path from the directory
	 * @param path The path to remove
	 * @throws ObjectCannotBeUpdated When an error occurs writing to the directory
	 */
	public void delete(Path path) throws ObjectCannotBeUpdated;
	
	// Role and agent management
	
	/**
	 * @param role
	 * @param hasJobList
	 * @return
	 * @throws ObjectAlreadyExistsException
	 * @throws ObjectCannotBeUpdated
	 */
	public RolePath createRole(String role, boolean hasJobList) throws ObjectAlreadyExistsException, ObjectCannotBeUpdated;

	/**
	 * @param agent
	 * @param rolePath
	 * @throws ObjectCannotBeUpdated
	 * @throws ObjectNotFoundException
	 */
	public void addRole(AgentPath agent, RolePath rolePath) throws ObjectCannotBeUpdated, ObjectNotFoundException;

	/**
	 * @param agent
	 * @param role
	 * @throws ObjectCannotBeUpdated
	 * @throws ObjectNotFoundException
	 */
	public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFoundException;

	/**
	 * @param agent
	 * @param newPassword
	 * @throws ObjectNotFoundException
	 * @throws ObjectCannotBeUpdated
	 * @throws NoSuchAlgorithmException
	 */
	public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException;
	
	/**
	 * @param role
	 * @param hasJobList
	 * @throws ObjectNotFoundException
	 * @throws ObjectCannotBeUpdated
	 */
	public void setHasJobList(RolePath role, boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated;


}