Search in sources :

Example 21 with ObjectRetrievalFailureException

use of org.springframework.orm.ObjectRetrievalFailureException in project opennms by OpenNMS.

the class PropertiesGraphDao method getPrefabGraph.

/** {@inheritDoc} */
@Override
public PrefabGraph getPrefabGraph(final String name) {
    for (final FileReloadContainer<PrefabGraphTypeDao> container : m_types.values()) {
        final PrefabGraphTypeDao type = container.getObject();
        this.rescanIncludeDirectory(type);
        final PrefabGraph graph = type.getQuery(name);
        if (graph != null) {
            return graph;
        }
    }
    throw new ObjectRetrievalFailureException(PrefabGraph.class, name, "Could not find prefabricated graph report with name '" + name + "'", null);
}
Also used : PrefabGraph(org.opennms.netmgt.model.PrefabGraph) ObjectRetrievalFailureException(org.springframework.orm.ObjectRetrievalFailureException)

Example 22 with ObjectRetrievalFailureException

use of org.springframework.orm.ObjectRetrievalFailureException in project opennms by OpenNMS.

the class GenericIndexResourceType method instantiateStorageStrategy.

private void instantiateStorageStrategy(String className) {
    Class<?> cinst;
    try {
        cinst = Class.forName(className);
    } catch (ClassNotFoundException e) {
        throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not load class", e);
    }
    try {
        m_storageStrategy = (StorageStrategy) cinst.newInstance();
    } catch (InstantiationException e) {
        throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate", e);
    } catch (IllegalAccessException e) {
        throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate", e);
    }
    m_storageStrategy.setResourceTypeName(m_name);
    if (getAgent() != null)
        m_storageStrategy.setStorageStrategyService(getAgent());
}
Also used : StorageStrategy(org.opennms.netmgt.collection.api.StorageStrategy) ObjectRetrievalFailureException(org.springframework.orm.ObjectRetrievalFailureException)

Aggregations

ObjectRetrievalFailureException (org.springframework.orm.ObjectRetrievalFailureException)22 OnmsResource (org.opennms.netmgt.model.OnmsResource)7 PrefabGraph (org.opennms.netmgt.model.PrefabGraph)7 StorageStrategy (org.opennms.netmgt.collection.api.StorageStrategy)4 Test (org.junit.Test)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Graph (org.opennms.netmgt.config.kscReports.Graph)2 OnmsCategory (org.opennms.netmgt.model.OnmsCategory)2 OnmsLocationMonitor (org.opennms.netmgt.model.OnmsLocationMonitor)2 OnmsNode (org.opennms.netmgt.model.OnmsNode)2 OnmsResourceType (org.opennms.netmgt.model.OnmsResourceType)2 ResourcePath (org.opennms.netmgt.model.ResourcePath)2 Resource (org.springframework.core.io.Resource)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 FileOutputStream (java.io.FileOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 StringWriter (java.io.StringWriter)1