Search in sources :

Example 26 with Singleton

use of com.google.inject.Singleton in project joynr by bmwcarit.

the class GlobalDomainAccessControllerModule method provideCacheManager.

@Provides
@Singleton
CacheManager provideCacheManager() {
    Configuration configuration = new Configuration();
    configuration.setName("GDACEhCacheManager");
    return CacheManager.create(configuration);
}
Also used : Configuration(net.sf.ehcache.config.Configuration) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 27 with Singleton

use of com.google.inject.Singleton in project ovirt-engine by oVirt.

the class BaseSystemModule method getXsrfTokenService.

@Provides
@Singleton
public XsrfTokenServiceAsync getXsrfTokenService() {
    XsrfTokenServiceAsync service = GWT.create(XsrfTokenService.class);
    ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + XsrfRpcRequestBuilder.XSRF_PATH);
    return service;
}
Also used : XsrfTokenServiceAsync(com.google.gwt.user.client.rpc.XsrfTokenServiceAsync) ServiceDefTarget(com.google.gwt.user.client.rpc.ServiceDefTarget) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 28 with Singleton

use of com.google.inject.Singleton in project ovirt-engine by oVirt.

the class UserModule method getPermissionListProvider.

@Provides
@Singleton
public SearchableDetailModelProvider<Permission, UserListModel, UserPermissionListModel> getPermissionListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<UserRolesPopupPresenterWidget> popupProvider, final Provider<RolePermissionsRemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> mainModelProvider, final Provider<UserPermissionListModel> modelProvider) {
    SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel> result = new SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand, Model windowModel) {
            UserPermissionListModel model = getModel();
            if (lastExecutedCommand == model.getAddRoleToUserCommand()) {
                return popupProvider.get();
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) UserGeneralModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGeneralModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UserQuotaListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserQuotaListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UserEventNotifierListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventNotifierListModel) UserEventListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventListModel) UserGroupListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGroupListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) SearchableDetailTabModelProvider(org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 29 with Singleton

use of com.google.inject.Singleton in project ovirt-engine by oVirt.

the class UserModule method getUserListProvider.

// Main List Model
@Provides
@Singleton
public MainModelProvider<DbUser, UserListModel> getUserListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<AssignTagsPopupPresenterWidget> assignTagsPopupProvider, final Provider<PermissionsPopupPresenterWidget> popupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> modelProvider) {
    MainViewModelProvider<DbUser, UserListModel> result = new MainViewModelProvider<DbUser, UserListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserListModel source, UICommand lastExecutedCommand, Model windowModel) {
            UserListModel model = getModel();
            if (lastExecutedCommand == model.getAssignTagsCommand()) {
                return assignTagsPopupProvider.get();
            } else if (lastExecutedCommand == model.getAddCommand()) {
                return popupProvider.get();
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setModelProvider(modelProvider);
    return result;
}
Also used : MainViewModelProvider(org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) UserGeneralModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGeneralModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UserQuotaListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserQuotaListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UserEventNotifierListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventNotifierListModel) UserEventListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventListModel) UserGroupListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGroupListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 30 with Singleton

use of com.google.inject.Singleton in project ovirt-engine by oVirt.

the class VirtualMachineModule method getVmDiskListProvider.

@Provides
@Singleton
public SearchableDetailModelProvider<Disk, VmListModel<Void>, VmDiskListModel> getVmDiskListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<VmDiskPopupPresenterWidget> popupProvider, final Provider<VmDiskAttachPopupPresenterWidget> attachPopupProvider, final Provider<VmDiskRemovePopupPresenterWidget> removeConfirmPopupProvider, final Provider<VmDiskSparsifyPopupPresenterWidget> sparsifyConfirmPopupProvider, final Provider<DisksAllocationPopupPresenterWidget> movePopupProvider, final Provider<ChangeQuotaPopupPresenterWidget> changeQutoaPopupProvider, final Provider<VmListModel<Void>> mainModelProvider, final Provider<VmDiskListModel> modelProvider) {
    SearchableDetailTabModelProvider<Disk, VmListModel<Void>, VmDiskListModel> result = new SearchableDetailTabModelProvider<Disk, VmListModel<Void>, VmDiskListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(VmDiskListModel source, UICommand lastExecutedCommand, Model windowModel) {
            VmDiskListModel model = getModel();
            if (lastExecutedCommand == model.getNewCommand() || lastExecutedCommand == model.getEditCommand()) {
                return popupProvider.get();
            } else if (lastExecutedCommand == getModel().getAttachCommand()) {
                return attachPopupProvider.get();
            } else if (lastExecutedCommand == getModel().getMoveCommand()) {
                return movePopupProvider.get();
            } else if (lastExecutedCommand == getModel().getChangeQuotaCommand()) {
                return changeQutoaPopupProvider.get();
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(VmDiskListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else if (lastExecutedCommand == getModel().getSparsifyCommand()) {
                return sparsifyConfirmPopupProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
}
Also used : VmListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel) VmListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel) VmDevicesListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmDevicesListModel) VmAffinityGroupListModel(org.ovirt.engine.ui.uicommonweb.models.configure.scheduling.affinity_groups.list.VmAffinityGroupListModel) VmErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.VmErrataCountModel) VmGuestInfoModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmGuestInfoModel) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) NewDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.NewDiskModel) VmInterfaceListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceListModel) ImportVmsModel(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmsModel) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) VncInfoModel(org.ovirt.engine.ui.uicommonweb.models.vms.VncInfoModel) ImportVmFromExportDomainModel(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmFromExportDomainModel) VmDiskListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmDiskListModel) VmAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.VmAffinityLabelListModel) VmAppListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmAppListModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) EditDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) VmSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmSnapshotListModel) VmEventListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmEventListModel) VmGeneralModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmGeneralModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) VmGuestContainerListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmGuestContainerListModel) VmHostDeviceListModel(org.ovirt.engine.ui.uicommonweb.models.vms.hostdev.VmHostDeviceListModel) ImportVmFromExternalProviderModel(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmFromExternalProviderModel) VmNextRunConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmNextRunConfigurationModel) VmErrataListModel(org.ovirt.engine.ui.uicommonweb.models.VmErrataListModel) VmImportGeneralModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmImportGeneralModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VmDiskListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmDiskListModel) SearchableDetailTabModelProvider(org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Singleton (com.google.inject.Singleton)80 Provides (com.google.inject.Provides)77 AbstractModule (com.google.inject.AbstractModule)8 Injector (com.google.inject.Injector)8 Named (com.google.inject.name.Named)7 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)7 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)7 Model (org.ovirt.engine.ui.uicommonweb.models.Model)7 IOException (java.io.IOException)5 SearchableDetailTabModelProvider (org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider)5 PermissionListModel (org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel)5 DataSourceFactory (io.dropwizard.db.DataSourceFactory)4 ManagedDataSource (io.dropwizard.db.ManagedDataSource)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 File (java.io.File)3 InetSocketAddress (java.net.InetSocketAddress)3 SocketAddress (java.net.SocketAddress)3 Properties (java.util.Properties)3 Test (org.junit.Test)3 ConfigModule (co.cask.cdap.common.guice.ConfigModule)2