protected void initAttributeContexts(MBeanAttributeInfo[] attributes) { // create invocation contexts for attributes for (int i = 0; i < attributes.length; ++i) { InvocationContext ctx = new InvocationContext(); // fill in some default values, the attribute name ctx.setName(attributes[i].getName()); ctx.setAttributeType(attributes[i].getType()); // set myself as the invoker ctx.setInvoker(this); //ctx.add(InvocationContext.ATTRIBUTE_ACCESS, getAccessCode(attributes[i])); // store attributeContextMap.put(attributes[i].getName(), ctx); } if (log.isTraceEnabled()) log.trace(getObjectName() + " configured attribute contexts: " + operationContextMap); }
public void addContext(final InvocationContext ctx) { super.copy(ctx); this.ctx = ctx; }
public Class getAttributeTypeClass() throws ClassNotFoundException { return ctx.getAttributeTypeClass(); }
protected void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name) throws Exception { // FIXME: do not require super calls super.configureInterceptorStack(info, server, name); if (resourceType.equals(STANDARD_MBEAN)) { List interceptors = getMBeanInfoCtx.getInterceptors(); interceptors.add(0, new StandardMBeanInfoInterceptor()); getMBeanInfoCtx.setInterceptors(interceptors); } }
InvocationContext ctx = new InvocationContext(); ctx.setName(opName); ctx.setSignature(signature); ctx.setReturnType(returnType); ctx.setInvoker(this);
getMBeanInfoCtx = new InvocationContext(); getMBeanInfoCtx.setInvoker(this); getMBeanInfoCtx.setDescriptor(mbeanDescriptor); getMBeanInfoCtx.setDispatcher(new AbstractInterceptor("MBeanInfo Dispatcher") InvocationContext ctx = new InvocationContext(); ctx.setInvoker(this); ctx.setDispatcher(new AbstractInterceptor("SetMangedResource Dispatcher")
InvocationContext ctx = (InvocationContext) operationContextMap.get(opKey); Interceptor dispatcher = ctx.getDispatcher(); " to " + Strings.defaultToString(target) + " method= " + m); ctx.setTarget(target); ctx.setDispatcher(dispatcher); ctx.setDispatcher(new AttributeDispatcher(getter, setter, dynamicResource)); ctx.setTarget(resource);
List defaultInterceptors = getInterceptors(getMBeanInfoCtx.getDescriptor()); interceptors = getMBeanInfoCtx.getInterceptors(); getMBeanInfoCtx.setInterceptors(interceptors); List list = getInterceptors(ctx.getDescriptor()); if (list == null) ctx.setInterceptors(list); List list = getInterceptors(ctx.getDescriptor()); if (list == null && defaultInterceptors != null) list = new ArrayList(defaultInterceptors); ctx.setInterceptors(list);
throw new AttributeNotFoundException("not found: " + attribute); if (ctx.isReadable() == false) throw new AttributeNotFoundException("Attribute '" + attribute + "' found, but it is not readable"); ctx.setDescriptor(attrDesc); updateAttributeInfo(attrDesc);
else if (ctx.isWritable() == false) ctx.setDescriptor(attrDesc); updateAttributeInfo(attrDesc);
public Class[] getSignatureClasses() throws ClassNotFoundException { return ctx.getSignatureClasses(); } }
public Class getReturnTypeClass() throws ClassNotFoundException { return ctx.getReturnTypeClass(); }
protected void setValuesFromMBeanInfo() throws JMException { for (Iterator it = attributeContextMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String key = (String) entry.getKey(); InvocationContext ctx = (InvocationContext) entry.getValue(); //Initialize value from descriptor. Object value = ctx.getDescriptor().getFieldValue(XMBeanConstants.CACHED_VALUE); if (value != null) { setAttribute(new Attribute(key, value)); } // end of if () } }
InvocationContext ctx = new InvocationContext(); ctx.setName(opName); ctx.setSignature(signature); ctx.setReturnType(returnType); ctx.setInvoker(this);
getMBeanInfoCtx = new InvocationContext(); getMBeanInfoCtx.setInvoker(this); getMBeanInfoCtx.setDescriptor(mbeanDescriptor); getMBeanInfoCtx.setDispatcher(new AbstractInterceptor("MBeanInfo Dispatcher") InvocationContext ctx = new InvocationContext(); ctx.setInvoker(this); ctx.setDispatcher(new AbstractInterceptor("SetMangedResource Dispatcher")
@SuppressWarnings("unchecked") protected void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name) throws Exception { // FIXME: do not require super calls super.configureInterceptorStack(info, server, name); if (resourceType.equals(STANDARD_MBEAN)) { List interceptors = getMBeanInfoCtx.getInterceptors(); interceptors.add(0, new StandardMBeanInfoInterceptor()); getMBeanInfoCtx.setInterceptors(interceptors); } }
InvocationContext ctx = (InvocationContext) operationContextMap.get(opKey); Interceptor dispatcher = ctx.getDispatcher(); " to " + Strings.defaultToString(target) + " method= " + m); ctx.setTarget(target); ctx.setDispatcher(dispatcher); ctx.setDispatcher(new AttributeDispatcher(getter, setter, dynamicResource)); ctx.setTarget(resource);
List defaultInterceptors = getInterceptors(getMBeanInfoCtx.getDescriptor()); interceptors = getMBeanInfoCtx.getInterceptors(); getMBeanInfoCtx.setInterceptors(interceptors); List list = getInterceptors(ctx.getDescriptor()); if (list == null) ctx.setInterceptors(list); List list = getInterceptors(ctx.getDescriptor()); if (list == null && defaultInterceptors != null) list = new ArrayList(defaultInterceptors); ctx.setInterceptors(list);
throw new AttributeNotFoundException("not found: " + attribute); if (ctx.isReadable() == false) throw new AttributeNotFoundException("Attribute '" + attribute + "' found, but it is not readable"); ctx.setDescriptor(attrDesc); updateAttributeInfo(attrDesc);
else if (ctx.isWritable() == false) ctx.setDescriptor(attrDesc); updateAttributeInfo(attrDesc);