Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
None
-
None
Description
By adding the required property file to the META-INF/services directory this will allow to instantiate a ContentItemFactory instance by using the Java ServiceLoader utility
Example code snippet:
private ContentITemFactory contentItemFactory;
public ContentItemFactory getContentItemFactory(){
if(contentItemFactory == null){
ServiceLoader<ContentItemFactory> loader = ServiceLoader.load(ContentItemFactory.class);
Iterator<ContentItemFactory> cifIt = loader.iterator();
if(cifIt.hasNext())
else
{ throw new IllegalStateException("No ContentItemFactory Implementation available!"); } }
return contentItemFactory;
}
Intended to be used when instantiating a ContentItemFactory in the absence of an OSGI environment.