⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productversionholder.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	  the Properties object provided.	  @param p The properties object that holds the productVersion	  information.	  @return The ProductVersionHolder or null if	  a product with the given genus is not available in the	  caller's environment.	  */	public static ProductVersionHolder	getProductVersionHolder(Properties p)	{		String pvn = p.getProperty(PropertyNames.PRODUCT_VENDOR_NAME);		String pn = p.getProperty(PropertyNames.PRODUCT_EXTERNAL_NAME);		String ptn = p.getProperty(PropertyNames.PRODUCT_TECHNOLOGY_NAME);		int v1 = parseInt(p.getProperty(PropertyNames.PRODUCT_MAJOR_VERSION));		int v2 = parseInt(p.getProperty(PropertyNames.PRODUCT_MINOR_VERSION));		int v3 = parseInt(p.getProperty(PropertyNames.PRODUCT_MAINT_VERSION));		int v4 = parseInt(p.getProperty(PropertyNames.PRODUCT_DRDA_MAINT_VERSION));		String bn = p.getProperty(PropertyNames.PRODUCT_BUILD_NUMBER);		Boolean isBeta =			Boolean.valueOf(p.getProperty(PropertyNames.PRODUCT_BETA_VERSION));		return 	getProductVersionHolder(pvn,pn,ptn,v1,v2,v3,v4,bn,isBeta);	}	/**	  Return the product vendor name.	  */	public String getProductVendorName()	{		return productVendorName;	}	/**	  Return the external product name.	  */	public String getProductName()	{		return productName;	}	public String getProductTechnologyName()	{		return productTechnologyName;	}	/**	  Return the major version number.	  */	public int getMajorVersion() {return majorVersion;}	/**	  Return the minor version number.	  */	public int getMinorVersion() {return minorVersion;}	/**	  Return the <B>encoded</B> maintainence version number.	  */	public int getMaintVersion() {return maintVersion;}	/** 		Return the drda protocol maintenance version for this minor release.		Starts at 0 for each minor release and only incremented 		when client behaviour changes based on the server version.	**/	public int getDrdaMaintVersion() {return drdaMaintVersion; }	/**		Return the fix pack version from the maintence encoding.	*/	public int getFixPackVersion() { return maintVersion / MAINT_ENCODING; }	/**	  Return true if this is a beta product.	  */	public boolean isBeta() {return isBeta.booleanValue();}	/**	  Return true if this is a alpha product.	  */	public boolean isAlpha() {		return	   (majorVersion >= 5)				&& (minorVersion > 2)				&& ((maintVersion / MAINT_ENCODING) == 0);	}	/**	  Return the build number for this product.	  */	public String getBuildNumber() {return buildNumber;}    /**     * Return the build number as an integer if possible,     * mapping from the SVN number.     * nnnnn -> returns nnnnn     * nnnnnM -> returns -nnnnn indicates a modified code base     * nnnnn:mmmmm -> returns -nnnnn     * anything else -> returns -1    */    public int getBuildNumberAsInt(){    	if (buildNumber == null)    	    return -1;    	boolean dubiousCode = false;    	int offset = buildNumber.indexOf('M');    	if (offset == -1)    	    offset = buildNumber.indexOf(':');    	else    	    dubiousCode = true;    	if (offset == -1)    		offset = buildNumber.length();        else            dubiousCode = true;    	    	try {    		int bnai = Integer.parseInt(buildNumber.substring(0, offset));    		if (dubiousCode)    		    bnai = -bnai;    		return bnai;    	} catch (NumberFormatException nfe)      	{     		return -1;    	}    }	/**	  Parse a string containing a non-negative integer. Return	  a negative integer is the String is invalid.	  @param s A string with a non-negative integer (a sequence	  of decimal digits.)	  @return the integer or a negative number if s is invalid.	  */	private static int parseInt(String s)	{		//System.out.println("Parsing integer: "+s);				int result = BAD_NUMBER;		try			{				if (s!=null)					result = Integer.parseInt(s);			}		catch (NumberFormatException nfe)			{}		if (result < 0) result = BAD_NUMBER;		return result;	}	/**	  Return  a string representation of this ProductVersion. The	  difference between this and createProductVersionString, is	  that this method retruns a String when this ProductVersionHolder	  holds invalid version information.	 */	public String toString()	{		StringBuffer sb = new StringBuffer();		sb.append(getProductVendorName());		sb.append(" - ");		sb.append(getProductName());		sb.append(" - ");		sb.append(getVersionBuildString(true));		return sb.toString();	}	/**		Return the feature version string, ie. major.minor. (e.g. 5.2)	*/	public String getSimpleVersionString() {		return ProductVersionHolder.simpleVersionString(majorVersion, minorVersion, isBeta());	}	/**		Convert a major and minor number with beta status into a string.	*/	public static String simpleVersionString(int major, int minor, boolean isBeta) {		StringBuffer sb = new StringBuffer();		sb.append(major);		sb.append('.');		sb.append(minor);		if (isBeta) {			sb.append(' ');			sb.append(BETA);		}		return sb.toString();	}	public static String fullVersionString(int major, int minor, int maint, boolean isBeta, String build) {		StringBuffer sb = new StringBuffer();		sb.append(major);		sb.append('.');		sb.append(minor);		sb.append('.');		String preRelease = null;		if (major == 5 && minor <= 2 && maint < MAINT_ENCODING)		{			sb.append(maint);			if (isBeta)				preRelease = BETA;		}		else		{			int fixPack = maint / MAINT_ENCODING;			int bugVersion = maint % MAINT_ENCODING;			sb.append(fixPack);			sb.append('.');			sb.append(bugVersion);			if (fixPack == 0)			{				preRelease = ALPHA;			}			else if (isBeta) {				preRelease = BETA;			}		}        if (preRelease != null)        {			sb.append(' ');            sb.append(preRelease);        }		if (build != null) {			sb.append(" - (");			sb.append(build);			sb.append(')');		}        return sb.toString();	}	/**		Returns a short-hand value for the product version string.		Used by Sysinfo.		Includes the optional <beta> designation	*/    public String getVersionBuildString(boolean withBuild)    {		return ProductVersionHolder.fullVersionString(majorVersion, minorVersion, maintVersion, isBeta(),			withBuild ? buildNumber : null);    }	/*	** Security related methods 	*/	private String productGenus;	public final Object run() {		// SECURITY PERMISSION - IP4		return loadProperties(this.productGenus);	}	// SECURITY PERMISSION - IP4	private Properties loadProperties(String productGenus) {		String resourceName = "/org/apache/derby/info/" + productGenus+".properties";					InputStream is = getClass().getResourceAsStream(resourceName);		if (is==null) {			return null;		}		Properties p = new Properties();		try {			p.load(is);			return p;		}		catch (IOException ioe) {			//			//This case is a bit ugly. If we get an IOException, we return			//null. Though this correctly reflects that the product is not			//available for use, it may be confusing to users that we swallow			//the IO error here.			return null;		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -