Skip to content
Browse files

Merge branch 'master' of github.com:imdario/murdock

Conflicts:
	src/main/java/hm/murdock/cli/Router.java
	src/main/java/hm/murdock/modules/HelloHook.java
	src/main/java/hm/murdock/modules/action/Action.java
	src/main/java/hm/murdock/modules/action/ActionHook.java
  • Loading branch information...
2 parents b525257 + d34dbc8 commit e4acd85a81bb10ce6d92a035786947f29afea913 @imdario committed Jul 17, 2010
View
11 src/main/java/hm/murdock/cli/Router.java
@@ -103,6 +103,16 @@ private void registerModules(Reflections reflections,
Set<Class<? extends Module>> modules = reflections
.getSubTypesOf(Module.class);
+ /*
+ * Set<Method> notOverridableMethods = new HashSet<Method>();
+ * notOverridableMethods
+ * .addAll(Arrays.asList(Object.class.getMethods()));
+ *
+ * Map<String, Map<Hook, Method>> hooks = new HashMap<String, Map<Hook,
+ * Method>>(); this.actions = new HashMap<String, Map<String,
+ * Action>>();
+ */
+
for (Class<? extends Module> module : modules) {
List<Action> moduleActions = new ArrayList<Action>();
@@ -133,6 +143,7 @@ private void registerModules(Reflections reflections,
"Ignoring action " + method.getName(), e);
}
} else {
+
trackHook(hooks, method, hookAnnotation);
}
}
View
2 src/main/java/hm/murdock/modules/action/Action.java
@@ -3,8 +3,8 @@
import hm.murdock.Murdock;
import hm.murdock.exceptions.ActionException;
import hm.murdock.exceptions.ActionException.ActionExceptionType;
-import hm.murdock.modules.Module;
import hm.murdock.modules.Addon;
+import hm.murdock.modules.Module;
import hm.murdock.modules.annotations.Hook;
import hm.murdock.modules.annotations.Hook.HookType;
import hm.murdock.utils.Context;
View
24 src/main/java/hm/murdock/utils/Context.java
@@ -127,17 +127,19 @@ public File getAppHome() {
public <T, E> E setProperty(ContextProperty<T> property, E value)
throws ConfigurationException {
E oldValue = (E) this.configuration.put(property.toString(), value);
- try {
- this.configuration.storeToXML(new FileOutputStream(
- configurationFile), null);
- } catch (FileNotFoundException e) {
- throw new ConfigurationException(
- ConfigurationExceptionType.UNABLE_WRITE_CONFIG, e,
- configurationFile.getAbsolutePath());
- } catch (IOException e) {
- throw new ConfigurationException(
- ConfigurationExceptionType.UNABLE_WRITE_CONFIG, e,
- configurationFile.getAbsolutePath());
+ if (!property.isFlash()) {
+ try {
+ this.configuration.storeToXML(new FileOutputStream(
+ configurationFile), null);
+ } catch (FileNotFoundException e) {
+ throw new ConfigurationException(
+ ConfigurationExceptionType.UNABLE_WRITE_CONFIG, e,
+ configurationFile.getAbsolutePath());
+ } catch (IOException e) {
+ throw new ConfigurationException(
+ ConfigurationExceptionType.UNABLE_WRITE_CONFIG, e,
+ configurationFile.getAbsolutePath());
+ }
}
return oldValue;
View
27 src/main/java/hm/murdock/utils/ContextProperty.java
@@ -1,5 +1,7 @@
package hm.murdock.utils;
+import hm.murdock.cli.Router;
+
/**
* Enum-like class to handle all properties keys.
*
@@ -12,6 +14,9 @@
*/
public class ContextProperty<T> {
+ public static final ContextProperty<Router> ROUTER = new ContextProperty<Router>(
+ "router", true);
+
public static final ContextProperty<String> TEST = new ContextProperty<String>(
"test");
@@ -21,8 +26,30 @@
private String fullId;
+ private final boolean isFlash;
+
+ private final boolean isPrivileged;
+
protected ContextProperty(String id) {
+ this(id, false);
+ }
+
+ protected ContextProperty(String id, boolean flash) {
+ this(id, flash, false);
+ }
+
+ protected ContextProperty(String id, boolean flash, boolean privileged) {
this.id = id;
+ this.isFlash = flash;
+ this.isPrivileged = privileged;
+ }
+
+ public final boolean isFlash() {
+ return this.isFlash;
+ }
+
+ public final boolean isPrivileged() {
+ return this.isPrivileged;
}
@Override

0 comments on commit e4acd85

Please sign in to comment.
Something went wrong with that request. Please try again.