You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2013/04/19 05:36:29 UTC
svn commit: r1469673 - in /openmeetings:
branches/2.1/src/org/apache/openmeetings/
branches/2.1/src/org/apache/openmeetings/remote/red5/
trunk/singlewebapp/src/org/apache/openmeetings/
trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ trunk/s...
Author: solomax
Date: Fri Apr 19 03:36:29 2013
New Revision: 1469673
URL: http://svn.apache.org/r1469673
Log:
Usability: OM version is printed to the logs on OM start.
Added:
openmeetings/branches/2.1/src/org/apache/openmeetings/Version.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/Version.java
Modified:
openmeetings/branches/2.1/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/AboutDialog.java
Added: openmeetings/branches/2.1/src/org/apache/openmeetings/Version.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/2.1/src/org/apache/openmeetings/Version.java?rev=1469673&view=auto
==============================================================================
--- openmeetings/branches/2.1/src/org/apache/openmeetings/Version.java (added)
+++ openmeetings/branches/2.1/src/org/apache/openmeetings/Version.java Fri Apr 19 03:36:29 2013
@@ -0,0 +1,98 @@
+/*
+ * 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.openmeetings;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+public class Version {
+ private static final Logger log = Red5LoggerFactory.getLogger(Version.class, OpenmeetingsVariables.webAppRootKey);
+ private static final int startedStringLength = 48;
+ private static String version = null;
+ private static String revision = null;
+ private static String buildDate = null;
+
+ private static Attributes getAttributes() throws MalformedURLException, IOException {
+ String jarUrl = Version.class.getResource(Version.class.getSimpleName() + ".class").toString();
+ return new Manifest(new URL(jarUrl.substring(0, jarUrl.indexOf('!')) + "!/META-INF/MANIFEST.MF").openStream()).getMainAttributes();
+ }
+
+ public static String getVersion() {
+ if (version == null) {
+ try {
+ version = getAttributes().getValue("Product-Version");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return version;
+ }
+
+ public static String getRevision() {
+ if (revision == null) {
+ try {
+ revision = getAttributes().getValue("Svn-Revision");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return revision;
+ }
+
+ public static String getBuildDate() {
+ if (buildDate == null) {
+ try {
+ buildDate = getAttributes().getValue("Built-On");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return buildDate;
+ }
+
+ private static void getLine(StringBuilder sb, String text, char fill) {
+ sb.append('#');
+ int l = text.length();
+ int headLength = (startedStringLength - l) / 2;
+ for (int i = 0; i < headLength; ++i) {
+ sb.append(fill);
+ }
+ sb.append(text);
+ for (int i = 0; i < (startedStringLength - l - headLength); ++i) {
+ sb.append(fill);
+ }
+ sb.append("#\n");
+ }
+
+ public static void logOMStarted() {
+ StringBuilder sb = new StringBuilder("\n");
+ getLine(sb, "", '#');
+ getLine(sb, "Openmeetings is up", ' ');
+ getLine(sb, getVersion() + " " + getRevision() + " " + getBuildDate(), ' ');
+ getLine(sb, "and ready to use", ' ');
+ getLine(sb, "", '#');
+ log.debug(sb.toString());
+ }
+}
Modified: openmeetings/branches/2.1/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/2.1/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1469673&r1=1469672&r2=1469673&view=diff
==============================================================================
--- openmeetings/branches/2.1/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/branches/2.1/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java Fri Apr 19 03:36:29 2013
@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.openmeetings.OpenmeetingsVariables;
+import org.apache.openmeetings.Version;
import org.apache.openmeetings.data.basic.SessiondataDao;
import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
import org.apache.openmeetings.data.basic.dao.ServerDao;
@@ -148,13 +149,7 @@ public class ScopeApplicationAdapter ext
}
ScopeApplicationAdapter.initComplete = true;
- log.debug("\n" +
- "\t################################################\n" +
- "\t# Openmeetings is up #\n" +
- "\t# and ready to use #\n" +
- "\t################################################\n"
- );
-
+ Version.logOMStarted();
} catch (Exception err) {
log.error("[appStart]", err);
}
Added: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/Version.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/Version.java?rev=1469673&view=auto
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/Version.java (added)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/Version.java Fri Apr 19 03:36:29 2013
@@ -0,0 +1,98 @@
+/*
+ * 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.openmeetings;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+public class Version {
+ private static final Logger log = Red5LoggerFactory.getLogger(Version.class, OpenmeetingsVariables.webAppRootKey);
+ private static final int startedStringLength = 48;
+ private static String version = null;
+ private static String revision = null;
+ private static String buildDate = null;
+
+ private static Attributes getAttributes() throws MalformedURLException, IOException {
+ String jarUrl = Version.class.getResource(Version.class.getSimpleName() + ".class").toString();
+ return new Manifest(new URL(jarUrl.substring(0, jarUrl.indexOf('!')) + "!/META-INF/MANIFEST.MF").openStream()).getMainAttributes();
+ }
+
+ public static String getVersion() {
+ if (version == null) {
+ try {
+ version = getAttributes().getValue("Product-Version");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return version;
+ }
+
+ public static String getRevision() {
+ if (revision == null) {
+ try {
+ revision = getAttributes().getValue("Svn-Revision");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return revision;
+ }
+
+ public static String getBuildDate() {
+ if (buildDate == null) {
+ try {
+ buildDate = getAttributes().getValue("Built-On");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return buildDate;
+ }
+
+ private static void getLine(StringBuilder sb, String text, char fill) {
+ sb.append('#');
+ int l = text.length();
+ int headLength = (startedStringLength - l) / 2;
+ for (int i = 0; i < headLength; ++i) {
+ sb.append(fill);
+ }
+ sb.append(text);
+ for (int i = 0; i < (startedStringLength - l - headLength); ++i) {
+ sb.append(fill);
+ }
+ sb.append("#\n");
+ }
+
+ public static void logOMStarted() {
+ StringBuilder sb = new StringBuilder("\n");
+ getLine(sb, "", '#');
+ getLine(sb, "Openmeetings is up", ' ');
+ getLine(sb, getVersion() + " " + getRevision() + " " + getBuildDate(), ' ');
+ getLine(sb, "and ready to use", ' ');
+ getLine(sb, "", '#');
+ log.debug(sb.toString());
+ }
+}
Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1469673&r1=1469672&r2=1469673&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java Fri Apr 19 03:36:29 2013
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.openmeetings.OpenmeetingsVariables;
+import org.apache.openmeetings.Version;
import org.apache.openmeetings.data.basic.SessiondataDao;
import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
import org.apache.openmeetings.data.basic.dao.ServerDao;
@@ -149,13 +150,7 @@ public class ScopeApplicationAdapter ext
}
ScopeApplicationAdapter.initComplete = true;
- log.debug("\n" +
- "\t################################################\n" +
- "\t# Openmeetings is up #\n" +
- "\t# and ready to use #\n" +
- "\t################################################\n"
- );
-
+ Version.logOMStarted();
} catch (Exception err) {
log.error("[appStart]", err);
}
Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/AboutDialog.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/AboutDialog.java?rev=1469673&r1=1469672&r2=1469673&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/AboutDialog.java (original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/AboutDialog.java Fri Apr 19 03:36:29 2013
@@ -18,13 +18,12 @@
*/
package org.apache.openmeetings.web.components.user;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import static org.apache.openmeetings.Version.getBuildDate;
+import static org.apache.openmeetings.Version.getRevision;
+import static org.apache.openmeetings.Version.getVersion;
+
import java.util.ArrayList;
import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
import org.apache.openmeetings.web.app.Application;
@@ -36,48 +35,6 @@ import com.googlecode.wicket.jquery.ui.w
public class AboutDialog extends AbstractDialog<String> {
private static final long serialVersionUID = 1400355222295594321L;
- private static String version = null;
- private static String revision = null;
- private static String buildDate = null;
-
- private Attributes getAttributes() throws MalformedURLException, IOException {
- String jarUrl = getClass().getResource(getClass().getSimpleName() + ".class").toString();
- return new Manifest(new URL(jarUrl.substring(0, jarUrl.indexOf('!')) + "!/META-INF/MANIFEST.MF").openStream()).getMainAttributes();
- }
-
- private String getVersion() {
- if (version == null) {
- try {
- version = getAttributes().getValue("Product-Version");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return version;
- }
-
- private String getRevision() {
- if (revision == null) {
- try {
- revision = getAttributes().getValue("Svn-Revision");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return revision;
- }
-
- private String getBuildDate() {
- if (buildDate == null) {
- try {
- buildDate = getAttributes().getValue("Built-On");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return buildDate;
- }
-
public AboutDialog(String id) {
super(id, "About"); //FIXME hardcoded