use of org.wso2.carbon.apimgt.api.model.Environment in project carbon-identity-framework by wso2.
the class PolicyEditorUtil method createMatchElement.
/**
* This method creates a match element (such as subject,action,resource or environment) of the XACML policy
*
* @param matchElementDTO match element data object
* @param doc XML document
* @return match Element
* @throws PolicyEditorException if any error occurs
*/
public static Element createMatchElement(MatchElementDTO matchElementDTO, Document doc) throws PolicyEditorException {
Element matchElement;
if (matchElementDTO.getMatchId() != null && matchElementDTO.getMatchId().trim().length() > 0) {
matchElement = doc.createElement(PolicyEditorConstants.MATCH_ELEMENT);
matchElement.setAttribute(PolicyEditorConstants.MATCH_ID, matchElementDTO.getMatchId());
if (matchElementDTO.getAttributeValueElementDTO() != null) {
Element attributeValueElement = createAttributeValueElement(matchElementDTO.getAttributeValueElementDTO(), doc);
matchElement.appendChild(attributeValueElement);
}
if (matchElementDTO.getAttributeDesignatorDTO() != null) {
Element attributeDesignatorElement = createAttributeDesignatorElement(matchElementDTO.getAttributeDesignatorDTO(), doc);
matchElement.appendChild(attributeDesignatorElement);
} else if (matchElementDTO.getAttributeSelectorDTO() != null) {
Element attributeSelectorElement = createAttributeSelectorElement(matchElementDTO.getAttributeSelectorDTO(), doc);
matchElement.appendChild(attributeSelectorElement);
}
} else {
throw new PolicyEditorException("Can not create Match element:" + " Required Attributes are missing");
}
return matchElement;
}
use of org.wso2.carbon.apimgt.api.model.Environment in project carbon-identity-framework by wso2.
the class IdentityUtil method getIdentityCacheConfig.
/**
* This reads the <CacheConfig> configuration in identity.xml.
* Since the name of the cache is different between the distributed mode and local mode,
* that is specially handled.
* <p>
* When calling this method, only pass the cacheManagerName and cacheName parameters considering
* how the names are set in a clustered environment i.e. without the CachingConstants.LOCAL_CACHE_PREFIX.
*/
public static IdentityCacheConfig getIdentityCacheConfig(String cacheManagerName, String cacheName) {
IdentityCacheConfigKey configKey = new IdentityCacheConfigKey(cacheManagerName, cacheName);
IdentityCacheConfig identityCacheConfig = identityCacheConfigurationHolder.get(configKey);
if (identityCacheConfig == null && cacheName.startsWith(CachingConstants.LOCAL_CACHE_PREFIX)) {
configKey = new IdentityCacheConfigKey(cacheManagerName, cacheName.replace(CachingConstants.LOCAL_CACHE_PREFIX, ""));
identityCacheConfig = identityCacheConfigurationHolder.get(configKey);
}
return identityCacheConfig;
}
use of org.wso2.carbon.apimgt.api.model.Environment in project product-iots by wso2.
the class IOTServerExtension method initiate.
@Override
public void initiate() {
try {
automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, IOT_CORE_PORT_OFFSET);
}
serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
} catch (XPathExpressionException e) {
throw new RuntimeException("Error while initiating test environment", e);
}
}
use of org.wso2.carbon.apimgt.api.model.Environment in project product-iots by wso2.
the class BrokerServerExtension method initiate.
@Override
public void initiate() throws AutomationFrameworkException {
try {
automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "3");
}
serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
} catch (XPathExpressionException e) {
handleException("Error while initiating test environment", e);
}
}
use of org.wso2.carbon.apimgt.api.model.Environment in project carbon-mediation by wso2.
the class ConfigurationUpdater method publishConfiguration.
private void publishConfiguration(SynapseConfiguration synCfg, Axis2SynapseEnvironment synEnv) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
SynapseRegistrationsService registrationsService = ConfigHolder.getInstance().getSynapseRegistrationService(tenantId);
if (registrationsService != null) {
serverContextInformation.setSynapseConfiguration(synCfg);
// populate the Synapse Configuration
ServiceRegistration configRegistration = registrationsService.getSynapseConfigurationServiceRegistration();
SynapseConfigurationService synCfgSvc = (SynapseConfigurationService) ConfigHolder.getInstance().getBundleContext().getService(configRegistration.getReference());
synCfgSvc.setSynapseConfiguration(synCfg);
configRegistration.setProperties(new Properties());
// populate the Synapse Environment
ServiceRegistration synEnvSvcRegistration = registrationsService.getSynapseEnvironmentServiceRegistration();
SynapseEnvironmentService synEnvSvc = (SynapseEnvironmentService) ConfigHolder.getInstance().getBundleContext().getService(synEnvSvcRegistration.getReference());
synEnvSvc.setSynapseEnvironment(synEnv);
synEnvSvcRegistration.setProperties(new Properties());
ConfigurationTrackingService trackingSvc = ConfigHolder.getInstance().getSynapseConfigTrackingService();
if (trackingSvc != null) {
trackingSvc.setSynapseConfiguration(synCfg);
}
} else {
String msg = "Couldn't find the OSGi service information about this " + "ESB Configuration";
log.error(msg);
throw new ConfigAdminException(msg);
}
}
Aggregations