You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2008/09/16 16:19:26 UTC

svn commit: r695893 - in /labs/magma/trunk/foundation-basics: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/magma/ src/main/java/org/apache/magma/basics/ src/main/java/org/apache/magma/basics/uti...

Author: simoneg
Date: Tue Sep 16 07:19:25 2008
New Revision: 695893

URL: http://svn.apache.org/viewvc?rev=695893&view=rev
Log:
Initial import.

Added:
    labs/magma/trunk/foundation-basics/pom.xml
    labs/magma/trunk/foundation-basics/src/
    labs/magma/trunk/foundation-basics/src/main/
    labs/magma/trunk/foundation-basics/src/main/java/
    labs/magma/trunk/foundation-basics/src/main/java/org/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableString.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableStringWithSubject.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/MagmaException.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/AnnotationToInstance.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/InitHolderInSettings.aj
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/ManageSettings.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/Settings.java
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/SettingsHolder.java

Added: labs/magma/trunk/foundation-basics/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/pom.xml?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/pom.xml (added)
+++ labs/magma/trunk/foundation-basics/pom.xml Tue Sep 16 07:19:25 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+	  <groupId>org.apache.magma</groupId>
+	  <artifactId>magma-parent</artifactId>
+	  <version>1</version>
+	</parent>
+	<groupId>org.apache.magma</groupId>
+	<artifactId>foundation-basics</artifactId>
+	<name>Foundation Basics</name>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>magma</packaging>	
+	<description>
+		Provides basic classes common to other foundation projects
+	</description>
+	<dependencies>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjrt</artifactId>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.magma.tools</groupId>
+				<artifactId>maven-magma-plugin</artifactId>
+				<extensions>true</extensions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableString.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableString.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableString.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableString.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.basics;
+
+import java.text.MessageFormat;
+
+
+public class LocalizableString {
+
+	private String message = null;
+	private Object[] args = null;
+	
+	public LocalizableString(String message, Object... arg) {
+		this.message = message;
+		this.args = arg;
+	}
+
+	public Object[] getArgs() {
+		return args;
+	}
+
+	public void setArgs(Object[] args) {
+		this.args = args;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+	@Override
+	public String toString() {
+		return MessageFormat.format(this.message, this.args);
+	}
+	
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableStringWithSubject.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableStringWithSubject.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableStringWithSubject.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/LocalizableStringWithSubject.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.basics;
+
+public class LocalizableStringWithSubject extends LocalizableString {
+
+	private Object subject;
+
+	public LocalizableStringWithSubject(Object subject, String message, Object[] arg) {
+		super(message, arg);
+		this.subject = subject;
+	}
+
+	public LocalizableStringWithSubject(Object subject, LocalizableString loc) {
+		super(loc.getMessage(), loc.getArgs());
+		this.subject = subject;
+	}
+
+	public Object getSubject() {
+		return subject;
+	}
+
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/MagmaException.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/MagmaException.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/MagmaException.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/MagmaException.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.basics;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MagmaException extends RuntimeException {
+	
+	private List<LocalizableString> messages = null;
+	
+	public MagmaException(List<LocalizableString> messages) {
+		this.messages = messages;
+	}
+
+	public MagmaException(LocalizableString error) {
+		this.messages = new ArrayList<LocalizableString>(1);
+		this.messages.add(error);
+	}
+
+	public MagmaException(LocalizableString error, Throwable t) {
+		super(t);
+		this.messages = new ArrayList<LocalizableString>(1);
+		this.messages.add(error);
+	}
+	
+	public MagmaException(String message, Object... args) {
+		this(new LocalizableString(message, args));		
+	}
+	
+	public MagmaException(Throwable t, String message, Object... args) {
+		this(new LocalizableString(message, args), t);		
+	}
+	
+	
+	public List<LocalizableString> getMessages() {
+		return messages;
+	}
+	
+	
+	@Override
+	public void printStackTrace(PrintStream s) {
+		s.println(getMessagesString());
+		super.printStackTrace(s);
+	}
+	
+	@Override
+	public void printStackTrace(PrintWriter s) {
+		s.println(getMessagesString());
+		super.printStackTrace(s);
+	}
+
+	public String getMessagesString() {
+		if (this.messages == null) return "";
+		String ret = "";
+		for (LocalizableString str : this.messages) {
+			ret += str.toString() + "\n"; 
+		}
+		return ret;
+	}
+	
+	
+	public void join(MagmaException e) {
+		if (e.getCause() != null || this.getCause() != null) {
+			if (this.getCause() == null) {
+				throw e;
+			}
+		}
+		this.messages.addAll(e.messages);
+	}
+
+	public void setSubject(Object subject) {
+		List<LocalizableString> nmesg = new ArrayList<LocalizableString>();
+		for (LocalizableString loc : messages) {
+			nmesg.add(new LocalizableStringWithSubject(subject, loc));
+		}		
+		messages = nmesg;
+	}	
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/AnnotationToInstance.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/AnnotationToInstance.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/AnnotationToInstance.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/utils/AnnotationToInstance.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.basics.utils;
+
+import org.apache.magma.basics.MagmaException;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+public class AnnotationToInstance {
+
+	public static void setup(Annotation annotation, Object instance) {
+		Class valclass = instance.getClass();
+		Method[] methods = annotation.annotationType().getMethods();
+		for (Method method : methods) {
+			Class valtype = method.getReturnType();
+			String name = method.getName();
+			name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+			Method valmethod = null;
+			try {
+				valmethod = valclass.getMethod("set" + name, valtype);
+			} catch (SecurityException e) {
+			} catch (NoSuchMethodException e) {
+			}
+			if (valmethod == null) continue;
+			try {
+				Object value = method.invoke(annotation);
+				valmethod.invoke(instance, value);
+			} catch (Exception e) {
+				throw new MagmaException(e, "Error invoking method {0}.{1} for annotation {2}", valclass.getName(), method.toString(), annotation.toString());
+			}
+		}
+	}
+	
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/InitHolderInSettings.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/InitHolderInSettings.aj?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/InitHolderInSettings.aj (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/InitHolderInSettings.aj Tue Sep 16 07:19:25 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.settings;
+
+public privileged aspect InitHolderInSettings {
+
+	pointcut readSettings() : execution(* Settings.get*(..)) || execution(* ManageSettings.get*(..));
+	
+	before() : readSettings() {
+		if (Settings.holder == null) {
+			Settings.holder = new SettingsHolder();
+			Settings.holder.init(System.getProperty("magma.env"), null, null);
+		}
+	}
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/ManageSettings.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/ManageSettings.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/ManageSettings.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/ManageSettings.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.settings;
+
+public class ManageSettings {
+
+	public static SettingsHolder getHolder() {
+		return Settings.holder;
+	}
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/Settings.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/Settings.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/Settings.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/Settings.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.settings;
+
+import java.util.Map;
+
+public class Settings {
+
+	static SettingsHolder holder = null;
+	
+	public static String get(String name) {
+		return holder.get(name);
+	}
+	
+	public static Map<String, String> getAll() {
+		return holder.getAll();
+	}
+	
+}

Added: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/SettingsHolder.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/SettingsHolder.java?rev=695893&view=auto
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/SettingsHolder.java (added)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/settings/SettingsHolder.java Tue Sep 16 07:19:25 2008
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.settings;
+
+import org.apache.magma.basics.MagmaException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.InvalidPropertiesFormatException;
+import java.util.Map;
+import java.util.Properties;
+
+public class SettingsHolder {
+
+	private Properties properties = null;
+	private boolean inited = false;
+	
+	public void override(String name, String value) {
+		properties.setProperty(name, value);
+	}
+	
+	public void overrideWith(Properties props) {
+		properties.putAll(props);
+	}
+	
+	public void overrideWith(File file) {
+		if (file == null) return;
+		boolean isxml = file.getName().endsWith("xml");
+		if (!file.exists()) {
+			if (isxml) return;
+			overrideWith(new File(file.getParentFile(), file.getName() + ".xml"));
+			return;
+		}
+		FileInputStream fis = null;
+		try {
+			fis = new FileInputStream(file);
+			overrideWith(fis, isxml);
+		} catch (FileNotFoundException e) {
+			throw new MagmaException(e, "File {0} not found", file.getAbsolutePath());
+		} catch (MagmaException e) {
+			throw new MagmaException(e, "Error while reading properties from {0}", file.getAbsolutePath());
+		}
+	}
+
+	public void overrideWith(URL resource) {
+		if (resource == null) return;
+		InputStream stream;
+		try {
+			stream = resource.openStream();
+			overrideWith(stream, resource.getFile().endsWith("xml"));
+		} catch (IOException e) {
+			throw new MagmaException(e, "Error opening {0}", resource);
+		}
+		
+	}
+	
+	public void overrideWith(InputStream stream, boolean xml) {
+		if (stream == null) return;
+		Properties np = new Properties();
+		try {
+			if (xml) {
+				np.loadFromXML(stream);
+			} else {
+				InputStreamReader isr = new InputStreamReader(stream, Charset.forName("UTF-8"));
+				np.load(isr);
+			}
+			properties.putAll(np);
+		} catch (FileNotFoundException e) {
+		} catch (InvalidPropertiesFormatException e) {
+			throw new MagmaException(e, "InvalidPropertiesFormatException");
+		} catch (IOException e) {
+			throw new MagmaException(e, "Error while reading properties");
+		} finally {
+			try {
+				stream.close();
+			} catch (IOException e) {
+			}
+		}
+	}
+	
+	public void init(String env, String prefix, SettingsHolder defs) {
+		if (inited) return;
+		this.properties = new Properties();
+		if (env == null) env = "";
+		if (env.length() > 0) env = "." + env;
+		if (prefix == null) prefix = "";
+		if (prefix.length() > 0) prefix += ".";
+		ClassLoader loader = getClass().getClassLoader();
+		if (defs == null) {
+			Enumeration<URL> resources;
+			try {
+				resources = loader.getResources("META-INF/magma.default.properties");
+				while (resources.hasMoreElements()) {
+					overrideWith(resources.nextElement());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			try {
+				resources = loader.getResources("META-INF/magma.default.properties.xml");
+				while (resources.hasMoreElements()) {
+					overrideWith(resources.nextElement());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			try {
+				resources = loader.getResources("META-INF/magma" + env + ".default.properties");
+				while (resources.hasMoreElements()) {
+					overrideWith(resources.nextElement());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			try {
+				resources = loader.getResources("META-INF/magma" + env + ".default.properties.xml");
+				while (resources.hasMoreElements()) {
+					overrideWith(resources.nextElement());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		overrideWith(loader.getResource("META-INF/" + prefix + "magma.properties"));
+		overrideWith(loader.getResource("META-INF/" + prefix + "magma.properties.xml"));
+		overrideWith(loader.getResource("META-INF/" + prefix + "magma" + env + ".properties"));
+		overrideWith(loader.getResource("META-INF/" +prefix + "magma" + env + ".properties.xml"));
+		overrideWith(new File(prefix + "magma.properties"));		
+		overrideWith(new File(prefix + "magma" + env + ".properties"));
+	}
+
+	public String get(String name) {
+		return properties.getProperty(name);
+	}
+
+	public Map<String, String> getAll() {
+		return Collections.unmodifiableMap((Map) properties);
+	}
+	
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org