Example usage for javax.management AttributeList clone

List of usage examples for javax.management AttributeList clone

Introduction

In this page you can find the example usage for javax.management AttributeList clone.

Prototype

@HotSpotIntrinsicCandidate
protected native Object clone() throws CloneNotSupportedException;

Source Link

Document

Creates and returns a copy of this object.

Usage

From source file:org.rifidi.edge.configuration.DefaultConfigurationImpl.java

/**
 * Constructor.//from  w  ww. j  a v  a  2s  .c o m
 * 
 * @param context
 * @param serviceID
 * @param factoryID
 * @param attributes
 * @param sessionDTOs
 */
public DefaultConfigurationImpl(final String serviceID, final String factoryID, final AttributeList attributes,
        final NotifierService notifierService, final JMXService jmxService, Set<SessionDTO> sessionDTOs) {
    this.notifierService = notifierService;
    this.nameToProperty = new HashMap<String, Property>();
    this.nameToOperation = new HashMap<String, Operation>();
    this.factoryID = factoryID;
    this.serviceID = serviceID;
    this.attributes = (AttributeList) attributes.clone();
    disableAutoStart = false;
    for (Object o : this.attributes) {
        Attribute att = (Attribute) o;
        String name = att.getName();
        if (name.equals("DisableAutoStart")) {
            // This is the 'override' autostart, so we will default to true
            // unless it is explicitly set to false
            if (att.getValue() != null && ((String) att.getValue()).equalsIgnoreCase("true")) {
                disableAutoStart = true;
            }
            break;
        }
    }
    this.listeners = new CopyOnWriteArraySet<AttributesChangedListener>();
    this.target = new AtomicReference<RifidiService>(null);
    this.jmxService = jmxService;
    this.sessionDTOs = new ConcurrentHashMap<SessionDTO, String>();
    if (sessionDTOs != null) {
        for (SessionDTO dto : sessionDTOs) {
            this.sessionDTOs.put(dto, "-1");
        }
    }
}

From source file:org.rifidi.edge.configuration.DefaultConfigurationImpl.java

@Override
public AttributeList setAttributes(final AttributeList attributes) {
    assert (attributes != null);
    RifidiService service = target.get();
    if (service != null) {
        service.setAttributes(attributes);
    }/*from   w w  w. j a  v  a 2s  .c  om*/

    // keep track of changed attributes since there might be an error
    AttributeList changedAttributes = new AttributeList();

    for (Attribute attribute : attributes.asList()) {

        String attrName = attribute.getName();
        Integer pos = nameToPos.get(attrName);
        if (pos == null) {
            logger.error("Error when trying to set " + attribute.getName());
        } else {
            this.attributes.set(pos, attribute);
            changedAttributes.add(this.attributes.get(pos));
        }

    }

    notifierService.attributesChanged(getServiceID(), (AttributeList) changedAttributes);
    return (AttributeList) changedAttributes.clone();
}

From source file:org.rifidi.edge.core.configuration.services.DefaultConfigurationImpl.java

/**
 * Constructor./* ww w  .j  a  va2s.  c o  m*/
 * 
 * @param context
 * @param serviceID
 * @param factoryID
 * @param attributes
 * @param sessionDTOs
 */
public DefaultConfigurationImpl(final String serviceID, final String factoryID, final AttributeList attributes,
        final NotifierService notifierService, final JMXService jmxService, Set<SessionDTO> sessionDTOs) {
    this.notifierService = notifierService;
    this.nameToProperty = new HashMap<String, Property>();
    this.nameToOperation = new HashMap<String, Operation>();
    this.factoryID = factoryID;
    this.serviceID = serviceID;
    this.attributes = (AttributeList) attributes.clone();
    this.listeners = new CopyOnWriteArraySet<AttributesChangedListener>();
    this.target = new AtomicReference<RifidiService>(null);
    this.jmxService = jmxService;
    this.sessionDTOs = new ConcurrentHashMap<SessionDTO, String>();
    if (sessionDTOs != null) {
        for (SessionDTO dto : sessionDTOs) {
            this.sessionDTOs.put(dto, "-1");
        }
    }
}