本文整理汇总了Java中com.sun.servicetag.RegistrationData类的典型用法代码示例。如果您正苦于以下问题:Java RegistrationData类的具体用法?Java RegistrationData怎么用?Java RegistrationData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistrationData类属于com.sun.servicetag包,在下文中一共展示了RegistrationData类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkRegistrationData
import com.sun.servicetag.RegistrationData; //导入依赖的package包/类
public static void checkRegistrationData(String regFile,
Map<String, ServiceTag> stMap)
throws IOException {
BufferedInputStream in = new BufferedInputStream(new FileInputStream(regFile));
RegistrationData registration = RegistrationData.loadFromXML(in);
Set<ServiceTag> svcTags = registration.getServiceTags();
if (svcTags.size() != stMap.size()) {
throw new RuntimeException("Invalid service tag count= " +
svcTags.size() + " expected=" + stMap.size());
}
for (ServiceTag st : svcTags) {
ServiceTag st1 = stMap.get(st.getInstanceURN());
if (!matches(st, st1)) {
System.err.println(st);
System.err.println(st1);
throw new RuntimeException("ServiceTag in the registry " +
"does not match the one in the map");
}
}
}
示例2: emptyRegistryFile
import com.sun.servicetag.RegistrationData; //导入依赖的package包/类
static void emptyRegistryFile() throws IOException {
if (registryFile.exists()) {
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(registryFile));
try {
RegistrationData data = new RegistrationData();
data.storeToXML(out);
} finally {
out.close();
}
}
}