本文整理汇总了Java中org.oscm.app.business.APPlatformControllerFactory类的典型用法代码示例。如果您正苦于以下问题:Java APPlatformControllerFactory类的具体用法?Java APPlatformControllerFactory怎么用?Java APPlatformControllerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
APPlatformControllerFactory类属于org.oscm.app.business包,在下文中一共展示了APPlatformControllerFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Timeout
public void execute(Timer timer) {
if (!VM_TIMER_INFO.equals(timer.getInfo())) {
return;
}
List<ServiceInstance> instances = serviceInstanceService.getInstances();
for (ServiceInstance serviceInstance : instances) {
try {
final APPlatformController controller = APPlatformControllerFactory
.getInstance(serviceInstance.getControllerId());
int vmsNumber = controller.getServersNumber(serviceInstance.getInstanceId(),
serviceInstance.getSubscriptionId(), serviceInstance.getOrganizationId());
ServiceInstance updatedServiceInstance = serviceInstanceService.updateVmsNumber(serviceInstance,
vmsNumber);
serviceInstanceService.notifySubscriptionAboutVmsNumber(updatedServiceInstance);
} catch (APPlatformException e) {
logger.error("Subscription cannot be notified about VMs number: ", e);
}
}
}
示例2: requestControllerSettings
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public void requestControllerSettings(String controllerId)
throws ConfigurationException, ControllerLookupException {
HashMap<String, Setting> settings = configService
.getControllerConfigurationSettings(controllerId);
APPlatformController controller = APPlatformControllerFactory
.getInstance(controllerId);
ControllerSettings controllerSettings = new ControllerSettings(
settings);
controllerSettings.setAuthentication(
configService.getAuthenticationForBESTechnologyManager(
controllerId, null, null));
controller.setControllerSettings(controllerSettings);
}
示例3: testWrongInterface
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Test(expected = ControllerLookupException.class)
public void testWrongInterface() throws Exception {
context.bind(APPlatformController.JNDI_PREFIX + "test.controller",
new String());
APPlatformControllerFactory.getInstance("test.controller");
}
示例4: testOK
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Test
public void testOK() throws Exception {
new APPlatformControllerFactory(); // coverage
context.bind(APPlatformController.JNDI_PREFIX + "test.controller",
Mockito.mock(APPlatformController.class));
APPlatformController instance = APPlatformControllerFactory
.getInstance("test.controller");
Assert.assertTrue(instance instanceof APPlatformControllerAdapter);
}
示例5: requestControllerSettings
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public void requestControllerSettings(String controllerId)
throws ConfigurationException, ControllerLookupException {
HashMap<String, Setting> settings = configService
.getControllerConfigurationSettings(controllerId);
APPlatformController controller = APPlatformControllerFactory
.getInstance(controllerId);
ControllerSettings controllerSettings = new ControllerSettings(
settings);
controller.setControllerSettings(controllerSettings);
}
示例6: getInstanceDescription
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
InstanceDescription getInstanceDescription(InstanceRequest request,
User requestingUser)
throws APPlatformException, BadResultException {
final HashMap<String, Setting> parameters = createParameterMap(
request.getParameterValue());
final HashMap<String, Setting> attributes = createAttributeMap(
request.getAttributeValue());
String controllerId = parameters.get(InstanceParameter.CONTROLLER_ID)
.getValue();
if (controllerId == null) {
logger.warn(
"The technical service does not define a controller implementation");
throw new BadResultException(Messages
.get(request.getDefaultLocale(), "error_configuration"));
}
HashMap<String, Setting> controllerSettings = configService
.getControllerConfigurationSettings(controllerId);
HashMap<String, Setting> customAttributes = configService
.getCustomAttributes(request.getOrganizationId());
final ProvisioningSettings settings = new ProvisioningSettings(
parameters, attributes, customAttributes, controllerSettings,
request.getDefaultLocale());
settings.setOrganizationId(request.getOrganizationId());
settings.setOrganizationName(request.getOrganizationName());
settings.setSubscriptionId(request.getSubscriptionId());
settings.setReferenceId(request.getReferenceId());
settings.setBesLoginUrl(request.getLoginUrl());
ServiceInstance si = new ServiceInstance();
si.setInstanceParameters(createParameters(si, parameters));
si.setControllerId(controllerId);
settings.setAuthentication(
configService.getAuthenticationForBESTechnologyManager(
controllerId, si, null));
configService.copyCredentialsFromControllerSettings(settings,
controllerSettings);
settings.setRequestingUser(UserMapper.toServiceUser(requestingUser));
final APPlatformController controller = APPlatformControllerFactory
.getInstance(controllerId);
final InstanceDescription descr = controller.createInstance(settings);
// Check whether instanceId is filled and unique
if (Strings.isEmpty(descr.getInstanceId())) {
logger.error("Instance ID not specified by controller.");
throw new BadResultException(Messages
.get(request.getDefaultLocale(), "error_instanceid_empty"));
}
if (instanceDAO.exists(descr.getInstanceId())) {
logger.error("Instance ID " + descr.getInstanceId()
+ " already used by another instance.");
throw new BadResultException(
Messages.get(request.getDefaultLocale(),
"error_instanceid_exists", descr.getInstanceId()));
}
return descr;
}
示例7: updateUsers
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public BaseResult updateUsers(String instanceId, List<User> users,
User requestingUser) {
logger.info("Update users for service instance {}.", instanceId);
ServiceInstance instance = null;
try {
instance = instanceDAO.getInstanceById(instanceId);
checkInstanceAvailability(instance);
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
final ProvisioningSettings settings = configService
.getProvisioningSettings(instance,
UserMapper.toServiceUser(requestingUser));
// Forward request
final InstanceStatus status = controller.updateUsers(
instance.getInstanceId(), settings,
mapToServiceUsers(users));
if (status != null) {
// forward call to provisioning service on application instance
if (status.isInstanceProvisioningRequested()) {
final ProvisioningService provisioning = provisioningFactory
.getInstance(instance);
final BaseResult result = provisioning
.updateUsers(instanceId, users, requestingUser);
if (provResult.isError(result)) {
return result;
}
}
// If everything worked well we will save all changed parameters
instance.setInstanceParameters(status.getChangedParameters());
}
instance.setProvisioningStatus(
ProvisioningStatus.WAITING_FOR_USER_MODIFICATION);
em.persist(instance);
timerService.initTimers();
return provResult.newOkBaseResult();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return provResult.getErrorResult(BaseResult.class, e,
getLocale(requestingUser), instance, instanceId);
}
}
示例8: deleteUsers
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public BaseResult deleteUsers(String instanceId, List<User> users,
User requestingUser) {
logger.info("Delete users for instance {}.", instanceId);
ServiceInstance instance = null;
try {
instance = instanceDAO.getInstanceById(instanceId);
checkInstanceAvailability(instance);
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
final ProvisioningSettings settings = configService
.getProvisioningSettings(instance,
UserMapper.toServiceUser(requestingUser));
// Forward activation request
final InstanceStatus status = controller.deleteUsers(
instance.getInstanceId(), settings,
mapToServiceUsers(users));
if (status != null) {
// forward call to provisioning service on application instance
if (status.isInstanceProvisioningRequested()) {
final ProvisioningService provisioning = provisioningFactory
.getInstance(instance);
final BaseResult result = provisioning
.deleteUsers(instanceId, users, requestingUser);
if (provResult.isError(result)) {
return result;
}
}
// If everything worked well we will save all changed parameters
instance.setInstanceParameters(status.getChangedParameters());
}
instance.setProvisioningStatus(
ProvisioningStatus.WAITING_FOR_USER_DELETION);
em.persist(instance);
timerService.initTimers();
return provResult.newOkBaseResult();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return provResult.getErrorResult(BaseResult.class, e,
getLocale(requestingUser), instance, instanceId);
}
}
示例9: modifySubscription
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
private BaseResult modifySubscription(String instanceId,
String subscriptionId, String referenceId,
List<ServiceParameter> parameterValues,
List<ServiceAttribute> attributeValues,
final HashMap<String, Setting> parameterMap,
final HashMap<String, Setting> attributeMap,
ProvisioningStatus targetStatus, User requestingUser) {
ServiceInstance instance = null;
try {
instance = instanceDAO.getInstanceById(instanceId);
instance.prepareRollback();
checkInstanceAvailability(instance);
final HashMap<String, Setting> controllerSettings = configService
.getControllerConfigurationSettings(
instance.getControllerId());
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
final ProvisioningSettings currentSettings = configService
.getProvisioningSettings(instance,
UserMapper.toServiceUser(requestingUser));
final ProvisioningSettings newSettings = new ProvisioningSettings(
parameterMap, attributeMap,
currentSettings.getCustomAttributes(), controllerSettings,
instance.getDefaultLocale());
newSettings.setAuthentication(currentSettings.getAuthentication());
configService.copyCredentialsFromControllerSettings(newSettings,
controllerSettings);
newSettings.setRequestingUser(
UserMapper.toServiceUser(requestingUser));
newSettings.setSubscriptionId(subscriptionId);
newSettings.setReferenceId(referenceId);
// Forward modification request
final InstanceStatus status = controller.modifyInstance(
instance.getInstanceId(), currentSettings, newSettings);
if (status != null) {
// forward call to provisioning service on application instance
if (status.isInstanceProvisioningRequested()) {
final ProvisioningService provisioning = provisioningFactory
.getInstance(instance);
final List<ServiceParameter> filteredParameters = InstanceFilter
.getFilteredInstanceParametersForService(
parameterValues);
final BaseResult result = provisioning.modifySubscription(
instanceId, subscriptionId, referenceId,
filteredParameters, attributeValues,
requestingUser);
if (provResult.isError(result)) {
return result;
}
}
// If everything worked well we will save all changed parameters
instance.setInstanceParameters(status.getChangedParameters());
instance.setInstanceAttributes(status.getChangedAttributes());
}
instance.setProvisioningStatus(targetStatus);
instance.setSubscriptionId(subscriptionId);
instance.setReferenceId(referenceId);
em.persist(instance);
timerService.initTimers();
return provResult.newOkBaseResult();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return provResult.getErrorResult(BaseResult.class, e,
getLocale(requestingUser), instance, instanceId);
}
}
示例10: activateInstance
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public BaseResult activateInstance(String instanceId, User requestingUser) {
logger.info("Activate instance {}.", instanceId);
ServiceInstance instance = null;
try {
instance = instanceDAO.getInstanceById(instanceId);
checkInstanceAvailability(instance);
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
final ProvisioningSettings settings = configService
.getProvisioningSettings(instance,
UserMapper.toServiceUser(requestingUser));
// Forward request
final InstanceStatus status = controller
.activateInstance(instance.getInstanceId(), settings);
if (status != null) {
// forward call to provisioning service on application instance
if (status.isInstanceProvisioningRequested()) {
final ProvisioningService provisioning = provisioningFactory
.getInstance(instance);
final BaseResult result = provisioning
.activateInstance(instanceId, requestingUser);
if (provResult.isError(result)) {
return result;
}
}
// If everything worked well we will save all changed parameters
instance.setInstanceParameters(status.getChangedParameters());
}
// Update current state
instance.setProvisioningStatus(
ProvisioningStatus.WAITING_FOR_SYSTEM_ACTIVATION);
em.persist(instance);
timerService.initTimers();
return provResult.newOkBaseResult();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return provResult.getErrorResult(BaseResult.class, e,
getLocale(requestingUser), instance, instanceId);
}
}
示例11: deactivateInstance
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Override
public BaseResult deactivateInstance(String instanceId,
User requestingUser) {
logger.info("Deactivate instance {}.", instanceId);
ServiceInstance instance = null;
try {
instance = instanceDAO.getInstanceById(instanceId);
checkInstanceAvailability(instance);
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
final ProvisioningSettings settings = configService
.getProvisioningSettings(instance,
UserMapper.toServiceUser(requestingUser));
// Forward request
final InstanceStatus status = controller
.deactivateInstance(instance.getInstanceId(), settings);
if (status != null) {
// forward call to provisioning service on application instance
if (status.isInstanceProvisioningRequested()) {
final ProvisioningService provisioning = provisioningFactory
.getInstance(instance);
final BaseResult result = provisioning
.deactivateInstance(instanceId, requestingUser);
if (provResult.isError(result)) {
return result;
}
}
// If everything worked well we will save all changed parameters
instance.setInstanceParameters(status.getChangedParameters());
}
// Update current state
instance.setProvisioningStatus(
ProvisioningStatus.WAITING_FOR_SYSTEM_DEACTIVATION);
em.persist(instance);
timerService.initTimers();
return provResult.newOkBaseResult();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return provResult.getErrorResult(BaseResult.class, e,
getLocale(requestingUser), instance, instanceId);
}
}
示例12: getController
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
APPlatformController getController(final ServiceInstance instance)
throws APPlatformException {
final APPlatformController controller = APPlatformControllerFactory
.getInstance(instance.getControllerId());
return controller;
}
示例13: testNotBound
import org.oscm.app.business.APPlatformControllerFactory; //导入依赖的package包/类
@Test(expected = ControllerLookupException.class)
public void testNotBound() throws Exception {
APPlatformControllerFactory.getInstance("not-existing.controller");
}