1 |
joko |
1.1 |
=pod |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
=head1 NEWS |
5 |
|
|
|
6 |
|
|
|
7 |
joko |
1.2 |
=head4 2003-02-09 - backward compatibility with custom application |
8 |
joko |
1.1 |
|
9 |
joko |
1.2 |
- Tangram <-> .csv |
10 |
|
|
- Tangram <-> mysql |
11 |
|
|
- Tangram <-> perl-code |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
=head4 2003-01-18 - start integration with Torus |
15 |
|
|
|
16 |
|
|
- MAPI <-> LDAP |
17 |
|
|
- please look at http://www.netfrag.org/horde/chora/cvs.php/perl/scripts/outlook2ldap/ |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
=head4 2002-10-10 - initial commit |
21 |
|
|
|
22 |
|
|
- Tangram <-> mysql |
23 |
joko |
1.1 |
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
=head1 DESCRIPTION |
27 |
|
|
|
28 |
joko |
1.2 |
Data::Transfer::Sync is a module providing a generic synchronization process |
29 |
|
|
across arbitrary/multiple storages based on a ident/checksum mechanism. |
30 |
|
|
It sits on top of Data::Storage. |
31 |
|
|
|
32 |
joko |
1.1 |
|
33 |
|
|
|
34 |
|
|
=head1 REQUIREMENTS |
35 |
|
|
|
36 |
|
|
For full functionality: |
37 |
joko |
1.2 |
Data::Compare |
38 |
joko |
1.1 |
Data::Storage |
39 |
|
|
Data::Transform |
40 |
joko |
1.2 |
... and all their dependencies. |
41 |
joko |
1.1 |
|
42 |
|
|
|
43 |
joko |
1.2 |
=head1 AUTHORS / COPYRIGHT / LICENSE |
44 |
joko |
1.1 |
|
45 |
joko |
1.2 |
The Data::Transfer::Sync module is Copyright (c) 2002 Andreas Motl. |
46 |
|
|
All rights reserved. |
47 |
joko |
1.1 |
|
48 |
joko |
1.2 |
Code contributions, suggestions, support and ideas by |
49 |
|
|
Sebastian Utz <su@tunemedia.de> and Jan Hoffmann <jan@romain-volk.com>. |
50 |
|
|
|
51 |
|
|
You may distribute it under the terms of either the GNU General Public |
52 |
|
|
License or the Artistic License, as specified in the Perl README file. |
53 |
joko |
1.1 |
|
54 |
|
|
|
55 |
|
|
=head1 SUPPORT / WARRANTY |
56 |
|
|
|
57 |
joko |
1.2 |
Data::Transfer::Sync is free software. IT COMES WITHOUT WARRANTY OF ANY KIND. |
58 |
|
|
|
59 |
|
|
Please feel free to contact me at <andreas.motl@ilo.de>. |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
=head1 EXAMPLE OUTPUT CHUNKS |
64 |
|
|
|
65 |
|
|
=head2 Synchronizing orm objects against entries in a .csv file - 17 items modified |
66 |
|
|
|
67 |
|
|
notice: PULL INTO backend NODE * TYPE Country SELECT NODE * TYPE [n/a] FROM base USING MODULE BizWorks::ResourceMapping; |
68 |
|
|
notice: OEF::Script::AbstractFeeder: |
69 |
|
|
- Loading data of type [n/a] and |
70 |
|
|
filtered by * from the storage named base |
71 |
|
|
to the storage named backend - filtered by *. |
72 |
|
|
- Will attempt to convert the data to Country. |
73 |
|
|
info: Data::Transfer::Sync::API->syncNodes: source=backend/* [Country] <- target=base/* [] |
74 |
|
|
:c:c:c:c:c:c:c:ctr:c:c:c:c:c:c:c:ctr:c:c:c:c:c:c:ctr:c:ctr:c:c:c:c:c:c:c:c:c:c:c:ctr:c:c:c:ctr:c:c:c:c:c:c:c:ctr:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c |
75 |
|
|
:c:c:c:c:c:c:c:c:ctr:c:c:c:c:c:c:c:c:c:c:c:ctr:c:c:c:c:ctr:c:c:c:ctr:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:ctr:ctr:c:c:c:c:ctr:c:c:c:c:c:c:c |
76 |
|
|
:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:ctr:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:ctr:c:c:ctr:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c |
77 |
|
|
info: Data::Transfer::Sync::Core->_startsync: statistics: in_sync: 180 / total: 197 / attempt_modify: 17 / ok: 17 |
78 |
|
|
|
79 |
|
|
=head2 Synchronizing orm objects against entries in a .csv file - in-sync |
80 |
|
|
|
81 |
|
|
notice: PULL INTO backend NODE * TYPE Country SELECT NODE * TYPE [n/a] FROM base USING MODULE BizWorks::ResourceMapping; |
82 |
|
|
notice: OEF::Script::AbstractFeeder: |
83 |
|
|
- Loading data of type [n/a] and |
84 |
|
|
filtered by * from the storage named base |
85 |
|
|
to the storage named backend - filtered by *. |
86 |
|
|
- Will attempt to convert the data to Country. |
87 |
|
|
info: Data::Transfer::Sync::API->syncNodes: source=backend/* [Country] <- target=base/* [] |
88 |
|
|
:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c |
89 |
|
|
:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c |
90 |
|
|
:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c:c |
91 |
|
|
info: Data::Transfer::Sync::Core->_startsync: statistics: in_sync: 197 / total: 197 |
92 |
joko |
1.1 |
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
=head1 BUGS |
96 |
|
|
|
97 |
|
|
When in "import" mode for windows file - DBD::AutoCSV may hang. |
98 |
|
|
Hint: Maybe the source node contains an ident-, but no checksum-column? |
99 |
|
|
|
100 |
|
|
|
101 |
|
|
=head1 USER LEVEL ERRORS |
102 |
|
|
|
103 |
|
|
=head4 Mapping |
104 |
|
|
|
105 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
106 |
|
|
info: BizWorks::Process::Setup->syncResource( source_node Currency mode PULL erase 0 import 0 )critical: BizWorks::Process::Setup->startSync: Can't access mapping for node "Currency" - please check BizWorks::ResourceMapping. |
107 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
108 |
|
|
You have to create a sub for each node used in synchronization inside named Perl module. The name of this sub _must_ match |
109 |
|
|
the name of the node you want to sync. This sub holds mapping metadata to give the engine hints about how |
110 |
|
|
to access the otherwise generic nodes. |
111 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
=head4 DBD::AutoCSV's rulebase |
115 |
|
|
|
116 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
117 |
|
|
info: BizWorks::Process::Setup->syncResource( source_node Currency mode PULL erase 0 import 0 ) |
118 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv |
119 |
|
|
|
120 |
|
|
Execution ERROR: Error while scanning: Missing first row or scanrule not applied. at C:/home/amo/develop/netfrag.org/nfo/perl/libs/DBD/CSV.p |
121 |
|
|
m line 165, <GEN9> line 1. |
122 |
|
|
called from C:/home/amo/develop/netfrag.org/nfo/perl/libs/Data/Storage/Handler/DBI.pm at 123. |
123 |
|
|
|
124 |
|
|
DBI-Error: DBD::AutoCSV::st fetchrow_hashref failed: Attempt to fetch row from a Non-SELECT statement |
125 |
|
|
notice: Data::Transfer::Sync->syncNodes: No nodes to synchronize. |
126 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
127 |
|
|
DBD::AutoCSV contains a rulebase which is spooled down while attempting to guess the style of the csv file regarding |
128 |
|
|
parameters like newline (eol), column-seperation-character (sep_char), quoting character (quote_char). |
129 |
|
|
If this spool runs out of entries and no style could be resolved, DBD::CSV dies causing this "Execution ERROR" which |
130 |
|
|
results in a "DBI-Error" afterwards. |
131 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
132 |
|
|
|
133 |
|
|
|
134 |
|
|
=head4 Check structure of source node |
135 |
|
|
|
136 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
137 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv |
138 |
|
|
critical: Data::Transfer::Sync->syncNodes: Can not synchronize: No ident found in source node, maybe try to "import" this node first. |
139 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
140 |
|
|
If lowlevel detection succeeds, but no other required informations are found, this message is issued. |
141 |
|
|
"Other informations" might be: |
142 |
|
|
- column-header-row completely missing |
143 |
|
|
- ident column is empty |
144 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
145 |
|
|
|
146 |
|
|
|
147 |
|
|
=head4 Modify structure of source node |
148 |
|
|
|
149 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
150 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv |
151 |
|
|
info: Data::Transfer::Sync->_prepareNode_MetaProperties( descent source ) |
152 |
|
|
warning: Data::Transfer::Sync->_prepareNode_MetaProperties: node is lacking meta properties - will try to alter... |
153 |
|
|
SQL ERROR: Command 'ALTER' not recognized or not supported! |
154 |
|
|
|
155 |
|
|
SQL ERROR: Command 'ALTER' not recognized or not supported! |
156 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
157 |
|
|
The Engine found a node which structure does not match the required. It tries to alter this automatically - only when doing "import" - |
158 |
|
|
but the DBD driver (in this case DBD::CSV) gets in the way croaking not to be able to do this. |
159 |
|
|
This could also appear if your database connection has insufficient rights to modify the database structure. |
160 |
|
|
DBD::CSV croaks because it doesn't implement the ALTER command, so please edit your columns manually. |
161 |
|
|
Hint: Add columns with the names of your "ident" and "checksum" property specifications. |
162 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
163 |
|
|
|
164 |
|
|
|
165 |
|
|
=head4 Load source node by ident |
166 |
|
|
|
167 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
168 |
|
|
info: Data::Transfer::Sync->_prepareNode_DummyIdent( descent source ) |
169 |
|
|
pcritical: Data::Transfer::Sync->_modifyNode failed: "source" node is empty. |
170 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
171 |
|
|
The source node could not be loaded. Maybe the ident is missing. Please check manually. |
172 |
|
|
Hint: Like above, the ident and/or checksum columns may be missing.... |
173 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
174 |
|
|
|
175 |
|
|
|
176 |
|
|
=head1 TODO |
177 |
|
|
|
178 |
joko |
1.2 |
o sub _resolveIdentProvider |
179 |
|
|
x wrap _doModifySource and _doTransferTarget around a core function which can change virtually any type of node |
180 |
|
|
x split this module up into Sync.pm, Sync/Core.pm, Sync/Compare.pm and Sync/Compare/Checksum.pm |
181 |
|
|
o introduce _compareNodes as a core method and wrap it around methods in Sync/Compare/Checksum.pm |
182 |
|
|
x introduce Sync/Compare/MyComparisonImplementation.pm |
183 |
|
|
o some generic deferring method - e.g. "$self->defer(action)" - to be able to accumulate a bunch of actions for later processing |
184 |
joko |
1.1 |
- this implies everything done is _really_ split up into generic actions - how else would we defer them??? |
185 |
|
|
- example uses: |
186 |
|
|
- fetch whole checksum list from node |
187 |
|
|
- remember source ident retransmits |
188 |
|
|
- remember: this is convenient - and maybe / of course faster - but we'll loose "per-node-atomic" operations |
189 |
joko |
1.2 |
o feature: mechanism to implicit inject checksum property to nodes (alter table / modify schema) |
190 |
|
|
o expand statistics / keep track of: |
191 |
joko |
1.1 |
- touched/untouched nodes |
192 |
joko |
1.2 |
o full sync |
193 |
joko |
1.1 |
- just do a push and a pull for now but use stats for touched nodes in between to speed up things |
194 |
joko |
1.2 |
o introduce some new metadata flags for a descent |
195 |
joko |
1.1 |
- isNewNodePropagator |
196 |
joko |
1.2 |
x isWriteProtected |
197 |
joko |
1.1 |
|
198 |
|
|
|
199 |
|
|
=cut |