List of usage examples for javax.management Attribute Attribute
public Attribute(String name, Object value)
From source file:org.archive.crawler.admin.CrawlJob.java
public AttributeList setAttributes(AttributeList attributes) { if (attributes == null) { throw new RuntimeOperationsException( new IllegalArgumentException("attributeNames[] cannot be " + "null"), "Cannot call getAttributes with null attribute " + "names"); }/*from w ww. j a va 2s . c o m*/ AttributeList resultList = new AttributeList(); if (attributes.size() == 0) { return resultList; } for (int i = 0; i < attributes.size(); i++) { try { Attribute attr = (Attribute) attributes.get(i); setAttributeInternal(attr); String an = attr.getName(); Object newValue = getAttribute(an); resultList.add(new Attribute(an, newValue)); } catch (Exception e) { e.printStackTrace(); } } // prompt updating of settings-sensitive components kickUpdate(); return resultList; }
From source file:com.cyberway.issue.crawler.admin.CrawlJob.java
public AttributeList setAttributes(AttributeList attributes) { if (attributes == null) { throw new RuntimeOperationsException( new IllegalArgumentException("attributeNames[] cannot be " + "null"), "Cannot call getAttributes with null attribute " + "names"); }//w w w .ja v a2 s. c o m AttributeList resultList = new AttributeList(); if (attributes.size() == 0) { return resultList; } for (int i = 0; i < attributes.size(); i++) { try { Attribute attr = (Attribute) attributes.get(i); setAttribute(attr); String an = attr.getName(); Object newValue = getAttribute(an); resultList.add(new Attribute(an, newValue)); } catch (Exception e) { e.printStackTrace(); } } return resultList; }
From source file:com.cyberway.issue.crawler.Heritrix.java
public AttributeList getAttributes(String[] attributeNames) { if (attributeNames == null) { throw new RuntimeOperationsException( new IllegalArgumentException("attributeNames[] cannot be " + "null"), "Cannot call getAttributes with null attribute " + "names"); }/* w w w.ja v a2 s . c o m*/ AttributeList resultList = new AttributeList(); if (attributeNames.length == 0) { return resultList; } for (int i = 0; i < attributeNames.length; i++) { try { Object value = getAttribute(attributeNames[i]); resultList.add(new Attribute(attributeNames[i], value)); } catch (Exception e) { e.printStackTrace(); } } return (resultList); }
From source file:org.rifidi.edge.rest.SensorManagerServiceRestletImpl.java
/** * Processes a chain of semicolon separated properties and checks whether it * is a well formed pair/* ww w . j av a 2 s. c om*/ * * @param propertiesChain * separated values of properties, for example: * (prop1=val2;prop2=val2;prop3=val3) * @return AttributeList containing the attributes * @throws Exception * if any property has no recognizable value */ private AttributeList getProcessedAttributes(String propertiesChain) throws Exception { AttributeList attributes = new AttributeList(); // Check if propertiesChain has properties to process... if (propertiesChain != null && !propertiesChain.isEmpty()) { String[] splitProp = propertiesChain.split(";"); for (String pair : splitProp) { String[] prop = pair.split("="); // check if property has a property and a value if (prop.length == 2) { // It has property and value attributes.add(new Attribute(prop[0], prop[1])); } else { // Property with no recognizable value, for example // Port=123=456, or Port, throw new Exception("Property with no recognizable value: " + prop[0]); } } } return attributes; }