org.osgi.framework.Filter.matches()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.osgi.framework.Filter.matches()方法的一些代码示例,展示了Filter.matches()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.matches()方法的具体详情如下:
包路径:org.osgi.framework.Filter
类名称:Filter
方法名:matches

Filter.matches介绍

[英]Filter using a Map. This Filter is executed using the specified Map's keys and values. The keys are looked up in a normal manner respecting case.
[中]

代码示例

代码示例来源:origin: org.osgi/org.osgi.core

/**
 * Internal implies method. Used by the implies and the permission
 * collection implies methods.
 * 
 * @param requested The requested AdaptPermission which has already be
 *        validated as a proper argument. The requested AdaptPermission must
 *        not have a filter expression.
 * @param effective The effective actions with which to start.
 * @return {@code true} if the specified permission is implied by this
 *         object; {@code false} otherwise.
 */
boolean implies0(AdaptPermission requested, int effective) {
  /* check actions first - much faster */
  effective |= action_mask;
  final int desired = requested.action_mask;
  if ((effective & desired) != desired) {
    return false;
  }
  /* Get filter */
  Filter f = filter;
  if (f == null) {
    // it's "*"
    return true;
  }
  return f.matches(requested.getProperties());
}

代码示例来源:origin: org.osgi/org.osgi.compendium

/**
 * Internal implies method. Used by the implies and the permission
 * collection implies methods.
 * 
 * @param requested The requested CoordinationPermission which has already
 *        be validated as a proper argument. The requested
 *        CoordinationPermission must not have a filter expression.
 * @param effective The effective actions with which to start.
 * @return {@code true} if the specified permission is implied by this
 *         object; {@code false} otherwise.
 */
boolean implies0(CoordinationPermission requested, int effective) {
  /* check actions first - much faster */
  effective |= action_mask;
  final int desired = requested.action_mask;
  if ((effective & desired) != desired) {
    return false;
  }
  /* Get filter */
  Filter f = filter;
  if (f == null) {
    // it's "*"
    return true;
  }
  return f.matches(requested.getProperties());
}

代码示例来源:origin: org.osgi/org.osgi.core

return f.matches(requestedProperties);

代码示例来源:origin: org.osgi/org.osgi.compendium

return f.matches(requestedProperties);

代码示例来源:origin: org.osgi/org.osgi.core

/**
 * Internal implies method. Used by the implies and the permission
 * collection implies methods.
 * 
 * @param requested The requested CapabilityPermission which has already be
 *        validated as a proper argument. The requested CapabilityPermission
 *        must not have a filter expression.
 * @param effective The effective actions with which to start.
 * @return {@code true} if the specified permission is implied by this
 *         object; {@code false} otherwise.
 */
boolean implies0(CapabilityPermission requested, int effective) {
  /* check actions first - much faster */
  effective |= action_mask;
  final int desired = requested.action_mask;
  if ((effective & desired) != desired) {
    return false;
  }
  /* Get filter if any */
  Filter f = filter;
  if (f == null) {
    return super.implies(requested);
  }
  return f.matches(requested.getProperties());
}

代码示例来源:origin: org.osgi/org.osgi.core

/**
 * Internal implies method. Used by the implies and the permission
 * collection implies methods.
 * 
 * @param requested The requested PackagePermission which has already be
 *        validated as a proper argument. The requested PackagePermission
 *        must not have a filter expression.
 * @param effective The effective actions with which to start.
 * @return {@code true} if the specified permission is implied by this
 *         object; {@code false} otherwise.
 */
boolean implies0(PackagePermission requested, int effective) {
  /* check actions first - much faster */
  effective |= action_mask;
  final int desired = requested.action_mask;
  if ((effective & desired) != desired) {
    return false;
  }
  /* Get filter if any */
  Filter f = filter;
  if (f == null) {
    return super.implies(requested);
  }
  return f.matches(requested.getProperties());
}

代码示例来源:origin: org.osgi/org.osgi.core

return f.matches(requested.getProperties());

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

