• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SimpleServerFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.dropwizard.server.SimpleServerFactory的典型用法代码示例。如果您正苦于以下问题:Java SimpleServerFactory类的具体用法?Java SimpleServerFactory怎么用?Java SimpleServerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleServerFactory类属于io.dropwizard.server包,在下文中一共展示了SimpleServerFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: providesAgentMetadata

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Provides
@Singleton
public BaragonAgentMetadata providesAgentMetadata(BaragonAgentConfiguration config) throws Exception {
  final SimpleServerFactory simpleServerFactory = (SimpleServerFactory) config.getServerFactory();
  final HttpConnectorFactory httpFactory = (HttpConnectorFactory) simpleServerFactory.getConnector();

  final int httpPort = httpFactory.getPort();
  final String hostname = config.getHostname().or(JavaUtils.getHostAddress());
  final Optional<String> domain = config.getLoadBalancerConfiguration().getDomain();
  final String appRoot = simpleServerFactory.getApplicationContextPath();

  final String baseAgentUri = String.format(config.getBaseUrlTemplate(), hostname, httpPort, appRoot);
  final String agentId = String.format("%s:%s", hostname, httpPort);

  return new BaragonAgentMetadata(baseAgentUri, agentId, domain, BaragonAgentEc2Metadata.fromEnvironment(), config.getExtraAgentData(), true);
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:17,代码来源:BaragonAgentServiceModule.java


示例2: SingularityHostAndPortProvider

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Inject
SingularityHostAndPortProvider(final SingularityConfiguration configuration, @Named(HOST_NAME_PROPERTY) String hostname) {
  checkNotNull(configuration, "configuration is null");
  this.hostname = configuration.getHostname().or(hostname);

  SimpleServerFactory simpleServerFactory = (SimpleServerFactory) configuration.getServerFactory();
  HttpConnectorFactory httpFactory = (HttpConnectorFactory) simpleServerFactory.getConnector();

  this.httpPort = httpFactory.getPort();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:11,代码来源:SingularityMainModule.java


示例3: updatePortsToAvoidCollision

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
private static void updatePortsToAvoidCollision(ServerFactory serverFactory) {
    if (serverFactory instanceof DefaultServerFactory) {
        DefaultServerFactory defaultServerFactory = (DefaultServerFactory)serverFactory;
        updatePortsToAvoidCollision(defaultServerFactory.getApplicationConnectors());
        updatePortsToAvoidCollision(defaultServerFactory.getAdminConnectors());
    } else if (serverFactory instanceof SimpleServerFactory) {
        SimpleServerFactory simpleServerFactory = (SimpleServerFactory)serverFactory;
        updatePortsToAvoidCollision(Collections.singleton(simpleServerFactory.getConnector()));
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:13,代码来源:ScanUploadTest.java


示例4: provideSelfHostAndPort

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Provides @Singleton @SelfHostAndPort
public HostAndPort provideSelfHostAndPort(ServerFactory serverFactory) {
    // Our method for obtaining connector factories from the server factory varies depending on the latter's type
    List<ConnectorFactory> appConnectorFactories;
    if (serverFactory instanceof DefaultServerFactory) {
        appConnectorFactories = ((DefaultServerFactory) serverFactory).getApplicationConnectors();
    } else if (serverFactory instanceof SimpleServerFactory) {
        appConnectorFactories = Collections.singletonList(((SimpleServerFactory) serverFactory).getConnector());
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }

    return getHostAndPortFromConnectorFactories(appConnectorFactories);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:SelfHostAndPortModule.java


示例5: provideSelfAdminHostAndPort

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Provides @Singleton @SelfAdminHostAndPort
public HostAndPort provideSelfAdminHostAndPort(ServerFactory serverFactory) {
    // Our method for obtaining connector factories from the server factory varies depending on the latter's type
    List<ConnectorFactory> adminConnectorFactories;
    if (serverFactory instanceof DefaultServerFactory) {
        adminConnectorFactories = ((DefaultServerFactory) serverFactory).getAdminConnectors();
    } else if (serverFactory instanceof SimpleServerFactory) {
        adminConnectorFactories = Collections.singletonList(((SimpleServerFactory) serverFactory).getConnector());
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }

    return getHostAndPortFromConnectorFactories(adminConnectorFactories);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:SelfHostAndPortModule.java


示例6: getPort

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
public static Integer getPort(ServerFactory serverFactory) {
   if(serverFactory instanceof SimpleServerFactory) {
      return getPort(((SimpleServerFactory)serverFactory).getConnector());
   }
   else if(serverFactory instanceof DefaultServerFactory) {
      return getPort(((DefaultServerFactory)serverFactory).getApplicationConnectors().get(0));
   }
   throw new RuntimeException("Unable to infer Port of " + serverFactory);
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:10,代码来源:DropwizardServerHelpers.java


示例7: getAdminPort

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
public static Integer getAdminPort(ServerFactory serverFactory) {
   if(serverFactory instanceof SimpleServerFactory) {
      return getPort(((SimpleServerFactory)serverFactory).getConnector());
   }
   else if(serverFactory instanceof DefaultServerFactory) {
      return getPort(((DefaultServerFactory)serverFactory).getAdminConnectors().get(0));
   }
   throw new RuntimeException("Unable to infer AdminPort of " + serverFactory);
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:10,代码来源:DropwizardServerHelpers.java


示例8: getConnectorFactoy

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
private @Nonnull HttpConnectorFactory getConnectorFactoy(ServerFactory serverFactory) {
	if(serverFactory instanceof DefaultServerFactory) {
		return getDefaultServerFactory(serverFactory);
	} else if(serverFactory instanceof SimpleServerFactory) {
		return getSimpleServerFactory(serverFactory);
	}
	throw new IllegalArgumentException(
			String.format("Unknonw ServerFactory instance '%s'", serverFactory.getClass().getName()));
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:10,代码来源:ExpanderApplication.java


示例9: getSimpleServerFactory

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
private @Nonnull HttpConnectorFactory getSimpleServerFactory(ServerFactory serverFactory) {
	HttpConnectorFactory connector = (HttpConnectorFactory) ((SimpleServerFactory)serverFactory).getConnector();
	if (connector.getClass().isAssignableFrom(HttpConnectorFactory.class)) {
	    return connector;
	}
	throw new IllegalArgumentException(String.format("Failed to find any server ConnectorFactory in serverFactory '%s'",
			serverFactory.getClass().getName()));		
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:9,代码来源:ExpanderApplication.java


示例10: getSingularityUriBase

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Provides
@Named(SingularityServiceUIModule.SINGULARITY_URI_BASE)
String getSingularityUriBase(final SingularityConfiguration configuration) {
  final String singularityUiPrefix;
  if (configuration.getServerFactory() instanceof  SimpleServerFactory) {
    singularityUiPrefix = configuration.getUiConfiguration().getBaseUrl().or(((SimpleServerFactory) configuration.getServerFactory()).getApplicationContextPath());
  } else {
    singularityUiPrefix = configuration.getUiConfiguration().getBaseUrl().or(((DefaultServerFactory) configuration.getServerFactory()).getApplicationContextPath());
  }
  return (singularityUiPrefix.endsWith("/")) ?  singularityUiPrefix.substring(0, singularityUiPrefix.length() - 1) : singularityUiPrefix;
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:12,代码来源:SingularityMainModule.java


示例11: getSingularityUriBase

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@Provides
@Named(SINGULARITY_URI_BASE)
String getSingularityUriBase(final SingularityConfiguration configuration) {
  final String singularityUiPrefix = configuration.getUiConfiguration().getBaseUrl().or(((SimpleServerFactory) configuration.getServerFactory()).getApplicationContextPath());
  return (singularityUiPrefix.endsWith("/")) ?  singularityUiPrefix.substring(0, singularityUiPrefix.length() - 1) : singularityUiPrefix;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:7,代码来源:SingularityMainModule.java


示例12: setup

import io.dropwizard.server.SimpleServerFactory; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    _lifeCycle = new SimpleLifeCycleRegistry();
    _healthChecks = mock(HealthCheckRegistry.class);

    // Start test instance of ZooKeeper in the current JVM
    TestingServer testingServer = new TestingServer();
    _lifeCycle.manage(testingServer);

    // Connect to ZooKeeper
    final CuratorFramework curator = CuratorFrameworkFactory.newClient(testingServer.getConnectString(),
            new BoundedExponentialBackoffRetry(100, 1000, 5));
    _lifeCycle.manage(curator).start();

    // Setup the DataStoreModule
    Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(LifeCycleRegistry.class).toInstance(_lifeCycle);
            bind(HealthCheckRegistry.class).toInstance(_healthChecks);
            bind(TaskRegistry.class).toInstance(mock(TaskRegistry.class));

            bind(DataStoreConfiguration.class).toInstance(new DataStoreConfiguration()
                    .setSystemTablePlacement("app_global:sys")
                    .setValidTablePlacements(ImmutableSet.of("app_global:sys", "ugc_global:ugc"))
                    .setCassandraClusters(ImmutableMap.<String, CassandraConfiguration>of(
                            "ugc_global", new TestCassandraConfiguration("ugc_global", "ugc_delta"),
                            "app_global", new TestCassandraConfiguration("app_global", "sys_delta")))
                    .setHistoryTtl(Period.days(2)));
            bind(DataStore.class).annotatedWith(SystemDataStore.class).toInstance(mock(DataStore.class));
            bind(JobService.class).toInstance(mock(JobService.class));
            bind(JobHandlerRegistry.class).toInstance(mock(JobHandlerRegistry.class));

            bind(DataCenterConfiguration.class).toInstance(new DataCenterConfiguration()
                    .setCurrentDataCenter("datacenter1")
                    .setSystemDataCenter("datacenter1")
                    .setDataCenterServiceUri(URI.create("http://localhost:8080"))
                    .setDataCenterAdminUri(URI.create("http://localhost:8080")));

            bind(CqlDriverConfiguration.class).toInstance(new CqlDriverConfiguration());

            bind(KeyspaceDiscovery.class).annotatedWith(Names.named("blob")).toInstance(mock(KeyspaceDiscovery.class));
            bind(String.class).annotatedWith(ServerCluster.class).toInstance("local_default");

            bind(String.class).annotatedWith(ReplicationKey.class).toInstance("password");
            bind(String.class).annotatedWith(InvalidationService.class).toInstance("emodb-cachemgr");

            bind(CuratorFramework.class).annotatedWith(Global.class).toInstance(curator);
            bind(CuratorFramework.class).annotatedWith(DataStoreZooKeeper.class)
                    .toInstance(ZKNamespaces.usingChildNamespace(curator, "applications/emodb-sor"));
            bind(CuratorFramework.class).annotatedWith(GlobalFullConsistencyZooKeeper.class)
                    .toInstance(ZKNamespaces.usingChildNamespace(curator, "applications/emodb-fct"));

            bind(new TypeLiteral<Supplier<Boolean>>(){}).annotatedWith(CqlForScans.class)
                    .toInstance(Suppliers.ofInstance(true));
            bind(new TypeLiteral<Supplier<Boolean>>(){}).annotatedWith(CqlForMultiGets.class)
                    .toInstance(Suppliers.ofInstance(true));

            bind(ServerFactory.class).toInstance(new SimpleServerFactory());

            bind(ServiceRegistry.class).toInstance(mock(ServiceRegistry.class));

            bind(Clock.class).toInstance(Clock.systemDefaultZone());

            EmoServiceMode serviceMode = EmoServiceMode.STANDARD_ALL;
            install(new SelfHostAndPortModule());
            install(new DataCenterModule(serviceMode));
            install(new CacheManagerModule());
            install(new DataStoreModule(serviceMode));
        }
    });
    _store = injector.getInstance(DataStore.class);
    _lifeCycle.start();

    Map<String, Object> template = Collections.emptyMap();
    _store.createTable(TABLE, new TableOptionsBuilder().setPlacement("ugc_global:ugc").build(), template, newAudit("create table"));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:78,代码来源:CasDataStoreTest.java



注:本文中的io.dropwizard.server.SimpleServerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TagData类代码示例发布时间:2022-05-22
下一篇:
Java FacesListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap