jaulib v1.3.0
Jau Support Library (C++, Java, ..)
DynamicLibraryBundleInfo.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2020 Gothel Software e.K.
4 * Copyright (c) 2010 Gothel Software e.K.
5 * Copyright (c) 2010 JogAmp Community.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27package org.jau.sys.dl;
28
29import java.util.List;
30
31import org.jau.util.parallel.RunnableExecutor;
32
33public interface DynamicLibraryBundleInfo {
34 public static final boolean DEBUG = DynamicLibraryBundle.DEBUG;
35
36 /**
37 * Returns {@code true} if tool libraries shall be searched in the system path <i>(default)</i>, otherwise {@code false}.
38 * @since 0.3.0
39 */
40 public boolean searchToolLibInSystemPath();
41
42 /**
43 * Returns {@code true} if system path shall be searched <i>first</i> <i>(default)</i>, rather than searching it last.
44 * <p>
45 * If {@link #searchToolLibInSystemPath()} is {@code false} the return value is ignored.
46 * </p>
47 * @since 0.3.0
48 */
50
51 /**
52 * If a {@link SecurityManager} is installed, user needs link permissions
53 * for the named libraries.
54 *
55 * @return a list of Tool library names or alternative library name lists.<br>
56 * <ul>
57 * <li>GL/GLU example Unix: [ [ "libGL.so.1", "libGL.so", "GL" ], [ "libGLU.so", "GLU" ] ] </li>
58 * <li>GL/GLU example Windows: [ "OpenGL32", "GLU32" ] </li>
59 * <li>Cg/CgGL example: [ [ "libCg.so", "Cg" ], [ "libCgGL.so", "CgGL" ] ] </li>
60 * </pre>
61 */
62 public List<List<String>> getToolLibNames();
63
64 /**
65 * If a {@link SecurityManager} is installed, user needs link permissions
66 * for the named libraries.
67 *
68 * @return a list of Glue library names.<br>
69 * <ul>
70 * <li>GL: [ "nativewindow_x11", "jogl_gl2es12", "jogl_desktop" ] </li>
71 * <li>NEWT: [ "nativewindow_x11", "newt" ] </li>
72 * <li>Cg: [ "nativewindow_x11", "jogl_cg" ] </li>
73 * </ul><br>
74 * Only the last entry is crucial, ie all other are optional preload dependencies and may generate errors,
75 * which are ignored.
76 */
77 public List<String> getGlueLibNames();
78
79 /**
80 * May return the native libraries <pre>GetProcAddressFunc</pre> names, the first found function is being used.<br>
81 * This could be eg: <pre> glXGetProcAddressARB, glXGetProcAddressARB </pre>.<br>
82 * If your Tool does not has this facility, just return null.
83 * @see #toolGetProcAddress(long, String)
84 */
85 public List<String> getToolGetProcAddressFuncNameList() ;
86
87 /**
88 * May implement the lookup function using the Tools facility.<br>
89 * The actual function pointer is provided to allow proper bootstrapping of the ProcAddressTable,
90 * using one of the provided function names by {@link #getToolGetProcAddressFuncNameList()}.<br>
91 */
92 public long toolGetProcAddress(long toolGetProcAddressHandle, String funcName);
93
94 /**
95 * @param funcName
96 * @return true if {@link #toolGetProcAddress(long, String)} shall be tried before
97 * the system loader for the given function lookup. Otherwise false.
98 * Default is <b>true</b>.
99 */
100 public boolean useToolGetProcAdressFirst(String funcName);
101
102 /** @return true if the native library symbols shall be made available for symbol resolution of subsequently loaded libraries. */
103 public boolean shallLinkGlobal();
104
105 /**
106 * If method returns <code>true</code> <i>and</i> if a {@link SecurityManager} is installed, user needs link permissions
107 * for <b>all</b> libraries, i.e. for <code>new RuntimePermission("loadLibrary.*");</code>!
108 *
109 * @return true if the dynamic symbol lookup shall happen system wide, over all loaded libraries.
110 * Otherwise only the loaded native libraries are used for lookup, which shall be the default.
111 */
112 public boolean shallLookupGlobal();
113
114 /**
115 * Returns a suitable {@link RunnableExecutor} implementation, which is being used
116 * to load the <code>tool</code> and <code>glue</code> native libraries.
117 * <p>
118 * This allows the generic {@link DynamicLibraryBundle} implementation to
119 * load the native libraries on a designated thread.
120 * </p>
121 * <p>
122 * An implementation may return {@link DynamicLibraryBundle#getDefaultRunnableExecutor()}.
123 * </p>
124 */
126}
127
128
List< String > getToolGetProcAddressFuncNameList()
May return the native libraries.
boolean searchToolLibSystemPathFirst()
Returns true if system path shall be searched first (default), rather than searching it last.
boolean useToolGetProcAdressFirst(String funcName)
RunnableExecutor getLibLoaderExecutor()
Returns a suitable RunnableExecutor implementation, which is being used to load the tool and glue nat...
List< String > getGlueLibNames()
If a SecurityManager is installed, user needs link permissions for the named libraries.
boolean searchToolLibInSystemPath()
Returns true if tool libraries shall be searched in the system path (default), otherwise false.
List< List< String > > getToolLibNames()
If a SecurityManager is installed, user needs link permissions for the named libraries.
boolean shallLookupGlobal()
If method returns true and if a SecurityManager is installed, user needs link permissions for all lib...
long toolGetProcAddress(long toolGetProcAddressHandle, String funcName)
May implement the lookup function using the Tools facility.