Closed GoogleCodeExporter closed 8 years ago
The Manager does allow more than one Connector of a given type, however, not
within
the same Spring file. They have to be configured in separate directories.
How are you deploying your connector? Typically deployment involves using the
SetManagerConfig Servlet followed by a call to the SetSchedule Servlet to set
the
schedule for the Connector.
For example, if I were to create two instances of TestConnectorA to run within
the
same Manager I would make the following HTTP 1.1 calls:
Request to create the Foo Connector of type TestConnectorA:
--------
POST /connector-manager/setConnectorConfig
<ConnectorConfig> <ConnectorName>Foo</ConnectorName>
<ConnectorType>TestConnectorA</ConnectorType> <Lang>en</Lang>
<Update>false</Update> <Param name="Color" value="color"/> <Param
name="Password"
value="poiu"/> <Param name="RepositoryFile"
value="MockRepositoryEventLog1.txt"/>
<Param name="Username" value="user"/></ConnectorConfig>
Good Response:
-------------
200 OK
<CmResponse>
<StatusId>0</StatusId>
</CmResponse>
Request for Foo schedule to set host load of 100 and continuous traversal
(12-12):
-------
POST /connector-manager/setSchedule
<ConnectorSchedules>
<ConnectorName>Foo</ConnectorName>
<load>100</load>
<TimeIntervals>12-12</TimeIntervals>
</ConnectorSchedules>
Good Response:
-------------
200 OK
<CmResponse>
<StatusId>0</StatusId>
</CmResponse>
Repeat the same set of two calls to create the Bar Connector of type
TestConnectorA.
This should result in the following files being created under the deployed Web
App area:
Under Tomcat Install:
--------------------
[...]/webapps/connector-manager/WEB-INF/connectors:
TestConnectorA/
Bar/
Bar.properties
-----
#Fri Jul 25 13:12:10 PDT 2008
Username=user
googleConnectorWorkDir=[...]/webapps/connector-manager/WEB-INF/connectors/TestCo
nnectorA/Bar
RepositoryFile=MockRepositoryEventLog2.txt
Password=hioRME3NQ0No5Jxg5XhFtA\=\=
Color=color
googleWorkDir=[...]/webapps/connector-manager/WEB-INF
Foo/
Foo.properties
-----
#Fri Jul 25 13:11:47 PDT 2008
Username=user
googleConnectorWorkDir=[...]/webapps/connector-manager/WEB-INF/connectors/TestCo
nnectorA/Foo
RepositoryFile=MockRepositoryEventLog1.txt
Password=hioRME3NQ0No5Jxg5XhFtA\=\=
Color=color
googleWorkDir=[...]/webapps/connector-manager/WEB-INF
TestConnectorB/
If you want to use a connectorInstance.xml that is different for each of the
Connectors you can also drop that in the individual Connector directories (Foo/
and
Bar/).
The schedule is stored in the java.util.pref.Preferences storage area for your
host.
On Windows that's in the registry and on Linux it's under the Tomcat user's home
directory.
java.util.pref.Preferences store on Linux:
-----------------------------------------
~<tomcat_user>/.java/.userPrefs/com/google/enterprise/connector/persist/schedule
/prefs.xml
---
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE map SYSTEM
"http://java.sun.com/dtd/preferences.dtd">
<map MAP_XML_VERSION="1.0"><entry key="Bar" value="Bar:100:300000:12-12"/><entry
key="Foo" value="Foo:100:300000:12-12"/></map>
Once these files are in place, if you stop and start the Web App the following
stack
trace will reload the connectors:
com.google.enterprise.connector.instantiator.SpringInstantiator.initialize()
com.google.enterprise.connector.instantiator.InstanceMap.InstanceMap(TypeMap)
com.google.enterprise.connector.instantiator.InstanceMap.processTypeDirectory(Ty
peInfo)
com.google.enterprise.connector.instantiator.InstanceInfo.fromDirectory(String,
File, TypeInfo)
com.google.enterprise.connector.instantiator.InstanceInfo.fromDirectoryAndThrow(
String,
File, TypeInfo)
So if you want to try this by hand (without using the Servlets), you might try:
1. Deploy the WAR file and your connector. This should result in a directory
being
created under WEB-INF/connectors/ that is associated with your Connector Type.
2. Stop Tomcat.
3. Create a directory under WEB-INF/connectors/<your_connector_type>/ that
matches
the name of the Connector you want to create.
4. Create a <connector_name>.properties file for your Connector under that
directory.
You can also create a specialized connectorInstance.xml file there.
5. Add a schedule entry to the schedule prefs area for your platform that
includes:
<entry key="<connector_name>"
value="<connector_name>:<host_load>:300000:<schedule_start-schdule_stop>"/>
The 300000 is just a 5 minute wait between retires and probably should be left alone.
6. Repeat Steps 3-5 for second Connector.
7. Start Tomcat.
Hope that helps.
Marty
Original comment by mgron...@gmail.com
on 25 Jul 2008 at 8:49
Original issue reported on code.google.com by
luis.per...@gmail.com
on 22 Jul 2008 at 11:16