001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id$
013 */
014
015package org.nuxeo.runtime.model;
016
017import org.nuxeo.runtime.service.TimestampedService;
018
019/**
020 * A Nuxeo Runtime component.
021 * <p>
022 * Components are extensible and adaptable objects and they provide methods to respond to component life cycle events.
023 *
024 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
025 */
026public interface Component extends Extensible, TimestampedService {
027
028    /**
029     * Activates the component.
030     * <p>
031     * This method is called by the runtime when a component is activated.
032     *
033     * @param context the runtime context
034     */
035    void activate(ComponentContext context);
036
037    /**
038     * Deactivates the component.
039     * <p>
040     * This method is called by the runtime when a component is deactivated.
041     *
042     * @param context the runtime context
043     */
044    void deactivate(ComponentContext context);
045
046    /**
047     * The component notification order for {@link #applicationStarted}.
048     * <p>
049     * Components are notified in increasing order. Order 1000 is the default order for components that don't care.
050     * Order 100 is the repository initialization.
051     *
052     * @return the order, 1000 by default
053     * @since 5.6
054     */
055    int getApplicationStartedOrder();
056
057    /**
058     * Notify the component that Nuxeo Framework finished starting all Nuxeo bundles.
059     */
060    void applicationStarted(ComponentContext context);
061
062}