Package org.jboss.system.metadata

Examples of org.jboss.system.metadata.ServiceValueContext


    * @param attrs the attributes
    * @throws Exception for any error
    */
   public static void configure(MBeanServer server, ServiceController controller, ObjectName objectName, ClassLoader cl, Collection<ServiceAttributeMetaData> attrs) throws Exception
   {
      ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl);
      server = checkMBeanServer(server, controller);
     
      HashMap<String, MBeanAttributeInfo> attributeMap = getAttributeMap(server, objectName);

      for (ServiceAttributeMetaData attribute : attrs)
      {
         String attributeName = attribute.getName();
         if (attributeName == null || attributeName.length() == 0)
            throw new RuntimeException("No or empty attribute name for " + objectName);
         MBeanAttributeInfo attributeInfo = attributeMap.get(attributeName);
         if (attributeInfo == null)
         {
            throw new RuntimeException("No Attribute found with name: " + attributeName + " for " + objectName
                  +", attributes: "+attributeMap.keySet());
         }

         valueContext.setAttributeInfo(attributeInfo);
         Object value = null;
         ClassLoader previous = SecurityActions.setContextClassLoader(cl);
         try
         {
            value = attribute.getValue(valueContext);
View Full Code Here


               try
               {
                  // TODO: cache this somehow
                  HashMap<String, MBeanAttributeInfo> attrs = ServiceConfigurator.getAttributeMap(mbeanServer, mbean);
                  MBeanAttributeInfo mbi = attrs.get(attrName);
                  ServiceValueContext svc = new ServiceValueContext(mbeanServer, controller, mbi, loader);
                  value = text.getValue(svc);
               }
               catch(Exception e)
               {
                  // TODO: better way to determine if the bean was installed, as this does not make much sense
View Full Code Here

/*     */   }
/*     */
/*     */   public static void configure(MBeanServer server, ServiceController controller, ObjectName objectName, ClassLoader cl, Collection<ServiceAttributeMetaData> attrs)
/*     */     throws Exception
/*     */   {
/* 117 */     ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl);
/* 118 */     server = checkMBeanServer(server, controller);
/*     */
/* 120 */     HashMap attributeMap = getAttributeMap(server, objectName);
/*     */
/* 122 */     for (ServiceAttributeMetaData attribute : attrs)
/*     */     {
/* 124 */       String attributeName = attribute.getName();
/* 125 */       if ((attributeName == null) || (attributeName.length() == 0))
/* 126 */         throw new DeploymentException("No or empty attribute name for " + objectName);
/* 127 */       MBeanAttributeInfo attributeInfo = (MBeanAttributeInfo)attributeMap.get(attributeName);
/* 128 */       if (attributeInfo == null)
/*     */       {
/* 130 */         throw new DeploymentException("No Attribute found with name: " + attributeName + " for " + objectName + ", attributes: " + attributeMap.keySet());
/*     */       }
/*     */
/* 134 */       valueContext.setAttributeInfo(attributeInfo);
/* 135 */       Object value = attribute.getValue(valueContext);
/*     */       try
/*     */       {
/* 138 */         log.debug(attributeName + " set to " + value + " in " + objectName);
/* 139 */         server.setAttribute(objectName, new Attribute(attributeName, value));
View Full Code Here

TOP

Related Classes of org.jboss.system.metadata.ServiceValueContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.