Skip to content

Instantly share code, notes, and snippets.

@sgaem
Created May 31, 2019 03:14
Show Gist options
  • Save sgaem/97515565a12ae1d36122a041da002c9e to your computer and use it in GitHub Desktop.
Save sgaem/97515565a12ae1d36122a041da002c9e to your computer and use it in GitHub Desktop.
UserAccountDetail.java is the implementation of Factory OSGI Configuration.
package com.poc.osgiannotation.core.servlets;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.metatype.annotations.Designate;
@Component(service=UserAccountDetail.class,immediate=true)
@Designate(ocd = UserConfiguration.class,factoy=true)
public class UserAccountDetail {
private String userName;
private String password;
private Boolean isAdminUser;
private String memberOf;
private int validity;
private String[] environments;
@Activate @Modified
protected void activate(final UserConfiguration userConfiguration) {
userName = userConfiguration.getUserName();
password = userConfiguration.getPassword();
isAdminUser = userConfiguration.isAdminUser();
memberOf = userConfiguration.getMemberOf();
validity = userConfiguration.getValidity();
environments = userConfiguration.getEnvironments();
}
/**
* @return the userName
*/
public String getUserName() {
return userName;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @return the isAdminUser
*/
public Boolean getIsAdminUser() {
return isAdminUser;
}
/**
* @return the memberOf
*/
public String getMemberOf() {
return memberOf;
}
/**
* @return the validity
*/
public int getValidity() {
return validity;
}
/**
* @return the environments
*/
public String[] getEnvironments() {
return environments;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment