/*
 * 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.screamingcoder.plebeians.bootstrap;

import com.screamingcoder.plebeians.discovery.WebBeanDiscoveryImpl;
import java.util.HashSet;
import org.jboss.webbeans.bootstrap.PropertiesBasedBootstrap;
import org.jboss.webbeans.bootstrap.SimpleResourceLoader;
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.util.DeploymentProperties;

/**
 *
 * @author pete (at screamingcoder.com)
 */
public class WebBeansBootstrap extends PropertiesBasedBootstrap {

    WebBeanDiscovery wbDisc = new WebBeanDiscoveryImpl();
    ResourceLoader resourceLoader = new MockResourceLoader();
    NamingContext naming = new MockNaming();
    EjbResolver ejbResolver = new MockEjbResolver();
    EjbDiscovery ejbDiscovery = new MockEjbDiscovery(new HashSet<Class<?>>());

    // The deployment properties
    private final DeploymentProperties deploymentProperties;

    public WebBeansBootstrap() {
        super();

        // Create a simpple resource loader based for initial loading
        ResourceLoader temporaryResourceLoader = new SimpleResourceLoader();
        this.deploymentProperties = new DeploymentProperties(temporaryResourceLoader);

        initManager(naming, ejbResolver, resourceLoader);
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }

    @Override
    protected WebBeanDiscovery getWebBeanDiscovery() {
        return wbDisc;
    }

    @Override
    protected EjbDiscovery getEjbDiscovery() {
        return ejbDiscovery;
    }

    @Override
    protected DeploymentProperties getDeploymentProperties() {
        return this.deploymentProperties;
    }

}
