Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4437438a27442edf8ed93cb7940c4537caa1e5f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2012, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.osgi.container;

import java.net.URL;
import java.util.Collection;
import java.util.List;
import org.eclipse.osgi.container.Module.StartOptions;

/**
 * A module loader is what connects a {@link ModuleWiring} to a real classloader.
 * @since 3.10
 */
public abstract class ModuleLoader {
	/**
	 * Returns entries in wiring this module loader
	 * is associated with.
	 * @param path The path name in which to look.
	 * @param filePattern The file name pattern for selecting entries in the
	 *        specified path
	 * @param options The options for listing resource names.
	 * @return An unmodifiable list of URL objects for each matching entry, or
	 *         an empty list if no matching entry could be found
	 * @see ModuleWiring#findEntries(String, String, int)
	 */
	protected abstract List<URL> findEntries(String path, String filePattern, int options);

	/**
	 * 
	 * @param path
	 * @param filePattern
	 * @param options
	 * @return TODO
	 * @see ModuleWiring#listResources(String, String, int)
	 */
	protected abstract Collection<String> listResources(String path, String filePattern, int options);

	/**
	 * Returns the class loader for this module loader.  A <code>null</code>
	 * value will be returned if this module loader is for a fragment.
	 * @return The class loader for this module loader.
	 * @see ModuleWiring#getClassLoader()
	 */
	protected abstract ClassLoader getClassLoader();

	/**
	 * Is called by {@link Module#start(Module.StartOptions...)} when
	 * using the {@link StartOptions#LAZY_TRIGGER} option is used.
	 * @return false if the trigger was not previously set; otherwise
	 * true is returned
	 */
	protected abstract boolean getAndSetTrigger();

	/**
	 * Returns true if the lazy trigger is set for this module loader
	 * @return true if the lazy trigger is set for this module loader
	 */
	public abstract boolean isTriggerSet();

	/**
	 * Dynamically loads fragment revisions to this already resolved
	 * module loader.
	 * @param fragments the fragments to load
	 */
	protected abstract void loadFragments(Collection<ModuleRevision> fragments);
}

Back to the top