Package javax.management

Examples of javax.management.InvalidAttributeValueException


            throw new AttributeNotFoundException
                ("Attribute name cannot be null");
        }

        if (value == null) {
            throw new InvalidAttributeValueException
                ("Attribute value for attribute " + name + " cannot be null");
        }

        try {
            if (name.equals(ATT_SET_READ_ONLY)) {
                openConfig.setReadOnly(((Boolean) value).booleanValue());
            } else if (name.equals(ATT_SET_TRANSACTIONAL)) {
                openConfig.setTransactional(((Boolean) value).booleanValue());
            } else if (name.equals(ATT_SET_SERIALIZABLE)) {
                openConfig.setTxnSerializableIsolation
                    (((Boolean) value).booleanValue());
            } else {
                /* Set the specified attribute if the environment is open. */
                if (targetEnv != null) {

                    EnvironmentMutableConfig config =
                        targetEnv.getMutableConfig();

                    if (name.equals(ATT_CACHE_SIZE)) {
                        config.setCacheSize(((Long) value).longValue());
                        targetEnv.setMutableConfig(config);
                    } else if (name.equals(ATT_CACHE_PERCENT)) {
                        config.setCachePercent(((Integer) value).intValue());
                        targetEnv.setMutableConfig(config);
                    } else {
                        throw new AttributeNotFoundException
                            ("attribute " + name + " is not valid.");
                    }
                } else {
                    throw new AttributeNotFoundException
                        ("attribute " + name + " is not valid.");
                }
            }
        } catch (NumberFormatException e) {
            throw new InvalidAttributeValueException("attribute name=" + name);
        } catch (DatabaseException e) {
            throw new InvalidAttributeValueException
                ("attribute name=" + name + e.getMessage());
        }
    }
View Full Code Here


            throw new AttributeNotFoundException
                ("Attribute name can't be null.");
        }

        if (value == null) {
            throw new InvalidAttributeValueException
                ("Attribute value for attribute " + name + " can't be null");
        }

        try {
            EnvironmentImpl envImpl = DbInternal.getEnvironmentImpl(env);
            Level level = Level.parse((String) value);

            if (name.equals(MEMORYHANDLER_LEVEL)) {
                envImpl.getMemoryHandler().setPushLevel(level);
            } else if (name.equals(CONSOLEHANDLER_LEVEL)) {
                envImpl.getConsoleHandler().setLevel(level);
            } else if (name.equals(FILEHANDLER_LEVEL)) {
                envImpl.getFileHandler().setLevel(level);
            } else {
                throw new AttributeNotFoundException
                    ("Attribute " + name + " is not valid.");
            }
        } catch (NullPointerException e) {
            throw new InvalidAttributeValueException
                ("Setting value for attribute " + name +
                 "is invalid because of " + e.getMessage());
        } catch (SecurityException e) {
            throw new MBeanException(e, e.getMessage());
        }
View Full Code Here

      }
       try {
         if ((Class.forName(attributes.get(attributeIndex).getType()).isAssignableFrom(value.getClass())))
           data.put(name, value);
        else
          throw(new InvalidAttributeValueException("Cannot set attribute due to incorrect data type"));
        return;
       } catch (ClassNotFoundException e) {
         logger.error(e.getMessage(), e);
       }
      throw(new AttributeNotFoundException("Attribute not found"));
View Full Code Here

        }

        if (argType.isPrimitive()) {
            if (!ManagementUtils.isWrapperClass(
                    attribute.getValue().getClass(), argType)) {
                throw new InvalidAttributeValueException(attribInfo.getName()
                        + " is a " + attribInfo.getType() + " attribute");
            }
        } else if (!argType.equals(attribute.getValue().getClass())) {
            throw new InvalidAttributeValueException(attribInfo.getName()
                    + " is a " + attribInfo.getType() + " attribute");
        }

        Method setterMethod = null;
        try {
View Full Code Here

            try
            {
                property.validate(attribute.getValue());
            } catch(ValidationException exception)
            {
                throw new InvalidAttributeValueException(exception.getMessage());
            }
            throw new RuntimeException("Not yet implemented.");
        }
View Full Code Here

        throw new IllegalArgumentException(errMsgX);
    }
   
    @Option(name="-y")
    public void setY(String y) throws InvalidAttributeValueException {
        throw new InvalidAttributeValueException(errMsgX);
    }
View Full Code Here

            {
                this.homeDirectory = getFileURI( ( String ) attribute.getValue() );
            }
            catch ( URISyntaxException e )
            {
                throw new InvalidAttributeValueException("homeDirectory value is not valid URI " + attribute.getValue());
            }
        }
        else if ( attribute.equals( ATTR_CONFIG_FILE ) )
        {
            try
            {
                this.configFile = getFileURI( ( String ) attribute.getValue() );
            }
            catch ( URISyntaxException e )
            {
                throw new InvalidAttributeValueException("configFile value is not valid URI " + attribute.getValue());
            }
        }

    }
View Full Code Here

            try {
                if (java.lang.Integer.class.isAssignableFrom
       ((value!=null)?value.getClass():java.lang.Integer.class)) {
                    setPort(((Integer)attribute.getValue()).intValue());
                } else {
                    throw(new InvalidAttributeValueException
        ("Cannot set attribute "+ name +" to a " +
         ((value!=null) ? value.getClass().getName() : value) + " object, java.lang.Integer expected"));
                 }
      } catch (Exception e) {
                if (logger.finestOn()) {
                    logger.finest("setAttribute","setAttribute Port: caught [Exception="+e+"]");
                }
                throw new MBeanException(e, "setAttribute Port: "+ e.getClass().getName() +" caught ["+ e.getMessage() +"]");
            }
        }
  // MaxActiveClientCount
  else if (name.equals("MaxActiveClientCount")) {
            try {
                if (java.lang.Integer.class.isAssignableFrom
       ((value!=null)?value.getClass():java.lang.Integer.class)) {
                    setMaxActiveClientCount(((Integer)attribute.getValue()).intValue());
                } else {
                    throw(new InvalidAttributeValueException
        ("Cannot set attribute "+ name +" to a " +
         ((value!=null) ? value.getClass().getName() : value) + " object, java.lang.Integer expected"));
                }
      } catch (Exception e) {
                if (logger.finestOn()) {
                    logger.finest("setAttribute","setAttribute MaxActiveClientCount: caught [Exception="+e+"]");
                }
                throw new MBeanException(e, "setAttribute MaxActiveClientCount: "+ e.getClass().getName() +" caught ["+ e.getMessage() +"]");
            }
        }
  // Parser
  else if (name.equals("Parser")) {
            try {
                if (javax.management.ObjectName.class.isAssignableFrom
        ((value!=null)?value.getClass():
         javax.management.ObjectName.class)) {
                    setParser((ObjectName)attribute.getValue());
                } else {
                    throw(new InvalidAttributeValueException
        ("Cannot set attribute "+ name +" to a " +
         ((value!=null) ? value.getClass().getName() : value) + " object, javax.management.ObjectName expected"));
                }
      } catch (Exception e) {
                if (logger.finestOn()) {
View Full Code Here

   *                                          acceptable for this MBean.
   */
  public void setAttribute(javax.management.Attribute attribute)
         throws AttributeNotFoundException, InvalidAttributeValueException
  {
    throw new InvalidAttributeValueException();
  }
View Full Code Here

         }
      }
      catch (IllegalArgumentException e)
      {
         String valueType = (null == attribute.getValue()) ? "<null value>" : attribute.getValue().getClass().getName();
         throw new InvalidAttributeValueException("Attribute value mismatch while setting '" + attribute.getName() + "': " + valueType);
      }
      catch (Exception e) // assume all other exceptions are reflection related
      {
         throw new ReflectionException(e, "Exception in AttributeProvider for setting '" + attribute.getName() + "'");
      }
View Full Code Here

TOP

Related Classes of javax.management.InvalidAttributeValueException

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.