All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.elephantdrummer.DrummerStarter Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package com.elephantdrummer;


import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import com.elephantdrummer.container.ClassFinder;
import com.elephantdrummer.container.Container;
import com.elephantdrummer.scope.DrummerObservable;


/**
 * Copyright 2018 Elephant Software Klaudiusz Wojtkowiak e-mail: [email protected]
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0 
 *  
 *  Unless required by applicable law or agreed to in writing, software 
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
 */
public class DrummerStarter {
	
	private static DrummerBoot boot=Container.getElement(DrummerBoot.class);
	
	 public static final void init(Properties properties) {
		 if (properties==null==false) {
			 Map map=new HashMap<>();
			 properties.keySet().forEach(key->{
				 map.put((String)key, (String)properties.getProperty((String)key));
			 });
			 boot.setConfigProperties(map); 
		 }

		 init();
	 }
	 

		
	
	 public static final void init(Map properties) {
		 boot.setConfigProperties(properties);
		 init();
	 }

	  public static final void init() {
		  
		  ClassFinder cf=new ClassFinder();
		  List> vec2=cf.findSubclasses(DrummerObservable.class.getName());
		  List vec3=new LinkedList<>();
		  
		  for (Class cl:vec2) {
			  try {
				  vec3.add((DrummerObservable) cl.newInstance());
			  } catch (InstantiationException | IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
			  }
		  }
		  
		  boot.boot(vec3);
	  }

	  
	  public static final DrummerJobManager getDrummerJobManager() {
		  return boot;
	  }
	  


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy