當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceTag類代碼示例

本文整理匯總了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");
        }
    }
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:21,代碼來源:Util.java

示例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"));
    }
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:37,代碼來源:Util.java

示例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);
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:9,代碼來源:Util.java

示例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;
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:56,代碼來源:Util.java


注:本文中的com.sun.servicetag.ServiceTag類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。