Browse Source

Merge pull request #87 in DESIGN/design from ~HZZZ/design61:feature/10.0 to feature/10.0

* commit '5d0ff4b4f69aff35354879e454c48ceeb09bb0a6':
  env
  env
  env
  merge
master
superman 7 years ago
parent
commit
1d4df31825
  1. 17
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  2. 7
      designer-base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  3. 9
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  4. 29
      designer-base/src/com/fr/design/utils/DesignUtils.java
  5. 8
      designer-base/src/com/fr/env/RemoteEnv.java
  6. 27
      designer-base/src/com/fr/env/SignIn.java
  7. 298
      designer-realize/src/com/fr/start/module/DesignerEnvProvider.java
  8. 12
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

17
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -7,6 +7,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.core.env.resource.EnvConfigUtils; import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -317,7 +318,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); DesignUtils.refreshDesignerFrame();
} }
}, new PluginFilter() { }, new PluginFilter() {
@ -682,10 +683,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 报表运行环境改变时,需要刷新某些面板 * 报表运行环境改变时,需要刷新某些面板
*
* @param env 环境
*/ */
public void refreshEnv(Env env) { public void refreshEnv() {
this.setTitle(); this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView(); DesignerFrameFileDealerPane.getInstance().refreshDockingView();
@ -965,14 +964,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
Env currentEnv = FRContext.getCurrentEnv(); EnvContext.signOut();
try {
EventDispatcher.fire(BEFORE_SIGN_OUT);
currentEnv.signOut();
EventDispatcher.fire(AFTER_SIGN_OUT);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
this.setVisible(false); this.setVisible(false);
this.dispose(); this.dispose();

7
designer-base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
@ -38,9 +37,9 @@ import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler { public class DesignerLogHandler {
protected static final int INFO_INT = com.fr.third.apache.log4j.Level.INFO.toInt(); protected static final int INFO_INT = Level.INFO.intValue();
protected static final int ERROR_INT = com.fr.third.apache.log4j.Level.ERROR.toInt(); protected static final int ERROR_INT = Level.SEVERE.intValue();
protected static final int WARN_INT = com.fr.third.apache.log4j.Level.WARN.toInt(); protected static final int WARN_INT = Level.WARNING.intValue();
private static final int GAP_X = -150; private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60; private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40; private static final int ERRO_GAP_Y = -40;

9
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -10,7 +10,6 @@ import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.LogRecordTime; import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils; import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -43,18 +42,18 @@ public class DesignerSocketIO {
}; };
static { static {
EventDispatcher.listen(EnvEvent.AFTER_SIGN_OUT, new Listener<Null>() { EventDispatcher.listen(EnvEvent.AFTER_SIGN_OUT, new Listener<EnvConfig>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, EnvConfig param) {
if (socketIO.isPresent()) { if (socketIO.isPresent()) {
socketIO.get().close(); socketIO.get().close();
socketIO = Optional.absent(); socketIO = Optional.absent();
} }
} }
}); });
EventDispatcher.listen(EnvEvent.AFTER_SIGN_IN, new Listener<Null>() { EventDispatcher.listen(EnvEvent.AFTER_SIGN_IN, new Listener<EnvConfig>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, EnvConfig param) {
updateSocket(); updateSocket();
} }
}); });

29
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -1,13 +1,14 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.EnvException; import com.fr.base.EnvException;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo; import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants; import com.fr.base.remote.RemoteDeziConstants;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.dav.DavXMLUtils; import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -30,8 +31,11 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
import java.awt.Font;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -183,20 +187,16 @@ public class DesignUtils {
}); });
} }
/** /**
* 当前的报表运行环境切换到env * 当前的报表运行环境切换到env
* *
* @param env 需要切换去的环境 * @param env 需要切换去的环境
*/ */
public static void switchToEnv(Env env) { public static void switchToEnv(EnvConfig env) {
if (env == null) { if (env == null) {
return; return;
} }
Env oldEnv = FRContext.getCurrentEnv();
String oldEnvPath = oldEnv == null ? null : oldEnv.getPath();
// 看一下这个env在DesignerEnvManager里面有没有对应的,有的话就setCurrentEnvName // 看一下这个env在DesignerEnvManager里面有没有对应的,有的话就setCurrentEnvName
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
java.util.Iterator<String> nameIt = envManager.getEnvNameIterator(); java.util.Iterator<String> nameIt = envManager.getEnvNameIterator();
@ -207,14 +207,11 @@ public class DesignUtils {
break; break;
} }
} }
// 更新CurrentEnv于FRContext & DesignerEnvManager EnvContext.signIn(env);
FRContext.setCurrentEnv(env); refreshDesignerFrame();
refreshDesignerFrame(env);
} }
public static void refreshDesignerFrame(Env env) { public static void refreshDesignerFrame() {
final Env run_env = env;
// 刷新DesignerFrame里面的面板 // 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@ -223,7 +220,7 @@ public class DesignUtils {
if (DesignerContext.getDesignerFrame() == null) { if (DesignerContext.getDesignerFrame() == null) {
return; return;
} }
DesignerContext.getDesignerFrame().refreshEnv(run_env); DesignerContext.getDesignerFrame().refreshEnv();
DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变. DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变.
} }
}); });
@ -517,4 +514,4 @@ public class DesignUtils {
} }
} }

