Creates and returns a new instance of the default implementation of the
{@link SseEventSourceFactory}.

@return SseEventSourceFactory
481192
public static SseEventSourceFactory createEventSourceFactory() {
        Class<SseEventSourceFactory>         clazz = SseEventSourceFactory.class;
        ServiceLoader<SseEventSourceFactory> loader = ServiceLoader.load(clazz);
        return loader.iterator().next();    
    }
486137
protected DialectFactory createDialectFactory() {
        DialectFactoryImpl factory = new DialectFactoryImpl();
        factory.injectServices(new ServiceRegistryImplementor() {

            @Override
            public <R extends Service> R getService(Class<R> serviceRole) {
                if (serviceRole == DialectResolver.class) {
                    return (R) new StandardDialectResolver();
                } else if (serviceRole == StrategySelector.class) {
                    return (R) new StrategySelectorImpl(new ClassLoaderServiceImpl(Thread.currentThread().getContextClassLoader()));
                }
                return null;
            }

            @Override
            public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole) {
                return null;
            }

            @Override
            public void destroy() {

            }

            @Override
            public void registerChild(ServiceRegistryImplementor child) {
            }

            @Override
            public void deRegisterChild(ServiceRegistryImplementor child) {
            }

            @Override
            public ServiceRegistry getParentServiceRegistry() {
                return null;
            }
        });
        return factory;
    }
1139339
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ XMLEventReader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return XMLEventReader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new XMLEventReaderHandle() : null;
        return handle;
      }
    };
  }
1143623
protected function createObjectFactory()
    {
        try {
            if (isset($this->parameters[SessionParameter::OBJECT_FACTORY_CLASS])) {
                $objectFactoryClass = new $this->parameters[SessionParameter::OBJECT_FACTORY_CLASS];
            } else {
                $objectFactoryClass = $this->createDefaultObjectFactoryInstance();
            }

            if (!($objectFactoryClass instanceof ObjectFactoryInterface)) {
                throw new \RuntimeException('Class does not implement ObjectFactoryInterface!', 1408354119);
            }

            $objectFactoryClass->initialize($this, $this->parameters);

            return $objectFactoryClass;
        } catch (\Exception $exception) {
            throw new \RuntimeException(
                'Unable to create object factory: ' . $exception,
                1408354120
            );
        }
    }
301856
public ClientFactory build() {
        final Function<? super EventLoopGroup,
                       ? extends AddressResolverGroup<? extends InetSocketAddress>> addressResolverGroupFactory;
        if (this.addressResolverGroupFactory != null) {
            addressResolverGroupFactory = this.addressResolverGroupFactory;
        } else {
            addressResolverGroupFactory = new DefaultAddressResolverGroupFactory(
                    firstNonNull(domainNameResolverCustomizers, ImmutableList.of()));
        }

        return new DefaultClientFactory(new HttpClientFactory(
                workerGroup, shutdownWorkerGroupOnClose, channelOptions, sslContextCustomizer,
                addressResolverGroupFactory, http2InitialConnectionWindowSize, http2InitialStreamWindowSize,
                http2MaxFrameSize, http2MaxHeaderListSize, http1MaxInitialLineLength, http1MaxHeaderSize,
                http1MaxChunkSize, idleTimeoutMillis, useHttp2Preface,
                useHttp1Pipelining, connectionPoolListener, meterRegistry));
    }
927958
public ServerSentEvent build() {
        if (id == null && event == null &&
            retry == null && comment == null && data == null) {
            return DefaultServerSentEvent.EMPTY;
        }
        return new DefaultServerSentEvent(id, event, retry, comment, data);
    }
42100
public static LazyProxyFactory createDefaultProxyFactory() {
        if (testDependencyFullFilled()) {
            final String factoryClassName = "dev.morphia.mapping.lazy.CGLibLazyProxyFactory";
            try {
                return (LazyProxyFactory) Class.forName(factoryClassName).newInstance();
            } catch (Exception e) {
                LOG.error("While instantiating " + factoryClassName, e);
            }
        }
        return null;
    }
635255
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ InputSource.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return InputSource.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new InputSourceHandle() : null;
        return handle;
      }
    };
  }
28264
protected EntityPropertyDescFactory createEntityPropertyDescFactory() {
    return globalFactory.createEntityPropertyDescFactory(
        dialect,
        entityPropertyClassNameResolver,
        versionColumnNamePattern,
        entityConfig.getGenerationType() == null
            ? null
            : entityConfig.getGenerationType().convertToEnum(),
        entityConfig.getInitialValue(),
        entityConfig.getAllocationSize(),
        entityConfig.isShowColumnName());
  }
982597
public static XMLInputFactory createSafeXmlInputFactory() {
    XMLInputFactory xif = XMLInputFactory.newInstance();
    if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
      xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
                      false);
    }

    if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) {
      xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
                      false);
    }

    if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) {
      xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    }
    return xif;
  }
92359
public static InterceptorFactory getInstance()
	{
		if (instance == null)
		{
			instance = new InterceptorFactory();
			OjbConfigurator.getInstance().configure(instance);
		}
		return instance;
	}
