Unique service locator instance per component type.
每个组件类型一个唯一的服务定位器实例。
My second implementation used a caching service locator.
我第二个实现使用了缓存服务定位器。
But the service locator should not include a resource cache.
但是服务定位器不应包含资源缓存。
My third implementation used a service locator with no cache.
我的第三个实现使用没有缓存的服务定位器。
Use of the service locator design pattern to simplify lookup code.
使用服务定位器设计模式来简化代码。
This article assumes knowledge of the Service Locator pattern.
本文假定的服务定位器模式的知识。
'Service Locator' as a stepping stone to Dependency injection.
用“Service Locator”作为到依赖注入的垫脚石。
So overloaded resource names mess up a service locator and its cache.
重载资源名使得服务定位器与其缓存之间变得混乱。
Caching isn't even the main point of the Service Locator pattern.
缓存甚至不是Service Locator模式的主要点。
OK, so a caching service locator causes errors for overloaded resource names.
好,既然是由于缓存服务定位器导致重载资源名时的错误。
How hard will it be to figure out that the service locator is causing the problem?
要解决由服务定位器导致的问题的难度有多大呢?
For Cairngorm, we offer a service locator that can be configured in the IoC container.
我们为Cairngorm提供了一个可配置在IoC容器中的服务定位器。
A service locator implementation that includes caching accesses a data source like this.
包含访问数据源缓存的服务定位器实现如下。
Because of the caching service locator, the two beans are now using the same data source.
由于缓存服务定位器的原因,两个bean现在使用相同数据源。
To make this safe, you need to have a mechanism to lock the service locator and make it read only.
为了安全,你需要用一种机制来锁定服务定位器并使之只读。
Another way is for each component type to use its own instance of service locator, not a singleton.
另外一个方法是每个组件类型使用它自身的服务定位器实例,而不是集合。
For example, the service locator code that enables a client to access a data source looks like this.
例如,允许客户端访问数据源的服务定位器代码表面上与此相似。
Modularity patterns: Separated Interface and Plug In, Service Locator, Event Aggregator, facade.
模块化模式:分离界面和插件、服务定位、事件聚合、外观模式。
The remaining alternative is to use a service locator, make it a singleton, but remove the reference cache.
剩下的一个选择是使用服务定位器使用集合的方式,但是要去除引用缓存。
Service locator implementations usually include a resource cache to avoid repeated lookups of the same resource.
服务定位器实现通常包括资源缓存,以此来避免对相同资源的重复查找。
Therefore, J2EE 1.3 applications should not include the resource cache in their service locator implementations.
因此,在J2EE 1.3应用程序中,服务定位器的实现不应该包含资源缓存。
This is because the service locator will cache the resource for whichever component USES the overloaded name first.
这是因为服务定位器将缓存不论哪个组件首次使用时所重载的名称的资源。
We will briefly review how JNDI works here, primarily to understand the parts that affect the Service Locator pattern.
我们将主要回顾JNDI是如何工作的,首先要弄清楚影响Service Locator模式的部分。
This is simple to apply to an existing application: just change the service locator implementation to disable or remove the cache.
将其应用于现有应用程序很简单:只要改变服务定位器实现去禁止或去除缓存。
Business logic code that USES a service locator avoids becoming cluttered with directory lookup code, and so is easier to understand.
业务逻辑代码使用服务定位器避免目录查找代码变得混乱,因此它很容易理解。
The Service Locator pattern is still useful for encapsulating the code that uses JNDI, even if the locator does not use caching.
Service Locator模式对封装使用JNDI的代码仍然有用,即使定位器不使用缓存。
In addition, the Service Locator pattern can be modified to access the appropriate version of the EJB home and remote interfaces.
另外,可以通过修改Service Locator模式来访问合适版本的ejb本地及远程接口。
My first implementation used no service locator; the beans performed all of the JNDI code themselves. Here are the two toString 's I got.
我的第一个实现没有使用服务定位器,bean本身执行所有的JNDI代码。
A business locator can take many forms — for instance, it could be a web service locator, an EJB component locator, or a JMS locator.
业务定位程序可以采用多种形式,比如Web服务定位程序、EJB组件定位程序或者JMS定位程序。
A service locator that caches references will cause a J2EE 1.3 (and later) application with an overloaded resource name to work incorrectly.
缓存引用的服务定位器将导致J2EE 1.3(以及以后版本)中有重载资源名的应用程序工作不正常。
应用推荐