modules/ballerina-core/src/main/java/org/ballerinalang/services/dispatchers/http/HTTPServicesRegistry.java
/**
     * Indicate the service exists already.
     * @param service requested service to check.
     * @return true if service exists.
     */
Indicate the service exists already.
@param service requested service to check.
@return true if service exists.
Indicate the service exists already . @param service requested service to check . @return true if service exists .
public boolean serviceExists(Service service) {
        String listenerInterface = Constants.DEFAULT_INTERFACE;
        String basePath = service.getSymbolName().getName();
        for (Annotation annotation : service.getAnnotations()) {
            if (annotation.getName().equals(Constants.ANNOTATION_NAME_SOURCE)) {
                String sourceInterfaceVal = annotation
                        .getValueOfElementPair(new SymbolName(Constants.ANNOTATION_SOURCE_KEY_INTERFACE));
                if (sourceInterfaceVal != null) {   
                    listenerInterface = sourceInterfaceVal;
                }
            } else if (annotation.getName().equals(
                    Constants.PROTOCOL_HTTP + ":" + Constants.ANNOTATION_NAME_BASE_PATH)) {
                basePath = annotation.getValue();
            }
        }
        return servicesMap.containsKey(listenerInterface) && servicesMap.get(listenerInterface).containsKey(basePath);
    }
public boolean serviceExists ( Service service ) { String listenerInterface = Constants . DEFAULT_INTERFACE ; String basePath = service . getSymbolName ( ) . getName ( ) ; for ( Annotation annotation : service . getAnnotations ( ) ) { if ( annotation . getName ( ) . equals ( Constants . ANNOTATION_NAME_SOURCE ) ) { String sourceInterfaceVal = annotation . getValueOfElementPair ( new SymbolName ( Constants . ANNOTATION_SOURCE_KEY_INTERFACE ) ) ; if ( sourceInterfaceVal != null ) { listenerInterface = sourceInterfaceVal ; } } else if ( annotation . getName ( ) . equals ( Constants . PROTOCOL_HTTP + ":" + Constants . ANNOTATION_NAME_BASE_PATH ) ) { basePath = annotation . getValue ( ) ; } } return servicesMap . containsKey ( listenerInterface ) && servicesMap . get ( listenerInterface ) . containsKey ( basePath ) ; }
Indicate the service exists already.
Indicate the service exists already .
//TODO: Filter non-http protocols