You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/02/01 21:24:03 UTC
svn commit: r1239306 - in /openejb/trunk/openejb:
arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/
container/openejb-core/src/main/java/org/apache/openejb/cli/
container/openejb-core/src/main/java/org/apache...
Author: rmannibucau
Date: Wed Feb 1 20:24:03 2012
New Revision: 1239306
URL: http://svn.apache.org/viewvc?rev=1239306&view=rev
Log:
OPENEJB-1762 unactivating this feature by default, if you want it add the system property openejb.version.check, can be done in ~/.openejb/system.properties
Added:
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
- copied, changed from r1239221, openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IO.java
Removed:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IO.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IOUtils.java
Modified:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/SessionScopeTest.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
openejb/trunk/openejb/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java
Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/SessionScopeTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/SessionScopeTest.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/SessionScopeTest.java (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/session/SessionScopeTest.java Wed Feb 1 20:24:03 2012
@@ -20,7 +20,6 @@ package org.apache.openejb.arquillian.se
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.openejb.util.IOUtils;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -34,10 +33,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.File;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java Wed Feb 1 20:24:03 2012
@@ -16,32 +16,28 @@
*/
package org.apache.openejb.cli;
-import org.apache.xbean.finder.ResourceFinder;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.util.OpenEjbVersion;
-import org.apache.openejb.util.OptionsLog;
-import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.Options;
import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.util.OpenEjbVersion;
+import org.apache.openejb.util.OptionsLog;
+import org.apache.xbean.finder.ResourceFinder;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.List;
import java.io.IOException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.BufferedInputStream;
-import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
/**
* Entry point for ALL things OpenEJB. This will use the new service
@@ -188,22 +184,6 @@ public class MainImpl implements Main {
System.exit(2);
}
- // Read in and apply the conf/system.properties
- try {
- File conf = systemInstance.getBase().getDirectory("conf");
- File file = new File(conf, "system.properties");
- if (file.exists()){
- Properties systemProperties = new Properties();
- FileInputStream fin = new FileInputStream(file);
- InputStream in = new BufferedInputStream(fin);
- systemProperties.load(in);
- System.getProperties().putAll(systemProperties);
- systemInstance.getProperties().putAll(systemProperties);
- }
- } catch (IOException e) {
- System.out.println("Processing conf/system.properties failed: "+e.getMessage());
- }
-
// Now read in and apply the properties specified on the command line
for (int i = 0; i < args.length; i++) {
String arg = args[i];
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java Wed Feb 1 20:24:03 2012
@@ -317,7 +317,7 @@ public class ConfigurationFactory implem
}
Thread updateCheckerThreader = null;
- if (!offline) {
+ if (!offline && !UpdateChecker.isSkipped()) {
updateCheckerThreader = new Thread(new UpdateChecker());
updateCheckerThreader.start();
}
@@ -420,7 +420,7 @@ public class ConfigurationFactory implem
}
}
- if (!offline) {
+ if (!offline && !UpdateChecker.isSkipped()) {
try {
updateCheckerThreader.join(10000); // 10s is already a lot
} catch (InterruptedException ignored) {
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java Wed Feb 1 20:24:03 2012
@@ -16,7 +16,6 @@
*/
package org.apache.openejb.core.security.jaas;
-import static org.apache.openejb.util.IOUtils.readProperties;
import org.apache.openejb.util.ConfUtils;
import org.apache.openejb.util.LogCategory;
import org.apache.openejb.util.Logger;
@@ -33,10 +32,12 @@ import javax.security.auth.spi.LoginModu
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.LinkedHashSet;
+
+import static org.apache.openejb.loader.IO.readProperties;
/**
* @version $Rev$ $Date$
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java Wed Feb 1 20:24:03 2012
@@ -16,6 +16,7 @@
*/
package org.apache.openejb.util;
+import org.apache.openejb.loader.IO;
import org.apache.openejb.loader.SystemInstance;
import java.io.File;
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java Wed Feb 1 20:24:03 2012
@@ -1,9 +1,11 @@
package org.apache.openejb.util;
+import org.apache.openejb.loader.IO;
+
import java.net.URL;
public class UpdateChecker implements Runnable {
- private static final String SKIP_CHECK = "openejb.version.check.skip";
+ private static final String SKIP_CHECK = "openejb.version.check";
private static final String REPO_URL = System.getProperty("openejb.version.check.repo.url", "http://repo1.maven.org/maven2/org/apache/openejb/");
private static final String URL = System.getProperty("openejb.version.check.url", REPO_URL + "openejb/maven-metadata.xml");
private static final String TAG = "latest";
@@ -67,7 +69,7 @@ public class UpdateChecker implements Ru
}
public static boolean isSkipped() {
- return System.getProperty(SKIP_CHECK) != null;
+ return System.getProperty(SKIP_CHECK) == null;
}
public static void main(String[] args) {
Copied: openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java (from r1239221, openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IO.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java?p2=openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java&p1=openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IO.java&r1=1239221&r2=1239306&rev=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/IO.java (original)
+++ openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java Wed Feb 1 20:24:03 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.util;
+package org.apache.openejb.loader;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -38,6 +38,7 @@ import java.net.ProxySelector;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
+import java.util.Properties;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@@ -74,6 +75,38 @@ public class IO {
return builder.toString();
}
+ public static Properties readProperties(URL resource) throws IOException {
+ Properties properties = new Properties();
+ InputStream in = null;
+ try {
+ in = resource.openStream();
+ in = new BufferedInputStream(in);
+ properties.load(in);
+ } finally{
+ try {
+ if (in != null) in.close();
+ } catch (IOException e) {
+ }
+ }
+ return properties;
+ }
+
+ public static Properties readProperties(final File resource) throws IOException {
+ Properties properties = new Properties();
+ InputStream in = null;
+ try {
+ in = new BufferedInputStream(new FileInputStream(resource));
+ properties.load(in);
+ } finally{
+ try {
+ if (in != null) in.close();
+ } catch (IOException ignored) {
+ // no-op
+ }
+ }
+ return properties;
+ }
+
public static String readString(URL url) throws IOException {
final InputStream in = url.openStream();
try {
Modified: openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java (original)
+++ openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java Wed Feb 1 20:24:03 2012
@@ -16,9 +16,10 @@
*/
package org.apache.openejb.loader;
-import java.util.Properties;
+import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
-import java.lang.annotation.Annotation;
+import java.util.Properties;
/**
* This class aims to be the one and only static in the entire system
@@ -180,9 +181,43 @@ public class SystemInstance {
public static void init(Properties properties) throws Exception {
if (initialized) return;
system = new SystemInstance(properties);
+ readUserSystemProperties();
+ readSystemProperties();
initialized = true;
}
+ private static void readUserSystemProperties() {
+ final File file = new File(System.getProperty("user.home"), ".openejb/system.properties");
+ addSystemProperties(file);
+ }
+
+ private static void readSystemProperties() {
+ // Read in and apply the conf/system.properties
+ try {
+ final File conf = system.getBase().getDirectory("conf");
+ final File file = new File(conf, "system.properties");
+ addSystemProperties(file);
+ } catch (IOException e) {
+ // no-op
+ }
+ }
+
+ private static void addSystemProperties(final File file) {
+ if (!file.exists()){
+ return;
+ }
+
+ final Properties systemProperties;
+ try {
+ systemProperties = IO.readProperties(file);
+ } catch (IOException e) {
+ return;
+ }
+
+ System.getProperties().putAll(systemProperties);
+ system.getProperties().putAll(systemProperties);
+ }
+
public static SystemInstance get() {
return system;
}
Modified: openejb/trunk/openejb/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java?rev=1239306&r1=1239305&r2=1239306&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java (original)
+++ openejb/trunk/openejb/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java Wed Feb 1 20:24:03 2012
@@ -19,7 +19,7 @@ package org.apache.tomee.embedded;
import org.apache.commons.io.FileUtils;
import org.apache.openejb.OpenEjbContainer;
-import org.apache.openejb.util.IOUtils;
+import org.apache.openejb.loader.IO;
import org.junit.Test;
import javax.ejb.embeddable.EJBContainer;
@@ -52,7 +52,7 @@ public class EmbeddedTomEEContainerTest
assertNotNull(container);
assertNotNull(container.getContext());
URL url = new URL("http://127.0.0.1:" + System.getProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT) + "/" + war.getName() + "/index.html");
- assertEquals("true", IOUtils.readProperties(url).getProperty("ok"));
+ assertEquals("true", IO.readProperties(url).getProperty("ok"));
container.close();
} finally {
try {