本文整理汇总了Java中javax.management.OperationsException类的典型用法代码示例。如果您正苦于以下问题:Java OperationsException类的具体用法?Java OperationsException怎么用?Java OperationsException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OperationsException类属于javax.management包,在下文中一共展示了OperationsException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeOperationInternal
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Invokes an operation on an MBean.
* @param onameStr The name of the MBean.
* @param operation The name of the operation to invoke.
* @param parameters An array of Strings containing the parameters to the
* operation. They will be converted to the appropriate
* types to call the reuested operation.
* @return The value returned by the requested operation.
*/
private Object invokeOperationInternal(String onameStr,
String operation,
String[] parameters)
throws OperationsException, MBeanException, ReflectionException {
ObjectName oname=new ObjectName( onameStr );
MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
MBeanParameterInfo[] signature = methodInfo.getSignature();
String[] signatureTypes = new String[signature.length];
Object[] values = new Object[signature.length];
for (int i = 0; i < signature.length; i++) {
MBeanParameterInfo pi = signature[i];
signatureTypes[i] = pi.getType();
values[i] = registry.convertValue(pi.getType(), parameters[i] );
}
return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
示例2: invokeOperationInternal
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Invokes an operation on an MBean.
*
* @param onameStr
* The name of the MBean.
* @param operation
* The name of the operation to invoke.
* @param parameters
* An array of Strings containing the parameters to the
* operation. They will be converted to the appropriate types to
* call the requested operation.
* @return The value returned by the requested operation.
*/
private Object invokeOperationInternal(String onameStr, String operation, String[] parameters)
throws OperationsException, MBeanException, ReflectionException {
ObjectName oname = new ObjectName(onameStr);
MBeanOperationInfo methodInfo = registry.getMethodInfo(oname, operation);
MBeanParameterInfo[] signature = methodInfo.getSignature();
String[] signatureTypes = new String[signature.length];
Object[] values = new Object[signature.length];
for (int i = 0; i < signature.length; i++) {
MBeanParameterInfo pi = signature[i];
signatureTypes[i] = pi.getType();
values[i] = registry.convertValue(pi.getType(), parameters[i]);
}
return mBeanServer.invoke(oname, operation, values, signatureTypes);
}
示例3: setConnection
import javax.management.OperationsException; //导入依赖的package包/类
void setConnection(ActiveMQConnection connection) throws OperationsException, JMSException {
this.session = (ActiveMQSession)connection.createSession(getUseTransaction(), Session.AUTO_ACKNOWLEDGE);
if(destinationType == KahaDestination.DestinationType.TOPIC) {
Topic topic = session.createTopic(java.lang.String.valueOf(destinationName));
if(hasSubscription()) {
consumer = (ActiveMQMessageConsumer)session.createDurableSubscriber(topic, subscription.getSubscriptionName(), subscription.getMessageSelector(), subscription.getNoLocal());
showSubscribeAdded();
}
else {
consumer = (ActiveMQMessageConsumer)session.createConsumer(topic);
}
}
else {
Queue queue = session.createQueue(destinationName);
consumer = (ActiveMQMessageConsumer)session.createConsumer(queue);
}
}
示例4: showJournalDestinationStatistics
import javax.management.OperationsException; //导入依赖的package包/类
private void showJournalDestinationStatistics(JournalStatistic journalStatistic) throws OperationsException {
showSeparator();
System.out.printf("Destination statistics:\r\n");
System.out.printf("- Topics: %s.\r\n", journalStatistic.getTopicCount());
System.out.printf("- Queues: %s.\r\n", journalStatistic.getQueueCount());
showCommandStatistics(journalStatistic.getTopicsDestinationStatistics());
showCommandStatistics(journalStatistic.getQueueDestinationStatistics());
DestinationStatistic[] otherDestinationStatistics = journalStatistic.getOtherDestinationStatistics();
if(otherDestinationStatistics.length != 0) {
System.out.println();
System.out.printf("Commands without destination:\r\n");
showCommandStatistics(otherDestinationStatistics);
}
}
示例5: verifyGetMemberDetails
import javax.management.OperationsException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void verifyGetMemberDetails(ObjectName wrapper, String memberId,
boolean verifyGatewayDetails) throws AdminException, OperationsException,
MBeanException, ReflectionException,
IOException {
logWriter.fine("Entered MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
Map memberDetailsJMX = getMemberDetailsJMX(wrapper, memberId);
Map memberDetailsDirect = getMemberDetailsDirect(memberId);
verifyMemberDetails(memberDetailsJMX, memberDetailsDirect);
if (verifyGatewayDetails) {
verifyGatewayDetails(memberDetailsJMX, memberDetailsDirect);
} else {
verifyClientsDetails(memberDetailsJMX, memberDetailsDirect);
verifyRegionsDetails(memberDetailsJMX, memberDetailsDirect);
}
logWriter.fine("Exited MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
}
示例6: deserialize
import javax.management.OperationsException; //导入依赖的package包/类
@Override
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data) throws OperationsException {
Throwable error = null;
MBeanServerPlugin delegate = null;
final boolean readOnly = true;
try {
delegate = findDelegate(name);
//Special authorization
authorizeClassloadingOperation(delegate, name, DESERIALIZE);
return delegate.deserialize(name, data);
} catch (Exception e) {
error = e;
if (e instanceof OperationsException) throw (OperationsException)e;
throw makeRuntimeException(e);
} finally {
if (shouldAuditLog(delegate, readOnly)) {
new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(name, data);
}
}
}
示例7: deserialize
import javax.management.OperationsException; //导入依赖的package包/类
@Deprecated
@Override
public ObjectInputStream deserialize(String className,
ObjectName loaderName, byte[] data)
throws InstanceNotFoundException, OperationsException,
ReflectionException {
return mbs.deserialize(className, loaderName, data);
}
示例8: setAttributeInternal
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Sets an MBean attribute's value.
*/
private void setAttributeInternal(String onameStr,
String attributeName,
String value)
throws OperationsException, MBeanException, ReflectionException {
ObjectName oname=new ObjectName( onameStr );
String type=registry.getType(oname, attributeName);
Object valueObj=registry.convertValue(type, value );
mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}
示例9: deserialize
import javax.management.OperationsException; //导入依赖的package包/类
/**
* De-serializes a byte array in the context of a given MBean class loader.
* The class loader is the one that loaded the class with name "className".
*
* @param className The name of the class whose class loader should be
* used for the de-serialization.
* @param data The byte array to be de-sererialized.
*
* @return The de-serialized object stream.
*
* @exception OperationsException Any of the usual Input/Output
* related exceptions.
* @exception ReflectionException The specified class could not be
* loaded by the default loader repository
*
*/
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
throws OperationsException, ReflectionException {
if (className == null) {
throw new RuntimeOperationsException(
new IllegalArgumentException(),
"Null className passed in parameter");
}
/* Permission check */
// This call requires MBeanPermission 'getClassLoaderRepository'
final ClassLoaderRepository clr = getClassLoaderRepository();
Class<?> theClass;
try {
if (clr == null) throw new ClassNotFoundException(className);
theClass = clr.loadClass(className);
} catch (ClassNotFoundException e) {
throw new ReflectionException(e,
"The given class could not be " +
"loaded by the default loader " +
"repository");
}
return instantiator.deserialize(theClass.getClassLoader(), data);
}
示例10: deserialize
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Call <code>checkRead()</code>, then forward this method to the
* wrapped object.
*/
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data)
throws InstanceNotFoundException, OperationsException {
checkRead();
return getMBeanServer().deserialize(name, data);
}
示例11: setAttributeInternal
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Sets an MBean attribute's value.
*/
private void setAttributeInternal(String onameStr, String attributeName, String value)
throws OperationsException, MBeanException, ReflectionException {
ObjectName oname = new ObjectName(onameStr);
String type = registry.getType(oname, attributeName);
Object valueObj = registry.convertValue(type, value);
mBeanServer.setAttribute(oname, new Attribute(attributeName, valueObj));
}
示例12: deserialize
import javax.management.OperationsException; //导入依赖的package包/类
/**
* De-serializes a byte array in the context of a classloader.
*
* @param loader the classloader to use for de-serialization
* @param data The byte array to be de-sererialized.
*
* @return The de-serialized object stream.
*
* @exception OperationsException Any of the usual Input/Output related
* exceptions.
*/
public ObjectInputStream deserialize(ClassLoader loader, byte[] data)
throws OperationsException {
// Check parameter validity
if (data == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException(), "Null data passed in parameter");
}
if (data.length == 0) {
throw new RuntimeOperationsException(new
IllegalArgumentException(), "Empty data passed in parameter");
}
// Object deserialization
ByteArrayInputStream bIn;
ObjectInputStream objIn;
bIn = new ByteArrayInputStream(data);
try {
objIn = new ObjectInputStreamWithLoader(bIn,loader);
} catch (IOException e) {
throw new OperationsException(
"An IOException occurred trying to de-serialize the data");
}
return objIn;
}
示例13: showJournalStatistic
import javax.management.OperationsException; //导入依赖的package包/类
private void showJournalStatistic(JournalStatistic journalStatistic, int fileIndex) throws OperationsException {
System.out.printf("(%s) Journal: '%s'.\r\n", fileIndex, journalStatistic.getFile());
if(journalStatistic.hasStatistic()) {
showJournalDestinationStatistics(journalStatistic);
showJournalCommandStatistics(journalStatistic);
}
showSeparator(2);
}
示例14: showCommandStatistics
import javax.management.OperationsException; //导入依赖的package包/类
private void showCommandStatistics(DestinationStatistic[] destinationStatistics) throws OperationsException {
for (DestinationStatistic destinationStatistic : destinationStatistics) {
CommandStatistic[] commandStatistics = destinationStatistic.getCommandStatistics();
if(destinationStatistic.hasDestinationId()) {
System.out.println();
String destinationRemovedStr = destinationStatistic.hasRemoved() ? "- " : "";
String destinationInfo = getDestinationInfo(destinationStatistic.getDestinationType(), destinationStatistic.getDestinationId());
System.out.printf("%s%s.\r\n", destinationRemovedStr, destinationInfo);
}
showCommandStatistics(commandStatistics);
}
}
示例15: MemberInfoWithStatsMBean
import javax.management.OperationsException; //导入依赖的package包/类
/**
* Default Constructor
*
* @param agent Admin Agent instance
* @throws OperationsException if ObjectName can't be formed for this MBean
* @throws MBeanRegistrationException
* @throws AdminException
*/
MemberInfoWithStatsMBean(Agent agent) throws OperationsException, MBeanRegistrationException, AdminException {
this.agent = agent;
this.logWriter = this.agent.getLogWriter().convertToLogWriterI18n();
this.objectName = ObjectName.getInstance(MBEAN_NAME);
this.version = GemFireVersion.getGemFireVersion();
this.refreshInterval = -1;
this.id = NOT_AVAILABLE_STR;
this.forwarder = new NotificationForwarder(agent.getMBeanServer(), this.logWriter);
}