Merge "Fix the MSB portal url"
authorManoop Talasila <talasila@research.att.com>
Wed, 12 Sep 2018 15:49:12 +0000 (15:49 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 12 Sep 2018 15:49:12 +0000 (15:49 +0000)
INFO.yaml [new file with mode: 0644]
deliveries/.env
docs/release-notes.rst
ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/InitializationServiceImpl.java

diff --git a/INFO.yaml b/INFO.yaml
new file mode 100644 (file)
index 0000000..5ce7de9
--- /dev/null
+++ b/INFO.yaml
@@ -0,0 +1,45 @@
+---
+project: 'portal'
+project_creation_date: '2017-02-02'
+project_category: ''
+lifecycle_state: 'Incubation'
+project_lead: &onap_portal_ptl
+    name: 'Manoop Talasila'
+    email: 'mt2061@att.com'
+    id: 'mt2061'
+    company: 'ATT'
+    timezone: 'America/New_York'
+primary_contact: *onap_portal_ptl
+issue_tracking:
+    type: 'jira'
+    url: 'https://jira.onap.org/projects/PORTAL'
+    key: 'PORTAL'
+mailing_list:
+    type: 'groups.io'
+    url: 'lists.onap.org'
+    tag: '<[sub-project_name]>'
+realtime_discussion: ''
+meetings:
+    - type: 'zoom'
+      agenda: 'https://wiki.onap.org/pages/viewpage.action?pageId=10782705'
+      url: 'https://wiki.onap.org/pages/viewpage.action?pageId=10782705'
+      server: 'n/a'
+      channel: 'n/a'
+      repeats: 'weekly'
+      time: '15:00 UTC (DST)'
+repositories:
+    - 'portal'
+committers:
+    - <<: *onap_portal_ptl
+    - name: 'Manoop Talasila'
+      email: 'mt2061@att.com'
+      company: 'ATT'
+      id: 'mt2061'
+      timezone: 'America/New_York'
+    - name: 'Sunder Tattavarada'
+      email: 'st782s@att.com'
+      company: 'ATT'
+      id: 'st782s'
+      timezone: 'America/New_York'
+tsc:
+    approval: 'https://lists.onap.org/pipermail/onap-tsc'
index 7325959..3b2fa14 100644 (file)
@@ -14,11 +14,11 @@ CLI_IMG_NAME=onap/cli
 
 # This is the first portion of the Docker image tag
 # that is published to the ONAP registry.
-PORTAL_VERSION=v2.3.0
+PORTAL_VERSION=2.3.0
 
 # This is used during builds and in docker-compose;
 # it is never published to the ONAP registry.
-PORTAL_TAG=beijing
+PORTAL_TAG=casablanca
 
 # Name of directory in apps container (NOT host)
 WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps
index 43803ad..b0c3f33 100644 (file)
@@ -6,6 +6,37 @@
 Portal Platform Release Notes
 =============================
 
+Version: 2.3.0
+--------------
+:Release Date: XXXX-XX-XX
+
+.. toctree::
+    :maxdepth: 1
+
+We worked on SDK upgrade to integrate with AAF.
+
+**New Features**
+        * Portal SDK (2.4.0)
+               * Use of Semantic Versioning - V3 is the supported version 
+               * Integration with AAF via REST; Supports both SDK and Framework Applicaitons
+               
+**Bug Fixes**
+
+
+**Known Issues**
+
+**Security Issues**
+
+**Security Notes**
+
+**Upgrade Notes**
+
+**Deprecation Notes**
+
+**Other**
+       * portal/sdk - (Release branch: "release-2.4.0")
+        
+
 Version: 2.2.0
 --------------
 
index 7d3bfee..b550863 100644 (file)
@@ -72,47 +72,50 @@ public class ExtractJar {
                String classContainer = clazz.getProtectionDomain().getCodeSource().getLocation().toString();
                URL jarUrl = clazz.getProtectionDomain().getCodeSource().getLocation();
 
-               JarInputStream entryStream = new JarInputStream(jarUrl.openStream());
-               JarEntry entry;
-               while (true) {
-                       entry = entryStream.getNextJarEntry();
-                       if (entry == null)
-                               break;
-                       if (entry.getName().indexOf("jarutil") < 0) {
-                               logger.info(entry.getName());
-                               File file = new File(directory, entry.getName());
-                               if (entry.isDirectory()) {
-                                       if (!file.exists())
-                                               file.mkdirs();
-                               } else {
-                                       // make directory (some jars don't list dirs)
-                                       File dir = new File(file.getParent());
-                                       if (!dir.exists())
-                                               dir.mkdirs();
-                                       if (file.exists())
-                                               file.delete();
-                                       // Make file
-                                       FileOutputStream fout = new FileOutputStream(file);
-                                       copy(entryStream, fout);
-                                       fout.close();
-
-                                       // touch the file.
-                                       if (entry.getTime() >= 0)
-                                               file.setLastModified(entry.getTime());
+               try(JarInputStream entryStream = new JarInputStream(jarUrl.openStream())){
+                       JarEntry entry;
+                       while (true) {
+                               entry = entryStream.getNextJarEntry();
+                               if (entry == null)
+                                       break;
+                               if (entry.getName().indexOf("jarutil") < 0) {
+                                       logger.info(entry.getName());
+                                       File file = new File(directory, entry.getName());
+                                       if (entry.isDirectory()) {
+                                               if (!file.exists())
+                                                       file.mkdirs();
+                                       } else {
+                                               // make directory (some jars don't list dirs)
+                                               File dir = new File(file.getParent());
+                                               if (!dir.exists())
+                                                       dir.mkdirs();
+                                               if (file.exists())
+                                                       file.delete();
+                                               // Make file
+                                               FileOutputStream fout = new FileOutputStream(file);
+                                               copy(entryStream, fout);
+                                               fout.close();
+       
+                                               // touch the file.
+                                               if (entry.getTime() >= 0)
+                                                       file.setLastModified(entry.getTime());
+                                       }
+       
                                }
-
+                               entryStream.closeEntry();
                        }
-                       entryStream.closeEntry();
+                       System.out.println("************************************************");
+                       System.out.println("*                                              *");
+                       System.out.println("*                                              *");
+                       System.out.println("*          RAPTOR SETUP COMPLETE.              *");
+                       System.out.println("*                                              *");
+                       System.out.println("*         Thank you for upgrading.             *");
+                       System.out.println("*                                              *");
+                       System.out.println("************************************************");
+               }catch(Exception e) {
+                       logger.error("Exception in extractFilesFromJar",e);
                }
-               entryStream.close();
-               System.out.println("************************************************");
-               System.out.println("*                                              *");
-               System.out.println("*                                              *");
-               System.out.println("*          RAPTOR SETUP COMPLETE.              *");
-               System.out.println("*                                              *");
-               System.out.println("*         Thank you for upgrading.             *");
-               System.out.println("*                                              *");
-               System.out.println("************************************************");
+               
        }
 
        public static void copy(InputStream in, OutputStream out, long byteCount) throws IOException {
index d05fe01..a7ce355 100644 (file)
@@ -377,32 +377,38 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                                .getBody();
 
                File downloadFile = File.createTempFile("temp", ".zip");
-               FileOutputStream stream = new FileOutputStream(downloadFile.getPath());
-               stream.write(byteFile);
-               stream.close();
-
-               FileInputStream inputStream = new FileInputStream(downloadFile);
-               String mimeType = context.getMimeType(downloadFile.getPath());
-               if (mimeType == null) {
-                       mimeType = "application/octet-stream";
+               try(FileOutputStream stream = new FileOutputStream(downloadFile.getPath())){
+                       stream.write(byteFile);
+               }catch(Exception e)
+               {
+                       logger.error(EELFLoggerDelegate.errorLogger, "doDownload failed", e);
+                       throw e;
                }
 
-               response.setContentType(mimeType);
-               response.setContentLength((int) downloadFile.length());
-               String headerKey = "Content-Disposition";
-               String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName());
-               downloadFile.delete();
-               response.setHeader(headerKey, headerValue);
-
-               OutputStream outStream = response.getOutputStream();
-               byte[] buffer = new byte[32 * 1024];
-               int bytesRead;
-               while ((bytesRead = inputStream.read(buffer)) != -1) {
-                       outStream.write(buffer, 0, bytesRead);
-               }
+               try(FileInputStream inputStream = new FileInputStream(downloadFile);
+                       OutputStream outStream = response.getOutputStream()){
+                       String mimeType = context.getMimeType(downloadFile.getPath());
+                       if (mimeType == null) {
+                               mimeType = "application/octet-stream";
+                       }
 
-               inputStream.close();
-               outStream.close();
+                       response.setContentType(mimeType);
+                       response.setContentLength((int) downloadFile.length());
+                       String headerKey = "Content-Disposition";
+                       String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName());
+                       downloadFile.delete();
+                       response.setHeader(headerKey, headerValue);
+       
+                       byte[] buffer = new byte[32 * 1024];
+                       int bytesRead;
+                       while ((bytesRead = inputStream.read(buffer)) != -1) {
+                               outStream.write(buffer, 0, bytesRead);
+                       }
+               }catch(Exception e)
+               {
+                       logger.error(EELFLoggerDelegate.errorLogger, "doDownload failed", e);
+                       throw e;
+               }
        }
 
        @RequestMapping(value = { "/portalApi/microservices/parameters" }, method = RequestMethod.POST)
index 825d33a..1886b8b 100644 (file)
@@ -157,7 +157,7 @@ public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {
                                client = HttpsBasicClient.getClient();
                        }
                } catch (Exception e) {
-                       logger.debug(EELFLoggerDelegate.debugLogger, "Unable to initialize rest client");
+                       logger.debug(EELFLoggerDelegate.debugLogger, "Unable to initialize rest client",e.getMessage());
 
                }
                logger.debug(EELFLoggerDelegate.debugLogger, "Client Initialized");
index cbc0c9d..c9365c4 100644 (file)
@@ -114,18 +114,13 @@ public class InitializationServiceImpl implements InitializationService {
                        long widgetId = widgetCatalogService.saveWidgetCatalog(newWidget);
 
                        File tmpZipFile = new File("/tmp/" + fileLocation);
-                       InputStream fileInputStream = null;
-                       OutputStream outputStream = null;
-                       try {
-                               fileInputStream = this.getClass().getClassLoader().getResourceAsStream(fileLocation);
-                               outputStream = new FileOutputStream(tmpZipFile);
+                       try(OutputStream outputStream = new FileOutputStream(tmpZipFile);
+                               InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream(fileLocation)) {
                                int read = 0;
                                byte[] bytes = new byte[4096];
                                while ((read = fileInputStream.read(bytes)) != -1) {
                                        outputStream.write(bytes, 0, read);
                                }
-                               outputStream.close();
-                               fileInputStream.close();
                        } catch (Exception e) {
                                logger.error(
                                                "Exception occurred while performing InitializationServiceImpl.initCommonWidget in widget microservices. Details:", e);