The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Getting Rapidminer studio license details from Java program

lplenkalplenka Member Posts: 11 Contributor II
edited December 2019 in Help

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 Member Posts: 11 Contributor 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: com.rapidminer.core.license.OpenSourceLicense@2d801d8

    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 Employee-RapidMiner, RMResearcher, Member Posts: 299 RM 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 Member Posts: 11 Contributor II

    yes @Edin_Klapic I 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, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM 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

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • jczogallajczogalla Employee-RapidMiner, Member Posts: 144 RM Engineering

    Hi,

     

    sadly I have to correct @mschmitz a 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

  • lplenkalplenka Member Posts: 11 Contributor II

    @mschmitz thanks 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?

     

    @jczogalla since 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 In or Register to comment.