本文整理了Java中org.geoserver.config.util.XStreamServiceLoader.getFilename()
方法的一些代码示例,展示了XStreamServiceLoader.getFilename()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStreamServiceLoader.getFilename()
方法的具体详情如下:
包路径:org.geoserver.config.util.XStreamServiceLoader
类名称:XStreamServiceLoader
方法名:getFilename
暂无
代码示例来源:origin: geoserver/geoserver
@Override
public void handleServiceChange(
ServiceInfo service,
List<String> propertyNames,
List<Object> oldValues,
List<Object> newValues) {
XStreamServiceLoader loader = findServiceLoader(service);
// handle the case of a service changing workspace and move the file
int i = propertyNames.indexOf("workspace");
if (i != -1) {
// TODO: share code with GeoServerPersister
WorkspaceInfo old = (WorkspaceInfo) oldValues.get(i);
if (old != null) {
WorkspaceInfo ws = (WorkspaceInfo) newValues.get(i);
Resource f;
try {
f = dir(ws).get(loader.getFilename());
f.renameTo(dir(ws).get(loader.getFilename()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
代码示例来源:origin: geoserver/geoserver
public void handleServiceRemove(ServiceInfo service) {
XStreamServiceLoader loader = findServiceLoader(service);
try {
Resource dir =
service.getWorkspace() != null
? dir(service.getWorkspace())
: resourceLoader.get(Paths.BASE);
dir.get(loader.getFilename()).delete();
} catch (Throwable t) {
throw new RuntimeException(t);
}
}
代码示例来源:origin: geoserver/geoserver
public final void save(T service, GeoServer gs, Resource directory) throws Exception {
String filename = getFilename();
Resource resource =
directory == null ? resourceLoader.get(filename) : directory.get(filename);
// using resource output stream makes sure we write on a temp file and them move
try (OutputStream out = resource.out()) {
XStreamPersister xp = xpf.createXMLPersister();
initXStreamPersister(xp, gs);
xp.save(service, out);
}
}
代码示例来源:origin: geoserver/geoserver
public final T load(GeoServer gs, Resource directory) throws Exception {
// look for file matching classname
Resource file;
if (Resources.exists(file = directory.get(getFilename()))) {
// xstream it in
try (BufferedInputStream in = new BufferedInputStream(file.in())) {
XStreamPersister xp = xpf.createXMLPersister();
initXStreamPersister(xp, gs);
return initialize(xp.load(in, getServiceClass()));
}
} else {
// create an 'empty' object
ServiceInfo service = createServiceFromScratch(gs);
return initialize((T) service);
}
}
代码示例来源:origin: org.geoserver/restconfig
@Override
protected Object handleObjectGet() throws Exception {
String workspace = getAttribute("workspace");
File root = resourceLoader.find("");
if (workspace != null) {
WorkspaceInfo ws = geoServer.getCatalog().getWorkspaceByName(workspace);
if (geoServer.getService(ws, clazz) == null) {
throw new RestletException(
"Service for workspace " + workspace + " does not exist",
Status.CLIENT_ERROR_NOT_FOUND);
}
File workspaces = resourceLoader.find("workspaces");
File workspaceDir = resourceLoader.find(workspaces + "/" + ws.getName());
for (XStreamServiceLoader<ServiceInfo> loader : loaders) {
if (loader.getFilename().equals(serviceXmlFileName)) {
return loader.load(geoServer, workspaceDir);
}
}
}
if (geoServer.getService(clazz) == null) {
throw new RestletException("Service for workspace " + workspace + " does not exist",
Status.CLIENT_ERROR_NOT_FOUND);
}
for (XStreamServiceLoader<ServiceInfo> loader : loaders) {
if (loader.getFilename().equals(serviceXmlFileName)) {
return loader.load(geoServer, root);
}
}
return (ServiceInfo) geoServer.getService(clazz);
}
代码示例来源:origin: org.geoserver/restconfig
XStreamServiceLoader serviceLoader = null;
for (XStreamServiceLoader<ServiceInfo> loader : loaders) {
if (loader.getFilename().equals(serviceXmlFileName)) {
serviceLoader = loader;
内容来源于网络,如有侵权,请联系作者删除!