use of org.opennms.netmgt.model.AdhocGraphType in project opennms by OpenNMS.
the class PropertiesGraphDao method loadAdhocProperties.
/**
* <p>
* loadAdhocProperties
* </p>
*
* @param type
* a {@link java.lang.String} object.
* @param in
* a {@link java.io.InputStream} object.
* @throws java.io.IOException
* if any.
*/
public void loadAdhocProperties(String type, InputStream in) throws IOException {
AdhocGraphType t = createAdhocGraphType(type, in);
m_adhocTypes.put(t.getName(), new FileReloadContainer<AdhocGraphType>(t));
}
use of org.opennms.netmgt.model.AdhocGraphType in project opennms by OpenNMS.
the class DefaultRrdGraphService method getAdhocGraph.
/**
* {@inheritDoc}
*/
@Override
public InputStream getAdhocGraph(ResourceId resourceId, String title, String[] dataSources, String[] aggregateFunctions, String[] colors, String[] dataSourceTitles, String[] styles, long start, long end) {
Assert.notNull(resourceId, "resourceId argument cannot be null");
Assert.notNull(title, "title argument cannot be null");
Assert.notNull(dataSources, "dataSources argument cannot be null");
Assert.notNull(aggregateFunctions, "aggregateFunctions argument cannot be null");
Assert.notNull(colors, "colors argument cannot be null");
Assert.notNull(dataSourceTitles, "dataSourceTitles argument cannot be null");
Assert.notNull(styles, "styles argument cannot be null");
Assert.isTrue(end > start, "end time must be after start time");
AdhocGraphType t = m_graphDao.findAdhocGraphTypeByName("performance");
OnmsResource r = m_resourceDao.getResourceById(resourceId);
Assert.notNull(r, "resource \"" + resourceId + "\" could not be located");
String command = createAdHocCommand(t, r, start, end, title, dataSources, aggregateFunctions, colors, dataSourceTitles, styles);
return getInputStreamForCommand(command);
}
use of org.opennms.netmgt.model.AdhocGraphType in project opennms by OpenNMS.
the class PropertiesGraphDao method createAdhocGraphType.
/**
* <p>
* createAdhocGraphType
* </p>
*
* @param type
* a {@link java.lang.String} object.
* @param in
* a {@link java.io.InputStream} object.
* @return a {@link org.opennms.netmgt.model.AdhocGraphType} object.
* @throws java.io.IOException
* if any.
*/
private AdhocGraphType createAdhocGraphType(String type, InputStream in) throws IOException {
Properties properties = new Properties();
properties.load(in);
AdhocGraphType t = new AdhocGraphType();
t.setName(type);
t.setCommandPrefix(getProperty(properties, "command.prefix"));
t.setOutputMimeType(getProperty(properties, "output.mime"));
t.setTitleTemplate(getProperty(properties, "adhoc.command.title"));
t.setDataSourceTemplate(getProperty(properties, "adhoc.command.ds"));
t.setGraphLineTemplate(getProperty(properties, "adhoc.command.graphline"));
return t;
}
use of org.opennms.netmgt.model.AdhocGraphType in project opennms by OpenNMS.
the class PropertiesGraphDao method loadAdhocProperties.
/**
* <p>createPrefabGraphType
* loadAdhocProperties
* </p>
*
* @param type
* a {@link java.lang.String} object.
* @param resource
* a {@link org.springframework.core.io.Resource} object.
* @throws java.io.IOException
* if any.
*/
public void loadAdhocProperties(String type, Resource resource) throws IOException {
InputStream in = resource.getInputStream();
AdhocGraphType t;
try {
t = createAdhocGraphType(type, in);
} finally {
IOUtils.closeQuietly(in);
}
m_adhocTypes.put(t.getName(), new FileReloadContainer<AdhocGraphType>(t, resource, m_adhocCallback));
}
Aggregations