Class BndEditModel

java.lang.Object
aQute.bnd.build.model.BndEditModel

public class BndEditModel extends Object
A model for a Bnd file.

The bndedit model maintains a Properties that can be modified/added with convenient semantic methods and/or properties can be deleted. The bnd file tends to be kept in a Processor, and the processors are kept in a inheritance chain. The BndEditModel can provide a Processor that extends the original but reflects the changes made in the inheritance model.

  • Field Details

  • Constructor Details

    • BndEditModel

      public BndEditModel()
      Default constructor
    • BndEditModel

      public BndEditModel(BndEditModel model)
      Copy constructor
      Parameters:
      model - the source
    • BndEditModel

      public BndEditModel(BndEditModel model, boolean effective)
      Copy constructor with an override for effective
      Parameters:
      model -
      effective -
    • BndEditModel

      public BndEditModel(Workspace workspace)
    • BndEditModel

      public BndEditModel(IDocument document) throws IOException
      Throws:
      IOException
    • BndEditModel

      public BndEditModel(Workspace workspace, Processor processor) throws IOException
      Throws:
      IOException
    • BndEditModel

      public BndEditModel(Project domain) throws IOException
      Throws:
      IOException
  • Method Details

    • loadFrom

      public void loadFrom(IDocument document) throws IOException
      Throws:
      IOException
    • toEscaped

      public InputStream toEscaped(String text) throws IOException
      Throws:
      IOException
    • toAsciiStream

      public InputStream toAsciiStream(IDocument doc) throws IOException
      Throws:
      IOException
    • loadFrom

      public void loadFrom(File file) throws IOException
      Throws:
      IOException
    • loadFrom

      public void loadFrom(InputStream inputStream) throws IOException
      Throws:
      IOException
    • loadFrom

      public void loadFrom(String string) throws IOException
      Throws:
      IOException
    • saveChangesTo

      public void saveChangesTo(IDocument document)
    • getAllPropertyNames

      public List<String> getAllPropertyNames()
    • lookupConverter

      public Converter<Object,String> lookupConverter(String propertyName)
    • lookupFormatter

      public Converter<String,Object> lookupFormatter(String propertyName)
    • genericGet

      public Object genericGet(String propertyName)
    • genericSet

      public void genericSet(String propertyName, Object value)
    • getBundleLicense

      public String getBundleLicense()
    • setBundleLicense

      public void setBundleLicense(String bundleLicense)
    • getBundleCategory

      public String getBundleCategory()
    • setBundleCategory

      public void setBundleCategory(String bundleCategory)
    • getBundleName

      public String getBundleName()
    • setBundleName

      public void setBundleName(String bundleName)
    • getBundleDescription

      public String getBundleDescription()
    • setBundleDescription

      public void setBundleDescription(String bundleDescription)
    • getBundleCopyright

      public String getBundleCopyright()
    • setBundleCopyright

      public void setBundleCopyright(String bundleCopyright)
    • getBundleUpdateLocation

      public String getBundleUpdateLocation()
    • setBundleUpdateLocation

      public void setBundleUpdateLocation(String bundleUpdateLocation)
    • getBundleVendor

      public String getBundleVendor()
    • setBundleVendor

      public void setBundleVendor(String bundleVendor)
    • getBundleContactAddress

      public String getBundleContactAddress()
    • setBundleContactAddress

      public void setBundleContactAddress(String bundleContactAddress)
    • getBundleDocUrl

      public String getBundleDocUrl()
    • setBundleDocUrl

      public void setBundleDocUrl(String bundleDocUrl)
    • getBundleSymbolicName

      public String getBundleSymbolicName()
    • setBundleSymbolicName

      public void setBundleSymbolicName(String bundleSymbolicName)
    • getBundleVersionString

      public String getBundleVersionString()
    • setBundleVersion

      public void setBundleVersion(String bundleVersion)
    • getBundleActivator

      public String getBundleActivator()
    • setBundleActivator

      public void setBundleActivator(String bundleActivator)
    • getOutputFile

      public String getOutputFile()
    • setOutputFile

      public void setOutputFile(String name)
    • isIncludeSources

      public boolean isIncludeSources()
    • setIncludeSources

      public void setIncludeSources(boolean includeSources)
    • getPrivatePackages

      public List<String> getPrivatePackages()
    • setPrivatePackages

      public void setPrivatePackages(List<String> newPackages)
    • addPrivatePackage

      public void addPrivatePackage(String packageName)
    • getSystemPackages

      public List<ExportedPackage> getSystemPackages()
    • setSystemPackages

      public void setSystemPackages(List<? extends ExportedPackage> packages)
    • getClassPath

      public List<String> getClassPath()
    • setClassPath

      public void setClassPath(List<? extends String> classPath)
    • getExportedPackages

      public List<ExportedPackage> getExportedPackages()
    • setExportedPackages

      public void setExportedPackages(List<? extends ExportedPackage> exports)
    • addExportedPackage

      public void addExportedPackage(ExportedPackage export)
    • getDSAnnotationPatterns

      public List<String> getDSAnnotationPatterns()
    • setDSAnnotationPatterns

      public void setDSAnnotationPatterns(List<? extends String> patterns)
    • getServiceComponents

      public List<ServiceComponent> getServiceComponents()
    • setServiceComponents

      public void setServiceComponents(List<? extends ServiceComponent> components)
    • getImportPatterns

      public List<ImportPattern> getImportPatterns()
    • setImportPatterns

      public void setImportPatterns(List<? extends ImportPattern> patterns)
    • getBuildPath

      public List<VersionedClause> getBuildPath()
    • getTestPath

      public List<VersionedClause> getTestPath()
    • setBuildPath

      public void setBuildPath(List<? extends VersionedClause> paths)
    • addPath

      public void addPath(VersionedClause versionedClause, String header)
    • addPath

      public void addPath(BundleId bundleId, String header)
    • setTestPath

      public void setTestPath(List<? extends VersionedClause> paths)
    • getRunBundles

      public List<VersionedClause> getRunBundles()
    • setRunBundles

      public void setRunBundles(List<? extends VersionedClause> paths)
    • getRunBundlesDecorator

      public List<VersionedClause> getRunBundlesDecorator()
    • setRunBundlesDecorator

      public void setRunBundlesDecorator(List<? extends VersionedClause> paths)
    • isIncludedPackage

      public boolean isIncludedPackage(String packageName)
    • getSubBndFiles

      public List<String> getSubBndFiles()
    • setSubBndFiles

      public void setSubBndFiles(List<String> subBndFiles)
    • getRunProperties

      public Map<String,String> getRunProperties()
    • setRunProperties

      public void setRunProperties(Map<String,String> props)
    • getRunVMArgs

      public String getRunVMArgs()
    • setRunVMArgs

      public void setRunVMArgs(String args)
    • getRunProgramArgs

      public String getRunProgramArgs()
    • setRunProgramArgs

      public void setRunProgramArgs(String args)
    • getTestSuites

      public List<String> getTestSuites()
    • setTestSuites

      public void setTestSuites(List<String> suites)
    • getPlugins

      public List<HeaderClause> getPlugins()
    • setPlugins

      public void setPlugins(List<HeaderClause> plugins)
    • getPluginsProperties

      public Map<String, List<BndEditModelHeaderClause>> getPluginsProperties()
      Similar to getPlugins() but returns a map where the key is the property key of the bnd file e.g. -plugin.1.Test, -plugin.2.Maven The value is a List of plugins, although usually it is just a 1-element list. But it is also possible to specify multiple plugins under a single key, thus it is a list.
      Returns:
      a map with a property keys and their plugins ( macros like (${.}) are returned not expanded)
    • setPlugins

      public void setPlugins(Map<String, List<BndEditModelHeaderClause>> plugins, Collection<String> pluginPropKeysToRemove)
      Updates and removes plugins (macros like (${.}) are not expanded).
      Parameters:
      plugins -
      pluginPropKeysToRemove - the property keys to remove (not modified, caller needs to handle cleanup)
    • getPluginPath

      public List<String> getPluginPath()
    • setPluginPath

      public void setPluginPath(List<String> pluginPath)
    • getDistro

      public List<String> getDistro()
    • setDistro

      public void setDistro(List<String> distros)
    • getRunRepos

      public List<String> getRunRepos()
    • setRunRepos

      public void setRunRepos(List<String> repos)
    • getRunFramework

      public String getRunFramework()
    • getRunFw

      public String getRunFw()
    • getEE

      public EE getEE()
    • setEE

      public void setEE(EE ee)
    • setRunFramework

      public void setRunFramework(String clause)
    • setRunFw

      public void setRunFw(String clause)
    • getRunRequires

      public List<org.osgi.resource.Requirement> getRunRequires()
    • setRunRequires

      public void setRunRequires(List<org.osgi.resource.Requirement> requires)
    • getRunBlacklist

      public List<org.osgi.resource.Requirement> getRunBlacklist()
    • setRunBlacklist

      public void setRunBlacklist(List<org.osgi.resource.Requirement> requires)
    • getStandaloneLinks

      public List<HeaderClause> getStandaloneLinks()
    • setStandaloneLinks

      public void setStandaloneLinks(List<HeaderClause> headers)
    • getIgnoreStandalone

      public List<HeaderClause> getIgnoreStandalone()
    • setIgnoreStandalone

      public void setIgnoreStandalone(List<HeaderClause> headers)
    • isProjectFile

      public boolean isProjectFile()
    • isBndrun

      public boolean isBndrun()
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
    • setBndResource

      public void setBndResource(File bndResource)
    • getBndResource

      public File getBndResource()
    • getBndResourceName

      public String getBndResourceName()
    • setBndResourceName

      public void setBndResourceName(String bndResourceName)
    • getBundleBlueprint

      public List<HeaderClause> getBundleBlueprint()
    • setBundleBlueprint

      public void setBundleBlueprint(List<HeaderClause> bundleBlueprint)
    • addBundleBlueprint

      public void addBundleBlueprint(String location)
    • getIncludeResource

      public List<String> getIncludeResource()
    • setIncludeResource

      @Deprecated public void setIncludeResource(List<String> newEntries)
      Deprecated.
    • addIncludeResource

      public void addIncludeResource(String resource)
    • getProject

      public Project getProject()
    • getWorkspace

      public Workspace getWorkspace()
    • setWorkspace

      public void setWorkspace(Workspace workspace)
    • getGenericString

      public String getGenericString(String name)
    • setGenericString

      public void setGenericString(String name, String value)
    • getProperties

      public Processor getProperties() throws Exception
      Return a processor for this model. This processor is based on the properties of the source processor but with the values of the changed properties in this edit model. I.e. the view of the returned processor of the properties is the same as when this model would be saved.

      The returned processor will use the owner of this model as the parent so that all unchanged properties come from the original owner.

      When using this method, realize that if you edit a project's bnd.bnd file, the returned processor adds an intermediate layer. The owner is the original Workspace, Project, Bndrun, or sub bnd object.

      Returns:
      a processor that reflects the actual processors setup
      Throws:
      Exception
    • getDocumentChanges

      public Map<String,String> getDocumentChanges()
      Return the saved changes in document format.
    • saveChanges

      public void saveChanges() throws IOException
      If this BndEditModel was created with a project then this method will save the changes in the document and will store them in the associated file.
      Throws:
      IOException
    • store

      public static void store(IDocument document, File file) throws IOException
      Throws:
      IOException
    • getResolveMode

      public ResolutionInstructions.ResolveMode getResolveMode()
    • setResolveMode

      public void setResolveMode(ResolutionInstructions.ResolveMode resolveMode)
    • isDirty

      public boolean isDirty()
      Returns:
      true if there is a discrepancy between the project's file and the document
    • setDirty

      public void setDirty(boolean isDirty)
    • load

      public void load() throws IOException
      Throws:
      IOException
    • isCnf

      @Deprecated public boolean isCnf()
      Deprecated.
      If this is on the cnf project
      Returns:
      true if it is the cnf project
    • format

      public static <T> String format(String header, String input)
      Use the built in formatters to take an unformatted header and turn it into a formatted header useful in the editor, for example escaped newlines.
      Type Parameters:
      T - the intermediate type, doesn't matter
      Parameters:
      header - the name of the instruction
      input - the source string
      Returns:
      the input or a formatted input if there is converter
    • getStem

      public static String getStem(String header)
    • add

      public <T extends Collection<Object>> String add(String header, String toAdd)
    • getLastChangedAt

      public long getLastChangedAt()
    • setOwner

      public void setOwner(Processor p)
    • getOwner

      public Processor getOwner()
    • getOwner

      public <T> Optional<T> getOwner(Class<T> class1)
    • setProject

      @Deprecated public void setProject(Project project)
      Deprecated.
    • getDocumentProperties

      public Properties getDocumentProperties()
      Return the document properties
    • isEffective

      public boolean isEffective()
      Return if this model is handling effective properties (and this read only) or actual document properties.