View Javadoc
1   package org.argeo.connect;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import javax.jcr.Session;
7   
8   /** Define API to manage the life cycle of a Connect App */
9   public interface AppMaintenanceService {
10  
11  	/** The system roles that must be available in the system. */
12  	default List<String> getRequiredRoles() {
13  		return new ArrayList<>();
14  	}
15  
16  	/**
17  	 * Creates the base JCR tree structure expected for this app if necessary.
18  	 * 
19  	 * Expects a clean session ({@link Session#hasPendingChanges()} should return
20  	 * false) and saves it once the changes have been done. Thus the session can be
21  	 * rolled back if an exception occurs.
22  	 * 
23  	 * @return true if something as been updated
24  	 */
25  	public boolean prepareJcrTree(Session session);
26  
27  	/**
28  	 * Adds app specific default privileges.
29  	 * 
30  	 * Expects a clean session ({@link Session#hasPendingChanges()} should return
31  	 * false} and saves it once the changes have been done. Thus the session can be
32  	 * rolled back if an exception occurs.
33  	 * 
34  	 * Warning: no check is done and corresponding privileges are always added, so
35  	 * only call this when necessary
36  	 */
37  	public void configurePrivileges(Session session);
38  
39  	public String getDefaultBasePath();
40  	// public void importResources(Session session, Map<String, URI> resources);
41  	//
42  	// public void importData(Session session, URI uri, Map<String, URI>
43  	// dataSources);
44  	//
45  	// default public void doBackup(Session session, URI uri, Object resource) {
46  	// }
47  }