Package org.rhq.plugins.jbossas5.connection

Examples of org.rhq.plugins.jbossas5.connection.AbstractProfileServiceConnectionProvider


        return propToUseAsComponentName.getStringValue();
    }


    private Deployer getDeployer(ResourceType resourceType) {
        ProfileServiceConnection profileServiceConnection = this.component.getConnection();

        PackageDownloader downloader = runningEmbedded() ? new LocalDownloader() : new RemoteDownloader(
            component.getResourceContext(), false, profileServiceConnection);

        if (ScriptComponent.TYPE_NAME.equals(resourceType.getName())) {
View Full Code Here


     * @return if successful, the Resource details, otherwise, null
     */
    @Nullable
    public DiscoveredResourceDetails discoverInProcessJBossAS(ResourceDiscoveryContext discoveryContext) {
        ProfileServiceConnectionProvider connectionProvider = new LocalProfileServiceConnectionProvider();
        ProfileServiceConnection connection;
        try {
            connection = connectionProvider.connect();
        } catch (Exception e) {
            // This most likely just means we're not embedded inside a JBoss 5.x or 6.x app server instance.
            log.debug("Unable to connect to in-process ProfileService.", e);
            return null;
        }

        ManagementView managementView = connection.getManagementView();
        ManagedComponent serverConfigComponent = ManagedComponentUtils.getSingletonManagedComponent(managementView,
            new ComponentType("MCBean", "ServerConfig"));
        String serverName = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent, "serverName");

        // serverHomeDir is the full path to the instance's configuration dir, e.g. "/opt/jboss-5.1.0.GA/server/default";
View Full Code Here

    }

    private Set<ManagedComponent> addManagedDeploymentComponent(String deployName, String componentName,
        ResourceDiscoveryContext<ApplicationServerComponent<?>> context) throws NoSuchDeploymentException {

        ProfileServiceConnection connection = context.getParentResourceComponent().getConnection();

        ManagementView managementView = connection.getManagementView();

        Set<ManagedComponent> components = new HashSet<ManagedComponent>();
        ManagedDeployment deploy = managementView.getDeployment(deployName);
        if (deploy != null) {
            if (componentName == null || componentName.equals("*"))
 
View Full Code Here

    // ------------ OperationFacet Implementation ------------

    @Override
    public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
        ProfileServiceConnection connection = getConnection();
        if (connection == null) {
            OperationResult result = new OperationResult();
            result.setErrorMessage("No profile service connection available");
            return result;
        }

        String deploymentName = getDeploymentName();

        if (deploymentName == null) {
            OperationResult result = new OperationResult();
            result.setErrorMessage("Did not find deployment with key [" + deploymentKey + "]");
            return result;
        }

        DeploymentManager deploymentManager = connection.getDeploymentManager();
        DeploymentProgress progress;
        if (name.equals("start")) {
            //FIXME: This is a workaround until JOPR-309 will be fixed.
            if (getAvailability() != AvailabilityType.UP) {
                progress = deploymentManager.start(deploymentName);
View Full Code Here

     *
     * @return if successful, the Resource details, otherwise, null
     */
    @Nullable
    public DiscoveredResourceDetails discoverInProcessJBossAS(ResourceDiscoveryContext discoveryContext) {
        ProfileServiceConnectionProvider connectionProvider = new LocalProfileServiceConnectionProvider();
        ProfileServiceConnection connection;
        try {
            connection = connectionProvider.connect();
        } catch (Exception e) {
            // This most likely just means we're not embedded inside a JBoss 5.x or 6.x app server instance.
            log.debug("Unable to connect to in-process ProfileService.", e);
            return null;
        }
View Full Code Here

    private void connectToProfileService() {
        if (this.connection != null) {
            return;
        }
        // TODO: Check for a defunct connection and if found try to reconnect?
        ProfileServiceConnectionProvider connectionProvider;
        if (runningEmbedded()) {
            connectionProvider = new LocalProfileServiceConnectionProvider();
        } else {
            Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
            String namingURL = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.NAMING_URL,
                null);
            validateNamingURL(namingURL);
            String principal = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.PRINCIPAL,
                null);
            String credentials = pluginConfig.getSimpleValue(
                ApplicationServerPluginConfigurationProperties.CREDENTIALS, null);
            connectionProvider = new RemoteProfileServiceConnectionProvider(namingURL, principal, credentials);
        }
        if (Thread.interrupted()) {
            // In case we've been timed out by the component facet invoker, clear the interrupted status,
            // so that when the below call to connect() tried to make a remote call, JBoss Remoting
            // doesn't throw an InterruptedException and short circuit our attempts to reconnect.
            log.debug("Ignoring facet timeout in order to reconnect to Profile Service.");
        }
        try {
            this.connection = connectionProvider.connect();
        } catch (RuntimeException e) {
            Throwable rootCause = ExceptionUtils.getRootCause(e);
            rootCause = rootCause == null ? e : rootCause;
            if (rootCause instanceof SecurityException) {
                if (log.isDebugEnabled()) {
View Full Code Here

            validateNamingURL(namingURL);
            String principal = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.PRINCIPAL,
                null);
            String credentials = pluginConfig.getSimpleValue(
                ApplicationServerPluginConfigurationProperties.CREDENTIALS, null);
            connectionProvider = new RemoteProfileServiceConnectionProvider(namingURL, principal, credentials);
        }
        if (Thread.interrupted()) {
            // In case we've been timed out by the component facet invoker, clear the interrupted status,
            // so that when the below call to connect() tried to make a remote call, JBoss Remoting
            // doesn't throw an InterruptedException and short circuit our attempts to reconnect.
View Full Code Here

    private Object target;
    private LoginContext loginContext;

    public JaasAuthenticationInvocationHandler(Object target, String username, String password) {
        this.target = target;               
        JBossCallbackHandler jaasCallbackHandler = new JBossCallbackHandler(username, password);
        Configuration jaasConfig = new JBossConfiguration();
        try {
            this.loginContext = new LoginContext(JBossConfiguration.JBOSS_ENTRY_NAME, null, jaasCallbackHandler,
                    jaasConfig);
        }
View Full Code Here

    private LoginContext loginContext;

    public JaasAuthenticationInvocationHandler(Object target, String username, String password) {
        this.target = target;               
        JBossCallbackHandler jaasCallbackHandler = new JBossCallbackHandler(username, password);
        Configuration jaasConfig = new JBossConfiguration();
        try {
            this.loginContext = new LoginContext(JBossConfiguration.JBOSS_ENTRY_NAME, null, jaasCallbackHandler,
                    jaasConfig);
        }
        catch (LoginException e) {
View Full Code Here


    private Deployer getDeployer(ResourceType resourceType) {
        ProfileServiceConnection profileServiceConnection = this.component.getConnection();

        PackageDownloader downloader = runningEmbedded() ? new LocalDownloader() : new RemoteDownloader(
            component.getResourceContext(), false, profileServiceConnection);

        if (ScriptComponent.TYPE_NAME.equals(resourceType.getName())) {
            String jbossHome = component.getResourceContext().getPluginConfiguration()
                .getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
View Full Code Here

TOP

Related Classes of org.rhq.plugins.jbossas5.connection.AbstractProfileServiceConnectionProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.