本文整理了Java中org.geoserver.platform.Service
类的一些代码示例,展示了Service
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Service
类的具体详情如下:
包路径:org.geoserver.platform.Service
类名称:Service
[英]A service descriptor which provides metadata such as id, and version.
Service descriptors are identified by an id, version pair. Two service descriptors are considered equal if they have the same id, and version.
The underlying service implementation is a plain old java object, available via #service.
[中]一种服务描述符,提供id和版本等元数据。
服务描述符由id、版本对标识。如果两个服务描述符具有相同的id和版本,则认为它们相等。
底层服务实现是一个普通的旧java对象,可通过#服务获得。
代码示例来源:origin: geoserver/geoserver
Service findService(String id, String ver, String namespace) throws ServiceException {
Version version = (ver != null) ? new Version(ver) : null;
Collection services = loadServices();
Service sBean = (Service) itr.next();
if (sBean.getId().equalsIgnoreCase(id)) {
matches.add(sBean);
Service s = (Service) itr.next();
if (version.equals(s.getVersion())) {
continue;
for (Iterator itr = nmatches.iterator(); itr.hasNext(); ) {
Service s = (Service) itr.next();
if (s.getNamespace() != null && !s.getNamespace().equals(namespace)) {
代码示例来源:origin: geoserver/geoserver
new Service(
"directCallService",
serviceBean,
new Version("1.0.0"),
Collections.singletonList("concat"));
Method method = serviceBean.getClass().getMethod("concat", String.class, String.class);
Object[] parameters = {"p1", "p2"};
Operation opDescriptor = new Operation("concat", service, method, parameters);
代码示例来源:origin: geoserver/geoserver
private boolean operationExists(Request req, Service serviceDescriptor) {
boolean exists = false;
for (String op : serviceDescriptor.getOperations()) {
if (op.equalsIgnoreCase(req.getRequest())) {
exists = true;
break;
}
}
return exists;
}
代码示例来源:origin: geoserver/geoserver
public Service serviceDispatched(Request request, Service service) {
Object s = service.getService();
+ service.getId()
+ " even if the service implements ServiceInfo, thus could not check if the service is enabled");
} else {
+ service.getId()
+ " thus could not check if the service is enabled");
代码示例来源:origin: geoserver/geoserver
Object serviceBean = serviceDescriptor.getService();
Method operation = OwsUtils.method(serviceBean.getClass(), req.getRequest());
Version version = new Version(req.getVersion());
if (version.equals(service.getVersion())) {
found = true;
Operation op = new Operation(req.getRequest(), serviceDescriptor, operation, parameters);
return fireOperationDispatchedCallback(req, op);
代码示例来源:origin: org.geoserver/wcs1_1
/**
* Makes sure this triggers only
* </p>
*/
public boolean canHandle(Operation operation) {
// is this a wcs 1.1.1 or 1.1.0 one?
return "GetCapabilities".equalsIgnoreCase(operation.getId()) &&
operation.getService().getId().equals("wcs") &&
(operation.getService().getVersion().toString().equals("1.1.0") ||
operation.getService().getVersion().toString().equals("1.1.1"));
}
代码示例来源:origin: org.geoserver/wfsv
public boolean canHandle(Operation operation) {
return "DescribeVersionedFeatureType".equalsIgnoreCase(operation
.getId())
&& operation.getService().getId().equalsIgnoreCase("wfsv");
}
代码示例来源:origin: org.geoserver/gs-wfs
public void write(Object value, OutputStream output, Operation operation)
throws IOException, ServiceException {
TransactionResponseType response = (TransactionResponseType) value;
if (new Version("1.0.0").equals(operation.getService().getVersion())) {
v_1_0(response, output, operation);
} else {
v_1_1(response, output, operation);
}
}
代码示例来源:origin: org.geoserver.community/gs-ows-simulate
String toJSON(Operation op, Map<String, Object> opts) {
int depth = Converters.convert(opts.getOrDefault(OPT_DEPTH, 3), Integer.class);
JSONStringer out = new JSONStringer();
out.object();
Service srv = op.getService();
out.key("service")
.object()
.key("name")
.value(srv.getId())
.key("version")
.value(srv.getVersion())
.endObject();
out.key("operation").object().key("name").value(op.getId());
Object req = Arrays.stream(op.getParameters()).findFirst().orElse(null);
if (req != null) {
out.key("request");
traverse(req, 0, depth, out);
}
out.endObject(); // operation
out.endObject();
return out.toString();
}
代码示例来源:origin: geoserver/geoserver
protected void setUp() throws Exception {
super.setUp();
HelloWorld helloWorld = new HelloWorld();
Service service =
new Service(
"hello",
helloWorld,
new Version("1.0.0"),
Collections.singletonList("hello"));
request =
new MockHttpServletRequest() {
public int getServerPort() {
return 8080;
}
};
request.setScheme("http");
request.setServerName("localhost");
request.setContextPath("geoserver");
response = new MockHttpServletResponse();
handler = new DefaultServiceExceptionHandler();
requestInfo = new Request();
requestInfo.setHttpRequest(request);
requestInfo.setHttpResponse(response);
requestInfo.setService("hello");
requestInfo.setVersion("1.0.0");
}
代码示例来源:origin: geoserver/geoserver
public String toString() {
return "Operation( " + id + ", " + service.getId() + " )";
}
}
代码示例来源:origin: geoserver/geoserver
Object execute(Request req, Operation opDescriptor) throws Throwable {
Service serviceDescriptor = opDescriptor.getService();
Object serviceBean = serviceDescriptor.getService();
Object[] parameters = opDescriptor.getParameters();
// step 5: execute
Object result = null;
try {
if (serviceBean instanceof DirectInvocationService) {
// invokeDirect expects the operation to be called as declared in the operation
// descriptor, although it used to match a method name, lets use the declared
// operation name for contract compliance.
String operationName = opDescriptor.getId();
result =
((DirectInvocationService) serviceBean)
.invokeDirect(operationName, parameters);
} else {
Method operation = opDescriptor.getMethod();
result = operation.invoke(serviceBean, parameters);
}
} catch (Exception e) {
if (e.getCause() != null) {
throw e.getCause();
}
throw e;
}
return fireOperationExecutedCallback(req, opDescriptor, result);
}
代码示例来源:origin: org.geoserver/gs-wms
Service serviceDesc = new Service("wms", null, null, Collections.EMPTY_LIST);
Operation opDescriptor = new Operation("", serviceDesc, null, new Object[] {gfreq});
outputFormat.write(features, out, opDescriptor);
代码示例来源:origin: org.geoserver.web/gs-web-core
/** @see org.geoserver.web.CapabilitiesHomePageLinkProvider#getCapabilitiesComponent */
public Component getCapabilitiesComponent(final String id) {
List<CapsInfo> serviceInfoLinks = new ArrayList<CapabilitiesHomePagePanel.CapsInfo>();
List<Service> extensions = GeoServerExtensions.extensions(Service.class);
for (Service si : extensions) {
if (si.getCustomCapabilitiesLink() != null) {
String serviceId = si.getId();
String capsLink = si.getCustomCapabilitiesLink();
CapsInfo ci = new CapsInfo(serviceId, si.getVersion(), capsLink);
serviceInfoLinks.add(ci);
} else if (si.getOperations().contains("GetCapabilities")) {
String serviceId = si.getId();
String capsLink =
"../ows?service="
+ serviceId
+ "&version="
+ si.getVersion().toString()
+ "&request=GetCapabilities";
CapsInfo ci = new CapsInfo(serviceId, si.getVersion(), capsLink);
serviceInfoLinks.add(ci);
}
}
return new CapabilitiesHomePagePanel(id, serviceInfoLinks);
}
}
代码示例来源:origin: org.geoserver.community/gs-geofence-server
/**
* Returns a sorted list of operation names in the specified service (or * if the workspace is
* *)
*/
protected List<String> getOperationNames(String serviceName) {
SortedSet<String> resultSet = new TreeSet<String>();
boolean flag = true;
if (serviceName != null) {
for (Service ows : GeoServerExtensions.extensions(Service.class)) {
if (serviceName.equalsIgnoreCase(ows.getId()) && flag) {
flag = false;
resultSet.addAll(ows.getOperations());
}
}
}
return new ArrayList<String>(resultSet);
}
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
public Service serviceDispatched(Request request, Service service) throws ServiceException {
Object req = request.getKvp().get("REQUEST");
if ("wfs".equals(service.getId().toLowerCase()) && PAGE_RESULTS.equals(req)) {
// allow the request to be successfully parsed as a GetFeature (needs at least a
// typename or a featureId)
request.getKvp().put("featureId", Collections.singletonList("dummy"));
// replace the service
return new Service(
service.getId(), this.service, service.getVersion(), service.getOperations());
}
return service;
}
代码示例来源:origin: geoserver/geoserver
@Override
public Object operationExecuted(
Request request, Operation operation, Object result) {
Operation op = Dispatcher.REQUEST.get().getOperation();
assertNotNull(op);
assertTrue(op.getService().getService() instanceof HelloWorld);
assertTrue(op.getParameters()[0] instanceof Message);
return result;
}
});
代码示例来源:origin: org.geoserver/gs-wms
@Override
public String getAttachmentFileName(Object value, Operation operation) {
return "getcapabilities_" + operation.getService().getVersion().toString() + ".xml";
}
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// configure the extra operation in WFS 2.0
List<Service> services = GeoServerExtensions.extensions(Service.class);
for (Service s : services) {
if ("wfs".equals(s.getId().toLowerCase())
&& Integer.valueOf(2).equals(s.getVersion().getMajor())) {
if (!s.getOperations().contains(PAGE_RESULTS)) {
s.getOperations().add(PAGE_RESULTS);
}
}
}
}
}
代码示例来源:origin: geoserver/geoserver
String version = null;
if (useServiceVersion && request.getServiceDescriptor() != null) {
version = request.getServiceDescriptor().getVersion().toString();
内容来源于网络,如有侵权,请联系作者删除!