Package com.zfabrik.impl.components.java
Class ComponentsBuilder
- java.lang.Object
-
- com.zfabrik.resources.provider.Resource
-
- com.zfabrik.impl.components.java.ComponentsBuilder
-
- All Implemented Interfaces:
com.zfabrik.components.java.build.IJavaBuilder
public class ComponentsBuilder extends com.zfabrik.resources.provider.Resource implements com.zfabrik.components.java.build.IJavaBuilderThis class implements the actual make for Java components. SeeIJavaComponentfor the supported folder structure.- Author:
- hb
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.logging.Loggerlogger
-
Constructor Summary
Constructors Constructor Description ComponentsBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(java.lang.Class<T> clz)Retrieve a typed representation of the resource.voidinvalidate()This method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.voidmake(com.zfabrik.components.IComponentDescriptor cd, java.io.File originFolder, java.io.File instanceFolder, java.util.logging.Logger exLogger)Note: we synchronize here, as we have to traverse the component graph and use file locks to avoid cross-process overwrites.voidsetCompiler(com.zfabrik.components.java.build.ICompiler compiler)voidsetOffline(boolean offline)
-
-
-
Method Detail
-
as
public <T> T as(java.lang.Class<T> clz)
Description copied from class:com.zfabrik.resources.provider.ResourceRetrieve a typed representation of the resource.- Overrides:
asin classcom.zfabrik.resources.provider.Resource- Parameters:
clz- expected return type- Returns:
- the expected return type instance represented by the resource or
nullif the type facade is not supported.
-
invalidate
public void invalidate() throws com.zfabrik.resources.ResourceBusyExceptionDescription copied from class:com.zfabrik.resources.provider.ResourceThis method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.This code should be executed in a life cycle code block of this resource instance, i.e. where dependencies are effectively managed, so that race conditions can be avoided.
State changing methods of a resource should always be synchronized (e.g. on this). This is in particular true for cross-resource dependencies. In order to assure consistency under race conditions, a dependent resource should first declare its dependency and then retrieve the resource implementation. In case of failures, resources should clean up by calling
handle().invalidate(true);- Overrides:
invalidatein classcom.zfabrik.resources.provider.Resource- Throws:
com.zfabrik.resources.ResourceBusyException
-
setCompiler
public void setCompiler(com.zfabrik.components.java.build.ICompiler compiler)
-
setOffline
public void setOffline(boolean offline)
-
make
public void make(com.zfabrik.components.IComponentDescriptor cd, java.io.File originFolder, java.io.File instanceFolder, java.util.logging.Logger exLogger)Note: we synchronize here, as we have to traverse the component graph and use file locks to avoid cross-process overwrites. Concurrent make would lead to duplicate file lock acquisition attempts and hence Exceptions (besides the fact that multiple compilers are a resource risk).- Specified by:
makein interfacecom.zfabrik.components.java.build.IJavaBuilderoriginFolder- Folder holding Java component resources as provided by the component repositoryinstanceFolder- Folder for instance specific resources. Origin resources will be copied and modified by compilation
-
-