Package org.appng.api.support
Class ApplicationResourceHolder
- java.lang.Object
-
- org.appng.api.support.ApplicationResourceHolder
-
-
Constructor Summary
Constructors Constructor Description ApplicationResourceHolder(Application application, MarshallService marshallService, File applicationFolder, File outputFolder)
Creates a newApplicationResourceHolder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
dumpToCache(ResourceType... types)
Writes allResource
s to the local caching location.ApplicationInfo
getApplicationInfo()
Resource
getResource(Integer id)
Returns theResource
with the given ID.Resource
getResource(ResourceType type, String fileName)
Returns theResource
of the given type with the given name, if any.Set<Resource>
getResources()
Returns the underlyingResource
Set<Resource>
getResources(ResourceType type)
Returns allResource
s of the givenResourceType
.
-
-
-
Constructor Detail
-
ApplicationResourceHolder
public ApplicationResourceHolder(Application application, MarshallService marshallService, File applicationFolder, File outputFolder) throws InvalidConfigurationException
Creates a newApplicationResourceHolder
- Parameters:
application
- theApplication
that owns theResources
marshallService
- aMarshallService
usingMarshallService.AppNGSchema.APPLICATION
applicationFolder
- the location of theApplication
'sResource
s on disc, only needed if theApplication
is filebasedoutputFolder
- the output folder for storing the cached resources of theApplication
- Throws:
InvalidConfigurationException
- if no valid application-info.xml could be found- See Also:
Application.getResourceSet()
,Application.isFileBased()
,dumpToCache(ResourceType...)
-
-
Method Detail
-
getResources
public Set<Resource> getResources(ResourceType type)
Description copied from interface:Resources
Returns allResource
s of the givenResourceType
.- Specified by:
getResources
in interfaceResources
- Parameters:
type
- the ResourceType- Returns:
- the
Resource
s of the givenResourceType
-
dumpToCache
public void dumpToCache(ResourceType... types)
Description copied from interface:Resources
Writes allResource
s to the local caching location.- Specified by:
dumpToCache
in interfaceResources
- Parameters:
types
- the types to write the cachefiles for- See Also:
Resource.getCachedFile()
-
getResource
public Resource getResource(ResourceType type, String fileName)
Description copied from interface:Resources
Returns theResource
of the given type with the given name, if any.- Specified by:
getResource
in interfaceResources
- Parameters:
type
- theResourceType
of theResource
fileName
- the name of theResource
- Returns:
- the
Resource
, ornull
if no suchResource
exists.
-
getResources
public Set<Resource> getResources()
Description copied from interface:Resources
Returns the underlyingResource
- Specified by:
getResources
in interfaceResources
- Returns:
- the underlying
Resource
s
-
getResource
public Resource getResource(Integer id)
Description copied from interface:Resources
Returns theResource
with the given ID.- Specified by:
getResource
in interfaceResources
- Parameters:
id
- the ID of theResource
- Returns:
- the
Resource
, ornull
if no such resource exists.
-
getApplicationInfo
public ApplicationInfo getApplicationInfo()
Description copied from interface:Resources
- Specified by:
getApplicationInfo
in interfaceResources
- Returns:
- the
ApplicationInfo
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceResources
- Throws:
IOException
-
-