import java.util.List;
-
/**
* Authorization service with persistent storage. This is a wrapper for
- * {@link org.wamblee.security.authorization.DefaultAuthorizationService}
- * which refreshes the state of the service at certain time intervals.
- *
+ * {@link org.wamblee.security.authorization.DefaultAuthorizationService} which
+ * refreshes the state of the service at certain time intervals.
+ *
* @author Erik Brakkee
*/
public class PersistentAuthorizationService extends AbstractPersistent
*/
private long lastRefreshTime;
-/**
+ /**
* Constructs the persistent service.
*
* @param aName
public PersistentAuthorizationService(String aName,
HibernateTemplate aTemplate, UserAccessor aAccessor,
long aRefreshInterval) {
- template = aTemplate;
- refreshInterval = aRefreshInterval;
- lastRefreshTime = System.currentTimeMillis();
- userAccessor = aAccessor;
- name = aName;
+ template = aTemplate;
+ refreshInterval = aRefreshInterval;
+ lastRefreshTime = System.currentTimeMillis();
+ userAccessor = aAccessor;
+ name = aName;
}
/**
* Initialize service if needed.
- *
- * @throws IllegalArgumentException DOCUMENT ME!
+ *
*/
private void initialize() {
if (service == null) {
if (result.size() > 1) {
throw new IllegalArgumentException(
- "Returned more than one service for name '" + name + "' ("
- + result.size() + ")");
+ "Returned more than one service for name '" + name + "' (" +
+ result.size() + ")");
}
if (result.size() == 0) {
/*
* (non-Javadoc)
- *
- * @see org.wamblee.security.authorization.AuthorizationService#isAllowed(java.lang.Object,
- * org.wamblee.security.authorization.Operation)
- */
- /**
- * DOCUMENT ME!
- *
- * @param aResource DOCUMENT ME!
- * @param aOperation DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationService#isAllowed(java
+ * .lang.Object, org.wamblee.security.authorization.Operation)
*/
public boolean isAllowed(Object aResource, Operation aOperation) {
initialize();
return service.isAllowed(aResource, aOperation);
}
- /* (non-Javadoc)
- * @see org.wamblee.security.authorization.AuthorizationService#check(T, org.wamblee.security.authorization.Operation)
- */
- /**
- * DOCUMENT ME!
- *
- * @param <T> DOCUMENT ME!
- * @param aResource DOCUMENT ME!
- * @param aOperation DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.wamblee.security.authorization.AuthorizationService#check(T,
+ * org.wamblee.security.authorization.Operation)
*/
public <T> T check(T aResource, Operation aOperation) {
initialize();
/*
* (non-Javadoc)
- *
+ *
* @see org.wamblee.security.authorization.AuthorizationService#getRules()
*/
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
public AuthorizationRule[] getRules() {
initialize();
refresh();
/*
* (non-Javadoc)
- *
- * @see org.wamblee.security.authorization.AuthorizationService#appendRule(org.wamblee.security.authorization.AuthorizationRule)
- */
- /**
- * DOCUMENT ME!
- *
- * @param aRule DOCUMENT ME!
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationService#appendRule(org
+ * .wamblee.security.authorization.AuthorizationRule)
*/
public void appendRule(AuthorizationRule aRule) {
initialize();
/*
* (non-Javadoc)
- *
- * @see org.wamblee.security.authorization.AuthorizationService#removeRule(int)
- */
- /**
- * DOCUMENT ME!
- *
- * @param aIndex DOCUMENT ME!
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationService#removeRule(int)
*/
public void removeRule(int aIndex) {
initialize();
/*
* (non-Javadoc)
- *
- * @see org.wamblee.security.authorization.AuthorizationService#insertRuleAfter(int,
- * org.wamblee.security.authorization.AuthorizationRule)
- */
- /**
- * DOCUMENT ME!
- *
- * @param aIndex DOCUMENT ME!
- * @param aRule DOCUMENT ME!
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationService#insertRuleAfter
+ * (int, org.wamblee.security.authorization.AuthorizationRule)
*/
public void insertRuleAfter(int aIndex, AuthorizationRule aRule) {
initialize();