@Override
public boolean matches(Filter filter) {
  if (filter == null) {
    return true;
  }
  return filter.matches(properties);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-aries-resolver

public boolean matches(Map map)
{
 return delgate.matches(map);
}

代码示例来源:origin: org.everit.osgi/org.everit.osgi.capabilitycollector

@Override
protected boolean matches(final BundleCapability capability, final Filter filter) {
 Map<String, Object> attributes = capability.getAttributes();
 return filter.matches(attributes);
}

代码示例来源:origin: org.osgi/org.amdatu.remote.admin.http

/**
 * Return the first matching filter for the specified Endpoint Description.
 * 
 * @param endpoint The Endpoint Description
 * @return The first matching Filter, or {@code null}
 */
private final Filter getFirstMatchingFilter(EndpointDescription endpoint) {
  for (Filter filter : m_filters) {
    if (filter.matches(endpoint.getProperties())) {
      return filter;
    }
  }
  return null;
}

代码示例来源:origin: org.osgi/org.amdatu.remote.discovery.bonjour

/**
 * Return the first matching filter for the specified Endpoint Description.
 * 
 * @param endpoint The Endpoint Description
 * @return The first matching Filter, or {@code null}
 */
private final Filter getFirstMatchingFilter(EndpointDescription endpoint) {
  for (Filter filter : m_filters) {
    if (filter.matches(endpoint.getProperties())) {
      return filter;
    }
  }
  return null;
}

代码示例来源:origin: org.knopflerfish/framework

@Override
public boolean matches(BundleCapability capability) {
 if (nameSpace.equals(capability.getNamespace())) {
  return null==filter ? true : filter.matches(capability.getAttributes());
 }
 return false;
}

代码示例来源:origin: org.ow2.chameleon.fuchsia/org.ow2.chameleon.fuchsia.core

/**
 * Calculate the matching of the Declaration modified with the DeclarationFilter of the.
 * Linker.
 *
 * @param declarationSRef the ServiceReference<Declaration> of the Declaration
 */
public void modified(ServiceReference<D> declarationSRef) {
  D declaration = getDeclaration(declarationSRef);
  boolean matchFilter = declarationFilter.matches(declaration.getMetadata());
  declarations.put(declarationSRef, matchFilter);
}

代码示例来源:origin: org.ow2.chameleon.fuchsia/org.ow2.chameleon.fuchsia.core

/**
 * Add the declarationSRef to the DeclarationsManager.
 * Calculate the matching of the Declaration with the DeclarationFilter of the
 * Linker.
 *
 * @param declarationSRef the ServiceReference<D> of the Declaration
 */
public void add(ServiceReference<D> declarationSRef) {
  D declaration = getDeclaration(declarationSRef);
  boolean matchFilter = declarationFilter.matches(declaration.getMetadata());
  declarations.put(declarationSRef, matchFilter);
}

代码示例来源:origin: org.ow2.chameleon.fuchsia/org.ow2.chameleon.fuchsia.core

/**
 * Return true if the Declaration can be linked to the ImporterService.
 *
 * @param declaration          The Declaration
 * @param declarationBinderRef The ServiceReference<ImporterService> of the ImporterService
 * @return true if the Declaration can be linked to the ImporterService
 */
public boolean canBeLinked(D declaration, ServiceReference<S> declarationBinderRef) {
  // Evaluate the target filter of the ImporterService on the Declaration
  Filter filter = bindersManager.getTargetFilter(declarationBinderRef);
  return filter.matches(declaration.getMetadata());
}

代码示例来源:origin: org.knopflerfish/framework

@Override
public boolean matches(BundleCapability capability)
{
 if (BundleRevision.BUNDLE_NAMESPACE.equals(capability.getNamespace())) {
  return toFilter().matches(capability.getAttributes());
 }
 return false;
}

代码示例来源:origin: org.knopflerfish/framework

@Override
public boolean matches(BundleCapability capability) {
 if (BundleRevision.HOST_NAMESPACE.equals(capability.getNamespace())) {
  return toFilter().matches(capability.getAttributes());
 }
 return false;
}

代码示例来源:origin: org.knopflerfish/framework

@Override
public boolean matches(BundleCapability capability) {
 if (BundleRevision.PACKAGE_NAMESPACE.equals(capability.getNamespace())) {
  return toFilter().matches(capability.getAttributes());
 }
 return false;
}

代码示例来源:origin: apache/karaf

private void handleEvent(Event event) {
  try {
    EventImpl ev = new EventImpl(event);
    if (filter == null || filter.matches(ev.getFilterMap())) {
      queue.put(new EventImpl(event));
      startRunner();
    }
  } catch (InterruptedException e) {
    logger.debug("Interrupted while putting event in queue", e);
  }
}

相关文章

微信公众号

最新文章

更多