當前位置: 首頁>>代碼示例>>Java>>正文


Java APPlatformControllerFactory類代碼示例

本文整理匯總了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);
		}
	}
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數: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);
    controllerSettings.setAuthentication(
            configService.getAuthenticationForBESTechnologyManager(
                    controllerId, null, null));
    controller.setControllerSettings(controllerSettings);
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:15,代碼來源:APPlatformServiceBean.java

示例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");
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:8,代碼來源:APPlatformControllerFactoryIT.java

示例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);
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:11,代碼來源:APPlatformControllerFactoryIT.java

示例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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:12,代碼來源:APPlatformServiceBean.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: 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-app,代碼行數:50,代碼來源: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: 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,項目名稱:oscm-app,代碼行數:51,代碼來源:AsynchronousProvisioningProxy.java

示例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);
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:53,代碼來源:AsynchronousProvisioningProxy.java

示例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;
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:7,代碼來源:OperationServiceBean.java

示例13: 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


注:本文中的org.oscm.app.business.APPlatformControllerFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。