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

com.enonic.xp.init.ExternalInitializer Maven / Gradle / Ivy

The newest version!
package com.enonic.xp.init;

import com.google.common.base.Preconditions;

import com.enonic.xp.index.IndexService;

public abstract class ExternalInitializer
    extends Initializer
{
    protected final IndexService indexService;

    protected ExternalInitializer( final Builder builder )
    {
        super( builder );
        this.indexService = builder.indexService;
    }

    @Override
    protected boolean isMaster()
    {
        return indexService.isMaster();
    }

    @Override
    protected boolean readyToInitialize()
    {
        return indexService.waitForYellowStatus();
    }

    public static class Builder
        extends Initializer.Builder
    {
        protected IndexService indexService;

        @SuppressWarnings("unchecked")
        public T setIndexService( final IndexService indexService )
        {
            this.indexService = indexService;
            return (T) this;
        }

        protected void validate()
        {
            Preconditions.checkNotNull( indexService );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy