| java.lang.Object com.knowgate.dataobjs.DBPersist com.knowgate.hipergate.ProductLocation
ProductLocation | public class ProductLocation extends DBPersist (Code) | | Product Location
Location semantics depend upon what Product is used for.
- For Downloadable Products, ProductLocations represent mirror download URLs.
- For Versioned Products, ProductLocations represent different versions of the same File.
- For Compound Products, ProductLocations represent parts of the Product each one being a File.
- For Physical Products, ProductLocations represent stock of Product at different warehouses.
author: Sergio Montoro Ten version: 2.2 |
Method Summary | |
public boolean | delete(JDCConnection oConn) Delete Productocation
If ProductLocation URL point to a file that does not exist then an SQLException will be raised.
Disk files are only deleted for CONTAINER_FILE and CONTAINER_FTP container types. | public int | getContainerType() Get numeric identifier for container type.
Usually, container type is computed from protocol.
Protocol | Container Type |
file:// | CONTAINER_FILE |
http:// | CONTAINER_HTTP |
https:// | CONTAINER_HTTPS |
ftp:// | CONTAINER_FTP |
odbc:// | CONTAINER_ODBC |
lotus:// | CONTAINER_LOTUS |
jdbc:// | CONTAINER_JDBC |
ware:// | CONTAINER_WARE |
Container Type. | public String | getPath() | public String | getProductType() | public String | getURL() | public boolean | rename(JDCConnection oConn, FileSystem oFileSys, String sNewFile) | public void | setLength(long lLen) | public void | setLength(int iLen) | public void | setPath(String sProtocol, String sHost, String sPath, String sFile, String sOriginalFile) Set File Path
Parameters: sProtocol - Protocol. | public void | setPath(String sProtocol, String sHost, String sPath, String sFile, String sOriginalFile, String sAnchor) Set File Path
Parameters: sProtocol - Protocol. | public void | setPath(String sHost, String sLocalPath) Set Local Path for ProductLocation
File Separator is taken from System.getProperty("file.separator") method. | public void | setURL(String sURL) | public boolean | store(JDCConnection oConn) Store productLocation
Properties gu_location, dt_uploaded, dt_modified, id_cont_type,
id_prod_type, pg_prod_locat and status are automatically set if not present
at internal properties colelction when calling store(). | public void | upload(JDCConnection oConn, FileSystem oFileSys, String sSourcePath, String sSourceFile, String sTargetPath, String sTargetFile) Move a File from a temporary directory up to the final location referenced
by ProductLocation URL.
Parameters: oConn - Database Connection Parameters: oFileSys - FileSystem object used for moving the file. If FileSystem requieres additional parameters (such as user authentification for FTP)it will be taken from hipergate.cnf file by using Environment singleton. Parameters: sSourcePath - Source Directory. |
CONTAINER_FILE | final public static int CONTAINER_FILE(Code) | | |
CONTAINER_FTP | final public static int CONTAINER_FTP(Code) | | |
CONTAINER_HTTP | final public static int CONTAINER_HTTP(Code) | | |
CONTAINER_HTTPS | final public static int CONTAINER_HTTPS(Code) | | |
CONTAINER_JDBC | final public static int CONTAINER_JDBC(Code) | | |
CONTAINER_LOTUS | final public static int CONTAINER_LOTUS(Code) | | |
CONTAINER_ODBC | final public static int CONTAINER_ODBC(Code) | | |
CONTAINER_WARE | final public static int CONTAINER_WARE(Code) | | |
ClassId | final public static short ClassId(Code) | | |
ProductLocation | public ProductLocation()(Code) | | |
ProductLocation | public ProductLocation(JDCConnection oConn, String iIdLocation) throws SQLException(Code) | | Load ProductLocation from database
Parameters: oConn - Database Conenction Parameters: iIdLocation - GUID of ProductLocation to be loaded throws: SQLException - |
delete | public boolean delete(JDCConnection oConn) throws SQLException(Code) | | Delete Productocation
If ProductLocation URL point to a file that does not exist then an SQLException will be raised.
Disk files are only deleted for CONTAINER_FILE and CONTAINER_FTP container types. Files pointed by
other protocols (such as CONTAINER_HTTP) will not be deleted with by this method.
Parameters: oConn - Database Connection throws: SQLException - |
getContainerType | public int getContainerType()(Code) | | Get numeric identifier for container type.
Usually, container type is computed from protocol.
Protocol | Container Type |
file:// | CONTAINER_FILE |
http:// | CONTAINER_HTTP |
https:// | CONTAINER_HTTPS |
ftp:// | CONTAINER_FTP |
odbc:// | CONTAINER_ODBC |
lotus:// | CONTAINER_LOTUS |
jdbc:// | CONTAINER_JDBC |
ware:// | CONTAINER_WARE |
Container Type. One of { CONTAINER_FILE, CONTAINER_HTTP, CONTAINER_HTTPS, CONTAINER_FTP, CONTAINER_ODBC, CONTAINER_JDBC, CONTAINER_LOTUS, CONTAINER_WARE } |
getPath | public String getPath()(Code) | | Get Path to URL or file
xprotocol [xhost] [:xport] / xpath Example 1: file:///opt/knowgate/storage/userdata/ Example 2: http://www.hipergate.org/es/ Example 3: http://localhost:8080/ |
getProductType | public String getProductType()(Code) | | Get product type from file path.
Product Type as listed in k_lu_prod_types table computed following these rules: If xfile is null and xpath is null and id_cont_type is not CONTAINER_HTTP or CONTAINER_HTTPS then "?" is returned. If xfile is null and xpath is null and id_cont_type is CONTAINER_HTTP or CONTAINER_HTTPS then "HTML" is returned. If xfile is not null and file name has at least one dot ('.') then last dot is considered the extension delimiter. Example 1: ProductLocation oLoca = new ProductLocation(); oLoca.setURL("http://www.hipergate.org/index.jsp?lang=en"); String sProdType = oLoca.getProductType(); // sProdType == "JSP"
Example 2: ProductLocation oLoca = new ProductLocation(); oLoca.put(DB.id_cont_type, ProductLocation.CONTAINER_HTTP); oLoca.setURL("http://www.hipergate.org/"); // sProdType == "HTML" |
getURL | public String getURL()(Code) | | Get URL for ProductLocation
getPath() [xfile] [#xanchor] |
setLength | public void setLength(int iLen)(Code) | | Set file length in bytes
Parameters: lLen - Length of file pointed by ProductLocation URL |
setPath | public void setPath(String sProtocol, String sHost, String sPath, String sFile, String sOriginalFile)(Code) | | Set File Path
Parameters: sProtocol - Protocol. One of { "file://", "http://", "https://", "ftp://", "odbc://", "jdbc://", "ware://" } Parameters: sHost - Host Name for electronic Products or WareHouse Name for physical Products. Example: "www.hipergate.org" Parameters: sPath - Absolute Access Path. Example: "/opt/knowgate/users/" Parameters: sFile - Uploaded File Name Parameters: sOriginalFile - Original File Name before uploading.In some cases, files may be renamed upon upload and then renamed again to their original names when downloaded. |
setPath | public void setPath(String sProtocol, String sHost, String sPath, String sFile, String sOriginalFile, String sAnchor)(Code) | | Set File Path
Parameters: sProtocol - Protocol. One of { "file://", "http://", "https://", "ftp://", "odbc://", "jdbc://", "ware://" } Parameters: sHost - Host Name for electronic Products or WareHouse Name for physical Products. Example: "www.hipergate.org" Parameters: sPath - Absolute Access Path. Example: "/opt/knowgate/users/" Parameters: sFile - Uploaded File Name Parameters: sOriginalFile - Original File Name before uploading.In some cases, files may be renamed upon upload and then renamed again to their original names when downloaded. Parameters: sAnchor - Anchor |
setPath | public void setPath(String sHost, String sLocalPath)(Code) | | Set Local Path for ProductLocation
File Separator is taken from System.getProperty("file.separator") method.
Parameters: sHost - Host Name Parameters: sLocalPath - Full Local Path and File Name. Example 1: "file:///opt/knowgate/userfiles/logo.gif" Example 2: "file://C:\\TEMP\\UserGuide.doc"
|
store | public boolean store(JDCConnection oConn) throws SQLException(Code) | | Store productLocation
Properties gu_location, dt_uploaded, dt_modified, id_cont_type,
id_prod_type, pg_prod_locat and status are automatically set if not present
at internal properties colelction when calling store().
Parameters: oConn - Database Connection throws: SQLException - |
upload | public void upload(JDCConnection oConn, FileSystem oFileSys, String sSourcePath, String sSourceFile, String sTargetPath, String sTargetFile) throws Exception, IOException, SQLException(Code) | | Move a File from a temporary directory up to the final location referenced
by ProductLocation URL.
Parameters: oConn - Database Connection Parameters: oFileSys - FileSystem object used for moving the file. If FileSystem requieres additional parameters (such as user authentification for FTP)it will be taken from hipergate.cnf file by using Environment singleton. Parameters: sSourcePath - Source Directory. For example: "file:///tmp/archivos/" Parameters: sSourceFile - Original File Name. For example: "notes.pdf" Parameters: sTargetPath - Target Directory. For example: "ftp://saturno/opt/storage/" Parameters: sTargetFile - Final File Name. For Example: "notes-13-05-03.pdf" throws: Exception - throws: IOException - throws: SQLException - See Also: com.knowgate.misc.Environment |
Methods inherited from com.knowgate.dataobjs.DBPersist | public void allcaps(boolean bAllValuesUpperCase)(Code)(Java Doc) public boolean allcaps()(Code)(Java Doc) protected HashMap changelog(DBPersist oOldInstance)(Code)(Java Doc) public void clear()(Code)(Java Doc) public void clone(DBPersist oSource)(Code)(Java Doc) public boolean containsKey(Object oKey) throws NullPointerException(Code)(Java Doc) public boolean containsValue(Object oKey)(Code)(Java Doc) public boolean delete(JDCConnection oConn) throws SQLException(Code)(Java Doc) public Set entrySet()(Code)(Java Doc) public boolean exists(JDCConnection oConn) throws SQLException(Code)(Java Doc) public Object get(String sKey)(Code)(Java Doc) public Object get(Object oKey) throws NullPointerException(Code)(Java Doc) public String getAuditClassName()(Code)(Java Doc) public Date getCreationDate(JDCConnection oConn) throws SQLException(Code)(Java Doc) public java.util.Date getDate(String sKey) throws ClassCastException(Code)(Java Doc) public String getDateFormated(String sKey, String sFormat) throws ClassCastException(Code)(Java Doc) public String getDateShort(String sKey) throws ClassCastException(Code)(Java Doc) public String getDateTime(String sKey)(Code)(Java Doc) public String getDateTime24(String sKey)(Code)(Java Doc) public BigDecimal getDecimal(String sKey) throws ClassCastException, NumberFormatException(Code)(Java Doc) public String getDecimalFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)(Java Doc) public double getDouble(String sKey) throws NullPointerException, NumberFormatException(Code)(Java Doc) public String getDoubleFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)(Java Doc) public float getFloat(String sKey) throws NullPointerException, NumberFormatException(Code)(Java Doc) public String getFloatFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)(Java Doc) public int getInt(String sKey) throws NullPointerException, NumberFormatException(Code)(Java Doc) public Integer getInteger(String sKey) throws NumberFormatException(Code)(Java Doc) public int getIntervalPart(String sKey, String sPart) throws NullPointerException, NumberFormatException, IllegalArgumentException(Code)(Java Doc) public HashMap getItemMap()(Code)(Java Doc) public Set getItems()(Code)(Java Doc) public Money getMoney(String sKey) throws NumberFormatException(Code)(Java Doc) public java.sql.Date getSQLDate(String sKey) throws ClassCastException(Code)(Java Doc) public Time getSQLTime(String sKey) throws ClassCastException(Code)(Java Doc) public short getShort(String sKey) throws java.lang.NullPointerException(Code)(Java Doc) public String getString(String sKey) throws NullPointerException(Code)(Java Doc) public String getStringNull(String sKey, String sDefault)(Code)(Java Doc) public DBTable getTable()(Code)(Java Doc) public DBTable getTable(JDCConnection oConn) throws SQLException, IllegalStateException(Code)(Java Doc) public String getTableName()(Code)(Java Doc) public String getTime(String sKey) throws ClassCastException(Code)(Java Doc) public Time getTimeOfDay(String sKey)(Code)(Java Doc) public Timestamp getTimestamp(String sKey)(Code)(Java Doc) protected static String getUIdFromName(JDCConnection oConn, Integer iDomainId, String sInstanceNm, String sStoredProc) throws SQLException(Code)(Java Doc) public boolean isEmpty()(Code)(Java Doc) public boolean isNull(String sKey)(Code)(Java Doc) public Iterator iterator()(Code)(Java Doc) public Set keySet()(Code)(Java Doc) public boolean load(JDCConnection oConn, Object[] PKVals) throws SQLException(Code)(Java Doc) public boolean load(JDCConnection oConn, String sKey) throws SQLException(Code)(Java Doc) public void parseXML(String sXMLFilePath) throws SAXException, SAXNotRecognizedException, SAXNotSupportedException, SAXParseException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException(Code)(Java Doc) public void put(String sKey, String sVal) throws NullPointerException(Code)(Java Doc) public void put(String sKey, Object oObj) throws NullPointerException(Code)(Java Doc) public Object put(Object sKey, Object oObj) throws NullPointerException(Code)(Java Doc) public void put(String sKey, int iVal)(Code)(Java Doc) public void put(String sKey, short iVal)(Code)(Java Doc) public void put(String sKey, Date dtVal)(Code)(Java Doc) public void put(String sKey, Time tmVal)(Code)(Java Doc) public void put(String sKey, String sDate, SimpleDateFormat oPattern) throws ParseException(Code)(Java Doc) public void put(String sKey, double dVal)(Code)(Java Doc) public void put(String sKey, BigDecimal oDecVal)(Code)(Java Doc) public void put(String sKey, String sDecVal, DecimalFormat oPattern) throws ParseException(Code)(Java Doc) public void put(String sKey, float fVal)(Code)(Java Doc) public void put(String sKey, Money mVal)(Code)(Java Doc) public void put(String sKey, File oFile) throws FileNotFoundException(Code)(Java Doc) public void put(String sKey, byte[] aBytes)(Code)(Java Doc) public void put(String sKey, char[] aChars)(Code)(Java Doc) public void put(String sKey, String sData, int iSQLType) throws FileNotFoundException, IllegalArgumentException, NullPointerException(Code)(Java Doc) public void putAll(Properties oPropsCollection) throws FileNotFoundException(Code)(Java Doc) public void putAll(Map oMap)(Code)(Java Doc) public void remove(String sKey)(Code)(Java Doc) public Object remove(Object oKey)(Code)(Java Doc) public void replace(String sKey, Object oObj)(Code)(Java Doc) public void replace(String sKey, int iVal)(Code)(Java Doc) public void replace(String sKey, short iVal)(Code)(Java Doc) public void replace(String sKey, float fVal)(Code)(Java Doc) public void setAuditTransact(String sAuditTransact)(Code)(Java Doc) public void setAuditUser(String sAuditUser)(Code)(Java Doc) public int size()(Code)(Java Doc) public boolean store(JDCConnection oConn) throws SQLException(Code)(Java Doc) public void toLowerCase(String sKey)(Code)(Java Doc) public void toUpperCase(String sKey)(Code)(Java Doc) protected String toXML(String sIdent, String sDelim, HashMap oAttrs) throws IllegalStateException(Code)(Java Doc) public String toXML(String sIdent, String sDelim) throws IllegalStateException(Code)(Java Doc) public String toXML(String sIdent)(Code)(Java Doc) public String toXML()(Code)(Java Doc) public Collection values()(Code)(Java Doc)
|
|
|