<commit_before>/*
* File   : $Source: /alkacon/cvs/opencms/src/com/opencms/file/Attic/CmsRegistry.java,v $
* Date   : $Date: 2001/10/02 12:21:43 $
* Version: $Revision: 1.37 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (C) 2001  The OpenCms Group
*
* 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.
*
* For further information about OpenCms, please see the
* OpenCms Website: http://www.opencms.org
*
* 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
*/

package com.opencms.file;

import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.text.*;
import java.security.*;
import java.lang.reflect.*;
import org.w3c.dom.*;
import com.opencms.template.*;
import com.opencms.core.*;

/**
 * This class implements the registry for OpenCms.
 *
 * @author <NAME>
 * @version $Revision: 1.37 $ $Date: 2001/10/02 12:21:43 $
 *
 */
public class CmsRegistry extends A_CmsXmlContent implements I_CmsRegistry {

    /**
     *  The xml-document representing the registry.
     */
    private Document m_xmlReg;

    /**
     *  The filename for the registry.
     */
    private String m_regFileName;

    /**
     *  A hashtable with shortcuts into the dom-structure for each module.
     */
    private Hashtable m_modules = new Hashtable();

    /**
     *  The cms-object to get access to the system with the context of the current user.
     */
    private CmsObject m_cms = null;

    /**
     *  The date-format to use.
     */
    private SimpleDateFormat m_dateFormat = new java.text.SimpleDateFormat("MM.dd.yyyy");

    /**
     *  A message digest to check the resource-codes
     */
    private MessageDigest m_digest;

    /**
     *  Declaration of Module event-method names.
     */
    private static final String C_UPLOAD_EVENT_METHOD_NAME = "moduleWasUploaded";
    private static final String C_UPDATE_PARAMETER_EVENT_METHOD_NAME = "moduleParameterWasUpdated";
    private static final String C_DELETE_EVENT_METHOD_NAME = "moduleWasDeleted";

