/*
(non-Javadoc)

@see
com.impetus.kundera.loader.GenericClientFactory#initialize(java.util.Map)
16914
@Override
    public void initialize(Map<String, Object> puProperties)
    {
        reader = new RethinkDBEntityReader(kunderaMetadata);
        setExternalProperties(puProperties);
        initializePropertyReader();
        PersistenceUnitMetadata pum = kunderaMetadata.getApplicationMetadata()
                .getPersistenceUnitMetadata(getPersistenceUnit());

        Properties pumProps = pum.getProperties();

        if (puProperties != null)
        {
            pumProps.putAll(puProperties);
        }

        String host = pumProps.getProperty("kundera.nodes");
        String port = pumProps.getProperty("kundera.port");

        if (host == null || port == null)
        {
            throw new KunderaException("Hostname/IP or Port is null.");
        }

        connection = r.connection().hostname(host).port(Integer.parseInt(port)).connect();

    }
1031241
@Override
	public void initialize() throws RepositoryException{
		initialized = true;
		try {

			queryEngine = configuration.loadQueryEngine();
			queryEngine.connect();
		}
		catch (Exception e){
			throw new RepositoryException(e);
		}
	}
741172
public void initPropertyMap() {
        propertyMap = new HashMap<String, EntityColumn>(getEntityClassColumns().size());
        for (EntityColumn column : getEntityClassColumns()) {
            propertyMap.put(column.getProperty(), column);
        }
    }
524295
protected void initialize()
	{
		// init transient fields
		bcmListeners = new ArrayList<BeanContextMembershipListener>();
		children = new HashMap();
		serializing = false;
		inNeedsGui = false;
		nonSerPCL = new PropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent event)
			{
				BeanContextSupport.this.propertyChange(event);
			}
		};
	}
1125956
protected synchronized void initialize() {
        String invocationServiceName = this.invocationServiceName;
        invocationService = (InvocationService)
                CacheFactory.getService(invocationServiceName);
        if (invocationService == null) {
            throw new IllegalArgumentException("Invocation service ["
                                               + invocationServiceName
                                               + "] is not defined.");
        }

        invocationService.addMemberListener(this);
        serviceMembers = invocationService.getInfo().getServiceMembers();
        memberIterator = serviceMembers.iterator();
    }
386174
@Override
	protected void initialize() {
		super.initialize();
		ClientLayerTreeInfo ltwli = (ClientLayerTreeInfo) mapWidget.getMapModel().getMapInfo()
				.getWidgetInfo(ClientLayerTreeInfo.IDENTIFIER);
		setIconSize(ltwli == null ? GltLayout.layerTreeIconSize : ltwli.getIconSize());

		for (Layer<?> layer : mapModel.getLayers()) {
			registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() {

				public void onLabelChange(LayerLabeledEvent event) {
					GWT.log("Legend: onLabelChange() - " + event.getLayer().getLabel());
					// find the node & update the icon
					for (TreeNode node : tree.getAllNodes()) {
						if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
							((LayerTreeTreeNode) node).updateIcon();
						}
					}
				}

				public void onVisibleChange(LayerShownEvent event) {
					GWT.log("Legend: onVisibleChange() - " + event.getLayer().getLabel());
					// find the node & update the icon
					for (TreeNode node : tree.getAllNodes()) {
						if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
							((LayerTreeTreeNode) node).updateIcon();
						}
					}
				}
			}));
			registrations.add(layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() {

				public void onLayerStyleChange(LayerStyleChangeEvent event) {
					GWT.log("Legend: onLayerStyleChange()");
					Layer<?> layer = event.getLayer();
					if (layer instanceof VectorLayer) {
						for (LayerTreeLegendItemNode node : legendIcons.get(layer)) {
							node.updateStyle((VectorLayer) layer);
						}
					}
				}
			}));

			if (layer instanceof VectorLayer) {
				VectorLayer vl = (VectorLayer) layer;
				registrations.add(vl.addLayerFilteredHandler(new LayerFilteredHandler() {

					public void onFilterChange(LayerFilteredEvent event) {
						GWT.log("Legend: onLayerFilterChange() - " + event.getLayer().getLabel());
						// find the node & update the icon
						for (TreeNode node : tree.getAllNodes()) {
							if (node.getName().equals(event.getLayer().getLabel()) 
									&& node instanceof LayerTreeTreeNode) {
								((LayerTreeTreeNode) node).updateIcon();
							}
						}
					}
				}));
			}
		}
	}
310669
@Override
    public void initialize(Map<String, Object> externalProperty)
    {
        reader = new CouchDBEntityReader(kunderaMetadata);
        initializePropertyReader();
        setExternalProperties(externalProperty);
    }
446651
@Override
  public void initialize() {
    if(databaseConnection == null) {
      return; // Supposedly we initialized already.
    }
    if(LOG.isDebugging()) {
      LOG.debugFine("Loading data from database connection.");
    }
    MultipleObjectsBundle bundle = databaseConnection.loadData();
    // Run at most once.
    databaseConnection = null;

    // Find DBIDs for bundle
    {
      DBIDs bids = bundle.getDBIDs();
      if(bids instanceof ArrayStaticDBIDs) {
        this.ids = (ArrayStaticDBIDs) bids;
      }
      else if(bids == null) {
        this.ids = DBIDUtil.generateStaticDBIDRange(bundle.dataLength());
      }
      else {
        this.ids = (ArrayStaticDBIDs) DBIDUtil.makeUnmodifiable(DBIDUtil.ensureArray(bids));
      }
    }
    // Replace id representation (it would be nicer if we would not need
    // DBIDView at all)
    this.idrep = new DBIDView(this.ids);
    relations.add(this.idrep);
    getHierarchy().add(this, idrep);

    DBIDArrayIter it = this.ids.iter();

    int numrel = bundle.metaLength();
    for(int i = 0; i < numrel; i++) {
      SimpleTypeInformation<?> meta = bundle.meta(i);
      @SuppressWarnings("unchecked")
      SimpleTypeInformation<Object> ometa = (SimpleTypeInformation<Object>) meta;
      WritableDataStore<Object> store = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_DB, ometa.getRestrictionClass());
      for(it.seek(0); it.valid(); it.advance()) {
        store.put(it, bundle.data(it.getOffset(), i));
      }
      Relation<?> relation = new MaterializedRelation<>(ometa, ids, null, store);
      relations.add(relation);
      getHierarchy().add(this, relation);

      // Try to add indexes where appropriate
      for(IndexFactory<?> factory : indexFactories) {
        if(factory.getInputTypeRestriction().isAssignableFromType(ometa)) {
          @SuppressWarnings("unchecked")
          final IndexFactory<Object> ofact = (IndexFactory<Object>) factory;
          @SuppressWarnings("unchecked")
          final Relation<Object> orep = (Relation<Object>) relation;
          final Index index = ofact.instantiate(orep);
          Duration duration = LOG.isStatistics() ? LOG.newDuration(index.getClass().getName() + ".construction").begin() : null;
          index.initialize();
          if(duration != null) {
            LOG.statistics(duration.end());
          }
          getHierarchy().add(relation, index);
        }
      }
    }

    // fire insertion event
    eventManager.fireObjectsInserted(ids);
  }
1041878
public void init(final Map<String, Map<String, DataSourceConfiguration>> dataSourceConfigurationMap,
                     final Map<String, RuleConfiguration> schemaRuleMap, final Authentication authentication, final Properties props) {
        for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourceConfigurationMap.entrySet()) {
            configService.persistConfiguration(entry.getKey(), dataSourceConfigurationMap.get(entry.getKey()), schemaRuleMap.get(entry.getKey()), authentication, props, isOverwrite);
        }
        stateService.persistInstanceOnline();
        stateService.persistDataSourcesNode();
        listenerManager.initListeners();
    }
35446
@Override
    protected void initializeImpl()
    {
        //get logger
        Logger logger=this.getLogger();

        //get use persistent connection value
        this.usePersistentConnection=Boolean.parseBoolean(this.getConfigurationValue(FaxClientSpiConfigurationConstants.USE_PERSISTENT_CONNECTION_PROPERTY_KEY));
        logger.logDebug(new Object[]{"Using persistent connection: ",String.valueOf(this.usePersistentConnection)},null);
        
        //setup connection factory
        String className=this.getConfigurationValue(FaxClientSpiConfigurationConstants.CONNECTION_FACTORY_CLASS_NAME_PROPERTY_KEY);
        this.connectionFactory=this.createMailConnectionFactoryImpl(className);
        if(this.connectionFactory==null)
        {
            throw new FaxException("Mail connection factory is not available.");
        }
    }
1100054
@SuppressWarnings("unchecked")
	@Override
	public void initialize() {
		// grab a handle to the hash table from the iteration broker
		if (taskContext instanceof AbstractIterativePactTask) {
			AbstractIterativePactTask<?, ?> iterativeTaskContext = (AbstractIterativePactTask<?, ?>) taskContext;
			String identifier = iterativeTaskContext.brokerKey();
			this.hashTable = (CompactingHashTable<IT1>) SolutionSetBroker.instance().get(identifier);
		} else {
			throw new RuntimeException("The task context of this driver is no iterative task context.");
		}
		
		TypeSerializer<IT1> buildSideSerializer = hashTable.getBuildSideSerializer();
		TypeComparator<IT1> buildSideComparator = hashTable.getBuildSideComparator().duplicate();
		
		probeSideSerializer = taskContext.<IT2>getInputSerializer(0).getSerializer();
		probeSideComparator = taskContext.getInputComparator(0);
		
		solutionSideRecord = buildSideSerializer.createInstance();
		
		TypePairComparatorFactory<IT1, IT2> pairCompFactory = taskContext.getTaskConfig().getPairComparatorFactory(taskContext.getUserCodeClassLoader());
		pairComparator = pairCompFactory.createComparator21(buildSideComparator, probeSideComparator);
	}
493946
public static void initialize(Object instance, Map namedArgs) {
        PersistentEntity dc = getDomainClass(instance);
        if (dc == null) {
            DataBindingUtils.bindObjectToInstance(instance, namedArgs);
        }
        else {
            DataBindingUtils.bindObjectToDomainInstance(dc, instance, namedArgs);
            DataBindingUtils.assignBidirectionalAssociations(instance, namedArgs, dc);
        }
        autowire(instance);
    }
958055
@Override
	public void initialize(Map<String, Object> properties) throws IOException {
		for(int index = elements.size() - 1; index >= 0; index--) {
			ITemplateProviderElement provider = elements.get(index);
			if(coreLogger.isTraceEnabled()) coreLogger.trace(Logs.LOG_02,
					ansiString(GREEN, provider.getClass().getSimpleName()),
					ansiString(GREEN, provider.getOrder())
			);
			Map<String, String> providerProperties = provider.initialize();
			if(providerProperties != null) {
				properties.putAll(providerProperties);
				properties.put(provider.getScope(), Collections.unmodifiableMap(providerProperties));
			}
		}
	}
916717
@Override
	@SuppressWarnings("unchecked")
	public void initialize() {
		
		// grab a handle to the hash table from the iteration broker
		if (taskContext instanceof AbstractIterativePactTask) {
			AbstractIterativePactTask<?, ?> iterativeTaskContext = (AbstractIterativePactTask<?, ?>) taskContext;
			String identifier = iterativeTaskContext.brokerKey();
			this.hashTable = (CompactingHashTable<IT1>) SolutionSetBroker.instance().get(identifier);
		} else {
			throw new RuntimeException("The task context of this driver is no iterative task context.");
		}
		
		TaskConfig config = taskContext.getTaskConfig();
		ClassLoader classLoader = taskContext.getUserCodeClassLoader();
		
		TypeSerializer<IT1> solutionSetSerializer = this.hashTable.getBuildSideSerializer();
		TypeSerializer<IT2> probeSideSerializer = taskContext.<IT2>getInputSerializer(0).getSerializer();
		
		TypeComparatorFactory<IT2> probeSideComparatorFactory = config.getDriverComparator(0, classLoader);
		TypeComparator<IT1> solutionSetComparator = this.hashTable.getBuildSideComparator().duplicate();
		this.probeSideComparator = probeSideComparatorFactory.createComparator();
		
		solutionSideRecord = solutionSetSerializer.createInstance();
		probeSideRecord = probeSideSerializer.createInstance();
		
		TypePairComparatorFactory<IT1, IT2> factory = taskContext.getTaskConfig().getPairComparatorFactory(taskContext.getUserCodeClassLoader());
		pairComparator = factory.createComparator21(solutionSetComparator, this.probeSideComparator);
	}
1250136
@Override
    public void initialize(Map<String, Object> puProperties)
    {
        reader = new SparkEntityReader(kunderaMetadata);
        setExternalProperties(puProperties);
        initializePropertyReader();
        PersistenceUnitMetadata pum = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(
                getPersistenceUnit());
        sparkconf = new SparkConf(true);
        configureClientProperties(pum);
        sparkContext = new SparkContext(sparkconf);
        sqlContext = new HiveContext(sparkContext);
    }
1268123
@Override
    protected void initializeImpl()
    {
        super.initializeImpl();

        //init maps
        this.faxActionType2ReponseDataPathMap=new HashMap<FaxActionType,String>();
        this.statusString2FaxStatusMap=new HashMap<String,FaxJobStatus>();

        //populate maps
        this.populateFaxActionType2ReponseDataPathMappings();
        this.populateStatusString2FaxStatusMappings();

        //set error values
        Enum<?> configurationKey=this.getErrorDetectionPathPropertyKey();
        this.errorDetectionPath=this.getConfigurationValue(configurationKey);
        configurationKey=this.getErrorDetectionValuePropertyKey();
        this.errorDetectionValue=this.getConfigurationValue(configurationKey);
        configurationKey=this.getErrorMessagePathPropertyKey();
        this.errorMessagePath=this.getConfigurationValue(configurationKey);
    }
470264
public static void initialize(KeenClient client) {
        if (client == null) {
            throw new IllegalArgumentException("Client must not be null");
        }

        if (ClientSingleton.INSTANCE.client != null) {
            // Do nothing.
            return;
        }

        ClientSingleton.INSTANCE.client = client;
    }