aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/common
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-12 16:20:47 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-12 16:20:47 -0800
commit3455cb5df0de8612d074198b55e1ecec8a8db123 (patch)
treea27ea5bcccee4f3705d9f9e512353537aaac4c58 /framework/src/onos/core/common
parent03974824abae35128f53f5a4af9a4ed8f573601a (diff)
ONOS update to commit id "761f0040f3ce4f33a38377c7f737145b603aa334
Change-Id: Ib76e3935c50fc275f803f17cffbc511e0a91f5d1 Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/core/common')
-rw-r--r--framework/src/onos/core/common/src/main/java/org/onosproject/codec/impl/ApplicationCodec.java8
-rw-r--r--framework/src/onos/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java13
-rw-r--r--framework/src/onos/core/common/src/test/java/org/onosproject/store/trivial/SimpleApplicationStore.java6
3 files changed, 17 insertions, 10 deletions
diff --git a/framework/src/onos/core/common/src/main/java/org/onosproject/codec/impl/ApplicationCodec.java b/framework/src/onos/core/common/src/main/java/org/onosproject/codec/impl/ApplicationCodec.java
index b2cab094..a09c0bdb 100644
--- a/framework/src/onos/core/common/src/main/java/org/onosproject/codec/impl/ApplicationCodec.java
+++ b/framework/src/onos/core/common/src/main/java/org/onosproject/codec/impl/ApplicationCodec.java
@@ -32,18 +32,18 @@ public final class ApplicationCodec extends JsonCodec<Application> {
public ObjectNode encode(Application app, CodecContext context) {
checkNotNull(app, "Application cannot be null");
ApplicationService service = context.getService(ApplicationService.class);
- ObjectNode result = context.mapper().createObjectNode()
+ return context.mapper().createObjectNode()
.put("name", app.id().name())
.put("id", app.id().id())
.put("version", app.version().toString())
.put("description", app.description())
.put("origin", app.origin())
- .put("permissions", app.permissions().toString())
+ .put("permissions", app.permissions().toString()) // FIXME: change to an array
.put("featuresRepo", app.featuresRepo().isPresent() ?
app.featuresRepo().get().toString() : "")
- .put("features", app.features().toString())
+ .put("features", app.features().toString()) // FIXME: change to an array
+ .put("requiredApps", app.requiredApps().toString()) // FIXME: change to an array
.put("state", service.getState(app.id()).toString());
- return result;
}
}
diff --git a/framework/src/onos/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java b/framework/src/onos/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
index 54f0fb89..37cdbdfc 100644
--- a/framework/src/onos/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
+++ b/framework/src/onos/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
@@ -17,6 +17,7 @@ package org.onosproject.common.app;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import org.apache.commons.configuration.ConfigurationException;
@@ -33,7 +34,6 @@ import org.onosproject.core.Version;
import org.onosproject.security.AppPermission;
import org.onosproject.security.Permission;
import org.onosproject.store.AbstractStore;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +46,6 @@ import java.io.InputStream;
import java.net.URI;
import java.nio.charset.Charset;
import java.nio.file.NoSuchFileException;
-import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Set;
@@ -79,6 +78,7 @@ public class ApplicationArchive
private static final String VERSION = "[@version]";
private static final String FEATURES_REPO = "[@featuresRepo]";
private static final String FEATURES = "[@features]";
+ private static final String APPS = "[@apps]";
private static final String DESCRIPTION = "description";
private static final String ROLE = "security.role";
@@ -291,8 +291,13 @@ public class ApplicationArchive
URI featuresRepo = featRepo != null ? URI.create(featRepo) : null;
List<String> features = ImmutableList.copyOf(cfg.getString(FEATURES).split(","));
+ String apps = cfg.getString(APPS, "");
+ List<String> requiredApps = apps.isEmpty() ?
+ ImmutableList.of() : ImmutableList.copyOf(apps.split(","));
+
return new DefaultApplicationDescription(name, version, desc, origin, role,
- perms, featuresRepo, features);
+ perms, featuresRepo, features,
+ requiredApps);
}
// Expands the specified ZIP stream into app-specific directory.
@@ -390,7 +395,7 @@ public class ApplicationArchive
// Returns the set of Permissions specified in the app.xml file
private ImmutableSet<Permission> getPermissions(XMLConfiguration cfg) {
- List<Permission> permissionList = new ArrayList();
+ List<Permission> permissionList = Lists.newArrayList();
for (Object o : cfg.getList(APP_PERMISSIONS)) {
String name = (String) o;
diff --git a/framework/src/onos/core/common/src/test/java/org/onosproject/store/trivial/SimpleApplicationStore.java b/framework/src/onos/core/common/src/test/java/org/onosproject/store/trivial/SimpleApplicationStore.java
index ea9a773e..d9f5285c 100644
--- a/framework/src/onos/core/common/src/test/java/org/onosproject/store/trivial/SimpleApplicationStore.java
+++ b/framework/src/onos/core/common/src/test/java/org/onosproject/store/trivial/SimpleApplicationStore.java
@@ -75,7 +75,8 @@ public class SimpleApplicationStore extends ApplicationArchive implements Applic
new DefaultApplication(appId, appDesc.version(),
appDesc.description(), appDesc.origin(),
appDesc.role(), appDesc.permissions(),
- appDesc.featuresRepo(), appDesc.features());
+ appDesc.featuresRepo(), appDesc.features(),
+ appDesc.requiredApps());
apps.put(appId, app);
states.put(appId, isActive(name) ? INSTALLED : ACTIVE);
// load app permissions
@@ -117,7 +118,8 @@ public class SimpleApplicationStore extends ApplicationArchive implements Applic
DefaultApplication app =
new DefaultApplication(appId, appDesc.version(), appDesc.description(),
appDesc.origin(), appDesc.role(), appDesc.permissions(),
- appDesc.featuresRepo(), appDesc.features());
+ appDesc.featuresRepo(), appDesc.features(),
+ appDesc.requiredApps());
apps.put(appId, app);
states.put(appId, INSTALLED);
delegate.notify(new ApplicationEvent(APP_INSTALLED, app));