Skip to content

Commit

Permalink
added more configuration options so folks can set things via blueprin…
Browse files Browse the repository at this point in the history
…t.properties files
  • Loading branch information
jstrachan committed Apr 19, 2013
1 parent 1e5e3a2 commit 6490fc2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
3 changes: 1 addition & 2 deletions hawtio-core/src/main/java/io/hawt/config/ConfigFacade.java
Expand Up @@ -45,7 +45,6 @@ public void init() throws Exception {
mBeanServer = ManagementFactory.getPlatformMBeanServer();
}
if (!registered && !mBeanServer.isRegistered(objectName)) {
System.out.println("Registering " + objectName + " as there is no bean registered yet with: " + this);
mBeanServer.registerMBean(this, objectName);
registered = true;
}
Expand Down Expand Up @@ -113,7 +112,7 @@ public File getConfigDirectory() {

@Override
public String getConfigDir() {
if (configDir == null) {
if (Strings.isBlank(configDir)) {
// lets default to the users home directory
String home = System.getProperty("user.home", "~");
configDir = home + "/.hawtio";
Expand Down
Expand Up @@ -2,15 +2,15 @@
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0">

<!--
<ext:property-placeholder>
<ext:default-properties>
<ext:property name="hawtio.config.dir" value=""/>
<!-- no value will default to ~/.hawtio -->
<ext:property name="hawtio.home.dir" value=""/>
</ext:default-properties>
</ext:property-placeholder>
-->

<bean id="configFacade" class="io.hawt.config.ConfigFacade" init-method="init" destroy-method="destroy">
<property name="configDir" value="${hawtio.home.dir}"/>
</bean>

</blueprint>
Expand Down
25 changes: 9 additions & 16 deletions hawtio-default/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Expand Up @@ -2,21 +2,14 @@
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0">

<!--
TODO add property injection from context parameters / system properties / env vars
<ext:property-placeholder>
<ext:default-properties>
<ext:property name="name" value="value" />
<ext:property name="a" value="Hello " />
<ext:property name="b" value="FooBar" />
</ext:default-properties>
<ext:location>classpath:test.properties</ext:location>
</ext:property-placeholder>
-->

<bean id="logFacade" class="org.fusesource.insight.log.log4j.Log4jLogQuery" init-method="start" destroy-method="stop">
<!-- TODO configure size property from hawtio.log.size -->
</bean>
<ext:property-placeholder>
<ext:default-properties>
<ext:property name="hawtio.log.buffer.size" value="2000"/>
</ext:default-properties>
</ext:property-placeholder>

<bean id="logFacade" class="org.fusesource.insight.log.log4j.Log4jLogQuery" init-method="start" destroy-method="stop">
<property name="size" value="${hawtio.log.buffer.size}"/>
</bean>
</blueprint>

Expand Up @@ -8,6 +8,7 @@
<ext:property name="hawtio.config.repo" value="https://github.com/hawtio/hawtio-config.git"/>
<ext:property name="hawtio.config.pullOnStartup" value="true"/>
<ext:property name="hawtio.config.cloneOnStartup" value="true"/>
<ext:property name="hawtio.config.remote" value="origin"/>
</ext:default-properties>
</ext:property-placeholder>

Expand All @@ -16,6 +17,7 @@
<property name="remoteRepository" value="${hawtio.config.repo}"/>
<property name="pullOnStartup" value="${hawtio.config.pullOnStartup}"/>
<property name="cloneRemoteRepoOnStartup" value="${hawtio.config.cloneOnStartup}"/>
<property name="remote" value="${hawtio.config.remote}"/>
</bean>

</blueprint>
Expand Down
Expand Up @@ -26,6 +26,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.io.IOException;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;

Expand Down Expand Up @@ -59,6 +60,9 @@ public void run() {
};
timer.schedule(task, 3000);
LOG.info("Started the async timer to create the MavenIndexerFacade after the application starts up");
if (repositories != null) {
LOG.info("Using remote repositories: " + Arrays.asList(repositories));
}
}

public void destroy() throws InstanceNotFoundException, IOException, MBeanRegistrationException {
Expand Down
Expand Up @@ -5,12 +5,23 @@
<ext:property-placeholder>
<ext:default-properties>
<ext:property name="hawtio.maven.index.dir" value=""/>
<!--
<ext:property name="hawtio.maven.index.repos">
<array>
<value>http://repo.fusesource.com/nexus/content/repositories/releases@id=fusesource.release.repo</value>
<value>http://repo1.maven.org/maven2@central</value>
</array>
</ext:property>
-->
</ext:default-properties>
</ext:property-placeholder>

<bean id="mavenIndexer" class="io.hawt.maven.indexer.AsyncMavenIndexerFacadeFactory" init-method="init"
destroy-method="destroy">
<property name="indexDirectory" value="${hawtio.maven.index.dir}"/>
<!--
<property name="repositories" value="${hawtio.maven.index.repos}"/>
-->
</bean>
</blueprint>

0 comments on commit 6490fc2

Please sign in to comment.