|
This is legacy documentation
CloudBees Feature Management is now part of CloudBees Unify. For current feature management documentation, go to CloudBees Unify Feature management. This documentation covers the original CloudBees Feature Management product (formerly Rollout.io), which is end-of-life. It remains available only for existing customers who are migrating to CloudBees Unify. |
|
Support during the extension period
Because CloudBees Feature Management is an end-of-life product, support during the extension period is limited to critical items only:
This coverage is consistent with the CloudBees end-of-life policy in the support Terms & Conditions. |
This section describes how to set up and install the Java SDK and how to deploy a feature flag.
Step 1: Setting up
To setup Java SDK, follow these steps:
-
Create a CloudBees Feature Management account. See Signup Page to create an account.
-
Get your environment key. Copy your environment key from App settings > Environments > Key.
Step 2: Installing the Java Server SDK
Add the CloudBees Feature Management Java Server package to your application by adding the following in the dependencies block:
implementation 'io.rollout.rox:rox-java-server:5.+'----
<dependency> <groupId>io.rollout.rox</groupId> <artifactId>rox-java-server</artifactId> <version>5.0.5</version> </dependency>
Create a container class called Flags.java with the following code. This container class is where we will define all of our feature flags.
import io.rollout.flags.RoxFlag; import io.rollout.flags.RoxString; import io.rollout.configuration.RoxContainer; // Create Roxflags in the Flags container class public class Flags implements RoxContainer { // Define the feature flags public RoxFlag enableTutorial = new RoxFlag(false); public RoxString titleColors = new RoxString("White", new String[] {"White", "Blue", "Green"}); }
Add the following lines of code to your application:
// Initialize container class that we created earlier Flags flags = new Flags(); // Register the flags container Rox.register(flags); // Setup the environment key Rox.setup("<ROLLOUT_ENV_KEY>"); // Boolean flag example if (flags.enableTutorial.isEnabled()) { // TODO: Put your code here that needs to be gated } // Multivariate flag example if (flags.titleColors.getValue().equals("White")) { System.out.println("Title color is white"); } else if (flags.titleColors.getValue().equals("Blue")) { System.out.println("Title color is blue"); } else if (flags.titleColors.getValue().equals("Green")) { System.out.println("Title color is green"); }