Example #1
0
  /**
   * Obtains the properties for the passed in object. This is a JBoss managed operation.
   *
   * @param objectName
   * @param objectType
   * @return an collection of managed properties (may be <code>null</code>)
   */
  @ManagementOperation(
      description = "Obtains the properties for an object",
      impact = Impact.ReadOnly)
  public List<ManagedProperty> getProperties(String objectName, Component objectType) {
    if (!isRunning()) return Collections.emptyList();

    // Get engine to use for the rest of the method (this is synchronized)
    // ...
    final JcrEngine engine = getEngine();
    assert engine != null;

    List<ManagedProperty> managedProps = new ArrayList<ManagedProperty>();
    if (objectType.equals(Component.CONNECTOR)) {
      RepositorySource repositorySource = engine.getRepositorySource(objectName);
      assert repositorySource != null : "Connection '" + objectName + "' does not exist";
      managedProps = ManagedUtils.getProperties(objectType, repositorySource);
    } else if (objectType.equals(Component.CONNECTIONPOOL)) {
      RepositoryConnectionPool connectionPool =
          engine.getRepositoryService().getRepositoryLibrary().getConnectionPool(objectName);
      assert connectionPool != null
          : "Repository Connection Pool for repository '" + objectName + "' does not exist";
      managedProps = ManagedUtils.getProperties(objectType, connectionPool);
    }

    return managedProps;
  }
Example #2
0
  /**
   * Obtains the managed sequencing service. This is a JBoss managed operation.
   *
   * @param repositoryName
   * @return the sequencing service or <code>null</code> if never started
   */
  @ManagementOperation(
      description = "Obtains the descriptors for a JCRRepository as ManagedProperties",
      impact = Impact.ReadOnly)
  public List<ManagedProperty> getRepositoryProperties(String repositoryName) {
    if (!isRunning()) return null;

    List<ManagedProperty> propertyList = new ArrayList<ManagedProperty>();

    JcrRepository repository = getRepository(repositoryName);

    String[] descriptorKeys = repository.getDescriptorKeys();

    for (String key : descriptorKeys) {
      String value = repository.getDescriptor(key);
      propertyList.add(new ManagedProperty(ManagedUtils.createLabel(key), value));
    }

    return propertyList;
  }