PILLUTLAAVINASH / google-enterprise-connector-manager

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

Add disable/enable to connectors #79

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add disable/enable to connectors

Original issue reported on code.google.com by jeffreyl...@gmail.com on 21 Apr 2008 at 8:54

GoogleCodeExporter commented 8 years ago
Need to: add more details

Original comment by jeffreyl...@gmail.com on 18 Jul 2008 at 9:19

GoogleCodeExporter commented 8 years ago
just stop the traversal;

From UI, will add "start/Stop" later.

Original comment by mgron...@gmail.com on 28 Jan 2009 at 10:34

GoogleCodeExporter commented 8 years ago
See also Google bug #753032.

Original comment by jl1615@gmail.com on 6 Feb 2009 at 5:45

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 26 Feb 2009 at 11:26

GoogleCodeExporter commented 8 years ago
Fixed in Connector Manager revision r1568

This is feature request to enable/disable traversals while
preserving the schedule.  [The current work-around of setting
the schedule to 1am-1am destroys any existing/complex schedule.]

The easiest way to implement this on the Connector Manager
side is to modify the saved schedule string to reflect the
enabled/disabled state.  After consideration of various
options, I chose a simple and rather obvious modification
of the schedule string - I "comment it out" by prepending
a '#' to the string.

The Schedule class has been enhanced with a "disabled" attribute.
It is settable via constructors and schedule string parsing.
It is testable via isDisabled() method.  TraversalScheduler
was modified to not schedule connectors whose schedules are
disabled.

The SetSchedule servlet has been modified to recognize an
optional "disabled" tag.  The presence/absence of this tag
determines the disabled boolean parameter passed to the
Schedule constructor.

SetSchedule also hard-coded the default retryDelayMillis
value (5 minutes).  Several customers have requested the
ability to adjust this.  I added a new bean to the application
context called "TraversalDelaySecondsDefault".  It specifies
the default number of seconds for retryDelay if none is
provided by the GSA when setting the schedule.  The
TraversalDelaySecondsDefault bean is documented as such
in applicationContext.xml and is set to 300 seconds -
the current default of 5 minutes.  This should make it
easier for administrators to adjust this behaviour.

ProductionManager was using internal knowlege of the format
of the stringified Schedule object to construct a schedule.
It did so because there were no Schedule class constructors
that were suitable for the available data.  I added a new
constructor that accepts the timeIntervals as a String,
rather than a list of ScheduleTimeInterval objects.

I was annoyed by the Manager.setSchedule() interface
requiring all the individual prameters needed to pass to the
Schedule constructor.  I decided to change Manager.setSchedule()
to take either a Schedule object or a schedule string, and
chose the latter.

Finally, the GetConnectorStatus and GetConnectorInstanceList
servlets previously returned a legacy schedule string, which
strips the retryDelayMillis and Disabled information from the
schedule string before returning it.  So this information is
lost in a round-trip edit of the Connector's schedule.
After some experimentation, I determined that the schedule
string returned with GetConnectorStatus is unused, and the
schedule string returned by GetConnectorInstanceList is the
one used in the Schedule section of the Connector Add/Edit GUI.
The Connector Add/Edit GUI fails to parse non-legacy format
strings.

I found I could return new format schedule strings
either as separate XML elements or as attributes on the
returned schedule element.  Either of which the GSA may
use in the future.  I chose adding a separate XML element
containing the new format schedule string, and preserving
the old XML element with the legacy format schedule string.
As it is, the XML tag "ConnectorSchedules" is already defined
and used with SetSchedule servlet, so I decided to also
use that as the tag for new format schedules - vs the tag
"ConnectorSchedule" for legacy format schedules.

I also add a version attribute to the schedule element,
allowing the string to be versioned, so we don't run into
this problem in the future.  The current version for schedule
string is 3:
  - 1 is legacy version string
  - 2 adds retryDelayMillis
  - 3 adds disabled

At this point, GetConnectorInstanceList now returns the
following schedule elements:
  <ConnectorSchedules version="3">#name:1000:300000:0-0</ConnectorSchedules>
  <ConnectorSchedule version="1">name:1000:0-0</ConnectorSchedule>

Change Log:
----------
M  
connector-manager/source/java/com/google/enterprise/connector/servlet/SetSchedul
e.java
   - Understands new "disabled" tag in request packet.
   - No longer hard-codes the default retryDelayMillis value.
   - Uses the new Manager.setSchedule() interface.

M 
connector-manager/source/java/com/google/enterprise/connector/servlet/GetConnect
orInstanceList.java
   - Return both new format and legacy format schedule strings.

M 
connector-manager/source/java/com/google/enterprise/connector/servlet/GetConnect
orStatus.java
   - Return new format, rather than legacy format, schedule strings.

M  
connector-manager/source/java/com/google/enterprise/connector/servlet/ServletUti
l.java
   - Define new XMLTAG_DISABLED = "disabled".

M 
connector-manager/source/java/com/google/enterprise/connector/manager/Production
Manager.java
   - Simplified setSchedule() method.

M  
connector-manager/source/java/com/google/enterprise/connector/manager/Manager.ja
va
   - Changed the setSchedule() interface to take schedule as a string.

M 
connector-manager/source/java/com/google/enterprise/connector/importexport/Impor
tExport.java
   - Uses the new Manager.setSchedule() interface.

M 
connector-manager/source/java/com/google/enterprise/connector/scheduler/Traversa
lScheduler.java
   - Don't schedule connectors with disabled schedules.

M  
connector-manager/source/java/com/google/enterprise/connector/scheduler/Schedule
.java
   - New constructor that takes timeIntervals as a string.
   - Added boolean disabled flag to constructors.
   - Added isDisabled() method.
   - Added defaultRetryDelayMillis() method that either gets the
     value from the Context, or returns a hard-coded 5 minutes.
   - Schedule string parsers understand leading '#' as disabled schedule.
   - Schedule string parsers use String.trim() to remove leading/trailing
     whitespace from schedule strings. [If I edit the schedule file with emacs,
     it would add a nl to the file, and the old parser would complain.]

M 
connector-manager/source/javatests/com/google/enterprise/connector/manager/MockM
anager.java
   - Implements new setSchedule() interface.
   - Returns new format schedule strings from getConnectorStatus().

M 
connector-manager/source/javatests/com/google/enterprise/connector/scheduler/Tra
versalSchedulerTest.java
   - Uses modified Schedule constructor interface.

M 
connector-manager/source/javatests/com/google/enterprise/connector/scheduler/Sch
eduleTest.java
   - Uses modified Schedule constructor interface.
   - Add tests for disabled schedules.

M 
connector-manager/source/javatests/com/google/enterprise/connector/servlet/GetCo
nnectorStatusTest.java
   - Understands new format schedule strings returned by GetConnectorStatus.

M  connector-manager/etc/applicationContext.xml
   - Added TraversalDelaySecondsDefault bean, with default value of 300 seconds

Original comment by Brett.Mi...@gmail.com on 17 Mar 2009 at 10:16

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 8:39

GoogleCodeExporter commented 8 years ago
Although this is now supported in the Connector Manager, there is not yet 
support for this feature in the GSA.

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 8:55