    /**
     * Declaration of an empty module in the registry.
     */
    private static final String[] C_EMPTY_MODULE = { "<module><name>", "</name><nicename>", "</nicename><version>", "</version><description>", "</description><author>", "</author><email/><creationdate>", "</creationdate><view/><documentation/><dependencies/><maintenance_class/><parameters/><repository/></module>" };

/**
 * Creates a new CmsRegistry for a user. The cms-object represents the current state of the current user.
 *
 * @param CmsObject the cms-object to get access to the system
 */
public CmsRegistry(CmsRegistry reg, CmsObject cms) {
    super();
    // there is no need of a real copy for this parameters
    m_modules = reg.m_modules;
    m_regFileName = reg.m_regFileName;
    m_xmlReg = reg.m_xmlReg;
    // store the cms-object for this instance.
    m_cms = cms;
    try {
        m_digest = MessageDigest.getInstance(CmsImport.C_IMPORT_DIGEST);
    } catch (NoSuchAlgorithmException e) {
        m_digest = null;
    }
}
/**
 * Creates a new CmsRegistry. The regFileName is the path to the registry-file in
 * the server filesystem.
 *
 *  @param String regFileName the path to the registry-file in the server fs.
 */
public CmsRegistry(String regFileName) throws CmsException {
    super();
    try {
        // store the filename
        m_regFileName = regFileName;

        // get the file
        File xmlFile = new File(m_regFileName);

        // get a buffered reader
        BufferedReader reader = new BufferedReader(new FileReader(xmlFile));

        StringBuffer content = new StringBuffer();
        String buffer = "";
        System.out.println("IR lod file to buffer");
        do {
            content.append(buffer);
            buffer = reader.readLine();
        } while (buffer != null);

        reader.close();
        System.out.println("IR parse content");

        // parse the registry-xmlfile and store it.
        m_xmlReg = parse(content.toString());
        System.out.println("IR init");
        init();
        System.out.println("IR done");
    } catch (Exception exc) {<commit_msg>Removed debug-code.<commit_after>/*
* File   : $Source: /alkacon/cvs/opencms/src/com/opencms/file/Attic/CmsRegistry.java,v $
* Date   : $Date: 2001/10/02 12:24:45 $
* Version: $Revision: 1.38 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (C) 2001  The OpenCms Group
*
* 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.
*
* For further information about OpenCms, please see the
* OpenCms Website: http://www.opencms.org
*
* 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
*/

package com.opencms.file;

import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.text.*;
import java.security.*;
import java.lang.reflect.*;
import org.w3c.dom.*;
import com.opencms.template.*;
import com.opencms.core.*;

/**
 * This class implements the registry for OpenCms.
 *
 * @author <NAME>
 * @version $Revision: 1.38 $ $Date: 2001/10/02 12:24:45 $
 *
 */
public class CmsRegistry extends A_CmsXmlContent implements I_CmsRegistry {

    /**
     *  The xml-document representing the registry.
     */
    private Document m_xmlReg;

    /**
     *  The filename for the registry.
     */
    private String m_regFileName;

    /**
     *  A hashtable with shortcuts into the dom-structure for each module.
     */
    private Hashtable m_modules = new Hashtable();

    /**
     *  The cms-object to get access to the system with the context of the current user.
     */
    private CmsObject m_cms = null;

    /**
     *  The date-format to use.
     */
    private SimpleDateFormat m_dateFormat = new java.text.SimpleDateFormat("MM.dd.yyyy");

    /**
     *  A message digest to check the resource-codes
     */
    private MessageDigest m_digest;

    /**
     *  Declaration of Module event-method names.
     */
    private static final String C_UPLOAD_EVENT_METHOD_NAME = "moduleWasUploaded";
    private static final String C_UPDATE_PARAMETER_EVENT_METHOD_NAME = "moduleParameterWasUpdated";
    private static final String C_DELETE_EVENT_METHOD_NAME = "moduleWasDeleted";

    /**
     * Declaration of an empty module in the registry.
     */
    private static final String[] C_EMPTY_MODULE = { "<module><name>", "</name><nicename>", "</nicename><version>", "</version><description>", "</description><author>", "</author><email/><creationdate>", "</creationdate><view/><documentation/><dependencies/><maintenance_class/><parameters/><repository/></module>" };

/**
 * Creates a new CmsRegistry for a user. The cms-object represents the current state of the current user.
 *
 * @param CmsObject the cms-object to get access to the system
 */
public CmsRegistry(CmsRegistry reg, CmsObject cms) {
    super();
    // there is no need of a real copy for this parameters
    m_modules = reg.m_modules;
    m_regFileName = reg.m_regFileName;
    m_xmlReg = reg.m_xmlReg;
    // store the cms-object for this instance.
    m_cms = cms;
    try {
        m_digest = MessageDigest.getInstance(CmsImport.C_IMPORT_DIGEST);
    } catch (NoSuchAlgorithmException e) {
        m_digest = null;
    }
}
/**
 * Creates a new CmsRegistry. The regFileName is the path to the registry-file in
 * the server filesystem.
 *
 *  @param String regFileName the path to the registry-file in the server fs.
 */
public CmsRegistry(String regFileName) throws CmsException {
    super();
    try {
        // store the filename
        m_regFileName = regFileName;

        // get the file
        File xmlFile = new File(m_regFileName);

        // get a buffered reader
        BufferedReader reader = new BufferedReader(new FileReader(xmlFile));

        StringBuffer content = new StringBuffer();
        String buffer = "";
        do {
            content.append(buffer);
            buffer = reader.readLine();
        } while (buffer != null);

        reader.close();

        // parse the registry-xmlfile and store it.
        m_xmlReg = parse(content.toString());
        init();
    } catch (Exception exc) {
{'fraction_non_alphanumeric': 0.10476700589180503, 'fraction_numerical': 0.011783610069630423, 'mean_word_length': 3.055603822762815, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 16}, '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': '6185887', 'n_tokens_mistral': 2771, 'n_tokens_neox': 2654, 'n_words': 929}