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 private static final long serialVersionUID = 1L; 044 045 @Factory(value = "nuxeoApplicationName", scope = ScopeType.APPLICATION) 046 public String getNuxeoProductName() { 047 return Framework.getProperty(Environment.PRODUCT_NAME); 048 } 049 050 @Factory(value = "nuxeoApplicationVersion", scope = ScopeType.APPLICATION) 051 public String getNuxeoProductVersion() { 052 return Framework.getProperty(Environment.PRODUCT_VERSION); 053 } 054 055 /** 056 * Gives current year used in copyright (in case this needs to be extracted from a configuration in the future). 057 * 058 * @since 5.9.2 059 */ 060 @Factory(value = "copyrightCurrentYear", scope = ScopeType.APPLICATION) 061 public String getCurrentYearAsString() { 062 return new DateTime().toString("Y"); 063 } 064 065}