@Test public void testPersistStringAttributeWithParentDirectory() throws Exception { initPersister(); File nodeDir = m_fileAnticipator.tempDir(getSnmpRrdDirectory(), m_node.getId().toString()); m_fileAnticipator.expecting(nodeDir, "strings.properties"); CollectionAttribute attribute = buildStringAttribute(); m_persister.persistStringAttribute(attribute); }
public void persistStringAttribute(CollectionAttribute attribute) { log().debug("Persisting "+attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { log().info("No data collected for attribute "+attribute+". Skipping."); return; } String attrName = attribute.getName(); try { File resourceDir = resource.getResourceDir(getRepository()); ResourceTypeUtils.updateStringProperty(resourceDir, value, attrName); } catch(FileNotFoundException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } catch(IOException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } }
BasePersister extends AbstractCollectionSetVisitor implements Persister { public void persistStringAttribute(CollectionAttribute attribute) { log().debug("Persisting "+attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { log().info("No data collected for attribute "+attribute+". Skipping."); return; } String attrName = attribute.getName(); try { File resourceDir = resource.getResourceDir(getRepository()); ResourceTypeUtils.updateStringProperty(resourceDir, value, attrName); } catch(FileNotFoundException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } catch(IOException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } } }
BasePersister extends AbstractCollectionSetVisitor implements Persister { public void persistStringAttribute(CollectionAttribute attribute) { log().debug("Persisting "+attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { log().info("No data collected for attribute "+attribute+". Skipping."); return; } String attrName = attribute.getName(); try { File resourceDir = resource.getResourceDir(getRepository()); ResourceTypeUtils.updateStringProperty(resourceDir, value, attrName); } catch(FileNotFoundException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } catch(IOException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } } BasePersister();  BasePersister(ServiceParameters params, RrdRepository repository); }
BasePersister extends AbstractCollectionSetVisitor implements Persister { public void persistStringAttribute(CollectionAttribute attribute) { log().debug("Persisting "+attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { log().info("No data collected for attribute "+attribute+". Skipping."); return; } String attrName = attribute.getName(); try { File resourceDir = resource.getResourceDir(getRepository()); ResourceTypeUtils.updateStringProperty(resourceDir, value, attrName); } catch(FileNotFoundException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } catch(IOException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } } BasePersister();  BasePersister(ServiceParameters params, RrdRepository repository); void completeAttribute(CollectionAttribute attribute); void completeGroup(AttributeGroup group); void completeResource(CollectionResource resource); RrdRepository getRepository(); void setRepository(RrdRepository repository); void persistNumericAttribute(CollectionAttribute attribute); void persistStringAttribute(CollectionAttribute attribute); void visitAttribute(CollectionAttribute attribute); void visitGroup(AttributeGroup group); void visitResource(CollectionResource resource); boolean isIgnorePersist(); void setIgnorePersist(boolean ignore); PersistOperationBuilder getBuilder(); }
BasePersister extends AbstractCollectionSetVisitor implements Persister { public void persistStringAttribute(CollectionAttribute attribute) { log().debug("Persisting "+attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { log().info("No data collected for attribute "+attribute+". Skipping."); return; } String attrName = attribute.getName(); try { File resourceDir = resource.getResourceDir(getRepository()); ResourceTypeUtils.updateStringProperty(resourceDir, value, attrName); } catch(FileNotFoundException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } catch(IOException e) { log().error("Unable to save string attribute " + attribute + ": " + e, e); } } BasePersister();  BasePersister(ServiceParameters params, RrdRepository repository); void completeAttribute(CollectionAttribute attribute); void completeGroup(AttributeGroup group); void completeResource(CollectionResource resource); RrdRepository getRepository(); void setRepository(RrdRepository repository); void persistNumericAttribute(CollectionAttribute attribute); void persistStringAttribute(CollectionAttribute attribute); void visitAttribute(CollectionAttribute attribute); void visitGroup(AttributeGroup group); void visitResource(CollectionResource resource); boolean isIgnorePersist(); void setIgnorePersist(boolean ignore); PersistOperationBuilder getBuilder();  }