/common/common-lang/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java

https://github.com/conceptboard/TwelveMonkeys · Java · 61 lines · 5 code · 3 blank · 53 comment · 0 complexity · ddb85681070619a20d267cbbdc080b6e MD5 · raw file

  1. /*
  2. * Copyright (c) 2008, Harald Kuhr
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name "TwelveMonkeys" nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  24. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  25. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. package com.twelvemonkeys.util.service;
  29. /**
  30. * An optional interface that may be implemented by service provider objects.
  31. * <p/>
  32. * If this interface is implemented, the service provider objects will receive
  33. * notification of registration and deregistration from the
  34. * {@code ServiceRegistry}.
  35. *
  36. * @see ServiceRegistry
  37. *
  38. * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
  39. * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java#1 $
  40. */
  41. public interface RegisterableService {
  42. /**
  43. * Called right after this service provider object is added to
  44. * the given category of the given {@code ServiceRegistry}.
  45. *
  46. * @param pRegistry the {@code ServiceRegistry} {@code this} was added to
  47. * @param pCategory the category {@code this} was added to
  48. */
  49. void onRegistration(ServiceRegistry pRegistry, Class pCategory);
  50. /**
  51. * Called right after this service provider object is removed
  52. * from the given category of the given {@code ServiceRegistry}.
  53. *
  54. * @param pRegistry the {@code ServiceRegistry} {@code this} was added to
  55. * @param pCategory the category {@code this} was added to
  56. */
  57. void onDeregistration(ServiceRegistry pRegistry, Class pCategory);
  58. }