Closed GoogleCodeExporter closed 8 years ago
As part of this, we should allow validateConfig to modify the properties, and
reconcile the uses of java.util.Map
vs. java.util.Properties. I think that the use of Properties should be
restricted to InstanceInfo as an
implementation detail. In that case, we should document that the Map is really
a Map<String,String>, although
we can't declare it as such since we support JDK 1.4.
Original comment by jl1615@gmail.com
on 23 Apr 2008 at 12:19
Original comment by jl1615@gmail.com
on 10 Jul 2008 at 9:52
Fixed in revision r925
This set of changes addresses Connector Manager Issues 80, 49, and 52 -
Implement ConnectorFactory and avoid storing connector instance properies
before they are validated.
This change involves change in the contract for the use of validateConfig(),
but not a change in the actual interface to validateConfig():
- validateConfig is supplied a configuration Map and a ConnectorFactory.
- validateConfig may construct connector instances using the supplied
factory for the purposes of validation. The factory accepts a config
Map as a parameter. validateConfig can pass in the Map it was supplied,
or it may pass in an altered Map. It may also pass in null, in which
case the factory will use the same Map that was passed to validateConfig.
- Connector instances created by the factory are not added added to the
InstanceMap and do not have an on-disk representation.
- If validateConfig returns null, the supplied configuration is assumed
to be valid. An instance of the connector is then created from the
configuration and the configuration is written out the the connector's
properties file.
- If validateConfig returns a ConfigureResponse that contains only
a configData Map, that Map is assumed to a valid configuration,
possibly different than the one that was passed in. An instance of the
connector is then created from the new configuration and the configuration
is written out the the connector's properties file.
- If validateConfig returns a ConfigureResponse that contains a non-null
message or non-null formSnippet, the configuration is assumed to be
invalid. Any configData Map returned in this case would be ignored.
Change Log:
----------
M
projects/connector-manager/source/java/com/google/enterprise/connector/instantia
tor/InstanceInfo.java
- Refactored to allow fromNewConfig() to instantiate a connector from the
config Map without writing it out to a properties file. The external
public methods of the class remain unchanged. However, a new inner class
called Configuation provides an abstraction over either a config Map or a
Properties file. The fromNewConfig(), fromDirectory(), fromDirectoryNoThrow()
methods are now thin wrappers over fromConfiguration() supplying an
instance of an appropriate Configuration subclass.
M
projects/connector-manager/source/java/com/google/enterprise/connector/instantia
tor/InstanceMap.java
- Implements a ConnectorFactory that uses InstanceInfo to create connector
instances on behalf of validateConfig().
- resetConfig() does not create a concrete connector instace before calling
validateConfig(). It now passes a connector factory to validateConfig().
Only if validateConfig() accepts the configuration, will a concrete connector
instance be created. If a connector instance can successfully be created,
only then will its configuration written out to a properies file.
[Connector Manager Issue 49]
M
projects/connector-manager/source/java/com/google/enterprise/connector/spi/Conne
ctorFactory.java
- ConnectorFactory.makeConnector() now takes a configuration Map parameter,
which may be null. If it is null, the original configuration that was
supplied to validateConfig() will be used.
- JavaDoc written [Connector Manager Issue 52].
M
projects/connector-manager/source/java/com/google/enterprise/connector/spi/Conne
ctorType.java
- Minor JavaDoc enhancements for validateConfig, specifically addressing
the use of the ConnectorFactory, and returning a modified config in the
ConfigureResponse.
M
projects/connector-manager/source/java/com/google/enterprise/connector/spi/Confi
gureResponse.java
- Minor JavaDoc enhancements.
M
projects/connector-manager/source/java/com/google/enterprise/connector/spiimpl/N
ullConnectorFactory.java
- ConnectorFactory.makeConnector() now takes a configuration Map parameter.
M
projects/connector-manager/source/javatests/com/google/enterprise/connector/inst
antiator/InstantiatorTest.java
M
projects/connector-manager/source/javatests/com/google/enterprise/connector/inst
antiator/InstanceMapTest.java
- It is no longer safe to assume that the input configuration map and
the output configuration map are identical.
Original comment by Brett.Mi...@gmail.com
on 28 Aug 2008 at 7:30
Original comment by jl1615@gmail.com
on 12 Jan 2009 at 3:21
Original issue reported on code.google.com by
jeffreyl...@gmail.com
on 21 Apr 2008 at 9:45