本文整理了Java中org.wso2.carbon.utils.Utils
类的一些代码示例,展示了Utils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils
类的具体详情如下:
包路径:org.wso2.carbon.utils.Utils
类名称:Utils
[英]Carbon utility methods.
[中]碳效用方法。
代码示例来源:origin: org.wso2.carbon.lcm/org.wso2.carbon.lcm.core
/**
* This method will return the lifecycle schema location in the server directory.
* @return schema location.
*/
private static String getLifecycleSchemaLocation() {
return Utils.getRuntimePath() + File.separator + "resources" + File.separator + "lifecycle-config.xsd";
}
代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.oauth
private Map<String, List<String>> populateDefaultFileBaseScopes() {
Map<String, List<String>> fileBasedScopeMap = new LinkedHashMap<>();
String fileBasedConfigPath = Utils.getRuntimeConfigPath().toString() + File.separator + JDBCAuthConstants
.FILE_BASE_SCOPE_FILE_NAME;
try {
String content = IOUtils.toString(new FileInputStream(fileBasedConfigPath));
fileBasedScopeMap = (Map<String, List<String>>) new Yaml().load(content);
} catch (IOException e) {
log.error("Error while Reading Configuration:" + JDBCAuthConstants.FILE_BASE_SCOPE_FILE_NAME);
}
return fileBasedScopeMap;
}
}
代码示例来源:origin: wso2/carbon-kernel
/**
* Return registered runtime list.
*
* @return List of rumtimes
*/
public List<Runtime> getRuntimeList() {
Utils.checkSecurity();
return runtimeList;
}
}
代码示例来源:origin: org.wso2.carbon.utils/org.wso2.carbon.utils
/**
* Get the conf path of the runtime.
*
* @return Path to the conf dir of runtime
*/
public static Path getRuntimeConfigPath() {
return Paths.get(getCarbonHome().toString(), Constants.CONF_DIR, getRuntimeName());
}
代码示例来源:origin: org.wso2.carbon.secvault/org.wso2.carbon.secvault.ciphertool
"not set");
org.wso2.carbon.utils.Utils.getCarbonRuntimes().forEach(carbonRuntime -> {
try {
System.setProperty(Constants.RUNTIME, carbonRuntime);
Object objCipherTool = Utils.createCipherTool(urlClassLoader, org.wso2.carbon.utils.Utils
.getRuntimeConfigPath().resolve(Constants.DEPLOYMENT_CONFIG_YAML));
processCommand(commandName, commandParam, objCipherTool);
if (commandLineParser.getCommandName().isPresent()) {
Path secureVaultConfigPath;
if (customConfigPath == null) {
secureVaultConfigPath = org.wso2.carbon.utils.Utils.getRuntimeConfigPath().resolve(Constants
.DEPLOYMENT_CONFIG_YAML);
} else {
代码示例来源:origin: org.wso2.carbon.utils/org.wso2.carbon.utils
/**
* This method will return the carbon configuration directory path.
* i.e ${carbon.home}/conf
*
* @return returns the Carbon Configuration directory path
*/
public static Path getCarbonConfigHome() {
return Paths.get(getCarbonHome().toString(), Constants.CONF_DIR);
}
代码示例来源:origin: wso2/carbon-kernel
/**
* Returns the carbon.yaml location.
*
* @return Path carbon.yaml location
*/
public static Path getCarbonYAMLLocation() {
return Paths.get(org.wso2.carbon.utils.Utils.getCarbonConfigHome().toString(),
Constants.CARBON_CONFIG_YAML);
}
代码示例来源:origin: org.wso2.carbon.utils/org.wso2.carbon.utils
/**
* Returns a list of WSO2 Carbon Runtime names.
*
* @return WSO2 Carbon Runtime names
* @throws IOException if an I/O error occurs
*/
public static List<String> getCarbonRuntimes() throws IOException {
Path carbonRuntimeHome = getCarbonHome().resolve(Constants.PROFILE_REPOSITORY);
Path osgiRepoPath = carbonRuntimeHome.resolve(Constants.OSGI_LIB);
if (!Files.exists(carbonRuntimeHome)) {
throw new IOException("invalid carbon home path " + carbonRuntimeHome.toString());
}
Stream<Path> runtimes = Files.list(carbonRuntimeHome);
List<String> runtimeNames = new ArrayList<>();
runtimes.filter(profile -> !osgiRepoPath.equals(profile))
.filter(Objects::nonNull)
.forEach(profile -> runtimeNames.add(profile.getFileName().toString()));
if (runtimeNames.size() == 0) {
throw new IOException("No runtime found in path " + carbonRuntimeHome);
}
return runtimeNames;
}
}
代码示例来源:origin: org.wso2.carbon.lcm/org.wso2.carbon.lcm.core
private static String getDefaltLifecycleConfigLocation() {
return Utils.getRuntimePath() + File.separator + "resources" + File.separator + "lifecycles";
}
}
代码示例来源:origin: wso2/carbon-kernel
/**
* Un-register runtime instance on RuntimeManager.
*
* @param runtime - runtime to be un-registered
*/
public void unRegisterRuntime(Runtime runtime) {
Utils.checkSecurity();
runtimeList.remove(runtime);
}
代码示例来源:origin: org.wso2.carbon.config/org.wso2.carbon.config
/**
* Initialise carbon config provider.
*
* @param bundleContext OSGi Bundle Context
*/
private void initializeConfigProvider(BundleContext bundleContext) {
try {
Path deploymentConfigPath = Paths.get(Utils.getRuntimeConfigPath().toString(),
Constants.DEPLOYMENT_CONFIG_YAML);
ConfigProvider configProvider = ConfigProviderFactory.getConfigProvider(deploymentConfigPath, secureVault);
bundleContext.registerService(ConfigProvider.class, configProvider, null);
logger.debug("ConfigProvider OSGi service registered successfully");
} catch (ConfigurationException e) {
logger.error("Error occurred while initializing config provider" , e);
}
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
/**
* This is the activation method of ServiceComponent. This will be called when it's references are fulfilled
*
* @throws Exception this will be thrown if an issue occurs while executing the activate method
*/
@Activate
protected void start() throws Exception {
//set maximum csv file size to 8MB
EventSimulatorDataHolder.getInstance().setMaximumFileSize(8388608);
EventSimulatorDataHolder.getInstance().setCsvFileDirectory(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT, EventSimulatorConstants.DIRECTORY_CSV_FILES).toString());
if (log.isDebugEnabled()) {
log.debug("Event Simulator file service component is activated");
}
}
代码示例来源:origin: wso2/carbon-kernel
/**
* Register runtime instance on RuntimeManager.
*
* @param runtime - runtime to be registered
*/
public void registerRuntime(Runtime runtime) {
Utils.checkSecurity();
runtimeList.add(runtime);
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
getConfigUploader().
getSimulationConfig(simulationName,
(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS))
代码示例来源:origin: wso2/carbon-kernel
/**
* Method to set the given JAAS principal object to current carbon context instance. This will throw a
* IllegalStateException if a thread is trying to override currently set principal instance with the different
* instance.
*
* @param userPrincipal the jaas principal object to be set.
*/
public void setUserPrincipal(Principal userPrincipal) {
Utils.checkSecurity();
getCarbonContextHolder().setUserPrincipal(userPrincipal);
//for auditing
MDC.put("user-name", userPrincipal.getName());
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
getConfigUploader().
deleteSimulationConfig(simulationName,
(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS))
代码示例来源:origin: wso2/carbon-kernel
/**
* Returns the carbon context instance which is stored at current thread local space.
*
* @return the carbon context instance.
*/
public static PrivilegedCarbonContext getCurrentContext() {
Utils.checkSecurity();
return new PrivilegedCarbonContext(CarbonContextHolder.getCurrentContextHolder());
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
if (simulationConfigUploader.checkSimulationExists(
simulationName,
Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS).toString())) {
deleted = simulationConfigUploader.
deleteSimulationConfig(simulationName,
(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS))
uploadSimulationConfig(
simulationConfigDetails,
(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS)).toString());
代码示例来源:origin: wso2/carbon-kernel
/**
* Method to set key, value pair as properties with carbon context instance. The stored properties can be
* replaced with new values by using the same property name.
*
* @param name the name of property to be set.
* @param value the value of the property to be set.
*/
public void setProperty(String name, Object value) {
Utils.checkSecurity();
getCarbonContextHolder().setProperty(name, value);
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
getConfigUploader().
getSimulationConfig(entry.getKey(),
(Paths.get(Utils.getRuntimePath().toString(),
EventSimulatorConstants.DIRECTORY_DEPLOYMENT,
EventSimulatorConstants.DIRECTORY_SIMULATION_CONFIGS)).
JSONObject inactiveSimulation = new JSONObject(SimulationConfigUploader.getConfigUploader()
.getSimulationConfig(entry.getKey(), (Paths.get(
Utils.getRuntimePath().toString(),
EventSimulatorConstants
.DIRECTORY_DEPLOYMENT,
内容来源于网络,如有侵权,请联系作者删除!