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


Java APPlatformControllerFactory.getInstance方法代码示例

本文整理汇总了Java中org.oscm.app.business.APPlatformControllerFactory.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java APPlatformControllerFactory.getInstance方法的具体用法?Java APPlatformControllerFactory.getInstance怎么用?Java APPlatformControllerFactory.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.oscm.app.business.APPlatformControllerFactory的用法示例。


在下文中一共展示了APPlatformControllerFactory.getInstance方法的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);
		}
	}
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:TimerRefreshSubscriptions.java

示例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);
    controller.setControllerSettings(controllerSettings);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:APPlatformServiceBean.java

示例3: 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);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:15,代码来源:APPlatformServiceBean.java

示例4: 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");
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:8,代码来源:APPlatformControllerFactoryIT.java

示例5: 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);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:11,代码来源:APPlatformControllerFactoryIT.java

示例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;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:61,代码来源:AsynchronousProvisioningProxy.java

示例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);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:53,代码来源:AsynchronousProvisioningProxy.java

示例8: 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);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:53,代码来源:AsynchronousProvisioningProxy.java

示例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);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:78,代码来源:AsynchronousProvisioningProxy.java

示例10: getController

import org.oscm.app.business.APPlatformControllerFactory; //导入方法依赖的package包/类
APPlatformController getController(final ServiceInstance instance)
        throws APPlatformException {
    final APPlatformController controller = APPlatformControllerFactory
            .getInstance(instance.getControllerId());
    return controller;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:7,代码来源:OperationServiceBean.java

示例11: testNotBound

import org.oscm.app.business.APPlatformControllerFactory; //导入方法依赖的package包/类
@Test(expected = ControllerLookupException.class)
public void testNotBound() throws Exception {
    APPlatformControllerFactory.getInstance("not-existing.controller");
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:5,代码来源:APPlatformControllerFactoryIT.java

示例12: 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);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:50,代码来源:AsynchronousProvisioningProxy.java

示例13: 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);
    }
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:51,代码来源:AsynchronousProvisioningProxy.java


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