src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java
author sspitsyn
Fri, 25 May 2018 00:18:47 -0700
changeset 50263 42165815ee40
parent 47216 71c04702a3d5
permissions -rw-r--r--
8203816: add tests failed because of 8203174 to the ProblemList-graal Summary: add tests to the ProblemList-graal.txt Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     1
/*
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     4
 *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    10
 *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    15
 * accompanied this code).
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    16
 *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    20
 *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    23
 * questions.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    24
 */
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    25
package jdk.tools.jlink.plugin;
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    26
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    27
import java.lang.module.ModuleDescriptor;
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    28
import java.util.Optional;
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    29
import java.util.Set;
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    30
import java.util.stream.Stream;
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 39834
diff changeset
    31
import jdk.internal.module.ModuleTarget;
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    32
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    33
/**
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    34
  * Link-time representation of a module.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    35
  */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    36
public interface ResourcePoolModule {
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    37
    /**
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    38
     * The module name.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    39
     *
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    40
     * @return The module name.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    41
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    42
    public String name();
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    43
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    44
    /**
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    45
     * Retrieves a ResourcePoolEntry from the given path (e.g:
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    46
     * /mymodule/com.foo.bar/MyClass.class)
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    47
     *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    48
     * @param path The piece of data path.
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    49
     * @return A ResourcePoolEntry of the given path, if found.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    50
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    51
    public Optional<ResourcePoolEntry> findEntry(String path);
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    52
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    53
    /**
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    54
     * The module descriptor of this module.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    55
     *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    56
     * @return The module descriptor.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    57
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    58
    public ModuleDescriptor descriptor();
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    59
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    60
    /**
45004
ea3137042a61 8178380: Module system implementation refresh (5/2017)
alanb
parents: 44359
diff changeset
    61
     * The target platform
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 39834
diff changeset
    62
     *
45004
ea3137042a61 8178380: Module system implementation refresh (5/2017)
alanb
parents: 44359
diff changeset
    63
     * @return The target platform
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 39834
diff changeset
    64
     */
45004
ea3137042a61 8178380: Module system implementation refresh (5/2017)
alanb
parents: 44359
diff changeset
    65
    public String targetPlatform();
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 39834
diff changeset
    66
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 39834
diff changeset
    67
    /**
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    68
     * Retrieves all the packages located in this module.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    69
     *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    70
     * @return The set of packages.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    71
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    72
    public Set<String> packages();
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    73
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    74
    /**
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    75
     * Retrieves the stream of ResourcePoolEntry.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    76
     *
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    77
     * @return The ResourcePoolEntry stream.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    78
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    79
    public Stream<ResourcePoolEntry> entries();
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    80
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    81
    /**
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    82
     * Return the number of ResourcePoolEntry count in this ResourcePoolModule.
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    83
     *
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    84
     * @return the entry count.
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    85
     */
39834
53a6fb443c20 8162538: plugin API should avoid read only pool, have module view separated from resource view and have pool builder to modify
sundar
parents: 38320
diff changeset
    86
    public int entryCount();
38320
e24c7029e8ba 8156914: jlink API minor cleanups
sundar
parents:
diff changeset
    87
}