public ResourceUpgrader(List <IUpgradePath> availableUpgrades)
 {
     VerifyArgument.IsNotNull("availableUpgrades", availableUpgrades);
     AvailableUpgrades = availableUpgrades;
 }
Exemplo n.º 2
0
 public ComposableRule(Rule <T> baseRule)
 {
     VerifyArgument.IsNotNull("baseRule", baseRule);
     _baseRule = baseRule;
     _check    = _baseRule.Check;
 }
 public ManageMySqlSourceViewModel(IManageDatabaseSourceModel updateManager, IEventAggregator aggregator, IDbSource dbSource, IAsyncWorker asyncWorker)
     : base(updateManager, aggregator, dbSource, asyncWorker, "MySqlDatabase")
 {
     VerifyArgument.IsNotNull("mySqlSource", dbSource);
 }
Exemplo n.º 4
0
 public EnvironmentModel(Guid id, IEnvironmentConnection environmentConnection, IResourceRepository resourceRepository, IStudioResourceRepository studioResourceRepository)
 {
     VerifyArgument.IsNotNull("resourceRepository", resourceRepository);
     Initialize(id, environmentConnection, resourceRepository, studioResourceRepository);
 }
Exemplo n.º 5
0
 public bool AuthorizeHubMethodInvocation(IHubIncomingInvokerContext context, bool appliesToMethod)
 {
     VerifyArgument.IsNotNull("context", context);
     return(Service.IsAuthorized(context.GetAuthorizationRequest()));
 }
 public TestSettingsRead(Func <IEsbManagementEndpoint> securityRead)
 {
     VerifyArgument.IsNotNull("securityRead", securityRead);
     _securityRead = securityRead;
 }
Exemplo n.º 7
0
        public ServiceDesignerViewModel(ModelItem modelItem, IContextualResourceModel rootModel, IEnvironmentRepository environmentRepository, IEventAggregator eventPublisher, IAsyncWorker asyncWorker)
            : base(modelItem)
        {
            AddTitleBarEditToggle();
            AddTitleBarMappingToggle();

            // PBI 6690 - 2013.07.04 - TWR : added
            // BUG 9634 - 2013.07.17 - TWR : resourceModel may be null if it is a remote resource whose environment is not connected!
            VerifyArgument.IsNotNull("rootModel", rootModel);
            VerifyArgument.IsNotNull("environmentRepository", environmentRepository);
            VerifyArgument.IsNotNull("eventPublisher", eventPublisher);
            VerifyArgument.IsNotNull("asyncWorker", asyncWorker);

            _worker         = asyncWorker;
            _eventPublisher = eventPublisher;
            eventPublisher.Subscribe(this);
            ButtonDisplayValue = DoneText;

            ShowExampleWorkflowLink = Visibility.Collapsed;
            RootModel = rootModel;
            DesignValidationErrors = new ObservableCollection <IErrorInfo>();
            FixErrorsCommand       = new DelegateCommand(o =>
            {
                FixErrors();
                IsFixed = IsWorstErrorReadOnly;
            });
            DoneCommand          = new DelegateCommand(o => Done());
            DoneCompletedCommand = new DelegateCommand(o => DoneCompleted());

            InitializeDisplayName();

            InitializeImageSource();

            IsAsyncVisible       = ActivityTypeToActionTypeConverter.ConvertToActionType(Type) == Common.Interfaces.Core.DynamicServices.enActionType.Workflow;
            OutputMappingEnabled = !RunWorkflowAsync;

            // When the active environment is not local, we need to get smart around this piece of logic.
            // It is very possible we are treating a remote active as local since we cannot logically assign
            // an environment id when this is the case as it will fail with source not found since the remote
            // does not contain localhost's connections ;)
            var activeEnvironment = environmentRepository.ActiveEnvironment;

            if (EnvironmentID == Guid.Empty && !activeEnvironment.IsLocalHostCheck())
            {
                _environment = activeEnvironment;
            }
            else
            {
                var environment = environmentRepository.FindSingle(c => c.ID == EnvironmentID);
                if (environment == null)
                {
                    IList <IEnvironmentModel> environments = EnvironmentRepository.Instance.LookupEnvironments(activeEnvironment);
                    environment = environments.FirstOrDefault(model => model.ID == EnvironmentID);
                }
                _environment = environment;
            }


            InitializeValidationService(_environment);
            if (!InitializeResourceModel(_environment))
            {
                return;
            }
            if (!IsDeleted)
            {
                // MUST InitializeMappings() first!
                InitializeMappings();
                InitializeLastValidationMemo(_environment);
                if (IsItemDragged.Instance.IsDragged)
                {
                    Expand();
                    IsItemDragged.Instance.IsDragged = false;
                }
            }
            if (_environment != null)
            {
                var source = _environment.ResourceRepository.FindSingle(a => a.ID == SourceId);
                if (source != null)
                {
                    FriendlySourceName = source.DisplayName;
                }
            }

            InitializeProperties();
            if (_environment != null)
            {
                _environment.AuthorizationServiceSet += OnEnvironmentOnAuthorizationServiceSet;
                AuthorizationServiceOnPermissionsChanged(null, null);
            }
        }
Exemplo n.º 8
0
 public AuthorizeHubAttribute(IAuthorizationService authorizationService)
 {
     VerifyArgument.IsNotNull("AuthorizationService", authorizationService);
     Service = authorizationService;
 }
Exemplo n.º 9
0
 public DataSet FetchDataSet(IDbCommand command, params SqlParameter[] parameters)
 {
     VerifyArgument.IsNotNull("command", command);
     AddParameters(command, parameters);
     return(_factory.FetchDataSet(command));
 }
        public override IOutputDescription TestService(DbService dbService)
        {
            VerifyArgument.IsNotNull("dbService", dbService);
            VerifyArgument.IsNotNull("dbService.Source", dbService.Source);

            IOutputDescription result;

            using (var server = CreateDbServer(dbService.Source as DbSource))
            {
                server.Connect(((DbSource)dbService.Source).ConnectionString);
                server.BeginTransaction();
                try
                {
                    //
                    // Execute command and normalize XML
                    //
                    IDbCommand command = CommandFromServiceMethod(server, dbService.Method);

                    // ReSharper disable PossibleNullReferenceException

                    var databaseName      = (dbService.Source as DbSource).DatabaseName;
                    var fullProcedureName = dbService.Method.ExecuteAction.Substring(dbService.Method.ExecuteAction.IndexOf(".", StringComparison.Ordinal) + 1);

                    // ReSharper disable once RedundantAssignment
                    var outParams         = server.GetProcedureOutParams(fullProcedureName, databaseName);
                    var countRefCursors   = outParams.Count(parameter => parameter.OracleDbType == OracleDbType.RefCursor);
                    var countSingleParams = outParams.Count(parameter => parameter.OracleDbType != OracleDbType.RefCursor);
                    if (countRefCursors > 1)
                    {
                        throw new Exception("Multiple Ref Cursor are not currently supported.");
                    }
                    if (countRefCursors >= 1 && countSingleParams >= 1)
                    {
                        throw new Exception("Mixing single return values and Ref Cursors are not currently supported.");
                    }
                    var        dbDataParameters = server.GetProcedureInputParameters(command, databaseName, fullProcedureName);
                    IDbCommand cmd = command.Connection.CreateCommand();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = databaseName + "." + fullProcedureName;
                    var parameters = dbService.Method.Parameters;
                    foreach (var dbDataParameter in dbDataParameters)
                    {
                        var foundParameter = parameters.FirstOrDefault(parameter => parameter.Name == dbDataParameter.ParameterName);
                        if (foundParameter != null)
                        {
                            dbDataParameter.Value = foundParameter.Value;
                        }
                        cmd.Parameters.Add(dbDataParameter);
                    }



                    // ReSharper restore PossibleNullReferenceException
                    foreach (var dbDataParameter in outParams)
                    {
                        cmd.Parameters.Add(dbDataParameter);
                    }
                    var dataTable = server.FetchDataTable(cmd);

                    //
                    // Map shape of XML
                    //
                    result = OutputDescriptionFactory.CreateOutputDescription(OutputFormats.ShapedXML);
                    var dataSourceShape = DataSourceShapeFactory.CreateDataSourceShape();
                    result.DataSourceShapes.Add(dataSourceShape);

                    var dataBrowser = DataBrowserFactory.CreateDataBrowser();
                    dataSourceShape.Paths.AddRange(dataBrowser.Map(dataTable));
                    cmd.Dispose();
                }
                finally
                {
                    server.RollbackTransaction();
                }
            }

            return(result);
        }
 public object Deserialize(string message, Type type)
 {
     VerifyArgument.IsNotNull("message", message);
     VerifyArgument.IsNotNull("type", type);
     return(JsonConvert.DeserializeObject(message, type, _deSerializerSettings));
 }
 public T Deserialize <T>([NotNull] string message)
 {
     VerifyArgument.IsNotNull("message", message);
     return(JsonConvert.DeserializeObject <T>(message, _deSerializerSettings));
 }
Exemplo n.º 13
0
 protected BaseConductor(IEventAggregator eventPublisher)
 {
     VerifyArgument.IsNotNull("eventPublisher", eventPublisher);
     _eventPublisher = eventPublisher;
     _eventPublisher.Subscribe(this);
 }
Exemplo n.º 14
0
 public FileChooserModel(IQueryManager queryManager)
 {
     VerifyArgument.IsNotNull("queryManager", queryManager);
     _queryManager = queryManager;
 }
Exemplo n.º 15
0
        public static string FindTextToSearch(this IntellisenseProviderContext context)
        {
            VerifyArgument.IsNotNull("context", context);
            var searchString  = string.Empty;
            var foundMinimum  = -1;
            var foundLength   = 0;
            var inputText     = context.InputText ?? string.Empty;
            var caretPosition = context.CaretPosition;

            var maxStringLength = Math.Min(caretPosition, inputText.Length);

            var closedBraceFound = false;
            var i = maxStringLength - 1;

            while (i >= 0)
            {
                var currentChar = inputText[i];
                if (currentChar == ')')
                {
                    closedBraceFound = true;
                }
                if (Char.IsWhiteSpace(currentChar))
                {
                    i = -1;
                }
                else
                {
                    ParseWarewolfLanguageSquareBraces(ref foundMinimum, ref foundLength, inputText, maxStringLength, closedBraceFound, ref i, currentChar);
                }
                i--;
            }

            if (foundMinimum != -1)
            {
                searchString = inputText.Substring(foundMinimum, foundLength);
            }

            var charArray = searchString.ToCharArray().ToList();

            if (!charArray.ToList().Any(c => Char.IsLetter(c) || c == '[' || c == '.' || c == ')'))
            {
                return(string.Empty);
            }

            var indexOfOpenBrace = inputText.IndexOf('(');

            if (indexOfOpenBrace > 0 && inputText[indexOfOpenBrace - 1] == '[')
            {
                return(string.Empty);
            }

            if (charArray.Count == 1)
            {
                if (!Char.IsLetterOrDigit(charArray[0]))
                {
                    return(string.Empty);
                }

                if (charArray[0] == '(')
                {
                    return(string.Empty);
                }
            }

            return(searchString);
        }