Search in sources :

Example 1 with RepositoryContent

use of org.osgi.service.repository.RepositoryContent in project aries by apache.

the class CustomResourceInstaller method install.

@Override
public Resource install() throws Exception {
    try {
        ContentHandler handler = subsystem.getBundleContext().getService(handlerRef);
        if (handler != null) {
            InputStream is = ((RepositoryContent) resource).getContent();
            handler.install(is, ResourceHelper.getSymbolicNameAttribute(resource), type, subsystem, coordination);
            addReference(resource);
            return resource;
        } else {
            throw new Exception("Custom content handler not found: " + handlerRef);
        }
    } finally {
        subsystem.getBundleContext().ungetService(handlerRef);
    }
}
Also used : InputStream(java.io.InputStream) RepositoryContent(org.osgi.service.repository.RepositoryContent) ContentHandler(org.apache.aries.subsystem.ContentHandler)

Aggregations

InputStream (java.io.InputStream)1 ContentHandler (org.apache.aries.subsystem.ContentHandler)1 RepositoryContent (org.osgi.service.repository.RepositoryContent)1