예제 #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;
  }
예제 #2
0
  /**
   * Obtains a connector by name.
   *
   * @param connectorName
   * @return RepositorySource - may be <code>null</code>)
   */
  public RepositorySource getConnector(String connectorName) {
    if (!isRunning()) return null;

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

    RepositorySource repositorySource = engine.getRepositorySource(connectorName);
    assert (repositorySource != null) : "Connector '" + connectorName + "' does not exist";
    return repositorySource;
  }