Beispiel #1
0
        public DfsContext(IDfsConfiguration dfsConfiguration)
        {
            this.dfsConfiguration = dfsConfiguration;
            serviceFactory = ServiceFactory.Instance;

            var contextFactory = ContextFactory.Instance;
            serviceContext = contextFactory.NewContext();

            var repositoryIdentity = new RepositoryIdentity(dfsConfiguration.Repository, dfsConfiguration.UserName, dfsConfiguration.Password, string.Empty);
            serviceContext.AddIdentity(repositoryIdentity);

            var contentTransferProfile = new ContentTransferProfile
            {
                TransferMode = ContentTransferMode.MTOM
            };
            serviceContext.SetProfile(contentTransferProfile);

            // Setting the filter to ALL can cause errors if the DataObject
            // passed to the operation contains system properties, so to be safe 
            // set the filter to ALL_NON_SYSTEM unless you explicitly want to update
            // a system property
            var propertyProfile = new PropertyProfile
            {
                FilterMode = PropertyFilterMode.ALL_NON_SYSTEM
            };
            serviceContext.SetProfile(propertyProfile);

            serviceContext.SetRuntimeProperty("USER_TRANSACTION_HINT", "TRANSACTION_REQUIRED");
        }
Beispiel #2
0
        private static IServiceContext createContext(String repository, String userName, String password)
        {
            Console.Out.WriteLine("Creating new empty IServiceContext instance...");

            //build context factory and an empty context
            ContextFactory  cf      = ContextFactory.Instance;
            IServiceContext context = cf.NewContext();

            Console.Out.WriteLine("Creating new repository identity...");

            //create a repository ID and seed it with the login credentials
            RepositoryIdentity repoIdent = new RepositoryIdentity(repository, userName, password, "");

            Console.Out.WriteLine("Adding repository ID into IServiceContext object...");

            //seed the IServiceContext with the Repository ID
            context.AddIdentity(repoIdent);

            ContentTransferProfile ctp = new ContentTransferProfile();

            ctp.TransferMode = ContentTransferMode.BASE64;
            context.SetProfile(ctp);

            return(context);
        }
Beispiel #3
0
        public void setContext(string userName, string password, string address, string repository)
        {
            /*
             * Get the service context and set the user
             * credentials and repository information
             */
            this.userName   = userName;
            this.password   = password;
            this.repository = repository;
            this.address    = address;

            ContextFactory contextFactory = ContextFactory.Instance;

            serviceContext = contextFactory.NewContext();
            RepositoryIdentity repositoryIdentity =
                new RepositoryIdentity(repository, userName, password, "");

            serviceContext.AddIdentity(repositoryIdentity);
        }
Beispiel #4
0
        /// <summary>
        /// Creazione di un oggetto Service di documentum, a partire da un token di autenticazione utente
        /// </summary>
        /// <param name="authenticationToken">Token di autenticazione utente</param>
        /// <param name="serviceModule"></param>
        /// <returns></returns>
        private static T GetServiceInstance <T>(string authenticationToken, string serviceModule)
        {
            IServiceContext context = DctmServiceContextHelper.GetCurrent();

            //ContentTransferProfile contentTransferProfile = new ContentTransferProfile();
            //contentTransferProfile.TransferMode = ContentTransferMode.BASE64;
            //OperationOptions streamOptions = new OperationOptions();
            //ContentProfile contentProfile = streamOptions.ContentProfile;
            //contentProfile.FormatFilter = FormatFilter.ANY;
            //contentProfile.formatFilterSpecified = true;
            //context.SetProfile(contentProfile);

            // Reperimento oggetto identity dal token di autenticazione
            context.AddIdentity(DctmRepositoryIdentityHelper.GetIdentity(authenticationToken));

            // Reperimento url del servizio
            string serviceUrl = DctmConfigurations.GetDocumentumServerUrl();

            return(ServiceFactory.Instance.GetRemoteService <T>(context, serviceModule, serviceUrl));
        }