001/* 002 * (C) Copyright 2006-2009 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nuxeo - initial API and implementation 018 * 019 * $Id$ 020 */ 021 022package org.nuxeo.ecm.webapp.helpers; 023 024import static org.jboss.seam.annotations.Install.FRAMEWORK; 025 026import java.io.Serializable; 027 028import org.jboss.seam.ScopeType; 029import org.jboss.seam.annotations.Factory; 030import org.jboss.seam.annotations.Install; 031import org.jboss.seam.annotations.Name; 032import org.jboss.seam.annotations.Scope; 033import org.joda.time.DateTime; 034 035import org.nuxeo.common.Environment; 036import org.nuxeo.runtime.api.Framework; 037 038@Name("appNameFactory") 039@Scope(ScopeType.STATELESS) 040@Install(precedence = FRAMEWORK) 041public class NuxeoProductNameFactory implements Serializable { 042 043 /** 044 * @deprecated Since 7.10. Use {@link Environment} constants. 045 */ 046 @Deprecated 047 public static String PNAME_KEY = Environment.PRODUCT_NAME; 048 049 /** 050 * @deprecated Since 7.10. Use {@link Environment} constants. 051 */ 052 @Deprecated 053 public static String PVERSION_KEY = Environment.PRODUCT_VERSION; 054 055 private static final long serialVersionUID = 1L; 056 057 @Factory(value = "nuxeoApplicationName", scope = ScopeType.APPLICATION) 058 public String getNuxeoProductName() { 059 return Framework.getProperty(Environment.PRODUCT_NAME); 060 } 061 062 @Factory(value = "nuxeoApplicationVersion", scope = ScopeType.APPLICATION) 063 public String getNuxeoProductVersion() { 064 return Framework.getProperty(Environment.PRODUCT_VERSION); 065 } 066 067 /** 068 * Gives current year used in copyright (in case this needs to be extracted from a configuration in the future). 069 * 070 * @since 5.9.2 071 */ 072 @Factory(value = "copyrightCurrentYear", scope = ScopeType.APPLICATION) 073 public String getCurrentYearAsString() { 074 return new DateTime().toString("Y"); 075 } 076 077}