/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mskcc.shenkers.control.track.config;

import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import org.mskcc.shenkers.control.track.bam.BamContext;
import org.mskcc.shenkers.control.track.bam.BamView1;
import org.mskcc.shenkers.control.track.bam.BamView2;
import org.mskcc.shenkers.control.track.TrackBuilder;
import org.mskcc.shenkers.control.track.TrackBuilderImpl;
import org.mskcc.shenkers.control.track.TrackFactory;
import org.mskcc.shenkers.control.track.TrackFactoryImpl;
import org.mskcc.shenkers.control.track.View;

/**
 *
 * @author sol
 */
public class TrackConfiguration extends AbstractModule {

    @Override
    protected void configure() {
        // Configure the builder implementation
        bind(TrackBuilder.class).to(TrackBuilderImpl.class);
        
        // For each data type, bind a single factory
        bind(new TypeLiteral<TrackFactory<BamContext>>() {})
                .to(new TypeLiteral<TrackFactoryImpl<BamContext>>() {});
        
        // For each data type, bind all available views to be injected into the factory
        TypeLiteral<View<BamContext>> bamViewType = new TypeLiteral<View<BamContext>>() {};
        Multibinder<View<BamContext>> bamViews = Multibinder.newSetBinder(binder(), bamViewType);
        bamViews.addBinding().to(BamView1.class);
        bamViews.addBinding().to(BamView2.class);
    }

}

@@ -792,16 +792,260 @@
 ck.View;
+%0Aimport org.mskcc.shenkers.control.track.bigwig.BigWigContext;%0Aimport org.mskcc.shenkers.control.track.bigwig.BigWigView;%0Aimport org.mskcc.shenkers.control.track.gene.GeneModelContext;%0Aimport org.mskcc.shenkers.control.track.gene.GeneModelView;
 %0A%0A/**%0A *
@@ -1332,32 +1332,47 @@
  single factory%0A
+        // BAM%0A
         bind(new
@@ -1489,16 +1489,344 @@
 () %7B%7D);%0A
+        // BIGWIG%0A        bind(new TypeLiteral%3CTrackFactory%3CBigWigContext%3E%3E() %7B%7D)%0A                .to(new TypeLiteral%3CTrackFactoryImpl%3CBigWigContext%3E%3E() %7B%7D);%0A        %0A        // GTF%0A        bind(new TypeLiteral%3CTrackFactory%3CGeneModelContext%3E%3E() %7B%7D)%0A                .to(new TypeLiteral%3CTrackFactoryImpl%3CGeneModelContext%3E%3E() %7B%7D);%0A
         
@@ -1906,32 +1906,47 @@
 nto the factory%0A
+        // BAM%0A
         TypeLite
@@ -2119,16 +2119,18 @@
 wType);%0A
+//
         
@@ -2217,21 +2217,587 @@
 ew2.class);%0A
+        //BIGWIG%0A        TypeLiteral%3CView%3CBigWigContext%3E%3E bigWigViewType = new TypeLiteral%3CView%3CBigWigContext%3E%3E() %7B%7D;%0A        Multibinder%3CView%3CBigWigContext%3E%3E bigWigViews = Multibinder.newSetBinder(binder(), bigWigViewType);%0A        bigWigViews.addBinding().to(BigWigView.class);%0A        %0A        //GTF%0A        TypeLiteral%3CView%3CGeneModelContext%3E%3E gtfViewType = new TypeLiteral%3CView%3CGeneModelContext%3E%3E() %7B%7D;%0A        Multibinder%3CView%3CGeneModelContext%3E%3E gtfViews = Multibinder.newSetBinder(binder(), gtfViewType);%0A        gtfViews.addBinding().to(GeneModelView.class);%0A
     %7D%0A%0A%7D%0A

support for bigwig and gtf files