<commit_before>/**
 *  Copyright 2012 <NAME> <<EMAIL>>
 *
 *  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.
 *
 */
package com.atomgraph.core.util.jena;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.util.LocationMapper;
import java.net.URI;
import com.atomgraph.core.MediaTypes;
import com.atomgraph.core.client.LinkedDataClient;
import java.net.URISyntaxException;
import java.util.Map;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import org.apache.jena.ext.com.google.common.collect.ImmutableMap;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ModelReader;
import org.apache.jena.util.FileManagerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Utility class for retrieval of RDF models from remote URLs.
*
* @author <NAME> {@literal <<EMAIL>>}
* @see org.apache.jena.util.FileManager
* @see org.apache.jena.rdf.model.ModelGetter
* @see com.atomgraph.core.client.LinkedDataClient
*/

public class DataManagerImpl extends FileManagerImpl implements DataManager
{

    private static final Logger log = LoggerFactory.getLogger(DataManagerImpl.class);

    private final boolean preemptiveAuth;
    private final Client client;
    private final MediaTypes mediaTypes;
    private boolean cacheModelLoads;
    private final Map<String, Model> modelCache;

    /**
     * Creates data manager.
     * 
     * @param mapper location mapper
     * @param modelCache
     * @param client HTTP client
     * @param mediaTypes supported readable and writable media types
     * @param cacheModelLoads if true, cache models after loading, using locations as keys
     * @param preemptiveAuth if true, preemptive HTTP authentication will be used
     */
    public DataManagerImpl(LocationMapper mapper, Map<String, Model> modelCache,
            Client client, MediaTypes mediaTypes,
            boolean cacheModelLoads, boolean preemptiveAuth)
    {
        super(mapper);
        if (client == null) throw new IllegalArgumentException("Model cache Map must be not null");
        if (modelCache == null) throw new IllegalArgumentException("Client must be not null");<commit_msg>Fixed error messages<commit_after>/**
 *  Copyright 2012 <NAME> <<EMAIL>>
 *
 *  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.
 *
 */
package com.atomgraph.core.util.jena;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.util.LocationMapper;
import java.net.URI;
import com.atomgraph.core.MediaTypes;
import com.atomgraph.core.client.LinkedDataClient;
import java.net.URISyntaxException;
import java.util.Map;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import org.apache.jena.ext.com.google.common.collect.ImmutableMap;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ModelReader;
import org.apache.jena.util.FileManagerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Utility class for retrieval of RDF models from remote URLs.
*
* @author <NAME> {@literal <<EMAIL>>}
* @see org.apache.jena.util.FileManager
* @see org.apache.jena.rdf.model.ModelGetter
* @see com.atomgraph.core.client.LinkedDataClient
*/

public class DataManagerImpl extends FileManagerImpl implements DataManager
{

    private static final Logger log = LoggerFactory.getLogger(DataManagerImpl.class);

    private final boolean preemptiveAuth;
    private final Client client;
    private final MediaTypes mediaTypes;
    private boolean cacheModelLoads;
    private final Map<String, Model> modelCache;

    /**
     * Creates data manager.
     * 
     * @param mapper location mapper
     * @param modelCache
     * @param client HTTP client
     * @param mediaTypes supported readable and writable media types
     * @param cacheModelLoads if true, cache models after loading, using locations as keys
     * @param preemptiveAuth if true, preemptive HTTP authentication will be used
     */
    public DataManagerImpl(LocationMapper mapper, Map<String, Model> modelCache,
            Client client, MediaTypes mediaTypes,
            boolean cacheModelLoads, boolean preemptiveAuth)
    {
        super(mapper);
        if (client == null) throw new IllegalArgumentException("Client must be not null");
        if (modelCache == null) throw new IllegalArgumentException("Model cache Map must be not null");
{'fraction_non_alphanumeric': 0.08855410619143854, 'fraction_numerical': 0.0036744442403086534, 'mean_word_length': 3.9356300997280145, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '1563966', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1514, 'n_words': 501}