/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.ocelotds;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.inject.Inject;
import org.ocelotds.logger.OcelotLogger;
import org.slf4j.Logger;

/**
 *
 * @author hhfrancois
 */
public abstract class AbstractServiceProvider implements IServicesProvider {

	@Inject
	@OcelotLogger
	private Logger logger;

	protected abstract String getFilename();
	
	@Override
	public void streamJavascriptServices(OutputStream out) {
		String jsname = getFilename();
		try (InputStream in = getJsStream(jsname)) {
			if(null != in) {
				byte[] buffer = new byte[Constants.DEFAULT_BUFFER_SIZE];
				int n = 0;
				while (-1 != (n = in.read(buffer))) {
					out.write(buffer, 0, n);
				}
			} else {
				logger.warn("Generation of '{}' failed. File not found", jsname);
			}
		} catch(IOException ex) {
			logger.error("Generation of '"+jsname+"' failed.", ex);
		}
	}
	
	InputStream getJsStream(String jsname) {
		ClassLoader classLoader = this.getClass().getClassLoader();
		if(null != classLoader) {
			return classLoader.getResourceAsStream(jsname);
		}
		return null;
	}
	
}

@@ -325,63 +325,18 @@
 ort 
-javax.inject.Inject;%0D%0Aimport org.ocelotds.logger.Ocelot
+org.slf4j.
 Logg
@@ -359,24 +359,31 @@
 slf4j.Logger
+Factory
 ;%0D%0A%0D%0A/**%0D%0A *
@@ -497,55 +497,92 @@
 %0A%0D%0A%09
-@Inject%0D%0A%09@OcelotLogger%0D%0A%09private Logger logger
+private final Logger logger = LoggerFactory.getLogger(AbstractServiceProvider.class)
 ;%0D%0A%0D

move LoggerProducer in core