+
+ private String getAuthorizedContainer(HttpServletRequest request, String container) {
+ String username = request.getUserPrincipal().getName();
+ IContainerAuthorization containerAuthorization = (IContainerAuthorization) ServiceHelper.
+ getGlobalInstance(IContainerAuthorization.class, this);
+ if (containerAuthorization != null) {
+ Set<Resource> resources = containerAuthorization.getAllResourcesforUser(username);
+ if (authorizeContainer(container, resources)) {
+ return container;
+ }
+ }
+
+ return GlobalConstants.DEFAULT.toString();
+ }
+
+ private boolean authorizeContainer(String container, Set<Resource> resources) {
+ for(Resource resource : resources) {
+ String containerName = (String) resource.getResource();
+ if (containerName.equals(container)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ metaCache = (Map<String, Map<String, Map<String, Object>>>) objReader.read(this, topologyWebFileName);
+ if (metaCache == null) metaCache = new HashMap<String, Map<String, Map<String, Object>>>();
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ objWriter.write(metaCache, topologyWebFileName);
+ return new Status(StatusCode.SUCCESS, null);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois)
+ throws FileNotFoundException, IOException, ClassNotFoundException {
+ // Perform the class deserialization locally, from inside the package where the class is defined
+ return ois.readObject();
+ }
+}
\ No newline at end of file