本文整理了Java中javax.management.Query.eq
方法的一些代码示例,展示了Query.eq
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.eq
方法的具体详情如下:
包路径:javax.management.Query
类名称:Query
方法名:eq
暂无
代码示例来源:origin: apache/geode
if (values[i] instanceof Boolean) {
if (queryExp == null) {
queryExp = Query.eq(Query.attr(attributes[i]), Query.value((Boolean) values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]), Query.value((Boolean) values[i])));
queryExp = Query.eq(Query.attr(attributes[i]), Query.value((Number) values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]), Query.value((Number) values[i])));
queryExp = Query.eq(Query.attr(attributes[i]), Query.value((String) values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]), Query.value((String) values[i])));
代码示例来源:origin: apache/geode
/**
* Builds the QueryExp used to identify the target MBean.
*
* @param pidAttribute the name of the MBean attribute with the process id to compare against
* @param attributes the names of additional MBean attributes to compare with expected values
* @param values the expected values of the specified MBean attributes
*
* @return the main QueryExp for matching the target MBean
*/
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes,
final Object[] values) {
QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values);
QueryExp constraint;
if (optionalAttributes != null) {
constraint =
Query.and(optionalAttributes, Query.eq(Query.attr(pidAttribute), Query.value(pid)));
} else {
constraint = Query.eq(Query.attr(pidAttribute), Query.value(pid));
}
return constraint;
}
代码示例来源: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 testCreateQueryParameterSource() throws MalformedObjectNameException {
final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
final QueryExp expectedQueryExpression = Query.eq(Query.attr("id"), Query.value("12345"));
final QueryParameterSource query =
new QueryParameterSource(expectedObjectName, expectedQueryExpression);
assertNotNull(query);
assertSame(expectedObjectName, query.getObjectName());
assertSame(expectedQueryExpression, query.getQueryExpression());
}
代码示例来源: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.alfresco/alfresco-core
QueryExp query = Query.or(Query.eq(Query.attr("clientAuth"), Query.value("want")),
Query.eq(Query.attr("clientAuth"), Query.value(true)));
logger.warn("Attempting to set clientAuth=want through JMX...");
query = Query.eq(Query.attr("secure"), Query.value(true));
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
protected static String getMemberId(final String jmxManagerHost, final int jmxManagerPort, final String memberName)
throws Exception
{
JMXConnector connector = null;
try {
connector = JMXConnectorFactory.connect(new JMXServiceURL(String.format(
"service:jmx:rmi://%1$s/jndi/rmi://%1$s:%2$d/jmxrmi", jmxManagerHost, jmxManagerPort)));
final MBeanServerConnection connection = connector.getMBeanServerConnection();
final ObjectName objectNamePattern = ObjectName.getInstance("GemFire:type=Member,*");
final QueryExp query = Query.eq(Query.attr("Name"), Query.value(memberName));
final Set<ObjectName> objectNames = connection.queryNames(objectNamePattern, query);
assertNotNull(objectNames);
assertEquals(1, objectNames.size());
//final ObjectName objectName = ObjectName.getInstance("GemFire:type=Member,Name=" + memberName);
final ObjectName objectName = objectNames.iterator().next();
//System.err.printf("ObjectName for Member with Name (%1$s) is %2$s%n", memberName, objectName);
return ObjectUtils.toString(connection.getAttribute(objectName, "Id"));
}
finally {
IOUtils.close(connector);
}
}
代码示例来源:origin: org.apache.geode/gemfire-core
/**
* Builds the QueryExp used to identify the target MBean.
*
* @param pidAttribute the name of the MBean attribute with the process id to compare against
* @param attributes the names of additional MBean attributes to compare with expected values
* @param values the expected values of the specified MBean attributes
*
* @return the main QueryExp for matching the target MBean
*/
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes, final Object[] values) {
final QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values);
QueryExp constraint;
if (optionalAttributes != null) {
constraint = Query.and(optionalAttributes, Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid)));
} else {
constraint = Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid));
}
return constraint;
}
代码示例来源:origin: org.apache.geode/gemfire-core
/**
* Builds the QueryExp used to identify the target MBean.
*
* @param pidAttribute the name of the MBean attribute with the process id to compare against
* @param attributes the names of additional MBean attributes to compare with expected values
* @param values the expected values of the specified MBean attributes
*
* @return the main QueryExp for matching the target MBean
*/
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes, final Object[] values) {
final QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values);
QueryExp constraint;
if (optionalAttributes != null) {
constraint = Query.and(optionalAttributes, Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid)));
} else {
constraint = Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid));
}
return constraint;
}
代码示例来源:origin: io.snappydata/gemfire-core
/**
* Builds the QueryExp used to identify the target MBean.
*
* @param pidAttribute the name of the MBean attribute with the process id to compare against
* @param attributes the names of additional MBean attributes to compare with expected values
* @param values the expected values of the specified MBean attributes
*
* @return the main QueryExp for matching the target MBean
*/
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes, final Object[] values) {
final QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values);
QueryExp constraint;
if (optionalAttributes != null) {
constraint = Query.and(optionalAttributes, Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid)));
} else {
constraint = Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid));
}
return constraint;
}
代码示例来源:origin: io.snappydata/gemfire-core
/**
* Builds the QueryExp used to identify the target MBean.
*
* @param pidAttribute the name of the MBean attribute with the process id to compare against
* @param attributes the names of additional MBean attributes to compare with expected values
* @param values the expected values of the specified MBean attributes
*
* @return the main QueryExp for matching the target MBean
*/
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes, final Object[] values) {
final QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values);
QueryExp constraint;
if (optionalAttributes != null) {
constraint = Query.and(optionalAttributes, Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid)));
} else {
constraint = Query.eq(
Query.attr(pidAttribute),
Query.value(this.pid));
}
return constraint;
}
代码示例来源:origin: io.snappydata/gemfire-core
if (values[i] instanceof Boolean) {
if (queryExp == null) {
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value(((Boolean) values[i])));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value(((Boolean) values[i]))));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((Number)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((Number)values[i])));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((String)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((String)values[i])));
代码示例来源:origin: org.apache.geode/gemfire-core
if (values[i] instanceof Boolean) {
if (queryExp == null) {
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value(((Boolean) values[i])));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value(((Boolean) values[i]))));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((Number)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((Number)values[i])));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((String)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((String)values[i])));
代码示例来源:origin: org.apache.geode/gemfire-core
if (values[i] instanceof Boolean) {
if (queryExp == null) {
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value(((Boolean) values[i])));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value(((Boolean) values[i]))));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((Number)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((Number)values[i])));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((String)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((String)values[i])));
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
final QueryExp constraint = Query.eq(Query.attr("Name"), Query.value(getUniqueName()));
代码示例来源:origin: io.snappydata/gemfire-core
if (values[i] instanceof Boolean) {
if (queryExp == null) {
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value(((Boolean) values[i])));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value(((Boolean) values[i]))));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((Number)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((Number)values[i])));
queryExp = Query.eq(
Query.attr(attributes[i]),
Query.value((String)values[i]));
} else {
queryExp = Query.and(queryExp,
Query.eq(Query.attr(attributes[i]),
Query.value((String)values[i])));
代码示例来源:origin: io.snappydata/gemfire-junit
QueryExp constraint = Query.eq(
Query.attr("Pid"),
Query.value(pid));
constraint = Query.eq(
Query.attr("Pid"),
Query.value(pid+1));
Query.eq(Query.attr("Process"),Query.value(true)),
Query.eq(Query.attr("Pid"),Query.value(pid)));
mbeanNames = server.queryNames(objectName, constraint);
assertFalse("Zero matching mbeans", mbeanNames.isEmpty());
Query.eq(Query.attr("Process"),Query.value(false)),
Query.eq(Query.attr("Pid"),Query.value(pid)));
mbeanNames = server.queryNames(objectName, constraint);
assertTrue("Found matching mbeans", mbeanNames.isEmpty());
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
final QueryExp constraint = Query.eq(Query.attr("ProcessId"),Query.value(ProcessUtils.identifyPid()));
代码示例来源: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;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!