package org.tt.core.dm;

import org.tt.core.fetch.AbstractDataFetcher;
import org.tt.core.sql.AbstractQueries;
import org.tt.core.sql.AbstractSQLManager;

public class TTFactory {
    private AbstractSQLManager sqlm;
    private AbstractQueries qrs;
    private AbstractDataFetcher df;

    public TTFactory() {
    }

    public TTFactory(AbstractSQLManager sqlm, AbstractQueries qrs, AbstractDataFetcher df) {
        this.sqlm = sqlm;
        this.qrs = qrs;
        this.df = df;
    }

    public TTFactory(AbstractSQLManager sqlm, AbstractDataFetcher df) {
        this.sqlm = sqlm;
        this.df = df;
    }

    public void setSQLManager(AbstractSQLManager sqlm) {
        this.sqlm = sqlm;
    }

    public void setSQLQueries(AbstractQueries qrs) {
        this.qrs = qrs;
    }

    public void setDataFetcher(AbstractDataFetcher df) {
        this.df = df;
    }

    public TTUpdateManager produceUpdateManager() {
        return new TTUpdateManager(sqlm, df);
    }

    public TTDeliveryManager produceDeliveryManager() {
        return new TTDeliveryManager(sqlm);
    }


}

@@ -177,32 +177,39 @@
 y %7B%0A    private 
+static 
 AbstractSQLManag
@@ -221,32 +221,39 @@
 lm;%0A    private 
+static 
 AbstractQueries 
@@ -269,16 +269,23 @@
 private 
+static 
 Abstract
@@ -300,27 +300,62 @@
 her df;%0A
-%0A    public
+    private static TTFactory ttf;%0A%0A    private
  TTFacto
@@ -371,32 +371,39 @@
   %7D%0A%0A    public 
+static 
 TTFactory(Abstra
@@ -399,277 +399,115 @@
 tory
-(AbstractSQLManager sqlm, AbstractQueries qrs, AbstractDataFetcher df) %7B%0A        this.sqlm = sqlm;%0A        this.qrs = qrs;%0A        this.df = df;%0A    %7D%0A%0A    public TTFactory(AbstractSQLManager sqlm, AbstractDataFetcher df) %7B%0A        this.sqlm = sqlm;%0A        this.df = d
+ getInstance() %7B%0A        if (ttf == null) %7B%0A            ttf = new TTFactory();%0A        %7D%0A%0A        return tt
 f;%0A 

Rework TTFactory for singleton pattern