Package org.ametys.cms.transformation
Class ConsistencyChecker
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.transformation.ConsistencyChecker
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class ConsistencyChecker extends AbstractLogEnabled implements Serviceable, Component
Consistency checker component. Checks the state of the links extracted as outgoing references for a content.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConsistencyChecker.CHECK
The state of the check
-
Field Summary
Fields Modifier and Type Field Description protected URIResolverExtensionPoint
_uriResolverEP
The ametys uri resolverprotected HttpUrlUtils
_urlUtils
The URL utilsprotected VersionsHandler
_versionsHandler
The version handlerstatic String
CONSISTENCY_EXTERNAL_REFERENCE_TYPE
Constants for the special external type for outgoing referencesstatic String
ROLE
Avalon role
-
Constructor Summary
Constructors Constructor Description ConsistencyChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConsistencyChecker.CHECK
_checkHTTPLink(String linkValue, boolean shortTest)
Test an http linkConsistencyChecker.CHECK
checkConsistency(String referenceType, String referenceValue, String contentId, String dataPath, boolean shortTest)
Check the consistency of a referenceI18nizableText
getLabel(String referenceType, String referenceValue, String contentId, String dataPath)
Get the label of a reference.void
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
CONSISTENCY_EXTERNAL_REFERENCE_TYPE
public static final String CONSISTENCY_EXTERNAL_REFERENCE_TYPE
Constants for the special external type for outgoing references- See Also:
- Constant Field Values
-
_uriResolverEP
protected URIResolverExtensionPoint _uriResolverEP
The ametys uri resolver
-
_versionsHandler
protected VersionsHandler _versionsHandler
The version handler
-
_urlUtils
protected HttpUrlUtils _urlUtils
The URL utils
-
-
Constructor Detail
-
ConsistencyChecker
public ConsistencyChecker()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkConsistency
public ConsistencyChecker.CHECK checkConsistency(String referenceType, String referenceValue, String contentId, String dataPath, boolean shortTest)
Check the consistency of a reference- Parameters:
referenceType
- The type of the reference to test (can be 'attachment', 'explorer', 'metadata', '__external', etc...)referenceValue
- The value of the reference to testcontentId
- The id of the content containing the referencedataPath
- The path of the data containing the referenceshortTest
- true to make a short test, that means that long tests will return UNKNOWN immediately. If false, you will always have a SUCCESS or a FAILURE.- Returns:
- CHECK enum value
-
getLabel
public I18nizableText getLabel(String referenceType, String referenceValue, String contentId, String dataPath)
Get the label of a reference.- Parameters:
referenceType
- The type of the reference to test (can be 'attachment', 'explorer', 'metadata', '__external', etc...)referenceValue
- The value of the reference to testcontentId
- The id of the content containing the referencedataPath
- The path of the data containing the reference- Returns:
- the element label.
-
_checkHTTPLink
protected ConsistencyChecker.CHECK _checkHTTPLink(String linkValue, boolean shortTest)
Test an http link- Parameters:
linkValue
- The http url to testshortTest
- true to make a short test (with short timeout)- Returns:
- The state. UNKNOWN if test cannot be done fully
-
-