|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.util.ResourceCollection
public class ResourceCollection
| Nested Class Summary | |
|---|---|
static class |
ResourceCollection.Resource
Class Resource holds a string path which may be a file, url or java resource path. |
| Field Summary | |
|---|---|
protected String |
description
The description |
protected String |
id
The id of this collection |
protected Hashtable |
idToPath
A mapping from id (String) to the resource path |
protected Hashtable |
pathToId
A mapping from resource path to id |
protected int |
writableIndex
Index of the writable index |
protected ResourceCollection.Resource |
writableResource
Path to the writable resource |
| Constructor Summary | |
|---|---|
ResourceCollection(String id)
Create a ResourceCollection with the given id. |
|
ResourceCollection(String id,
List resources)
Ctor |
|
ResourceCollection(String id,
String description)
Create a ResourceCollection with the given id ad description |
|
ResourceCollection(String id,
String writable,
List resources)
Deprecated. not good anymore |
|
| Method Summary | |
|---|---|
void |
addLabels(Hashtable labelMap)
Deprecated. not used anymore |
void |
addResource(ResourceCollection.Resource resource)
Add the resource. |
void |
addResource(String resource)
Add the resource. |
void |
addResourceAtStart(String resourcePath)
Add the resource. |
void |
addResourceAtStart(String resourcePath,
String label)
|
void |
addResources(List rs)
Add the list of resources |
void |
clearCache()
Clear the cache |
boolean |
contains(String path)
Do we contain the given path |
void |
deleteAllFiles()
Delete, if possible, all resource files. |
Object |
get(int i)
Return the name of the i'th resource |
boolean |
getCanLoadMore()
Should we keep loading resources from this collection. |
String |
getDescription()
Get the Description property. |
String |
getId()
The id of the resource collection |
String |
getLabel(int resourceIdx)
Return the label (or null if none defined) for the given resource. |
String |
getPathFromId(String id)
Find the path for the given id |
String |
getProperty(String name,
int resourceIdx)
_more_ |
String |
getResourceId(int idx)
Find the id for the given resource index |
List |
getResources()
Get the list of resources |
String |
getShortName(int resourceIdx)
Return an abbreviated name of the given resource for display purposes. |
String |
getWritable()
Get the string path of the writable file resource. |
boolean |
hasWritableResource()
Do we have a writable resource |
boolean |
isHttp(int i)
Is the given index an http based path |
boolean |
isHttp(String resource)
Is the given path an http based path |
boolean |
isValid(int i)
Is the given resource index valid. |
boolean |
isWritable(int i)
Is the i'th resource writable |
boolean |
isWritableResource(int i)
Is the ith resource a writable resource |
String |
read(int i)
Read the ith resource |
String |
read(int i,
boolean lookAtCache)
Read the ith resource |
protected String |
read(ResourceCollection.Resource resource,
boolean lookAtCache)
Read and return the contents of the resource. |
String |
readWritableResource()
Read in the writable resource file |
void |
removeAll()
Reset all structures |
void |
removeWritable()
Delete, if possible, the writable resource file |
void |
setCanLoadMore(boolean lm)
Set if we can keep loading resources |
void |
setDescription(String value)
Set the Description property. |
void |
setId(String id)
Set the id of the resource collection |
void |
setIdForPath(String id,
String path)
Associate the resource id with the path |
int |
size()
How many resources |
String |
toString()
The toString method |
void |
writeWritableResource(String contents)
Write the given contents into the writable resource file |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String id
protected String description
protected Hashtable idToPath
protected Hashtable pathToId
protected ResourceCollection.Resource writableResource
protected int writableIndex
| Constructor Detail |
|---|
public ResourceCollection(String id)
id - The id of this ResourceCollection
public ResourceCollection(String id,
String description)
id - The id of this ResourceCollectiondescription - The description of this ResourceCollection
public ResourceCollection(String id,
List resources)
id - Resource idresources - List of resources
public ResourceCollection(String id,
String writable,
List resources)
id - Resource idresources - List of resourceswritable - The writable resource| Method Detail |
|---|
public boolean contains(String path)
path - the resource path
public void setIdForPath(String id,
String path)
id - The idpath - The pathpublic String getPathFromId(String id)
id - The id
public String getResourceId(int idx)
idx - The resource index
public boolean getCanLoadMore()
public void setCanLoadMore(boolean lm)
lm - valuepublic String getId()
public void setId(String id)
id - The idpublic boolean isValid(int i)
i - Resource index
public String getLabel(int resourceIdx)
resourceIdx -
public String getProperty(String name,
int resourceIdx)
name - _more_resourceIdx - _more_
public String getShortName(int resourceIdx)
resourceIdx -
public void addLabels(Hashtable labelMap)
labelMap - Pat to label mappublic void addResources(List rs)
rs - List of Resource-spublic void addResource(String resource)
resource - The resource pathpublic void addResource(ResourceCollection.Resource resource)
resource - The resourcepublic void addResourceAtStart(String resourcePath)
resourcePath - the path to the resource
public void addResourceAtStart(String resourcePath,
String label)
public int size()
public boolean isWritable(int i)
i - Resource index
public boolean isHttp(String resource)
resource - Resource path
public boolean isHttp(int i)
i - Resource index
public Object get(int i)
i - The resource index
public boolean isWritableResource(int i)
i - Resource index
public String readWritableResource()
public void writeWritableResource(String contents)
throws FileNotFoundException,
IOException
contents -
FileNotFoundException
IOException
protected String read(ResourceCollection.Resource resource,
boolean lookAtCache)
resource - The resourcelookAtCache - Should we look in the cache or reread
public String read(int i,
boolean lookAtCache)
i - The resource indexlookAtCache - Should we look in the cache or reread
public String read(int i)
i - The resource index
public List getResources()
public void removeWritable()
public void clearCache()
public void deleteAllFiles()
public void removeAll()
public String getWritable()
public boolean hasWritableResource()
public String toString()
toString in class Objectpublic void setDescription(String value)
value - The new value for Descriptionpublic String getDescription()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||