xp-framework/rfc — Issue #24: ResourceManager
Author: thekid
Created: 2011-10-17 15:39:11+00:00
State: open
Labels: draft, framework

Scope of Change
====
A new singleton named ResourceManager will be added. It will hold
database connections, webservice endpoints, LDAP urls, mail connections
and remote specs.

Rationale
====
While a efficient method exists to manage database connections there is
currently no way for other resources.

Functionality
====

Resource interface
----

```php

```

Resource classes
----
* rdbms.DBConnection (and its subclasses)
* peer.ldap.LdapConnection
* util.log.LogCategory
* util.Properties
* remote.Remote

ResourceManager
----

```php

```

Example #1: Registering the database connection to the "orders" database
----

```php
bind(
'/xp/rdbms/orders',
DriverManager::getConnection('mysql://...')
);
?>
```

Example #2: Get an rdbms.DBConnection instance by name "orders"
----

```php
lookup('/xp/rdbms/orders');
?>
```

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
- xp-framework/rfc #147 - LdapConnection

Related documents
====
- EJB 3.0 Dependency Injection Annotations
http://www.caucho.com/resin-3.0/ejb3/bean-ann.xtp#@Inject

- Initial implementation
http://experiments.xp-framework.net/?people,friebe,resourcepool

- Inversion of Control Containers and the Dependency Injection pattern
http://www.martinfowler.com/articles/injection.html