001/* 002 * (C) Copyright 2012-2015 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 * mguillaume 018 */ 019 020package org.nuxeo.launcher.info; 021 022import java.io.File; 023import java.io.FileInputStream; 024import java.io.IOException; 025import java.util.Properties; 026 027import javax.xml.bind.annotation.XmlAccessType; 028import javax.xml.bind.annotation.XmlAccessorType; 029import javax.xml.bind.annotation.XmlElement; 030import javax.xml.bind.annotation.XmlRootElement; 031 032import org.nuxeo.common.Environment; 033 034@XmlAccessorType(XmlAccessType.NONE) 035@XmlRootElement(name = "distribution") 036public class DistributionInfo { 037 038 public DistributionInfo() { 039 } 040 041 public DistributionInfo(File distFile) throws IOException { 042 Properties distProps = new Properties(); 043 distProps.load(new FileInputStream(distFile)); 044 name = distProps.getProperty(Environment.DISTRIBUTION_NAME, "unknown"); 045 server = distProps.getProperty(Environment.DISTRIBUTION_SERVER, "unknown"); 046 version = distProps.getProperty(Environment.DISTRIBUTION_VERSION, "unknown"); 047 date = distProps.getProperty(Environment.DISTRIBUTION_DATE, "unknown"); 048 packaging = distProps.getProperty(Environment.DISTRIBUTION_PACKAGE, "unknown"); 049 } 050 051 @XmlElement() 052 public String name = "unknown"; 053 054 @XmlElement() 055 public String server = "unknown"; 056 057 @XmlElement() 058 public String version = "unknown"; 059 060 @XmlElement() 061 public String date = "unknown"; 062 063 @XmlElement() 064 public String packaging = "unknown"; 065 066}