Search in sources :

Example 1 with CacheModule

use of org.platformlayer.cache.CacheModule in project platformlayer by platformlayer.

the class KeystoneAdminServer method main.

public static void main(String[] args) throws Exception {
    List<Module> modules = Lists.newArrayList();
    modules.add(new ConfigurationModule());
    modules.add(new CacheModule());
    modules.add(new GuiceAuthenticationConfig());
    modules.add(new KeystoneJdbcModule());
    modules.add(new KeystoneOpsSystemModule());
    modules.add(new CodahaleMetricsModule());
    modules.add(new JerseyServletModule() {

        @Override
        protected void configureServlets() {
            bind(TokensResource.class);
            bind(KeychainResource.class);
            bind(PkiResource.class);
            bind(ServicesResource.class);
            Map<String, String> params = Maps.newHashMap();
            params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "org.openstack.keystone.jaxrs;org.codehaus.jackson.jaxrs");
            serve("/*").with(GuiceContainer.class, params);
        }
    });
    Injector injector = Guice.createInjector(modules);
    KeystoneAdminServer server = injector.getInstance(KeystoneAdminServer.class);
    server.start(WellKnownPorts.PORT_PLATFORMLAYER_AUTH_ADMIN);
}
Also used : KeystoneOpsSystemModule(org.platformlayer.auth.keystone.KeystoneOpsSystemModule) KeystoneJdbcModule(org.platformlayer.auth.KeystoneJdbcModule) CacheModule(org.platformlayer.cache.CacheModule) TokensResource(org.openstack.keystone.resources.admin.TokensResource) CodahaleMetricsModule(org.platformlayer.metrics.client.codahale.CodahaleMetricsModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) Injector(com.google.inject.Injector) GuiceAuthenticationConfig(org.platformlayer.auth.server.GuiceAuthenticationConfig) JerseyServletModule(com.sun.jersey.guice.JerseyServletModule) GuiceContainer(com.sun.jersey.guice.spi.container.servlet.GuiceContainer) Module(com.google.inject.Module) CodahaleMetricsModule(org.platformlayer.metrics.client.codahale.CodahaleMetricsModule) JerseyServletModule(com.sun.jersey.guice.JerseyServletModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) CacheModule(org.platformlayer.cache.CacheModule) KeystoneJdbcModule(org.platformlayer.auth.KeystoneJdbcModule) KeystoneOpsSystemModule(org.platformlayer.auth.keystone.KeystoneOpsSystemModule) KeychainResource(org.openstack.keystone.resources.admin.KeychainResource) ServicesResource(org.openstack.keystone.resources.admin.ServicesResource) PkiResource(org.openstack.keystone.resources.admin.PkiResource) Map(java.util.Map)

Example 2 with CacheModule

use of org.platformlayer.cache.CacheModule in project platformlayer by platformlayer.

the class KeystoneUserServer method main.

public static void main(String[] args) throws Exception {
    List<Module> modules = Lists.newArrayList();
    ConfigurationModule configurationModule = new ConfigurationModule();
    modules.add(configurationModule);
    Discovery discovery = Discovery.build();
    ConfigurationImpl configuration = configurationModule.getConfiguration();
    Extensions extensions = new Extensions(configuration, discovery);
    modules.add(new CacheModule());
    modules.add(new GuiceAuthenticationConfig());
    modules.add(new KeystoneJdbcModule());
    modules.add(new KeystoneOpsUserModule());
    modules.add(new CodahaleMetricsModule());
    modules.add(new UserAuthServletModule(extensions));
    Injector injector = Guice.createInjector(modules);
    KeystoneUserServer server = injector.getInstance(KeystoneUserServer.class);
    server.start(WellKnownPorts.PORT_PLATFORMLAYER_AUTH_USER);
}
Also used : UserAuthServletModule(org.openstack.keystone.resources.user.UserAuthServletModule) Discovery(com.fathomdb.discovery.Discovery) KeystoneJdbcModule(org.platformlayer.auth.KeystoneJdbcModule) CacheModule(org.platformlayer.cache.CacheModule) Extensions(org.platformlayer.extensions.Extensions) CodahaleMetricsModule(org.platformlayer.metrics.client.codahale.CodahaleMetricsModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) KeystoneOpsUserModule(org.platformlayer.auth.keystone.KeystoneOpsUserModule) Injector(com.google.inject.Injector) GuiceAuthenticationConfig(org.platformlayer.auth.server.GuiceAuthenticationConfig) Module(com.google.inject.Module) UserAuthServletModule(org.openstack.keystone.resources.user.UserAuthServletModule) KeystoneOpsUserModule(org.platformlayer.auth.keystone.KeystoneOpsUserModule) CodahaleMetricsModule(org.platformlayer.metrics.client.codahale.CodahaleMetricsModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) CacheModule(org.platformlayer.cache.CacheModule) KeystoneJdbcModule(org.platformlayer.auth.KeystoneJdbcModule) ConfigurationImpl(com.fathomdb.config.ConfigurationImpl)

