[daisy] Get RepositoryManager from ServiceManager fails

Kevin hellosticky at gmail.com
Wed Aug 1 11:55:01 CDT 2007


Hi,

On 8/1/07, Bruno Dumon <bruno at outerthought.org> wrote:
>
> I'm wondering why you need access to the UserManager?

I want to (potentially) update roles if certain conditions have
changed since last login (in the check(Credentials) method).

>
> As for getting access to the repository manager, you can only get access
> to components for which you declared a dependency, e.g. like this:
>
> @avalon.dependency key="repository-manager" type="org.outerj.daisy.repository.RepositoryManager"
>

Where do I declare this? I decorated my AuthenticationSchemeFactory
service method, but it threw the same exception:

	/**
	 * @avalon.dependency key="auth-scheme-registrar"
	 *
type="org.outerj.daisy.authentication.AuthenticationSchemeRegistrar"
	 * @avalon.dependency key="repository-manager"
	 *                    type="org.outerj.daisy.repository.RepositoryManager"
	 */
	public void service(ServiceManager serviceManager) throws ServiceException {
		super.service(serviceManager);

		this.serviceManager = serviceManager;

		Repository result = getRepository(serviceManager);
		RepositoryManager repositoryManager = null;
		try {
			repositoryManager = (RepositoryManager) serviceManager
					.lookup("repository-manager");
			result = repositoryManager.getRepository(new Credentials(
					"registrar", "defaultpwd"));
		} catch (RepositoryException e) {
			e.printStackTrace();
		} finally {
			if (repositoryManager != null)
				serviceManager.release(repositoryManager);
		}
		System.out.println("DEBUG: " + result);
	}

I also tried adding

    <dependency key="repository-manager"
type="org.outerj.daisy.repository.RepositoryManager"/>

To my .xinfo file in my JAR that contains the AuthenticationScheme,
and the repository startup froze (I did a Ctrl-Break to get the thread
dump in case you want to check to see why an invalid .xinfo file
freezes the startup).

Your help is appreciated,

Thanks!
Kevin


More information about the daisy mailing list