From e72c7e9194dbd3cdfe7ae87b6767dc9ca25958d5 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 14 Feb 2019 12:35:56 +0100 Subject: [PATCH] remove left-over licensing support code from IDL preprocessor Signed-off-by: Erik Boasson --- .../src/org/eclipse/cyclonedds/Compiler.java | 37 +-- .../eclipse/cyclonedds/LicenseMgr.java.dummy | 25 -- .../eclipse/cyclonedds/LicenseMgr.java.rlm | 304 ------------------ .../cyclonedds/compilers/IdlcCmdOptions.java | 9 +- .../eclipse/cyclonedds/compilers/Idlcpp.java | 2 +- src/idlc/src/pom.xml.in | 11 - 6 files changed, 19 insertions(+), 369 deletions(-) delete mode 100644 src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.dummy delete mode 100644 src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.rlm diff --git a/src/idlc/src/org/eclipse/cyclonedds/Compiler.java b/src/idlc/src/org/eclipse/cyclonedds/Compiler.java index 0caec31..6c945e5 100644 --- a/src/idlc/src/org/eclipse/cyclonedds/Compiler.java +++ b/src/idlc/src/org/eclipse/cyclonedds/Compiler.java @@ -50,11 +50,6 @@ public class Compiler try { - if (!LicenseMgr.checkout (Project.nameCaps + "_IDLC")) - { - System.exit (1); - } - String pathSep = System.getProperty ("file.separator"); String outpath = (opts.outputdir == null) ? "" : opts.outputdir + pathSep; String fileRoot; @@ -98,7 +93,7 @@ public class Compiler { System.err.println ("Input IDL file " + idl.getPath () + " is not valid"); - licenseCheckAndExit (1); + System.exit (1); } fileRoot = idl.getName ().substring (0, idl.getName ().lastIndexOf ('.')); @@ -109,12 +104,12 @@ public class Compiler if (!ppstatus.isOK ()) { System.err.println ("Error: At " + ppstatus.getFilename () + ":" + ppstatus.getLine () + ", " + ppstatus.getMessage ()); - licenseCheckAndExit(1); + System.exit(1); } if (opts.pponly) { System.out.println (ppresult.toCharArray ()); - licenseCheckAndExit (0); + System.exit (0); } ANTLRInputStream input = @@ -136,7 +131,7 @@ public class Compiler System.out.println (t.getText ()); } } - licenseCheckAndExit (0); + System.exit (0); } params.linetab = @@ -149,7 +144,7 @@ public class Compiler ParserRuleContext tree = (ParserRuleContext)parser.specification (); if (parser.getNumberOfSyntaxErrors () != 0) { - licenseCheckAndExit (1); + System.exit (1); } if (opts.dumptree) { @@ -164,7 +159,7 @@ public class Compiler jd.setModalityType (java.awt.Dialog.ModalityType.APPLICATION_MODAL); jd.setVisible (true); } - licenseCheckAndExit(0); + System.exit(0); } params.symtab = new SymbolTable (); @@ -172,18 +167,18 @@ public class Compiler gst.visit (tree); if (gst.getErrorCount () != 0) { - licenseCheckAndExit (1); + System.exit (1); } if (gst.unresolvedSymbols ()) { - licenseCheckAndExit (1); + System.exit (1); } if (opts.dumpsymbols) { System.out.println ("Symbol table pass complete, symbols are:"); params.symtab.dump (); - licenseCheckAndExit (0); + System.exit (0); } params.basename = fileRoot; @@ -209,13 +204,13 @@ public class Compiler catch (IOException x) { System.err.format("IOException: %s%n", x); - licenseCheckAndExit (1); + System.exit (1); } } catch (RecognitionException r) { r.printStackTrace (); - licenseCheckAndExit (1); + System.exit (1); } } } @@ -223,16 +218,6 @@ public class Compiler { e.printStackTrace (); } - finally - { - LicenseMgr.checkin (); - } - } - - private static void licenseCheckAndExit (int exitStatus) - { - LicenseMgr.checkin (); - System.exit (exitStatus); } private static void version () diff --git a/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.dummy b/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.dummy deleted file mode 100644 index f252b50..0000000 --- a/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.dummy +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright(c) 2006 to 2018 ADLINK Technology Limited and others - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License - * v. 1.0 which is available at - * http://www.eclipse.org/org/documents/edl-v10.php. - * - * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause - */ -package org.eclipse.cyclonedds; - -class LicenseMgr -{ - static boolean checkout (String feature) - { - return true; - } - - static boolean checkin () - { - return true; - } -} diff --git a/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.rlm b/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.rlm deleted file mode 100644 index 28cb679..0000000 --- a/src/idlc/src/org/eclipse/cyclonedds/LicenseMgr.java.rlm +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright(c) 2006 to 2018 ADLINK Technology Limited and others - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License - * v. 1.0 which is available at - * http://www.eclipse.org/org/documents/edl-v10.php. - * - * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause - */ -package org.eclipse.cyclonedds; - -import com.reprisesoftware.rlm.RlmHandle; -import com.reprisesoftware.rlm.RlmLicense; -import com.reprisesoftware.rlm.RlmException; - -import java.util.Properties; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.File; - -class LicenseMgr -{ - private static final String FS = System.getProperty ("file.separator"); - - private static final String LIC_PROPS_FILE = "license.properties"; - private static final String LIC_FEATURE = Project.nameCaps + "_IDLC"; - private static final String LIC_VERSION = "#VERSION#"; - private static final String LIC_REL_PATH = "etc"; - private static final String LIC_FILE_NAME = "license.lic"; - private static final String PROJECT_HOME_PROP = Project.nameCaps + "_HOME"; - - private static final String LIC_RLM_PROP = "RLM_LICENSE"; - private static final String LIC_LOC_PROP = "prismtech_LICENSE"; - - private static RlmLicense license = null; - private static RlmHandle handle = null; - - private static String vlHome = System.getProperty (PROJECT_HOME_PROP); - private static String licPropsPath; - private static String defaultLic; - private static String licRelPath; - private static String licLoc = null; // Final var that contains where it is - - private LicenseMgr () - { - } - - private static boolean getProjectHome() - { - // Use the property, if null then fall back to the env - if (vlHome == null) - { - vlHome = System.getenv(Project.nameCaps + "_HOME"); - if (vlHome == null) - { - System.err.println (Project.nameCaps + "_HOME environment variable or property must be set"); - return false; - } - } - // Need to re-ajust each time we get osplHome - setupGlobals(); - return true; - } - - private static void setupGlobals() - { - licRelPath = vlHome + FS + LIC_REL_PATH + FS; - licPropsPath = licRelPath + LIC_PROPS_FILE; - defaultLic = licRelPath + LIC_FILE_NAME; - } - - - /* Locations for license: - 1 : ${PROJECTNAME}_HOME/etc/ANY.lic - 2 : ../../../license/ANY.lic - 3 : Read from environment variable prismtech_LICENSE or RLM_LICENSE - */ - - static boolean checkout (String feature) - { - try - { - String licLocProp = System.getProperty (LIC_LOC_PROP); - if (licLocProp == null) - { - licLocProp = System.getenv(LIC_LOC_PROP); - } - - if (licLocProp != null && licLocProp.length() != 0) - { - File f = new File(licLocProp); - if (f.exists()) - { - // Property pointed at a license file directly - licLoc = licLocProp; - } - else - { - String licFileLoc = licLocProp+FS+LIC_FILE_NAME; - f = new File(licFileLoc); - if (f.exists()) - { - // Property pointed at the directory containing - // a license.lic - licLoc = licFileLoc; - } - else - { - // Try whatever they put on the property as it could - // be the server setting - licLoc = licLocProp; - } - } - } - else - { - // check RLM_LICENSE - String licRlmProp = System.getProperty (LIC_RLM_PROP); - - if (licRlmProp == null) - { - licRlmProp = System.getenv(LIC_RLM_PROP); - } - - if (licRlmProp != null && licRlmProp.length() != 0) - { - File f = new File(licRlmProp); - if (f.exists()) - { - // Property pointed at a license file directly - licLoc = licRlmProp; - } - else - { - String licFileLoc = licRlmProp+FS+LIC_FILE_NAME; - f = new File(licFileLoc); - if (f.exists()) - { - // Property pointed at the directory containing - // a license.lic - licLoc = licFileLoc; - } - else - { - // Try whatever they put on the property as it could - // be the server setting - licLoc = licRlmProp; - } - } - } - } - - - // NOTE: VortexLite - This section is not used?? - if (licLoc == null) - { - // No Property set lets check for a properties file - FileInputStream fis = null; - Properties licProps = null; - - if (!getProjectHome()) - { - return false; - } - - // check for license file location in properties file - File f = new File(licPropsPath); - if (f.exists()) - { - licProps = new Properties (); - try - { - fis = new FileInputStream (licPropsPath); - licProps.load (fis); - } - catch (FileNotFoundException ex) - {} // Ignore - finally - { - fis.close(); - } - String licFileLoc = licProps.getProperty (LIC_LOC_PROP); - if (licFileLoc == null) - { - licFileLoc = System.getenv(LIC_LOC_PROP); - } - if (licFileLoc != null) - { - // Property pointed at the directory containing it - licLoc = licFileLoc; - } - } - } - - if (licLoc == null) - { - // No valid source set or found use the default as - // ${PROJECTNAME}_HOME/etc/license.lic as fall back - if (!getProjectHome()) - { - return false; - } - - File f = new File(defaultLic); - if (f.exists()) - { - // Property pointed at the directory containing a license.lic - licLoc = defaultLic; - } - else - { - // Try whatever they put on the property - licLoc = licRelPath; - } - } - - handle = new RlmHandle(licLoc, "", ""); - license = new RlmLicense(handle, feature, LIC_VERSION, 1); - return true; - } - catch (Exception ex) - { - // From Vortex_v2 there will be a license directory under Vortex_v2 where - // a license can be installed for use by all products. If a valid license - // is not found in the normal locations then we check this directory for a - // valid license. The location of the Vortex_v2 directory will be set by - // the release.com/release.bat file. - - String altLicRelPath = vlHome + FS + ".." + FS + ".." + FS + ".." + FS + "license"; - String altDefaultLic = null; - - if (altLicRelPath != null) - { - try - { - altDefaultLic = altLicRelPath + FS + "license" + FS + LIC_FILE_NAME; - File f = new File(altDefaultLic); - if (f.exists()) - { - // Property pointed at the directory containing a license.lic - licLoc = altDefaultLic; - } - else - { - // Try whatever they put on the property - licLoc = altLicRelPath; - } - handle = new RlmHandle(licLoc, "", ""); - license = new RlmLicense(handle, feature, LIC_VERSION, 1); - return true; - } - catch (Exception ex2) - { - System.err.println ("dds_idlc: License checkout failed!"); - System.err.print (" Caught " + ex2.getClass().getName() + ": "); - System.err.println (ex2.getMessage()); - } - } - else - { - System.err.println ("dds_idlc: License checkout failed!"); - System.err.print (" Caught " + ex.getClass().getName() + ": "); - System.err.println (ex.getMessage()); - } - - // If we get here then we have not found a valid license - if (license != null) - { - license.checkin (); - } - if (handle != null) - { - handle.close(); - } - } - return false; - } - - static boolean checkin () - { - if (license != null) - { - try - { - license.checkin (); - if (handle != null) - { - handle.close (); - } - return true; - } - catch (Exception ex) - { - System.err.println ("dds_idlc: License checkin failed!"); - System.err.print (" Caught " + ex.getClass().getName() + ": "); - System.err.println (ex.getMessage()); - } - } - - return false; - } -} diff --git a/src/idlc/src/org/eclipse/cyclonedds/compilers/IdlcCmdOptions.java b/src/idlc/src/org/eclipse/cyclonedds/compilers/IdlcCmdOptions.java index 4830424..2788bab 100644 --- a/src/idlc/src/org/eclipse/cyclonedds/compilers/IdlcCmdOptions.java +++ b/src/idlc/src/org/eclipse/cyclonedds/compilers/IdlcCmdOptions.java @@ -35,7 +35,8 @@ public class IdlcCmdOptions extends CmdOptions io.println (" -notopics Generate type definitions only"); io.println (" -nostamp Do not timestamp generated code"); io.println (" -lax Skip over structs containing unsupported datatypes"); - io.println (" -quiet Suppress console output other than error messages"); + io.println (" -quiet Suppress console output other than error messages (default)"); + io.println (" -verbose Enable console ouptut other than error messages"); io.println (" -map_wide Map the unsupported wchar and wstring types to char and string"); io.println (" -map_longdouble Map the unsupported long double type to double"); } @@ -72,6 +73,10 @@ public class IdlcCmdOptions extends CmdOptions { quiet = true; } + else if (arg1.equals ("-verbose") || arg1.equals ("-v")) + { + quiet = false; + } else if (arg1.equals ("-lax")) { lax = true; @@ -111,7 +116,7 @@ public class IdlcCmdOptions extends CmdOptions public boolean allstructs; public boolean notopics; public boolean nostamp; - public boolean quiet; + public boolean quiet = true; public boolean lax; public boolean mapwide; public boolean mapld; diff --git a/src/idlc/src/org/eclipse/cyclonedds/compilers/Idlcpp.java b/src/idlc/src/org/eclipse/cyclonedds/compilers/Idlcpp.java index dfe02ed..e56157a 100644 --- a/src/idlc/src/org/eclipse/cyclonedds/compilers/Idlcpp.java +++ b/src/idlc/src/org/eclipse/cyclonedds/compilers/Idlcpp.java @@ -34,7 +34,7 @@ public class Idlcpp if (opts.version) { - System.out.print ("Cyclone DDS "); + System.out.print ("Eclipse Cyclone DDS "); System.out.println ("IDL to C++ compiler v" + Project.version); } else diff --git a/src/idlc/src/pom.xml.in b/src/idlc/src/pom.xml.in index 9767115..f5e8ad9 100644 --- a/src/idlc/src/pom.xml.in +++ b/src/idlc/src/pom.xml.in @@ -95,17 +95,6 @@ target/generated-sources/idlc/org/eclipse/cyclonedds/Project.java - - copy-LicenseMgr - generate-sources - - copy - - - ${basedir}/org/eclipse/cyclonedds/LicenseMgr.java.dummy - target/generated-sources/idlc/org/eclipse/cyclonedds/LicenseMgr.java - -