jasenautoupdateparcelwrapper.java
来自「spam source codejasen-0.9jASEN - java An」· Java 代码 · 共 176 行
JAVA
176 行
/*
* @(#)JasenAutoUpdateParcelWrapper.java 8/01/2005
*
* Copyright (c) 2004, 2005 jASEN.org
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 4. Any modification or additions to the software must be contributed back
* to the project.
*
* 5. Any investigation or reverse engineering of source code or binary to
* enable emails to bypass the filters, and hence inflict spam and or viruses
* onto users who use or do not use jASEN could subject the perpetrator to
* criminal and or civil liability.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JASEN.ORG,
* OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package org.jasen.update;
import java.util.List;
/**
* <p>
* Provides a read-only wrapper around an update parcel.
* </p>
* <P>
* An update parcel is the summary information about an update which is downloaded prior to the update itself
* </P>
* @author Jason Polites
*/
public class JasenAutoUpdateParcelWrapper {
JasenAutoUpdateParcel parcel;
/**
*
*/
public JasenAutoUpdateParcelWrapper(JasenAutoUpdateParcel parcel) {
super();
this.parcel = parcel;
}
/**
* Gets the name of the update package to be downloaded.
* @return The name of the update package (jar)
*/
public String getArchiveName() {
return parcel.getArchiveName();
}
/**
* Gets the name of the class that will be executed after the update has been downloaded. May be null.
* @return The fully qualified class name of the class to be executed
* @see org.jasen.interfaces.AutoUpdateExecutor
*/
public String getClassName() {
return parcel.getClassName();
}
/**
* Gets the list of files contained in the update.
* @return A list of JasenAutoUpdateFile objects
* @see JasenAutoUpdateFile
*/
public List getFiles() {
return parcel.getFiles();
}
/**
* Gets the name of the jar file which contains the executable class. May be null.
* @return The name (relative path) of the jar file in which the executable class is contained
* @see org.jasen.interfaces.AutoUpdateExecutor
*/
public String getJarName() {
return parcel.getJarName();
}
/**
* Gets the local (relative) path to which the jar file will be deposited.
* @return The local relative path of the jar file
*/
public String getJarPath() {
return parcel.getJarPath();
}
/**
* A boolean value which indicates whether the jar file will be retained after the update has completed.
* @return True if the jar file will be retained, false otherwise or if there was no jar file
*/
public boolean getRetainJar() {
if(parcel.getRetainJar() != null) {
return new Boolean(parcel.getRetainJar()).booleanValue();
}
else
{
return false;
}
}
/**
* Gets the size (in bytes) of the update.
* @return The size in bytes
*/
public long getSize() {
if(parcel.getSize() != null) {
return Long.parseLong(parcel.getSize());
}
else
{
return 0L;
}
}
/**
* Gets the date of the update as a String.
* @return A String representation of the update in dd-MM-yyyy HH:mm format
*/
public String getUpdateDate() {
return parcel.getUpdateDate();
}
/**
* Gets the ID of the update. This should be different for every update.
* @return A string representation of the ID. The ID itself is usually an integer
*/
public String getUpdateId() {
return parcel.getUpdateId();
}
/**
* A boolean value which indicates whether a separate (manual) website update is required.
* @return True if there is further updates which cannot be completed via Auto Update, false otherwise.
*/
public boolean getWebUpdateRequired() {
if(parcel.getWebUpdateRequired() != null) {
return new Boolean(parcel.getWebUpdateRequired()).booleanValue();
}
else
{
return false;
}
}
/**
* If a website update is required, returns the URL of the site containing the update. May be null.
* @return The URL of the update site from which further (manual) updates should be installed.
*/
public String getWebUpdateUrl() {
return parcel.getWebUpdateUrl();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?