List of usage examples for javax.management AttributeList AttributeList
public AttributeList()
AttributeList
. From source file:org.apache.geode.management.internal.security.MBeanServerWrapper.java
@Override public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException { AttributeList results = new AttributeList(); for (String attribute : attributes) { try {// w w w . j a va2 s .co m Object value = getAttribute(name, attribute); Attribute att = new Attribute(attribute, value); results.add(att); } catch (Exception e) { throw new GemFireSecurityException("error getting value of " + attribute + " from " + name, e); } } return results; }
From source file:com.ecyrd.management.SimpleMBean.java
/** * Gets multiple attributes at the same time. * //from ww w. j a v a 2 s.com * @param arg0 The attribute names to get * @return A list of attributes */ public AttributeList getAttributes(String[] arg0) { AttributeList list = new AttributeList(); for (int i = 0; i < arg0.length; i++) { try { list.add(new Attribute(arg0[i], getAttribute(arg0[i]))); } catch (AttributeNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MBeanException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReflectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return list; }
From source file:gestionale.persistence.DAOSalva.java
public void creaFascicoli(List<Fascicolo> listaFascicoli) { //listaFascicoli = eliminaDuplicatiFascicoli(listaFascicoli); ordinaFascicoli(listaFascicoli);// w w w . j a va 2 s .com Document documet = new Document(); Element radiceXML = new Element("generale"); for (int i = 0; i < listaFascicoli.size(); i++) { Fascicolo fascicolo = listaFascicoli.get(i); List newAttributes = new AttributeList(); Element elementFascicolo = new Element("fascicolo"); Element subElemId = new Element("id"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", "" + fascicolo.getId())); subElemId.setAttributes(newAttributes); Element subElemExternId = new Element("externId"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", "" + fascicolo.getExternId())); subElemExternId.setAttributes(newAttributes); Element subElementNotizieReato = new Element("notizieReato"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", fascicolo.getNotizieRato())); subElementNotizieReato.setAttributes(newAttributes); Element subElementRgnr = new Element("rgnr"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", fascicolo.getRgnr())); subElementRgnr.setAttributes(newAttributes); Element subElementRggip = new Element("rggip"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", fascicolo.getRgGip())); subElementRggip.setAttributes(newAttributes); Element subElementNumeroSentenza = new Element("numeroSentenza"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", fascicolo.getNumeroSentenza())); subElementNumeroSentenza.setAttributes(newAttributes); Element subElementAutoritaGiudiziaria = new Element("autoritaGiudiziaria"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", fascicolo.getAutoritaGiudiziaria())); subElementAutoritaGiudiziaria.setAttributes(newAttributes); elementFascicolo.addContent(subElemId); elementFascicolo.addContent(subElemExternId); elementFascicolo.addContent(subElementNotizieReato); elementFascicolo.addContent(subElementRgnr); elementFascicolo.addContent(subElementRggip); elementFascicolo.addContent(subElementNumeroSentenza); elementFascicolo.addContent(subElementAutoritaGiudiziaria); radiceXML.addContent(elementFascicolo); } documet.addContent(radiceXML); XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setIndent(" "); format.setLineSeparator("\n"); outputter.setFormat(format); FileWriter fileWriter = null; try { fileWriter = new FileWriter("fascicolo.xml"); outputter.output(documet, fileWriter); logger.info("Fascicolo creato correttamente"); } catch (IOException ioe) { logger.info("IOException: " + ioe.getMessage()); return; } finally { if (fileWriter != null) { try { fileWriter.close(); } catch (IOException ioe) { logger.info("IOException: " + ioe.getMessage()); return; } } } }
From source file:org.parallelj.launching.transport.jmx.DynamicLegacyProgram.java
@Override public final AttributeList getAttributes(final String[] attributes) { return new AttributeList(); }
From source file:com.ecyrd.management.SimpleMBean.java
public AttributeList setAttributes(AttributeList arg0) { AttributeList result = new AttributeList(); for (Iterator i = arg0.iterator(); i.hasNext();) { Attribute attr = (Attribute) i.next(); ///*w w w .jav a2 s . com*/ // Attempt to set the attribute. If it succeeds (no exception), // then we just add it to the list of successfull sets. // try { setAttribute(attr); result.add(attr); } catch (AttributeNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidAttributeValueException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MBeanException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReflectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; }
From source file:org.parallelj.launching.transport.jmx.DynamicLegacyProgram.java
@Override public final AttributeList setAttributes(final AttributeList attributes) { return new AttributeList(); }
From source file:org.rifidi.edge.configuration.DefaultConfigurationImpl.java
@Override public AttributeList getAttributes(String[] attributes) { assert (attributes != null); AttributeList ret = new AttributeList(); Set<String> attribNames = new HashSet<String>(); for (int count = 0; count < attributes.length; count++) { attribNames.add(attributes[count]); }/*from w w w. j ava 2s . co m*/ for (Attribute attr : this.attributes.asList()) { if (attribNames.contains(attr.getName())) { ret.add(attr); } } return ret; }
From source file:gestionale.persistence.DAOSalva.java
public void creaUdienze(List<Udienza> lista) { lista = eliminaDuplicatiUdienze(lista); logger.info("Numero di udienze senza duplicati: " + lista.size()); ordinaListaUdienza(lista);//from www . ja v a 2 s . c o m Document documet = new Document(); Element radiceXML = new Element("generale"); for (Udienza udienza : lista) { List newAttributes = new AttributeList(); Element elemUdienza = new Element("udienza"); Element subElemId = new Element("id"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", "" + udienza.getId())); subElemId.setAttributes(newAttributes); Element subElemExternId = new Element("externId"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", "" + udienza.getExternId())); subElemExternId.setAttributes(newAttributes); Element subElemData = new Element("data"); newAttributes = new AttributeList(); newAttributes.add(new Attribute("value", udienza.formattaDataShort())); subElemData.setAttributes(newAttributes); elemUdienza.addContent(subElemId); elemUdienza.addContent(subElemExternId); elemUdienza.addContent(subElemData); radiceXML.addContent(elemUdienza); } documet.addContent(radiceXML); XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setIndent(" "); format.setLineSeparator("\n"); outputter.setFormat(format); FileWriter fileWriter = null; try { fileWriter = new FileWriter("udienza.xml"); outputter.output(documet, fileWriter); logger.info("Udienza creato correttamente"); } catch (IOException ioe) { logger.info("IOException: " + ioe.getMessage()); return; } finally { if (fileWriter != null) { try { fileWriter.close(); } catch (IOException ioe) { logger.info("IOException: " + ioe.getMessage()); return; } } } }
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); }/* www .j a va 2 s.com*/ // 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.apache.tomcat.util.mx.DynamicMBeanProxy.java
public AttributeList getAttributes(String[] attributes) { AttributeList al = new AttributeList(); if (attributes == null) return null; for (int i = 0; i < attributes.length; i++) { try {//from www . ja v a 2 s.c o m Attribute att = new Attribute(attributes[i], getAttribute(attributes[i])); al.add(att); } catch (Exception ex) { ex.printStackTrace(); } } return al; }