Package sc.layer

Class Layer

  • All Implemented Interfaces:
    IDynObject, LayerConstants, ILifecycle

    public class Layer
    extends java.lang.Object
    implements ILifecycle, LayerConstants, IDynObject
    The main implementation class for a Layer. There's one instance of this class for a given layer in a given LayeredSystem. The LayeredSystem stores the current list of layers that are active in the system in it's layers property for when it's used to model a set of layers to build+run. When the LayeredSystem is used in the IDE, it maintains a list of inactiveLayers that are also kept in a sorted order based on dependencies.

    To create a new layer, add a layer definition file, placed in the layer's directory in your system's layerpath (e.g. /home/StrataCode/bundles/example/example/unitConverter/clientServer/clientServer.sc)

    At startup time, the LayeredSystem creates a Layer instance for each layer definition file. It sorts the list of layers based on dependencies. It initializes all of the layers by calling tbe initialize method in the layer definition file. It then starts all Layers by calling the start method. The layer definition file can define new build properties, or instances of layered components to define new features in the project. Add compiled libraries to the classPath or additional source directories to the source path. Define new file types or a MvnRepositoryPackage component to automatically download and include a specific 3rd party package. This component chooses a specific version that can be easily overridden by a downstream layer.

    Even more control can be obtained by adding code to the init or start methods in the Layer definition component. To use layers in the IDE, make sure not to start processes unless the 'activated' flag is true.

    • Field Detail

      • ANY_LAYER

        public static final Layer ANY_LAYER
      • ANY_INACTIVE_LAYER

        public static final Layer ANY_INACTIVE_LAYER
      • ANY_OPEN_INACTIVE_LAYER

        public static final Layer ANY_OPEN_INACTIVE_LAYER
      • INVALID_LAYER_PATH

        public static final java.lang.String INVALID_LAYER_PATH
        See Also:
        Constant Field Values
      • layerDirName

        public java.lang.String layerDirName
        The name of the layer used to find it in the layer path dot separated, e.g. groupName.dirName
      • baseLayerNames

        public java.util.List<java.lang.String> baseLayerNames
        Contains the list of layers this layer extends
      • baseLayers

        public java.util.List<Layer> baseLayers
      • started

        public boolean started
      • validated

        public boolean validated
      • dynamic

        public boolean dynamic
        Is this a compiled or a dynamic layer
      • removed

        public boolean removed
        Set to true when this layer is removed from the system
      • activated

        public boolean activated
        Set to false for layers which are not part of the running application
      • disabled

        public boolean disabled
        Set to true when this layer should not be started for whatever reason.
      • excluded

        public boolean excluded
        Set to true for a baseLayer which has been excluded from this runtime
      • buildLayer

        public boolean buildLayer
        Set to true for any layers which should be compiled individually. Set to true when buildSeparate = true, this is the buildLayer (the last layer), or the layer was previous built
      • transparent

        public boolean transparent
        Set to true for layers who want to show all objects and properties visible in their extended layers
      • closed

        public boolean closed
        For inactive layers, we can remove a layer from participating in the type system by marking it as closed.
      • buildSeparate

        public boolean buildSeparate
        Set this to true so that a given layer is compiled by itself - i.e. its build will not include source or classes for any layers which it extends. In that case, those layers will have to be built separately before this layer can be run.
      • layerPosition

        public int layerPosition
        The integer position of the layer in the list of layers
      • classPath

        public java.lang.String classPath
        Any set of dependent classes code in this layer requires
      • classPathCache

        public java.util.Set<java.lang.String> classPathCache
        Stores classPath entries added to this layer to avoid duplicates
      • externalClassPath

        public java.lang.String externalClassPath
        Any set of dependent classes code in this layer requires which cannot be loaded into the normal ClassLoader
      • srcPath

        public java.lang.String srcPath
        Optional: if not set, the layer's top level folder is used as the one src directory.
      • preCompiledSrcPath

        public java.lang.String preCompiledSrcPath
        Optional: specifies a set of directories or zip files which are already compiled but can be accessed as src models in the system (e.g. for converting to Javascript)
      • packagePrefix

        public java.lang.String packagePrefix
        Prepend this prefix globally to all package names auto-generated
      • imports

        public java.util.List<ImportDeclaration> imports
        Imports added to all Java, v, vj classes
      • defaultModifier

        public java.lang.String defaultModifier
        Set using the public or private modifier set on the layer definition itself
      • annotationLayer

        public boolean annotationLayer
        True if this layer just sets annotations and does not generate classes
      • configLayer

        public boolean configLayer
        True if this layer configures it's base layers as it's primary goal. It affects how layers are sorted, so that this layer is placed as close to it's base layers as dependencies will allow.
      • buildDir

        public java.lang.String buildDir
        The directory to put .class in
      • buildSrcDir

        public java.lang.String buildSrcDir
        The directory to put generated src in - defaults to buildDir if buildSrcDir is not set
      • sysBuildSrcDir

        public java.lang.String sysBuildSrcDir
      • buildSrcSubDir

        public java.lang.String buildSrcSubDir
        Used when compiled source should be in a sub-directory of the build dir. Sets the default value of buildSrcDir to buildDir/buildSrcSubDir. This value is inherited form one layer to the next
      • buildClassesSubDir

        public java.lang.String buildClassesSubDir
        Used when compiled classes should be in a sub-directory of the build dir (e.g. WEB-INF/classes). Sets the default value of buildDir to buildDir/buildSubDir. This value is inherited form one layer to the next
      • origBuildLayer

        public Layer origBuildLayer
        The layer where classes built from this layer should go. It gets set to the buildSysClassesDir of the LayeredSystem and only adjusted as needed because types start modifying types in this layer.
      • buildClassesDir

        public java.lang.String buildClassesDir
        The class directory where this layer's compiled files should go.
      • hidden

        public boolean hidden
        Set this to true for any layers you do not want to show up in the UI
      • compiledOnly

        public boolean compiledOnly
        Set to true for layers that cannot be used in dynamic mode. Default for them is to compile them.
      • liveDynamicTypes

        public boolean liveDynamicTypes
        When true, any object instances of types in this layer are registered in a weak hash-table with their class as a key. When you interactively add a property assignment to a layer that modifies these instances, we can apply those changes dynamically.
      • compileLiveDynamicTypes

        public boolean compileLiveDynamicTypes
        Controls the compilation process for implementing the liveDynamicTypes.
      • compiled

        public boolean compiled
        True when this layer has been successfully compiled - i.e. its buildDir is up-to-date
      • compiledInClassPath

        public boolean compiledInClassPath
        Set to true when a layer has been compiled and put into the classpath
      • excludedFiles

        public java.util.List<java.lang.String> excludedFiles
        Set of patterns to ignore in any layer src or class directory, using Java's regex language
      • excludedPaths

        public java.util.List<java.lang.String> excludedPaths
        Normalized paths relative to the layer directory that are excluded from processing
      • skipStartPaths

        public java.util.List<java.lang.String> skipStartPaths
        Set of src-file pathnames to which are included in the src cache but not processed
      • skipStartFiles

        public java.util.List<java.lang.String> skipStartFiles
        Set of patterns to ignore in any layer src or class directory, using Java's regex language
      • exportImports

        public boolean exportImports
        When this is true, the imports from this layer are used by the next layer if its inheritImports are true
      • inheritImports

        public boolean inheritImports
        When this is true, we'll inherit the imports from any extended layer which has exportImports=true
      • useGlobalImports

        public boolean useGlobalImports
        Expose imports before us in the layer path even if we do not extend those layers
      • inheritPackage

        public boolean inheritPackage
        When this is true, the extended layer by default uses the package of the last extended layer in the list.
      • exportPackage

        public boolean exportPackage
        Set this to false on framework layers which set a package that child layers should not inherit by default
      • exportRuntime

        public boolean exportRuntime
        Controls whether or not a layer which extends this layer inherits the runtime dependencies of this layer. For example, if this layer excludes JS will an extending layer also exclude JS? Or if this layer is run on both JS and Java will extending layers run on both too?
      • exportProcess

        public boolean exportProcess
      • inheritRuntime

        public boolean inheritRuntime
        Controls whether we inherit the runtime dependencies of our base classes. By default, if you extend a layer that only runs in Javascript or Java your layer will only run in Java or JS. If you set this flag to false, it can run on any runtime.
      • inheritProcess

        public boolean inheritProcess
        Same as inheritRuntime but for the process name
      • excludeRuntimes

        public java.util.List<java.lang.String> excludeRuntimes
      • includeRuntimes

        public java.util.List<java.lang.String> includeRuntimes
      • excludeProcesses

        public java.util.List<java.lang.String> excludeProcesses
      • includeProcesses

        public java.util.List<java.lang.String> includeProcesses
      • hasDefinedRuntime

        public boolean hasDefinedRuntime
      • hasDefinedProcess

        public boolean hasDefinedProcess
      • includeForInit

        public boolean includeForInit
        Set this to true for the layer to be included in the 'initialization runtime' - the server runtime when using client/server or the only runtime in a single-process configuration
      • defaultSyncMode

        public SyncMode defaultSyncMode
        Enable or disable the default sync mode for types which are defined in this layer. TODO - deprecated. Use @Sync on the layer
      • finalLayer

        public boolean finalLayer
        Set this to true to disallow modification to any types defined in this layer from upstream layers. In other words, when a layer is final, it's the last layer to modify those types. FinalLayer also makes it illegal to modify any types that a finalLayer type depends on so be careful in how you use it. When you build a finalLayer separately, upstream layers can load their class files directly, since they can't be changed by upstream layers. This makes compiling makes must faster.
      • changedModelsDetected

        public boolean changedModelsDetected
        Set to true when this layer has had all changed files detected. If it's not changed, we will load it as source
      • buildAllFiles

        public boolean buildAllFiles
        Set to true for a given build layer which needs to build all files
      • traceBuildSrcIndex

        public static boolean traceBuildSrcIndex
        Trace build src index operations to track generated file build process
      • repositoryPackages

        public java.util.List<RepositoryPackage> repositoryPackages
        The list of third party packages to be installed or updated for this layer
      • errorsStarting

        public boolean errorsStarting
      • copyPlainJavaFiles

        public boolean copyPlainJavaFiles
        If a Java file uses no extensions, we can either compile it from the source dir or copy it to the build dir
      • layerPathName

        public java.lang.String layerPathName
        Set by the system to the full path to the directory containing LayerName.sc (layerFileName = layerPathName + layerBaseName + ".sc") (or INVALID_LAYER_FILE if we do not have a valid path)
      • layerBaseName

        public java.lang.String layerBaseName
        Just the LayerName.sc part
      • layerUniqueName

        public java.lang.String layerUniqueName
        The unique name of the layer - prefix + dirName, e.g. sc.util.util
      • buildSrcIndex

        public java.util.HashMap<java.lang.String,​SrcIndexEntry> buildSrcIndex
      • initFailed

        public boolean initFailed
        Set to true if a base layer or start method failed to start
      • initCompleted

        public boolean initCompleted
      • needsIndexRefresh

        public boolean needsIndexRefresh
      • tempLayer

        public boolean tempLayer
        Set to true for layers that need to be saved the first time they are needed
      • indexLayer

        public boolean indexLayer
      • buildInfo

        public BuildInfo buildInfo
        Each build layer has a buildInfo which stores global project info for that layer
      • dynTypeIndex

        public java.util.HashSet<java.lang.String> dynTypeIndex
        Caches the typeNames of all dynamic types built in this build layer (if any)
      • scopeProcessors

        public java.util.HashMap<java.lang.String,​sc.lang.sc.IScopeProcessor> scopeProcessors
      • annotationProcessors

        public java.util.HashMap<java.lang.String,​IAnnotationProcessor> annotationProcessors
      • TYPE_INDEX_SUFFIX

        public static final java.lang.String TYPE_INDEX_SUFFIX
        See Also:
        Constant Field Values
      • BUILD_STATUS_FILE_BASE

        public static final java.lang.String BUILD_STATUS_FILE_BASE
        See Also:
        Constant Field Values
    • Constructor Detail

      • Layer

        public Layer()
    • Method Detail

      • addModifiedLayer

        public void addModifiedLayer​(java.lang.String otherLayerName)
        Add an explicitly dependency on layer. This will ensure that if your layer and the otherLayerName are in the stack, that this layer will be compiled along with other layer. One case you need this is if you override an annotation such as sc.html.URL so that it depends on classes generated by your layer. Since that dependency is not reflected in the code, there's no easy way to figure it out but the build system needs to be aware of this dependency.
      • replacesLayer

        public void replacesLayer​(java.lang.String otherLayerName)
        For fine-grained control over layer ordering, a downstream layer can mark that it replaces an update stream layer. This is always going to be a layer which the downstream layer already extends. When determining layer ordering, if a third layer extends the upstream layer, it will also follow the downstream layer which replaces that upstream layer. For example, if html.schtml replaces html.core, and you extend html.core, you'll be guaranteed to follow html.schtml in the layer list. Why this is necessary? In most cases, you explicitly depend upon a feature of another layer so you usually extend the layers you depend upon. But if another framework layer modifies that feature, and it follows your layer in the stack, supporting all of the invalidation and rebuilds necessary so you end up recompiling all affected files is too much work. The tagPackageList is an example of a feature that does not always respect the strict layering due to it's flexibility. So classes put into that list may need to replace the layer which defined the tagPackage entry. Essentially, your application layer may need to inherit a dependency on the last layer which replaces the feature to work properly.
      • excludeRuntimes

        public void excludeRuntimes​(java.lang.String... names)
      • excludeRuntime

        public void excludeRuntime​(java.lang.String name)
      • includeRuntimes

        public void includeRuntimes​(java.lang.String... names)
      • includeRuntime

        public void includeRuntime​(java.lang.String name)
      • excludeProcesses

        public void excludeProcesses​(java.lang.String... names)
      • excludeProcess

        public void excludeProcess​(java.lang.String name)
      • includeProcesses

        public void includeProcesses​(java.lang.String... names)
      • includeProcess

        public void includeProcess​(java.lang.String name)
      • createDefaultRuntime

        public void createDefaultRuntime​(java.lang.String runtimeName,
                                         boolean useContextClassLoader)
        Creates a new java runtime which is incompatible with the standard Java runtime
      • addRuntime

        public void addRuntime​(IRuntimeProcessor proc)
        Called from the layer definition file to register a new runtime required by this layer.
      • getAllowedInAnyRuntime

        public boolean getAllowedInAnyRuntime()
        Some layers do not extend a layer bound to a runtime platform and so can run in any layer.
      • getAllowedInAnyProcess

        public boolean getAllowedInAnyProcess()
      • buildsLayer

        public boolean buildsLayer​(Layer layer)
        Use this method to decide whether to build a given assets. The build layer accumulates all assets but when we do intermediate builds, we only include the layers which are directly in the extension graph.
      • getInheritedSrcFileFromTypeName

        public SrcEntry getInheritedSrcFileFromTypeName​(java.lang.String typeName,
                                                        boolean srcOnly,
                                                        boolean prependPackage,
                                                        java.lang.String subPath,
                                                        IProcessDefinition proc,
                                                        boolean layerResolve)
      • getBaseLayerSrcFileFromTypeName

        public SrcEntry getBaseLayerSrcFileFromTypeName​(java.lang.String typeName,
                                                        boolean srcOnly,
                                                        boolean prependPackage,
                                                        java.lang.String subPath,
                                                        IProcessDefinition proc,
                                                        boolean layerResolve)
      • getSrcFileFromTypeName

        public SrcEntry getSrcFileFromTypeName​(java.lang.String typeName,
                                               boolean srcOnly,
                                               boolean prependPackage,
                                               java.lang.String subPath,
                                               boolean layerResolve)
      • getAnnotationProcessor

        public IAnnotationProcessor getAnnotationProcessor​(java.lang.String annotName,
                                                           boolean checkBaseLayers)
      • getScopeProcessor

        public sc.lang.sc.IScopeProcessor getScopeProcessor​(java.lang.String annotName,
                                                            boolean checkBaseLayers)
      • getScopeAlias

        public java.lang.String getScopeAlias​(java.lang.String scopeName,
                                              boolean checkBaseLayers)
      • updateTypeIndex

        public void updateTypeIndex​(TypeIndexEntry typeIndexEntry,
                                    long lastModified)
      • getTypeIndexEntry

        public TypeIndexEntry getTypeIndexEntry​(java.lang.String typeName)
      • getBaseLayerDisabled

        public boolean getBaseLayerDisabled()
      • getDisabledLayerName

        public java.lang.String getDisabledLayerName()
        If getBaseLayerDisabled returns true, this method returns the name of the first layer it encounters which is disabled (for diagnostic purposes).
      • addBuildDirs

        public void addBuildDirs​(sc.layer.BuildState bd)
        Adds the top level src directories for
      • definesProperty

        public boolean definesProperty​(java.lang.String propName)
      • hasProperty

        public boolean hasProperty​(java.lang.String propName)
      • getProperty

        public java.lang.Object getProperty​(java.lang.String propName,
                                            boolean getField)
        Specified by:
        getProperty in interface IDynObject
      • getProperty

        public java.lang.Object getProperty​(int propIndex,
                                            boolean getField)
        Specified by:
        getProperty in interface IDynObject
      • getTypedProperty

        public <_TPROP> _TPROP getTypedProperty​(java.lang.String propName,
                                                java.lang.Class<_TPROP> propType)
        Specified by:
        getTypedProperty in interface IDynObject
      • addProperty

        public void addProperty​(java.lang.Object propType,
                                java.lang.String propName,
                                java.lang.Object initValue)
        Specified by:
        addProperty in interface IDynObject
      • setProperty

        public void setProperty​(java.lang.String propName,
                                java.lang.Object value,
                                boolean setField)
        Specified by:
        setProperty in interface IDynObject
      • setProperty

        public void setProperty​(int propIndex,
                                java.lang.Object value,
                                boolean setField)
        Specified by:
        setProperty in interface IDynObject
      • invoke

        public java.lang.Object invoke​(java.lang.String methodName,
                                       java.lang.String paramSig,
                                       java.lang.Object... args)
        Specified by:
        invoke in interface IDynObject
      • invoke

        public java.lang.Object invoke​(int methodIndex,
                                       java.lang.Object... args)
        Specified by:
        invoke in interface IDynObject
      • getDynType

        public java.lang.Object getDynType()
        Specified by:
        getDynType in interface IDynObject
      • setDynType

        public void setDynType​(java.lang.Object type)
        Specified by:
        setDynType in interface IDynObject
      • setHasSrc

        public void setHasSrc​(boolean val)
        Disable indexing of the layer's src directory
      • isInitialized

        public boolean isInitialized()
        A name remapping applied to all classes in this layer - so you can substitute one class for another. This remapping will also be applied to any derived layers import foo as bar might be the syntax to define this. public Map classSubstitutionMap;
        Specified by:
        isInitialized in interface ILifecycle
      • process

        public void process()
        Called right before the code processing phase starts - an opportunity for the layer to generate a build file
        Specified by:
        process in interface ILifecycle
      • init

        public void init()
        Specified by:
        init in interface ILifecycle
      • updateModel

        public boolean updateModel​(JavaModel newModel)
      • markExcluded

        public void markExcluded()
      • getBaseIsDynamic

        public static boolean getBaseIsDynamic​(java.util.List<Layer> baseLayers)
      • getInheritedPrefix

        public static boolean getInheritedPrefix​(java.util.List<Layer> baseLayers,
                                                 java.lang.String prefix,
                                                 JavaModel model)
      • ensureInitialized

        public void ensureInitialized​(boolean checkBaseLayers)
      • getDefaultBuildDir

        public java.lang.String getDefaultBuildDir()
      • getDefaultBuildSrcDir

        public java.lang.String getDefaultBuildSrcDir()
      • initBuildDir

        public void initBuildDir()
      • getBuildSrcSubDir

        public java.lang.String getBuildSrcSubDir()
      • getBuildClassesSubDir

        public java.lang.String getBuildClassesSubDir()
      • getBuildClassesDir

        public java.lang.String getBuildClassesDir()
      • setBuildClassesDir

        public void setBuildClassesDir​(java.lang.String oldBuildDir)
      • getLastModifiedTime

        public long getLastModifiedTime()
      • isBuildDirPath

        public static boolean isBuildDirPath​(java.lang.String dir)
      • info

        public void info​(java.lang.String... args)
      • error

        public void error​(java.lang.String... args)
      • warn

        public void warn​(java.lang.String... args)
      • verbose

        public void verbose​(java.lang.String... args)
      • reportMessage

        public void reportMessage​(MessageType type,
                                  java.lang.String... args)
      • addNewSrcFile

        public void addNewSrcFile​(SrcEntry srcEnt,
                                  boolean checkPeers)
      • removeSrcFile

        public void removeSrcFile​(SrcEntry srcEnt)
      • start

        public void start()
        Specified by:
        start in interface ILifecycle
      • startReplacingTypes

        public void startReplacingTypes​(java.lang.String modelTypeName)
      • ensureStarted

        public void ensureStarted​(boolean checkBaseLayers)
      • ensureValidated

        public void ensureValidated​(boolean checkBaseLayers)
      • ensureProcessed

        public void ensureProcessed​(boolean checkBaseLayers)
      • isBuildLayer

        public boolean isBuildLayer()
      • makeBuildLayer

        public void makeBuildLayer()
      • markBuildSrcFileInUse

        public boolean markBuildSrcFileInUse​(java.io.File genFile,
                                             java.lang.String genRelFileName)
      • cleanBuildSrcIndex

        public void cleanBuildSrcIndex()
      • saveBuildSrcIndex

        public void saveBuildSrcIndex()
      • initTypeIndex

        public void initTypeIndex()
      • removeFromTypeIndex

        public void removeFromTypeIndex()
      • saveTypeIndex

        public void saveTypeIndex()
      • updateFileIndexLastModified

        public void updateFileIndexLastModified()
      • markDynamicType

        public void markDynamicType​(java.lang.String typeName)
      • isDynamicType

        public boolean isDynamicType​(java.lang.String typeName)
      • getSortPriority

        public int getSortPriority()
      • saveDynTypeIndex

        public void saveDynTypeIndex()
      • stop

        public void stop()
        Specified by:
        stop in interface ILifecycle
      • getLayerPathName

        public java.lang.String getLayerPathName()
      • getLayerDefFilePath

        public java.lang.String getLayerDefFilePath()
      • getLayerName

        public java.lang.String getLayerName()
        The vanilla name of the layer - no package prefix but does include the layer group
      • getLayerGroupName

        public java.lang.String getLayerGroupName()
        Just the layer group
      • getLayerUniqueName

        public java.lang.String getLayerUniqueName()
      • getLayeredSystem

        public LayeredSystem getLayeredSystem()
        The layered system which owns this layer
      • getLayerPosition

        public int getLayerPosition()
      • checkIfStarted

        public boolean checkIfStarted()
      • findSrcFile

        public java.io.File findSrcFile​(java.lang.String srcName,
                                        boolean layerResolve)
      • getSrcEntry

        public SrcEntry getSrcEntry​(java.lang.String absFileName)
      • getTypeIndexEntryForPath

        public TypeIndexEntry getTypeIndexEntryForPath​(java.lang.String absFileName)
      • findSrcEntry

        public SrcEntry findSrcEntry​(java.lang.String srcName,
                                     boolean prependPackage,
                                     boolean layerResolve)
      • getSrcFiles

        public java.util.Iterator<java.lang.String> getSrcFiles()
      • getSrcEntries

        public java.util.Set<SrcEntry> getSrcEntries()
      • startAllTypes

        public boolean startAllTypes​(long startTime)
      • getSrcTypeNames

        public java.util.Set<java.lang.String> getSrcTypeNames​(boolean prependLayerPrefix,
                                                               boolean includeInnerTypes,
                                                               boolean restrictToLayer,
                                                               boolean includeImports)
      • getImportedTypeNames

        public java.util.Set<java.lang.String> getImportedTypeNames()
      • getInnerTypeNames

        public java.util.Set<java.lang.String> getInnerTypeNames​(java.lang.String relTypeName,
                                                                 java.lang.Object type,
                                                                 boolean restrictToLayer)
      • getLayersList

        public java.util.List<Layer> getLayersList()
      • getNextLayer

        public Layer getNextLayer()
        Returns the layer after this one in the list, i.e. the one that overrides this layer
      • getPreviousLayer

        public Layer getPreviousLayer()
        Returns the layer just before this one in the list, i.e. the one this layer overrides
      • getPreviousBuildLayer

        public Layer getPreviousBuildLayer()
      • getNextBuildLayer

        public Layer getNextBuildLayer()
      • getNextBuildLayer

        public Layer getNextBuildLayer​(Layer forLayer)
        Return the build layer for this layer - this layer if it's a buildLayer
      • getRelativeFile

        public java.lang.String getRelativeFile​(java.lang.String fileName)
        Returns a file name relative to the layer directory. This filename uses / as the file separator so it is platform independent
      • findClassFile

        public java.io.File findClassFile​(java.lang.String classFileName,
                                          boolean includePrevious)
        This method looks in the class path and find the file which defines this class (for dependency purposes). If it is a zip file, we can just return the zip file. We first look in the build directory.
      • findClassFile

        public java.io.File findClassFile​(java.lang.String classFileName,
                                          boolean includePrevious,
                                          boolean external)
      • getClass

        public java.lang.Object getClass​(java.lang.String classFileName,
                                         java.lang.String className)
      • getClass

        public java.lang.Object getClass​(java.lang.String classFileName,
                                         java.lang.String className,
                                         boolean external)
      • getCFClass

        public java.lang.Object getCFClass​(java.lang.String classFileName)
      • getCFClass

        public java.lang.Object getCFClass​(java.lang.String classFileName,
                                           boolean external)
      • getInnerCFClass

        public java.lang.Object getInnerCFClass​(java.lang.String fullTypeName,
                                                java.lang.String cfTypeName,
                                                java.lang.String name)
      • getImportDecl

        public ImportDeclaration getImportDecl​(java.lang.String name,
                                               boolean checkBaseLayers)
      • exportImportsTo

        public boolean exportImportsTo​(Layer refLayer)
      • findMatchingSrcNames

        public boolean findMatchingSrcNames​(java.lang.String prefix,
                                            java.util.Set<java.lang.String> candidates,
                                            boolean retFullTypeName,
                                            int max)
      • findMatchingGlobalNames

        public boolean findMatchingGlobalNames​(java.lang.String prefix,
                                               java.util.Set<java.lang.String> candidates,
                                               boolean retFullTypeName,
                                               boolean checkBaseLayers,
                                               int max)
      • getPackagePath

        public java.lang.String getPackagePath()
      • skipStart

        public boolean skipStart​(java.lang.String fileName,
                                 java.lang.String prefix)
      • excludedFile

        public boolean excludedFile​(java.lang.String fileName,
                                    java.lang.String prefix)
      • setLayerUniqueName

        public void setLayerUniqueName​(java.lang.String s)
      • getLayerTypeName

        public java.lang.String getLayerTypeName()
      • getLayerModelTypeName

        public java.lang.String getLayerModelTypeName()
        Returns the type name of the layer's definition file. This is just the package prefix plus the name of the layer
      • getStaticImportedType

        public java.lang.Object getStaticImportedType​(java.lang.String name)
        Note, this returns the type containing the statically imported name, not the field or method.
      • getClassInputStream

        public java.io.InputStream getClassInputStream​(java.lang.String classPathName)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • saveLayer

        public void saveLayer()
      • initModel

        public void initModel()
      • refreshDir

        public void refreshDir​(java.lang.String srcDir,
                               java.lang.String relDir,
                               long lastRefreshTime,
                               ExecutionContext ctx,
                               java.util.List<Layer.ModelUpdate> changedModels,
                               UpdateInstanceInfo updateInfo,
                               boolean active,
                               java.lang.String srcRootName)
      • addSrcFileIndex

        public void addSrcFileIndex​(java.lang.String relFileName,
                                    byte[] hash,
                                    java.lang.String ext,
                                    java.lang.String absFileName)
        Register the source file in any build layers including or following this one
      • getPrevSrcFileIndex

        public SrcIndexEntry getPrevSrcFileIndex​(java.lang.String relFileName)
      • getPrevSrcFileLayer

        public Layer getPrevSrcFileLayer​(java.lang.String relFileName)
      • getSrcFileIndex

        public SrcIndexEntry getSrcFileIndex​(java.lang.String relFileName)
      • extendsLayer

        public boolean extendsLayer​(Layer other)
        Does this layer have an explicit extends on the other layer
      • extendsOrIsLayer

        public boolean extendsOrIsLayer​(Layer other)
      • extendsReplacedLayer

        public boolean extendsReplacedLayer​(Layer other)
        Does this layer extend any layers which replaced features of layers we do extend
      • modifiedByLayer

        public boolean modifiedByLayer​(Layer other)
        Does this layer modify any types which are in the other layer.
      • modifiesPackage

        public boolean modifiesPackage​(java.lang.String pkg)
      • setDependentLayers

        public void setDependentLayers​(java.util.List<Layer> layers)
        This property is not settable but this is needed to suppress a bogus error when we are sync'ing this property to the client. If we don't get the js specific source for this class we do not find the setDependentLayers method and get an error parsing. We don't want to load the source for performance reasons.
      • getUsedByLayers

        public java.util.List<Layer> getUsedByLayers()
        Returns the set of layers which extend this layer in the same order as they originally appeared in the list
      • getUsedByLayerNames

        public java.util.List<java.lang.String> getUsedByLayerNames()
        Returns the set of layers which extend this layer in the same order as they originally appeared in the list
      • getBuildAllFiles

        public boolean getBuildAllFiles()
      • saveBuildInfo

        public void saveBuildInfo​(boolean writeBuildSrcIndex)
      • matchesFilter

        public boolean matchesFilter​(java.util.Collection<CodeType> codeTypes)
      • updateBuildInProgress

        public void updateBuildInProgress​(boolean start)
        Called for a build layer before the first phase with true and after the last phase with false. Decides whether the build was interrupted or not.
      • transparentToLayer

        public boolean transparentToLayer​(Layer other,
                                          int mergeLayersCt)
      • getTransparentLayers

        public java.util.List<Layer> getTransparentLayers()
        Returns the set of layers which are transparent onto this layer. This is fairly brute force and obviously could be sped up a lot by just pre-computing the list
      • getSelectedLayers

        public java.util.List<Layer> getSelectedLayers()
      • getVisibleInEditor

        public boolean getVisibleInEditor()
        To be visible in the editor, we cannot be extended only from hidden layers. We need at least one visible, non-hidden layer to extend this layer
      • isSpecifiedLayer

        public boolean isSpecifiedLayer()
        Is this a layer which was specified by the user (true) or a layer which was dragged in by a dependency (false)
      • initSync

        public void initSync()
      • toDetailString

        public java.lang.String toDetailString()
      • getCompiledFinalLayer

        public boolean getCompiledFinalLayer()
      • getRepositoryPackage

        public RepositoryPackage getRepositoryPackage​(java.lang.String pkgName)
      • addRepositoryPackage

        public RepositoryPackage addRepositoryPackage​(java.lang.String url)
      • installPackage

        public void installPackage​(java.lang.String url)
      • installPackages

        public void installPackages​(java.lang.String[] urlList)
      • addRepositoryPackage

        public RepositoryPackage addRepositoryPackage​(java.lang.String pkgName,
                                                      java.lang.String repositoryTypeName,
                                                      java.lang.String url,
                                                      boolean unzip,
                                                      boolean unwrapZip)
      • addRepositoryPackage

        public RepositoryPackage addRepositoryPackage​(java.lang.String pkgName,
                                                      java.lang.String fileName,
                                                      java.lang.String repositoryTypeName,
                                                      java.lang.String url,
                                                      boolean unzip,
                                                      boolean unwrapZip)
        Adds this repository package to the system for the current layer. Often called from the layer's start method so it registers the package with the layer. The package is installed right before the start method returns. If this method is called from the initialize method, downstream layers have a chance to modify the package before it's installed - right before the start method of the layer is called.
      • getSrcFileFromRelativeTypeName

        public SrcEntry getSrcFileFromRelativeTypeName​(java.lang.String relDir,
                                                       java.lang.String subPath,
                                                       java.lang.String pkgPrefix,
                                                       boolean srcOnly,
                                                       boolean checkBaseLayers,
                                                       boolean layerResolve)
      • getUnderscoreName

        public java.lang.String getUnderscoreName()
      • getLayerNameFromUniqueUnderscoreName

        public static java.lang.String getLayerNameFromUniqueUnderscoreName​(java.lang.String uname)
      • getUniqueUnderscoreName

        public static java.lang.String getUniqueUnderscoreName​(java.lang.String layerName)
      • registerAnnotationProcessor

        public void registerAnnotationProcessor​(java.lang.String annotationTypeName,
                                                IAnnotationProcessor processor)
      • registerScopeProcessor

        public void registerScopeProcessor​(java.lang.String scopeName,
                                           sc.lang.sc.IScopeProcessor processor)
        When encountering scope<name> in the code as an annotation for a type, the IScopeProcessor will allow the framework developer the ability to customize how the getX, setX, methods of the object or property are generated. You can inject additional interfaces and fields into the type. Additional parameters to the constructor which are obtained in the current context in which this scope is valid. Scopes let you flexibly separate the names from how they are implemented in code - supporting iteration and other advanced constructs at both the runtime and compile time contexts.
      • registerScopeAlias

        public void registerScopeAlias​(java.lang.String newScopeName,
                                       java.lang.String aliasedToName)
      • registerFileProcessor

        public void registerFileProcessor​(IFileProcessor proc,
                                          java.lang.String ext)
      • registerLanguage

        public void registerLanguage​(Language lang,
                                     java.lang.String ext)
      • getScopeNames

        public java.lang.String getScopeNames()
      • initAllTypeIndex

        public boolean initAllTypeIndex​(long startTime)
      • hasDefinitionForType

        public boolean hasDefinitionForType​(java.lang.String typeName)
      • getSrcEntryForType

        public SrcEntry getSrcEntryForType​(java.lang.String typeName)
      • disableLayer

        public void disableLayer()
      • destroyLayer

        public void destroyLayer()
      • addSrcPath

        public void addSrcPath​(java.lang.String srcPath,
                               java.lang.String srcPathType)
        Called from within a layer definition file to associate a SrcPathType (e.g. web, or resource) with a given layer directory.
      • setPathTypeBuildPrefix

        public void setPathTypeBuildPrefix​(java.lang.String pathTypeName,
                                           java.lang.String buildPrefix)
      • addSrcPath

        public void addSrcPath​(java.lang.String srcPath,
                               java.lang.String srcPathType,
                               java.lang.String buildPrefix,
                               java.lang.String fromPathType)
        Adds a new src directory to be searched for source files to an existing srcPathType or optionally creates a new srcPathType when called with a srcPathType, buildPrefix, and fromPathType. The srcPathType is a name that defines rules for processing src files in paths of that type. For example for src files in the web directory, the srcPathType is 'web'. If you want your files to be treated as ordinary source files like Java files using the default build dir use null for the srcPathType. Each srcPathType has an optional buildPrefix - prepended onto the path name of the file, relative to the srcPath directory. Specify a fromPathType to inherit the processors from a previous type, but to set a new buildPrefix for a given srcPath directory.
      • getSrcPathTypeName

        public java.lang.String getSrcPathTypeName​(java.lang.String fileName,
                                                   boolean abs)
      • getSrcPathBuildPrefix

        public java.lang.String getSrcPathBuildPrefix​(java.lang.String pathTypeName)
      • getSrcPathTypeByName

        public sc.layer.Layer.SrcPathType getSrcPathTypeByName​(java.lang.String pathTypeName,
                                                               boolean buildPrefix)
      • getSrcPathType

        public sc.layer.Layer.SrcPathType getSrcPathType​(java.lang.String fileName,
                                                         boolean abs)
      • getSrcPathTypeName

        public java.lang.String getSrcPathTypeName​(SrcEntry srcEnt)
      • addClassPathEntry

        public void addClassPathEntry​(java.lang.String entry)
      • hasClassPathEntry

        public boolean hasClassPathEntry​(java.lang.String entry)
      • markClosed

        public void markClosed​(boolean val,
                               boolean closePeers)
      • fileRenamed

        public void fileRenamed​(SrcEntry oldFile,
                                SrcEntry newFile)
      • addTypeGroupDependency

        public void addTypeGroupDependency​(java.lang.String relFileName,
                                           java.lang.String typeName,
                                           java.lang.String typeGroupName)
      • addErrorFile

        public void addErrorFile​(SrcEntry srcEnt)
        In case there's a file which generates an error that's not part of the project - i.e. gets included via a src-path entry like scrt-core-src.jar for Javascript code gen, we still need to report that file as one having a syntax error
      • getLayerProperty

        public java.lang.String getLayerProperty​(java.lang.String propertiesFile,
                                                 java.lang.String propName)
        Called with propertiesFile="build" to return propName in the layer path build.properties. Returns the layer property of any layer under this one in the stack. Note that this searches all layers, not just base layers because we only use it now for 'build properties' that need to do a merge of everything. In some cases, we only use baseLayers because of the desire for 'static typing' and support of resolution in the IDE where there is no build layer.
      • getProperty

        public java.lang.String getProperty​(java.lang.String propertiesFile,
                                            java.lang.String propName)
      • findSrcFileNameFromRelName

        public java.lang.String findSrcFileNameFromRelName​(java.lang.String relName)
      • getLayerFileFromRelName

        public SrcEntry getLayerFileFromRelName​(java.lang.String relName,
                                                boolean checkBaseLayers,
                                                boolean byPosition)
      • getBaseLayerFileFromRelName

        public SrcEntry getBaseLayerFileFromRelName​(java.lang.String relName,
                                                    boolean byPosition)
      • getSubLayerFileFromRelName

        public SrcEntry getSubLayerFileFromRelName​(java.lang.String relName,
                                                   boolean byPosition)
      • checkRemovedDirectory

        public boolean checkRemovedDirectory​(java.lang.String dirPath)
      • removeSrcDir

        public void removeSrcDir​(java.lang.String srcDir,
                                 java.util.List<Layer.ModelUpdate> changedModels)
      • appendDetailString

        public boolean appendDetailString​(java.lang.StringBuilder sb,
                                          boolean first,
                                          boolean details,
                                          boolean runtime,
                                          boolean sync)
        Used by both the command line and layers view to append a description for the layer based on what you are interested in
      • getDefaultDataSource

        public DBDataSource getDefaultDataSource()