Use Your Own Factory Producer Implementation

  • Implement your own custom factory producer.
    • You can extend the existing DefaultFactoryProducer class.
    • Otherwise, make sure your own class implements the tools.gsf.config.FactoryProducer interface.
  • Register it, in one of the following ways:
    1. Via META-INF/gsf-factory-producer:
      1. Create a file named "gsf-factory-producer".
      2. Inside the file, add a line with the fully-qualified name of your custom factory producer class, as in:
        com.mycompany.wcs.gsf.config.MyCustomFactoryProducer
      3. Package that file inside the "META-INF" folder of any JAR you are deploying inside the WCS 12c web app.
        • Typically, you'd put it inside your custom JAR file (e.g. the one containing the custom factory producer class itself).
      4. Deploy the JAR file containing your "gsf-factory-producer" file inside the WCS web app.
    2. Via web.xml:
      1. Inside your WCS 12c web app's web.xml descriptor, add a context-param called "gsf-factory-producer" and specify the fully-qualified classname of your factory producer class. For example:
        <context-param>
           <param-name>gsf-factory-producer</param-name>
           <param-value>com.mycompany.wcs.gsf.config.MyCustomFactoryProducer</param-value>
        </context-param>
      2. Redeploy (and restart) the WCS 12c web app so it picks up the updated web.xml descriptor.

Use the SitePlanNavService Implementation

  • All you need is to:
    • Create your own AssetNode implementation, and
    • Create your own NavService implementation by extending SitePlanNavService.
    • Make sure your IcsBackedFactory (instantiates and) exposes your NavService implementation (via a @ServiceProducer method).
  • We strongly advise you to look at the gsf-sample's implementation before trying to figure everything out from scratch on your own.
    • In most cases, gsf-sample's AssetNode implementation should be reusable to the point where all you need to adjust is the logic for populating the node's data map with your own model-specific data.
      • In any case, that is just one of multiple ways of implementing AssetNode.
      • If needed, you can create your own AssetNode from scratch. If you do so, we strongly advise you to look at AbstractAssetNode first.
    • In most cases, gst-sample's SitePlanNavService implementation should be reusable to the point where implementing your own class only implies:
      • Specifying your own class' generic type as your own AssetNode implementation.
      • Implementing your own class' createAssetNode method, which is where you hook-up your own AssetNode implementation.
      • Implementing your own class' constructor, making sure it gets everything it needs in order to instantiate your own AssetNode implementation.
  • Plugging in your own NavService is simple (see below)

Expose Your Own NavService Implementation

  • Implement your own object factory.
  • Make your custom bean / object available by having a Service Producer method in your own object factory instantiate it:
    • You must add the due Service Producer method to your own implementation; for example:
      @ServiceProducer(cache = true)
      public NavService<AssetNode> createNavService(final ICS ics) {
          TemplateAssetAccess dao = getObject("templateAssetAccess", TemplateAssetAccess.class);
          return new MyCustomNavServiceImplementation(ics, dao);
      }