Class Workspace

    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • BND_DEFAULT_WS

        public static final java.io.File BND_DEFAULT_WS
      • BND_CACHE_REPONAME

        public static final java.lang.String BND_CACHE_REPONAME
        See Also:
        Constant Field Values
      • CACHEDIR

        public static final java.lang.String CACHEDIR
      • STANDALONE_REPO_CLASS

        public static final java.lang.String STANDALONE_REPO_CLASS
        See Also:
        Constant Field Values
      • PLUGIN_STANDALONE

        private static final java.lang.String PLUGIN_STANDALONE
        See Also:
        Constant Field Values
      • cache

        private static final java.util.Map<java.io.File,​java.lang.ref.WeakReference<Workspace>> cache
      • commands

        final java.util.Map<java.lang.String,​Action> commands
      • maven

        final Maven maven
      • offline

        private final java.util.concurrent.atomic.AtomicBoolean offline
      • overallDriver

        static java.lang.String overallDriver
      • overallGestalt

        static Parameters overallGestalt
      • signalBusy

        final java.lang.ThreadLocal<Reporter> signalBusy
        Signal a BndListener plugin. We ran an infinite bug loop :-(
      • driver

        private java.lang.String driver
      • trail

        final java.util.Set<Project> trail
      • buildDir

        private java.io.File buildDir
      • lock

        private final java.util.concurrent.locks.ReadWriteLock lock
      • remoteWorkspaces

        public static boolean remoteWorkspaces
      • defaultConstructor

        private static final java.lang.invoke.MethodType defaultConstructor
      • ESCAPE_P

        private static final java.util.regex.Pattern ESCAPE_P
      • _projectswhereHelp

        static final java.lang.String _projectswhereHelp
        Provide a macro that lists all currently loaded project names that match a macro. This macro checks for cycles since I am not sure if calling getAllProjects is safe for some macros in all cases. I.e. the primary use case wants to use it in -dependson
              ${projectswhere;key;glob}
         
        See Also:
        Constant Field Values
      • projectswhereCycleCheck

        private static final java.lang.ThreadLocal<java.lang.Boolean> projectswhereCycleCheck
    • Constructor Detail

      • Workspace

        public Workspace​(java.io.File workspaceDir)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • Workspace

        public Workspace​(java.io.File workspaceDir,
                         java.lang.String bndDir)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • Workspace

        private Workspace​(WorkspaceLayout layout)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • getProject

        public static Project getProject​(java.io.File projectDir)
                                  throws java.lang.Exception
        This static method finds the workspace and creates a project (or returns an existing project)
        Parameters:
        projectDir -
        Throws:
        java.lang.Exception
      • getDefaults

        public static Processor getDefaults()
      • createDefaultWorkspace

        public static Workspace createDefaultWorkspace()
                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWorkspace

        public static Workspace getWorkspace​(java.io.File workspaceDir)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWorkspaceWithoutException

        public static Workspace getWorkspaceWithoutException​(java.io.File workspaceDir)
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • findWorkspace

        public static Workspace findWorkspace​(java.io.File base)
                                       throws java.lang.Exception
        /* Return the nearest workspace
        Throws:
        java.lang.Exception
      • getWorkspace

        public static Workspace getWorkspace​(java.io.File workspaceDir,
                                             java.lang.String bndDir)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setFileSystem

        public void setFileSystem​(java.io.File workspaceDir,
                                  java.lang.String bndDir)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getProjectFromFile

        public Project getProjectFromFile​(java.io.File projectDir)
      • getProject

        public Project getProject​(java.lang.String bsn)
      • isPresent

        public boolean isPresent​(java.lang.String name)
      • getCurrentProjects

        public java.util.Collection<Project> getCurrentProjects()
      • refreshProjects

        public void refreshProjects()
        Signal that the driver has detected a dynamic change in the workspace directory, for example a project was added or removed in the IDE. Since this does not affect the inherited properties we can only change the list of projects.
      • _workspace

        public java.lang.String _workspace​(java.lang.String[] args)
      • addCommand

        public void addCommand​(java.lang.String menu,
                               Action action)
      • removeCommand

        public void removeCommand​(java.lang.String menu)
      • fillActions

        public void fillActions​(java.util.Map<java.lang.String,​Action> all)
      • getAllProjects

        public java.util.Collection<Project> getAllProjects()
      • changedFile

        public void changedFile​(java.io.File f)
        Inform any listeners that we changed a file (created/deleted/changed).
        Parameters:
        f - The changed file
      • bracket

        public void bracket​(boolean begin)
      • signal

        public void signal​(Reporter reporter)
      • syncCache

        public void syncCache()
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getRepositories

        public java.util.List<RepositoryPlugin> getRepositories()
                                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getBuildOrder

        public java.util.Collection<Project> getBuildOrder()
                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getBuildOrder

        private void getBuildOrder​(java.util.Collection<Project> dependsOn,
                                   java.util.Set<Project> result)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWorkspace

        public static Workspace getWorkspace​(java.lang.String path)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getMaven

        public Maven getMaven()
      • setTypeSpecificPlugins

        protected void setTypeSpecificPlugins​(java.util.Set<java.lang.Object> list)
        Overrides:
        setTypeSpecificPlugins in class Processor
      • addExtensions

        protected void addExtensions​(java.util.Set<java.lang.Object> list)
        Add any extensions listed
        Overrides:
        addExtensions in class Processor
        Parameters:
        list -
      • isOffline

        public boolean isOffline()
      • getOffline

        public java.util.concurrent.atomic.AtomicBoolean getOffline()
      • setOffline

        public Workspace setOffline​(boolean on)
      • _global

        public java.lang.String _global​(java.lang.String[] args)
                                 throws java.lang.Exception
        Provide access to the global settings of this machine.
        Throws:
        java.lang.Exception
      • _user

        public java.lang.String _user​(java.lang.String[] args)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _repodigests

        public java.lang.Object _repodigests​(java.lang.String[] args)
                                      throws java.lang.Exception
        Return the repository signature digests. These digests are a unique id for the contents of the repository
        Throws:
        java.lang.Exception
      • getRun

        public static Run getRun​(java.io.File file)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • report

        public void report​(java.util.Map<java.lang.String,​java.lang.Object> table)
                    throws java.lang.Exception
        Report details of this workspace
        Overrides:
        report in class Processor
        Throws:
        java.lang.Exception
      • getCache

        public java.io.File getCache​(java.lang.String name)
      • getWorkspaceRepository

        public WorkspaceRepository getWorkspaceRepository()
        Return the workspace repo
      • checkStructure

        public void checkStructure()
      • getBuildDir

        public java.io.File getBuildDir()
      • setBuildDir

        public void setBuildDir​(java.io.File buildDir)
      • isValid

        public boolean isValid()
      • getRepository

        public RepositoryPlugin getRepository​(java.lang.String repo)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class Processor
      • getDriver

        public java.lang.String getDriver()
        Get the bnddriver, can be null if not set. The overallDriver is the environment that runs this bnd.
      • setDriver

        public static void setDriver​(java.lang.String driver)
        Set the driver of this environment
      • _driver

        public java.lang.String _driver​(java.lang.String[] args)
        Macro to return the driver. Without any arguments, we return the name of the driver. If there are arguments, we check each of the arguments against the name of the driver. If it matches, we return the driver name. If none of the args match the driver name we return an empty string (which is false).
      • addGestalt

        public static void addGestalt​(java.lang.String part,
                                      Attrs attrs)
        Add a gestalt to all workspaces. The gestalt is a set of parts describing the environment. Each part has a name and optionally attributes. This method adds a gestalt to the VM. Per workspace it is possible to augment this.
      • getGestalt

        public Attrs getGestalt​(java.lang.String part)
        Get the attrs for a gestalt part
      • getGestalt

        public Parameters getGestalt()
        Get the attrs for a gestalt part
      • getLayout

        public WorkspaceLayout getLayout()
        Get the layout style of the workspace.
      • _gestalt

        public java.lang.String _gestalt​(java.lang.String[] args)
        The macro to access the gestalt

        $ gestalt;part[;key[;value]]

      • toString

        public java.lang.String toString()
        Description copied from class: Processor
        Printout of the status of this processor for toString()
        Overrides:
        toString in class Processor
      • addPlugin

        public boolean addPlugin​(java.lang.Class<?> plugin,
                                 java.lang.String alias,
                                 java.util.Map<java.lang.String,​java.lang.String> parameters,
                                 boolean force)
                          throws java.lang.Exception
        Add a plugin
        Parameters:
        plugin -
        Throws:
        java.lang.Exception
      • newInstance

        private static <T> T newInstance​(java.lang.Class<T> rawClass)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • escaped

        private java.lang.Object escaped​(java.lang.String value)
      • removePlugin

        public boolean removePlugin​(java.lang.String alias)
      • createStandaloneWorkspace

        public static Workspace createStandaloneWorkspace​(Processor run,
                                                          java.net.URI base)
                                                   throws java.lang.Exception
        Create a workspace that does not inherit from a cnf directory etc.
        Parameters:
        run -
        Throws:
        java.lang.Exception
      • isDefaultWorkspace

        public boolean isDefaultWorkspace()
      • isInteractive

        public boolean isInteractive()
        Description copied from class: Processor
        Return if this is an interactive environment like Eclipse or runs in batch mode. If interactive, things can get refreshed.
        Overrides:
        isInteractive in class Processor
      • resetStatic

        public static void resetStatic()
      • createProject

        public Project createProject​(java.lang.String name)
                              throws java.lang.Exception
        Create a project in this workspace
        Throws:
        java.lang.Exception
      • removeProject

        void removeProject​(Project p)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createWorkspace

        public static Workspace createWorkspace​(java.io.File wsdir)
                                         throws java.lang.Exception
        Create a new Workspace
        Parameters:
        wsdir -
        Throws:
        java.lang.Exception
      • readLocked

        public <T> T readLocked​(java.util.concurrent.Callable<T> r,
                                long timeoutInMs)
                         throws java.lang.Exception
        Lock the workspace and its corresponding projects for reading. The r parameter when called can freely use any read function in the workspace.
        Parameters:
        r - the lambda to run
        timeoutInMs - the timeout in milliseconds
        Returns:
        the value of the lambda
        Throws:
        java.lang.Exception
      • readLocked

        public <T> T readLocked​(java.util.concurrent.Callable<T> r)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • writeLocked

        public <T> T writeLocked​(java.util.concurrent.Callable<T> r,
                                 long timeoutInMs)
                          throws java.lang.Exception
        Lock the workspace and its corresponding projects for all functions. The r parameter when called can freely use any function in the workspace.
        Parameters:
        r - the lambda to run
        timeoutInMs - the timeout in milliseconds
        Returns:
        the value of the lambda
        Throws:
        java.lang.Exception
      • writeLocked

        public <T> T writeLocked​(java.util.concurrent.Callable<T> r)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • locked

        <T> T locked​(java.util.concurrent.Callable<T> r,
                     long timeoutInMs,
                     java.util.concurrent.locks.Lock readLock)
              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _projectswhere

        public java.lang.String _projectswhere​(java.lang.String[] args)