
org.eclipse.osgi.internal.loader.buddy.PolicyHandler Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2005, 2016 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.internal.loader.buddy;
import java.net.URL;
import java.util.*;
import org.eclipse.osgi.container.ModuleContainerAdaptor.ContainerEvent;
import org.eclipse.osgi.internal.framework.EquinoxBundle;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.osgi.framework.*;
import org.osgi.service.packageadmin.PackageAdmin;
public class PolicyHandler implements SynchronousBundleListener {
//Key for the framework buddies
private final static String DEPENDENT_POLICY = "dependent"; //$NON-NLS-1$
private final static String GLOBAL_POLICY = "global"; //$NON-NLS-1$
private final static String REGISTERED_POLICY = "registered"; //$NON-NLS-1$
private final static String APP_POLICY = "app"; //$NON-NLS-1$
private final static String EXT_POLICY = "ext"; //$NON-NLS-1$
private final static String BOOT_POLICY = "boot"; //$NON-NLS-1$
private final static String PARENT_POLICY = "parent"; //$NON-NLS-1$
//The loader to which this policy is attached.
private final BundleLoader policedLoader;
private final List originalBuddyList;
//List of the policies as well as cache for the one that have been created. The size of this array never changes over time. This is why the synchronization is not done when iterating over it.
private volatile Object[] policies = null;
//Support to cut class / resource loading cycles in the context of one thread. The contained object is a set of classname
private final ThreadLocal> beingLoaded;
private final PackageAdmin packageAdmin;
public PolicyHandler(BundleLoader loader, List buddyList, PackageAdmin packageAdmin) {
policedLoader = loader;
this.originalBuddyList = buddyList;
policies = buddyList.toArray();
beingLoaded = new ThreadLocal<>();
this.packageAdmin = packageAdmin;
}
static Object[] getArrayFromList(String stringList) {
if (stringList == null || stringList.trim().equals("")) //$NON-NLS-1$
return null;
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy