当前位置: 首页>>代码示例>>Java>>正文


Java Standards类代码示例

本文整理汇总了Java中ca.nrc.cadc.reg.Standards的典型用法代码示例。如果您正苦于以下问题:Java Standards类的具体用法?Java Standards怎么用?Java Standards使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Standards类属于ca.nrc.cadc.reg包,在下文中一共展示了Standards类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
private void init() {
    Subject s = AuthenticationUtil.getCurrentSubject();
    AuthMethod meth = AuthenticationUtil.getAuthMethodFromCredentials(s);
    if (meth == null) {
        meth = AuthMethod.ANON;
    }
    this.baseServiceURL = rc.getServiceURL(this.resourceID, Standards.CAOM2REPO_OBS_23, meth);
    if (baseServiceURL == null) {
        throw new RuntimeException("not found: " + resourceID + " + " + Standards.CAOM2REPO_OBS_23 + " + " + meth);
    }
    log.debug("observation list URL: " + baseServiceURL.toString());
    log.debug("AuthMethod:  " + meth);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:14,代码来源:RepoClient.java

示例2: initDel

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
private void initDel() {
    Subject s = AuthenticationUtil.getCurrentSubject();
    AuthMethod meth = AuthenticationUtil.getAuthMethodFromCredentials(s);
    if (meth == null) {
        meth = AuthMethod.ANON;
    }
    this.baseDeletionURL = rc.getServiceURL(resourceID, Standards.CAOM2REPO_DEL_23, meth);
    if (baseDeletionURL == null) {
        throw new RuntimeException("not found: " + resourceID + " + " + Standards.CAOM2REPO_DEL_23 + " + " + meth);
    }
    log.debug("deletion list URL: " + baseDeletionURL.toString());
    log.debug("AuthMethod:  " + meth);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:14,代码来源:RepoClient.java

示例3: toURL

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
@Override
public URL toURL(URI uri) {
    if (!SCHEME.equals(uri.getScheme())) {
        throw new IllegalArgumentException("invalid scheme in " + uri);
    }

    try {
        Subject subject = AuthenticationUtil.getCurrentSubject();
        AuthMethod authMethod = AuthenticationUtil.getAuthMethodFromCredentials(subject);
        if (authMethod == null) {
            authMethod = AuthMethod.ANON;
        }
        RegistryClient rc = new RegistryClient();
        Capabilities caps = rc.getCapabilities(DATA_RESOURCE_ID);
        Capability dataCap = caps.findCapability(Standards.DATA_10);
        URI securityMethod = Standards.getSecurityMethod(authMethod);
        Interface ifc = dataCap.findInterface(securityMethod);
        if (ifc == null) {
            throw new IllegalArgumentException("No interface for security method " + securityMethod);
        }
        String baseDataURL = ifc.getAccessURL().getURL().toString();
        URL url = new URL(baseDataURL + "/MAST/" + uri.getSchemeSpecificPart());
        log.debug(uri + " --> " + url);
        return url;
    } catch (MalformedURLException ex) {
        throw new RuntimeException("BUG", ex);
    } catch (Throwable t) {
        String message = "Failed to convert to data URL";
        throw new RuntimeException(message, t);
    }
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:32,代码来源:CadcMastResolver.java

示例4: toURL

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
@Override
public URL toURL(URI uri) {
    if (!SCHEME.equals(uri.getScheme())) {
        throw new IllegalArgumentException("invalid scheme in " + uri);
    }

    try {
        String path = getPath(uri);
        
        // check if authMethod has been set
        AuthMethod am = this.authMethod;
        if (am == null) {
            am = AuthenticationUtil.getAuthMethod(AuthenticationUtil.getCurrentSubject());
        }
        if (am == null) {
            am = AuthMethod.ANON;
        }
        
        RegistryClient rc = new RegistryClient();
        URL serviceURL = rc.getServiceURL(new URI(DATA_URI), Standards.DATA_10, am);
        URL url = this.toURL(serviceURL, path);
        log.debug(uri + " --> " + url);
        return url;
    } catch (MalformedURLException ex) {
        throw new RuntimeException("BUG", ex);
    } catch (URISyntaxException bug) {
        throw new RuntimeException("BUG - failed to create data web service URI", bug);
    }
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:30,代码来源:AdResolver.java

示例5: getURL

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * Convert a URI to a URL.
 *
 * @param uri the URI to convert to an URL.
 * @param secure generate a secure HTTP URL.
 * @throws IllegalArgumentException if the URI scheme is invalid
 * @return a URL to the identified resource
 */
public URL getURL(URI uri, boolean secure)
{
    if (!SCHEME.equals(uri.getScheme()))
        throw new IllegalArgumentException("invalid scheme in " + uri);

    AuthMethod authMethod = AuthMethod.ANON;
    if (secure)
    {
        authMethod = AuthMethod.CERT;
    }

    String path = getPath(uri);
    URL serviceURL = rc.getServiceURL(dataURI, Standards.DATA_10, authMethod);
    if (serviceURL == null)
    {
        throw new RuntimeException("Unable to find URL for " + dataURI + ", " +
                                    Standards.DATA_10 + ", " + authMethod.getValue());
    }

    URL url;
    try
    {
        url = new URL(serviceURL.toExternalForm() + "/" + uri.getSchemeSpecificPart());
    }
    catch (MalformedURLException e)
    {
        throw new RuntimeException("Unable to create URL for " + serviceURL.toExternalForm() +
                                   " and " + uri.toString());
    }
    log.debug(url + " --> " + url);
    return url;
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:41,代码来源:AdSchemeHandler.java

示例6: AdSchemeHandlerTest

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
public AdSchemeHandlerTest()
    throws Exception
{
    RegistryClient rc = new RegistryClient();
    this.baseHttpURL = rc.getServiceURL(new URI("ivo://cadc.nrc.ca/data"), Standards.DATA_10, AuthMethod.ANON);
    this.baseHttpsURL = rc.getServiceURL(new URI("ivo://cadc.nrc.ca/data"), Standards.DATA_10, AuthMethod.CERT);
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:8,代码来源:AdSchemeHandlerTest.java

示例7: CaomRepoDeletedTest

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
public CaomRepoDeletedTest(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_DEL_23, pem1, pem2, pem3);
    this.resourceID = resourceID;
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:5,代码来源:CaomRepoDeletedTest.java

示例8: HackRepoClient

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
HackRepoClient(URI resourceID) {
    super(resourceID, Standards.CAOM2REPO_OBS_23, null, null, null);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:4,代码来源:CaomRepoDeletedTest.java

示例9: createURL

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
protected String createURL(URI uri) {
    // Temporary: because the VOSpace client doesn't support
    // cutouts through document posting, create cutout urls
    // using synctrans
    try {
        // check if authMethod has been set
        AuthMethod am = this.authMethod;
        if (am == null) {
            am = AuthenticationUtil.getAuthMethod(AuthenticationUtil.getCurrentSubject());
        }
        if (am == null) {
            am = AuthMethod.ANON;
        }
        
        URI vuri = getVOSURI(uri);
        RegistryClient registryClient = new RegistryClient();
        URL baseURL = registryClient.getServiceURL(getServiceURI(vuri), Standards.VOSPACE_SYNC_21, am);

        String scheme = baseURL.getProtocol();
        String protocol = null;
        if (scheme.equalsIgnoreCase("http")) {
            protocol = PROTOCOL_HTTP_GET;
        } else {
            protocol = PROTOCOL_HTTPS_GET;
        }

        StringBuilder query = new StringBuilder();
        query.append(baseURL);

        query.append("?");
        query.append("TARGET=").append(NetUtil.encode(vuri.toString()));
        query.append("&");
        query.append("DIRECTION=").append(NetUtil.encode(pullFromVoSpaceValue));
        query.append("&");
        query.append("PROTOCOL=").append(NetUtil.encode(protocol));

        return query.toString();
    } catch (Throwable t) {
        throw new RuntimeException("failed to convert " + uri, t);
    }
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:42,代码来源:VOSpaceResolver.java

示例10: CaomRepoIntTests

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * @param resourceID resource identifier of service to test
 * @param pem1       PEM file for user with read-write permission
 * @param pem2       PEM file for user with read-only permission
 * @param pem3       PEM file for user with no permissions
 */
public CaomRepoIntTests(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_OBS_23, pem1, pem2, pem3);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:10,代码来源:CaomRepoIntTests.java

示例11: CaomRepoIntTests22

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * @param resourceID resource identifier of service to test
 * @param pem1       PEM file for user with read-write permission
 * @param pem2       PEM file for user with read-only permission
 * @param pem3       PEM file for user with no permissions
 */
public CaomRepoIntTests22(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_OBS_20, pem1, pem2, pem3);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:10,代码来源:CaomRepoIntTests22.java

示例12: CaomRepoListTests22

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * @param resourceID resource identifier of service to test
 * @param pem1       PEM file for user with read-write permission
 * @param pem2       PEM file for user with read-only permission
 * @param pem3       PEM file for user with no permissions
 */
public CaomRepoListTests22(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_OBS_20, pem1, pem2, pem3);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:10,代码来源:CaomRepoListTests22.java

示例13: CaomRepoListTests

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * @param resourceID resource identifier of service to test
 * @param pem1       PEM file for user with read-write permission
 * @param pem2       PEM file for user with read-only permission
 * @param pem3       PEM file for user with no permissions
 */
public CaomRepoListTests(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_OBS_23, pem1, pem2, pem3);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:10,代码来源:CaomRepoListTests.java

示例14: CaomRepoTupleTests

import ca.nrc.cadc.reg.Standards; //导入依赖的package包/类
/**
 * Default constructor.
 *
 * @param resourceID resource identifier of service to test
 * @param pem1       PEM file for user with read-write permission
 * @param pem2       PEM file for user with read-only permission
 * @param pem3       PEM file for user with no permissions
 */
public CaomRepoTupleTests(URI resourceID, String pem1, String pem2, String pem3) {
    super(resourceID, Standards.CAOM2REPO_OBS_23, pem1, pem2, pem3);
}
 
开发者ID:opencadc,项目名称:caom2db,代码行数:12,代码来源:CaomRepoTupleTests.java


注:本文中的ca.nrc.cadc.reg.Standards类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。