📄 siteextractionbean.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .//////// SiteExtractionBean//// NK 03.08.2001////package org.jahia.admin.sites;import java.io.*;import java.util.*;import org.jahia.utils.*;import org.jahia.exceptions.*;import org.jahia.utils.properties.PropertiesManager;/** * Load Information from a site extraction properties file * * @author Khue ng * @version 1.0 */public class SiteExtractionBean { private static final String CLASS_NAME ="SiteExtractionBean"; private String mExtractName; private String mExtractDescr; private long mDate; private int mBuild; private double mRelease; /** * @associates SiteInfoBean */ private Vector mSites = new Vector(); /** * Constructor * @param descrFile, a valid extraction properties file * @exception JahiaException throw when file is not valid */ public SiteExtractionBean ( String descrFile ) throws JahiaException { if ( descrFile == null ){ throw new JahiaException(CLASS_NAME, "Description File path is null", JahiaException.ERROR, JahiaException.ERROR); } PropertiesManager prop = new PropertiesManager(descrFile); mExtractName = prop.getProperty(ExtDepSiteConstants.DESCRFILE_NAME); if ( mExtractName == null || mExtractName.trim().equals("") ){ throw new JahiaException(CLASS_NAME, "Extraction Name is not valid", JahiaException.ERROR, JahiaException.ERROR); } mExtractDescr = prop.getProperty(ExtDepSiteConstants.DESCRFILE_DESCR); if ( mExtractDescr == null ){ mExtractDescr = "No description"; } try { mDate = Long.parseLong(prop.getProperty(ExtDepSiteConstants.DESCRFILE_DATE)); } catch ( Throwable t ){ throw new JahiaException(CLASS_NAME, "Extraction Date is not valid", JahiaException.ERROR, JahiaException.ERROR); } try { mBuild = Integer.parseInt(prop.getProperty(ExtDepSiteConstants.DESCRFILE_BUILD)); } catch ( Throwable t ){ throw new JahiaException(CLASS_NAME, "Extraction Build number is not valid", JahiaException.ERROR, JahiaException.ERROR); } try { mRelease = Double.parseDouble(prop.getProperty(ExtDepSiteConstants.DESCRFILE_RELEASE)); } catch ( Throwable t ){ throw new JahiaException(CLASS_NAME, "Extraction Release number is not valid", JahiaException.ERROR, JahiaException.ERROR); } try { String[] sites = JahiaTools.getTokens(prop.getProperty(ExtDepSiteConstants.DESCRFILE_SITES),","); for ( int i=0 ; i<sites.length ; i++ ){ String[] site = JahiaTools.getTokens(sites[i],"@@@"); SiteInfoBean sBean = new SiteInfoBean(site[0],site[1]); mSites.add(sBean); } } catch ( Throwable t ){ throw new JahiaException(CLASS_NAME, "Extraction Site List is not valid", JahiaException.ERROR, JahiaException.ERROR); } prop = null; } //-------------------------------------------------------------------------- /** * Returns the extract name */ public String getName(){ return mExtractName; } //-------------------------------------------------------------------------- /** * Returns the extract descr */ public String getDescr(){ return mExtractDescr; } //-------------------------------------------------------------------------- /** * Returns the extract date */ public long getDate(){ return mDate; } //-------------------------------------------------------------------------- /** * Returns the extract build number */ public int getBuildNumber(){ return mBuild; } //-------------------------------------------------------------------------- /** * Returns the release number */ public double getReleaseNumber(){ return mRelease; } //-------------------------------------------------------------------------- /** * Returns an enumeration of site names contained in this extraction */ public Enumeration getSites(){ return mSites.elements(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -