/**
* Processes PortletPreferencesValidator annotated classes. The preferences validators are temorarily stored while
* the portlet configuration annotations are being processed.
*
* @param cls
* The annotated class
*/
@Override
public void processValidatorAnnotation(Class<?> cls) {
PortletPreferencesValidator vali = cls.getAnnotation(PortletPreferencesValidator.class);
if (vali != null) {
if (!PreferencesValidator.class.isAssignableFrom(cls)) {
StringBuilder txt = new StringBuilder(128);
txt.append("@PortletPreferencesValidator annotated class must implement PreferencesValidator interface. ");
txt.append(", class: ").append(cls.getCanonicalName());
LOG.warn(txt.toString());
throw new IllegalArgumentException(txt.toString());
}
String clsName = cls.getCanonicalName();
prefValidators.put(vali, clsName);
}
}
java类javax.portlet.PreferencesValidator的实例源码
JSR362ConfigurationProcessor.java 文件源码
项目:portals-pluto
阅读 20
收藏 0
点赞 0
评论 0
PortletPreferencesImpl.java 文件源码
项目:portals-pluto
阅读 25
收藏 0
点赞 0
评论 0
/**
* Stores the portlet preferences to a persistent storage. If a preferences
* validator is defined for this portlet, this method firstly validates the
* portlet preferences.
* <p>
* This method is invoked internally, thus it does not check the portlet
* request method ID (METHOD_RENDER or METHOD_ACTION).
* </p>
* @throws ValidatorException if the portlet preferences are not valid.
* @throws IOException if an error occurs with the persistence mechanism.
*/
protected final void internalStore() throws IOException, ValidatorException {
// Validate the preferences before storing, if a validator is defined.
// If the preferences cannot pass the validation,
// an ValidatorException will be thrown out.
PortletDefinition portletD = window.getPortletDefinition();
PreferencesValidator validator = preferencesService.getPreferencesValidator(portletD);
if (validator != null)
{
validator.validate(this);
}
// Store the portlet preferences.
try {
preferencesService.store(window, request, preferences);
} catch (PortletContainerException ex) {
LOG.error("Error storing preferences.", ex);
throw new IOException("Error storing perferences: " + ex.getMessage());
}
}
MockPortletPreferences.java 文件源码
项目:spring4-understanding
阅读 19
收藏 0
点赞 0
评论 0
public void setPreferencesValidator(PreferencesValidator preferencesValidator) {
this.preferencesValidator = preferencesValidator;
}
MockPortletPreferences.java 文件源码
项目:spring4-understanding
阅读 20
收藏 0
点赞 0
评论 0
public void setPreferencesValidator(PreferencesValidator preferencesValidator) {
this.preferencesValidator = preferencesValidator;
}
MockPortletPreferences.java 文件源码
项目:class-guard
阅读 18
收藏 0
点赞 0
评论 0
public void setPreferencesValidator(PreferencesValidator preferencesValidator) {
this.preferencesValidator = preferencesValidator;
}
MockPortletPreferences.java 文件源码
项目:class-guard
阅读 19
收藏 0
点赞 0
评论 0
public void setPreferencesValidator(PreferencesValidator preferencesValidator) {
this.preferencesValidator = preferencesValidator;
}
PortletPreferencesManagerImpl.java 文件源码
项目:GridSphere
阅读 19
收藏 0
点赞 0
评论 0
public PortletPreferencesManagerImpl(org.gridsphere.portletcontainer.impl.descriptor.PortletPreferences prefsDesc, PreferencesValidator validator) {
PersistenceManagerService pms = (PersistenceManagerService) PortletServiceFactory.createPortletService(PersistenceManagerService.class, true);
pm = pms.createGridSphereRdbms();
this.prefsDesc = prefsDesc;
this.validator = validator;
}
PortletPreferencesImpl.java 文件源码
项目:GridSphere
阅读 19
收藏 0
点赞 0
评论 0
public PreferencesValidator getValidator() {
return validator;
}
PortletPreferencesImpl.java 文件源码
项目:GridSphere
阅读 19
收藏 0
点赞 0
评论 0
public void setValidator(PreferencesValidator validator) {
this.validator = validator;
}
PortletPreferencesService.java 文件源码
项目:portals-pluto
阅读 17
收藏 0
点赞 0
评论 0
/**
* Returns the preferences validator instance for the given portlet
* definition. If no preferences validator class is defined for the portlet
* definition, null is returned. This method caches the validator instances
* in the cache to ensure that only one validator instance is created per
* portlet definition.
* @param portletDefinition the portlet definition.
* @return the preferences validator if defined for the portlet definition.
* @throw ValidatorException if fail to instantiate validator instance.
*/
PreferencesValidator getPreferencesValidator(PortletDefinition portletDefinition)
throws ValidatorException;