PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

Should Connector know its name? #122

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Marty Gronberg asks:

Question - In your experience, has it ever important for the Connector to know 
it's name?

Background - some of the Connectors we are building have an additional 
communication 
channel with the cloud where they have to identify which source they have fed 
and do this by 
giving their name.  Other than scraping it off the googleConnectorWorkDir there 
doesn't seem 
to be a nice way for the Connector to determine it's name.

Related - If we wanted to support this, any thoughts on best approach?

John Lacy responds:

I wanted it as a hack when validateConfig didn't get the 
googleConnectorWorkDir, so it couldn't 
find the custom connectorInstance.xml file. Now that's obsolete in two ways: 
the property is not 
stripped from the config map, and you can use ConnectorFactory.

I strongly suspect that something somewhere is going to want to know the 
connector name for 
the logs. Log files with multiple connector instances are unreadable. I do not 
know whether it 
will be enough for the connector manager to know, rather than the connector. I 
suspect that 
only the connector manager will need to know.

My first inclination if we support it would be as a setter on the Connector 
implementation, 
something like setGoogleConnectorName (using the "google" prefix established by 
the 
google*WorkDir properties). I'm leaning toward not including the connector name 
in the config 
map passed to validateConfig, to be conservative. 

(I think it would be better if the google*WorkDir properties were not in the 
properties file or the 
config map, since they contain hard-coded info about the directory structure 
and connector 
name. Note that we added them to the config map for 1.3, or more properly we 
now avoid 
removing them. At the time it didn't seem important, and it was easier not to 
filter the 
properties in the new config storage code. I don't think it occurred to us to 
remove them from 
the properties file altogether.)

Brett Johnson adds:

I was going to suggest adding a googleConnectorName property 
to the configuration map.  I am not sure I understand John's
reluctance to do so.

Original issue reported on code.google.com by Brett.Mi...@gmail.com on 10 Feb 2009 at 4:48

GoogleCodeExporter commented 8 years ago
Fixed in CM revision r1532

Add a googleConnectorName property to the configuration map
that lets the connector know its name.

Change Log:

M  
projects/connector-manager/source/java/com/google/enterprise/connector/common/Pr
opertiesUtils.java
   - define 'googleConnectorName' property key

M  projects/connector-
manager/source/java/com/google/enterprise/connector/instantiator/InstanceMap.jav
a
   - add 'googleConnectorName' property to configuration map given to connector

M  projects/connector-
manager/source/javatests/com/google/enterprise/connector/instantiator/InstanceMa
pTest.java
   - add test to verify 'googleConnectorName' property

Original comment by Brett.Mi...@gmail.com on 10 Feb 2009 at 5:50

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 9:11