diff options
author | Thomas Watson | 2005-07-06 21:07:23 +0000 |
---|---|---|
committer | Thomas Watson | 2005-07-06 21:07:23 +0000 |
commit | 8f380a7b978fe479eb8494720179a86df37c8c41 (patch) | |
tree | 4496ece6df389fd23abd8b5ec16853fcabf26f59 /bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java | |
parent | 9c3147917a8c2aee0da281f6f3a6fec2a6a6b96c (diff) | |
download | rt.equinox.framework-8f380a7b978fe479eb8494720179a86df37c8c41.tar.gz rt.equinox.framework-8f380a7b978fe479eb8494720179a86df37c8c41.tar.xz rt.equinox.framework-8f380a7b978fe479eb8494720179a86df37c8c41.zip |
resolver implementation restructure.
improved 'uses' algorithm for transitive closure.
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java')
-rw-r--r-- | bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java new file mode 100644 index 000000000..6edb7ca9f --- /dev/null +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2005 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.module; + +import org.eclipse.osgi.service.resolver.BundleDescription; +import org.eclipse.osgi.service.resolver.VersionConstraint; + +/* + * A companion to VersionConstraint from the state used while resolving + */ +public abstract class ResolverConstraint { + ResolverBundle bundle; + VersionConstraint constraint; + + ResolverConstraint(ResolverBundle bundle, VersionConstraint constraint) { + this.bundle = bundle; + this.constraint = constraint; + } + + // returns the Resolver bundle requiring the ResolverConstraint + ResolverBundle getBundle() { + return bundle; + } + + // returns the BundleDescription requiring the ResolverConstraint + BundleDescription getBundleDescription() { + return bundle.getBundle(); + } + + // returns whether this constraint is from an attached fragment + boolean isFromFragment() { + return constraint.getBundle().getHost() != null; + } + + // Same as VersionConstraint but does additinal permission checks + boolean isSatisfiedBy(VersionSupplier vs) { + if (!bundle.getResolver().getPermissionChecker().checkPermission(constraint, vs.getBaseDescription())) + return false; + return constraint.isSatisfiedBy(vs.getBaseDescription()); + } + + // returns the companion VersionConstraint object from the State + VersionConstraint getVersionConstraint() { + return constraint; + } + + // returns the name of this constraint + public String getName() { + return constraint.getName(); + } + + public String toString() { + return constraint.toString(); + } + + // returns whether this constraint is optional + abstract boolean isOptional(); +} |