Package org.nasutekds.quicksetup

Examples of org.nasutekds.quicksetup.JavaArguments


   * @return the java arguments object representing the input of the user
   * in this panel.
   */
  public JavaArguments getJavaArguments()
  {
    JavaArguments javaArguments = new JavaArguments();

    String sMaxMemory = tfMaxMemory.getText().trim();
    if (sMaxMemory.length() > 0)
    {
      javaArguments.setMaxMemory(Integer.parseInt(sMaxMemory));
    }
    String sInitialMemory = tfInitialMemory.getText().trim();
    if (sInitialMemory.length() > 0)
    {
      javaArguments.setInitialMemory(Integer.parseInt(sInitialMemory));
    }
    String[] args = getOtherArguments();
    if (args.length > 0)
    {
      javaArguments.setAdditionalArguments(args);
    }
    return javaArguments;
  }
View Full Code Here


   */
  public static void main(String[] args)
  {
    try
    {
      JavaArguments javaArgs = new JavaArguments();
      javaArgs.setInitialMemory(100);
      javaArgs.setMaxMemory(99);
      javaArgs.setAdditionalArguments(new String[]{"" , "-client", "-XX"});
      // UIFactory.initialize();
      JavaArgumentsDialog dlg = new JavaArgumentsDialog(new JFrame(), javaArgs,
          Message.raw("my title"),
          Message.raw("Set the java arguments for the test command-line."));
      dlg.pack();
View Full Code Here

  private boolean displayWebStartWarningIfRequired()
  {
    boolean returnValue = true;
    if (Utils.isWebStart() && !userAgreedWithWebStart)
    {
      JavaArguments args = getJavaArguments();
      if (!args.equals(javaArguments) &&
          ((args.getInitialMemory() != -1) ||
              (args.getMaxMemory() != -1) ||
              (args.getAdditionalArguments().length > 0)))
      {
        returnValue = displayConfirmationDialog(
            INFO_JAVA_ARGUMENTS_CANNOT_BE_CHECKED_IN_WEBSTART.get(),
            INFO_CONFIRMATION_TITLE.get());
        userAgreedWithWebStart = returnValue;
View Full Code Here

    // JavaArgument.
    Map<JavaArguments, JavaArguments> hmJavaArguments =
      new HashMap<JavaArguments, JavaArguments>();
    for (String script : uData.getScriptNamesForJavaArguments())
    {
      JavaArguments origJavaArguments = uData.getJavaArguments(script);
      if (hmJavaArguments.get(origJavaArguments) == null)
      {
        if (Utils.supportsOption(origJavaArguments.getStringArguments(),
            javaHome, installPath))
        {
          // The argument works, so just use it.
          hmJavaArguments.put(origJavaArguments, origJavaArguments);
        }
        else
        {
          // We have to fix it somehow: test separately memory and other
          // arguments to see if something works.
          JavaArguments transformedArguments =
            getBestEffortArguments(origJavaArguments, javaHome, installPath);
          hmJavaArguments.put(origJavaArguments, transformedArguments);
        }
      }
      else
      {
        // Already checked if supported.
      }
    }

    Properties fileProperties = getJavaPropertiesFileContents(
        getPropertiesFileName(installPath));
    Map<String, JavaArguments> args = new HashMap<String, JavaArguments>();
    Map<String, String> otherProperties = new HashMap<String, String>();

    for (String script : uData.getScriptNamesForJavaArguments())
    {
      JavaArguments origJavaArgument = uData.getJavaArguments(script);
      JavaArguments transformedJavaArg = hmJavaArguments.get(origJavaArgument);
      JavaArguments defaultJavaArg = uData.getDefaultJavaArguments(script);

      // Apply the following policy: overwrite the values in the file only
      // if the values provided by the user are not the default ones.

      String propertiesKey = getJavaArgPropertyForScript(script);
View Full Code Here

   * @return a working JavaArguments object.
   */
  private JavaArguments getBestEffortArguments(JavaArguments origJavaArguments,
      String javaHome, String installPath)
  {
    JavaArguments memArgs = new JavaArguments();
    memArgs.setInitialMemory(origJavaArguments.getInitialMemory());
    memArgs.setMaxMemory(origJavaArguments.getMaxMemory());
    String m = memArgs.getStringArguments();
    boolean supportsMemory = false;
    if (m.length() > 0)
    {
      supportsMemory = Utils.supportsOption(m, javaHome, installPath);
    }

    JavaArguments additionalArgs = new JavaArguments();
    additionalArgs.setAdditionalArguments(
        origJavaArguments.getAdditionalArguments());
    String a = additionalArgs.getStringArguments();
    boolean supportsAdditional = false;
    if (a.length() > 0)
    {
      supportsAdditional = Utils.supportsOption(a, javaHome, installPath);
    }

    JavaArguments javaArgs = new JavaArguments();
    if (supportsMemory)
    {
      javaArgs.setInitialMemory(origJavaArguments.getInitialMemory());
      javaArgs.setMaxMemory(origJavaArguments.getMaxMemory());
    }
    else
    {
      // Try to figure out a smaller amount of memory.
      long currentMaxMemory = Runtime.getRuntime().maxMemory();
      int maxMemory = origJavaArguments.getMaxMemory();
      if (maxMemory != -1)
      {
        maxMemory = maxMemory / 2;
        while ((1024 * 1024 * maxMemory) < currentMaxMemory &&
            !Utils.supportsOption(JavaArguments.getMaxMemoryArgument(maxMemory),
                javaHome, installPath))
        {
          maxMemory = maxMemory / 2;
        }
        if ((1024 * 1024 * maxMemory) > currentMaxMemory)
        {
          // Supports this option.
          javaArgs.setMaxMemory(maxMemory);
        }
      }
    }
    if (supportsAdditional)
    {
      javaArgs.setAdditionalArguments(
          origJavaArguments.getAdditionalArguments());
    }
    return javaArgs;
  }
View Full Code Here

   * user.
   */
private String getRuntimeString(UserData userData)
{
   String s;
   JavaArguments serverArguments =
     userData.getJavaArguments(UserData.SERVER_SCRIPT_NAME);
   JavaArguments importArguments =
     userData.getJavaArguments(UserData.IMPORT_SCRIPT_NAME);


   boolean defaultServer =
     userData.getDefaultJavaArguments(UserData.SERVER_SCRIPT_NAME).equals(
         serverArguments);
   boolean defaultImport =
   userData.getDefaultJavaArguments(UserData.IMPORT_SCRIPT_NAME).equals(
       importArguments);

   if (defaultServer && defaultImport)
   {
     s = INFO_DEFAULT_JAVA_ARGUMENTS.get().toString();
   }
   else if (defaultServer)
   {
     s = INFO_USE_CUSTOM_IMPORT_RUNTIME.get(
         importArguments.getStringArguments()).toString();
   }
   else if (defaultImport)
   {
     s = INFO_USE_CUSTOM_SERVER_RUNTIME.get(
         serverArguments.getStringArguments()).toString();
   }
   else
   {
     s = INFO_USE_CUSTOM_SERVER_RUNTIME.get(
         serverArguments.getStringArguments())+"\n"+
         INFO_USE_CUSTOM_IMPORT_RUNTIME.get(
             importArguments.getStringArguments());
   }
   return s;
}
View Full Code Here

  private String getEquivalentJavaPropertiesProcedure(
      UserData userData,
      ProgressMessageFormatter formatter)
  {
    StringBuilder sb = new StringBuilder();
    JavaArguments serverArguments =
      userData.getJavaArguments(UserData.SERVER_SCRIPT_NAME);
    JavaArguments importArguments =
      userData.getJavaArguments(UserData.IMPORT_SCRIPT_NAME);

    ArrayList<String> linesToAdd = new ArrayList<String>();

    boolean defaultServer =
      userData.getDefaultJavaArguments(UserData.SERVER_SCRIPT_NAME).equals(
          serverArguments);
    boolean defaultImport =
    userData.getDefaultJavaArguments(UserData.IMPORT_SCRIPT_NAME).equals(
        importArguments);

    if (!defaultServer)
    {
      linesToAdd.add(getJavaArgPropertyForScript(UserData.SERVER_SCRIPT_NAME)
          +": "+serverArguments.getStringArguments());
    }
    if (!defaultImport)
    {
      linesToAdd.add(getJavaArgPropertyForScript(UserData.IMPORT_SCRIPT_NAME)+
          ": "+importArguments.getStringArguments());
    }

    if (linesToAdd.size() == 1)
    {
      String arg0 = getJavaPropertiesFilePath(userData);
View Full Code Here

TOP

Related Classes of org.nasutekds.quicksetup.JavaArguments

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.