org.apache.sling.jcr.contentloader.internal
Class ContentLoaderService

java.lang.Object
  extended by org.apache.sling.jcr.contentloader.internal.ContentLoaderService
All Implemented Interfaces:
EventListener, JcrContentHelper, org.osgi.framework.BundleListener, org.osgi.framework.SynchronousBundleListener

public class ContentLoaderService
extends Object
implements org.osgi.framework.SynchronousBundleListener, JcrContentHelper

The ContentLoaderService is the service providing the following functionality:


Field Summary
static String BUNDLE_CONTENT_NODE
           
static String PROPERTY_CONTENT_LOADED
           
static String PROPERTY_UNINSTALL_PATHS
           
protected  SlingSettingsService settingsService
           
 
Constructor Summary
ContentLoaderService()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext)
          Activates this component, called by SCR before registering as a service
 void bundleChanged(org.osgi.framework.BundleEvent event)
          Loads and unloads any content provided by the bundle whose state changed.
 void contentIsUninstalled(javax.jcr.Session session, org.osgi.framework.Bundle bundle)
           
protected  void createRepositoryPath(javax.jcr.Session writerSession, String repositoryPath)
           
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
          Deativates this component, called by SCR to take out of service
 String digestPassword(String pwd)
          Digest the given password using the configured digest algorithm
 Map<String,Object> getBundleContentInfo(javax.jcr.Session session, org.osgi.framework.Bundle bundle, boolean create)
          Return the bundle content info and make an exclusive lock.
 String getMimeType(String name)
          Returns the MIME type from the MimeTypeService for the given name
protected  SlingRepository getRepository()
          Returns the JCR repository used by this service.
 void unlockBundleContentInfo(javax.jcr.Session session, org.osgi.framework.Bundle bundle, boolean contentLoaded, List<String> createdNodes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CONTENT_LOADED

public static final String PROPERTY_CONTENT_LOADED
See Also:
Constant Field Values

PROPERTY_UNINSTALL_PATHS

public static final String PROPERTY_UNINSTALL_PATHS
See Also:
Constant Field Values

BUNDLE_CONTENT_NODE

public static final String BUNDLE_CONTENT_NODE
See Also:
Constant Field Values

settingsService

protected SlingSettingsService settingsService
Constructor Detail

ContentLoaderService

public ContentLoaderService()
Method Detail

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent event)
Loads and unloads any content provided by the bundle whose state changed. If the bundle has been started, the content is loaded. If the bundle is about to stop, the content are unloaded.

Specified by:
bundleChanged in interface org.osgi.framework.BundleListener
Parameters:
event - The BundleEvent representing the bundle state change.

getMimeType

public String getMimeType(String name)
Returns the MIME type from the MimeTypeService for the given name

Specified by:
getMimeType in interface JcrContentHelper
Parameters:
name - the name of the file to get the mimeType for

createRepositoryPath

protected void createRepositoryPath(javax.jcr.Session writerSession,
                                    String repositoryPath)
                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

digestPassword

public String digestPassword(String pwd)
                      throws IllegalArgumentException
Digest the given password using the configured digest algorithm

Specified by:
digestPassword in interface JcrContentHelper
Parameters:
pwd - the value to digest
Returns:
the digested value
Throws:
IllegalArgumentException

activate

protected void activate(org.osgi.service.component.ComponentContext componentContext)
Activates this component, called by SCR before registering as a service


deactivate

protected void deactivate(org.osgi.service.component.ComponentContext componentContext)
Deativates this component, called by SCR to take out of service


getRepository

protected SlingRepository getRepository()
Returns the JCR repository used by this service.


getBundleContentInfo

public Map<String,Object> getBundleContentInfo(javax.jcr.Session session,
                                               org.osgi.framework.Bundle bundle,
                                               boolean create)
                                        throws javax.jcr.RepositoryException
Return the bundle content info and make an exclusive lock.

Parameters:
session -
bundle -
Returns:
The map of bundle content info or null.
Throws:
javax.jcr.RepositoryException

unlockBundleContentInfo

public void unlockBundleContentInfo(javax.jcr.Session session,
                                    org.osgi.framework.Bundle bundle,
                                    boolean contentLoaded,
                                    List<String> createdNodes)
                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

contentIsUninstalled

public void contentIsUninstalled(javax.jcr.Session session,
                                 org.osgi.framework.Bundle bundle)


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.