001/* 002 * (C) Copyright 2006-2009 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 * $Id$ 018 */ 019 020package org.nuxeo.ecm.webapp.helpers; 021 022import static org.jboss.seam.annotations.Install.FRAMEWORK; 023 024import java.io.Serializable; 025 026import org.jboss.seam.ScopeType; 027import org.jboss.seam.annotations.Factory; 028import org.jboss.seam.annotations.Install; 029import org.jboss.seam.annotations.Name; 030import org.jboss.seam.annotations.Scope; 031import org.joda.time.DateTime; 032 033import org.nuxeo.common.Environment; 034import org.nuxeo.runtime.api.Framework; 035 036@Name("appNameFactory") 037@Scope(ScopeType.STATELESS) 038@Install(precedence = FRAMEWORK) 039public class NuxeoProductNameFactory implements Serializable { 040 041 /** 042 * @deprecated Since 7.10. Use {@link Environment} constants. 043 */ 044 @Deprecated 045 public static String PNAME_KEY = Environment.PRODUCT_NAME; 046 047 /** 048 * @deprecated Since 7.10. Use {@link Environment} constants. 049 */ 050 @Deprecated 051 public static String PVERSION_KEY = Environment.PRODUCT_VERSION; 052 053 private static final long serialVersionUID = 1L; 054 055 @Factory(value = "nuxeoApplicationName", scope = ScopeType.APPLICATION) 056 public String getNuxeoProductName() { 057 return Framework.getProperty(Environment.PRODUCT_NAME); 058 } 059 060 @Factory(value = "nuxeoApplicationVersion", scope = ScopeType.APPLICATION) 061 public String getNuxeoProductVersion() { 062 return Framework.getProperty(Environment.PRODUCT_VERSION); 063 } 064 065 /** 066 * Gives current year used in copyright (in case this needs to be extracted from a configuration in the future). 067 * 068 * @since 5.9.2 069 */ 070 @Factory(value = "copyrightCurrentYear", scope = ScopeType.APPLICATION) 071 public String getCurrentYearAsString() { 072 return new DateTime().toString("Y"); 073 } 074 075}