Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This 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 software 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 software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.connector.util;
 
 import static org.jboss.as.connector.logging.ConnectorLogger.ROOT_LOGGER;
 import static org.jboss.as.connector.logging.ConnectorMessages.MESSAGES;
 
 import java.util.Map;
 
ConnectorServices contains some utility methods used internally and constants for all connector's subsystems service names.

Author(s):
Stefano Maestri
Jesper Pedersen
 
 public class ConnectorServices {

    
A map whose key corresponds to a ra name and whose value is an identifier with which the RA is registered in the org.jboss.jca.core.spi.rar.ResourceAdapterRepository
 
     private static Map<StringStringresourceAdapterRepositoryIdentifiers = new HashMap<StringString>();
 
     public static final ServiceName CONNECTOR_CONFIG_SERVICE = ..append("connector""config");
 
     public static final ServiceName BEAN_VALIDATION_CONFIG_SERVICE = ..append("connector""bean_validation",
             "config");
 
     public static final ServiceName ARCHIVE_VALIDATION_CONFIG_SERVICE = ..append("connector",
             "archive_validation""config");
 
     public static final ServiceName BOOTSTRAP_CONTEXT_SERVICE = ..append("connector""bootstrapcontext");
 
     public static final ServiceName TRANSACTION_INTEGRATION_SERVICE = ..append("connector",
             "transactionintegration");
 
     public static final ServiceName WORKMANAGER_SERVICE = ..append("connector""workmanager");
 
     public static final ServiceName RESOURCE_ADAPTER_SERVICE_PREFIX = ..append("ra");
 
             .append("deployment");
 
             .append("deployer");
 
     public static final ServiceName RESOURCE_ADAPTER_REGISTRY_SERVICE = ..append("raregistry");
 
     public static final ServiceName RESOURCE_ADAPTER_ACTIVATOR_SERVICE = ..append("raactivator");
 
     public static final ServiceName INACTIVE_RESOURCE_ADAPTER_SERVICE = ..append("rainactive");

    
MDR service name *
 
     public static final ServiceName IRONJACAMAR_MDR = ..append("ironjacamar""mdr");
 
     public static final ServiceName RA_REPOSITORY_SERVICE = ..append("rarepository");
 
     public static final ServiceName MANAGEMENT_REPOSITORY_SERVICE = ..append("management_repository");
 
     public static final ServiceName RESOURCEADAPTERS_SERVICE = ..append("resourceadapters");
 
     public static final ServiceName RESOURCEADAPTERS_SUBSYSTEM_SERVICE = ..append("resourceadapters-subsystem");
 
     public static final ServiceName RA_SERVICE = ..append("resourceadapters""ra");
 
     public static final ServiceName DATASOURCES_SERVICE = ..append("datasources");
 
     public static final ServiceName JDBC_DRIVER_REGISTRY_SERVICE = ..append("jdbc-driver""registry");
 
     public static final ServiceName CCM_SERVICE = ..append("cached-connection-manager");
 
     public static final ServiceName IDLE_REMOVER_SERVICE = ..append("ironjacamar""idle-remover");
    public static final ServiceName CONNECTION_VALIDATOR_SERVICE = ..append("ironjacamar",
            "connection-validator");

    
convenient method to check notNull of value

Parameters:
<T> type of the value
value the value
Returns:
the value or throw an java.lang.IllegalStateException if value is null (a.k.a. service not started)
    public static <T> T notNull(T value) {
        if (value == null)
            throw .serviceNotStarted();
        return value;
    }
    // resource-adapter DMR resource
    public static synchronized ServiceName getDeploymentServiceName(final String raNamefinal ResourceAdapter raxml) {
        if (raName == null)
            throw .undefinedVar("RaName");
        ServiceName serviceName = null;
        if (ra != null && ra.getId() != null) {
            serviceName = getDeploymentServiceName(raName,ra.getId());
        } else {
            serviceName = getDeploymentServiceName(raName,(String)null);
        }
        .tracef("ConnectorServices: getDeploymentServiceName(%s,%s) -> %s"raNameraxml,serviceName);
        return serviceName;
    }
    public static synchronized ServiceName getDeploymentServiceName(String raNameString raId) {
        if (raName == null)
            throw .undefinedVar("RaName");
        // ServiceName entry = deploymentServiceNames.get(raName);
        ServiceName serviceName = null;
        if (raId == null || raId.equals(raName)) {
            serviceName = .append(raName);
        } else {
            serviceName = .append(raName + "_" + raId);
        }
        .tracef("ConnectorServices: getDeploymentServiceName(%s,%s) -> %s"raNameraId,serviceName);
        return serviceName;
    }
    public static synchronized ServiceName getDeploymentServiceName(final String raName) {
        if (raName == null)
            throw .undefinedVar("RaName");
        final ServiceName serviceName = .append(raName);
        .tracef("ConnectorServices: getDeploymentServiceName(%s) -> %s"raNameserviceName);
        return serviceName;
    }
    public static synchronized ServiceName getResourceAdapterServiceName(final String id) {
        if (id == null || id.trim().isEmpty()) {
            throw .undefinedVar("id");
        }
        .tracef("ConnectorServices: getResourceAdapterServiceName(%s) -> %s"idserviceName);
        return serviceName;
    }
    private static String stripDotRarSuffix(final String raName) {
       if (raName == null) {
          return null;
       }
       // See RaDeploymentParsingProcessor
       if (raName.endsWith(".rar"))       {
         return raName.substring(0, raName.indexOf(".rar"));
       }
       return raName;
    }

    
Returns the identifier with which the resource adapter named raName is registered in the org.jboss.jca.core.spi.rar.ResourceAdapterRepository. Returns null, if there's no registration for a resource adapter named raName

Parameters:
raName The resource adapter name
Returns:
    public static String getRegisteredResourceAdapterIdentifier(final String raName) {
        synchronized () {
            return .get(raName);
        }
    }

    
Makes a note of the resource adapter identifier with which a resource adapter named raName is registered in the org.jboss.jca.core.spi.rar.ResourceAdapterRepository.

Subsequent calls to getRegisteredResourceAdapterIdentifier(java.lang.String) with the passed raName return the raIdentifier

Parameters:
raName The resource adapter name
raIdentifier The resource adapter identifier
    public static void registerResourceAdapterIdentifier(final String raNamefinal String raIdentifier) {
        synchronized () {
            .put(raNameraIdentifier);
        }
    }

    
Clears the mapping between the raName and the resource adapter identifier, with which the resource adapter is registered with the org.jboss.jca.core.spi.rar.ResourceAdapterRepository

Subsequent calls to getRegisteredResourceAdapterIdentifier(java.lang.String) with the passed raName return null

Parameters:
raName The resource adapter name
    public static void unregisterResourceAdapterIdentifier(final String raName) {
        synchronized () {
            .remove(raName);
        }
    }
New to GrepCode? Check out our FAQ X