public class FileOptimizerServiceImpl extends Object implements FileOptimizerService, org.osgi.framework.ServiceListener
Modifier and Type | Class and Description |
---|---|
static interface |
FileOptimizerServiceImpl.Config |
Constructor and Description |
---|
FileOptimizerServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
activate(org.osgi.service.component.ComponentContext context,
FileOptimizerServiceImpl.Config config) |
boolean |
canOptimize(org.apache.sling.api.resource.Resource fileResource)
Returns true if the resource is a registered type, the CA Config for the
resource is enabled and if an optimizer is registered for the file's meta
type
|
void |
deactivate(org.osgi.service.component.ComponentContext context) |
Map<String,List<org.osgi.framework.ServiceReference<FileOptimizer>>> |
getFileOptimizers() |
OptimizationResult |
getOptimizedContents(org.apache.sling.api.resource.Resource fileResource)
Gets the optimized contents of a file resource.
|
boolean |
isOptimized(org.apache.sling.api.resource.Resource fileResource)
Returns true if the specified resource has already been optimized by the
FileOptimizer.
|
OptimizationResult |
optimizeFile(org.apache.sling.api.resource.Resource fileResource,
boolean autoCommit)
Optimizes a file resource.
|
void |
serviceChanged(org.osgi.framework.ServiceEvent event) |
void |
setFileOptimizers(Map<String,List<org.osgi.framework.ServiceReference<FileOptimizer>>> fileOptimizers) |
public void activate(org.osgi.service.component.ComponentContext context, FileOptimizerServiceImpl.Config config) throws org.osgi.framework.InvalidSyntaxException
org.osgi.framework.InvalidSyntaxException
public boolean canOptimize(org.apache.sling.api.resource.Resource fileResource)
FileOptimizerService
canOptimize
in interface FileOptimizerService
fileResource
- the resource to check if the optimizer is availablepublic void deactivate(org.osgi.service.component.ComponentContext context)
public Map<String,List<org.osgi.framework.ServiceReference<FileOptimizer>>> getFileOptimizers()
public OptimizationResult getOptimizedContents(org.apache.sling.api.resource.Resource fileResource) throws IOException
FileOptimizerService
getOptimizedContents
in interface FileOptimizerService
fileResource
- the resource to optimizeIOException
- an exception occurs reading the original resourcepublic boolean isOptimized(org.apache.sling.api.resource.Resource fileResource)
FileOptimizerService
isOptimized
in interface FileOptimizerService
fileResource
- the resource to checkpublic OptimizationResult optimizeFile(org.apache.sling.api.resource.Resource fileResource, boolean autoCommit) throws IOException
FileOptimizerService
optimizeFile
in interface FileOptimizerService
fileResource
- the resource to optimizeautoCommit
- if true, the results will automatically be committed to
the Sling RepoIOException
- an exception occurs reading the original resourcepublic void serviceChanged(org.osgi.framework.ServiceEvent event)
serviceChanged
in interface org.osgi.framework.ServiceListener
public void setFileOptimizers(Map<String,List<org.osgi.framework.ServiceReference<FileOptimizer>>> fileOptimizers)
fileOptimizers
- the fileOptimizers to setCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.