View Javadoc
1   package com.atlassian.refapp.sal.license;
2   
3   import com.atlassian.extras.api.LicenseException;
4   import com.atlassian.extras.api.Product;
5   import com.atlassian.extras.api.ProductLicense;
6   import com.atlassian.extras.common.util.LicenseProperties;
7   import com.atlassian.extras.core.AbstractProductLicenseFactory;
8   import com.atlassian.extras.core.DefaultProductLicense;
9   
10  /**
11   * RefApp analogues of the per product constants in {@link Product} and associated classes.
12   *
13   * @since 3.0.0
14   */
15  public class RefappProduct {
16      private static final String REFAPP_NS = "refapp";
17  
18      public static Product REFAPP = new Product("RefImpl", REFAPP_NS);
19  
20      private static class RefappProductLicense extends DefaultProductLicense {
21          public RefappProductLicense(final Product product, final LicenseProperties licenseProperties) {
22              super(product, licenseProperties);
23          }
24      }
25  
26      static class RefappProductLicenseFactory extends AbstractProductLicenseFactory {
27          @Override
28          protected ProductLicense getLicenseInternal(final Product product, final LicenseProperties licenseProperties) {
29              if (REFAPP.equals(product)) {
30                  return new RefappProductLicense(product, licenseProperties);
31              } else {
32                  throw new LicenseException("Cannot create license for " + product);
33              }
34          }
35      }
36  }