<commit_before>#
# Copyright <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include Chef::Asadmin

def default_logging_properties
  {
    "handlers" => "java.util.logging.ConsoleHandler",
    "java.util.logging.ConsoleHandler.formatter" => "com.sun.enterprise.server.logging.UniformLogFormatter",

    "com.sun.enterprise.server.logging.GFFileHandler.formatter" => "com.sun.enterprise.server.logging.UniformLogFormatter",
    "com.sun.enterprise.server.logging.GFFileHandler.file" => "${com.sun.aas.instanceRoot}/logs/server.log",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes" => "0",
    "com.sun.enterprise.server.logging.GFFileHandler.flushFrequency" => "1",
    "com.sun.enterprise.server.logging.GFFileHandler.logtoConsole" => "false",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes" => "2000000",
    "com.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours" => "0",
    "com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles" => "3",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange" => "false",

    "com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging" => "false",

    "log4j.logger.org.hibernate.validator.util.Version" => "warn",

    #All log level details
    ".level" => "INFO",

    "com.sun.enterprise.server.logging.GFFileHandler.level" => "ALL",
    "javax.enterprise.system.tools.admin.level" => "INFO",
    "org.apache.jasper.level" => "INFO",
    "javax.enterprise.resource.corba.level" => "INFO",
    "javax.enterprise.system.core.level" => "INFO",
    "javax.enterprise.system.core.classloading.level" => "INFO",
    "javax.enterprise.resource.jta.level" => "INFO",
    "java.util.logging.ConsoleHandler.level" => "FINEST",
    "javax.enterprise.system.webservices.saaj.level" => "INFO",
    "javax.enterprise.system.tools.deployment.level" => "INFO",
    "javax.enterprise.system.container.ejb.level" => "INFO",
    "javax.enterprise.system.core.transaction.level" => "INFO",
    "org.apache.catalina.level" => "INFO",
    "javax.enterprise.system.container.ejb.mdb.level" => "INFO",
    "org.apache.coyote.level" => "INFO",
    "javax.level" => "INFO",
    "javax.enterprise.resource.javamail.level" => "INFO",
    "javax.enterprise.system.webservices.rpc.level" => "INFO",
    "javax.enterprise.system.container.web.level" => "INFO",
    "javax.enterprise.system.util.level" => "INFO",
    "javax.enterprise.resource.resourceadapter.level" => "INFO",
    "javax.enterprise.resource.jms.level" => "INFO",
    "javax.enterprise.system.core.config.level" => "INFO",
    "javax.enterprise.system.level" => "INFO",
    "javax.enterprise.system.core.security.level" => "INFO",
    "javax.enterprise.system.container.cmp.level" => "INFO",
    "javax.enterprise.system.webservices.registry.level" => "INFO",
    "javax.enterprise.system.core.selfmanagement.level" => "INFO",
    "javax.enterprise.resource.jdo.level" => "INFO",
    "javax.enterprise.system.core.naming.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.application.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.resource.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.config.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.context.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.facelets.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.lifecycle.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.managedbean.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.renderkit.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.taglib.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.timing.level" => "INFO",
    "javax.enterprise.resource.sqltrace.level" => "FINE",
    "javax.org.glassfish.persistence.level" => "INFO",
    "org.jvnet.hk2.osgiadapter.level" => "INFO",
    "javax.enterprise.system.tools.backup.level" => "INFO",
    "org.glassfish.admingui.level" => "INFO",
    "javax.enterprise.system.ssl.security.level" => "INFO",
    "ShoalLogger.level" => "CONFIG",
    "org.eclipse.persistence.session.level" => "INFO",
  }
end

def default_realm_confs
  {
    "fileRealm" => "com.sun.enterprise.security.auth.login.FileLoginModule",
    "ldapRealm" => "com.sun.enterprise.security.auth.login.LDAPLoginModule",
    "solarisRealm" => "com.sun.enterprise.security.auth.login.SolarisLoginModule",
    "jdbcRealm" => "com.sun.enterprise.security.auth.login.JDBCLoginModule",
    "jdbcDigestRealm" => "com.sun.enterprise.security.auth.login.JDBCDigestLoginModule",
    "pamRealm" => "com.sun.enterprise.security.auth.login.PamLoginModule",
  }
end

