javax.management.Query.or()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(78)

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

Query.or介绍

暂无

代码示例

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

public static MemberMXBean getMemberMXBean(final String serviceName, final String member)
  throws IOException {
 assertState(Gfsh.isCurrentInstanceConnectedAndReady(),
   "Gfsh must be connected in order to get proxy to a GemFire Member MBean.");
 MemberMXBean memberBean = null;
 try {
  String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
  objectNamePattern += (org.apache.geode.internal.lang.StringUtils.isBlank(serviceName)
    ? org.apache.geode.internal.lang.StringUtils.EMPTY
    : "service=" + serviceName + org.apache.geode.internal.lang.StringUtils.COMMA_DELIMITER);
  objectNamePattern += "type=Member,*";
  // NOTE throws a MalformedObjectNameException, however, this should not happen since the
  // ObjectName is constructed
  // here in a conforming pattern
  final ObjectName objectName = ObjectName.getInstance(objectNamePattern);
  final QueryExp query = Query.or(Query.eq(Query.attr("Name"), Query.value(member)),
    Query.eq(Query.attr("Id"), Query.value(member)));
  final Set<ObjectName> memberObjectNames =
    Gfsh.getCurrentInstance().getOperationInvoker().queryNames(objectName, query);
  if (!memberObjectNames.isEmpty()) {
   memberBean = Gfsh.getCurrentInstance().getOperationInvoker()
     .getMBeanProxy(memberObjectNames.iterator().next(), MemberMXBean.class);
  }
 } catch (MalformedObjectNameException e) {
  Gfsh.getCurrentInstance().logSevere(e.getMessage(), e);
 }
 return memberBean;
}

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

