This repository has been archived by the owner on Jan 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLOUDIFY-2057 initial commit of the version project
- Loading branch information
barakm
committed
Oct 2, 2013
1 parent
c34214f
commit e70663a
Showing
3 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Cloudify Version | ||
|
||
This sub-module is a hook into the GigaSpaces XAP service grid, defining the version of Cloudify as it will appear in the service grid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>cloudify</artifactId> | ||
<groupId>org.cloudifysource</groupId> | ||
<version>2.7.0-SNAPSHOT</version> | ||
<relativePath>../cloudify</relativePath> | ||
</parent> | ||
|
||
<packaging>jar</packaging> | ||
<artifactId>version</artifactId> | ||
<name>version</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.gigaspaces</groupId> | ||
<artifactId>gs-openspaces</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
<build> | ||
<finalName>version</finalName> | ||
</build> | ||
</project> |
143 changes: 143 additions & 0 deletions
143
version/src/main/java/com/j_spaces/kernel/CloudifyVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2011 GigaSpaces Technologies Ltd. All rights reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
package com.j_spaces.kernel; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.FileOutputStream; | ||
import java.io.PrintStream; | ||
import java.text.DateFormat; | ||
import java.util.Date; | ||
|
||
public class CloudifyVersion implements ProductVersion { | ||
private String EDITION = "Cloudify"; | ||
// !!!IMPORTANT, read below | ||
// Must be of this format otherwise PlatformLogicalVersion will fail | ||
// parsing!!! | ||
private String VERSION = "2.7.0"; | ||
private String MILESTONE = "m4"; | ||
private String BUILD_TYPE = "regular"; | ||
private String V_NUM = VERSION + '-' + EDITION + '-' + MILESTONE; | ||
private String V_LICENSE_NUM = "2.2" + EDITION; | ||
// !!!IMPORTANT, read below | ||
// Must be of either "int-int-string", "int-int" or "int" format otherwise | ||
// PlatformLogicalVersion will fail parsing!!! | ||
private final String BUILD_NUM = "5985-204"; | ||
private final String V_NAME = "GigaSpaces"; | ||
private final String PRODUCT_HELP_URL = "http://www.cloudifysource.org/guide"; | ||
private final String BUILD_TIMESTAMP = "5985-204"; | ||
|
||
/** default constructor for Class.forName() - see com.j_spaces.kernel.PlatformVersion */ | ||
public CloudifyVersion() { | ||
} | ||
|
||
@Override | ||
public String getOfficialVersion() { | ||
return V_NAME + " " + getShortOfficialVersion() + " (build " | ||
+ BUILD_NUM + ", timestamp " + BUILD_TIMESTAMP + ")"; | ||
} | ||
|
||
@Override | ||
public String getShortOfficialVersion() { | ||
String edition = EDITION; | ||
final String XAP_Prefix = "XAP"; | ||
if (EDITION.startsWith("XAP")) { | ||
edition = XAP_Prefix + " " + EDITION.substring(XAP_Prefix.length()); | ||
} | ||
|
||
return edition + " " + VERSION + " " + MILESTONE.toUpperCase(); | ||
} | ||
|
||
@Override | ||
public String getVersionAndBuild() { | ||
return VERSION + "." + BUILD_NUM; | ||
} | ||
|
||
@Override | ||
public void createBuildNumberPropertyFile() { | ||
FileOutputStream fileOut = null; | ||
PrintStream ps = null; | ||
|
||
try { | ||
fileOut = new FileOutputStream("build.properties", true); | ||
} catch (FileNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
ps = new PrintStream(fileOut); | ||
|
||
ps.println("buildnumber=" + BUILD_NUM); | ||
ps.println("tag=" + getTag()); | ||
ps.println("versionnumber=" + V_NUM); | ||
ps.println("milestone=" + MILESTONE); | ||
ps.println("productversion=" + VERSION); | ||
|
||
ps.close(); | ||
} | ||
|
||
@Override | ||
public String getTag() { | ||
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT); | ||
String date = dateFormat.format(new Date()); | ||
|
||
String tag = "build" + BUILD_NUM + "_" + date; | ||
|
||
return tag; | ||
} | ||
|
||
@Override | ||
public String getEdition() { | ||
return EDITION; | ||
} | ||
|
||
@Override | ||
public String getVersion() { | ||
return VERSION; | ||
} | ||
|
||
@Override | ||
public String getLicenseVersion() { | ||
return V_LICENSE_NUM; | ||
} | ||
|
||
@Override | ||
public String getBuildNumber() { | ||
return BUILD_NUM; | ||
} | ||
|
||
@Override | ||
public String getVersionNumber() { | ||
return V_NUM; | ||
} | ||
|
||
@Override | ||
public String getMilestone() { | ||
return MILESTONE; | ||
} | ||
|
||
@Override | ||
public String getBuildType() { | ||
return BUILD_TYPE; | ||
} | ||
|
||
@Override | ||
public String getProductHelpUrl() { | ||
return PRODUCT_HELP_URL; | ||
} | ||
|
||
@Override | ||
public String getBuildTimestamp() { | ||
return BUILD_TIMESTAMP; | ||
} | ||
} |