public class ComponentPersistence extends Object
 components/
     component1.xml
     component2.xml
     ...
     bundle_symbolicName1/
         component1.xml
         component2.xml
         ...
     bundle_symbolicName1/
         ...
     ...
 
 If components are put directly under the root then they will be deployed in the runtime bundle context. If they are
 put in a directory having as name the symbolicName of a bundle in the system, then the component will be deployed in
 that bundle context.
 Any files not ending with .xml are ignored. Any directory that doesn't match a bundle symbolic name will be ignored too.
Dynamic components must use the following name convention: (it is not mandatory but it is recommended)
components/mycomp1.xml and
 components/mybundle/mycomp2.xml the name for mycomp1 must be: comp1 and for
 mycomp2 must be mybundle/mycomp2
 
 This service is working only with OSGiRuntimeService
| Modifier and Type | Field and Description | 
|---|---|
protected ReadWriteLock | 
fileLock  | 
protected Set<RegistrationInfo> | 
persistedComponents  | 
protected File | 
root  | 
protected OSGiRuntimeService | 
runtime  | 
protected RuntimeContext | 
sysrc  | 
| Constructor and Description | 
|---|
ComponentPersistence(OSGiRuntimeService runtime)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
createComponent(byte[] bytes)  | 
void | 
createComponent(byte[] bytes,
               boolean isPersistent)  | 
protected void | 
deploy(RuntimeContext rc,
      File file)  | 
RuntimeContext | 
getContext(String symbolicName)  | 
File | 
getRoot()  | 
void | 
loadPersistedComponent(File file)  | 
void | 
loadPersistedComponents()  | 
void | 
loadPersistedComponents(RuntimeContext rc,
                       File root)  | 
Document | 
loadXml(File file)  | 
static Document | 
loadXml(InputStream in)  | 
boolean | 
removeComponent(String compName)  | 
protected byte[] | 
safeReadFile(File file)  | 
protected void | 
safeWriteFile(byte[] bytes,
             File file)  | 
protected final RuntimeContext sysrc
protected final OSGiRuntimeService runtime
protected final ReadWriteLock fileLock
protected final Set<RegistrationInfo> persistedComponents
public ComponentPersistence(OSGiRuntimeService runtime)
public final RuntimeContext getContext(String symbolicName)
protected void deploy(RuntimeContext rc, File file) throws IOException
IOExceptionpublic void loadPersistedComponents() throws IOException
IOExceptionpublic void loadPersistedComponents(RuntimeContext rc, File root) throws IOException
IOExceptionpublic void loadPersistedComponent(File file) throws IOException
IOExceptionpublic Document loadXml(File file) throws IOException
IOExceptionpublic static Document loadXml(InputStream in)
public void createComponent(byte[] bytes) throws IOException
IOExceptionpublic void createComponent(byte[] bytes, boolean isPersistent) throws IOException
IOExceptionpublic boolean removeComponent(String compName) throws IOException
IOExceptionprotected void safeWriteFile(byte[] bytes, File file) throws IOException
IOExceptionprotected byte[] safeReadFile(File file) throws IOException
IOExceptionCopyright © 2019 Nuxeo. All rights reserved.