得到Rapidminerstudio license details from Java program

lplenkalplenka MemberPosts:11Contributor II
edited December 2019 inHelp

I am running rapidminer studio from java file and want to get the license information of currently installed Rapidminer Studio like license type, constraints and to whom the license is registered.

Here is the initial code. I need some help to get these information.

package rapidminer;
import com.lowagie.text.Annotation;
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.nio.ExcelExampleSource;
import com.rapidminer.tools.XMLException;
import java.io.File;
import java.io.IOException;
import com.rapidminer.license.License;

public class rapid {

public static void main(String[] args) {
try {
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
RapidMiner.init();

} catch(Exception ex) {
ex.printStackTrace();
}
}
}

Answers

  • lplenkalplenka MemberPosts:11Contributor II

    I did some research and got the license details using this java program

    package rapidminer;
    import com.lowagie.text.Annotation;
    import com.rapidminer.Process;
    import com.rapidminer.RapidMiner;
    import com.rapidminer.RapidMinerVersion;
    import com.rapidminer.operator.Operator;
    import com.rapidminer.operator.OperatorException;
    import com.rapidminer.operator.nio.ExcelExampleSource;
    import com.rapidminer.tools.FileSystemService;
    import com.rapidminer.tools.XMLException;
    import java.io.File;
    import java.io.IOException;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    import java.util.List;

    import com.rapidminer.license.License;
    import com.rapidminer.license.LicenseConstants;
    import com.rapidminer.core.license.*;
    import com.rapidminer.license.LicenseUser;
    import com.rapidminer.license.LicenseManagerRegistry;
    import com.rapidminer.gui.RapidMinerGUI;
    import com.rapidminer.gui.license.LicenseTools;
    import com.rapidminer.license.location.LicenseLoadingException;
    import com.rapidminer.license.location.LicenseLocation;
    import com.rapidminer.license.location.LicenseStoringException;
    import com.rapidminer.license.product.Constraint;
    import com.rapidminer.license.product.DefaultProduct;
    import com.rapidminer.license.product.Product;
    import com.rapidminer.license.product.NumericalConstraint;
    import com.rapidminer.license.location.FileLicenseLocation;
    public class rapid {

    public static void main(String[] args) {
    try {


    RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
    RapidMiner.init();

    License license =ProductConstraintManager.INSTANCE.getActiveLicense();
    Product product = ProductConstraintManager.INSTANCE.getProduct();
    String ProductEdition = LicenseTools.translateProductEdition(license);
    String registered_to = license.getLicenseUser().getEmail();
    String limit = license.getConstraints().getConstraintValue(ProductConstraintManager.INSTANCE.getDataRowConstraint());
    String logical_processor = license.getConstraints().getConstraintValue(ProductConstraintManager.INSTANCE.getLogicalProcessorConstraint());

    System.out.println("license: " + license);
    System.out.println("Product Edition:" + ProductEdition);
    System.out.println("Version: " + RapidMiner.getLongVersion());
    System.out.println(license.getProductId());
    System.out.println(license.getProductEdition());
    System.out.println("limit: " + limit );
    System.out.println("Number of logical processors: " + logical_processor );


    } catch(Exception ex) {
    ex.printStackTrace();
    }
    }
    }

    Output:-

    license:[email protected]

    Product Edition: Free (uninitialized)
    Version: 8.1.000
    rapidminer-studio
    starter
    limit: 10000
    Number of logical processors: 1

    But I am using an educational license and the output is clearly for free(uninitialized) version. Why is the output like this?

  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, MemberPosts:299RM Data Scientist

    Hi@lplenka,

    Have you started RapidMiner Studio once in GUI mode and checked if your license has been correctly identified there?

    Hint: It is always displayed above the menu bar.

    At least on Windows in your personal .RapidMiner\licenses\rapidminer-studio folder are all licenses stored which have ever been installed.

    Is your educational license available there?

    Best,

    Edin

  • lplenkalplenka MemberPosts:11Contributor II

    yes@Edin_KlapicI am using Linux and can find the license in "home/.Rapidminer/licenses/rapidminer-studio/" folder. It contains both my free license and educational license.

    And yes I have started the GUI mode earlier. I always see "Educational License registered to xyz" in the splash screen.

    It seems through java program "Rapidminer.init()" always opens the "Free (uninitialized)" version.

    I tried the other way using "Rapidminer.init(Product product, LicenseLocation licenselocation)", that also didn't work.:(

    Here is the extra part of code.

    final Path MAIN_LICENSE_PATH = Paths.get(new File(FileSystemService.getUserRapidMinerDir(), "licenses").toURI());
    final Product DEFAULT_PRODUCT = new DefaultProduct("rapidminer-studio", "7.2+", false, "Rmfgu6rDLgqPCIBl/WzEWmVW4O8cPHF2yPMQvTTAWZGDIwhMadeRmMK6e3V/VW+VOrdKKPHCHB3PtzNQAVGWHrKsv3tmKivQGNIQOSG8192araFXSGHpapQhWFf+8gjsDlf1Dbbt2ZRSf/Gmiinb2JcoT6x+NQiZfkXUFVeOEGyAJLUufKCAdvTu2bzkbexdfcJAvTSzqn2VwgFThg4zRzLxoO2hElT6DHWmr3pi2iLnzVgcM0ifJYdTYsTnAk0fhSijpVv3jMbL81ehUh8iJSQlXoutVcxYFAviMhlBlKb/3dgLhBlG8F12epF20WNSyewCRM8ysANZbzP9qcOf+w==", new Constraint[] { LicenseConstants.DATA_ROW_CONSTRAINT, LicenseConstants.LOGICAL_PROCESSOR_CONSTRAINT, LicenseConstants.MEMORY_LIMIT_CONSTRAINT, LicenseConstants.WEB_SERVICE_LIMIT_CONSTRAINT });LicenseLocation licenseLocation = new FileLicenseLocation(MAIN_LICENSE_PATH, new Path[0]);
    LicenseLocation licenseLocation = new FileLicenseLocation(MAIN_LICENSE_PATH, new Path[0]);
    RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
    RapidMiner.init(DEFAULT_PRODUCT, licenseLocation);

    I might be doing something wrong here, but can't find it.

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University ProfessorPosts:3,362RM Data Scientist

    Hi,

    this is how i get the active license in my word2vec extension:

    License activeLicense = ProductConstraintManager.INSTANCE.getActiveLicense();

    where ProductContraintManager comes from

    import com.rapidminer.core.license.ProductConstraintManager;

    See:https://github.com/rapidminer/rapidminer-studio/blob/master/src/main/java/com/rapidminer/core/license/ProductConstraintManager.java

    I guess that's what you need:)

    Best,

    Martin

    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
    sgenzer
  • jczogallajczogalla Employee, MemberPosts:144RM Engineering

    Hi,

    sadly I have to correct@mschmitza little here. Since this is in an extension, this uses the fully initialized RapidMinerGUI, which uses a closed source license manager. If you simply integrate RM in your Java application, there will only be the OpenSource license manager which will always return the free license. You need to have an OEM license to use the closed source features.

    What exactly is your use case for this if I may ask?

    Cheers

    Jan

    sgenzer
  • lplenkalplenka MemberPosts:11Contributor II

    @mschmitzthanks for your suggestion but incase you missed the first part of post, I have already used

    License activeLicense = ProductConstraintManager.INSTANCE.getActiveLicense();

    and got OpenSource license.

    Exactly!@jczogalla, I am getting the uninitialized i.e.OpenSource license everytime.

    Is there any way to get the actual license whether Free, Educational or Large?

    @jczogallasince you are asking about the use case, I actually wanted to check whoever using my app should atleast have a licensed version of rapidminer studio.


    One workaround I can think of is checking the presence of valid licenses in "home/.Rapidminer/licenses/rapidminer-studio/" folder but there must be some robust way of doing this.


    Any help would be appreciated:)

Sign InorRegisterto comment.