<commit_before>/*
 *   Copyright 2005 The Apache Software Foundation
 *
 *   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 org.apache.felix.framework;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;

import org.osgi.framework.*;

class BundleImpl implements Bundle
{
    private Felix m_felix = null;
    private BundleInfo m_info = null;

    protected BundleImpl(Felix felix, BundleInfo info)
    {
        m_felix = felix;
        m_info = info;
    }

    Felix getFelix() // package protected
    {
        return m_felix;
    }

    BundleInfo getInfo() // package protected
    {
        return m_info;
    }

    void setInfo(BundleInfo info) // package protected
    {
        m_info = info;
    }

    public long getBundleId()
    {
        return m_info.getBundleId();
    }

    public URL getEntry(String name)
    {
        return m_felix.getBundleEntry(this, name);
    }

    public Enumeration getEntryPaths(String path)
    {
        return m_felix.getBundleEntryPaths(this, path);
    }

    public Dictionary getHeaders()
    {
        return m_felix.getBundleHeaders(this);
    }

    public long getLastModified()
    {
        return m_info.getLastModified();
    }

    public String getLocation()<commit_msg>Added a private getContext() method so that it is possible to run Equinox' Declarative Services impl on Felix.<commit_after>/*
 *   Copyright 2005 The Apache Software Foundation
 *
 *   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 org.apache.felix.framework;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;

import org.osgi.framework.*;

class BundleImpl implements Bundle
{
    private Felix m_felix = null;
    private BundleInfo m_info = null;

    protected BundleImpl(Felix felix, BundleInfo info)
    {
        m_felix = felix;
        m_info = info;
    }

    Felix getFelix() // package protected
    {
        return m_felix;
    }

    BundleInfo getInfo() // package protected
    {
        return m_info;
    }

    void setInfo(BundleInfo info) // package protected
    {
        m_info = info;
    }

    /**
     * This method is a hack to make Felix compatible with Equinox'
     * Declarative Services implementation; this should be revisited
     * in the future.
     * @return the bundle context associated with this bundle.
    **/
    private BundleContext getContext()
    {
        BundleContext bc = m_info.getContext();
        if (bc == null)
        {
            m_info.setContext(new BundleContextImpl(m_felix, this));
        }
        return m_info.getContext();
    }

    public long getBundleId()
    {
        return m_info.getBundleId();
    }

    public URL getEntry(String name)
    {
        return m_felix.getBundleEntry(this, name);
    }

    public Enumeration getEntryPaths(String path)
    {
        return m_felix.getBundleEntryPaths(this, path);
    }

    public Dictionary getHeaders()
    {
        return m_felix.getBundleHeaders(this);
    }

    public long getLastModified()
    {
        return m_info.getLastModified();
    }

    public String getLocation()
{'fraction_non_alphanumeric': 0.07969330855018587, 'fraction_numerical': 0.0037174721189591076, 'mean_word_length': 2.63597972972973, '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': '6747470', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1200, 'n_words': 401}