1、通过当前Resorces得到
Code
UIComponent form = facesContext.getViewRoot().findComponent(
(String) paramMap.get("formId"));
if (form == null) {
return;
}
MapControl mapControl = (MapControl) form
.findComponent((String) paramMap.get("mapId"));
if (mapControl == null) {
return;
}
WebMap webMap = mapControl.getWebMap();
WebContext webContext = webMap.getWebContext();
// 得到当前服务的IServerContext
AGSLocalMapResource mapResource = (AGSLocalMapResource) webContext
.getResources().get("ags1");
MapServer mapServer = mapResource.getLocalMapServer();
IServerContext serverContext = mapResource.getServerContext();
UIComponent form = facesContext.getViewRoot().findComponent(
(String) paramMap.get("formId"));
if (form == null) {
return;
}
MapControl mapControl = (MapControl) form
.findComponent((String) paramMap.get("mapId"));
if (mapControl == null) {
return;
}
WebMap webMap = mapControl.getWebMap();
WebContext webContext = webMap.getWebContext();
// 得到当前服务的IServerContext
AGSLocalMapResource mapResource = (AGSLocalMapResource) webContext
.getResources().get("ags1");
MapServer mapServer = mapResource.getLocalMapServer();
IServerContext serverContext = mapResource.getServerContext();
2、通过IP链接的Resources得到
Code
ServerConnection connection = null;
// 、、、、、、、、、、、、、、、、、、、、、、链接到服务器
ServerInitializer serverInitializer = new ServerInitializer();
serverInitializer.initializeServer("10.2.9.22",
"administrator", "oil");
connection = new ServerConnection();
connection.connect("10.2.9.22"); // 服务器名
// 链接到SOA
IServerObjectAdmin serverObjectAdmin = connection
.getServerObjectAdmin();
// 得到serverContext
IServerObjectManager serverObjectManager = connection
.getServerObjectManager();
IServerContext serverContext = serverObjectManager
.createServerContext("globe", "MapServer");
ServerConnection connection = null;
// 、、、、、、、、、、、、、、、、、、、、、、链接到服务器
ServerInitializer serverInitializer = new ServerInitializer();
serverInitializer.initializeServer("10.2.9.22",
"administrator", "oil");
connection = new ServerConnection();
connection.connect("10.2.9.22"); // 服务器名
// 链接到SOA
IServerObjectAdmin serverObjectAdmin = connection
.getServerObjectAdmin();
// 得到serverContext
IServerObjectManager serverObjectManager = connection
.getServerObjectManager();
IServerContext serverContext = serverObjectManager
.createServerContext("globe", "MapServer");