Commit graph

21 commits

Author SHA1 Message Date
Patrick Ohly 4062d1d926 SAN + forced slow sync: move flag into SyncSource
The main motivation for this change was that access to that flag was
needed inside the SyncSource while experimenting with slow sync
detection.

In the end, the flag was not really needed there. Applying this patch
might make sense anyway, just in case that a similar need arises
again.

Eventually it might also allow to remove the entire
SourceConfigSpecials structure.
2010-02-10 10:02:07 +01:00
Patrick Ohly 052f12d757 virtual source: support D-Bus CheckSource() (MB #9535)
As Jussi found out, the CheckSource() D-Bus method always declared
a virtual source as "unusable".

The underlying reason was that instantiating a SyncSource corresponding
to a virtual source config was not possible. If that had worked, it
wouldn't have checked the underlying sources.

This patch fixes both problems by extending VirtualSyncSource (now
instantiates and opens underlying sources) and
SyncSource::createSource() (now recognizes "virtual" and creates a
VirtualSyncSource).

Because creating proper sources depends on the SyncConfig, this must
be passed as parameter into createSource/VirtualSyncSource when
that kind of checking is desired.

Besides opening the underlying sources, VirtualSyncSource::open()
also verifies that it has a proper data format.

I noticed that this code had been copied from SyncSourceSerialize. I
moved the common code into a new SyncSourceBase::getDataTypeSupport().
Error checking also was a bit streamlined. For example, bad or missing
MIME type are detected in SyncSourceBase::getDataTypeSupport(), which
allows us to remove the corresponding check in SyncContext.cpp.

Note that SyncSource::throwError() should be used for source-specific
problems instead of SE_THROW(), because it includes the name of the
source in the exception.
2010-02-09 09:34:10 +01:00
Patrick Ohly 7a12a1a0ae SyncSource API: access to previous backup (MB #7708)
This is the API change which will allow a SyncSource implemenation
to reuse data and files from a previous backup. Right now, neither
the caller nor the callee actually use this option.
2010-02-09 09:33:52 +01:00
Patrick Ohly 06b3e7e915 CPPUnit header file dependency for backends (MB #9149)
Congwu already removed the -DENABLE_INTEGRATION_TESTS, which
caused the CPPUnit header include. This caused a problem in
the nightly build, which compiles without --enable-integration-tests
and then compiles client-test separately.

Registering integration tests doesn't depend on CPPUnit headers
or libs, only running them. Backends therefore should always
register themselves for testing.

This patch clarifies that in the comments and changes the Evolution
and file backends accordingly.
2010-01-22 10:46:12 +01:00
Patrick Ohly 429876c1cf MAKE/PARSETEXTWITHPROFILE: EVOLUTION no longer the default rule
MAKE/PARSETEXTWITHPROFILE() is used when converting data for or
from a backend. Properties can be enabled/disabled in that
conversion by enabling a "remoterule".

That rule used to be hard-coded as "EVOLUTION". With this patch,
the default is to use no rule. The Evolution backend
sets "EVOLUTION" in its base class.
2010-01-19 20:32:26 +01:00
Chen Congwu 426526e496 ClientTest: enabling the test with virtual syncsource
Virtual syncsource should be viewed as a single source by the synccontext while
as a list of sub datasources for the LocalTest.
2009-12-17 10:18:18 +08:00
Chen Congwu e1ab662c32 SyncSourceAdmin: do not flush mapping table if never loaded
For local test scenarios, it is possible the mapping table is never loaded but
flushed during endSession, this will empty the mapping file uncontentionaly.
2009-12-17 09:46:35 +08:00
Chen Congwu e5b641897a FileSyncSource: use x-vcalendar instead of x-calendar
"x-calendar" was a typo.. However, to be backward compatible  we will
accept both "x-vcalendar" and "x-calendar".
The configuration example is change to "x-vcalendar" to educate new users
to use "x-vcalendar".
2009-11-30 11:44:38 +01:00
Chen Congwu 1b923115a0 Join/dejoin Mutiple SyncSources, MB#4611
As Nokia phone stores calendar and todos in one datastore, we need to utilize
synthesis superdatastore to handle this case. A virtual SyncSource is introduced
which has a backend type "virtual" and its local database path points to a list
of sub syncsources. The virtual syncsource is maintained by SyncSourceList and
used to generate appropriate synthesis superdatastore configuraitons.
unescapeJoinedString is introduced to parse a comma seperated list of sub
syncsources. At this time, the configuration is fixed to work with
"calendar+todo" case.
2009-11-30 11:44:38 +01:00
Chen Congwu 97cead8f3b Server Alerted Sync: Set Content Type in SAN
Nokia phone (S40, 7710c) does not accept the null content type.
SyncSource::getPeerMimeType is added for this purpose, each backend
implementation can provide a MimeType used for sync by default. For
TrackingSyncSource based backend implementations it maps to getMimeType
directly.
2009-11-30 11:44:38 +01:00
Patrick Ohly 9b35062bb9 ConfigNode: use map with case-insensitive keys for properties
The case of property names does not matter. A map where the key
is case-insensitive is thus a better data structure for storing
a set of property key/value pairs.

Such a type was already used by FilterConfigNode. This patch
cleans up the config nodes so that all of them use the new ConfigProps
type. The previous typedefs inside ConfigNode and FilterConfigNode are
preserved to keep old source code working without changing it.

The intention is to use the result of readProperties() directly as
parameter for setConfigFilter().
2009-11-25 16:57:51 +01:00
Patrick Ohly 5f61785608 config: reorganized for shared config layout (MB#7707)
This patch introduces code changes for the new layout without actually
using it yet. Therefore all existing tests for the older layout
still pass. The new meaning of the former "server name" is introduced:
- A plain string now refers to a peer configuration (can be client
  or server).
- The @ sign allows selecting a specific context. Different contexts
  have independent sets of local sources and peer definitions.
- An empty peer name selects a view on the configuration which contains
  no peer-specific properties. Not fully implemented yet.

The FileConfigTree is instantiated with a root which is one level high
up compare to before this patch (for example,
"~/.config/syncevolution" instead of
"./config/syncevolution/scheduleworld") and then config files include
that dropped level in their relative path name
("scheduleworld/config.ini" instead of "config.ini"). This allows
accessing the global properties in
"~/.config/syncevolution/config.ini" and will be used to move peers
further down the hierarchy
("~/.config/syncevolution/peers/scheduleworld/config.ini").

To keep the output of "--print-servers" consistent, the FileConfigTree
gets another parameter which identifies the subset of the larger tree
that is referenced by this FileConfigTree instance.

One side effect of this change is that FileConfigTree instances are no
longer completely separate. Something to keep in mind when
instantiating SyncContext multiple times (MB#8006).

Code may no longer make assumptions in which config node a property is
stored. This is determined by the new getNode() calls based on the
property attributes (hidden, sharing). The new layout is represented as
a set of config nodes. Older layouts use the same set of nodes with
identical instances assigned to them, if they don't really have separate
files for each of them.

SyncSourceNodes no longer grants direct access to the nodes, to catch
code which incorrectly access a specific node directly. For the same
reason the name of the nodes changed.

Code which needs access to all hidden or all visible properties now
does this via a config node returned by getProperties(). Currently
this is identical to the underlying nodes. Once the new layout is
active, this node will act as a multiplexer which gathers properties
from all underlying nodes when reading and picks the right one when
writing.

The "change ID" parameter for sources has been obsolete for a while
and was removed.

Reorganized the property registration so that it is a bit easier
to see which properties are hidden and which use non-default sharing.
The default sharing is "no sharing".

Some other code was improved while touching it:
- removed useless visibility[] array in favor of a i != 0 check in
  SyncConfig::copy()
- added default parameters to save/checkPassword() methods
- some constness definition changes
- Property::getProperty() is a virtual call which could only be
  overloaded in one case because the constness was wrong; now
  getProperty() always returns the string value and getPropertyValue()
  some other kind of representation of it, depending on the
  class.
- ConstSyncSourceNodes is based on SyncSourceNodes instead of duplicating
  it, which simplifies the implementation.

The simplified SyncSourceAdmin API changed slightly: instead of passing
a pointer to the source's SyncSourceNodes, the default nodes are now
found via the SyncSource pointer. For callers this is a bit less
work and it is more general.
2009-11-25 16:57:50 +01:00
Patrick Ohly 607b54860d Merge branch 'master' into dbus-api 2009-10-20 14:32:40 +02:00
Zhu, Yongsheng 3e52d52f0c SyncSource: change names for m_incomingScript and m_outgointScript
SynthesisInfo has 2 members m_incomingScript and m_outgointScript
which are used for beforewritescript and afterreadscript.
This could make code confusing. Change their names
2009-10-15 11:04:36 +08:00
Patrick Ohly 8399970c48 SyncML server: handle admin data inside SyncEvolution, use <simpleauthuser/pw>
Previously, sync failed because the datastore configuration specified
no means of storing the admin data (single chunk of text and local ID/remote ID
mapping). This could have been added by configuring the SDK_textdb as
<plugin_admin_module>.

Instead this patch implements the functionality inside SyncEvolution,
using a new ".server.ini" config node for the mapping and an
internal "adminData" property for the admin data text chunk. This is
more natural because it keeps the data under our control.

Authentication is configured via <simpleauthuser/pw>. In contrast to
using the SDK_textdb, this allows choosing the username and password.
Ultimately this should also be done inside SyncEvolution, to avoid
writing the username/password into the XML (unsolved encoding issue)
and into log files (privacy issue).
2009-10-07 18:18:10 +02:00
Patrick Ohly 546b97308d sync progress: generate information about inactive sources
Sources which aren't active during a sync exist in the SyncEvolution
and therefore GUIs may show them. The Synthesis engine isn't told
about these sources, so it won't generate any events for them.

This patch generates the normal 100% done events and the final
source is "done" events inside the EvolutionSyncClient before even
invoking the Synthesis engine. That way GUIs don't have to treat
these inactive sources in any special way.

The command line output is aware of this change and suppresses
output for inactive sources, except for a single INFO line which
tells the user that the source is inactive.

Because of the way the internal API works, it is necessary to
instantiate a dummy SyncSource with no config nodes.
2009-10-07 18:14:12 +02:00
Patrick Ohly 71fbf32c94 files and classes renamed, include statements cleaned up
The intention is to get rid of the historic and inconsistent
naming of some classes and their corresponding files:
* EvolutionSyncClient = class derived from Funambol's SyncClient,
* SyncEvolutionConfig = SyncEvolution's config

With the strict 'namespace SyncEvo' and the syncevo/ path prefix for
most header files it is no longer necessary to have "SyncEvolution" or
"Evolution" in the names. This patch thus renames as follows:
  EvolutionSyncClient => SyncContext
  EvolutionSmartPtr => SmartPtr
  SyncEvolutionCmdline => Cmdline
  SyncEvolutionConfig => SyncConfig
  SyncEvolutionUtil => util

The former EvolutionSyncClient always had a role that went beyond just
running a sync, for example it also provided config access. With the
upcoming server support it also won't be just a client. Thus the new
name "SyncContext".

The 'syncevo/' prefix is used throughout the code now.

removed whenever the prefix made it clear that the file belongs
to SyncEvolution. This helps finding incorrect include paths.

Quotes should be used exclusively for SyncEvolution files which don't
have a specific prefix yet (test.h, config.h) to help identifying
them.
2009-10-05 14:49:32 +02:00
Patrick Ohly f87ffd682d introduced "namespace SyncEvo" consistently
Added syncevo/declarations.h, which has

This is now used for all SyncEvolution source files, except
for the GTK UI, which is written in plain C. In the library
it helps to avoid name clashes.

The reason for using defines instead of spelling out "namespace SyncEvo"
is twofold:
1. if that should ever become necessary, it is easier to
   rename the namespace via configure options by changing
   the define
2. editors don't indent the whole file content
2009-10-02 17:27:45 +02:00
Patrick Ohly 6442a46af5 revised backend API: fixed potential crash after calling SyncSourceBackendDebug/Info()
std::iostream.str() created a temporary std::string which was
destructed when these functions returned, therefore
the c_str() pointer returned by these functions was invalid.

Changed the return type so that a dynamically created std::string
can be returned. Moved the functions into SyncSource, because
conceptually they are related to SyncSource::createSource().
2009-09-27 23:06:52 +02:00
Chen Congwu 35ee636619 Dynamic loadable backends: repackage libsyncevolution to enable dynamic loadable backends
Install head files to a standard path, the remaining dependencies are
synthesis and boost
client-test is portable when ENABLE_MODULES is defined, no longer link to
backends libraries.

Add --enable-developer-mode, in which mode the backend scan path will be
under current build directory for development purposes.
2009-09-23 07:35:25 +02:00
Chen Congwu 0579e1d0d2 SyncEvolution core: rename core to syncevo 2009-09-23 07:35:24 +02:00
Renamed from src/core/SyncSource.h (Browse further)