001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.metamodel.services;
021
022import java.util.List;
023
024import org.apache.isis.applib.DomainObjectContainer;
025import org.apache.isis.core.commons.components.ApplicationScopedComponent;
026import org.apache.isis.core.commons.components.Injectable;
027import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
028
029/**
030 * The repository of services, also able to inject into any object.
031 * 
032 * <p>
033 * The {@link #getContainer() domain object container} is always injected but is
034 * not a {@link #getRegisteredServices() registered service}.
035 * 
036 * <p>
037 * Can be considered a mutable SPI to the {@link ServicesInjector} immutable API.
038 */
039public interface ServicesInjectorSpi extends ApplicationScopedComponent, Injectable, ServicesInjector {
040
041    // ///////////////////////////////////////////////////////////////////////////
042    // Container
043    // ///////////////////////////////////////////////////////////////////////////
044
045    DomainObjectContainer getContainer();
046
047    /**
048     * Container to inject.
049     * 
050     * <p>
051     * This itself is injected.
052     */
053    public void setContainer(final DomainObjectContainer container);
054
055    // ///////////////////////////////////////////////////////////////////////////
056    // Services
057    // ///////////////////////////////////////////////////////////////////////////
058
059    /**
060     * Services to be injected.
061     * 
062     * <p>
063     * Should automatically inject all services into each other (though calling
064     * {@link #open()} will also do this).
065     * 
066     * @param services
067     */
068    void setServices(List<Object> services);
069
070
071
072}