Package org.nuxeo.runtime.model.impl
Class ComponentPersistence
java.lang.Object
org.nuxeo.runtime.model.impl.ComponentPersistence
Manage persistent components. Persistent components are located in ${nxserver_data_dir}/components directory, and can
be dynamically removed or registered. After framework startup (after the application was completely started) the
persistent components are deployed. The layout of the components directory is the following:
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 deployed in root directory must use as name the file name without the .xml extension.
- Components deployed in a bundle directory must use the relative file path without the .xml extensions.
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
- Author:
- Bogdan Stefanescu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReadWriteLockprotected final Set<RegistrationInfo>protected final Fileprotected final OSGiRuntimeServiceprotected final RuntimeContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateComponent(byte[] bytes) voidcreateComponent(byte[] bytes, boolean isPersistent) protected voiddeploy(RuntimeContext rc, File file) final RuntimeContextgetContext(String symbolicName) getRoot()voidloadPersistedComponent(File file) voidvoidloadPersistedComponents(RuntimeContext rc, File root) static DocumentloadXml(InputStream in) booleanremoveComponent(String compName) protected byte[]safeReadFile(File file) protected voidsafeWriteFile(byte[] bytes, File file)
-
Field Details
-
root
-
sysrc
-
runtime
-
fileLock
-
persistedComponents
-
-
Constructor Details
-
ComponentPersistence
-
-
Method Details
-
getRoot
-
getContext
-
deploy
- Throws:
IOException
-
loadPersistedComponents
- Throws:
IOException
-
loadPersistedComponents
- Throws:
IOException
-
loadPersistedComponent
- Throws:
IOException
-
loadXml
- Throws:
IOException
-
loadXml
-
createComponent
- Throws:
IOException
-
createComponent
- Throws:
IOException
-
removeComponent
- Throws:
IOException
-
safeWriteFile
- Throws:
IOException
-
safeReadFile
- Throws:
IOException
-