public Object getValue(ServiceValueContext valueContext) throws Exception { MBeanAttributeInfo attributeInfo = valueContext.getAttributeInfo(); ClassLoader cl = valueContext.getClassloader(); MBeanServer server = valueContext.getServer(); ObjectName objectName = getObjectName(); if (proxyType != null) { if (proxyType.equals("attribute")) { proxyType = attributeInfo.getType(); if (proxyType == null) throw new ConfigurationException("AttributeInfo for " + attributeInfo.getName() + " has no type"); } Class<?> proxyClass = cl.loadClass(proxyType); return MBeanProxyExt.create(proxyClass, objectName, server, true); } return objectName; }
/** * Get the controller * * @return the controller */ public KernelController getController() { return getKernel().getController(); } }
/** * Get the kernel * * @return the kernel */ public Kernel getKernel() { return getServiceController().getKernel(); }
public Object getValue(ServiceValueContext valueContext) throws Exception { if (this.parameterTypeName == null) throw new IllegalStateException("Must set parameterTypeName"); String desiredType = (this.valueTypeName == null ? parameterTypeName : valueTypeName); return getValue(valueContext.getClassloader(), this.textValue, desiredType, valueContext.getAttributeInfo().getName()); }
public Object getValue(ServiceValueContext valueContext) throws Exception MBeanAttributeInfo attributeInfo = valueContext.getAttributeInfo(); ClassLoader cl = valueContext.getClassloader(); boolean trim = valueContext.isTrim(); boolean replace = valueContext.isReplace();
ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl); server = checkMBeanServer(server, controller); valueContext.setAttributeInfo(attributeInfo); Object value = null; ClassLoader previous = SecurityActions.setContextClassLoader(cl);
@Override public Object ungetValue(ServiceValueContext valueContext) throws Throwable { if (property == null || property.length() == 0) { KernelController controller = valueContext.getController(); ControllerState state = dependentState; if (state == null) state = ControllerState.INSTALLED; ControllerContext context = controller.getContext(dependency, state); if (context != null) { ungetTarget(underlyingContext, context); return null; } } return super.ungetValue(valueContext); }
ServiceValueContext svc = new ServiceValueContext(mbeanServer, controller, mbi, loader); value = text.getValue(svc);
public Object getValue(ServiceValueContext valueContext) throws Exception { // Replace any ${x} references in the element text if (valueContext.isReplace()) { PropertyEditor editor = PropertyEditorManager.findEditor(Element.class); if (editor == null) log.warn("Cannot perform property replace on Element"); else { editor.setValue(element); String text = editor.getAsText(); text = StringPropertyReplacer.replaceProperties(text); editor.setAsText(text); return editor.getValue(); } } return element; } }
public Object getValue(ServiceValueContext valueContext) throws Exception { // Get the attribute element content in a parsable form StringBuffer buffer = ServiceConfigurator.getElementContent(getElement()); Thread current = Thread.currentThread(); ClassLoader oldTcl = current.getContextClassLoader(); ClassLoader cl = valueContext.getClassloader(); if (cl != null) current.setContextClassLoader(cl); try { // Parse the attribute element content SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); StringReader reader = new StringReader(buffer.toString()); return unmarshaller.unmarshal(reader, resolver); } finally { if (cl != null) current.setContextClassLoader(oldTcl); } } }
public Object getValue(ServiceValueContext valueContext) throws Exception MBeanAttributeInfo attributeInfo = valueContext.getAttributeInfo(); ClassLoader cl = valueContext.getClassloader(); boolean trim = valueContext.isTrim(); boolean replace = valueContext.isReplace();
ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl); server = checkMBeanServer(server, controller); valueContext.setAttributeInfo(attributeInfo); Object value = null; ClassLoader previous = SecurityActions.setContextClassLoader(cl);
public Object getValue(ServiceValueContext valueContext) throws Exception { if (this.parameterTypeName == null) throw new IllegalStateException("Must set parameterTypeName"); String desiredType = (this.valueTypeName == null ? parameterTypeName : valueTypeName); return getValue(valueContext.getClassloader(), this.textValue, desiredType, valueContext.getAttributeInfo().getName()); }
public Object getValue(ServiceValueContext valueContext) throws Throwable { KernelController controller = valueContext.getController(); ControllerState state = dependentState; if (state == null) state = ControllerState.INSTALLED; ControllerContext context = controller.getContext(dependency, state); if (context == null) throw new Error("Should not be here - dependency failed! " + this); if (property != null && property.length() > 0) { if (context instanceof AttributeDispatchContext) { AttributeDispatchContext adc = (AttributeDispatchContext)context; return adc.get(property); } else throw new IllegalArgumentException( "Cannot use property attribute, context is not AttributeDispatchContext: " + context + ", metadata: " + this); } else { return getTarget(underlyingContext, context); } }
public Object getValue(ServiceValueContext valueContext) throws Exception { // Replace any ${x} references in the element text if (valueContext.isReplace()) { PropertyEditor editor = PropertyEditorManager.findEditor(Element.class); if (editor == null) log.warn("Cannot perform property replace on Element"); else { editor.setValue(element); String text = editor.getAsText(); text = StringPropertyReplacer.replaceProperties(text); editor.setAsText(text); return editor.getValue(); } } return element; } }
public Object getValue(ServiceValueContext valueContext) throws Exception { // Get the attribute element content in a parsable form StringBuffer buffer = ServiceConfigurator.getElementContent(getElement()); Thread current = Thread.currentThread(); ClassLoader oldTcl = current.getContextClassLoader(); ClassLoader cl = valueContext.getClassloader(); if (cl != null) current.setContextClassLoader(cl); try { // Parse the attribute element content SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); StringReader reader = new StringReader(buffer.toString()); Object bean = unmarshaller.unmarshal(reader, resolver); return bean; } finally { if (cl != null) current.setContextClassLoader(oldTcl); } } }
ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl); server = checkMBeanServer(server, controller); valueContext.setAttributeInfo(attributeInfo); Object value = null; ClassLoader previous = SecurityActions.setContextClassLoader(cl);
public Object getValue(ServiceValueContext valueContext) throws Exception { MBeanAttributeInfo attributeInfo = valueContext.getAttributeInfo(); ClassLoader cl = valueContext.getClassloader(); MBeanServer server = valueContext.getServer(); ObjectName objectName = getObjectName(); if (proxyType != null) { if (proxyType.equals("attribute")) { proxyType = attributeInfo.getType(); if (proxyType == null) throw new ConfigurationException("AttributeInfo for " + attributeInfo.getName() + " has no type"); } Class<?> proxyClass = cl.loadClass(proxyType); return MBeanProxyExt.create(proxyClass, objectName, server, true); } return objectName; }
public Object getValue(ServiceValueContext valueContext) throws Exception MBeanAttributeInfo attributeInfo = valueContext.getAttributeInfo(); ClassLoader cl = valueContext.getClassloader();
public Object getValue(ServiceValueContext valueContext) throws Throwable { KernelController controller = valueContext.getController(); ControllerState state = dependentState; if (state == null) state = ControllerState.INSTALLED; ControllerContext context = controller.getContext(dependency, state); if (context == null) throw new Error("Should not be here - dependency failed! " + this); Object result = context.getTarget(); if (property != null) { if (context instanceof AttributeDispatchContext) { AttributeDispatchContext adc = (AttributeDispatchContext)context; result = adc.get(property); } else throw new IllegalArgumentException( "Cannot use property attribute, context is not AttributeDispatchContext: " + context + ", metadata: " + this); } return result; }