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


Java ServerConstants类代码示例

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


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

示例1: replaceSystemProperty

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
private String replaceSystemProperty(String text) {

        int indexOfStartingChars = -1;
        int indexOfClosingBrace;
        String tmpText = null;
        // The following condition deals with properties.
        // Properties are specified as ${system.property},
        // and are assumed to be System properties
        while (indexOfStartingChars < text.indexOf("${")
                && (indexOfStartingChars = text.indexOf("${")) != -1
                && (indexOfClosingBrace = text.indexOf("}")) != -1) { // Is a property used?
            String sysProp = text.substring(indexOfStartingChars + 2, indexOfClosingBrace);
            String propValue = System.getProperty(sysProp);
            if (propValue != null) {
                tmpText = text.substring(0, indexOfStartingChars) + propValue
                        + text.substring(indexOfClosingBrace + 1);
            }

            if ((ServerConstants.CARBON_HOME).equals(sysProp) &&
                    (".").equals(System.getProperty(ServerConstants.CARBON_HOME))) {
                tmpText = new File(".").getAbsolutePath() + File.separator + text;

            }
        }
        return tmpText;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:FileBasedConfigurationBuilder.java

示例2: replaceSystemProperty

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
private String replaceSystemProperty(String text) {
    int indexOfStartingChars = -1;
    int indexOfClosingBrace;

    // The following condition deals with properties.
    // Properties are specified as ${system.property},
    // and are assumed to be System properties
    while (indexOfStartingChars < text.indexOf("${")
            && (indexOfStartingChars = text.indexOf("${")) != -1
            && (indexOfClosingBrace = text.indexOf("}")) != -1) { // Is a property used?
        String sysProp = text.substring(indexOfStartingChars + 2, indexOfClosingBrace);
        String propValue = System.getProperty(sysProp);
        if (propValue != null) {
            text = text.substring(0, indexOfStartingChars) + propValue
                    + text.substring(indexOfClosingBrace + 1);
        }
        if (sysProp.equals(ServerConstants.CARBON_HOME) &&  ".".equals(System.getProperty(ServerConstants.CARBON_HOME)) ) {
            text = new File(".").getAbsolutePath() + File.separator + text;
        }
    }
    return text;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:ThriftAuthenticationConfigParser.java

示例3: removeTrustedService

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
public void removeTrustedService(String serviceAddress) throws SecurityConfigException {
    try {
        AxisService stsService = getAxisConfig().getService(ServerConstants.STS_NAME);
        Parameter origParam = stsService.getParameter(SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG
                .getLocalPart());
        if (origParam != null) {
            OMElement samlConfigElem = origParam.getParameterElement().getFirstChildWithName(
                    SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG);
            SAMLTokenIssuerConfig samlConfig = new SAMLTokenIssuerConfig(samlConfigElem);
            samlConfig.getTrustedServices().remove(serviceAddress);
            setSTSParameter(samlConfig);
            removeTrustedService(ServerConstants.STS_NAME, ServerConstants.STS_NAME,
                    serviceAddress);
        } else {
            throw new AxisFault("missing parameter : "
                    + SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG.getLocalPart());
        }

    } catch (Exception e) {
        log.error("Error while removing a trusted service", e);
        throw new SecurityConfigException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:24,代码来源:STSAdminServiceImpl.java

示例4: getProofKeyType

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
@Override
public String getProofKeyType() throws SecurityConfigException {
    try {
        AxisService service = getAxisConfig().getService(ServerConstants.STS_NAME);
        Parameter origParam = service.getParameter(SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG
                .getLocalPart());
        if (origParam != null) {
            OMElement samlConfigElem = origParam.getParameterElement().getFirstChildWithName(
                    SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG);
            SAMLTokenIssuerConfig samlConfig = new SAMLTokenIssuerConfig(samlConfigElem);
            return samlConfig.getProofKeyType();
        } else {
            throw new SecurityConfigException("missing parameter : "
                    + SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG.getLocalPart());
        }
    } catch (Exception e) {
        log.error("Error while retrieving proof key type", e);
        throw new SecurityConfigException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:STSAdminServiceImpl.java

示例5: setProofKeyType

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
@Override
public void setProofKeyType(String keyType) throws SecurityConfigException {
    try {
        AxisService service = getAxisConfig().getService(ServerConstants.STS_NAME);
        Parameter origParam = service.getParameter(SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG
                .getLocalPart());
        if (origParam != null) {
            OMElement samlConfigElem = origParam.getParameterElement().getFirstChildWithName(
                    SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG);
            SAMLTokenIssuerConfig samlConfig = new SAMLTokenIssuerConfig(samlConfigElem);
            samlConfig.setProofKeyType(keyType);
            setSTSParameter(samlConfig);
        } else {
            throw new AxisFault("missing parameter : "
                    + SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG.getLocalPart());
        }

    } catch (Exception e) {
        log.error("Error setting proof key type", e);
        throw new SecurityConfigException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:STSAdminServiceImpl.java

示例6: verifyCertExistence

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
/**
 * Check whether the certificate is available in the file system
 *
 * @param fileName             file name
 * @param configurationContext configuration context of the current message
 */
private static boolean verifyCertExistence(String fileName, ConfigurationContext configurationContext) {
    String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
    String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName;
    File pubCert = new File(workDir + File.separator + "pub_certs" + File.separator + fileName);

    //if cert is still available then exit
    if (pubCert.exists()) {
        Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
        if (fileResourcesMap == null) {
            fileResourcesMap = new Hashtable();
            configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap);
        }
        if (fileResourcesMap.get(fileName) == null) {
            fileResourcesMap.put(fileName, filePath);
        }
        return true;
    }
    return false;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:KeyStoreMgtUtil.java

示例7: replaceSystemProperty

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
private String replaceSystemProperty(String text) {
    int indexOfStartingChars = -1;
    int indexOfClosingBrace;

    // The following condition deals with properties.
    // Properties are specified as ${system.property},
    // and are assumed to be System properties
    while (indexOfStartingChars < text.indexOf("${")
            && (indexOfStartingChars = text.indexOf("${")) != -1
            && (indexOfClosingBrace = text.indexOf("}")) != -1) { // Is a property used?
        String sysProp = text.substring(indexOfStartingChars + 2, indexOfClosingBrace);
        String propValue = System.getProperty(sysProp);
        if (propValue != null) {
            text = text.substring(0, indexOfStartingChars) + propValue
                    + text.substring(indexOfClosingBrace + 1);
        }
        if (sysProp.equals(ServerConstants.CARBON_HOME)) {
            if (System.getProperty(ServerConstants.CARBON_HOME).equals(".")) {
                text = new File(".").getAbsolutePath() + File.separator + text;
            }
        }
    }
    return text;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:IdentityConfigParser.java

示例8: getRegistry

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
public static Registry getRegistry(String domainName, String username) throws IdentityException {
    HttpSession httpSess = getHttpSession();

    if (httpSess != null) {
        if (httpSess.getAttribute(ServerConstants.USER_LOGGED_IN) != null) {
            try {
                return AdminServicesUtil.getSystemRegistry();
            } catch (CarbonException e) {
                log.error("Error obtaining a registry instance", e);
                throw IdentityException.error(
                        "Error obtaining a registry instance", e);
            }
        }
    }
    return getRegistryForAnonymousSession(domainName, username);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:17,代码来源:IdentityTenantUtil.java

示例9: AxisOperationClient

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
public AxisOperationClient() {


        String repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
                "samples" + File.separator + "axis2Server" + File.separator + "repository";
        File repository = new File(repositoryPath);
        log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());

        try {
            cfgCtx =
                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository.getCanonicalPath(),
                            null);
            serviceClient = new ServiceClient(cfgCtx, null);
            log.info("Sample clients initialized successfully...");
        } catch (Exception e) {
            log.error("Error while initializing the Operational Client", e);
        }
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:19,代码来源:AxisOperationClient.java

示例10: backupConfiguration

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
/**
 * backup the current server configuration file
 *
 * @param fileName file name
 */
private void backupConfiguration(String fileName) throws IOException {
    //restore backup configuration
    String carbonHome = System.getProperty(ServerConstants.CARBON_HOME);
    String confDir = Paths.get(carbonHome ,"conf").toString();
    String AXIS2_XML = "axis2";
    if (fileName.contains(AXIS2_XML)) {
        confDir = Paths.get(confDir , "axis2" ).toString();
    }
    originalConfig = Paths.get(confDir,fileName).toFile();
    backUpConfig = Paths.get(confDir , fileName + ".backup").toFile();

    Files.move(originalConfig.toPath(), backUpConfig.toPath(), StandardCopyOption.REPLACE_EXISTING);

    if (originalConfig.exists()) {
        throw new IOException("Failed to rename file from " + originalConfig.getName() + "to" + backUpConfig.getName());
    }

    configDatas.add(new ConfigData(backUpConfig, originalConfig));
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:25,代码来源:ServerConfigurationManager.java

示例11: SampleAxis2Server

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
public SampleAxis2Server(String axis2xmlFile) {
    repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
                     "samples" + File.separator + "axis2Server" + File.separator + "repository";
    File repository = new File(repositoryPath);
    log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());

    try {
        File axis2xml = copyResourceToFileSystem(axis2xmlFile, "axis2.xml");
        if (axis2xml == null) {
            log.error("Error while copying the test axis2.xml to the file system");
            return;
        }
        log.info("Loading axis2.xml from: " + axis2xml.getAbsolutePath());
        cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                repository.getAbsolutePath(), axis2xml.getAbsolutePath());
    } catch (Exception e) {
        log.error("Error while initializing the configuration context", e);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:SampleAxis2Server.java

示例12: setEnvironment

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    super.init();
    serverConfigurationManager =
            new ServerConfigurationManager(new AutomationContext("ESB",
                                                                 TestUserMode.SUPER_TENANT_ADMIN));

    String carbonHome = System.getProperty(ServerConstants.CARBON_HOME);
    String confDir = carbonHome + File.separator + "conf" + File.separator;
    File originalConfig = new File(getESBResourceLocation() + File.separator + "synapseconfig" + File.separator +
            "nhttp_transport" + File.separator + "default_content_type_axis2.xml");
    File destDir = new File(confDir + "axis2" + File.separator);
    FileUtils.copyFileToDirectory(originalConfig, destDir);
    serverConfigurationManager.restartGracefully();
    super.init();
    loadESBConfigurationFromClasspath("/artifacts/ESB/synapseconfig/nhttp_transport"
                                      + "/default_content_type_synapse.xml");

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:21,代码来源:DefaultRequestContentTypeTestCase.java

示例13: waitUntilLibAvailable

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
/**
 * Wait until the zip file is copied to the synapse-libs directory or the default wait time is exceeded
 *
 * @param connectorZip
 */
private void waitUntilLibAvailable(String connectorZip) {

    String connectorZipPath = ServerConstants.CARBON_HOME + File.separator + "repository" + File.separator +
            "deployment" + File.separator + "server" + File.separator + "synapse-libs" + File.separator +
            connectorZip;

    File zipFile = new File(connectorZipPath);
    long startTime = System.currentTimeMillis();

    while (((System.currentTimeMillis() - startTime) < 20000) && !zipFile.exists()) {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            log.warn("Error while sleep the thread for 0.5 sec");
        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:MediationLibraryServiceTestCase.java

示例14: init

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    super.init();
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    String nhttpFile = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + separator + "ESB" + separator +
            "passthru" + separator + "transport" + separator + "httpaccesslogs" + separator + "nhttp.properties";

    File srcFile = new File(nhttpFile);
    String carbonHome = System.getProperty(ServerConstants.CARBON_HOME);
    httpLogDir = carbonHome + File.separator + "repository" + File.separator + "logs" + File.separator + "httpLogs";
    File log4jProperties = new File(carbonHome + File.separator + "conf" +
            File.separator + "log4j.properties");

    String propertyName = "nhttp.log.directory";
    createNewDir(httpLogDir);
    applyProperty(srcFile, propertyName, httpLogDir);
    applyProperty(log4jProperties, "log4j.logger.org.apache.synapse.transport.http.access", "DEBUG");
    serverConfigurationManager.restartGracefully();
    super.init();
    verifyProxyServiceExistence("HttpAccessLogsTestProxy");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:HttpAccessLogTestCase.java

示例15: Axis2ServerManager

import org.wso2.carbon.utils.ServerConstants; //导入依赖的package包/类
public Axis2ServerManager(String axis2xmlFile) {
    repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
            "samples" + File.separator + "axis2Server" + File.separator + "repository";
    File repository = new File(repositoryPath);
    log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
    try {
        File axis2xml = copyResourceToFileSystem(axis2xmlFile, "axis2.xml");
        if (!axis2xml.exists()) {
            log.error("Error while copying the test axis2.xml to the file system");
            return;
        }
        log.info("Loading axis2.xml from: " + axis2xml.getAbsolutePath());
        cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                repository.getAbsolutePath(), axis2xml.getAbsolutePath());
    } catch (Exception e) {
        log.error("Error while initializing the configuration context", e);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:19,代码来源:Axis2ServerManager.java


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