Skip to Content.
Sympa Menu

notify-dpml - r1677 - in trunk/main/depot/library/src/main/net/dpml/library: . impl info

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1677 - in trunk/main/depot/library/src/main/net/dpml/library: . impl info
  • Date: Wed, 26 Jul 2006 16:00:34 +0200

Author: mcconnell
Date: 2006-07-26 16:00:22 +0200 (Wed, 26 Jul 2006)
New Revision: 1677

Modified:
trunk/main/depot/library/src/main/net/dpml/library/Resource.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
Log:
add support for decimal version prefix in version string determination

Modified: trunk/main/depot/library/src/main/net/dpml/library/Resource.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-07-25 21:39:33 UTC (rev 1676)
+++ trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-07-26 14:00:22 UTC (rev 1677)
@@ -56,6 +56,12 @@
String getVersion();

/**
+ * Return the statutory resource version.
+ * @return the version
+ */
+ String getStatutoryVersion();
+
+ /**
* Return the fully qualified path to the resource.
* @return the path
*/

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
2006-07-25 21:39:33 UTC (rev 1676)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
2006-07-26 14:00:22 UTC (rev 1677)
@@ -116,6 +116,48 @@
}

/**
+ * Return an integer property value.
+ * @param key the property key
+ * @param value the default value
+ * @return the property value as an integer
+ * @exception NumberFormatException if underlying property value
+ * cannot be resolved to an integer
+ */
+ public int getIntegerProperty( String key, int value )
+ {
+ String result = m_properties.getProperty( key );
+ if( null == result )
+ {
+ return value;
+ }
+ else
+ {
+ String literal = resolve( result );
+ return Integer.parseInt( literal );
+ }
+ }
+
+ /**
+ * Return an boolean property value.
+ * @param key the property key
+ * @param value the default value
+ * @return the property value as an boolean
+ * @exception NumberFormatException if underlying property value
+ * cannot be resolved to an integer
+ */
+ public boolean getBooleanProperty( String key, boolean value )
+ {
+ String result = m_properties.getProperty( key );
+ if( null != result )
+ {
+ return Boolean.valueOf( result ).booleanValue();
+ }
+ else
+ {
+ return value;
+ }
+ }
+ /**
* Evaluate and expand any symbolic references in the supplied value.
* @param value the value to resolve
* @return the resolved value

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-25 21:39:33 UTC (rev 1676)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-26 14:00:22 UTC (rev 1677)
@@ -260,25 +260,52 @@
{
return getStandardVersion();
}
- String version = m_directive.getVersion();
if( ResourceDirective.ANONYMOUS.equals( getClassifier() ) )
{
- return version;
+ return m_directive.getVersion();
}
- if( null == version )
+ else
{
- if( null != m_parent )
+ String version = getStatutoryVersion();
+ if( null != version )
{
- return m_parent.getVersion();
+ return version;
}
else
{
return getStandardVersion();
}
}
+ }
+
+ /**
+ * Return the declard resource version.
+ * @return the statutory version
+ */
+ public String getStatutoryVersion()
+ {
+ if( null == m_directive )
+ {
+ return null;
+ }
else
{
- return version;
+ String version = m_directive.getVersion();
+ if( null != version )
+ {
+ return version;
+ }
+ else
+ {
+ if( null != m_parent )
+ {
+ return m_parent.getStatutoryVersion();
+ }
+ else
+ {
+ return null;
+ }
+ }
}
}

@@ -1340,6 +1367,36 @@

private String getStandardVersion()
{
+ String value = getBuildSignature();
+ if( value.equals( SNAPSHOT ) )
+ {
+ return value;
+ }
+ else
+ {
+ boolean flag = getBooleanProperty(
"project.version-prefix.enabled", false );
+ if( flag )
+ {
+ Version decimal = getDecimalVersion();
+ return decimal.toString() + "-" + value;
+ }
+ else
+ {
+ return value;
+ }
+ }
+ }
+
+ private Version getDecimalVersion()
+ {
+ int major = getMajorVersion();
+ int minor = getMinorVersion();
+ int micro = getMicroVersion();
+ return new Version( major, minor, micro );
+ }
+
+ private String getBuildSignature()
+ {
String system = System.getProperty( "build.signature", SNAPSHOT );
String value = getProperty( "build.signature", system );
if( value.equals( "project.timestamp" ) )
@@ -1351,7 +1408,22 @@
return value;
}
}
-
+
+ private int getMajorVersion()
+ {
+ return getIntegerProperty( "project.major.version", 0 );
+ }
+
+ private int getMinorVersion()
+ {
+ return getIntegerProperty( "project.minor.version", 0 );
+ }
+
+ private int getMicroVersion()
+ {
+ return getIntegerProperty( "project.micro.version", 0 );
+ }
+
/**
* Return the UTC YYMMDD.HHMMSSS signature of a date.
* @return the UTC date-stamp signature

Modified:
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
2006-07-25 21:39:33 UTC (rev 1676)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
2006-07-26 14:00:22 UTC (rev 1677)
@@ -155,7 +155,6 @@
Properties properties = null;
ImportDirective[] imports = new ImportDirective[0];
List list = new ArrayList();
- //ResourceDirective[] resources = new ResourceDirective[0];
Element[] children = ElementHelper.getChildren( element );
for( int i=0; i<children.length; i++ )
{
@@ -257,9 +256,8 @@
|| MODULE_ELEMENT_NAME.equals( tag ) )
{
final String name = ElementHelper.getAttribute( element, "name"
);
-
final String version = ElementHelper.getAttribute( element,
"version" );
- String basedir = ElementHelper.getAttribute( element, "basedir",
null );
+ String basedir = ElementHelper.getAttribute( element, "basedir"
);
if( path != null )
{
if( basedir == null )




  • r1677 - in trunk/main/depot/library/src/main/net/dpml/library: . impl info, mcconnell at BerliOS, 07/26/2006

Archive powered by MHonArc 2.6.24.

Top of Page