本文整理汇总了Java中org.wso2.carbon.CarbonException类的典型用法代码示例。如果您正苦于以下问题:Java CarbonException类的具体用法?Java CarbonException怎么用?Java CarbonException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CarbonException类属于org.wso2.carbon包,在下文中一共展示了CarbonException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: canUserBeProvisioned
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
/**
* @param provisioningEntity
* @param provisionByRoleList
* @param tenantDomain
* @return
* @throws CarbonException
* @throws UserStoreException
*/
protected boolean canUserBeProvisioned(ProvisioningEntity provisioningEntity,
String[] provisionByRoleList, String tenantDomain) throws UserStoreException,
CarbonException {
if (provisioningEntity.getEntityType() != ProvisioningEntityType.USER
|| provisionByRoleList == null || provisionByRoleList.length == 0) {
// we apply restrictions only for users.
// if service provider's out-bound provisioning configuration does not define any roles
// to be provisioned then we apply no restrictions.
return true;
}
String userName = getUserName(provisioningEntity.getAttributes());
List<String> roleListOfUser = getUserRoles(userName, tenantDomain);
for (String provisionByRole : provisionByRoleList) {
if (roleListOfUser.contains(provisionByRole)) {
return true;
}
}
return false;
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:32,代码来源:OutboundProvisioningManager.java
示例2: getRegistry
import org.wso2.carbon.CarbonException; //导入依赖的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
示例3: getRegistryForAnonymousSession
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private static Registry getRegistryForAnonymousSession(String domainName, String username)
throws IdentityException {
try {
if (domainName == null && username == null) {
domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (username == null) {
return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService,
realmService, domainName);
} else {
return AnonymousSessionUtil.getSystemRegistryByUserName(registryService,
realmService, username);
}
} catch (CarbonException e) {
log.error("Error obtaining a registry instance", e);
throw IdentityException.error("Error obtaining a registry instance", e);
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:IdentityTenantUtil.java
示例4: getRealmForAnonymousSession
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
private static UserRealm getRealmForAnonymousSession(String domainName, String username)
throws IdentityException {
try {
if (username != null) {
return AnonymousSessionUtil.getRealmByUserName(registryService, realmService,
username);
}
if (domainName == null) {
domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService,
domainName);
} catch (CarbonException e) {
throw IdentityException.error("Error Obtaining a realm for user name: " + username + " and " +
"domain:" + domainName, e);
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:IdentityTenantUtil.java
示例5: getUserIM
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
/**
* Get the IM Address of an user to populate the IM field of XMPP Configuration page.
*
* @param userId
* @return
* @throws IdentityProviderException
*/
public String getUserIM(String userId) throws IdentityProviderException {
String message = "Invalid parameters provided to hasXMPPSettings";
validateInputParameters(new String[] { userId }, message);
checkUserAuthorization(userId, "hasXMPPSettings");
Map<String, String> claimValues = null;
try {
UserStoreManager userStore = AdminServicesUtil.getUserRealm().getUserStoreManager();
String[] imClaim = { UserCoreConstants.ClaimTypeURIs.IM };
claimValues = userStore.getUserClaimValues(userId, imClaim, UserCoreConstants.DEFAULT_PROFILE);
} catch (UserStoreException | CarbonException e) {
throw new IdentityProviderException("Failed to get claims for user " + userId);
}
if (claimValues.containsKey(UserCoreConstants.ClaimTypeURIs.IM)) {
return claimValues.get(UserCoreConstants.ClaimTypeURIs.IM);
} else {
return null;
}
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:28,代码来源:XMPPConfigurationService.java
示例6: canUserBeProvisioned
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
/**
* @param provisioningEntity
* @param provisionByRoleList
* @param tenantDomain
* @return
* @throws CarbonException
* @throws UserStoreException
*/
protected boolean canUserBeProvisioned(ProvisioningEntity provisioningEntity,
String[] provisionByRoleList, String tenantDomain) throws UserStoreException,
CarbonException {
if (provisioningEntity.getEntityType() != ProvisioningEntityType.USER
|| provisionByRoleList == null || provisionByRoleList.length == 0) {
// we apply restrictions only for users.
// if service provider's out-bound provisioning configuration does not define any roles
// to be provisioned then we apply no restrictions.
return true;
}
String userName = getUserName(provisioningEntity.getAttributes());
List<String> roleListOfUser = getUserRoles(userName, tenantDomain);
for (String provisionByRole : provisionByRoleList) {
if (roleListOfUser.contains(provisionByRole)) {
return true;
}
}
return false;
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:32,代码来源:OutboundProvisioningManager.java
示例7: getRealmForAnonymousSession
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
private static UserRealm getRealmForAnonymousSession(String domainName, String username)
throws IdentityException {
try {
if (domainName == null && username == null) {
domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (username == null) {
return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService,
domainName);
} else if (username != null) {
return AnonymousSessionUtil.getRealmByUserName(registryService, realmService,
username);
}
} catch (CarbonException e) {
log.error("Error obtaining the realm", e);
throw IdentityException.error("Error Obtaining a realm", e);
}
return null;
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:21,代码来源:IdentityTenantUtil.java
示例8: build
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static Component build(InputStream componentIn,
String componentName,
String componentVersion,
BundleContext bundleContext) throws CarbonException,
XMLStreamException {
XMLStreamReader streamReader =
XMLInputFactory.newInstance().createXMLStreamReader(componentIn);
StAXOMBuilder builder = new StAXOMBuilder(streamReader);
OMElement document = builder.getDocumentElement();
Component component = new Component();
component.setName(componentName);
component.setVersion(componentVersion);
processMenus(componentName, document, component);
processServlets(document, component);
processFileUploadConfigs(document, component);
processCustomUIs(document, component);
processOSGiServices(document, bundleContext);
processFrameworkConfiguration(document, component);
processContextConfiguration(componentName, document, component);
return component;
}
开发者ID:apache,项目名称:stratos,代码行数:25,代码来源:ComponentBuilder.java
示例9: processFileUploadExecutorDefinitions
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
private void processFileUploadExecutorDefinitions(Component component , String action) throws
CarbonException{
if (component.getFileUploadExecutorConfigs() != null
&& component.getFileUploadExecutorConfigs().length > 0) {
FileUploadExecutorManager executorManager =
(FileUploadExecutorManager) fileUploadExecManagerTracker.getService();
if (executorManager == null) {
log.error("FileUploadExecutorManager service is not available");
return;
}
FileUploadExecutorConfig[] executorConfigs = component.getFileUploadExecutorConfigs();
for (FileUploadExecutorConfig executorConfig : executorConfigs) {
String[] mappingActions = executorConfig.getMappingActionList();
for (String mappingAction : mappingActions) {
if (CarbonConstants.ADD_UI_COMPONENT.equals(action)) {
executorManager.addExecutor(mappingAction,
executorConfig.getFUploadExecClass());
} else if (CarbonConstants.REMOVE_UI_COMPONENT.equals(action)) {
executorManager.removeExecutor(mappingAction);
}
}
}
}
}
开发者ID:apache,项目名称:stratos,代码行数:25,代码来源:UIBundleDeployer.java
示例10: jsConstructor
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static Scriptable jsConstructor(Context cx, Object[] args, Function ctorObj,
boolean inNewExpr) throws CarbonException {
if (args.length == 1) {
if (args[0] instanceof Resource && !(args[0] instanceof Scriptable)) {
return new ResourceHostObject((Resource) args[0], cx);
} else if (args[0] instanceof Scriptable) {
throw new CarbonException("Resource object cannot be initialized directly, " +
"use registry.newResource() instead");
} else {
throw new CarbonException("Invalid argument type for Resource constructor");
}
} else {
throw new CarbonException("Resource object cannot be initialized directly, use " +
"registry.newResource() instead");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:17,代码来源:ResourceHostObject.java
示例11: jsFunction_getProperties
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static NativeArray jsFunction_getProperties(Context cx, Scriptable thisObj,
Object[] arguments,
Function funObj) throws CarbonException {
ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
if (arguments.length == 0) {
List<NativeObject> props= new ArrayList<NativeObject>();
Properties properties = resourceHostObject.resource.getProperties();
Enumeration<?> propertyNames = properties.propertyNames();
while(propertyNames.hasMoreElements()) {
NativeObject property = new NativeObject();
String key = (String) propertyNames.nextElement();
property.put("name", property, key);
property.put("value", property, properties.get(key));
props.add(property);
}
return new NativeArray(props.toArray());
} else {
throw new CarbonException("getProperties() method doesn't accept arguments");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:21,代码来源:ResourceHostObject.java
示例12: jsFunction_editPropertyValue
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static void jsFunction_editPropertyValue(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
if (arguments.length == 3) {
if (arguments[0] instanceof String && arguments[1] instanceof String &&
arguments[2] instanceof String) {
resourceHostObject.resource.editPropertyValue((String) arguments[0], (String) arguments[1],
(String) arguments[2]);
} else {
throw new CarbonException("Invalid argument types for editProperty() method");
}
} else {
throw new CarbonException("Invalid no. of arguments for editProperty() method");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:17,代码来源:ResourceHostObject.java
示例13: jsFunction_setProperty
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static void jsFunction_setProperty(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
if (arguments.length == 2) {
if (arguments[0] instanceof String && arguments[1] instanceof String) {
resourceHostObject.resource.setProperty((String) arguments[0], (String) arguments[1]);
} else if (arguments[0] instanceof String && arguments[1] instanceof NativeArray) {
resourceHostObject.resource.setProperty((String) arguments[0], (List) Context.jsToJava(
arguments[1], List.class));
} else {
throw new CarbonException("Invalid argument types for setProperty() method");
}
} else {
throw new CarbonException("Invalid no. of arguments for setProperty() method");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:17,代码来源:ResourceHostObject.java
示例14: jsGet_content
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public Object jsGet_content() throws CarbonException {
try {
Object result = this.resource.getContent();
String mediaType = this.resource.getMediaType();
if (result instanceof byte[]) {
//if mediaType is xml related one, we return an e4x xml object
if(mediaType.matches(".*[\\/].*[xX][mM][lL].*")) {
return context.newObject(this, "XML", new Object[]{new String((byte[]) result)});
}
return new String((byte[]) result);
} else if (result instanceof String[]) {
return new NativeArray((String[])result);
} else {
return Context.toObject(result, this);
}
} catch (RegistryException e) {
throw new CarbonException("Registry Exception while reading content property", e);
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:20,代码来源:ResourceHostObject.java
示例15: jsFunction_remove
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static void jsFunction_remove(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 1) {
if (arguments[0] instanceof String) {
try {
registryHostObject.registry.delete(getAbsoluteRegistryPath((String) arguments[0]));
} catch (RegistryException e) {
throw new CarbonException("Registry error occurred while executing delete()" +
" operation.", e);
}
} else {
throw new CarbonException("Path argument of method delete() should be a string.");
}
} else {
throw new CarbonException("Invalid no. of arguments for delete() method");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:19,代码来源:RegistryHostObject.java
示例16: jsFunction_put
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static String jsFunction_put(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 2) {
if (arguments[0] instanceof String && arguments[1] instanceof Scriptable) {
ResourceHostObject resourceHostobject = (ResourceHostObject) arguments[1];
try {
return registryHostObject.registry.put(getAbsoluteRegistryPath((String) arguments[0]),
resourceHostobject.getResource());
} catch (RegistryException e) {
throw new CarbonException("Registry error occurred while executing get() " +
"operation.", e);
}
} else {
throw new CarbonException("Invalid argument types for put() method.");
}
} else {
throw new CarbonException("Invalid no. of arguments for put() method");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:21,代码来源:RegistryHostObject.java
示例17: jsFunction_newCollection
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static Scriptable jsFunction_newCollection(Context cx, Scriptable thisObj,
Object[] arguments,
Function funObj) throws CarbonException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 0) {
if (registryHostObject.registry != null) {
try {
Collection collection = registryHostObject.registry.newCollection();
CollectionHostObject collectionHostobject = (CollectionHostObject) cx.newObject(
registryHostObject, "Collection", new Object[]{collection});
return collectionHostobject;
} catch (RegistryException e) {
throw new CarbonException("Error occurred while creating a new Collection.", e);
}
} else {
throw new CarbonException("Registry has not initialized.");
}
} else {
throw new CarbonException("newCollection() Method doesn't accept arguments.");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:22,代码来源:RegistryHostObject.java
示例18: jsFunction_newResource
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static Scriptable jsFunction_newResource(Context cx, Scriptable thisObj,
Object[] arguments,
Function funObj) throws CarbonException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 0) {
if (registryHostObject.registry != null) {
try {
Resource resource = registryHostObject.registry.newResource();
ResourceHostObject resourceHostobject = (ResourceHostObject) cx.newObject(
registryHostObject, "Resource", new Object[]{resource});
return resourceHostobject;
} catch (RegistryException e) {
throw new CarbonException("Error occurred while creating a new Resource.", e);
}
} else {
throw new CarbonException("Registry has not initialized.");
}
} else {
throw new CarbonException("newResource() Method doesn't accept arguments.");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:22,代码来源:RegistryHostObject.java
示例19: jsFunction_resourceExists
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
public static boolean jsFunction_resourceExists(Context cx, Scriptable thisObj,
Object[] arguments,
Function funObj) throws CarbonException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 1) {
if (arguments[0] instanceof String) {
try {
return registryHostObject.registry.resourceExists(getAbsoluteRegistryPath((String) arguments[0]));
} catch (RegistryException e) {
throw new CarbonException("Error occurred while creating a new Resource.", e);
}
} else {
throw new CarbonException("Invalid argument types for resourceExists() method.");
}
} else {
throw new CarbonException("Invalid no. of arguments");
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:19,代码来源:RegistryHostObject.java
示例20: getUserRealm
import org.wso2.carbon.CarbonException; //导入依赖的package包/类
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException {
UserRealm realm;
try {
realm = AnonymousSessionUtil.getRealmByTenantDomain(
FrameworkServiceComponent.getRegistryService(),
FrameworkServiceComponent.getRealmService(), tenantDomain);
} catch (CarbonException e) {
throw new FrameworkException("Error occurred while retrieving the Realm for " +
tenantDomain + " to handle local claims", e);
}
return realm;
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:13,代码来源:DefaultPostAuthenticationHandler.java
注:本文中的org.wso2.carbon.CarbonException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论