Commit graph

19 commits

Author SHA1 Message Date
Patrick Ohly
87b4eca964 make dist: FileConfigNode.h must be public API
Because the template code in SyncConfig.h uses
it, FileConfigNode.h must be included in the set
of installed header files. Found by nightly testing.
2010-01-20 10:01:32 +01:00
Patrick Ohly
bf8b29f7d9 LCS: Longest Common Subsequence
The code was originally written for an improved diff to be used in
synccompare. It improves upon the normal LCS by taking into account
that the some subsequences might be "nicer" than others of the same
length, for example because they cross less "boundaries" inside the
sequences.

The reason for adding it now is for use in a fuzzy manufacturer/model
matching.
2010-01-19 17:23:07 +01:00
Patrick Ohly
aa13c8446a Merge remote branch 'origin/syncevolution-0-9-branch'
Conflicts:
	configure-pre.in
	src/syncevo/Makefile.am

Version conflict in configure and unrelated changes near
same line in Makefile.
2009-11-30 21:41:53 +01:00
Patrick Ohly
0944e3eda5 installation: templates now in $(datadir)/syncevolution/templates (MB #7808)
The previous location was /usr/etc/syncevolution. It should have been
/etc/syncevolution in our debs, with proper declaration as system
config files. The intention was that system admins can add or modify
templates.

Not particularly likely, so now template files are only searched in
/usr/share/syncevolution/templates (or whatever was chosen with
configure --datadir).

Also added a README to that directory, warning that copying these
files will lead to incomplete configs. Each main config.ini carries
a similar comment, for those who miss the README.
2009-11-27 14:43:22 +01:00
Patrick Ohly
b4435ce13b config: share properties between peers, configuration view without peer
This patch makes the configuration layout with per-source and per-peer
properties the default for new configurations. Migrating old
configurations is not implemented. The command line has not
been updated at all (MB #8048). The D-Bus API is fairly complete,
only listing sessions independently of a peer is missing (MB #8049).

The key concept of this patch is that a pseudo-node implemented by
MultiplexConfigNode provides a view on all user-visible or hidden
properties. Based on the property name, it looks up the property
definition, picks one of the underlying nodes based on the property
visibility and sharing attributes, then reads and writes the property
via that node. Clearing properties is not needed and not implemented,
because of the uncertain semantic (really remove shared properties?!).

The "sync" property must be available both in the per-source config
(to pick a backend independently of a specific peer) and in the
per-peer configuration (to select a specific data format). This is
solved by making the property special (SHARED_AND_UNSHARED flag) and
then writing it into two nodes. Reading is done from the more specific
per-peer node, with the other node acting as fallback.

The MultiplexConfigNode has to implement the FilterConfigNode API
because it is used as one by the code which sets passwords in the
filter. For this to work, the base FilterConfigNode implementation must
use virtual method calls.

The TestDBusSessionConfig.testUpdateConfigError checks that the error
generated for an incorrect "sync" property contains the path of the
config.ini file. The meaning of the error message in this case is that
the wrong value is *for* that file, not that the property is already
wrong *in* the file, but that's okay.

The MultiplexConfigNode::getName() can only return a fixed name. To
satisfy the test and because it is the right choice at the moment for
all properties which might trigger such an error, it now is configured
so that it returns the most specific path of the non-shared
properties.

"syncevolution --print-config" shows errors that are in files. Wrong
command line parameters are rejected with a message that refers to the
command line parameter ("--source-property sync=foo").
A future enhancement would be to make the name depend on the
property (MB#8037).

Because an empty string is now a valid configuration name (referencing
the source properties without the per-peer properties) several checks
for such empty strings were removed. The corresponding tests were
updated resp. removed. Instead of talking about "server not found",
the more neutral name "configuration" is used. The new
TestMultipleConfigs.testSharing() covers the semantic of sharing
properties between multiple configs.

Access to non-existant nodes is routed into the new
DevNullConfigNode.  It always returns an empty string when reading and
throws an error when trying to write into it. Unintentionally writing
into a config.ini file therefore became harder, compared with the
previous instantiation of SyncContext() with empty config name.

The parsing of incoming messages uses a SyncContext which is bound to
a VolatileConfigNode. This allows reading and writing of properties
without any risk of touching files on disk.

The patch which introduced the new config nodes was not complete yet
with regards to the new layout. Removing nodes and trees used the
wrong root path: getRootPath() refers to the most specific peer
config, m_root to the part without the peer path. SyncConfig must
distinguish between a view with peer-specific properties and one
without, which is done by setting the m_peerPath only if a peer was
selected. Copying properties must know whether writing per-specific
properties ("unshared") is wanted, because trying to do it for a view
without those properties would trigger the DevNullConfigNode
exception.

SyncConfig::removeSyncSource() removes source properties both in the
shared part of the config and in *all* peers. This is used by
Session.SetConfig() for the case that the caller is a) setting instead
of updating the config and b) not providing any properties for the
source. This is clearly a risky operation which should not be done
when there are other peers which still use the source. We might have a
problem in our D-Bus API definition for "removing a peer
configuration" (MB #8059) because it always has an effect on other
peers.

The property registries were initialized implicitly before. With the
recent changes it happened that SyncContext was initialized to analyze
a SyncML message without initializing the registry, which caused
getRemoteDevID() to use a property where the hidden flag had not been
set yet.

Moving all of these additional flags into the property constructors is
awkward (which is why they are in the getRegistry() methods), so this
was fixed by initializing the properties in the SyncConfig
constructors by asking for the registries. Because there is no way to
access them except via the registry and SyncConfig instances (*), this
should ensure that the properties are valid when used.

(*) Exception are some properties which are declared publicly to have access
to their name. Nobody's perfect...
2009-11-25 16:57:50 +01:00
Chen Congwu
3f04de4833 OBEX Client Transport: in-process OBEX client (binding over Bluetooth, #5188)
Outgoing OBEX connection implementation, only binds over Bluetooth now.

Integrates with gmainloop so that the opertaions in the transport will not
block the whole application.

It uses Bluetooth sdp to automatically discovery the corresponding service
channel providing SyncML service; the process is asynchronous. Callback
sdp_source_cb and sdp_callback are used for this purpose. sdp_source_cb is a
GIOChannel watch event callback which poll the underlying sdp socket, the
sdp_callback is invoked by Bluez during processing sdp packets.

Callback obex_fd_source and obex_callback are related to the OBEX processing
(Connect, Put, Get, Disconnect). obex_fd_source is a GIOChannel event source
callback which poll the underlying OBEX interface, the obex_callback is
invoked by libopenobex when it needs to delivering events to the application.

Connect is splited by several steps, see CONNECT_STATUS for more detail.
Disconnect will be invoked when shutDown is called or processing in
obex_fd_source_cb is failed, timeout occurs or user suspention. It will first
try to send a "Disconnect" command to server and waiting for response. If
such opertaion is failed it will disconnect anyway. It is important to call
wait after shutdown to ensure the transport is properly cleaned up.

Each callback function is protected by a "Try-catch" block to ensure no
exception is thrown in the C stack. This is important otherwise the application
will abort if an exception is really thrown.

Using several smart pointers to avoid potential resource leak. After initialized
the resource is held by ObexTransportAgent. Copy the smart pointer to the local
stack entering a function and return to ObexTransportAgent if the whole
process is correct and we want to continue. First, it ensures the resource is
released at least during ObexTransportAgent destructing; Second, it can also
try to release the resource as early as possible. For example cxxptr<ObexEvent>
will release the resource during each wait() so that the underlying poll will
not be processed if no transport activity is expected by the application.

"SyncURL" is used consistently for the address of the remote peer to
contact with.
2009-11-17 13:15:54 +08:00
Patrick Ohly
607b54860d Merge branch 'master' into dbus-api 2009-10-20 14:32:40 +02:00
Patrick Ohly
df81ccba65 packaging: another fix for installcheck-local
When the installation is in the standard location, pkg-config won't
print -I and -L options. The "redirect into DESTDIR via sed" trick
depended on that, meaning that the files were not found during the
nightly build.

Now -I and -L for the DESTDIR dirs is added explicitly. LD_LIBRARY_PATH
also has to be set, for libsmltk to be found.
2009-10-15 14:44:50 +02:00
Patrick Ohly
71b899846b packaging: fix for installcheck
First, installcheck does not imply install. Packaging must
ask for both.

Second, installcheck of header files and libs must be aware
of DESTDIR. src/syncevo/installcheck-local.sh patches the -I and -L
parameters so that it includes the DESTDIR passed to it.

Third, "distbin" overwrites "prefix", which breaks this. Don't
try installcheck as part of that target.
2009-10-14 12:27:41 +02:00
Patrick Ohly
98f83c5b3c syncevo-dbus-server/syncevolution-http-server.py: SyncML HTTP server
This uses the new combined client/server Synthesis engine. When
building shared modules, the engine is opened dynamically only
while needed, thus reducing overall memory consumption.

The HTTP server is implemented in Python, using the the 'twisted'
server framework because it can use the same glib event loop as the
D-Bus binding. This allows us to keep the same event loop running
forever and react to both kinds of events.

The server takes a base url (including host name and port)
and a default configuration as name. The host name is currently
ignored. It could be used to bind to a specific interface.

The path is what a client has to use as part of his sync URL
to synchronize against the default configuration. In addition
the client can add another path to select that as his server
configuration.

For example, if the script is called with
   http://localhost:9000/syncevolution default
then syncURL = http://localhost:9000/syncevolution will synchronize
against the configuration called "default". With syncURL =
http://localhost:9000/syncevolution/my_server, it will
synchronize against "my_server".
2009-10-07 18:15:45 +02:00
Patrick Ohly
18a0d2ad3d TransportAgent: added shutdown(), moved HTTP setup out of core engine
This TransportAgent API revision was done in preparation for transport
agents which do not support HTTP. Forcing them to provide HTTP specific
methods is unnecessary, so now setting things like proxy is done when
constructing an HTTP-based agent in the createTransport() call.
So now the result of createTransport() must be ready for sending messages.

setURL() is still part of the API, because it provides message-specific
information. Perhaps it should be renamed when it is clearer what
the corresponding information in other transports is.

For connection oriented agents a new shutdown() call was introduced.
This gives them a chance to close the connection and inform the
engine about errors during that shutdown.

For servers (which send the last message without expecting a reply),
wait(noReply=true) was added.
2009-10-07 18:10:55 +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
2e938f6520 added developer file install check
The installcheck-local.sh script is invoked after installing the
header files and libs. It locates a C++ compiler (trying a few
candidates and giving up if none works, using -Wall -Werror if
possible) and then checks that every one of our header
files can be included in a C++ file without warnings.

It also links an executable once against libsyncevolution (already
found one bug, the lib wasn't installed with --disable-shared).

The script uses only the information provided by pkg-config based
on our syncevolution.pc, so that is tested, too.
2009-10-02 17:27:45 +02:00
Patrick Ohly
188ab43d09 libsyncevolution: install static version of it
With --disable-shared, the static library wasn't installed
because there were no use cases for it outside of SyncEvolution.
With the backend API, the library would be needed by external
developers who want to build a single-executable SyncML client,
so install it.
2009-10-02 17:27:45 +02:00
Chen Congwu
1d368ff9a8 Enable SQlite backends (MB#5049)
SQLite backends is supported with new syncsoruce api. This demostrates how to
access synthesis data field directly.
Change tracking is done the same as TrackingSyncSource.
2009-09-29 11:38:09 +08:00
Patrick Ohly
61bfc40dac libsyncevolution.so installation: must go into libdir
libsyncevolution.so is now a first-class system library
and therefore should be installed in the normal libdir.
This is also where it was expected by syncevolution.pc.
2009-09-25 08:15:23 +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/Makefile.am (Browse further)