com.kolibrifx.plovercrest.server.PlovercrestServerBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
The newest version!
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server;
import java.util.Collection;
import java.util.Collections;
import com.kolibrifx.plovercrest.client.DefaultSerializerContext;
import com.kolibrifx.plovercrest.client.DefaultTableSerializerFactory;
import com.kolibrifx.plovercrest.client.TableSerializerFactory;
import com.kolibrifx.plovercrest.client.remote.DefaultPlovercrestRemote;
import com.kolibrifx.plovercrest.server.security.AccessControlFilter;
import com.kolibrifx.plovercrest.server.security.PassthroughAccessControlFilter;
import com.kolibrifx.plovercrest.server.streams.StreamProvider;
public class PlovercrestServerBuilder {
private TableSerializerFactory serializerFactory =
new DefaultTableSerializerFactory(new DefaultSerializerContext());
private int port = DefaultPlovercrestRemote.DEFAULT_STREAMING_PORT;
private final String dataPath;
private AccessControlFilter accessControlFilter = new PassthroughAccessControlFilter();
private Collection extraStreamProviders = Collections.emptySet();
public PlovercrestServerBuilder(final String dataPath) {
this.dataPath = dataPath;
}
public PlovercrestServerBuilder port(final int port) {
this.port = port;
return this;
}
/**
* Sets a {@link TableSerializerFactory} which will be used by folds running on this server.
*/
public PlovercrestServerBuilder serializerFactory(final TableSerializerFactory serializerFactory) {
this.serializerFactory = serializerFactory;
return this;
}
public PlovercrestServerBuilder accessControlFilter(final AccessControlFilter accessControlFilter) {
this.accessControlFilter = accessControlFilter;
return this;
}
public PlovercrestServerBuilder extraStreamProviders(final Collection extraStreamProviders) {
this.extraStreamProviders = extraStreamProviders;
return this;
}
public PlovercrestServer build() {
return new PlovercrestServer(dataPath, port, serializerFactory, accessControlFilter, extraStreamProviders);
}
}