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);
}
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();
}
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
}
}
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;
}
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;
}
Aggregations