View Javadoc
1   package com.atlassian.plugin.parsers;
2   
3   
4   import com.atlassian.util.concurrent.LazyReference;
5   import com.google.common.annotations.VisibleForTesting;
6   
7   import javax.annotation.Nonnull;
8   
9   import static java.lang.System.getProperty;
10  
11  /**
12   * This is used by the application this library is bundled with, it shouldn't be changed without also changing all the products it is bundled with.
13   */
14  public class DefaultSafeModeCommandLineArgumentsFactory implements SafeModeCommandLineArgumentsFactory {
15      private static final String PARAMETER_SYSTEM_PROPERTY = "atlassian.plugins.startup.options";
16      private LazyReference<SafeModeCommandLineArguments> safeModeCommandLineArguments = new LazyReference<SafeModeCommandLineArguments>() {
17          @Override
18          protected SafeModeCommandLineArguments create() throws Exception {
19              return new SafeModeCommandLineArguments(getProperty(PARAMETER_SYSTEM_PROPERTY, ""));
20          }
21      };
22  
23      /**
24       * The name of the system property that contains the startup parameters passed to start-<product>.sh
25       * (for example in the case <code>start-jira.sh -fg --disable-plugins=com.atlassian.xyz</code> this system property
26       * would be set to <code>-fg --disable-plugins=com.atlassian.xyz</code>
27       * This requires support from the host product
28       *
29       * @return The name of the system property
30       */
31      @VisibleForTesting
32      @Nonnull
33      String getParameterSystemProperty() {
34          return PARAMETER_SYSTEM_PROPERTY;
35      }
36  
37      @Override
38      public SafeModeCommandLineArguments get() {
39          return safeModeCommandLineArguments.get();
40  
41      }
42  }