def default_jvm_options
  [
    # Don't rely on the JVMs default encoding
    "-Dfile.encoding=UTF-8",

    # Glassfish should be headless by default
    "-Djava.awt.headless=true",

    # Remove the "Server" header altogether
    "-Dproduct.name=\"\"",

    # JVM options
    "-XX:+UnlockDiagnosticVMOptions",
    "-XX:MaxPermSize=#{new_resource.max_perm_size}m",
    #"-XX:PermSize=64m",
    "-Xss#{new_resource.max_stack_size}k",
    "-Xms#{new_resource.min_memory}m",
    "-Xmx#{new_resource.max_memory}m",
    "-XX:NewRatio=2",
    "-client",
    "-Djava.ext.dirs=#{node['java']['java_home']}/lib/ext:#{node['java']['java_home']}/jre/lib/ext:#{domain_dir_path}/lib/ext",
    "-Djava.endorsed.dirs=#{node['glassfish']['base_dir']}/glassfish/modules/endorsed:#{node['glassfish']['domains_dir']}/glassfish/lib/endorsed",

      # Configuration to enable effective JMX management
    "-Djava.rmi.server.hostname=#{node['fqdn']}",<commit_msg>Remove extra quotes<commit_after>#
# Copyright <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include Chef::Asadmin

def default_logging_properties
  {
    "handlers" => "java.util.logging.ConsoleHandler",
    "java.util.logging.ConsoleHandler.formatter" => "com.sun.enterprise.server.logging.UniformLogFormatter",

    "com.sun.enterprise.server.logging.GFFileHandler.formatter" => "com.sun.enterprise.server.logging.UniformLogFormatter",
    "com.sun.enterprise.server.logging.GFFileHandler.file" => "${com.sun.aas.instanceRoot}/logs/server.log",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes" => "0",
    "com.sun.enterprise.server.logging.GFFileHandler.flushFrequency" => "1",
    "com.sun.enterprise.server.logging.GFFileHandler.logtoConsole" => "false",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes" => "2000000",
    "com.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours" => "0",
    "com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles" => "3",
    "com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange" => "false",

    "com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging" => "false",

    "log4j.logger.org.hibernate.validator.util.Version" => "warn",

    #All log level details
    ".level" => "INFO",

    "com.sun.enterprise.server.logging.GFFileHandler.level" => "ALL",
    "javax.enterprise.system.tools.admin.level" => "INFO",
    "org.apache.jasper.level" => "INFO",
    "javax.enterprise.resource.corba.level" => "INFO",
    "javax.enterprise.system.core.level" => "INFO",
    "javax.enterprise.system.core.classloading.level" => "INFO",
    "javax.enterprise.resource.jta.level" => "INFO",
    "java.util.logging.ConsoleHandler.level" => "FINEST",
    "javax.enterprise.system.webservices.saaj.level" => "INFO",
    "javax.enterprise.system.tools.deployment.level" => "INFO",
    "javax.enterprise.system.container.ejb.level" => "INFO",
    "javax.enterprise.system.core.transaction.level" => "INFO",
    "org.apache.catalina.level" => "INFO",
    "javax.enterprise.system.container.ejb.mdb.level" => "INFO",
    "org.apache.coyote.level" => "INFO",
    "javax.level" => "INFO",
    "javax.enterprise.resource.javamail.level" => "INFO",
    "javax.enterprise.system.webservices.rpc.level" => "INFO",
    "javax.enterprise.system.container.web.level" => "INFO",
    "javax.enterprise.system.util.level" => "INFO",
    "javax.enterprise.resource.resourceadapter.level" => "INFO",
    "javax.enterprise.resource.jms.level" => "INFO",
    "javax.enterprise.system.core.config.level" => "INFO",
    "javax.enterprise.system.level" => "INFO",
    "javax.enterprise.system.core.security.level" => "INFO",
    "javax.enterprise.system.container.cmp.level" => "INFO",
    "javax.enterprise.system.webservices.registry.level" => "INFO",
    "javax.enterprise.system.core.selfmanagement.level" => "INFO",
    "javax.enterprise.resource.jdo.level" => "INFO",
    "javax.enterprise.system.core.naming.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.application.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.resource.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.config.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.context.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.facelets.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.lifecycle.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.managedbean.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.renderkit.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.taglib.level" => "INFO",
    "javax.enterprise.resource.webcontainer.jsf.timing.level" => "INFO",
    "javax.enterprise.resource.sqltrace.level" => "FINE",
    "javax.org.glassfish.persistence.level" => "INFO",
    "org.jvnet.hk2.osgiadapter.level" => "INFO",
    "javax.enterprise.system.tools.backup.level" => "INFO",
    "org.glassfish.admingui.level" => "INFO",
    "javax.enterprise.system.ssl.security.level" => "INFO",
    "ShoalLogger.level" => "CONFIG",
    "org.eclipse.persistence.session.level" => "INFO",
  }
end

def default_realm_confs
  {
    "fileRealm" => "com.sun.enterprise.security.auth.login.FileLoginModule",
    "ldapRealm" => "com.sun.enterprise.security.auth.login.LDAPLoginModule",
    "solarisRealm" => "com.sun.enterprise.security.auth.login.SolarisLoginModule",
    "jdbcRealm" => "com.sun.enterprise.security.auth.login.JDBCLoginModule",
    "jdbcDigestRealm" => "com.sun.enterprise.security.auth.login.JDBCDigestLoginModule",
    "pamRealm" => "com.sun.enterprise.security.auth.login.PamLoginModule",
  }
end

def default_jvm_options
  [
    # Don't rely on the JVMs default encoding
    "-Dfile.encoding=UTF-8",

    # Glassfish should be headless by default
    "-Djava.awt.headless=true",

    # Remove the "Server" header altogether
    "-Dproduct.name=",

    # JVM options
    "-XX:+UnlockDiagnosticVMOptions",
    "-XX:MaxPermSize=#{new_resource.max_perm_size}m",
    #"-XX:PermSize=64m",
    "-Xss#{new_resource.max_stack_size}k",
    "-Xms#{new_resource.min_memory}m",
    "-Xmx#{new_resource.max_memory}m",
    "-XX:NewRatio=2",
    "-client",
    "-Djava.ext.dirs=#{node['java']['java_home']}/lib/ext:#{node['java']['java_home']}/jre/lib/ext:#{domain_dir_path}/lib/ext",
    "-Djava.endorsed.dirs=#{node['glassfish']['base_dir']}/glassfish/modules/endorsed:#{node['glassfish']['domains_dir']}/glassfish/lib/endorsed",

      # Configuration to enable effective JMX management
    "-Djava.rmi.server.hostname=#{node['fqdn']}",
{'fraction_non_alphanumeric': 0.17092496765847348, 'fraction_numerical': 0.0033958602846054335, 'mean_word_length': 4.389542483660131, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5174453', 'n_tokens_mistral': 4196, 'n_tokens_neox': 4227, 'n_words': 543}