Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
457 rajveer 1
package in.shop2020.util;
2
 
3
import in.shop2020.metamodel.definitions.Catalog;
4
import in.shop2020.metamodel.definitions.DefinitionsContainer;
5
import in.shop2020.metamodel.definitions.EntityContainer;
6
 
7
/*
8
 * @author rajveer 
9
 * 
10
 *
11
 */
12
 
13
public class ContentMigrator {
14
	private String sourceDbPath;
15
	private String destinationDbPath;
16
 
17
	public static void main(String[] args) throws Exception {
18
		String usage = "Usage: ContentMigrator {source db path}{destination db path}";
19
 
20
		String sourceDbPath = null, destinationDbPath = null;
21
		if(args.length < 2) {
22
			System.out.println(usage);
23
			System.exit(-1);
24
		}else{
25
			sourceDbPath = args[0];
26
			destinationDbPath = args[1];
27
		}
28
 
29
		ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath, destinationDbPath);
30
		boolean result = contentmigrator.migrate();
31
		System.out.println("Content migration status:  "+ result);
32
	}
33
 
34
	public ContentMigrator(String sourceDbPath, String destinationDbPath) {
35
		this.sourceDbPath = sourceDbPath;
36
		this.destinationDbPath = destinationDbPath;
37
	}
473 rajveer 38
	/**
39
	 * this function will read source definition and source entities, and will convert
40
	 * source entities to destination entities according to destination definitions.  
41
	 * 
42
	 * @return boolean
43
	 */
457 rajveer 44
	public boolean migrate(){
473 rajveer 45
		DefinitionsContainer sourceDefs = new DefinitionsContainer(sourceDbPath);
46
		DefinitionsContainer destinationDefs = new DefinitionsContainer(destinationDbPath);
47
		EntityContainer sourceEnts = new EntityContainer(sourceDbPath);
48
		EntityContainer destinationEnts = new EntityContainer(destinationDbPath);
49
 
50
 
457 rajveer 51
		return true;
52
	}
53
}