8
designer-base/src/com/fr/env/RemoteEnv.java vendored

@ -41,6 +41,7 @@ import com.fr.stable.SvgProvider;
import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.third.guava.base.Strings;
import com.fr.third.guava.collect.ImmutableMap; import com.fr.third.guava.collect.ImmutableMap;
import com.fr.web.ResourceConstants; import com.fr.web.ResourceConstants;
@ -75,6 +76,7 @@ import static com.fr.third.guava.base.Preconditions.checkArgument;
* @author null * @author null
*/ */
public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurable { public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurable {
private static final String CERT_KEY = "javax.net.ssl.trustStore"; private static final String CERT_KEY = "javax.net.ssl.trustStore";
private static final String PWD_KEY = "javax.net.ssl.trustStorePassword"; private static final String PWD_KEY = "javax.net.ssl.trustStorePassword";
private static final String HTTPS_PREFIX = "https:"; private static final String HTTPS_PREFIX = "https:";
@ -138,7 +140,6 @@ public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurabl
} }
/** /**
* nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的 * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的
* *
@ -214,7 +215,7 @@ public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurabl
EnvConstants.USERNAME, getUser(), EnvConstants.USERNAME, getUser(),
EnvConstants.PWD, getPassword()); EnvConstants.PWD, getPassword());
String res = HttpToolbox.post(url, params, headers); String res = HttpToolbox.post(url, params, headers);
if (res == null) { if (Strings.isNullOrEmpty(res)) {
if (needMessage) { if (needMessage) {
JOptionPane.showMessageDialog(component, Inter.getLocText("Datasource-Connection_failed")); JOptionPane.showMessageDialog(component, Inter.getLocText("Datasource-Connection_failed"));
} }
@ -237,7 +238,7 @@ public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurabl
return false; return false;
} else { } else {
if (needMessage) { if (needMessage) {
JOptionPane.showMessageDialog(component, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); JOptionPane.showMessageDialog(component, Inter.getLocText("Datasource-Connection_failed"));
} else { } else {
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"}));
} }
@ -818,7 +819,6 @@ public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurabl
} }
/** /**
* 获取当前env的build文件路径 * 获取当前env的build文件路径
*/ */

27
designer-base/src/com/fr/env/SignIn.java vendored

@ -1,13 +1,11 @@
package com.fr.env; package com.fr.env;
import com.fr.base.FRContext;
import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext; import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent; import com.fr.core.env.EnvEvent;
import com.fr.core.env.resource.EnvConfigUtils; import com.fr.design.mainframe.DesignerContext;
import com.fr.core.env.resource.RemoteEnvConfig; import com.fr.design.mainframe.DesignerFrame;
import com.fr.dav.LocalEnv;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -17,7 +15,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class SignIn { public class SignIn {
@ -26,20 +23,14 @@ public class SignIn {
EventDispatcher.listen(EnvEvent.CONNECTION_ERROR, new Listener<Null>() { EventDispatcher.listen(EnvEvent.CONNECTION_ERROR, new Listener<Null>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
if (JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Remote_Connect2Server_Again"), UIManager.getString("OptionPane.titleText"), JOptionPane.YES_NO_OPTION) JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"));
== JOptionPane.OK_OPTION) {
try {
EnvContext.signIn(EnvContext.currentEnv());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
} }
}); });
} }
/** /**
* 注册入环境 * 注册入环境
*
* @param selectedEnv 选择的环境 * @param selectedEnv 选择的环境
* @throws Exception 异常 * @throws Exception 异常
*/ */
@ -47,15 +38,7 @@ public class SignIn {
if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) { if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) {
EnvContext.signOut(); EnvContext.signOut();
} }
EnvContext.signIn(selectedEnv);
DesignUtils.switchToEnv(trans(selectedEnv));
}
private static com.fr.base.Env trans(EnvConfig env) { DesignUtils.switchToEnv(selectedEnv);
if (env instanceof RemoteEnvConfig) {
return new RemoteEnv(env.getPath(), EnvConfigUtils.getUsername(env), EnvConfigUtils.getPassword(env));
} else {
return new LocalEnv();
}
} }
} }

