diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevBundleFileWrapperFactoryHook.java')
-rwxr-xr-x | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevBundleFileWrapperFactoryHook.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevBundleFileWrapperFactoryHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevBundleFileWrapperFactoryHook.java new file mode 100755 index 000000000..3b83561bf --- /dev/null +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevBundleFileWrapperFactoryHook.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013 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.hooks; + +import org.eclipse.osgi.internal.framework.EquinoxConfiguration; +import org.eclipse.osgi.internal.hookregistry.BundleFileWrapperFactoryHook; +import org.eclipse.osgi.storage.BundleInfo.Generation; +import org.eclipse.osgi.storage.bundlefile.BundleFile; +import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; + +/* + * Returns DevBundleFileWrapper objects for base bundle files that are + * directories when in development mode. Ideally, this hook should not be + * registered if not in development mode. + */ +public class DevBundleFileWrapperFactoryHook implements BundleFileWrapperFactoryHook { + private EquinoxConfiguration configuration; + + public DevBundleFileWrapperFactoryHook(EquinoxConfiguration configuration) { + if (configuration == null) + throw new NullPointerException(); + this.configuration = configuration; + } + + @Override + public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { + if (base && configuration.inDevelopmentMode() && bundleFile.getBaseFile().isDirectory()) + return new DevBundleFileWrapper(bundleFile, generation, configuration); + return null; + } +} |