View Javadoc

1   /*
2    * $Id$
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is eXchaNGeR browser code. (org.xngr.browser.*)
14   *
15   * The Initial Developer of the Original Code is Cladonia Ltd.. Portions created 
16   * by the Initial Developer are Copyright (C) 2002 the Initial Developer. 
17   * All Rights Reserved. 
18   *
19   * Contributor(s): Edwin Dankert <edankert@cladonia.com>
20   */
21  
22  package org.xmlhammer;
23  
24  /***
25   * The version and name of the Xngr browser application.
26   *
27   * Sets 6 System-properties for general use:<br/>
28   * <code>xngr.title</code><br/>
29   * <code>xngr.vendor</code><br/>
30   * <code>xngr.reference</code><br/>
31   * <code>xngr.version</code><br/>
32   * <code>xngr.description</code><br/>
33   * <code>xngr.copyright</code><br/>
34   *
35   * @version	$Revision$, $Date$
36   * @author Edwin Dankert <edankert@cladonia.com>
37   */
38  public class Identity {
39  	private static Identity identity = null;
40  	
41  	public static final String TITLE_PROPERTY 			= "product.title";
42  	public static final String VENDOR_PROPERTY			= "product.vendor";
43  	public static final String REFERENCE_PROPERTY		= "product.reference";
44  	public static final String VERSION_PROPERTY		    = "product.version";
45  	public static final String DESCRIPTION_PROPERTY	    = "product.description";
46  	public static final String COPYRIGHT_PROPERTY		= "product.copyright";
47  	
48  	/***
49  	 * Gets the one version of the identity.
50  	 */
51  	public static Identity getInstance() {
52  		if ( identity == null) {
53  			identity = new Identity();
54  		}
55  		
56  		return identity;
57  	}
58  	
59  	/***
60  	 * Sets the identity of the application as System properties...
61  	 */
62  	private Identity() {
63  		System.setProperty( TITLE_PROPERTY, "XML Hammer");
64  		System.setProperty( VENDOR_PROPERTY, "Edwin Dankert");
65  		System.setProperty( REFERENCE_PROPERTY, "http://www.xmlhammer.org/");
66  		System.setProperty( VERSION_PROPERTY, "1.0");
67  		System.setProperty( DESCRIPTION_PROPERTY, "When the only thing you've got is a XML Hammer...");
68  		System.setProperty( COPYRIGHT_PROPERTY, "Copyright 2005 - 2008 (C) Edwin Dankert");
69  	}
70  
71  	/***
72  	 * Gets the product's title.
73  	 */
74  	public String getTitle()  {
75  		return System.getProperty( TITLE_PROPERTY);
76  	}
77  
78  	/***
79  	 * Gets the vendor's name.
80  	 */
81  	public String getVendor() {
82  		return System.getProperty( VENDOR_PROPERTY);
83  	}
84  
85  	/***
86  	 * Gets a reference, ie. the products home page.
87  	 */
88  	public String getReference() {
89  		return System.getProperty( REFERENCE_PROPERTY);
90  	}
91  	
92  	
93  	/***
94  	 * Gets the version number for the product.
95  	 */
96  	public String getVersion() {
97  		return System.getProperty( VERSION_PROPERTY);
98  	}
99  
100 	/***
101 	 * Gets a description for the product.
102 	 */
103 	public String getDescription() {
104 		return System.getProperty( DESCRIPTION_PROPERTY);
105 	}
106 
107 	/***
108 	 * Gets the copyright information for the product.
109 	 */
110 	public String getCopyright() {
111 		return System.getProperty( COPYRIGHT_PROPERTY);
112 	}
113 }