本文整理了Java中com.vmware.xenon.common.Utils.buildServicePath()
方法的一些代码示例,展示了Utils.buildServicePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.buildServicePath()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:buildServicePath
[英]Compute path to static resources for service. For example: the class "com.vmware.xenon.services.common.ExampleService" is converted to "com/vmware/xenon/services/common/ExampleService".
[中]计算服务的静态资源的路径。例如:“com.vmware.xenon.services.common.ExampleService”类被转换为“com/vmware/xenon/services/common/ExampleService”。
代码示例来源:origin: vmware/xenon
private Path getBaseUriPath(Path path, Service s, boolean hasCustomResources) {
Path baseUriPath;
if (!hasCustomResources) {
baseUriPath = Paths.get(ServiceUriPaths.UI_RESOURCES,
Utils.buildServicePath(s.getClass()));
} else {
baseUriPath = Paths.get(ServiceUriPaths.UI_RESOURCES, path.toString());
}
return baseUriPath;
}
代码示例来源:origin: vmware/xenon
/**
* Compute URI prefix for static resources of a service.
*
* @param klass Service class
* @return String
*/
public static String buildUiResourceUriPrefixPath(Class<? extends Service> klass) {
return UriUtils.buildUriPath(ServiceUriPaths.UI_RESOURCES,
buildServicePath(klass));
}
代码示例来源:origin: vmware/xenon
/**
* Compute ui resource path for this service.
* <p>
* If service has defined the custom path on ServiceDocumentDescription
* userInterfaceResourcePath field that will be used else default UI path
* will be calculated using service path Eg. for ExampleService
* default path will be ui/com/vmware/xenon/services/common/ExampleService
*
* @param s service class for which UI path has to be extracted
* @return UI resource path object
*/
public static Path getServiceUiResourcePath(Service s) {
ServiceDocument sd = s.getDocumentTemplate();
ServiceDocumentDescription sdd = sd.documentDescription;
if (sdd != null && sdd.userInterfaceResourcePath != null) {
String resourcePath = sdd.userInterfaceResourcePath;
if (!resourcePath.isEmpty()) {
return Paths.get(resourcePath);
} else {
log(Utils.class, Utils.class.getSimpleName(), Level.SEVERE,
"UserInterface resource path field empty for service document %s",
s.getClass().getSimpleName());
}
} else {
String servicePath = buildServicePath(s.getClass());
return Paths.get(UI_DIRECTORY_NAME, servicePath);
}
return null;
}
代码示例来源:origin: vmware/xenon
@Test
public void testServiceUiDefaultPath() {
class MyService extends StatelessService {
}
Service s = new MyService();
s.setHost(new VerificationHost());
Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class));
assertEquals(path, Utils.getServiceUiResourcePath(s));
}
代码示例来源:origin: com.vmware.xenon/xenon-common
@Test
public void testServiceUiDefaultPath() {
class MyService extends StatelessService {
}
Service s = new MyService();
s.setHost(new VerificationHost());
Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class));
assertEquals(path, Utils.getServiceUiResourcePath(s));
}
内容来源于网络,如有侵权,请联系作者删除!