001/*
002 * Copyright 2012-2016 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.loader.tools;
018
019/**
020 * Strategy interface used to determine the layout for a particular type of archive.
021 * Layouts may additionally implement {@link CustomLoaderLayout} if they wish to write
022 * custom loader classes.
023 *
024 * @author Phillip Webb
025 * @see Layouts
026 * @see RepackagingLayout
027 * @see CustomLoaderLayout
028 */
029public interface Layout {
030
031        /**
032         * Returns the launcher class name for this layout.
033         * @return the launcher class name
034         */
035        String getLauncherClassName();
036
037        /**
038         * Returns the destination path for a given library.
039         * @param libraryName the name of the library (excluding any path)
040         * @param scope the scope of the library
041         * @return the destination relative to the root of the archive (should end with '/')
042         * or {@code null} if the library should not be included.
043         */
044        String getLibraryDestination(String libraryName, LibraryScope scope);
045
046        /**
047         * Returns the location of classes within the archive.
048         * @return the classes location
049         */
050        String getClassesLocation();
051
052        /**
053         * Returns if loader classes should be included to make the archive executable.
054         * @return if the layout is executable
055         */
056        boolean isExecutable();
057
058}