input
stringlengths
10
828
output
stringlengths
5
107
public boolean is offline return false
return true if the environment is offline
public object lookup string name throws unavailable service exception exact match for int i 0 i service names length i if service names i equals name return services i substring match for int i 0 i service names length i if 1 service names i index of name return services i throw new unavailable service exception name
returns the service
public boolean is web browser supported initialize return command null
return true if a web browser is supported
public boolean show document url url initialize if url to string ends with jnlp try new launcher launch external url return true catch exception ex return false if command null try this is bogus because the command may require options should use a stream tokenizer or similar to get tokens outside of quotes runtime get runtime exec command url to string runtime get runtime exec new string command url to string return true catch ioexception ex if jnlpruntime is debug ex print stack trace return false
show a document
public download service listener get default progress window return null
returns a listener that will automatically display download
public boolean is extension part cached url ref string version string part return true
returns whether the part in an extension specified by the
public application instance launch url location throws launch exception return launch to file location
launches a jnlp file by calling the launch method for the
public boolean is extension part cached url ref string version string parts return true
returns whether the parts in an extension specified by the
public boolean is part cached string part return true
returns whether the part of the calling application is cached
public boolean is part cached string parts return true
returns whether all of the parts of the calling application
protected file to cache file url location throws malformed urlexception return cache util url to path location pcache
converts a url into a file in the persistence store
public boolean is resource cached url ref string version return true
returns whether the resource is cached locally
public void launch background jnlpfile file bg runner runner new bg runner file null new thread runner start
launches a jnlp file by calling the launch method for the
public void load extension part url ref string version string parts download service listener progress throws ioexception
downloads the parts of an extension
public version get file version return get version root version null
returns the file version
public application instance get application return application
returns the application instance
public void load extension part url ref string version string part download service listener progress throws ioexception
downloads a part of an extension
public resource tracker get tracker return tracker
returns the tracker that owns the resource
public url get resource location return resource get location
returns the location of the resource being downloaded
public void load part string parts download service listener progress throws ioexception
downloads the parts
public boolean matches string class name form 1 exact class if name equals class name return true form 2 package if name ends with string pk name name substring 0 name length 1 if class name starts with pk name string postfix class name substring pk name length 1 return recursive 1 postfix index of return false
returns whether the specified class is part of this package
public void launch background url location bg runner runner new bg runner null location new thread runner start
launches the jnlp file at the specified location in the
public void load part string part download service listener progress throws ioexception
downloads the part
public url get file location return file location
returns the file location
public void close contributed by ssriram users sourceforge net allow connection to close hopefully we ask java to check another resource before it closes the underlying connection to the server assume we have already used the input stream so we aren t creating it just to close it try if connection null connection get input stream close catch exception ex don t care we re done with it connection null
closes the connection used by this resource
public boolean should update cache entry entry long updated entry get last updated long current system current time millis return current updated time diff
returns whether the resource should be checked for being
public void load resource url ref string version download service listener progress throws ioexception
downloads a resource
public void launch external jnlpfile file throws launch exception if file get source location null launch external file get source location else if file get file location null launch external file get file location else launch error new launch exception file null r lsfatal r lcexternal launch r lnull location r lnull location info
launches the jnlp file in a new jvm instance
public boolean is set int flag if flag uninitialized return status uninitialized else return status flag 0
returns true if any of the specified flags are set
public void remove extension part url ref string version string part throws ioexception
notify the system that an extensions part is no longer
public void remove extension part url ref string version string parts throws ioexception
notify the system that an extensions parts are no longer
public url get code base return codebase
returns the codebase
private string get status string int flag string buffer result new string buffer if flag 0 result append if flag connect 0 result append connect if flag connecting 0 result append connecting if flag connected 0 result append connected if flag download 0 result append download if flag downloading 0 result append downloading if flag downloaded 0 result append downloaded if flag error 0 result append error if flag started 0 result append started return result delete char at result length 1 to string
returns a human readable status string
public void remove part string part throws ioexception
notifies the system that a part is no longer important to
public void remove part string parts throws ioexception
notifies the system that the parts is no longer important to
public void remove resource url ref string version throws ioexception
notifies the system that the resource is no longer important
public void change status int clear int add int orig 0 synchronized this orig status this status clear this status add if jnlpruntime is debug if status orig system out print status get status string status if status orig 0 system out print get status string status orig if status orig 0 system out print get status string status orig system out println location get path
changes the status by clearing the flags in the first
protected list get netx options array list result new array list if jnlpruntime is debug result add verbose if jnlpruntime is headless result add headless if jnlpruntime is security enabled result add nosecurity result add basedir result add jnlpruntime get base dir to string return result
returns the external options passed to netxs boot class
public void remove tracker resource tracker tracker synchronized trackers trackers remove tracker trackers trim to size
removes the tracker to the list of trackers monitoring this
public int get update rate return 150 ms
return the update rate
public void remove resource url location synchronized resources resource resource get resource location if resource null resources remove resource resource remove tracker this should remove from queue probably doesn t matter
removes a resource from the tracker
public int get initial delay return 300 ms
return the initial delay before obtaining a listener
public void add tracker resource tracker tracker synchronized trackers list t trackers hard list prevent gc between contains and add if t contains tracker trackers add tracker trackers trim to size
adds the tracker to the list of trackers monitoring this
protected list get java options array list result new array list string host system get property http proxy host if host null result add dhttp proxy host host string port system get property http proxy port if port null result add dhttp proxy port port return result
returns the external command line jvm options for example
public download service listener get listener application instance app string download name url resources download panel result new download panel download name if frame null frame new jframe downloading frame get content pane set layout new grid bag layout if resources null for int i 0 i resources length i result add progress panel resources i null frame get content pane add result vertical frame pack if frame is visible dimension screen toolkit get default toolkit get screen size frame set location screen width 2 frame get width 2 screen height 2 frame get height 2 frame show return result
return a download service listener that displays the progress
public version get spec version return spec
returns the specification version
public void dispose listener final download service listener listener if listener instanceof download panel return action listener hider new action listener public void action performed action event evt if frame get content pane get component count 1 frame hide frame get content pane remove download panel listener frame pack timer timer new timer close delay hider timer set repeats false timer start
remove a download service listener that was obtained by
protected void fire download event list send synchronized trackers send trackers hard list for int i 0 i send size i resource tracker rt resource tracker send get i rt fire download event this
instructs the trackers monitoring this resource to fire a
protected void add progress panel url url string version if urls contains url progress panel panel new progress panel url version add panel vertical indent frame pack urls add url panels add panel
add a progress panel for a url
protected void update final url url final string version final long read so far final long total final int overall percent runnable r new runnable public void run if urls contains url add progress panel url version set overall percent overall percent progress panel panel progress panel panels get urls index of url panel set progress read so far total panel invalidate added by drichan but should not be needed jam panel repaint swing utilities invoke later r
update the download progress of a url
public void add download listener download listener listener synchronized listeners if listeners contains listener listeners add listener
adds the listener to the list of objects interested in
public void set overall percent int percent don t get whole string from resource and sub in values because it ll be doing a message format for each update header set text downloading download name percent complete
sets the overall percent completed
public list get resources node parent boolean j2se throws parse exception list result new array list node resources get child nodes parent resources ensure that there are at least one information section present if resources length 0 j2se throw new parse exception r pno resources create objects from the resources sections for int i 0 i resources length i result add get resources desc resources i j2se return result
returns all of the resources desc elements under the specified
public void download failed url url string version update url version 1 1 1
called when a download failed
protected application instance launch applet jnlpfile file boolean enable code base throws launch exception if file is applet throw launch error new launch exception file null r lsfatal r lcclient r lnot applet r lnot applet info try applet instance applet create applet file enable code base applet initialize applet get applet environment start applet this should be a direct call to applet instance return applet catch launch exception lex throw launch error lex catch exception ex throw launch error new launch exception file ex r lsfatal r lclaunching r lcould not launch r lcould not launch info
launches a jnlp applet
public void progress url url string version long read so far long total int overall percent update url version read so far total overall percent
called when a download has progressed
public void remove download listener download listener listener synchronized listeners listeners remove listener
removes a download listener
public void upgrading archive url url string version int patch percent int overall percent update url version patch percent 100 overall percent
called when an archive is patched
protected application instance launch installer jnlpfile file throws launch exception throw launch error new launch exception file null r lsfatal r lcnot supported r lno installers r lno installers info
launches a jnlp installer
public long get last updated try return long parse long properties get property last updated catch exception ex return 0
returns the time in the local system clock that the file was
public void validating url url string version long entry long total int overall percent update url version entry total overall percent
called when a download is being validated
public void set last updated long updated time properties set property last updated long to string updated time
sets the time in the local system clock that the file was
protected void fire download event resource resource download listener l null synchronized listeners l download listener listeners to array new download listener 0 int status synchronized resource status resource status download event event new download event this resource for int i 0 i l length i if 0 error downloaded status l i download completed event else if 0 downloading status l i download started event else if 0 connecting status l i update started event
fires the download event corresponding to the resources
public boolean is current urlconnection connection boolean cached is cached if cached return false try long remote modified connection get last modified long cached modified long parse long properties get property last modified return remote modified 0 remote modified cached modified catch exception ex if jnlpruntime is debug ex print stack trace return cached if can t connect return whether already in cache
returns whether there is a version of the url contents in
public boolean is cached file local file cache util get cache file location version if local file exists return false try long cached length local file length long remote length long parse long properties get property content length 1 if remote length 0 cached length remote length return false else return true catch exception ex if jnlpruntime is debug ex print stack trace return false should throw
returns true if the cache has a local copy of the contents
protected void store properties store
save the current information for the cache entry
protected application instance create application jnlpfile file throws launch exception try jnlpclass loader loader jnlpclass loader get instance file update policy security policy app thread group group app thread group thread current thread get thread group application instance app new application instance file group loader group set application app loader set application app if context null app set app context context return app catch exception ex throw launch error new launch exception file ex r lsfatal r clinit r linit applet r linit applet info
creates an application
public url get cache url url location try file f get cache file location if f null return f to url catch malformed urlexception ex if jnlpruntime is debug ex print stack trace return location
returns a url pointing to the cached location of the
public jredesc get jre node node throws parse exception version version get version node version null url location get url node href base string initial heap get attribute node initial heap size null string max heap get attribute node max heap size null list resources get resources node true require version attribute get required attribute node version null return new jredesc version location initial heap max heap resources
returns the jre element at the specified node
protected app thread group create thread group jnlpfile file return new app thread group main group file get title
create a thread group for the jnlp file
public file get cache file url location try resource resource get resource location if resource is set downloaded error wait for resource location 0 if resource is set error return null if resource local file null return resource local file if location get protocol equals ignore case file file file new file location get file if file exists return file return null catch interrupted exception ex if jnlpruntime is debug ex print stack trace return null need an error exception to throw
returns a file containing the downloaded resource
public jnlpfile get file return file
returns the jnlpfile being launched
public string get title return string get item title
returns the applications title
private launch exception launch error launch exception ex if handler null handler launch error ex return ex
send n launch error to the handler if set and also to the
public string get vendor return string get item vendor
returns the applications vendor
public jardesc get jar node node throws parse exception boolean native jar nativelib equals node get node name url location get required url node href base version version get version node version null string part get attribute node part null boolean main true equals get attribute node main false boolean lazy lazy equals get attribute node download eager long size long parse long get attribute node size 1 if native jar main if strict throw new parse exception r pnative has main return new jardesc location version part lazy main native jar size
returns the jar element at the specified node
public string get summary return summary
returns a one sentence summary of the problem
public url get homepage return url get item homepage
returns the applications homepage
public input stream get input stream url location throws ioexception try resource resource get resource location if resource is set downloaded error wait for resource location 0 if resource local file null return new file input stream resource local file return resource location open stream catch interrupted exception ex throw new ioexception wait was interrupted
returns an input stream that reads the contents of the
public string get description string result get description default try to find any description if default is null if result null result get description one line if result null result get description short if result null result get description tooltip return result
returns the default description for the application
private launch exception launch warning launch exception ex if handler null if handler launch warning ex no need to destroy the app b c it hasn t started return ex chose to abort return null chose to continue or no handler
send a launch error to the handler if set and to the
public string get description object kind string result string get item description kind if result null return string get item description default else return result
returns the applications description of the specified type
public url get icon location object kind int width int height icon desc icons get icons kind if icons length 0 return null icon desc best null for int i 0 i icons length i if icons i get width width icons i get height height if best null best icons i if icons i get width best get width use so last specified of icons i get height best get height equivalent icons is chosen best icons i if best null best icons 0 return best get location
returns the url of the icon closest to the specified size and
public void print stack trace print stream stream super print stack trace stream if cause null stream println caused by cause print stack trace stream
print the stack trace and the cause exception 1
public jnlpfile get jnlpfile return jnlp file
returns the jnlpfile the information is for
public void print stack trace print writer stream super print stack trace stream if cause null stream println caused by cause print stack trace stream
print the stack trace and the cause exception 1
public boolean is offline allowed return null get item offline allowed
returns whether offline execution allowed
public boolean wait for resources url urls long timeout throws interrupted exception resource resources new resource urls length synchronized resources keep the lock so get resource doesn t have to aquire it each time for int i 0 i urls length i resources i get resource urls i if resources length 0 return wait resources timeout return true
wait for a group of resources to be downloaded and made
public extension desc get extension node node throws parse exception string name get attribute node name null version version get version node version null url location get required url node href base extension desc ext new extension desc name version location node dload get child nodes node ext download for int i 0 i dload length i boolean lazy lazy equals get attribute node download eager ext add part get required attribute node ext part null get attribute node part null lazy return ext
returns the extension element at the specified node
public boolean is sharing allowed return null get item sharing allowed
returns whether the resources specified in the jnlp file may
protected object get item object key list items get items key if items size 0 return null else return items get items size 1
returns the last item matching the specified key
protected list get items object key if info null return collections empty list list result new array list for int i 0 i info size i 2 if info get i equals key result add info get i 1 return result
returns all items matching the specified key
protected void add item string key object value if info null info new array list info add key info add value
add an information item description icon etc under a
public string get property string key if loaded load return super get property key
returns the value of the specified key or null if the key
public string get property string key string default value if loaded load return super get property key default value
returns the value of the specified key or the default value
public boolean wait for resource url location long timeout throws interrupted exception return wait new resource get resource location timeout
wait for a particular resource to be downloaded and made
public object set property string key string value if loaded load return super set property key value
sets the value for the specified key
public file get store file return file
returns the file backing this properties object
public void load loaded true try if file exists return input stream s new file input stream file load s catch ioexception ex file may be corrupt file corrupt new file file to string corrupt if corrupt exists corrupt delete file rename to corrupt
ensures that the file backing these properties has been
public void store if loaded return nothing could have changed so save unnecessary load save try output stream s new file output stream file store s header catch ioexception ex may be permissions
saves the properties to the file