Skip to content

Commit 627d94f

Browse files
author
Jared Nagle
committed
getting there
1 parent b7f55d7 commit 627d94f

24 files changed

+179
-233
lines changed

.idea/libraries/Maven__commons_io_commons_io_2_4.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Algorithms.iml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.3.04" level="project" />
7575
<orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
7676
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
77+
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
7778
</component>
7879
</module>
7980

pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@
4343
<artifactId>commons-collections</artifactId>
4444
<version>3.2.1</version>
4545
</dependency>
46+
<dependency>
47+
<groupId>commons-io</groupId>
48+
<artifactId>commons-io</artifactId>
49+
<version>2.4</version>
50+
</dependency>
4651
</dependencies>
47-
4852
<build>
4953
<pluginManagement>
5054
<plugins>

src/main/java/com/thenaglecode/algorithms/Configuration.java

-22
This file was deleted.

src/main/java/com/thenaglecode/algorithms/ConfigurationManager.java

-23
This file was deleted.

src/main/java/com/thenaglecode/algorithms/ejb/AlgorithmControllerBean.java renamed to src/main/java/com/thenaglecode/algorithms/ejb/session/singletons/AlgorithmControllerBean.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.thenaglecode.algorithms.ejb;
1+
package com.thenaglecode.algorithms.ejb.session.singletons;
22

33
import com.thenaglecode.algorithms.random.LinearCongruentialGenerator;
44
import com.thenaglecode.algorithms.random.RandomNumberGenerator;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.thenaglecode.algorithms.ejb.session.singletons;
2+
3+
4+
import com.thenaglecode.core.util.propeties.PropertyBundleResource;
5+
import com.thenaglecode.core.util.propeties.RefreshablePropertyResourceBundle;
6+
7+
import javax.annotation.PostConstruct;
8+
import javax.annotation.security.DeclareRoles;
9+
import javax.ejb.Singleton;
10+
import javax.ejb.Startup;
11+
import javax.servlet.ServletException;
12+
import javax.servlet.annotation.WebServlet;
13+
import javax.servlet.http.HttpServlet;
14+
import java.util.logging.Level;
15+
import java.util.logging.Logger;
16+
17+
/**
18+
* Created with IntelliJ IDEA.
19+
* User: jxnagl
20+
* Date: 8/6/13
21+
* Time: 3:46 PM
22+
*
23+
* place all initialization code in here.
24+
*/
25+
26+
@Singleton
27+
@Startup
28+
public class StartUp extends HttpServlet{
29+
30+
private static final Logger log = Logger.getLogger(StartUp.class.getName());
31+
32+
@PropertyBundleResource(name = "com.thenaglecode.core.configuration")
33+
RefreshablePropertyResourceBundle coreConfiguration;
34+
35+
//todo setup web security with ldap server hava admin access to this method. (i.e. the system)
36+
@PostConstruct
37+
public void init() {
38+
log.log(Level.INFO, "---- Initialising App ----");
39+
log.log(Level.FINE, "loading configuration managers");
40+
41+
42+
43+
//todo read the core configuration file and create configuration managers for every property file with that format
44+
}
45+
46+
private void initialiseConfigurationManagers(){
47+
String[] configFileNames = coreConfiguration.getBundle().getStringArray("configuration.filenames");
48+
}
49+
}

src/main/java/com/thenaglecode/algorithms/primes/PrimeGenerator.java

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.thenaglecode.algorithms.primes;
22

3-
import com.thenaglecode.algorithms.Configuration;
4-
import com.thenaglecode.algorithms.ConfigurationManager;
53
import com.thenaglecode.core.util.Named;
64

75
/**

src/main/java/com/thenaglecode/core/Configuration.java

-15
This file was deleted.

src/main/java/com/thenaglecode/core/ConfigurationManager.java

-23
This file was deleted.

src/main/java/com/thenaglecode/core/StartUp.java

-25
This file was deleted.

src/main/java/com/thenaglecode/core/ui/Configuration.java

-19
This file was deleted.

src/main/java/com/thenaglecode/core/ui/CoreUIConfigurationManager.java

-24
This file was deleted.

src/main/java/com/thenaglecode/core/util/PackageUtil.java

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.thenaglecode.core.util;
22

3-
import com.thenaglecode.algorithms.Configuration;
4-
import com.thenaglecode.algorithms.ConfigurationManager;
53
import com.thenaglecode.core.util.propeties.PropertyBundleResource;
64

75
import java.util.ResourceBundle;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.thenaglecode.core.util.propeties;
2+
3+
import javax.enterprise.util.Nonbinding;
4+
5+
/**
6+
* Created with IntelliJ IDEA.
7+
* User: Jared Nagle
8+
* Date: 7/08/13
9+
* Time: 7:50 PM
10+
* To change this template use File | Settings | File Templates.
11+
*/
12+
public @interface Configuration {
13+
14+
public String subsystem();
15+
16+
public String file() default "configuration";
17+
}

