Search in sources :

Example 6 with ApplicationDescription

use of org.onosproject.app.ApplicationDescription in project onos by opennetworkinglab.

the class ApplicationArchiveTest method loadApp.

@Test
public void loadApp() throws IOException {
    saveZippedApp();
    ApplicationDescription app = aar.getApplicationDescription(APP_NAME);
    validate(app);
}
Also used : ApplicationDescription(org.onosproject.app.ApplicationDescription) Test(org.junit.Test) DefaultApplicationDescriptionTest(org.onosproject.app.DefaultApplicationDescriptionTest)

Example 7 with ApplicationDescription

use of org.onosproject.app.ApplicationDescription in project onos by opennetworkinglab.

the class ApplicationArchiveTest method saveZippedApp.

@Test
public void saveZippedApp() throws IOException {
    InputStream stream = getClass().getResourceAsStream("app.zip");
    ApplicationDescription app = aar.saveApplication(stream);
    validate(app);
    stream.close();
}
Also used : InputStream(java.io.InputStream) ApplicationDescription(org.onosproject.app.ApplicationDescription) Test(org.junit.Test) DefaultApplicationDescriptionTest(org.onosproject.app.DefaultApplicationDescriptionTest)

Example 8 with ApplicationDescription

use of org.onosproject.app.ApplicationDescription in project onos by opennetworkinglab.

the class SimpleApplicationStore method loadFromDisk.

private void loadFromDisk() {
    for (String name : getApplicationNames()) {
        ApplicationId appId = idStore.registerApplication(name);
        ApplicationDescription appDesc = getApplicationDescription(name);
        DefaultApplication app = DefaultApplication.builder(appDesc).withAppId(appId).build();
        apps.put(appId, app);
        states.put(appId, isActive(name) ? INSTALLED : ACTIVE);
    // load app permissions
    }
}
Also used : DefaultApplication(org.onosproject.core.DefaultApplication) ApplicationId(org.onosproject.core.ApplicationId) ApplicationDescription(org.onosproject.app.ApplicationDescription)

Example 9 with ApplicationDescription

use of org.onosproject.app.ApplicationDescription in project onos by opennetworkinglab.

the class DistributedApplicationStore method convertApplication.

/**
 * Converts the version of the application in store to the version of the local application.
 */
private InternalApplicationHolder convertApplication(InternalApplicationHolder appHolder, Version version) {
    // Load the application description from disk. If the version doesn't match the persisted
    // version, update the stored application with the new version.
    ApplicationDescription appDesc = null;
    try {
        appDesc = getApplicationDescription(appHolder.app.id().name());
    } catch (ApplicationException e) {
        // If external application is not present then just ignore it as it will be installed from other onos nodes
        log.warn("Application : {} not found in disk", appHolder.app.id().name());
    }
    if (appDesc != null && !appDesc.version().equals(appHolder.app().version())) {
        log.info("Updating app version to : {} in store for app : {}", appDesc.version(), appHolder.app.id());
        Application newApplication = DefaultApplication.builder(appDesc).withAppId(appHolder.app.id()).build();
        return new InternalApplicationHolder(newApplication, appHolder.state, appHolder.permissions);
    }
    return appHolder;
}
Also used : ApplicationException(org.onosproject.app.ApplicationException) Application(org.onosproject.core.Application) DefaultApplication(org.onosproject.core.DefaultApplication) ApplicationDescription(org.onosproject.app.ApplicationDescription)

Example 10 with ApplicationDescription

use of org.onosproject.app.ApplicationDescription in project onos by opennetworkinglab.

the class SimpleApplicationStore method create.

@Override
public Application create(InputStream appDescStream) {
    ApplicationDescription appDesc = saveApplication(appDescStream);
    ApplicationId appId = idStore.registerApplication(appDesc.name());
    DefaultApplication app = DefaultApplication.builder(appDesc).withAppId(appId).build();
    apps.put(appId, app);
    states.put(appId, INSTALLED);
    delegate.notify(new ApplicationEvent(APP_INSTALLED, app));
    return app;
}
Also used : ApplicationEvent(org.onosproject.app.ApplicationEvent) DefaultApplication(org.onosproject.core.DefaultApplication) ApplicationId(org.onosproject.core.ApplicationId) ApplicationDescription(org.onosproject.app.ApplicationDescription)

Aggregations

ApplicationDescription (org.onosproject.app.ApplicationDescription)11 InputStream (java.io.InputStream)5 Test (org.junit.Test)4 ApplicationException (org.onosproject.app.ApplicationException)4 DefaultApplicationDescriptionTest (org.onosproject.app.DefaultApplicationDescriptionTest)4 ApplicationId (org.onosproject.core.ApplicationId)4 DefaultApplication (org.onosproject.core.DefaultApplication)4 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 ApplicationEvent (org.onosproject.app.ApplicationEvent)2 Charsets (com.google.common.base.Charsets)1 MoreObjects (com.google.common.base.MoreObjects)1 Preconditions (com.google.common.base.Preconditions)1 Throwables (com.google.common.base.Throwables)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Multimap (com.google.common.collect.Multimap)1 Multimaps.newSetMultimap (com.google.common.collect.Multimaps.newSetMultimap)1 Multimaps.synchronizedSetMultimap (com.google.common.collect.Multimaps.synchronizedSetMultimap)1