@Test
public void testSerialization()
  throws ClassNotFoundException, IOException, MalformedObjectNameException {
 final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
 final QueryExp expectedQueryExpression =
   Query.or(Query.eq(Query.attr("name"), Query.value("myName")),
     Query.eq(Query.attr("id"), Query.value("myId")));
 final QueryParameterSource expectedQuery =
   new QueryParameterSource(expectedObjectName, expectedQueryExpression);
 assertNotNull(expectedQuery);
 assertSame(expectedObjectName, expectedQuery.getObjectName());
 assertSame(expectedQueryExpression, expectedQuery.getQueryExpression());
 final byte[] queryBytes = IOUtils.serializeObject(expectedQuery);
 assertNotNull(queryBytes);
 assertTrue(queryBytes.length != 0);
 final Object queryObj = IOUtils.deserializeObject(queryBytes);
 assertTrue(queryObj instanceof QueryParameterSource);
 final QueryParameterSource actualQuery = (QueryParameterSource) queryObj;
 assertNotSame(expectedQuery, actualQuery);
 assertNotNull(actualQuery.getObjectName());
 assertEquals(expectedQuery.getObjectName().toString(), actualQuery.getObjectName().toString());
 assertNotNull(actualQuery.getQueryExpression());
 assertEquals(expectedQuery.getQueryExpression().toString(),
   actualQuery.getQueryExpression().toString());
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

public static final QueryExp matchAllTerracottaMBeans(UUID id, String[] tunneledDomains) {
 try {
  QueryExp query = Query.or(new ObjectName(MBeanDomain.PUBLIC + ":*,node=" + id),
               new ObjectName(MBeanDomain.INTERNAL + ":*,node=" + id));
  if (tunneledDomains != null) {
   for (String tunneledDomain : tunneledDomains) {
    query = Query.or(query, new ObjectName(tunneledDomain + ":*,node=" + id));
   }
  }
  return query;
 } catch (MalformedObjectNameException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

public static final QueryExp matchAllTerracottaMBeans(UUID id, String[] tunneledDomains) {
 try {
  QueryExp query = Query.or(new ObjectName(MBeanDomain.PUBLIC + ":*,node=" + id),
               new ObjectName(MBeanDomain.INTERNAL + ":*,node=" + id));
  if (tunneledDomains != null) {
   for (String tunneledDomain : tunneledDomains) {
    query = Query.or(query, new ObjectName(tunneledDomain + ":*,node=" + id));
   }
  }
  return query;
 } catch (MalformedObjectNameException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1

public static final QueryExp matchAllTerracottaMBeans(UUID id, String[] tunneledDomains) {
 try {
  QueryExp query = Query.or(new ObjectName(MBeanDomain.PUBLIC + ":*,node=" + id),
               new ObjectName(MBeanDomain.INTERNAL + ":*,node=" + id));
  if (tunneledDomains != null) {
   for (String tunneledDomain : tunneledDomains) {
    query = Query.or(query, new ObjectName(tunneledDomain + ":*,node=" + id));
   }
  }
  return query;
 } catch (MalformedObjectNameException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: pl.edu.icm.synat/synat-platform-container

private QueryExp prepareQuery(final String baseIdentifier, final ListableBeanFactory context) {
  String domain;
  domain = getSelfDefinedMBeanDomain(baseIdentifier);
  QueryExp query = null;
  try {
    query = new ObjectName(domain+":*");
  } catch (Exception e) {
    logger.warn("Exception while defining query", e);
  }
  
  Map<String, ServiceManagerLocations> maps = context.getBeansOfType(ServiceManagerLocations.class);
  
  Collection<ServiceManagerLocations> serviceManagerLocations = maps.values();
  for (ServiceManagerLocations managerLocations : serviceManagerLocations) {
    QueryExp singleQuery = managerLocations.getLocalManagersQuery();
    if (query == null) {
      query = singleQuery;
    } else {
      query = Query.or(query, singleQuery);
    }
  }
  
  return query;
}

代码示例来源:origin: locationtech/geowave

final QueryExp subQuery1 = Query.match(Query.attr("protocol"), Query.value("HTTP/1.1"));
final QueryExp subQuery2 = Query.anySubString(Query.attr("protocol"), Query.value("Http11"));
final QueryExp query = Query.or(subQuery1, subQuery2);
final Set<ObjectName> objs = mbs.queryNames(new ObjectName("*:type=Connector,*"), query);

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

QueryExp query = Query.or(Query.eq(Query.attr("clientAuth"), Query.value("want")),
             Query.eq(Query.attr("clientAuth"), Query.value(true)));

代码示例来源:origin: org.apache.geode/gemfire-core

protected MemberMXBean getMemberMXBean(final String serviceName, final String member) throws IOException {
 assertState(isConnectedAndReady(), "Gfsh must be connected in order to get proxy to a GemFire Member MBean.");
 MemberMXBean memberBean = null;
 try {
  String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
  objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY_STRING
   : "service=" + serviceName + StringUtils.COMMA_DELIMITER);
  objectNamePattern += "type=Member,*";
  // NOTE throws a MalformedObjectNameException, however, this should not happen since the ObjectName is constructed
  // here in a conforming pattern
  final ObjectName objectName = ObjectName.getInstance(objectNamePattern);
  final QueryExp query = Query.or(
   Query.eq(Query.attr("Name"), Query.value(member)),
   Query.eq(Query.attr("Id"), Query.value(member))
  );
  final Set<ObjectName> memberObjectNames = getGfsh().getOperationInvoker().queryNames(objectName, query);
  if (!memberObjectNames.isEmpty()) {
   memberBean = getGfsh().getOperationInvoker().getMBeanProxy(memberObjectNames.iterator().next(), MemberMXBean.class);
  }
 }
 catch (MalformedObjectNameException e) {
  getGfsh().logSevere(e.getMessage(), e);
 }
 return memberBean;
}

代码示例来源:origin: io.snappydata/gemfire-core

protected MemberMXBean getMemberMXBean(final String serviceName, final String member) throws IOException {
 assertState(isConnectedAndReady(), "Gfsh must be connected in order to get proxy to a GemFire Member MBean.");
 MemberMXBean memberBean = null;
 try {
  String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
  objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY_STRING
   : "service=" + serviceName + StringUtils.COMMA_DELIMITER);
  objectNamePattern += "type=Member,*";
  // NOTE throws a MalformedObjectNameException, however, this should not happen since the ObjectName is constructed
  // here in a conforming pattern
  final ObjectName objectName = ObjectName.getInstance(objectNamePattern);
  final QueryExp query = Query.or(
   Query.eq(Query.attr("Name"), Query.value(member)),
   Query.eq(Query.attr("Id"), Query.value(member))
  );
  final Set<ObjectName> memberObjectNames = getGfsh().getOperationInvoker().queryNames(objectName, query);
  if (!memberObjectNames.isEmpty()) {
   memberBean = getGfsh().getOperationInvoker().getMBeanProxy(memberObjectNames.iterator().next(), MemberMXBean.class);
  }
 }
 catch (MalformedObjectNameException e) {
  getGfsh().logSevere(e.getMessage(), e);
 }
 return memberBean;
}

相关文章