Package com.iizix.license
Interface IGenericLicenseSystem
- All Superinterfaces:
IBasicUserInfoDetailNames
- All Known Subinterfaces:
IAppBuilderLicenseSystem
,IDesignerLicenseSystem
,IServerLicenseSystem
public interface IGenericLicenseSystem extends IBasicUserInfoDetailNames
The generic license system interface.- Author:
- Christopher Mindus
Field Summary
Fields inherited from interface com.iizix.user.IBasicUserInfoDetailNames
DETAIL_AdditionalEmail, DETAIL_Address, DETAIL_Address_2, DETAIL_Address_3, DETAIL_City, DETAIL_CompanyDivision, DETAIL_CompanyName, DETAIL_Country, DETAIL_CroppedUploadedProfileImage, DETAIL_DBAdministrationUserName, DETAIL_DeveloperGroupID, DETAIL_DeveloperID, DETAIL_Email, DETAIL_EmailVerify, DETAIL_FirstName, DETAIL_FixedPassword, DETAIL_FullName, DETAIL_HomeFax, DETAIL_HomeMobile, DETAIL_HomePhone, DETAIL_JobTitle, DETAIL_LargeProfileImage, DETAIL_LastName, DETAIL_LocalizedFirstName, DETAIL_LocalizedFullName, DETAIL_LocalizedLastName, DETAIL_LocalizedMiddleName, DETAIL_LocalizedTitle, DETAIL_MiddleName, DETAIL_Phone, DETAIL_Phone_2, DETAIL_PinCode, DETAIL_RecoveryAnswer, DETAIL_RecoveryQuestion, DETAIL_StateProvince, DETAIL_ThumbnailProfileImage, DETAIL_Title, DETAIL_UploadedProfileImage, DETAIL_UploadedProfileImageCrop, DETAIL_WorkFax, DETAIL_WorkMobile, DETAIL_WorkPhone, DETAIL_ZipCode, detailsSet, profilePictureDetailsList
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
activate(GenericCallback<java.lang.Void,java.lang.String> callback)
Activates the license.boolean
addListener(ILicenseServerListener listener)
Adds a dispose listener for license server communication.void
assignCallback(ILicenseCallback callback)
Assigns the callback for major failures.void
assignFeedBack(IUserInterfaceFeedback<ValidateReply> feedback)
Assigns the validation feedback (UI).java.lang.String
completeRegistration(GenericCallback<java.lang.Void,java.lang.String> callback)
Completes the registration.void
dispose()
Disposes of the license system.java.lang.String
extendTrial(GenericCallback<java.lang.Void,java.lang.String> callback)
Requests an additional 7 days extension for the trial.java.lang.String
getDatabaseAdministratorUser()
Gets the database administrator user name used when creating the license.java.util.Map<java.lang.String,java.lang.String>
getDetails()
Gets the DETAIL_* map.java.lang.String
getInstallationID()
Gets the unique installation ID.java.lang.String
getLoggedInUser()
Gets the logged in user.default ProfilePicture
getProfilePicture()
Gets the "uploaded" profile picture.ProfilePicture
getProfilePicture(java.lang.String type)
Gets the profile picture.java.lang.Object
getSignature(java.lang.Object which)
Returns the license system signature.long
getTrialDuration()
Gets the trial duration.long
getTrialExtension()
Gets the trial extension time in milliseconds.long
getTrialStarted()
Gets the trial started time.long[]
getValidityPeriod()
In case there is a time period the license is valid, this method returns the beginning (including) and ending time (excluding) in milliseconds since the epoch.boolean
initialize(PropFactory serverFactory, java.lang.Object caller, java.lang.Object signature, java.lang.Object which, java.io.File dir)
Initializes the license system.boolean
isConnected()
Returns the connection state to the license server.boolean
isTrialMode()
Returns if the installation is in trial mode.java.lang.String
login(java.lang.String email, java.lang.String password, java.lang.String newPassword, java.util.function.BiFunction<LoginResult,java.lang.String,java.lang.Void> callback)
Login user.boolean
logout()
Logs out of the License System.void
performOfflineRegistration(java.util.Map<java.lang.String,java.lang.String> offLineDetails, java.lang.Object caller)
Performs offline registration.void
preClose()
Requests disconnection from the license server, this will end when no more communication tasks in progress, and there are no pending open requests throughpreOpen()
.void
preOpen()
Opens connection to license server in order to be fast in response later on...boolean
removeListener(ILicenseServerListener listener)
Removes a dispose listener for the client session.boolean
removeProfilePictures()
Removes all the profile pictures.java.lang.String
requestEmailVerification(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback)
Requests to send an email to verify the email.java.lang.String
resetPassword(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback)
Resets the password for a user by sending a mail.void
save()
Saves the license file.boolean
setProfilePicture(ProfilePicture profilePicture)
Sets a profile picture.boolean
setRecoveryEmail(java.lang.String recoveryEmail)
Adds, removes or changes the additional email for recovery.java.lang.String
signUp(java.lang.String email, java.lang.String password, java.util.Map<java.lang.String,java.lang.String> details, GenericCallback<java.lang.Void,java.lang.String> callback)
Sign up user.ValidateReply
validate()
Validates the license.java.lang.String
verifyEmailCode(java.lang.String email, java.lang.String code, GenericCallback<java.lang.Void,java.lang.String> callback)
Verifies a code for an email sent to the user.java.lang.String
verifyEmailTaken(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback)
Verifies if an email is taken for login.
Method Detail
initialize
boolean initialize(PropFactory serverFactory, java.lang.Object caller, java.lang.Object signature, java.lang.Object which, java.io.File dir)
Initializes the license system.- Parameters:
serverFactory
- The server factory.caller
- The licensed caller instance.which
- Which signature is specified.signature
- The signature.dir
- Directory where to store data.- Returns:
- true for success, false if the license fails initialization and requires shut-down of the caller.
dispose
void dispose()
Disposes of the license system.
assignCallback
void assignCallback(ILicenseCallback callback)
Assigns the callback for major failures.- Parameters:
callback
- The failure callback.
assignFeedBack
void assignFeedBack(IUserInterfaceFeedback<ValidateReply> feedback)
Assigns the validation feedback (UI).- Parameters:
feedback
- The feedback to a potential UI.
getSignature
java.lang.Object getSignature(java.lang.Object which)
Returns the license system signature.- Parameters:
which
- Which signature to return.- Returns:
- The signature.
save
void save() throws LicenseException
Saves the license file. If the license system has not been initialized, nothing will happen.- Throws:
LicenseException
- If the file failed to be saved.
completeRegistration
java.lang.String completeRegistration(GenericCallback<java.lang.Void,java.lang.String> callback) throws LicenseException
Completes the registration.- Parameters:
callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- An immediate error message, or null for callback to be invoked later.
- Throws:
LicenseException
- For License System errors.
isConnected
boolean isConnected()
Returns the connection state to the license server.- Returns:
- true if connected to the license server, false otherwise.
preOpen
void preOpen()
Opens connection to license server in order to be fast in response later on... Multiple calls to this method can be done, must each call MUST be followed bypreClose()
, otherwise the communication link to the license server will remain open.
preClose
void preClose()
Requests disconnection from the license server, this will end when no more communication tasks in progress, and there are no pending open requests throughpreOpen()
.
addListener
boolean addListener(ILicenseServerListener listener)
Adds a dispose listener for license server communication. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
java.lang.NullPointerException
- If the listener isnull
.
removeListener
boolean removeListener(ILicenseServerListener listener)
Removes a dispose listener for the client session.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
validate
ValidateReply validate()
Validates the license.- Returns:
- The validation result, never null.
getInstallationID
java.lang.String getInstallationID()
Gets the unique installation ID. This installation ID is dependent on the installation location, the hardware it is installed on, etc. Each developer ID is allowed to have up to 10 such installations. There are functions to remove registered installations in the iizi License App.- Returns:
- An installation ID that is unique for each iizi installation, even on the same machine.
getDetails
java.util.Map<java.lang.String,java.lang.String> getDetails()
Gets the DETAIL_* map.See the DETAIL_* values in
IBasicUserInfoDetailNames
.- Returns:
- A new map, or null if license file is not loaded.
getValidityPeriod
long[] getValidityPeriod()
In case there is a time period the license is valid, this method returns the beginning (including) and ending time (excluding) in milliseconds since the epoch.In case there is no beginning or ending set, the array consists of a
zero
entry. If there is no time period limitation at all, this method returns an array with of size 2 with zero's.- Returns:
- The time limitation as an array, index 0 (zero) is the start of the period (inclusive). If
zero
there is no start period specified. The index 1 (one) is the end of the period (exclusive), and set to zero, there is no end period.
isTrialMode
boolean isTrialMode()
Returns if the installation is in trial mode.- Returns:
- true if in trial mode, false if it has been registered and no longer in trial mode.
Note: "Trial Mode" may still remain if this is a paid subscription, even if registered.
getTrialDuration
long getTrialDuration()
Gets the trial duration.- Returns:
- The trial duration in milliseconds, -1L for no trial!
getTrialStarted
long getTrialStarted()
Gets the trial started time.- Returns:
- The trial start in milliseconds since the epoch, -1L for no trial!
getTrialExtension
long getTrialExtension()
Gets the trial extension time in milliseconds.- Returns:
- The trial extension time in milliseconds, zero for none.
login
java.lang.String login(java.lang.String email, java.lang.String password, java.lang.String newPassword, java.util.function.BiFunction<LoginResult,java.lang.String,java.lang.Void> callback)
Login user. The details for the user replaces the current settings in the license file if login is successful (once the password has been changed if that was required).- Parameters:
email
- The email string (lower case, trimmed).password
- The password (the password is not sent in the clear, event using TLS).newPassword
- New password for user once validated, null for no change.callback
- The callback with the responseLoginResult
and a String for error, null String for success.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
resetPassword
java.lang.String resetPassword(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback) throws java.lang.NullPointerException
Resets the password for a user by sending a mail.- Parameters:
email
- The email string (lower case, trimmed).callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
signUp
java.lang.String signUp(java.lang.String email, java.lang.String password, java.util.Map<java.lang.String,java.lang.String> details, GenericCallback<java.lang.Void,java.lang.String> callback) throws java.lang.NullPointerException
Sign up user.- Parameters:
email
- The email string (lower case, trimmed).password
- The password (the password is not sent in the clear, event using TLS).details
- Details for the user according to standard ofcom.iizix.server.db.BasicUserInfo
.callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
performOfflineRegistration
void performOfflineRegistration(java.util.Map<java.lang.String,java.lang.String> offLineDetails, java.lang.Object caller)
Performs offline registration.- Parameters:
offLineDetails
- The details for offline registration.caller
- The caller.- Throws:
java.lang.IllegalArgumentException
- If details and caller do not match, or the license system is online.java.lang.SecurityException
- If called from wrong party.
activate
java.lang.String activate(GenericCallback<java.lang.Void,java.lang.String> callback)
Activates the license.- Parameters:
callback
- The callback for the activation result. The String in the callback argument is null for success, or an error message.- Returns:
- null for OK, empty string for no need for activation, otherwise an error string. The callback will be invoked only if the return code is null.
extendTrial
java.lang.String extendTrial(GenericCallback<java.lang.Void,java.lang.String> callback)
Requests an additional 7 days extension for the trial.- Parameters:
callback
- The callback for the activation result. The String in the callback argument is null for success, or an error message.- Returns:
- null for OK, empty string for no need for trial extension, otherwise an error string. The callback will be invoked only if the return code is null.
getLoggedInUser
java.lang.String getLoggedInUser()
Gets the logged in user.- Returns:
- The user that is logged in, or null if nobody is signed in.
logout
boolean logout()
Logs out of the License System.- Returns:
- true for success, false if no user is logged in.
setRecoveryEmail
boolean setRecoveryEmail(java.lang.String recoveryEmail)
Adds, removes or changes the additional email for recovery. This routine also handles email verification requirements to the license server.- Parameters:
recoveryEmail
- The new or updated recovery email address, null to remove it.- Returns:
- true for success, false for no change.
verifyEmailTaken
java.lang.String verifyEmailTaken(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback)
Verifies if an email is taken for login.- Parameters:
email
- The email string (lower case, trimmed).callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
requestEmailVerification
java.lang.String requestEmailVerification(java.lang.String email, GenericCallback<java.lang.Void,java.lang.String> callback)
Requests to send an email to verify the email.- Parameters:
email
- The email string (lower case, trimmed).callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
verifyEmailCode
java.lang.String verifyEmailCode(java.lang.String email, java.lang.String code, GenericCallback<java.lang.Void,java.lang.String> callback)
Verifies a code for an email sent to the user.- Parameters:
email
- The email string (lower case, trimmed).code
- The code from the email verification mail.callback
- The callback with the response String parameter: null for OK, otherwise the message string.- Returns:
- null for OK, otherwise an error string.
- Throws:
java.lang.NullPointerException
- If any of the parameters are null.
removeProfilePictures
boolean removeProfilePictures()
Removes all the profile pictures.- Returns:
- true for changed, false for no change.
getProfilePicture
default ProfilePicture getProfilePicture()
Gets the "uploaded" profile picture. It is up to the caller to clean-up potential temporary directory and/or file.- Returns:
- The profile picture instance, or null if none is present.
getProfilePicture
ProfilePicture getProfilePicture(java.lang.String type)
Gets the profile picture. It is up to the caller to clean-up potential temporary directory and/or file.- Parameters:
type
- The type of image: DETAIL_UploadedProfileImage, DETAIL_LargeProfileImage, DETAIL_ThumbnailProfileImage, or null for the largest available.- Returns:
- The profile picture instance, or null if none is present.
- Throws:
java.lang.IllegalArgumentException
- Iftype
is notIBasicUserInfoDetailNames.DETAIL_UploadedProfileImage
ornull
,IBasicUserInfoDetailNames.DETAIL_LargeProfileImage
; orIBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage
.
setProfilePicture
boolean setProfilePicture(ProfilePicture profilePicture)
Sets a profile picture.- Parameters:
profilePicture
- The profile picture to set.- Returns:
- true for changed, false for no change.
getDatabaseAdministratorUser
java.lang.String getDatabaseAdministratorUser()
Gets the database administrator user name used when creating the license.- Returns:
- The database administrator user name, or null if none is available.