src/main/java/com/thenaglecode/core/util/ConfigurationItem.java renamed to src/main/java/com/thenaglecode/core/util/propeties/ConfigurationItem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.thenaglecode.core.util;
1+
package com.thenaglecode.core.util.propeties;
22

33
/**
44
* Created with IntelliJ IDEA.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.thenaglecode.core.util.propeties;
2+
3+
import javax.enterprise.inject.Produces;
4+
import javax.enterprise.inject.spi.InjectionPoint;
5+
6+
/**
7+
* Created with IntelliJ IDEA.
8+
* User: Jared Nagle
9+
* Date: 7/08/13
10+
* Time: 7:51 PM
11+
*/
12+
public class ConfigurationLocator {
13+
}

src/main/java/com/thenaglecode/core/util/propeties/AbstractConfigurationManager.java renamed to src/main/java/com/thenaglecode/core/util/propeties/ConfigurationManager.java

+13-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.thenaglecode.core.util.propeties;
22

3-
import com.thenaglecode.core.util.ConfigurationItem;
4-
import com.thenaglecode.core.util.ConfigurationUtil;
53
import com.thenaglecode.core.util.Named;
64
import com.thenaglecode.core.util.Refreshable;
75

@@ -15,11 +13,13 @@
1513
*
1614
* extend this class to create a configuration manager for the residing package. the configuration
1715
* properties fileName specified in the constructor should also reside in the same package as the
18-
* <tt>AbstractConfigurationManager</tt> implementation. if a filename is not specified, the default of
16+
* <tt>ConfigurationManager</tt> implementation. if a filename is not specified, the default of
1917
* <tt>"configuration"</tt> is used.
2018
*/
21-
public abstract class AbstractConfigurationManager implements Refreshable, Named {
19+
public class ConfigurationManager implements Refreshable, Named {
2220

21+
@NotNull
22+
private String subsystem;
2323
@NotNull
2424
private String propertyFile;
2525
@NotNull
@@ -30,17 +30,16 @@ public abstract class AbstractConfigurationManager implements Refreshable, Named
3030
/**
3131
* do not ctor
3232
*/
33-
protected AbstractConfigurationManager(){
33+
protected ConfigurationManager(){
3434
this(DEFAULT_CONFIG_BUDNLE_NAME);
3535
}
3636

37-
protected AbstractConfigurationManager(String propertyFile){
38-
init(propertyFile);
39-
ConfigurationUtil.registerConfigurationManager(this);
37+
protected ConfigurationManager(String subSystem){
38+
this(subSystem, DEFAULT_CONFIG_BUDNLE_NAME);
4039
}
4140

42-
private String getPropertyFile() {
43-
return propertyFile;
41+
protected ConfigurationManager(String subSystem, String fileName){
42+
init(subSystem, fileName);
4443
}
4544

4645
private void setPropertyFile(String propertyFile) {
@@ -68,8 +67,10 @@ synchronized public void refresh() {
6867
bundle.refresh();
6968
}
7069

71-
protected void init(){
72-
init(getPropertyFile());
70+
protected void init(@NotNull String subSystem, @NotNull String fileName){
71+
setPropertyFile(fileName);
72+
String baseName = subSystem + "." + fileName;
73+
bundle = new RefreshablePropertyResourceBundle(baseName);
7374
}
7475

7576
/**
@@ -87,10 +88,4 @@ public String getName() {
8788
private String getFullyQualifiedPropertyFileReference(){
8889
return getClass().getPackage().getName() + "." + propertyFile;
8990
}
90-
91-
protected void init(String propertyFile) {
92-
setPropertyFile(propertyFile);
93-
String baseName = getFullyQualifiedPropertyFileReference();
94-
bundle = new RefreshablePropertyResourceBundle(baseName);
95-
}
9691
}

0 commit comments

Comments
 (0)