Uploaded image for project: 'Stanbol (Retired)'
  1. Stanbol (Retired)
  2. STANBOL-884

Add ServiceLoader support for the ContentItemFactory

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • enhancer-0.10.0
    • Enhancer
    • 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())

      { contentItemFactory = cifIt.next(); }

      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.

      Attachments

        Activity

          People

            rwesten Rupert Westenthaler
            rwesten Rupert Westenthaler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment