/activeobjects-plugin/src/main/java/com/atlassian/activeobjects/internal/ActiveObjectsFactory.java
Java | 32 lines | 8 code | 4 blank | 20 comment | 0 complexity | fa5176bf134b384cc407f002d69b90a8 MD5 | raw file
Possible License(s): Apache-2.0
1package com.atlassian.activeobjects.internal;
2
3import com.atlassian.activeobjects.config.ActiveObjectsConfiguration;
4import com.atlassian.activeobjects.external.ActiveObjects;
5import com.atlassian.tenancy.api.Tenant;
6
7/**
8 * Factory to create instances of {@link com.atlassian.activeobjects.external.ActiveObjects}.
9 */
10public interface ActiveObjectsFactory {
11 /**
12 * Tells whether the give data source type is supported by this factory, users should call this method before
13 * calling {@link #create(ActiveObjectsConfiguration)} to avoid an {@link IllegalStateException} being thrown.
14 *
15 * @param configuration the configuration of active objects
16 * @return {@code true} if the {@link ActiveObjectsConfiguration configuration} is supported.
17 */
18 boolean accept(ActiveObjectsConfiguration configuration);
19
20
21 /**
22 * Creates a <em>new</em> instance of {@link com.atlassian.activeobjects.external.ActiveObjects} each time it is called.
23 *
24 * @param configuration th configuration of active objects
25 * @param tenant against which to create
26 * @return the new {@link com.atlassian.activeobjects.external.ActiveObjects}
27 * @throws IllegalStateException is the type of configuration is not supported by this factory
28 * @throws com.atlassian.activeobjects.internal.ActiveObjectsInitException on failure to lock across the cluster prior to upgradation
29 * @see #accept(ActiveObjectsConfiguration)
30 */
31 ActiveObjects create(ActiveObjectsConfiguration configuration, Tenant tenant);
32}