298
designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

@ -1,20 +1,29 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable; import com.fr.base.ModifiedTable;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.base.env.serializer.OldSerializerAdapter; import com.fr.base.env.serializer.OldSerializerAdapter;
import com.fr.base.env.serializer.ProcedureDataModelSerializer; import com.fr.base.env.serializer.ProcedureDataModelSerializer;
import com.fr.base.env.user.RemoteUserCenter; import com.fr.core.env.EnvConfig;
import com.fr.core.env.operator.user.UserCenter; import com.fr.core.env.EnvEvent;
import com.fr.core.env.proxy.EnvProxy; import com.fr.core.env.proxy.EnvProxy;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.DavXMLUtils; import com.fr.dav.DavXMLUtils;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.env.RemoteEnv;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
@ -44,181 +53,190 @@ public class DesignerEnvProvider extends Activator {
} }
} }
initDesignerEnv(); initDesignerEnv();
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher());
//设置好环境即可,具体跟环境有关的模块会自动调用 //设置好环境即可,具体跟环境有关的模块会自动调用
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();
} }
private void initDesignerEnv() { private void initDesignerEnv() {
addSerializers(); addSerializers();
EnvProxy.addRemoteService(UserCenter.class, new RemoteUserCenter()); EventDispatcher.listen(EnvEvent.BEFORE_SIGN_IN, new Listener<EnvConfig>() {
@Override
public void on(Event event, EnvConfig envConfig) {
if (envConfig instanceof RemoteEnvConfig) {
RemoteEnv remoteEnv = new RemoteEnv(envConfig.getPath(), EnvConfigUtils.getUsername(envConfig), EnvConfigUtils.getPassword(envConfig));
FRContext.setCurrentEnv(remoteEnv);
} else if (envConfig instanceof LocalEnvConfig) {
FRContext.setCurrentEnv(new LocalEnv());
}
}
});
} }
private void addSerializers() { private void addSerializers() {
EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer()); EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer());
EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>( EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>(
new OldSerializerAdapter.OldSerializer<ModifiedTable>() { new OldSerializerAdapter.OldSerializer<ModifiedTable>() {
@Override @Override
public void serializer(ModifiedTable obj, OutputStream out) throws Exception { public void serializer(ModifiedTable obj, OutputStream out) throws Exception {
DavXMLUtils.writeXMLModifiedTables(obj, out); DavXMLUtils.writeXMLModifiedTables(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<ModifiedTable>() { new OldSerializerAdapter.OldDeserializer<ModifiedTable>() {
@Override @Override
public ModifiedTable deserializer(InputStream in) throws Exception { public ModifiedTable deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLModifiedTables(in); return DavXMLUtils.readXMLModifiedTables(in);
}
} }
}
)); ));
EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>( EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>(
new OldSerializerAdapter.OldSerializer<Connection>() { new OldSerializerAdapter.OldSerializer<Connection>() {
@Override @Override
public void serializer(Connection obj, OutputStream out) { public void serializer(Connection obj, OutputStream out) {
DavXMLUtils.writeXMLFileDatabaseConnection(obj, out); DavXMLUtils.writeXMLFileDatabaseConnection(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<Connection>() { new OldSerializerAdapter.OldDeserializer<Connection>() {
@Override @Override
public Connection deserializer(InputStream in) throws Exception { public Connection deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLDatabaseConnection(in); return DavXMLUtils.readXMLDatabaseConnection(in);
}
} }
}
)); ));
EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>( EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>(
new OldSerializerAdapter.OldSerializer<FileNode[]>() { new OldSerializerAdapter.OldSerializer<FileNode[]>() {
@Override @Override
public void serializer(FileNode[] obj, OutputStream out) { public void serializer(FileNode[] obj, OutputStream out) {
DavXMLUtils.writeXMLFileNodes(obj, out); DavXMLUtils.writeXMLFileNodes(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<FileNode[]>() { new OldSerializerAdapter.OldDeserializer<FileNode[]>() {
@Override @Override
public FileNode[] deserializer(InputStream in) { public FileNode[] deserializer(InputStream in) {
return DavXMLUtils.readXMLFileNodes(in); return DavXMLUtils.readXMLFileNodes(in);
}
} }
}
)); ));
EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>( EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>(
new OldSerializerAdapter.OldSerializer<TableProcedure[]>() { new OldSerializerAdapter.OldSerializer<TableProcedure[]>() {
@Override @Override
public void serializer(TableProcedure[] obj, OutputStream out) { public void serializer(TableProcedure[] obj, OutputStream out) {
DavXMLUtils.writeXMLFileSQLTable(obj, out); DavXMLUtils.writeXMLFileSQLTable(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() { new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() {
@Override @Override
public TableProcedure[] deserializer(InputStream in) throws Exception { public TableProcedure[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLSQLTables(in); return DavXMLUtils.readXMLSQLTables(in);
}
} }
}
)); ));
EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>( EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>(
new OldSerializerAdapter.OldSerializer<TableData>() { new OldSerializerAdapter.OldSerializer<TableData>() {
@Override @Override
public void serializer(TableData obj, OutputStream out) { public void serializer(TableData obj, OutputStream out) {
DavXMLUtils.writeXMLFileTableData(obj, out); DavXMLUtils.writeXMLFileTableData(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<TableData>() { new OldSerializerAdapter.OldDeserializer<TableData>() {
@Override @Override
public TableData deserializer(InputStream in) throws Exception { public TableData deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLTableData(in); return DavXMLUtils.readXMLTableData(in);
}
} }
}
)); ));
EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>( EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>(
new OldSerializerAdapter.OldSerializer<Parameter[]>() { new OldSerializerAdapter.OldSerializer<Parameter[]>() {
@Override @Override
public void serializer(Parameter[] obj, OutputStream out) { public void serializer(Parameter[] obj, OutputStream out) {
DavXMLUtils.writeXMLFileParameters(obj, out); DavXMLUtils.writeXMLFileParameters(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<Parameter[]>() { new OldSerializerAdapter.OldDeserializer<Parameter[]>() {
@Override @Override
public Parameter[] deserializer(InputStream in) throws Exception { public Parameter[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLParameters(in); return DavXMLUtils.readXMLParameters(in);
}
} }
}
)); ));
EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>( EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>(
new OldSerializerAdapter.OldSerializer<StoreProcedure>() { new OldSerializerAdapter.OldSerializer<StoreProcedure>() {
@Override @Override
public void serializer(StoreProcedure obj, OutputStream out) { public void serializer(StoreProcedure obj, OutputStream out) {
DavXMLUtils.writeXMLFileStoreProcedure(obj, out); DavXMLUtils.writeXMLFileStoreProcedure(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<StoreProcedure>() { new OldSerializerAdapter.OldDeserializer<StoreProcedure>() {
@Override @Override
public StoreProcedure deserializer(InputStream in) throws Exception { public StoreProcedure deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLStoreProcedure(in); return DavXMLUtils.readXMLStoreProcedure(in);
}
} }
}
)); ));
EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>( EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>(
new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() { new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() {
@Override @Override
public void serializer(StoreProcedureParameter[] obj, OutputStream out) { public void serializer(StoreProcedureParameter[] obj, OutputStream out) {
DavXMLUtils.writeXMLFileParameters(obj, out); DavXMLUtils.writeXMLFileParameters(obj, out);
} }
}, },
new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() { new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() {
@Override @Override
public StoreProcedureParameter[] deserializer(InputStream in) throws Exception { public StoreProcedureParameter[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLStoreProcedureParameters(in); return DavXMLUtils.readXMLStoreProcedureParameters(in);
}
} }
}
)); ));
} }
@Override @Override
public void stop() { public void stop() {
//清空模块 //清空模块
getRoot().removeSingleton(EnvSwitcher.class); getRoot().removeSingleton(EnvSwitcher.class);
} }
} }

12
designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

@ -14,25 +14,25 @@ import com.fr.stable.module.ModuleListener;
* 之后慢慢将DesignerModule拆成Activator * 之后慢慢将DesignerModule拆成Activator
*/ */
public class DesignerModuleActivator extends Activator implements Prepare { public class DesignerModuleActivator extends Activator implements Prepare {
@Override @Override
public void start() { public void start() {
ModuleContext.registerModuleListener(getModule().upFindSingleton(ModuleListener.class)); ModuleContext.registerModuleListener(getModule().upFindSingleton(ModuleListener.class));
ModuleContext.startModule(DesignerModule.class.getName()); ModuleContext.startModule(DesignerModule.class.getName());
ModuleContext.clearModuleListener(); ModuleContext.clearModuleListener();
DesignerSocketIO.init(); DesignerSocketIO.init();
} }
@Override @Override
public void stop() { public void stop() {
} }
@Override @Override
public void prepare() { public void prepare() {
addMutable(InterMutableKey.Path, "com/fr/design/i18n/main", "com/fr/design/i18n/chart"); addMutable(InterMutableKey.Path, "com/fr/design/i18n/main", "com/fr/design/i18n/chart");
} }
} }

Loading…
Cancel
Save