View Javadoc
1   package com.atlassian.activeobjects.internal;
2   
3   import com.atlassian.activeobjects.config.ActiveObjectsConfiguration;
4   import com.atlassian.activeobjects.external.ActiveObjects;
5   import com.atlassian.tenancy.api.Tenant;
6   
7   /**
8    * Factory to create instances of {@link com.atlassian.activeobjects.external.ActiveObjects}.
9    */
10  public 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, Tenant)} to avoid an {@link IllegalStateException} being
14       * thrown.
15       *
16       * @param configuration the configuration of active objects
17       * @return {@code true} if the {@link ActiveObjectsConfiguration configuration} is supported.
18       */
19      boolean accept(ActiveObjectsConfiguration configuration);
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 upgrade
29       * @see #accept(ActiveObjectsConfiguration)
30       */
31      ActiveObjects create(ActiveObjectsConfiguration configuration, Tenant tenant);
32  }