All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.security.config.SecurityConfig Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package com.alachisoft.ncache.security.config;

import Alachisoft.NCache.Common.Configuration.*;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;

import java.io.IOException;

@ConfigurationRootAnnotation(value = "cache-security")
public class SecurityConfig implements InternalCompactSerializable, Cloneable
{
	private boolean _enabled;
	private DomainController _domainController;
	private DomainController _secondaryDC;
	private Administrators _administrator;

	public SecurityConfig()
	{
		_domainController = new DomainController();
		_secondaryDC = new DomainController();
		_administrator = new Administrators();
	}

	@ConfigurationAttributeAnnotation(value = "enable", appendText = "")
	public final boolean getEnabled()
	{
		return _enabled;
	}
	@ConfigurationAttributeAnnotation(value = "enable", appendText = "")
	public final void setEnabled(boolean value)
	{
		_enabled = value;
	}

	@ConfigurationAttributeAnnotation(value = "ldap", appendText = "")
	public final DomainController getDomainController()
	{
		return _domainController;
	}
	@ConfigurationAttributeAnnotation(value = "ldap", appendText = "")
	public final void setDomainController(DomainController value)
	{
		_domainController = value;
	}

	@ConfigurationAttributeAnnotation(value = "ldap-secondary", appendText = "")
	public final DomainController getSecondaryDomainController()
	{
		return _secondaryDC;
	}
	@ConfigurationAttributeAnnotation(value = "ldap-secondary", appendText = "")
	public final void setSecondaryDomainController(DomainController value)
	{
		_secondaryDC = value;
	}


	@ConfigurationAttributeAnnotation(value = "administrators", appendText = "")
	public final Administrators getAdministrator()
	{
		return _administrator;
	}
	@ConfigurationAttributeAnnotation(value = "administrators", appendText = "")
	public final void setAdministrator(Administrators value)
	{
		_administrator = value;
	}

	public final Object clone()
	{
		SecurityConfig securityConfig = new SecurityConfig();
		securityConfig.setEnabled(_enabled);
		securityConfig.setDomainController(getDomainController() != null ? (DomainController) getDomainController().clone() : null);
		securityConfig.setSecondaryDomainController(getSecondaryDomainController() != null ? (DomainController) getSecondaryDomainController().clone() : null);
		securityConfig.setAdministrator(getAdministrator() != null ? (Administrators) getAdministrator().clone() : null);
		return securityConfig;

	}
	@Override
	public void Serialize(CompactWriter writer) throws IOException {
		writer.Write(_enabled);
		writer.WriteObject(_domainController);
		writer.WriteObject(_secondaryDC);
		writer.WriteObject(_administrator);
	}

	@Override
	public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
		_enabled = reader.ReadBoolean();
		Object tempVar = reader.ReadObject();
		_domainController = (DomainController)((tempVar instanceof DomainController) ? tempVar : null);
		Object tempVar2 = reader.ReadObject();
		_secondaryDC = (DomainController)((tempVar2 instanceof DomainController) ? tempVar2 : null);
		Object tempVar3 = reader.ReadObject();
		_administrator = (Administrators)((tempVar3 instanceof Administrators) ? tempVar3 : null);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy