Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Raluca Munteanu
2016-04-26 13:03:25 +00:00
parent 8674e2bfc8
commit dc6b2852d0
830 changed files with 142585 additions and 142585 deletions

View File

@@ -1,20 +1,20 @@
package org.alfresco.repo.security.authentication;
public class AuthenticationDisallowedException extends AuthenticationException
{
/**
*
*/
static final long serialVersionUID = -5993582597632086734L;
public AuthenticationDisallowedException(String msg)
{
super(msg);
}
public AuthenticationDisallowedException(String msg, Throwable cause)
{
super(msg, cause);
}
}
package org.alfresco.repo.security.authentication;
public class AuthenticationDisallowedException extends AuthenticationException
{
/**
*
*/
static final long serialVersionUID = -5993582597632086734L;
public AuthenticationDisallowedException(String msg)
{
super(msg);
}
public AuthenticationDisallowedException(String msg, Throwable cause)
{
super(msg, cause);
}
}

View File

@@ -1,20 +1,20 @@
package org.alfresco.repo.security.authentication;
public class AuthenticationMaxUsersException extends AuthenticationException
{
/**
*
*/
static final long serialVersionUID = -3804740186420556532L;
public AuthenticationMaxUsersException(String msg)
{
super(msg);
}
public AuthenticationMaxUsersException(String msg, Throwable cause)
{
super(msg, cause);
}
}
package org.alfresco.repo.security.authentication;
public class AuthenticationMaxUsersException extends AuthenticationException
{
/**
*
*/
static final long serialVersionUID = -3804740186420556532L;
public AuthenticationMaxUsersException(String msg)
{
super(msg);
}
public AuthenticationMaxUsersException(String msg, Throwable cause)
{
super(msg, cause);
}
}

View File

@@ -1,26 +1,26 @@
package org.alfresco.repo.security.authentication;
import org.springframework.context.ApplicationEvent;
/**
* Event emmitted when an Authenticator is deleted, the source is the zoneId deleted.
*
* @author mrogers
*/
public class AuthenticatorDeletedEvent extends ApplicationEvent
{
/**
*
*/
private static final long serialVersionUID = 3641164223727881175L;
/**
*
* @param source a String with the zoneid
*/
public AuthenticatorDeletedEvent(Object source)
{
super(source);
}
}
package org.alfresco.repo.security.authentication;
import org.springframework.context.ApplicationEvent;
/**
* Event emmitted when an Authenticator is deleted, the source is the zoneId deleted.
*
* @author mrogers
*/
public class AuthenticatorDeletedEvent extends ApplicationEvent
{
/**
*
*/
private static final long serialVersionUID = 3641164223727881175L;
/**
*
* @param source a String with the zoneid
*/
public AuthenticatorDeletedEvent(Object source)
{
super(source);
}
}

View File

@@ -1,95 +1,95 @@
package org.alfresco.repo.security.authentication;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.ParameterCheck;
/**
* Helper to process username / password pairs passed to the remote tier
*
* Identifies whether username / password is a ticket.
*
* Is ticket, if one of the following is true:
*
* a) Username == "ROLE_TICKET" (in any case) b) Username is not specified (i.e.
* null) c) Username is zero length
*/
public class Authorization
{
public static String TICKET_USERID = PermissionService.ROLE_PREFIX + "TICKET";
private String username;
private String password;
private String ticket;
/**
* Construct
*
* @param authorization String
*/
public Authorization(String authorization)
{
ParameterCheck.mandatoryString("authorization", authorization);
if (authorization.length() == 0)
{
throw new IllegalArgumentException("authorization does not consist of username and password");
}
int idx = authorization.indexOf(':');
if (idx == -1)
{
setUser(null, authorization);
}
else
{
setUser(authorization.substring(0, idx), authorization.substring(idx + 1));
}
}
/**
* Construct
*
* @param username String
* @param password String
*/
public Authorization(String username, String password)
{
setUser(username, password);
}
private void setUser(String username, String password)
{
this.username = username;
this.password = password;
if (username == null || username.length() == 0 || username.equalsIgnoreCase(TICKET_USERID))
{
this.ticket = password;
}
}
public String getUserName()
{
return username;
}
public String getPassword()
{
return password;
}
public char[] getPasswordCharArray()
{
return password == null ? null : password.toCharArray();
}
public boolean isTicket()
{
return ticket != null;
}
public String getTicket()
{
return ticket;
}
}
package org.alfresco.repo.security.authentication;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.ParameterCheck;
/**
* Helper to process username / password pairs passed to the remote tier
*
* Identifies whether username / password is a ticket.
*
* Is ticket, if one of the following is true:
*
* a) Username == "ROLE_TICKET" (in any case) b) Username is not specified (i.e.
* null) c) Username is zero length
*/
public class Authorization
{
public static String TICKET_USERID = PermissionService.ROLE_PREFIX + "TICKET";
private String username;
private String password;
private String ticket;
/**
* Construct
*
* @param authorization String
*/
public Authorization(String authorization)
{
ParameterCheck.mandatoryString("authorization", authorization);
if (authorization.length() == 0)
{
throw new IllegalArgumentException("authorization does not consist of username and password");
}
int idx = authorization.indexOf(':');
if (idx == -1)
{
setUser(null, authorization);
}
else
{
setUser(authorization.substring(0, idx), authorization.substring(idx + 1));
}
}
/**
* Construct
*
* @param username String
* @param password String
*/
public Authorization(String username, String password)
{
setUser(username, password);
}
private void setUser(String username, String password)
{
this.username = username;
this.password = password;
if (username == null || username.length() == 0 || username.equalsIgnoreCase(TICKET_USERID))
{
this.ticket = password;
}
}
public String getUserName()
{
return username;
}
public String getPassword()
{
return password;
}
public char[] getPasswordCharArray()
{
return password == null ? null : password.toCharArray();
}
public boolean isTicket()
{
return ticket != null;
}
public String getTicket()
{
return ticket;
}
}

View File

@@ -1,103 +1,103 @@
package org.alfresco.repo.security.authentication;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.transaction.TransactionListener;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Transaction listener that re-generates the hash of a users password in
* the afterCommit callback.
*
* @author Gavin Cornwell
*/
public class HashPasswordTransactionListener implements TransactionListener
{
private static Log logger = LogFactory.getLog(HashPasswordTransactionListener.class);
private final String username;
private final char[] password;
private TransactionService transactionService;
private MutableAuthenticationDao authenticationDao;
public HashPasswordTransactionListener(final String username, final char[] password)
{
this.username = username;
this.password = password;
}
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
public void setAuthenticationDao(MutableAuthenticationDao authenticationDao)
{
this.authenticationDao = authenticationDao;
}
@Override
public void flush()
{
// nothing to do
}
@Override
public void beforeCommit(boolean readOnly)
{
// nothing to do
}
@Override
public void beforeCompletion()
{
// nothing to do
}
@Override
public void afterCommit()
{
// get transaction helper and force it to be writable in case system is in read only mode
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
txHelper.setForceWritable(true);
txHelper.doInTransaction(new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
if (logger.isDebugEnabled())
{
logger.debug("Re-hashing password for user: " + username);
}
// update the users password to force a new hash to be generated
authenticationDao.updateUser(username, password);
if (logger.isDebugEnabled())
{
logger.debug("Password for user '" + username + "' has been re-hashed following login");
}
return null;
}
finally
{
AuthenticationUtil.popAuthentication();
}
}
}, false, true);
}
@Override
public void afterRollback()
{
// nothing to do
}
}
package org.alfresco.repo.security.authentication;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.transaction.TransactionListener;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Transaction listener that re-generates the hash of a users password in
* the afterCommit callback.
*
* @author Gavin Cornwell
*/
public class HashPasswordTransactionListener implements TransactionListener
{
private static Log logger = LogFactory.getLog(HashPasswordTransactionListener.class);
private final String username;
private final char[] password;
private TransactionService transactionService;
private MutableAuthenticationDao authenticationDao;
public HashPasswordTransactionListener(final String username, final char[] password)
{
this.username = username;
this.password = password;
}
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
public void setAuthenticationDao(MutableAuthenticationDao authenticationDao)
{
this.authenticationDao = authenticationDao;
}
@Override
public void flush()
{
// nothing to do
}
@Override
public void beforeCommit(boolean readOnly)
{
// nothing to do
}
@Override
public void beforeCompletion()
{
// nothing to do
}
@Override
public void afterCommit()
{
// get transaction helper and force it to be writable in case system is in read only mode
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
txHelper.setForceWritable(true);
txHelper.doInTransaction(new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
if (logger.isDebugEnabled())
{
logger.debug("Re-hashing password for user: " + username);
}
// update the users password to force a new hash to be generated
authenticationDao.updateUser(username, password);
if (logger.isDebugEnabled())
{
logger.debug("Password for user '" + username + "' has been re-hashed following login");
}
return null;
}
finally
{
AuthenticationUtil.popAuthentication();
}
}
}, false, true);
}
@Override
public void afterRollback()
{
// nothing to do
}
}

View File

@@ -1,41 +1,41 @@
package org.alfresco.repo.security.authentication;
import net.sf.acegisecurity.providers.encoding.BaseDigestPasswordEncoder;
/**
* <p>
* NoOp implementation of PasswordEncoder.
* </p>
* The No Op Password Encoder produces a blank hash. And will not match any value of hash.
* Used to replace an obsolete encoder like the MD4.
* </p>
*/
public class NoOpPasswordEncoderImpl extends BaseDigestPasswordEncoder implements MD4PasswordEncoder
{
public NoOpPasswordEncoderImpl()
{
super();
// TODO Auto-generated constructor stub
}
// ~ Methods
// ================================================================
public boolean isPasswordValid(String encPass, String rawPass, Object salt)
{
return false;
}
public String encodePassword(String rawPass, Object salt)
{
return "";
}
public byte[] decodeHash(String encodedHash)
{
return new byte[0];
}
}
package org.alfresco.repo.security.authentication;
import net.sf.acegisecurity.providers.encoding.BaseDigestPasswordEncoder;
/**
* <p>
* NoOp implementation of PasswordEncoder.
* </p>
* The No Op Password Encoder produces a blank hash. And will not match any value of hash.
* Used to replace an obsolete encoder like the MD4.
* </p>
*/
public class NoOpPasswordEncoderImpl extends BaseDigestPasswordEncoder implements MD4PasswordEncoder
{
public NoOpPasswordEncoderImpl()
{
super();
// TODO Auto-generated constructor stub
}
// ~ Methods
// ================================================================
public boolean isPasswordValid(String encPass, String rawPass, Object salt)
{
return false;
}
public String encodePassword(String rawPass, Object salt)
{
return "";
}
public byte[] decodeHash(String encodedHash)
{
return new byte[0];
}
}

View File

@@ -1,37 +1,37 @@
package org.alfresco.repo.security.authentication;
import org.alfresco.error.AlfrescoRuntimeException;
import org.quartz.StatefulJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
* @author Andy
*
*/
public class TicketCleanupJob implements StatefulJob
{
public TicketCleanupJob()
{
}
/**
* Calls the cleaner to do its work
*/
public void execute(JobExecutionContext context) throws JobExecutionException
{
JobDataMap jobData = context.getJobDetail().getJobDataMap();
// extract the content cleaner to use
Object abstractAuthenticationServiceRef = jobData.get("abstractAuthenticationService");
if (abstractAuthenticationServiceRef == null || !(abstractAuthenticationServiceRef instanceof AbstractAuthenticationService))
{
throw new AlfrescoRuntimeException(
"ContentStoreCleanupJob data must contain valid 'contentStoreCleaner' reference");
}
AbstractAuthenticationService abstractAuthenticationService = (AbstractAuthenticationService) abstractAuthenticationServiceRef;
abstractAuthenticationService.invalidateTickets(true);
}
}
package org.alfresco.repo.security.authentication;
import org.alfresco.error.AlfrescoRuntimeException;
import org.quartz.StatefulJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
* @author Andy
*
*/
public class TicketCleanupJob implements StatefulJob
{
public TicketCleanupJob()
{
}
/**
* Calls the cleaner to do its work
*/
public void execute(JobExecutionContext context) throws JobExecutionException
{
JobDataMap jobData = context.getJobDetail().getJobDataMap();
// extract the content cleaner to use
Object abstractAuthenticationServiceRef = jobData.get("abstractAuthenticationService");
if (abstractAuthenticationServiceRef == null || !(abstractAuthenticationServiceRef instanceof AbstractAuthenticationService))
{
throw new AlfrescoRuntimeException(
"ContentStoreCleanupJob data must contain valid 'contentStoreCleaner' reference");
}
AbstractAuthenticationService abstractAuthenticationService = (AbstractAuthenticationService) abstractAuthenticationServiceRef;
abstractAuthenticationService.invalidateTickets(true);
}
}

View File

@@ -1,187 +1,187 @@
package org.alfresco.repo.security.authentication.ldap;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.OpenDataException;
import javax.management.openmbean.OpenType;
import javax.management.openmbean.SimpleType;
import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.security.authentication.AuthenticationStep;
import org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizerStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Monitoring methods and properties to be exposed via the
* JMX admin console.
*/
public class Monitor
{
LDAPAuthenticationComponentImpl component;
ChainingUserRegistrySynchronizerStatus syncMonitor;
String id;
private static Log logger = LogFactory.getLog(Monitor.class);
public void setLDAPAuthenticationComponent(LDAPAuthenticationComponentImpl component)
{
this.component = component;
}
public void setChainingUserRegistrySynchronizerStatus(ChainingUserRegistrySynchronizerStatus syncStatus)
{
this.syncMonitor = syncStatus;
}
/**
* test authenticate
*
* @param userName String
* @param credentials String
* @throws AuthenticationException
*/
public CompositeData testAuthenticate(String userName, String credentials)
{
String stepKeys[] = {"id", "stepMessage", "success"};
String stepDescriptions[] = {"id", "stepMessage", "success"};
OpenType<?> stepTypes[] = {SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN };
try
{
String[] key = {"id"};
CompositeType sType = new CompositeType("Authentication Step", "Step", stepKeys, stepDescriptions, stepTypes);
TabularType tType = new TabularType("Diagnostic", "Authentication Steps", sType, key);
TabularData table = new TabularDataSupport(tType);
String attributeKeys[] = {"authenticationMessage", "success", "diagnostic"};
String attributeDescriptions[] = {"authenticationMessage", "success", "diagnostic"};
OpenType<?> attributeTypes[] = {SimpleType.STRING, SimpleType.BOOLEAN, tType};
try
{
component.authenticate(userName, credentials.toCharArray());
CompositeType cType = new CompositeType("Authentication Result", "Result Success", attributeKeys, attributeDescriptions, attributeTypes);
Map<String, Object> value = new HashMap<String, Object>();
value.put("authenticationMessage", "Test Passed");
value.put("success", true);
value.put("diagnostic", table);
CompositeDataSupport row = new CompositeDataSupport(cType, value);
return row;
}
catch (AuthenticationException ae)
{
CompositeType cType = new CompositeType("Authentication Result", "Result Failed", attributeKeys, attributeDescriptions, attributeTypes);
Map<String, Object> value = new HashMap<String, Object>();
value.put("authenticationMessage", ae.getMessage());
value.put("success", false);
if(ae.getDiagnostic() != null)
{
int i = 0;
for(AuthenticationStep step : ae.getDiagnostic().getSteps())
{
Map<String, Object> x = new HashMap<String, Object>();
x.put("id", i++);
x.put("stepMessage", step.getMessage());
x.put("success", step.isSuccess());
CompositeDataSupport row = new CompositeDataSupport(sType, x);
table.put(row);
}
}
value.put("diagnostic", table);
CompositeDataSupport row = new CompositeDataSupport(cType, value);
return row;
}
}
catch (OpenDataException oe)
{
logger.error("", oe);
return null;
}
}
public int getNumberFailedAuthentications()
{
return component.getNumberFailedAuthentications();
}
public int getNumberSuccessfulAuthentications()
{
return component.getNumberSuccessfulAuthentications();
}
public String getSynchronizationStatus()
{
return syncMonitor.getSynchronizationStatus(getZone(component.getId()));
}
// public Date getSynchronizationLastUserUpdateTime()
// {
// // TODO This method fails due to a unable to find transaction error - Comment out for now
// return syncMonitor.getSynchronizationLastUserUpdateTime(getZone(component.getId()));
// }
//
// public Date getSynchronizationLastGroupUpdateTime()
// {
// // TODO This method fails due to a unable to find transaction error - Comment out for now
// return syncMonitor.getSynchronizationLastGroupUpdateTime(getZone(component.getId()));
// }
//
public String getSynchronizationLastError()
{
return syncMonitor.getSynchronizationLastError(getZone(component.getId()));
}
public String getSynchronizationSummary()
{
return syncMonitor.getSynchronizationSummary(getZone(component.getId()));
}
public String getLastRunOnServer()
{
return syncMonitor.getLastRunOnServer();
}
public Date getSyncStartTime()
{
return syncMonitor.getSyncStartTime();
}
public Date getSyncEndTime()
{
return syncMonitor.getSyncEndTime();
}
/**
* Get the zone for an ldap authentication component. e.g given [managed,ldap1] return ldap1
* @param id ths id of the subsystem
* @return the zone
*/
private String getZone(String id)
{
String s = id.replace("[", "");
String s2 = s.replace("]", "");
String[] ids = s2.split(",");
String x = ids[ids.length -1].trim();
return x;
}
}
package org.alfresco.repo.security.authentication.ldap;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.OpenDataException;
import javax.management.openmbean.OpenType;
import javax.management.openmbean.SimpleType;
import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.security.authentication.AuthenticationStep;
import org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizerStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Monitoring methods and properties to be exposed via the
* JMX admin console.
*/
public class Monitor
{
LDAPAuthenticationComponentImpl component;
ChainingUserRegistrySynchronizerStatus syncMonitor;
String id;
private static Log logger = LogFactory.getLog(Monitor.class);
public void setLDAPAuthenticationComponent(LDAPAuthenticationComponentImpl component)
{
this.component = component;
}
public void setChainingUserRegistrySynchronizerStatus(ChainingUserRegistrySynchronizerStatus syncStatus)
{
this.syncMonitor = syncStatus;
}
/**
* test authenticate
*
* @param userName String
* @param credentials String
* @throws AuthenticationException
*/
public CompositeData testAuthenticate(String userName, String credentials)
{
String stepKeys[] = {"id", "stepMessage", "success"};
String stepDescriptions[] = {"id", "stepMessage", "success"};
OpenType<?> stepTypes[] = {SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN };
try
{
String[] key = {"id"};
CompositeType sType = new CompositeType("Authentication Step", "Step", stepKeys, stepDescriptions, stepTypes);
TabularType tType = new TabularType("Diagnostic", "Authentication Steps", sType, key);
TabularData table = new TabularDataSupport(tType);
String attributeKeys[] = {"authenticationMessage", "success", "diagnostic"};
String attributeDescriptions[] = {"authenticationMessage", "success", "diagnostic"};
OpenType<?> attributeTypes[] = {SimpleType.STRING, SimpleType.BOOLEAN, tType};
try
{
component.authenticate(userName, credentials.toCharArray());
CompositeType cType = new CompositeType("Authentication Result", "Result Success", attributeKeys, attributeDescriptions, attributeTypes);
Map<String, Object> value = new HashMap<String, Object>();
value.put("authenticationMessage", "Test Passed");
value.put("success", true);
value.put("diagnostic", table);
CompositeDataSupport row = new CompositeDataSupport(cType, value);
return row;
}
catch (AuthenticationException ae)
{
CompositeType cType = new CompositeType("Authentication Result", "Result Failed", attributeKeys, attributeDescriptions, attributeTypes);
Map<String, Object> value = new HashMap<String, Object>();
value.put("authenticationMessage", ae.getMessage());
value.put("success", false);
if(ae.getDiagnostic() != null)
{
int i = 0;
for(AuthenticationStep step : ae.getDiagnostic().getSteps())
{
Map<String, Object> x = new HashMap<String, Object>();
x.put("id", i++);
x.put("stepMessage", step.getMessage());
x.put("success", step.isSuccess());
CompositeDataSupport row = new CompositeDataSupport(sType, x);
table.put(row);
}
}
value.put("diagnostic", table);
CompositeDataSupport row = new CompositeDataSupport(cType, value);
return row;
}
}
catch (OpenDataException oe)
{
logger.error("", oe);
return null;
}
}
public int getNumberFailedAuthentications()
{
return component.getNumberFailedAuthentications();
}
public int getNumberSuccessfulAuthentications()
{
return component.getNumberSuccessfulAuthentications();
}
public String getSynchronizationStatus()
{
return syncMonitor.getSynchronizationStatus(getZone(component.getId()));
}
// public Date getSynchronizationLastUserUpdateTime()
// {
// // TODO This method fails due to a unable to find transaction error - Comment out for now
// return syncMonitor.getSynchronizationLastUserUpdateTime(getZone(component.getId()));
// }
//
// public Date getSynchronizationLastGroupUpdateTime()
// {
// // TODO This method fails due to a unable to find transaction error - Comment out for now
// return syncMonitor.getSynchronizationLastGroupUpdateTime(getZone(component.getId()));
// }
//
public String getSynchronizationLastError()
{
return syncMonitor.getSynchronizationLastError(getZone(component.getId()));
}
public String getSynchronizationSummary()
{
return syncMonitor.getSynchronizationSummary(getZone(component.getId()));
}
public String getLastRunOnServer()
{
return syncMonitor.getLastRunOnServer();
}
public Date getSyncStartTime()
{
return syncMonitor.getSyncStartTime();
}
public Date getSyncEndTime()
{
return syncMonitor.getSyncEndTime();
}
/**
* Get the zone for an ldap authentication component. e.g given [managed,ldap1] return ldap1
* @param id ths id of the subsystem
* @return the zone
*/
private String getZone(String id)
{
String s = id.replace("[", "");
String s2 = s.replace("]", "");
String[] ids = s2.split(",");
String x = ids[ids.length -1].trim();
return x;
}
}

View File

@@ -1,92 +1,92 @@
package org.alfresco.repo.security.authentication.ldap;
import java.beans.BeanInfo;
import java.beans.SimpleBeanInfo;
/**
* A BeanInfo providing metadata for the Monitor class
*
* @author mrogers
*/
public class MonitorBeanInfo extends SimpleBeanInfo
{
/**
* Gets the beans <code>BeanDescriptor</code>.
*
* @return A BeanDescriptor providing overall information about
* the bean, such as its displayName, its customizer, etc. May
* return null if the information should be obtained by automatic
* analysis.
*/
// BeanDescriptor getBeanDescriptor();
/**
* Gets the beans <code>EventSetDescriptor</code>s.
*
* @return An array of EventSetDescriptors describing the kinds of
* events fired by this bean. May return null if the information
* should be obtained by automatic analysis.
*/
// EventSetDescriptor[] getEventSetDescriptors();
/**
* A bean may have a "default" event that is the event that will
* mostly commonly be used by humans when using the bean.
* @return Index of default event in the EventSetDescriptor array
* returned by getEventSetDescriptors.
* <P> Returns -1 if there is no default event.
*/
// int getDefaultEventIndex();
/**
* Returns descriptors for all properties of the bean.
* May return {@code null} if the information
* should be obtained by automatic analysis.
* <p>
* If a property is indexed, then its entry in the result array
* will belong to the {@link IndexedPropertyDescriptor} subclass
* of the {@link PropertyDescriptor} class.
* A client of the {@code getPropertyDescriptors} method
* can use "{@code instanceof}" to check
* whether a given {@code PropertyDescriptor}
* is an {@code IndexedPropertyDescriptor}.
*
* @return an array of {@code PropertyDescriptor}s
* describing all properties supported by the bean
* or {@code null}
*/
// PropertyDescriptor[] getPropertyDescriptors();
/**
* A bean may have a "default" property that is the property that will
* mostly commonly be initially chosen for update by human's who are
* customizing the bean.
* @return Index of default property in the PropertyDescriptor array
* returned by getPropertyDescriptors.
* <P> Returns -1 if there is no default property.
*/
// int getDefaultPropertyIndex();
/**
* Gets the beans <code>MethodDescriptor</code>s.
*
* @return An array of MethodDescriptors describing the externally
* visible methods supported by this bean. May return null if
* the information should be obtained by automatic analysis.
*/
// MethodDescriptor[] getMethodDescriptors();
/**
* This method allows a BeanInfo object to return an arbitrary collection
* of other BeanInfo objects that provide additional information on the
* current bean.
* <P>
* If there are conflicts or overlaps between the information provided
* by different BeanInfo objects, then the current BeanInfo takes precedence
* over the getAdditionalBeanInfo objects, and later elements in the array
* take precedence over earlier ones.
*
* @return an array of BeanInfo objects. May return null.
*/
// BeanInfo[] getAdditionalBeanInfo();
}
package org.alfresco.repo.security.authentication.ldap;
import java.beans.BeanInfo;
import java.beans.SimpleBeanInfo;
/**
* A BeanInfo providing metadata for the Monitor class
*
* @author mrogers
*/
public class MonitorBeanInfo extends SimpleBeanInfo
{
/**
* Gets the beans <code>BeanDescriptor</code>.
*
* @return A BeanDescriptor providing overall information about
* the bean, such as its displayName, its customizer, etc. May
* return null if the information should be obtained by automatic
* analysis.
*/
// BeanDescriptor getBeanDescriptor();
/**
* Gets the beans <code>EventSetDescriptor</code>s.
*
* @return An array of EventSetDescriptors describing the kinds of
* events fired by this bean. May return null if the information
* should be obtained by automatic analysis.
*/
// EventSetDescriptor[] getEventSetDescriptors();
/**
* A bean may have a "default" event that is the event that will
* mostly commonly be used by humans when using the bean.
* @return Index of default event in the EventSetDescriptor array
* returned by getEventSetDescriptors.
* <P> Returns -1 if there is no default event.
*/
// int getDefaultEventIndex();
/**
* Returns descriptors for all properties of the bean.
* May return {@code null} if the information
* should be obtained by automatic analysis.
* <p>
* If a property is indexed, then its entry in the result array
* will belong to the {@link IndexedPropertyDescriptor} subclass
* of the {@link PropertyDescriptor} class.
* A client of the {@code getPropertyDescriptors} method
* can use "{@code instanceof}" to check
* whether a given {@code PropertyDescriptor}
* is an {@code IndexedPropertyDescriptor}.
*
* @return an array of {@code PropertyDescriptor}s
* describing all properties supported by the bean
* or {@code null}
*/
// PropertyDescriptor[] getPropertyDescriptors();
/**
* A bean may have a "default" property that is the property that will
* mostly commonly be initially chosen for update by human's who are
* customizing the bean.
* @return Index of default property in the PropertyDescriptor array
* returned by getPropertyDescriptors.
* <P> Returns -1 if there is no default property.
*/
// int getDefaultPropertyIndex();
/**
* Gets the beans <code>MethodDescriptor</code>s.
*
* @return An array of MethodDescriptors describing the externally
* visible methods supported by this bean. May return null if
* the information should be obtained by automatic analysis.
*/
// MethodDescriptor[] getMethodDescriptors();
/**
* This method allows a BeanInfo object to return an arbitrary collection
* of other BeanInfo objects that provide additional information on the
* current bean.
* <P>
* If there are conflicts or overlaps between the information provided
* by different BeanInfo objects, then the current BeanInfo takes precedence
* over the getAdditionalBeanInfo objects, and later elements in the array
* take precedence over earlier ones.
*
* @return an array of BeanInfo objects. May return null.
*/
// BeanInfo[] getAdditionalBeanInfo();
}