Package javax.management

Examples of javax.management.InvalidAttributeValueException


            // unrecognized attribute name:
            throw new AttributeNotFoundException("Attribute " + name
                    + " not found in " + m_className);
        }
        if (!propertyField.isWritable()) {
            throw new InvalidAttributeValueException("Attribute " + name
                    + " can not be set");
        }

        if (value == null) {
            try {
                m_instanceManager.onSet(null, propertyField.getField(), null);
            } catch (Exception e) {
                throw new InvalidAttributeValueException(
                    "Cannot set attribute " + name + " to null");
            }
        } else { // if non null value, make sure it is assignable to the
            // attribute
            if (true /* TODO type.class.isAssignableFrom(value.getClass()) */) {
                // propertyField.setValue(value);
                // setValue(attributeField.getField(),null);
                m_instanceManager.onSet(null, propertyField.getField(), value);
            } else {
                throw new InvalidAttributeValueException(
                    "Cannot set attribute " + name + " to a "
                            + value.getClass().getName()
                            + " object, String expected");
            }
        }
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 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

    public void setConfigFileName(String fileName) throws InvalidAttributeValueException {
        try {
            controller.setConfigFile(fileName != null ? new File(fileName) : null);
        } catch (CruiseControlException e) {
            throw new InvalidAttributeValueException(e.getMessage());
        }
    }
View Full Code Here

   
    public void setConfigFileName(String fileName) throws InvalidAttributeValueException {
        try {
            controller.setConfigFile(fileName != null ? new File(fileName) : null);
        } catch (CruiseControlException e) {
            throw new InvalidAttributeValueException(e.getMessage());
        }
    }
View Full Code Here

            Object cookie)
            throws InvalidAttributeValueException {
        if (!validParameter(setter, arg, 0, cookie)) {
            final String msg =
                    "Invalid value for attribute " + name + ": " + arg;
            throw new InvalidAttributeValueException(msg);
        }
    }
View Full Code Here

            throw MESSAGES.invalidAttributeType(e, attribute.getName());
        }
        ModelNode result = execute(op);
        String error = getFailureDescription(result);
        if (error != null) {
            throw new InvalidAttributeValueException(error);
        }
    }
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

        if (argType.isPrimitive()) {
            if (!ManagementUtils.isWrapperClass(
                    attribute.getValue().getClass(), argType)) {              
                //lm.0B= {0} is a {1} attribute
                throw new InvalidAttributeValueException(Messages.getString("lm.0B", attribInfo.getName(), attribInfo.getType())); //$NON-NLS-1$
            }
        } else if (!argType.equals(attribute.getValue().getClass())) {
            //lm.0B= {0} is a {1} attribute
            throw new InvalidAttributeValueException(Messages.getString("lm.0B", attribInfo.getName(), attribInfo.getType())); //$NON-NLS-1$
        }

        Method setterMethod = null;
        try {
            setterMethod = this.getClass().getMethod(
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 {
            EnvironmentMutableConfig mutableConfig = env.getMutableConfig();

            if (name.equals(ATT_CACHE_SIZE)) {
                mutableConfig.setCacheSize(((Long) value).longValue());
                env.setMutableConfig(mutableConfig);
            } else if (name.equals(ATT_CACHE_PERCENT)) {
                mutableConfig.setCachePercent(((Integer) value).intValue());
                env.setMutableConfig(mutableConfig);
            } else {
                throw new AttributeNotFoundException
                    ("Attribute " + name + " is not valid.");
            }
        } catch (NumberFormatException e) {
            throw new InvalidAttributeValueException
                ("Attribute value for attribute " + name + " is not valid.");
        } catch (DatabaseException e) {
            throw new InvalidAttributeValueException
                ("Setting value for attribute " + name +
                 "is invalid because of " + e.getMessage());
        }
    }
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.