本文整理汇总了Java中com.sun.servicetag.ServiceTag类的典型用法代码示例。如果您正苦于以下问题:Java ServiceTag类的具体用法?Java ServiceTag怎么用?Java ServiceTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceTag类属于com.sun.servicetag包,在下文中一共展示了ServiceTag类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkRegistrationData
import com.sun.servicetag.ServiceTag; //导入依赖的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: newServiceTag
import com.sun.servicetag.ServiceTag; //导入依赖的package包/类
public static ServiceTag newServiceTag(File f, boolean noInstanceURN)
throws FileNotFoundException, IOException, NumberFormatException {
Properties props = new Properties();
FileReader reader = new FileReader(f);
try {
props.load(reader);
} finally {
reader.close();
}
if (noInstanceURN) {
return ServiceTag.newInstance(
props.getProperty("product_name"),
props.getProperty("product_version"),
props.getProperty("product_urn"),
props.getProperty("product_parent"),
props.getProperty("product_parent_urn"),
props.getProperty("product_defined_inst_id"),
props.getProperty("product_vendor"),
props.getProperty("platform_arch"),
props.getProperty("container"),
props.getProperty("source"));
} else {
return ServiceTag.newInstance(
props.getProperty("instance_urn"),
props.getProperty("product_name"),
props.getProperty("product_version"),
props.getProperty("product_urn"),
props.getProperty("product_parent"),
props.getProperty("product_parent_urn"),
props.getProperty("product_defined_inst_id"),
props.getProperty("product_vendor"),
props.getProperty("platform_arch"),
props.getProperty("container"),
props.getProperty("source"));
}
}
示例3: matches
import com.sun.servicetag.ServiceTag; //导入依赖的package包/类
public static boolean matches(ServiceTag st1, ServiceTag st2) {
if (!st1.getInstanceURN().equals(st2.getInstanceURN())) {
System.out.println("instance_urn: " + st1.getInstanceURN() +
" != " + st2.getInstanceURN());
return false;
}
return matchesNoInstanceUrn(st1, st2);
}
示例4: matchesNoInstanceUrn
import com.sun.servicetag.ServiceTag; //导入依赖的package包/类
public static boolean matchesNoInstanceUrn(ServiceTag st1, ServiceTag st2) {
if (!st1.getProductName().equals(st2.getProductName())) {
System.out.println("product_name: " + st1.getProductName() +
" != " + st2.getProductName());
return false;
}
if (!st1.getProductVersion().equals(st2.getProductVersion())) {
System.out.println("product_version: " + st1.getProductVersion() +
" != " + st2.getProductVersion());
return false;
}
if (!st1.getProductURN().equals(st2.getProductURN())) {
System.out.println("product_urn: " + st1.getProductURN() +
" != " + st2.getProductURN());
return false;
}
if (!st1.getProductParentURN().equals(st2.getProductParentURN())) {
System.out.println("product_parent_urn: " + st1.getProductParentURN() +
" != " + st2.getProductParentURN());
return false;
}
if (!st1.getProductParent().equals(st2.getProductParent())) {
System.out.println("product_parent: " + st1.getProductParent() +
" != " + st2.getProductParent());
return false;
}
if (!st1.getProductDefinedInstanceID().equals(st2.getProductDefinedInstanceID())) {
System.out.println("product_defined_inst_id: " +
st1.getProductDefinedInstanceID() +
" != " + st2.getProductDefinedInstanceID());
return false;
}
if (!st1.getProductVendor().equals(st2.getProductVendor())) {
System.out.println("product_vendor: " + st1.getProductVendor() +
" != " + st2.getProductVendor());
return false;
}
if (!st1.getPlatformArch().equals(st2.getPlatformArch())) {
System.out.println("platform_arch: " + st1.getPlatformArch() +
" != " + st2.getPlatformArch());
return false;
}
if (!st1.getContainer().equals(st2.getContainer())) {
System.out.println("container: " + st1.getContainer() +
" != " + st2.getContainer());
return false;
}
if (!st1.getSource().equals(st2.getSource())) {
System.out.println("source: " + st1.getSource() +
" != " + st2.getSource());
return false;
}
return true;
}