|
|
|
@ -7,12 +7,6 @@ import com.fr.base.TableData;
|
|
|
|
|
import com.fr.base.env.serializer.OldSerializerAdapter; |
|
|
|
|
import com.fr.base.env.serializer.ProcedureDataModelSerializer; |
|
|
|
|
import com.fr.base.env.user.RemoteUserCenter; |
|
|
|
|
import com.fr.base.operator.connection.DataConnectionOperator; |
|
|
|
|
import com.fr.base.operator.connection.LocalDataConnectionOperator; |
|
|
|
|
import com.fr.base.operator.file.FileOperator; |
|
|
|
|
import com.fr.base.operator.file.LocalFileOperator; |
|
|
|
|
import com.fr.core.env.operator.envinfo.EnvInfoOperator; |
|
|
|
|
import com.fr.core.env.operator.envinfo.LocalEnvInfoOperator; |
|
|
|
|
import com.fr.core.env.operator.user.UserCenter; |
|
|
|
|
import com.fr.core.env.proxy.EnvProxy; |
|
|
|
|
import com.fr.data.core.db.TableProcedure; |
|
|
|
@ -26,7 +20,6 @@ import com.fr.general.ComparatorUtils;
|
|
|
|
|
import com.fr.module.Activator; |
|
|
|
|
import com.fr.start.EnvSwitcher; |
|
|
|
|
import com.fr.start.StartServer; |
|
|
|
|
import com.fr.startup.opeartors.LocalUserCenter; |
|
|
|
|
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.io.OutputStream; |
|
|
|
@ -50,42 +43,38 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); |
|
|
|
|
|
|
|
|
|
initEnvOperators(); |
|
|
|
|
initDesignerEnv(); |
|
|
|
|
|
|
|
|
|
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); |
|
|
|
|
//设置好环境即可,具体跟环境有关的模块会自动调用
|
|
|
|
|
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void stop() { |
|
|
|
|
//清空模块
|
|
|
|
|
getRoot().removeSingleton(EnvSwitcher.class); |
|
|
|
|
} |
|
|
|
|
private void initDesignerEnv() { |
|
|
|
|
|
|
|
|
|
private void initEnvOperators() { |
|
|
|
|
addSerializers(); |
|
|
|
|
EnvProxy.addLocalService(FileOperator.class, new LocalFileOperator()); |
|
|
|
|
EnvProxy.addLocalService(DataConnectionOperator.class, new LocalDataConnectionOperator()); |
|
|
|
|
EnvProxy.addLocalService(EnvInfoOperator.class, new LocalEnvInfoOperator()); |
|
|
|
|
EnvProxy.addLocalService(UserCenter.class, new LocalUserCenter()); |
|
|
|
|
EnvProxy.addRemoteService(UserCenter.class, new RemoteUserCenter()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addSerializers() { |
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer()); |
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<ModifiedTable>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(ModifiedTable obj, OutputStream out) throws Exception { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLModifiedTables(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<ModifiedTable>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public ModifiedTable desializer(InputStream in) throws Exception { |
|
|
|
|
public ModifiedTable deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLModifiedTables(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -93,14 +82,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<Connection>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(Connection obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileDatabaseConnection(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<Connection>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Connection desializer(InputStream in) throws Exception { |
|
|
|
|
public Connection deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLDatabaseConnection(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -108,14 +101,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<FileNode[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(FileNode[] obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileNodes(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<FileNode[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public FileNode[] desializer(InputStream in) { |
|
|
|
|
public FileNode[] deserializer(InputStream in) { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLFileNodes(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -123,14 +120,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<TableProcedure[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(TableProcedure[] obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileSQLTable(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public TableProcedure[] desializer(InputStream in) throws Exception { |
|
|
|
|
public TableProcedure[] deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLSQLTables(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -138,14 +139,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<TableData>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(TableData obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileTableData(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<TableData>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public TableData desializer(InputStream in) throws Exception { |
|
|
|
|
public TableData deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLTableData(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -153,14 +158,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<Parameter[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(Parameter[] obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileParameters(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<Parameter[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Parameter[] desializer(InputStream in) throws Exception { |
|
|
|
|
public Parameter[] deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLParameters(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -168,14 +177,18 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<StoreProcedure>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(StoreProcedure obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileStoreProcedure(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<StoreProcedure>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public StoreProcedure desializer(InputStream in) throws Exception { |
|
|
|
|
public StoreProcedure deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLStoreProcedure(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -183,18 +196,29 @@ public class DesignerEnvProvider extends Activator {
|
|
|
|
|
|
|
|
|
|
EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>( |
|
|
|
|
new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void serializer(StoreProcedureParameter[] obj, OutputStream out) { |
|
|
|
|
|
|
|
|
|
DavXMLUtils.writeXMLFileParameters(obj, out); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public StoreProcedureParameter[] desializer(InputStream in) throws Exception { |
|
|
|
|
public StoreProcedureParameter[] deserializer(InputStream in) throws Exception { |
|
|
|
|
|
|
|
|
|
return DavXMLUtils.readXMLStoreProcedureParameters(in); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void stop() { |
|
|
|
|
//清空模块
|
|
|
|
|
getRoot().removeSingleton(EnvSwitcher.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|