/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 2008 Bull S.A.S.
 * Copyright (C) 2008 France Telecom R&D
 * Contact: jonas-team@ow2.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or 1any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.ow2.jonas.versioning;

import java.net.URL;

/**
 * Interface for the versioning service, which only contains methods for the
 * versioning service and doesn't inherit from any other interface. This
 * interface will be exposed via JMX.
 *
 * @author Frederic Germaneau
 * @author S. Ali Tokmen
 */
public interface VersioningServiceBase {
    /**
     * @return  Whether versioning is enabled.
     */
    boolean isVersioningEnabled();

    /**
     * @return  The default policy.
     */
    String getDefaultPolicy();

    /**
     * @param defaultPolicy  Default policy to set.
     */
    void setDefaultPolicy(String defaultPolicy);

    /**
     * @return  Names of all deployed versioned applications.
     */
    String[] getContextNames();

    /**
     * @param name Name of the versioned application to get the details for,
     *             see @link{VersioningServiceBase#getContextNames()}.
     * @return  Versioned context's management beans' names, null if name is
     *          not found.
     */
    String[] getContextBeans(String name);

    /**
     * @param url JAR, WAR or EAR file to read the version ID from.
     * @return Version ID of url, null if none found.
     */
    String getVersionID(URL url);

    /**
     * @param url JAR or EAR object to create a JNDI prefix from.
     * @return JNDI prefix for url, null if none found.
     */
    String getPrefix(URL url);

    /**
     * @param url JAR, WAR or EAR object to get the base name for. The base name
     *        is used when creating the JNDI naming prefix.
     * @return Base name for URL, null if none found.
     */
    String getBaseName(URL url);
}
