krysalis-version/src/java/org/krysalis/version/impl VersionImporter.java,1.2,1.3 VersionImplementationConstants.java,1.1,1.2 KrysalisVersion.java,1.30,1.31

[email protected] Tue, 25 Mar 2003 08:01:34 -0800
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv1962/src/java/org/krysalis/version/impl

Modified Files:
	VersionImporter.java VersionImplementationConstants.java 
	KrysalisVersion.java 
Log Message:
Tried working on DatestampedSpec...

Index: VersionImporter.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/VersionImporter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VersionImporter.java	24 Mar 2003 01:25:46 -0000	1.2
--- VersionImporter.java	25 Mar 2003 16:00:58 -0000	1.3
***************
*** 66,69 ****
--- 66,70 ----
  import org.krysalis.version.specification.VersionSpecificationFactory;
  import org.krysalis.version.util.debug.DebugUtils;
+ import org.krysalis.version.util.logging.VersionLogger;
  import org.krysalis.version.util.note.AnnotationScratchpad;
  
***************
*** 101,125 ****
          VersionException lastVersionException = null;
  
          //
!         //  Favour our specification
          //
!         VersionSpecification krysalisSpecification =
!             VersionSpecificationFactory.createKrysalisVersionSpecification();
  
          try {
!             VersionFormat format = krysalisSpecification.getVersionFormat();
  
              VersionData versionData = format.parseVersion(data);
  
!             version =
!                 new KrysalisVersion(id, krysalisSpecification, versionData);
          }
          catch (VersionFormatException vfe) {
              lastVersionException = vfe;
          }
          catch (VersionException ve) {
              lastVersionException = ve;
          }
  
          //
          //  Try all other specifications...
--- 102,154 ----
          VersionException lastVersionException = null;
  
+         VersionLogger.g_log.warn("Import: [" + data + "]");
+ 
          //
!         //  Favour our Datestamped specification
          //
!         VersionSpecification datedSpecification =
!             VersionSpecificationFactory.createDatestampedVersionSpecification();
  
          try {
!             VersionFormat format = datedSpecification.getVersionFormat();
  
              VersionData versionData = format.parseVersion(data);
  
!             version = new KrysalisVersion(id, datedSpecification, versionData);
          }
          catch (VersionFormatException vfe) {
+             VersionLogger.g_log.warn("Datestamped: ", vfe);
              lastVersionException = vfe;
          }
          catch (VersionException ve) {
+             VersionLogger.g_log.warn("Datestamped: ", ve);
              lastVersionException = ve;
          }
+         if (null == version) {
  
+             //
+             //  Favour our specification
+             //
+             VersionSpecification krysalisSpecification =
+                 VersionSpecificationFactory
+                     .createKrysalisVersionSpecification();
+ 
+             try {
+                 VersionFormat format = krysalisSpecification.getVersionFormat();
+ 
+                 VersionData versionData = format.parseVersion(data);
+ 
+                 version =
+                     new KrysalisVersion(id, krysalisSpecification, versionData);
+             }
+             catch (VersionFormatException vfe) {
+                 VersionLogger.g_log.warn("Default: ", vfe);
+                 lastVersionException = vfe;
+             }
+             catch (VersionException ve) {
+                 VersionLogger.g_log.warn("Default: ", ve);
+                 lastVersionException = ve;
+             }
+         }
          //
          //  Try all other specifications...
***************
*** 189,193 ****
          if (args.length == 0)
              System.err.println("Pass formatted versions (e.g.\"1.0\") as args");
!             
          for (int i = 0; i < args.length; ++i) {
              String data = args[i];
--- 218,222 ----
          if (args.length == 0)
              System.err.println("Pass formatted versions (e.g.\"1.0\") as args");
! 
          for (int i = 0; i < args.length; ++i) {
              String data = args[i];

Index: VersionImplementationConstants.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/VersionImplementationConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** VersionImplementationConstants.java	24 Mar 2003 01:25:46 -0000	1.1
--- VersionImplementationConstants.java	25 Mar 2003 16:00:59 -0000	1.2
***************
*** 81,84 ****
--- 81,85 ----
  
      public static final String KRYSALIS_VERSION_ID = VERSION_PACKAGE;
+     public static final String DATESTAMPED_VERSION_ID = "org.krysalis.datestamped";
      public static final String ECLIPSE_VERSION_ID = "org.eclipse";
      public static final String MAVEN_VERSION_ID = "org.apache.maven";

Index: KrysalisVersion.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/KrysalisVersion.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** KrysalisVersion.java	24 Mar 2003 01:25:46 -0000	1.30
--- KrysalisVersion.java	25 Mar 2003 16:01:00 -0000	1.31
***************
*** 93,98 ****
              version.getId(),
              version.getVersion());
- 
      }
      /**
       * Constructor for Version.
--- 93,98 ----
              version.getId(),
              version.getVersion());
      }
+ 
      /**
       * Constructor for Version.
***************
*** 501,508 ****
      KrysalisVersion(
          final VersionIdentifier identifier,
!         final VersionSpecification format,
          final VersionData data) {
          m_identifier = identifier;
!         m_specification = format;
          m_data = data;
      }
--- 501,508 ----
      KrysalisVersion(
          final VersionIdentifier identifier,
!         final VersionSpecification spec,
          final VersionData data) {
          m_identifier = identifier;
!         m_specification = spec;
          m_data = data;
      }
***************
*** 602,613 ****
      }
  
      public boolean isCompatible(Version other) {
!         //:TODO: Understand/Test this code (stolen/copied from Ruper)
! 
!         boolean compatible = true;
  
          if (other instanceof KrysalisVersion) {
              KrysalisVersion otherKrysalisVersion = (KrysalisVersion) other;
  
              //
              // Other is 0, or major's equal 
--- 602,617 ----
      }
  
+     /**
+     * Compute if this other version is compatible with this one.
+     *
+     */
      public boolean isCompatible(Version other) {
!         boolean compatible = false;
  
          if (other instanceof KrysalisVersion) {
              KrysalisVersion otherKrysalisVersion = (KrysalisVersion) other;
  
+             compatible = true; // Optomistic...
+ 
              //
              // Other is 0, or major's equal 
***************
*** 621,631 ****
              //
              compatible
!                 &= (getReleaseLevelObject()
!                     .compareTo(otherKrysalisVersion.getReleaseLevelObject())
                      >= 0)
!                 || (!ReleaseLevel.RELEASE.equals(getReleaseLevelObject()))
!                 && (!ReleaseLevel
!                     .RELEASE
!                     .equals(otherKrysalisVersion.getReleaseLevelObject()));
  
          }
--- 625,636 ----
              //
              compatible
!                 &= (otherKrysalisVersion
!                     .getReleaseLevelObject()
!                     .compareTo(getReleaseLevelObject())
                      >= 0)
!                 || !((ReleaseLevel.RELEASE.equals(getReleaseLevelObject()))
!                     || (ReleaseLevel
!                         .RELEASE
!                         .equals(otherKrysalisVersion.getReleaseLevelObject())));
  
          }




-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en