blob: 41cb46c5012b345b31d887925c5d6cef7371ee1f [file] [log] [blame]
/*
* Copyright 2008 Niclas Hedhman. All rights Reserved.
* Copyright 2012, Paul Merlin.
*
* 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.zest.bootstrap;
import org.apache.zest.api.activation.Activator;
import org.apache.zest.api.common.Visibility;
import org.apache.zest.api.service.ServiceImporter;
import org.apache.zest.api.service.importer.InstanceImporter;
import org.apache.zest.api.service.importer.NewObjectImporter;
import org.apache.zest.api.service.importer.ServiceInstanceImporter;
import org.apache.zest.api.service.importer.ServiceSelectorImporter;
/**
* Fluent API for declaring imported services. Instances
* of this API are acquired by calling {@link ModuleAssembly#importedServices(Class[])}.
*/
public interface ImportedServiceDeclaration
{
// Convenience constants for common service importers
public static final Class<? extends ServiceImporter> INSTANCE = InstanceImporter.class;
public static final Class<? extends ServiceImporter> NEW_OBJECT = NewObjectImporter.class;
public static final Class<? extends ServiceImporter> SERVICE_SELECTOR = ServiceSelectorImporter.class;
public static final Class<? extends ServiceImporter> SERVICE_IMPORTER = ServiceInstanceImporter.class;
ImportedServiceDeclaration visibleIn( Visibility visibility );
ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass );
ImportedServiceDeclaration identifiedBy( String identity );
ImportedServiceDeclaration taggedWith( String... tags );
ImportedServiceDeclaration setMetaInfo( Object serviceAttribute );
ImportedServiceDeclaration importOnStartup();
/**
* Set the imported service activators. Activators are executed in order around
* the ServiceReference activation and passivation.
*
* @param activators the imported service activators
* @return the assembly
*/
@SuppressWarnings( { "unchecked","varargs" } )
ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
}