<commit_before>/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 *      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.
*/

package org.kie.api.runtime.manager;

import org.kie.api.KieBase;
import org.kie.api.builder.ReleaseId;
import org.kie.api.io.Resource;
import org.kie.api.io.ResourceType;
import org.kie.api.task.UserGroupCallback;
import org.kie.api.task.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public interface RuntimeEnvironmentBuilder {

    public RuntimeEnvironmentBuilder persistence(boolean persistenceEnabled);

    public RuntimeEnvironmentBuilder entityManagerFactory(Object emf);

    public RuntimeEnvironmentBuilder addAsset(Resource asset, ResourceType type);

    public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value);

    public RuntimeEnvironmentBuilder addConfiguration(String name, String value);

    public RuntimeEnvironmentBuilder knowledgeBase(KieBase kbase);

    public RuntimeEnvironmentBuilder userGroupCallback(UserGroupCallback callback);

    public RuntimeEnvironmentBuilder userInfo(UserInfo userInfo);

    public RuntimeEnvironmentBuilder registerableItemsFactory(RegisterableItemsFactory factory);

    public RuntimeEnvironment get();

    public RuntimeEnvironmentBuilder classLoader(ClassLoader cl);

    public RuntimeEnvironmentBuilder schedulerService(Object globalScheduler);

    public static class Factory implements RuntimeEnvironmentBuilderFactory {
        private static RuntimeEnvironmentBuilderFactory INSTANCE;
        private static Logger logger = LoggerFactory.getLogger(Factory.class);

        static {
            try {
                INSTANCE = ( RuntimeEnvironmentBuilderFactory )
                        Class.forName( "org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder").newInstance();
            } catch (Exception e) {
                logger.error("Unable to instance RuntimeEnvironmentBuilderFactory due to " + e.getMessage());
            }
        }

        /**
         * Returns a reference to the RuntimeEnvironmentBuilderFactory singleton
         */
        public static RuntimeEnvironmentBuilderFactory get() {
            if (INSTANCE == null) {
                throw new RuntimeException("RuntimeEnvironmentBuilder was not initialized, see previous errors");
            }
            return INSTANCE;
        }
<commit_msg>RHPAM-1624 - Ability to override RuntimeEnvironmentBuilder implementation class (#366)<commit_after>/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 *      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.
*/

package org.kie.api.runtime.manager;

import org.kie.api.KieBase;
import org.kie.api.builder.ReleaseId;
import org.kie.api.io.Resource;
import org.kie.api.io.ResourceType;
import org.kie.api.task.UserGroupCallback;
import org.kie.api.task.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public interface RuntimeEnvironmentBuilder {

    public RuntimeEnvironmentBuilder persistence(boolean persistenceEnabled);

    public RuntimeEnvironmentBuilder entityManagerFactory(Object emf);

    public RuntimeEnvironmentBuilder addAsset(Resource asset, ResourceType type);

    public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value);

    public RuntimeEnvironmentBuilder addConfiguration(String name, String value);

    public RuntimeEnvironmentBuilder knowledgeBase(KieBase kbase);

    public RuntimeEnvironmentBuilder userGroupCallback(UserGroupCallback callback);

    public RuntimeEnvironmentBuilder userInfo(UserInfo userInfo);

    public RuntimeEnvironmentBuilder registerableItemsFactory(RegisterableItemsFactory factory);

    public RuntimeEnvironment get();

    public RuntimeEnvironmentBuilder classLoader(ClassLoader cl);

    public RuntimeEnvironmentBuilder schedulerService(Object globalScheduler);

    public static class Factory implements RuntimeEnvironmentBuilderFactory {
        private static RuntimeEnvironmentBuilderFactory INSTANCE;
        private static Logger logger = LoggerFactory.getLogger(Factory.class);

        static {
            try {
                INSTANCE = ( RuntimeEnvironmentBuilderFactory )
                        Class.forName(System.getProperty("org.jbpm.runtime.env.builder.class",
                                "org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder")).newInstance();
            } catch (Exception e) {
                logger.error("Unable to instance RuntimeEnvironmentBuilderFactory due to " + e.getMessage());
            }
        }

        /**
         * Returns a reference to the RuntimeEnvironmentBuilderFactory singleton
         */
        public static RuntimeEnvironmentBuilderFactory get() {
            if (INSTANCE == null) {
                throw new RuntimeException("RuntimeEnvironmentBuilder was not initialized, see previous errors");
            }
            return INSTANCE;
        }

{'fraction_non_alphanumeric': 0.06876496749914471, 'fraction_numerical': 0.004618542593226137, 'mean_word_length': 3.6148382004735597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4444832', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1303, 'n_words': 423}