2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalsdk.analytics.system.fusion;
22 import java.io.IOException;
23 import java.util.Iterator;
25 import java.util.jar.Attributes;
26 import java.util.jar.JarFile;
27 import java.util.jar.Manifest;
31 * This class is used to get version and Build information when
32 * user run "java -jar raptor_fusion.jar" command.
34 public class AntBuild {
36 public static void main(String[] args) {
37 System.out.println("Jar (raptor_fusion.jar) Information: ");
41 public static void readManifest() {
43 JarFile jar = new JarFile("./raptor_fusion.jar");
44 Manifest manifest = jar.getManifest();
46 Attributes attribs = manifest.getMainAttributes();
47 Iterator it = attribs.entrySet().iterator();
49 Map.Entry entry = (Map.Entry) it.next();
50 Attributes.Name attributeName = (Attributes.Name) entry.getKey();
51 String attributeValue = (String) entry.getValue();
52 if (attributeName.toString().equals("Created-By"))
53 System.out.println("JDK Version " + " : " + attributeValue);
54 else if (attributeName.toString().equals("Ant-Version"))
55 System.out.println(attributeName.toString() + " : " + attributeValue);
57 if(attributeName.toString().startsWith("Raptor"))
58 System.out.println(attributeName.toString() + " : " + attributeValue);
62 } catch (IOException e) {
63 System.err.println("Cannot read jar-file manifest: "