1068518
public ExtendedRegisterableItemsFactory build() {
        return new NoopExtendedRegisterableItemsFactory() {
            private RuntimeEngine _runtime;
            private List<EventListener> _listeners = new ArrayList<EventListener>();

            private synchronized List<EventListener> listeners(RuntimeEngine runtime) {
                if (_runtime != runtime) {
                    _runtime = runtime;
                    _listeners.clear();
                    KieRuntimeEventManager runtimeEventManager = _runtime.getKieSession();
                    for (ListenerBuilder builder : _listenerBuilders) {
                        EventListener listener = builder.build(runtimeEventManager);
                        if (listener != null && !builder.wasAutomaticRegistration()) {
                            _listeners.add(listener);
                        }
                    }
                }
                return new ArrayList<EventListener>(_listeners);
            }

            @Override
            public List<AgendaEventListener> getAgendaEventListeners(RuntimeEngine runtime) {
                List<AgendaEventListener> list = new ArrayList<AgendaEventListener>();
                for (EventListener listener : listeners(runtime)) {
                    if (listener instanceof AgendaEventListener) {
                        list.add((AgendaEventListener)listener);
                    }
                }
                return list;
            }

            @Override
            public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) {
                List<ProcessEventListener> list = new ArrayList<ProcessEventListener>();
                if (_bpm) {
                    // always add our EventPublisherProcessEventListener for bpm component
                    list.add(new EventPublisherProcessEventListener(getServiceDomain().getEventPublisher()));
                }
                for (EventListener listener : listeners(runtime)) {
                    if (listener instanceof ProcessEventListener) {
                        list.add((ProcessEventListener)listener);
                    }
                }
                return list;
            }

            @Override
            public List<RuleRuntimeEventListener> getRuleRuntimeEventListeners(RuntimeEngine runtime) {
                List<RuleRuntimeEventListener> list = new ArrayList<RuleRuntimeEventListener>();
                for (EventListener listener : listeners(runtime)) {
                    if (listener instanceof RuleRuntimeEventListener) {
                        list.add((RuleRuntimeEventListener)listener);
                    }
                }
                return list;
            }

            @Override
            public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {
                Map<String, WorkItemHandler> map = new LinkedHashMap<String, WorkItemHandler>();
                // wih builder list will always be empty for rules component
                for (WorkItemHandlerBuilder builder : _workItemHandlerBuilders) {
                    ProcessRuntime processRuntime = runtime.getKieSession();
                    RuntimeManager runtimeManager = null;
                    if (runtime instanceof RuntimeEngineImpl) {
                        runtimeManager = ((RuntimeEngineImpl)runtime).getManager();
                    }
                    String name = builder.getWorkItemHandlerName();
                    WorkItemHandler handler = builder.build(processRuntime, runtimeManager);
                    map.put(name, handler);
                }
                return map;
            }

            @Override
            public List<KieBaseEventListener> getKieBaseEventListeners(RuntimeEngine runtime) {
                List<KieBaseEventListener> list = new ArrayList<KieBaseEventListener>();
                for (EventListener listener : listeners(runtime)) {
                    if (listener instanceof KieBaseEventListener) {
                        list.add((KieBaseEventListener)listener);
                    }
                }
                return list;
            }
        };
    }
615270
public SmtpConnectionFactory build() {
    if (session == null) {
      session = Session.getInstance(new Properties());
    }

    TransportStrategy transportStrategy = protocol == null ? newSessiontStrategy() : newProtocolStrategy(protocol);

    ConnectionStrategy connectionStrategy;
    if (host == null && port == -1 && username == null && password == null) {
      connectionStrategy = newConnectionStrategy();
    } else {
      connectionStrategy = newConnectionStrategy(host, port, username, password);
    }

    return new SmtpConnectionFactory(session, transportStrategy, connectionStrategy, defaultTransportListeners);
  }
1351021
public static function findRequestFactory()
    {
        try {
            $messageFactory = static::findOneByType(RequestFactoryInterface::class);
        } catch (DiscoveryFailedException $e) {
            throw self::createException('request factory', $e);
        }

        return static::instantiateClass($messageFactory);
    }
1130398
public JettyServiceBuilder sessionIdManagerFactory(
            Function<? super Server, ? extends SessionIdManager> sessionIdManagerFactory) {
        requireNonNull(sessionIdManagerFactory, "sessionIdManagerFactory");
        this.sessionIdManagerFactory = sessionIdManagerFactory;
        return this;
    }
439034
protected final CommPortConnectionFactory createCommPortConnectionFactory()
    {
        //create new instance
        CommPortConnectionFactory factory=(CommPortConnectionFactory)ReflectionHelper.createInstance(this.commConnectionFactoryClassName);
            
        //initialize
        factory.initialize(this);
        
        return factory;
    }
75988
public Factory getMessageFactory()
    {
        return new Factory()
        {
            @Override
            public ThriftMessage create(ChannelBuffer messageBuffer)
            {
                return new ThriftMessage(messageBuffer, getTransportType());
            }
        };
    }