All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.petals.admin.jmx.JMXEndpointDirectoryAdministration Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/**
 * Copyright (c) 2012 EBM WebSourcing, 2012-2016 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program/library; If not, see http://www.gnu.org/licenses/
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.admin.jmx;

import java.util.List;
import java.util.Map;

import org.ow2.petals.admin.api.EndpointDirectoryAdministration;
import org.ow2.petals.admin.api.exception.EndpointDirectoryAdministrationException;
import org.ow2.petals.admin.api.exception.EndpointDirectoryRegexpPatternException;
import org.ow2.petals.admin.endpoint.EndpointDirectoryView;
import org.ow2.petals.admin.jmx.endpoint.JMXEndpointDirectoryView;
import org.ow2.petals.clientserverapi.jbi.messaging.endpoint.exception.EndpointDirectoryException;
import org.ow2.petals.jmx.api.api.JMXClient;
import org.ow2.petals.jmx.api.api.exception.ConnectionErrorException;
import org.ow2.petals.jmx.api.api.exception.EndpointDirectoryServiceDoesNotExistException;
import org.ow2.petals.jmx.api.api.exception.EndpointDirectoryServiceErrorException;

/**
 * 
 * @author Nicolas Oddoux - EBM WebSourcing
 */
public class JMXEndpointDirectoryAdministration implements EndpointDirectoryAdministration {

    protected JMXEndpointDirectoryAdministration() {
    }

    @Override
    public EndpointDirectoryView getEndpointDirectoryContent(final String containerNameRegex, final String endpointNameRegex,
            final String serviceNameRegex, final String interfaceNameRegex) throws EndpointDirectoryRegexpPatternException,
            EndpointDirectoryAdministrationException {
        try {
            JMXClient client = JMXClientConnection.getJMXClient();
            List> endpointMaps = client.getEndpointDirectoryClient()
                    .getAllEndpoints();
            return new JMXEndpointDirectoryView(endpointMaps, containerNameRegex, endpointNameRegex, serviceNameRegex,
                    interfaceNameRegex);
        } catch (ConnectionErrorException cee) {
            throw new EndpointDirectoryAdministrationException(cee);
        } catch (NumberFormatException nfe) {
            throw new EndpointDirectoryAdministrationException(nfe);
        } catch (final EndpointDirectoryServiceErrorException ersee) {
            throw new EndpointDirectoryAdministrationException(ersee);
        } catch (final EndpointDirectoryServiceDoesNotExistException ersdnee) {
            throw new EndpointDirectoryAdministrationException(ersdnee);
        } catch (final EndpointDirectoryException e) {
            throw new EndpointDirectoryAdministrationException(e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy