Skip to content

Commit

Permalink
v0.52 release
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcclean committed Mar 23, 2015
1 parent 0e56f2f commit 384a01c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 118 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subprojects {
apply plugin: 'com.bmuschko.nexus'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '0.51'
version = '0.52'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
Expand Down Expand Up @@ -45,7 +45,7 @@ subprojects {
exclude(module: 'org.springframework')
}
compile 'net.javacrumbs.future-converter:future-converter-spring-java8:0.1.0'
compile group: 'com.aol.simplereact', name:'simple-react', version:'0.5'
compile group: 'com.aol.simplereact', name:'simple-react', version:'0.80'
compile group: 'org.apache.httpcomponents', name:'httpclient', version:'4.4'
compile group: 'org.apache.httpcomponents', name:'httpasyncclient', version:'4.1-beta1'
compile group: 'com.wordnik', name: 'swagger-jersey2-jaxrs_2.10', version:'1.3.10'
Expand Down
2 changes: 1 addition & 1 deletion micro-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ modifyPom {

groupId 'com.aol.microservices'
artifactId 'microserver-boot'
version '0.51'
version '0.52'

scm {
url 'scm:[email protected]:aol/micro-server.git'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,126 +22,131 @@
import com.aol.simple.react.exceptions.ExceptionSoftener;
import com.google.common.collect.Lists;


public class MicrobootApp {



private final Logger logger = LoggerFactory.getLogger(this.getClass());

private final List<Module> modules;
private final CompletableFuture end = new CompletableFuture();
private final ExceptionSoftener softener = ExceptionSoftener.singleton.factory.getInstance();

@Getter
private final ApplicationContext springContext;

/**
* This will construct a Spring context, using Spring Boot for this Microboot instance.
* The calling class will be used to determine the base package to auto-scan from for Spring Beans
* It will attempt to pick up an @Microservice annotation first, if not present the package of the calling class
* will be used.
*
* @param modules Multiple Microservice end points that can be deployed within a single Spring context
*/
public MicrobootApp(Module...modules){
this.modules = Lists.newArrayList(modules);
springContext = new SpringContextFactory(new MicrobootConfigurator().buildConfig(extractClass()),extractClass(),
modules[0].getSpringConfigurationClasses()).withSpringBuilder(new BootApplicationConfigurator()).createSpringContext();


private final Logger logger = LoggerFactory.getLogger(this.getClass());

private final List<Module> modules;
private final CompletableFuture end = new CompletableFuture();
private final ExceptionSoftener softener = ExceptionSoftener.singleton.factory
.getInstance();

@Getter
private final ApplicationContext springContext;

/**
* This will construct a Spring context, using Spring Boot for this
* Microboot instance. The calling class will be used to determine the base
* package to auto-scan from for Spring Beans It will attempt to pick up an @Microservice
* annotation first, if not present the package of the calling class will be
* used.
*
* @param modules
* Multiple Microservice end points that can be deployed within a
* single Spring context
*/
public MicrobootApp(Module... modules) {
this.modules = Lists.newArrayList(modules);
springContext = new SpringContextFactory(
new MicrobootConfigurator().buildConfig(extractClass()),
extractClass(), modules[0].getSpringConfigurationClasses())
.withSpringBuilder(new BootApplicationConfigurator())
.createSpringContext();

}

/**
* This will construct a Spring context, using Spring Boot for this
* Microboot instance. The provided class will be used to determine the base
* package to auto-scan from for Spring Beans It will attempt to pick up an @Microservice
* annotation first, if not present the package of the provided class will
* be used.
*
* @param c
* Class used to configure Spring
* @param modules
* Multiple Microservice end points that can be deployed within a
* single Spring context
*/
public MicrobootApp(Class c, Module... modules) {

this.modules = Lists.newArrayList(modules);
springContext = new SpringContextFactory(
new MicrobootConfigurator().buildConfig(c), c,
modules[0].getSpringConfigurationClasses()).withSpringBuilder(
new BootApplicationConfigurator()).createSpringContext();

}

/**
* This will construct a Spring context, using Spring Boot for this
* Microboot instance. The provided Config object will be used to configure
* Spring
*
* @param config
* Spring configuration
* @param modules
* Multiple Microservice end points that can be deployed within a
* single Spring context
*/
public MicrobootApp(Config config, Module... modules) {

this.modules = Lists.newArrayList(modules);
config.set();
springContext = new SpringContextFactory(config,
modules[0].getSpringConfigurationClasses()).withSpringBuilder(
new BootApplicationConfigurator()).createSpringContext();

}

private Class extractClass() {
try {
return Class.forName(new Exception().getStackTrace()[2]
.getClassName());
} catch (ClassNotFoundException e) {
softener.throwSoftenedException(e);
}
return null; // unreachable normally
}


/**
* This will construct a Spring context, using Spring Boot for this Microboot instance.
* The provided class will be used to determine the base package to auto-scan from for Spring Beans
* It will attempt to pick up an @Microservice annotation first, if not present the package of the provided class
* will be used.
*
* @param c Class used to configure Spring
* @param modules Multiple Microservice end points that can be deployed within a single Spring context
*/
public MicrobootApp(Class c, Module... modules) {

this.modules = Lists.newArrayList(modules);
springContext =new SpringContextFactory(new MicrobootConfigurator().buildConfig(c),c,
modules[0].getSpringConfigurationClasses()).withSpringBuilder(new BootApplicationConfigurator()).createSpringContext();

}
public void stop() {

/**
* This will construct a Spring context, using Spring Boot for this Microboot instance.
* The provided Config object will be used to configure Spring
*
* @param config Spring configuration
* @param modules Multiple Microservice end points that can be deployed within a single Spring context
*/
public MicrobootApp(Config config, Module... modules) {

this.modules = Lists.newArrayList(modules);
config.set();
springContext =
new SpringContextFactory(config,
modules[0].getSpringConfigurationClasses())
.withSpringBuilder(new BootApplicationConfigurator())
.createSpringContext();
end.complete(true);
Config.reset();

}
}


private Class extractClass() {
try {
return Class.forName(new Exception().getStackTrace()[2]
.getClassName());
} catch (ClassNotFoundException e) {
softener.throwSoftenedException(e);
}
return null; // unreachable normally
}
public void run() {
start().forEach(thread -> join(thread));
}


public void stop() {
public List<Thread> start() {

end.complete(true);
Config.reset();
List<ServerApplication> apps = modules
.stream()
.map(module -> new GrizzlyApplicationFactory(springContext,
module).createApp()).collect(Collectors.toList());

}
ServerRunner runner;
try {

public void run() {
start().forEach(thread -> join(thread));
runner = new ServerRunner(
springContext.getBean(ApplicationRegister.class), apps, end);
} catch (BeansException e) {
runner = new ServerRunner(apps, end);
}

public List<Thread> start() {

List<ServerApplication> apps = modules
.stream()
.map(module -> new GrizzlyApplicationFactory(springContext,
module).createApp()).collect(Collectors.toList());

ServerRunner runner;
try {
return runner.run();

runner = new ServerRunner(
springContext.getBean(ApplicationRegister.class), apps, end);
} catch (BeansException e) {
runner = new ServerRunner(apps, end);
}
}

return runner.run();

private void join(Thread thread) {
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
softener.throwSoftenedException(e);
}

private void join(Thread thread) {
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
softener.throwSoftenedException(e);
}
}



}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,7 @@ public AccessLogLocationBean createAccessLogLocationBean(
return new AccessLogLocationBean(location);
}

@Bean
public Environment createEnvironment(ApplicationContext rootContext) {
Properties props = (Properties) rootContext.getBean("propertyFactory");
Map<String, ModuleBean> moduleDefinitions = rootContext
.getBeansOfType(ModuleBean.class);
if (moduleDefinitions == null)
return new Environment(props);
return new Environment(props, moduleDefinitions.values());

}

public DAOProvider buildDAOProvider(
AnnotationConfigWebApplicationContext rootContext,
Expand Down
2 changes: 1 addition & 1 deletion micro-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ modifyPom {

groupId 'com.aol.microservices'
artifactId 'microserver-core'
version '0.51'
version '0.52'

scm {
url 'scm:[email protected]:aol/micro-server.git'
Expand Down

0 comments on commit 384a01c

Please sign in to comment.