29 lines
949 B
Java
29 lines
949 B
Java
package p.studio.api.automation;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
/** Required grant participant. Preparation/publication may do IO; activation/invalidation must not. */
|
|
public interface AutomationConnectionLifecycle {
|
|
Publication prepare(Path projectRoot) throws Exception;
|
|
|
|
final class OwnershipConflict extends Exception {
|
|
public OwnershipConflict() { super("Another Studio instance owns this project's connection. Reclaim or close it before granting here."); }
|
|
}
|
|
|
|
interface Publication extends AutoCloseable {
|
|
void publish() throws Exception;
|
|
void activate();
|
|
void invalidate();
|
|
@Override void close() throws Exception;
|
|
}
|
|
|
|
static AutomationConnectionLifecycle none() {
|
|
return root -> new Publication() {
|
|
public void publish() { }
|
|
public void activate() { }
|
|
public void invalidate() { }
|
|
public void close() { }
|
|
};
|
|
}
|
|
}
|