本文整理匯總了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();
}
}
}