Evidence Registrar Module

Google Guice dependency injection should be used in order to register the different evidence types and their implementations. This can be done by writing a new module class, or adding to a pre existing one. Once this is added to the ModuleCalssName table, then at runtime it will be loaded and the evidence types registered.

Example

/*
 * Copyright 2011 Cúram Software Ltd.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information 
 * of Cúram Software, Ltd. ("Confidential Information").  You 
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement 
 * you entered into with Cúram Software.
 */
      
package curam.seg.evidence.service.impl;
      
      
import curam.codetable.CASEEVIDENCE;
import com.google.inject.AbstractModule;
import curam.core.impl.FactoryMethodHelper;
import java.lang.reflect.Method;
import com.google.inject.multibindings.MapBinder;
import curam.core.impl.RegistrarImpl;
import curam.core.impl.Registrar.RegistrarType;

      
/**
 * A module class which provides registration for all of the 
 * evidence hook implementations.
 */
public class SEGRegistrarModule extends AbstractModule {

  @Override
  public void configure() {
    
    // Register all hook implementations which implement the 
    // interface EvidenceInterface.
    MapBinder<String, Method> evidenceInterfaceMapBinder =
      MapBinder.newMapBinder(binder(), String.class, 
        Method.class, new RegistrarImpl(RegistrarType.EVIDENCE));
        
    evidenceInterfaceMapBinder
      .addBinding(CASEEVIDENCE.ASSET)
        .toInstance(FactoryMethodHelper.getNewInstanceMethod(
          curam.seg.evidence.entity.fact.AssetFactory.class));
  }
}