<commit_before>/*
*    jETeL/Clover - Java based ETL application framework.
*    Copyright (C) 2002-04  <NAME> <<EMAIL>>
*    
*    This library is free software; you can redistribute it and/or
*    modify it under the terms of the GNU Lesser General Public
*    License as published by the Free Software Foundation; either
*    version 2.1 of the License, or (at your option) any later version.
*    
*    This library is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    
*    Lesser General Public License for more details.
*    
*    You should have received a copy of the GNU Lesser General Public
*    License along with this library; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*/
// FILE: c:/projects/jetel/org/jetel/graph/TransformationGraph.java

package org.jetel.graph;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetel.data.lookup.LookupTable;
import org.jetel.data.sequence.Sequence;
import org.jetel.database.IConnection;
import org.jetel.enums.EdgeTypeEnum;
import org.jetel.exception.ComponentNotReadyException;
import org.jetel.exception.ConfigurationStatus;
import org.jetel.exception.GraphConfigurationException;
import org.jetel.graph.dictionary.Dictionary;
import org.jetel.graph.dictionary.DictionaryValue;
import org.jetel.graph.runtime.CloverPost;
import org.jetel.graph.runtime.WatchDog;
import org.jetel.metadata.DataRecordMetadata;
import org.jetel.util.crypto.Enigma;
import org.jetel.util.file.FileUtils;
import org.jetel.util.primitive.TypedProperties;
import org.jetel.util.property.PropertyRefResolver;
import org.jetel.util.string.StringUtils;
/*
 *  import org.apache.log4j.Logger;
 *  import org.apache.log4j.BasicConfigurator;
 */
/**
 * A class that represents Transformation Graph - all the Nodes and connecting Edges
 *
 * @author      D.Pavlis
 * @since       April 2, 2002
 * @revision    $Revision$
 * @see         org.jetel.graph.runtime.WatchDog
 */

public final class TransformationGraph extends GraphElement {

	public static final String DEFAULT_GRAPH_ID = "DEFAULT_GRAPH_ID";
	
	public static final String PROJECT_DIR_PROPERTY = "PROJECT_DIR";

	private Map <Integer,Phase> phases;

    private Map <String,IConnection> connections;

	private Map <String, Sequence> sequences;

	private Map <String, LookupTable> lookupTables;
	
	private Map <String, DataRecordMetadata> dataRecordMetadata;

	private Dictionary dictionary;
	
	private String password = null;
	
	private Enigma enigma = null;
	
    private boolean debugMode = true;
    
    private String debugModeStr;
    
    private String debugDirectory;
    
    private int debugMaxRecords = 0;
    
	static Log logger = LogFactory.getLog(TransformationGraph.class);

	private WatchDog watchDog;

	private TypedProperties graphProperties;

	public TransformationGraph() {
		this(DEFAULT_GRAPH_ID);
	}

	/**
	 *Constructor for the TransformationGraph object
	 *
	 * @param  _name  Name of the graph
	 * @since         April 2, 2002
	 */
	public TransformationGraph(String id) {
		super(id);
		
		phases = new HashMap<Integer,Phase>();
		connections = new HashMap <String,IConnection> ();
		sequences = new HashMap<String,Sequence> ();
		lookupTables = new HashMap<String,LookupTable> ();
		dataRecordMetadata = new HashMap<String,DataRecordMetadata> ();
		// initialize logger - just basic
		//BasicConfigurator.configure();
		graphProperties = new TypedProperties();
		dictionary = new Dictionary(this);
	}

	private static boolean firstCallProjectURL = true; //have to be reset
	private static URL projectURL = null;
    public URL getProjectURL() {
        if(firstCallProjectURL) {
            firstCallProjectURL = false;
            String projectURLStr = null;
            if(getGraphProperties().containsKey(PROJECT_DIR_PROPERTY)) {
                projectURLStr = getGraphProperties().getStringProperty(PROJECT_DIR_PROPERTY);
            } else {
            	//maybe any other default project directory
            }
            
            if(projectURLStr != null) {
                try {
                    projectURL = FileUtils.getFileURL(projectURLStr);
                } catch (MalformedURLException e) {
                    getLogger().warn("Home project dir is not in valid URL format - " + projectURLStr);
                }
            }
        }

        return projectURL;
    }

