krysalis-version/src/java/org/krysalis/version/ant/nested DefaultVersionAttributes.java,1.4,1.5

[email protected]
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/ant/nested
In directory sc8-pr-cvs1:/tmp/cvs-serv18959/src/java/org/krysalis/version/ant/nested

Modified Files:
	DefaultVersionAttributes.java 
Log Message:
Docs & also Constraints

Index: DefaultVersionAttributes.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/ant/nested/DefaultVersionAttributes.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DefaultVersionAttributes.java	11 Feb 2003 23:45:23 -0000	1.4
--- DefaultVersionAttributes.java	17 Feb 2003 18:54:55 -0000	1.5
***************
*** 56,59 ****
--- 56,60 ----
  package org.krysalis.version.ant.nested;
  
+ import java.net.InetAddress;
  import java.util.ArrayList;
  import java.util.HashMap;
***************
*** 72,122 ****
  public class DefaultVersionAttributes extends NestedElement {
  
! 	private List m_list = null;
  
! 	private static final HashMap DEFAULT_MAP;
  
! 	static {
! 		DEFAULT_MAP = new HashMap();
  
! 		DEFAULT_MAP.put("java.vm.version", VersionConstants.BUILD_JVM);
! 		DEFAULT_MAP.put("user.name", VersionConstants.BUILD_USER);
! 		DEFAULT_MAP.put("build.date", VersionConstants.BUILD_DATE);
  
! 		// :TODO: Add more...
! 	}
  
! 	/**
! 	 * Constructor for VersionAttribute.
! 	 */
! 	public DefaultVersionAttributes(Task task) {
! 		super(task);
  
! 		m_list = new ArrayList();
  
! 		importProperties();
! 	}
  
! 	private void importProperties() {
! 		Hashtable properties = m_ant.getProject().getProperties();
  
! 		for (Iterator i = DEFAULT_MAP.keySet().iterator(); i.hasNext();) {
! 			Object key = i.next();
! 			String vkey = (String) DEFAULT_MAP.get(key);
! 			Object value = properties.get(key);
  
! 			if (null != value) {
! 				m_list.add(
! 					new VersionAttribute(m_ant.getTask(), vkey, value.toString()));
! 			} else
! 				m_ant.log(
! 					"Attribute [" + vkey + "] without value",
! 					Project.MSG_WARN);
! 		}
! 	}
  
! 	public VersionAttribute createAttribute() {
! 		VersionAttribute attr = new VersionAttribute(m_ant.getTask());
! 		m_list.add(attr);
! 		return attr;
! 	}
  }
--- 73,145 ----
  public class DefaultVersionAttributes extends NestedElement {
  
!     private List m_list = null;
  
!     private static final HashMap DEFAULT_MAP;
  
!     static {
!         DEFAULT_MAP = new HashMap();
  
!         DEFAULT_MAP.put("java.vm.version", VersionConstants.BUILD_JVM);
!         DEFAULT_MAP.put("user.name", VersionConstants.BUILD_USER);
!         DEFAULT_MAP.put("build.date", VersionConstants.BUILD_DATE);
  
!         // :TODO: Add more...
!     }
  
!     /**
!      * Constructor for VersionAttribute.
!      */
!     public DefaultVersionAttributes(Task task) {
!         super(task);
  
!         m_list = new ArrayList();
  
!         importProperties();
  
!         generateProperties();
!     }
  
!     private void importProperties() {
!         Hashtable properties = m_ant.getProject().getProperties();
  
!         for (Iterator i = DEFAULT_MAP.keySet().iterator(); i.hasNext();) {
!             Object key = i.next();
!             String vkey = (String) DEFAULT_MAP.get(key);
!             Object value = properties.get(key);
  
!             if (null != value) {
!                 m_list.add(
!                     new VersionAttribute(
!                         m_ant.getTask(),
!                         vkey,
!                         value.toString()));
!             }
!             else
!                 m_ant.log(
!                     "Attribute [" + vkey + "] without value",
!                     Project.MSG_WARN);
!         }
!     }
! 
!     private void generateProperties() {
!         String hostname = null;
!         try {
!             hostname = InetAddress.getLocalHost().getHostName();
!         }
!         catch (Exception e) {
!             hostname = "unknown";
!         }
!         
!         m_list.add(
!             new VersionAttribute(
!                 m_ant.getTask(),
!                 VersionConstants.BUILD_HOST,
!                 hostname));
!     }
! 
!     public VersionAttribute createAttribute() {
!         VersionAttribute attr = new VersionAttribute(m_ant.getTask());
!         m_list.add(attr);
!         return attr;
!     }
  }




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.