svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / ExpressionEvaluatorImplLibrary.java @ 45789
History | View | Annotate | Download (4.26 KB)
1 |
package org.gvsig.expressionevaluator.impl; |
---|---|
2 |
|
3 |
import org.gvsig.expressionevaluator.spi.BaseExpressionEvaluator; |
4 |
import org.gvsig.expressionevaluator.DataTypes; |
5 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLibrary; |
6 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
7 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager; |
8 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceJsonArrayToString; |
9 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceJsonObjectToString; |
10 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceToExpression; |
11 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceToJson.CoerceToJsonArray; |
12 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceToJson.CoerceToJsonObject; |
13 |
import org.gvsig.expressionevaluator.impl.coercion.CoerceToString; |
14 |
import org.gvsig.expressionevaluator.impl.grammars.BasicGrammarFactory; |
15 |
import org.gvsig.expressionevaluator.impl.repr.ReprBoolean; |
16 |
import org.gvsig.expressionevaluator.impl.repr.ReprCharSequence; |
17 |
import org.gvsig.expressionevaluator.impl.repr.ReprDate; |
18 |
import org.gvsig.expressionevaluator.impl.repr.ReprNumber; |
19 |
import org.gvsig.expressionevaluator.impl.repr.ReprSQLDate; |
20 |
import org.gvsig.expressionevaluator.impl.repr.ReprSQLTime; |
21 |
import org.gvsig.expressionevaluator.impl.repr.ReprSQLTimestamp; |
22 |
import org.gvsig.expressionevaluator.impl.symboltable.AggregateSymbolTableFactory; |
23 |
import org.gvsig.expressionevaluator.impl.symboltable.BasicImageSymbolTableFactory; |
24 |
import org.gvsig.expressionevaluator.impl.symboltable.BookmarksSymbolTableFactory; |
25 |
import org.gvsig.expressionevaluator.impl.symboltable.FoldersSymbolTableFactory; |
26 |
import org.gvsig.expressionevaluator.impl.symboltable.ProgrammingSymbolTableFactory; |
27 |
import org.gvsig.expressionevaluator.impl.symboltable.SQLSymbolTableFactory; |
28 |
import org.gvsig.expressionevaluator.impl.symboltable.UtilsSymbolTableFactory; |
29 |
import org.gvsig.tools.ToolsLibrary; |
30 |
import org.gvsig.tools.ToolsLocator; |
31 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
32 |
import org.gvsig.tools.library.AbstractLibrary; |
33 |
import org.gvsig.tools.library.LibraryException; |
34 |
|
35 |
public class ExpressionEvaluatorImplLibrary extends AbstractLibrary { |
36 |
|
37 |
@Override
|
38 |
public void doRegistration() { |
39 |
registerAsImplementationOf(ExpressionEvaluatorLibrary.class); |
40 |
require(ToolsLibrary.class); |
41 |
} |
42 |
|
43 |
@Override
|
44 |
protected void doInitialize() throws LibraryException { |
45 |
ExpressionEvaluatorLocator.registerManager(DefaultExpressionEvaluatorManager.class); |
46 |
} |
47 |
|
48 |
@Override
|
49 |
protected void doPostInitialize() throws LibraryException { |
50 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
51 |
|
52 |
manager.registerSymbolTable(new SQLSymbolTableFactory());
|
53 |
manager.registerSymbolTable(new UtilsSymbolTableFactory());
|
54 |
manager.registerSymbolTable(new BasicImageSymbolTableFactory());
|
55 |
manager.registerSymbolTable(new ProgrammingSymbolTableFactory());
|
56 |
manager.registerSymbolTable(new FoldersSymbolTableFactory());
|
57 |
manager.registerSymbolTable(new AggregateSymbolTableFactory());
|
58 |
manager.registerSymbolTable(new BookmarksSymbolTableFactory());
|
59 |
|
60 |
manager.registerGrammar(new BasicGrammarFactory());
|
61 |
|
62 |
DefaultExpression.registerPersistence(); |
63 |
BaseExpressionEvaluator.registerPersistence(); |
64 |
|
65 |
DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
66 |
|
67 |
dataTypesManager.addCoercion(DataTypes.EXPRESSION, new CoerceToExpression());
|
68 |
dataTypesManager.addCoercion(DataTypes.STRING,new CoerceToString());
|
69 |
dataTypesManager.addCoercion(DataTypes.STRING,new CoerceJsonObjectToString());
|
70 |
dataTypesManager.addCoercion(DataTypes.STRING,new CoerceJsonArrayToString());
|
71 |
dataTypesManager.addCoercion(DataTypes.JSONOBJECT, new CoerceToJsonObject());
|
72 |
dataTypesManager.addCoercion(DataTypes.JSONARRAY, new CoerceToJsonArray());
|
73 |
|
74 |
ToolsLocator.registerScriptManager(DefaultExpressionEvaluatorManager.class); |
75 |
|
76 |
ReprBoolean.selfRegister(); |
77 |
ReprCharSequence.selfRegister(); |
78 |
ReprNumber.selfRegister(); |
79 |
ReprDate.selfRegister(); |
80 |
ReprSQLDate.selfRegister(); |
81 |
ReprSQLTime.selfRegister(); |
82 |
ReprSQLTimestamp.selfRegister(); |
83 |
DefaultExpression.selfRegister(); |
84 |
|
85 |
} |
86 |
} |
87 |
|