Skip to content

Instantly share code, notes, and snippets.

View asamaraw's full-sized avatar

Asanka Samaraweera asamaraw

  • PROS
  • Houston, TX
View GitHub Profile
@asamaraw
asamaraw / JDBCTestDropwizardApp.java
Last active April 28, 2018 00:17
Distributed JDBC session store for Dropwizard 1.2.2
@Override
public void run(TestDropwizardConfiguration configuration, Environment environment)
throws Exception
{
env.lifecycle().addLifeCycleListener(new AbstractLifeCycleListener()
{
@Override
public void lifeCycleStarting(LifeCycle event)
{
if (!(event instanceof Server))
@asamaraw
asamaraw / AzureYamlConfigurator.java
Last active August 29, 2015 14:01
Replace placeholders of the dropwizard yml file with values fetched from azure worker role configuration settings at the dw service startup
public class AzureYamlConfigurator
{
final static Charset ENCODING = StandardCharsets.UTF_8;
String configureYaml(String fileName) throws IOException
{
if (RoleEnvironment.isAvailable())
{
Map<String, String> propMap = RoleEnvironment.getConfigurationSettings();
configureYaml(fileName, propMap);
@asamaraw
asamaraw / DropwizardService.java
Created February 10, 2014 17:50
Sample Dropwizard (V0.7.0-rc1) service decrypt credentials at startup using private key stored in the windows cert manager
package com.github.asamaraw.dropwizardservice;
import java.security.Key;
import java.security.KeyStore;
import java.security.PrivateKey;
import javax.crypto.Cipher;
import lombok.extern.slf4j.Slf4j;