コード例 #1
0
  private ErrorMapper createErrorMapper(
      MessageProcessorConfigHolder config, ServerServiceId svcId, ClassLoader cl)
      throws ServiceException {
    ErrorMapper result;
    String className = config.getErrorMappingClass();
    if (className == null) {
      // if error mapper not configured, use the system default one
      result = new DefaultErrorMapperImpl();
    } else {
      result = ReflectionUtils.createInstance(className, ErrorMapper.class, cl);
    }

    ErrorMapperInitContextImpl initCtx = new ErrorMapperInitContextImpl(svcId);
    result.init(initCtx);
    initCtx.kill();

    return result;
  }
コード例 #2
0
  public ServerServiceDesc createFallbackServiceDesc(QName serviceQName) throws ServiceException {
    ServerServiceId serverSvcId =
        ServerServiceId.createFallbackServiceId(serviceQName.getLocalPart());
    ClassLoader cl = ServiceDesc.class.getClassLoader();

    // create empty pipelines
    Pipeline requestPipeline = createFallbackPipeline(serverSvcId, PipelineMode.REQUEST);
    Pipeline responsePipeline = createFallbackPipeline(serverSvcId, PipelineMode.RESPONSE);

    // create empty operation lists
    Map<String, ServiceOperationDesc> operations = new HashMap<String, ServiceOperationDesc>();
    RequestPatternMatcher<ServiceOperationDesc> operationMatcher =
        new RequestPatternMatcher<ServiceOperationDesc>(true);

    // create empty protocol processor lists
    Map<String, ProtocolProcessorDesc> protocols = new HashMap<String, ProtocolProcessorDesc>();
    RequestPatternMatcher<ProtocolProcessorDesc> protocolMatcher =
        new RequestPatternMatcher<ProtocolProcessorDesc>(true);

    Set<Class> rootClasses = getRootClassesFromOperations(operations.values());

    // create default bindings
    Map<String, DataBindingDesc> bindings = new HashMap<String, DataBindingDesc>();
    addDefaultDataBindings(serverSvcId, bindings, null, rootClasses, null, true);

    // create matchers for bindings
    RequestPatternMatcher<DataBindingDesc> bindingMatcherForRequest =
        new RequestPatternMatcher<DataBindingDesc>(true);
    RequestPatternMatcher<DataBindingDesc> bindingMatcherForResponse =
        new RequestPatternMatcher<DataBindingDesc>(true);
    createDataBindingsMatchers(
        bindings.values(), bindingMatcherForRequest, bindingMatcherForResponse);

    ServiceTypeMappings typeMappings = createFallbackTypeMappings();

    ErrorMapper errorMapper = new DefaultErrorMapperImpl();
    ErrorDataProvider errorDataProviderClass = getDefaultErrorDataProviderClass();

    ErrorMapperInitContextImpl errorMapperInitCtx = new ErrorMapperInitContextImpl(serverSvcId);
    errorMapper.init(errorMapperInitCtx);
    errorMapperInitCtx.kill();

    List<LoggingHandler> loggingHandlers = new ArrayList<LoggingHandler>();
    addDefaultLoggingHandler(serverSvcId, cl, loggingHandlers);

    Dispatcher requestDispatcher = new FallbackRequestDispatcher();
    Dispatcher responseDispatcher = new SimpleServerResponseDispatcher(true);

    VersionCheckHandler versionCheckHandler = new NullVersionCheckHandler();

    VersionCheckHandlerInitContextImpl versionInitCtx =
        new VersionCheckHandlerInitContextImpl(serverSvcId, "1.0", null);
    versionCheckHandler.init(versionInitCtx);
    versionInitCtx.kill();

    Collection<GlobalIdEntry> registryEntries =
        GlobalRegistryConfigManager.getInstance().getAllEntries();
    Map<String, GlobalIdDesc> globalIdMap = createGlobalIdMap(registryEntries, null);

    List<String> serviceLayers =
        ServiceConfigManager.getInstance().getGlobalConfig().getServiceLayerNames();

    ServerServiceDesc result =
        new ServerServiceDesc(
            serverSvcId,
            serviceQName,
            null, // config
            requestPipeline,
            responsePipeline,
            requestDispatcher,
            responseDispatcher,
            operations,
            protocols,
            bindings,
            typeMappings,
            cl,
            loggingHandlers,
            null, // service interface class
            operationMatcher,
            protocolMatcher,
            bindingMatcherForRequest,
            bindingMatcherForResponse,
            null, // service impl class name
            errorMapper,
            errorDataProviderClass,
            globalIdMap,
            versionCheckHandler,
            null,
            UrlMappingsDesc.EMPTY_MAPPINGS,
            new OperationMappings(),
            HeaderMappingsDesc.EMPTY_MAPPINGS,
            HeaderMappingsDesc.EMPTY_MAPPINGS,
            Collections.unmodifiableMap(new HashMap<String, Map<String, String>>()),
            bindings.get(BindingConstants.PAYLOAD_XML),
            bindings.get(BindingConstants.PAYLOAD_XML),
            serviceLayers,
            null,
            null,
            null,
            null);

    return result;
  }