Example 3 with CacheModule

use of org.platformlayer.cache.CacheModule in project platformlayer by platformlayer.

the class StandaloneXaasWebserver method main.

public static void main(String[] args) {
    try {
        // Force GMT
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
        Discovery discovery = Discovery.build();
        ConfigurationImpl configuration = ConfigurationImpl.load();
        Extensions extensions = new Extensions(configuration, discovery);
        List<Module> modules = Lists.newArrayList();
        modules.add(new NullMetricsModule());
        modules.add(new GuiceXaasConfig(configuration));
        modules.add(new ConfigurationModule(configuration));
        modules.add(new CacheModule());
        modules.add(new JdbcGuiceModule());
        modules.add(new PlatformLayerServletModule(extensions));
        modules.add(new PlatformlayerValidationModule());
        Injector injector = extensions.createInjector(configuration, modules);
        ResultSetMappersProvider provider = injector.getInstance(ResultSetMappersProvider.class);
        provider.addAll(ItemEntity.class, TagEntity.class, SchedulerRecordEntity.class, JobEntity.class, JobExecutionEntity.class);
        extensions.addEntities(provider);
        StandaloneXaasWebserver server = injector.getInstance(StandaloneXaasWebserver.class);
        // Temporary hack
        if (args.length != 0) {
            log.warn("Insert WAR onto root: " + args[0]);
            File rootWar = new File(args[0]);
            server.wars.put("/", rootWar);
        }
        if (!server.start()) {
            log.error("Failed to start webserver");
            System.exit(1);
        }
    } catch (Throwable e) {
        log.error("Error in initialization", e);
        System.exit(1);
    }
}
Also used : Discovery(com.fathomdb.discovery.Discovery) GuiceXaasConfig(org.platformlayer.xaas.GuiceXaasConfig) CacheModule(org.platformlayer.cache.CacheModule) Extensions(org.platformlayer.extensions.Extensions) NullMetricsModule(org.platformlayer.metrics.NullMetricsModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) ResultSetMappersProvider(com.fathomdb.jpa.impl.ResultSetMappersProvider) PlatformLayerServletModule(org.platformlayer.xaas.PlatformLayerServletModule) Injector(com.google.inject.Injector) JdbcGuiceModule(com.fathomdb.jdbc.JdbcGuiceModule) Module(com.google.inject.Module) PlatformLayerServletModule(org.platformlayer.xaas.PlatformLayerServletModule) JdbcGuiceModule(com.fathomdb.jdbc.JdbcGuiceModule) CacheModule(org.platformlayer.cache.CacheModule) ConfigurationModule(org.platformlayer.config.ConfigurationModule) NullMetricsModule(org.platformlayer.metrics.NullMetricsModule) ConfigurationImpl(com.fathomdb.config.ConfigurationImpl) File(java.io.File)

Aggregations

Injector (com.google.inject.Injector)3 Module (com.google.inject.Module)3 CacheModule (org.platformlayer.cache.CacheModule)3 ConfigurationModule (org.platformlayer.config.ConfigurationModule)3 ConfigurationImpl (com.fathomdb.config.ConfigurationImpl)2 Discovery (com.fathomdb.discovery.Discovery)2 KeystoneJdbcModule (org.platformlayer.auth.KeystoneJdbcModule)2 GuiceAuthenticationConfig (org.platformlayer.auth.server.GuiceAuthenticationConfig)2 Extensions (org.platformlayer.extensions.Extensions)2 CodahaleMetricsModule (org.platformlayer.metrics.client.codahale.CodahaleMetricsModule)2 JdbcGuiceModule (com.fathomdb.jdbc.JdbcGuiceModule)1 ResultSetMappersProvider (com.fathomdb.jpa.impl.ResultSetMappersProvider)1 JerseyServletModule (com.sun.jersey.guice.JerseyServletModule)1 GuiceContainer (com.sun.jersey.guice.spi.container.servlet.GuiceContainer)1 File (java.io.File)1 Map (java.util.Map)1 KeychainResource (org.openstack.keystone.resources.admin.KeychainResource)1 PkiResource (org.openstack.keystone.resources.admin.PkiResource)1 ServicesResource (org.openstack.keystone.resources.admin.ServicesResource)1 TokensResource (org.openstack.keystone.resources.admin.TokensResource)1