/activeobjects-plugin/src/main/java/com/atlassian/activeobjects/internal/ActiveObjectsFactory.java

https://bitbucket.org/activeobjects/ao-plugin · Java · 32 lines · 8 code · 4 blank · 20 comment · 0 complexity · fa5176bf134b384cc407f002d69b90a8 MD5 · raw file

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