    public void setPassword(String password) {
    	this.password = password;<commit_msg>FIX: TransformationGraph.projectURL variable is not already static.<commit_after>/*
*    jETeL/Clover - Java based ETL application framework.
*    Copyright (C) 2002-04  <NAME> <<EMAIL>>
*    
*    This library is free software; you can redistribute it and/or
*    modify it under the terms of the GNU Lesser General Public
*    License as published by the Free Software Foundation; either
*    version 2.1 of the License, or (at your option) any later version.
*    
*    This library is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    
*    Lesser General Public License for more details.
*    
*    You should have received a copy of the GNU Lesser General Public
*    License along with this library; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*/
// FILE: c:/projects/jetel/org/jetel/graph/TransformationGraph.java

package org.jetel.graph;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetel.data.lookup.LookupTable;
import org.jetel.data.sequence.Sequence;
import org.jetel.database.IConnection;
import org.jetel.enums.EdgeTypeEnum;
import org.jetel.exception.ComponentNotReadyException;
import org.jetel.exception.ConfigurationStatus;
import org.jetel.exception.GraphConfigurationException;
import org.jetel.graph.dictionary.Dictionary;
import org.jetel.graph.dictionary.IDictionaryValue;
import org.jetel.graph.runtime.CloverPost;
import org.jetel.graph.runtime.WatchDog;
import org.jetel.metadata.DataRecordMetadata;
import org.jetel.util.crypto.Enigma;
import org.jetel.util.file.FileUtils;
import org.jetel.util.primitive.TypedProperties;
import org.jetel.util.property.PropertyRefResolver;
import org.jetel.util.string.StringUtils;
/*
 *  import org.apache.log4j.Logger;
 *  import org.apache.log4j.BasicConfigurator;
 */
/**
 * A class that represents Transformation Graph - all the Nodes and connecting Edges
 *
 * @author      D.Pavlis
 * @since       April 2, 2002
 * @revision    $Revision$
 * @see         org.jetel.graph.runtime.WatchDog
 */

public final class TransformationGraph extends GraphElement {

	public static final String DEFAULT_GRAPH_ID = "DEFAULT_GRAPH_ID";
	
	public static final String PROJECT_DIR_PROPERTY = "PROJECT_DIR";

	private Map <Integer,Phase> phases;

    private Map <String,IConnection> connections;

	private Map <String, Sequence> sequences;

	private Map <String, LookupTable> lookupTables;
	
	private Map <String, DataRecordMetadata> dataRecordMetadata;

	private Dictionary dictionary;
	
	private String password = <PASSWORD>;
	
	private Enigma enigma = null;
	
    private boolean debugMode = true;
    
    private String debugModeStr;
    
    private String debugDirectory;
    
    private int debugMaxRecords = 0;
    
	static Log logger = LogFactory.getLog(TransformationGraph.class);

	private WatchDog watchDog;

	private TypedProperties graphProperties;

	private URL projectURL = null;

	public TransformationGraph() {
		this(DEFAULT_GRAPH_ID);
	}

	/**
	 *Constructor for the TransformationGraph object
	 *
	 * @param  _name  Name of the graph
	 * @since         April 2, 2002
	 */
	public TransformationGraph(String id) {
		super(id);
		
		phases = new HashMap<Integer,Phase>();
		connections = new HashMap <String,IConnection> ();
		sequences = new HashMap<String,Sequence> ();
		lookupTables = new HashMap<String,LookupTable> ();
		dataRecordMetadata = new HashMap<String,DataRecordMetadata> ();
		// initialize logger - just basic
		//BasicConfigurator.configure();
		graphProperties = new TypedProperties();
		dictionary = new Dictionary(this);
	}

	private boolean firstCallProjectURL = true; //have to be reset
    public URL getProjectURL() {
        if(firstCallProjectURL) {
            firstCallProjectURL = false;
            String projectURLStr = null;
            if(getGraphProperties().containsKey(PROJECT_DIR_PROPERTY)) {
                projectURLStr = getGraphProperties().getStringProperty(PROJECT_DIR_PROPERTY);
            } else {
            	//maybe any other default project directory
            }
            
            if(projectURLStr != null) {
                try {
                    projectURL = FileUtils.getFileURL(projectURLStr);
                } catch (MalformedURLException e) {
                    getLogger().warn("Home project dir is not in valid URL format - " + projectURLStr);
                }
            }
        }

        return projectURL;
    }

    public void setPassword(String password) {
    	this.password = password;
{'fraction_non_alphanumeric': 0.08689234402676639, 'fraction_numerical': 0.0068884077937413895, 'mean_word_length': 3.469217238346526, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '255787', 'n_tokens_mistral': 2953, 'n_tokens_neox': 2784, 'n_words': 819}