<commit_before>/*
 *  eXist Open Source Native XML Database
 *  Copyright (C) 2001-04 The eXist Team
 *
 *  http://exist-db.org
 *  
 *  This program 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
 *  of the License, or (at your option) any later version.
 *  
 *  This program 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 program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *  $Id$
 */
package org.exist.xquery.functions.system;

import org.exist.xquery.AbstractInternalModule;
import org.exist.xquery.FunctionDef;

public class SystemModule extends AbstractInternalModule {

	public static final String NAMESPACE_URI = "http://exist-db.org/xquery/system";
	
	public static final String PREFIX = "system";

    public static final FunctionDef[] functions = {
            new FunctionDef(FtIndexLookup.signature, FtIndexLookup.class),

            new FunctionDef(CountInstances.countInstancesMax, CountInstances.class),
            new FunctionDef(CountInstances.countInstancesActive, CountInstances.class),
            new FunctionDef(CountInstances.countInstancesAvailable, CountInstances.class),
            new FunctionDef(GetMemory.getMemoryMax, GetMemory.class),
            new FunctionDef(GetMemory.getMemoryTotal, GetMemory.class),
            new FunctionDef(GetMemory.getMemoryFree, GetMemory.class),
            new FunctionDef(GetVersion.signature, GetVersion.class),
            new FunctionDef(GetBuild.signature, GetBuild.class),
            new FunctionDef(GetRevision.signature, GetRevision.class),
            new FunctionDef(GetExistHome.signature, GetExistHome.class),
            new FunctionDef(Shutdown.signatures[0], Shutdown.class),
            new FunctionDef(Shutdown.signatures[1], Shutdown.class),
            new FunctionDef(GetModuleLoadPath.signature, GetModuleLoadPath.class),
            new FunctionDef(TriggerSystemTask.signature, TriggerSystemTask.class)
    };
	
	public SystemModule() {
		super(functions);
	}

	public String getNamespaceURI() {
		return NAMESPACE_URI;
	}

	public String getDefaultPrefix() {
		return PREFIX;
	}

	public String getDescription() {
		return "Functions to retrieve information about eXist and the system.";
	}
}
<commit_msg>Added a function system:as-user to execute a limited block of code as a different user. This approach offers better security than the force-user pragma which was proposed as a patch.<commit_after>/*
 *  eXist Open Source Native XML Database
 *  Copyright (C) 2001-04 The eXist Team
 *
 *  http://exist-db.org
 *  
 *  This program 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
 *  of the License, or (at your option) any later version.
 *  
 *  This program 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 program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *  $Id$
 */
package org.exist.xquery.functions.system;

import org.exist.xquery.AbstractInternalModule;
import org.exist.xquery.FunctionDef;

public class SystemModule extends AbstractInternalModule {

	public static final String NAMESPACE_URI = "http://exist-db.org/xquery/system";
	
	public static final String PREFIX = "system";

    public static final FunctionDef[] functions = {
            new FunctionDef(FtIndexLookup.signature, FtIndexLookup.class),

            new FunctionDef(CountInstances.countInstancesMax, CountInstances.class),
            new FunctionDef(CountInstances.countInstancesActive, CountInstances.class),
            new FunctionDef(CountInstances.countInstancesAvailable, CountInstances.class),
            new FunctionDef(GetMemory.getMemoryMax, GetMemory.class),
            new FunctionDef(GetMemory.getMemoryTotal, GetMemory.class),
            new FunctionDef(GetMemory.getMemoryFree, GetMemory.class),
            new FunctionDef(GetVersion.signature, GetVersion.class),
            new FunctionDef(GetBuild.signature, GetBuild.class),
            new FunctionDef(GetRevision.signature, GetRevision.class),
            new FunctionDef(GetExistHome.signature, GetExistHome.class),
            new FunctionDef(Shutdown.signatures[0], Shutdown.class),
            new FunctionDef(Shutdown.signatures[1], Shutdown.class),
            new FunctionDef(GetModuleLoadPath.signature, GetModuleLoadPath.class),
            new FunctionDef(TriggerSystemTask.signature, TriggerSystemTask.class),
            new FunctionDef(AsUser.signature, AsUser.class)
    };
	
	public SystemModule() {
		super(functions);
	}

	public String getNamespaceURI() {
		return NAMESPACE_URI;
	}

	public String getDefaultPrefix() {
		return PREFIX;
	}

	public String getDescription() {
		return "Functions to retrieve information about eXist and the system.";
	}
}

{'fraction_non_alphanumeric': 0.07707369170523318, 'fraction_numerical': 0.006051975792096832, 'mean_word_length': 3.586938775510204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1885844', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1471, 'n_words': 488}