top-image

LATEST ARTICLES

Hello,

I would like to explain information concerning an error with the message DM_API_E_EXIST with stacktraces below. The system could not retrieve the objects while they were present in the docbase, suggesting a problem of corruption or consistency.

First, in Documentum, there are several levels of cache : Object type caching (cache of object type definitions), Repository session caches (existing only for the life of the repository session), Persistent caching…etc.
See Caching chapter in “Documentum Content Server Fundamentals” documentation :
http://www.jouvinio.net/wiki/images/c/c2/Documentum_Content_Server_6.7_Fundamentals.pdf or this other resource : http://pingfang.iteye.com/blog/869589

Secondly, after some research on the net, it seems that the concern comes from the persistent cache at the DFC level. The first test was to change the value of the I_VSTAMP field on the DM_SYSOBJECT_S table for one of the documents concerned by the problem. After incrementing the value of 1, the problem in client application no longer appeared for the document. Obviously this change forces DFC to flush the persistent cache for this object.
Obviously, a change on this property forces DFC to flush out all persistent caches of any kind, and this for any new open sessions from the change.

More, there is client_pcaching_change property which controls whether the persistent caches, including the object caches and all query caches, are flushed when a client session is started. When a client session is started, the DFC checks the cached value of the client_pcaching_change property against the repository value. If the values are different, the DFC flushes all the persistent caches, including the object caches and all query caches.The client_pcaching_change value must be changed in the docbase config object manually, by a Superuser.

[9/10/17 16:48:45:004 CEST] 00000488 SystemOut     O 1600024485 [WebContainer : 22] ERROR com.emc.documentum.fs.services.core.ObjectServiceWebService  - Operation output generation failed: could not retrieve data for identity: 090xxxxxxxxxxxx04. [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."
com.emc.documentum.fs.services.core.CoreServiceException: Operation output generation failed: could not retrieve data for identity: 090xxxxxxxxxxxx04. [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."
	at com.emc.documentum.fs.services.core.impl.execution.proto.transformation.CoreServiceExceptionContext.execute(CoreServiceExceptionContext.java:31)
	at com.emc.documentum.fs.services.core.impl.execution.proto.payload.FailOnExceptionPayloadPolicy.execute(FailOnExceptionPayloadPolicy.java:28)
	at com.emc.documentum.fs.services.core.impl.execution.proto.payload.PayloadPolicy.execute(PayloadPolicy.java:33)
	at com.emc.documentum.fs.services.core.impl.execution.proto.payload.PayloadPolicy.execute(PayloadPolicy.java:1)
	at com.emc.documentum.fs.services.core.impl.execution.proto.transformation.ObjectIdentitySetToDataPackagePayloadAdapter.execute(ObjectIdentitySetToDataPackagePayloadAdapter.java:29)
	at com.emc.documentum.fs.services.core.impl.ObjectService.get(ObjectService.java:397)
	at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at com.emc.documentum.fs.rt.context.impl.ReflectionServiceInvoker.invoke(ReflectionServiceInvoker.java:40)
	at com.emc.documentum.fs.rt.impl.tx.TxInvocationHandler.invoke(TxInvocationHandler.java:29)
	at com.emc.documentum.fs.rt.context.impl.SoapServiceInvocationHandler.invoke(SoapServiceInvocationHandler.java:50)
	at com.emc.documentum.fs.rt.context.impl.ContextCacheCleanupHandler.invoke(ContextCacheCleanupHandler.java:28)
	at com.emc.documentum.fs.rt.context.impl.ServiceContextCleanupHandler.invoke(ServiceContextCleanupHandler.java:31)
	at com.emc.documentum.fs.rt.context.impl.HandlerChainExceptionInvocationHandler.invoke(HandlerChainExceptionInvocationHandler.java:35)
	at com.emc.documentum.fs.rt.context.impl.UcfServiceInvocationHandler.invoke(UcfServiceInvocationHandler.java:53)
	at com.emc.documentum.fs.rt.context.impl.OperationOptionsHandler.invoke(OperationOptionsHandler.java:72)
	at com.emc.documentum.fs.rt.context.impl.FileRegistryCleanupHandler.invoke(FileRegistryCleanupHandler.java:25)
	at com.sun.proxy.$Proxy112.get(Unknown Source)
	at com.emc.documentum.fs.services.core.ObjectServiceWebService.get(ObjectServiceWebService.java:262)
	at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
	at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
	at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
	at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
	at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
	at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
	at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
	at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
	at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
	at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
	at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
	at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
	at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1114)
	at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949)
	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
	at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
	at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1833)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: 
com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DfcOperationException: Failed to retrieve relations from docbrocker. [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DeepGetAction.execute(DeepGetAction.java:135)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DeepGetAction.execute(DeepGetAction.java:1)
	at com.emc.documentum.fs.services.core.impl.execution.proto.transformation.DataObjectToObjectIdentityAdapter.execute(DataObjectToObjectIdentityAdapter.java:22)
	at com.emc.documentum.fs.services.core.impl.execution.proto.transformation.DataObjectToObjectIdentityAdapter.execute(DataObjectToObjectIdentityAdapter.java:1)
	at com.emc.documentum.fs.services.core.impl.execution.proto.transformation.CoreServiceExceptionContext.execute(CoreServiceExceptionContext.java:27)
	... 61 more
Caused by: 
com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DfcOperationException: E_CANNOT_LOAD_PROPERTIES. [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PropertiesLoader.process(PropertiesLoader.java:64)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PropertiesLoader.execute(PropertiesLoader.java:40)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PropertiesLoader.execute(PropertiesLoader.java:1)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PermissionsLoader.execute(PermissionsLoader.java:38)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PermissionsLoader.execute(PermissionsLoader.java:1)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DeepGetAction.walk(DeepGetAction.java:223)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DeepGetAction.execute(DeepGetAction.java:119)
	... 65 more
Caused by: 
com.emc.documentum.fs.services.core.impl.execution.proto.dfc.DfcOperationException: Getting persistent object failed. Repository: "MY_DOCBASE_PROD". [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."
	at com.emc.documentum.fs.services.core.impl.execution.proto.util.GetIdUtil.getPersistentObject(GetIdUtil.java:154)
	at com.emc.documentum.fs.services.core.impl.execution.proto.dfc.PropertiesLoader.process(PropertiesLoader.java:55)
	... 71 more
Caused by: 
DfIdNotFoundException:: THREAD: WebContainer : 22; MSG: [DM_API_E_EXIST]error:  "Document/object specified by 090xxxxxxxxxxxx04 does not exist."; ERRORCODE: 100; NEXT: null
	at com.documentum.fc.client.impl.objectmanager.PersistentDataManager.fetchFromServer(PersistentDataManager.java:214)
	at com.documentum.fc.client.impl.objectmanager.PersistentDataManager.getData(PersistentDataManager.java:92)
	at com.documentum.fc.client.impl.objectmanager.PersistentObjectManager.getObjectFromServer(PersistentObjectManager.java:355)
	at com.documentum.fc.client.impl.objectmanager.PersistentObjectManager.getObject(PersistentObjectManager.java:311)
	at com.documentum.fc.client.impl.session.Session.getObject(Session.java:906)
	at com.documentum.fc.client.impl.session.SessionHandle.getObject(SessionHandle.java:637)
	at com.emc.documentum.fs.services.core.impl.execution.proto.util.GetIdUtil.getPersistentObject(GetIdUtil.java:150)
	... 72 more
Caused by: 
DfException:: THREAD: WebContainer : 22; MSG: [DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '090xxxxxxxxxxxx04'."; ERRORCODE: 100; NEXT: null
	at com.documentum.fc.client.impl.docbase.DocbaseExceptionMapper.newException(DocbaseExceptionMapper.java:57)
	at com.documentum.fc.client.impl.connection.docbase.MessageEntry.getException(MessageEntry.java:39)
	at com.documentum.fc.client.impl.connection.docbase.DocbaseMessageManager.getException(DocbaseMessageManager.java:137)
	at com.documentum.fc.client.impl.connection.docbase.netwise.NetwiseDocbaseRpcClient.checkForMessages(NetwiseDocbaseRpcClient.java:310)
	at com.documentum.fc.client.impl.connection.docbase.netwise.NetwiseDocbaseRpcClient.applyForObject(NetwiseDocbaseRpcClient.java:653)
	at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection$8.evaluate(DocbaseConnection.java:1326)
	at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.evaluateRpc(DocbaseConnection.java:1085)
	at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.applyForObject(DocbaseConnection.java:1318)
	at com.documentum.fc.client.impl.docbase.DocbaseApi.parameterizedFetch(DocbaseApi.java:108)
	at com.documentum.fc.client.impl.objectmanager.PersistentDataManager.fetchFromServer(PersistentDataManager.java:201)
	... 78 more
#################
select  client_pcaching_change FROM dm_docbase_config;
12

Best regards,

Hi,
Following options enable logging of all communication to the console. Set these options in the code, as command line parameter using -D or as environment variable:

	static {
		// 
		System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
		System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
		System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
		System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");


		//System.setProperty("javax.net.ssl.trustStore", System.getProperty("user.dir") + "\\mycertificates");
		//System.setProperty("javax.net.ssl.trustStorePassword", "JavaLu");
		//System.setProperty("javax.net.ssl.keyStore", System.getProperty("user.dir") + "\\mycertificates");
		//System.setProperty("javax.net.ssl.keyStorePassword", "JavaLu");

	}

Best regards,

Huseyin

Hello,

Sometimes, the execution of a job/method Documentum via Java Method Server (JMS) can generate a Core dump error for various reasons : content file protected, document corrupted, …etc…especially when using IRM protection which produces the stopping of DCTM job.

Here, an example of error:

	EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000111b9d09, pid=3684, tid=7584
	#
	# JRE version: 7.0_17-b02
	# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode windows-amd64 compressed oops)
	# Problematic frame:
	# C  [libemcdctmirm.dll+0x1f9d09]  PVS_TemplateListFree+0x7069
	#
	# Core dump written. Default location: D:\App\Workspaces\....\hs_err_pid3684.mdmp

So, I will try to expose a simple solution in order to avoid the stopping of JMS by by-passing the use of JMS:
DCTM JOB => DCTM METHOD => Script BATCH CMD => Script POWERSHELL => JAVA DFC/JVM

  • Creation of a DCTM job My_Method_PowershellScript :
    In Documentum Administrator, in the section Administration/Job Management/Methods, create a method My_Method_PowershellScript:

    ***** in tab "Method Info" 
    * Name = My_Method_PowershellScript
    * Verb = D:\App\MyFolder4DCTM\My_ScriptProcess.cmd
    * Method Type = program
    * Timeout Minimum = 30
    * Timeout Default = 172800
    * Timeout Maximum = 345600
    * Launch Direct	= [X] Use the exec call to execute the procedure
    * Launch Asynchronously	= [X] Launch as a separate process	 
    * Run As Owner = [X] Run as the installation owner
    

  • Creation of a DCTM method My_Job_BatchScript :
    In Documentum Administrator, in the section Administration/Job Management/Jobs, create a method My_Job_BatchScript:

    ***** in tab "Info"
    * Name = My_Job_BatchScript
    * Trace Level = 0 (no trace)
    * Designated Server = Any Running Server
    * State = "Inactive"
    
    ***** in tab "Method"
    * Method Name = My_Method_PowershellScript
    
    ***** in tab "SysObject Info"
    * Title = My_Job_BatchScript
    

  • Creation of folder containing the scripts and librairies D:\App\MyFolder4DCTM on DCTM server

  • Creation of BATCH CMD script My_ScriptProcess.cmd in the folder D:\App\MyFolder4DCTM calling the POWERSHELL script:
    @echo off
    SET "DOCUMENTIDS="
    :parse
    IF "%~1"=="" GOTO endparse
    if "%DOCUMENTIDS%"=="" (
    	SET DOCUMENTIDS=-DocumentIds %~1
    ) ELSE (
    	SET DOCUMENTIDS=%DOCUMENTIDS%,%~1
    )
    SHIFT
    GOTO parse
    
    :endparse
    
    CD "D:\App\MyFolder4DCTM"
    D:
    
    SET CurrentDirectory=%CD%
    SET JavaHome=D:\Documentum\java64\1.7.0_17
    SET DctmDirectory=D:\Documentum
    SET DctmConfigDirectory=%DctmDirectory%\config
    SET DctmIrmDirectory=%DctmDirectory%\irm
    
    powershell .\My_ScriptProcess.ps1 "%DOCUMENTIDS%" -DctmEnv ALL -CurrentDirectory "%CurrentDirectory%" -JavaHome "%JavaHome%" -DctmConfigDirectory "%DctmConfigDirectory%" -DctmIrmDirectory "%DctmIrmDirectory%"
    

  • Creation of POWERSHELL script My_ScriptProcess.ps1 in the folder D:\App\MyFolder4DCTM calling the JAVA com.java.lu.business.service.ecm.utils.main.CreateListToProcess:
    param(
    	[Int32[]] $DocumentIds,
    	[String] $CurrentDirectory,
    	[String] $JavaHome,
    	[String] $DctmConfigDirectory,
    	[String] $DctmIrmDirectory,
    	[String] $DctmEnv
    )
    
    
    
    
    function CreateIdList
    {
    	param(
    		[String] $DocumentIds,
    		[String] $CurrentDirectory,
    		[String] $JavaHome,
    		[String] $DctmConfigDirectory,
    		[String] $DctmIrmDirectory,
    		[String] $DctmEnv,
    		[String] $IdsToProcessFile
    	)
    	
    	Write-Host "Calling CreateIdList with parameters:"
    	Write-Host " * DocumentIds: $DocumentIds"
    	Write-Host " * CurrentDirectory: $CurrentDirectory"
    	Write-Host " * JavaHome: $JavaHome"
    	Write-Host " * DctmConfigDirectory: $DctmConfigDirectory"
    	Write-Host " * DctmIrmDirectory: $DctmIrmDirectory"
    	Write-Host " * DctmEnv: $DctmEnv"
    	Write-Host " * IdsToProcessFile: $IdsToProcessFile"
    
    	$ClassPath = $DctmConfigDirectory;
    	
    	foreach($Jar IN Get-ChildItem "$CurrentDirectory\dfc" -filter "*.jar" -Name){
    		$ClassPath += ";$CurrentDirectory\dfc\$Jar"
    	}
    	
    	foreach($Jar IN Get-ChildItem "$CurrentDirectory\lib" -filter "*.jar" -Name){
    		$ClassPath += ";$CurrentDirectory\lib\$Jar"
    	}
    	
    	$ClassPath += ";$DctmIrmDirectory\emcdctmirm.jar"
    	$ClassPath += ";$CurrentDirectory\IRMisationDocs4ArchivedDeliverable.jar"
    	
    	$JavaLibraryPath = "$DctmIrmDirectory"
    	$JavaLibraryPath += ";$DctmIrmDirectory\Common"
    	$JavaLibraryPath += ";$env:path"
    	$JavaLibraryPath = $JavaLibraryPath -replace "\\", "/"
    	
    	$pInfo = New-Object System.Diagnostics.ProcessStartInfo
    	$pInfo.FileName = "$JavaHome\bin\java.exe"
    
    	$LogFile = "$CurrentDirectory\log\My_ScriptProcess_log_$((Get-Date).ToString("yyyyMMdd_HHmmss")).log"
    	$pInfo.Arguments = @(
    		#"-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y",
    		#"-XX:-DumpOnCrash",
    		#"-XX:-CoreOnCrash",
    		"-Xmx1g",
    		"-Doracle.net.tns_admin=""$env:TNS_ADMIN""",
    		"-Djava.library.path=""$JavaLibraryPath""",
    		"-cp", """$ClassPath""",
    		"com.java.lu.business.service.ecm.utils.main.CreateListToProcess",
    		$DctmEnv,
    		"""$LogFile""",
    		"""$IdsToProcessFile""",
    		$DocumentIds)
    
    	$p = New-Object System.Diagnostics.Process
    	$p.StartInfo = $pInfo
    	
    	$p.Start() | Out-Null
    	
    	$p.WaitForExit()
    	
    	Write-Host "Content of $($IdsToProcessFile):"
    	Get-Content -Path $IdsToProcessFile | Foreach-Object { Write-Host $_ }
    	Write-Host "End of Content"
    }
    
    
    
    
    function LaunchSensitiveProcess 
    {
    	param(
    		[String] $ObjectIds,
    		[String] $CurrentDirectory,
    		[String] $JavaHome,
    		[String] $DctmConfigDirectory,
    		[String] $DctmIrmDirectory,
    		[String] $DctmEnv
    	)
    	
    # ....
    # ....
    # ....
    # ....
    # ....
    
    }
    
    function MyProcess{
    	param(
    		[Int32[]] $DocumentIds,
    		[String] $CurrentDirectory,
    		[String] $JavaHome,
    		[String] $DctmConfigDirectory,
    		[String] $DctmIrmDirectory,
    		[String] $DctmEnv
    	)
    	$DocumentIdsToProcess=$DocumentIds -join ','
    
    	$IdsToProcessFile = "$CurrentDirectory\My_ScriptProcess_$((Get-Date).ToString("yyyyMMdd_HHmmss")).txt"
    
    	CreateIdList -DocumentIds $DocumentIdsToProcess -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv -IdsToProcessFile $IdsToProcessFile
    
    	foreach ($IdsToProcess in Get-Content -Path $IdsToProcessFile) {
    		LaunchSensitiveProcess -ObjectIds $IdsToProcess -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv
    	}
    
    	#Remove-Item -Path $IdsToProcessFile
    }
    
    
    
    
    $MaxNbOfDocumentIds = 150
    
    if ($DocumentIds.Count -gt $MaxNbOfDocumentIds){
    	while($DocumentIds.Count -gt 0){
    		$NewDocumentIds = New-Object System.Collections.ArrayList
    		while(($NewDocumentIds.Count -le $MaxNbOfDocumentIds) -and ($DocumentIds.Count -gt 0)){
    			$DocumentId = $DocumentIds[0]
    			if ($DocumentIds.Count -gt 1){
    				$DocumentIds = $DocumentIds[1..($DocumentIds.Count -1)]
    			}else{
    				$DocumentIds = @()
    			}
    			$NewDocumentIds.Add($DocumentId) > $null
    		}
    		
    		MyProcess -DocumentIds $NewDocumentIds -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv
    	}
    }else{
    	MyProcess -DocumentIds $DocumentIds -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv
    }
    

  • Creation of java class com.java.lu.business.service.ecm.utils.main.CreateListToProcess:
    package com.java.lu.business.service.ecm.utils.main;
    
    import java.io.File;
    import java.io.PrintWriter;
    import java.text.MessageFormat;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.List;
    import java.util.Properties;
    import java.util.Set;
    
    import javax.naming.spi.NamingManager;
    import javax.sql.DataSource;
    
    import org.apache.commons.configuration.PropertiesConfiguration;
    import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
    import org.apache.commons.lang.StringUtils;
    
    import com.documentum.com.DfClientX;
    import com.documentum.com.IDfClientX;
    import com.documentum.fc.client.DfQuery;
    import com.documentum.fc.client.IDfClient;
    import com.documentum.fc.client.IDfCollection;
    import com.documentum.fc.client.IDfQuery;
    import com.documentum.fc.client.IDfSession;
    import com.documentum.fc.client.IDfSessionManager;
    import com.documentum.fc.client.IDfUser;
    import com.documentum.fc.common.DfException;
    import com.documentum.fc.common.DfLoginInfo;
    import com.documentum.fc.common.IDfId;
    
    
    public class CreateListToProcess {
    	public static void main(String[] args) {
    		try {
    			String myRepository = "MY_DOCBASE";
    			String adminLogin = "adminuser";
    			String adminPassword = "pwd4adminuser";
    			
    			IDfClientX clientx = new DfClientX();
    			IDfClient client = clientx.getLocalClient();
    			final IDfSessionManager sMgr = client.newSessionManager();
    			sMgr.setIdentity(IDfSessionManager.ALL_DOCBASES, new DfLoginInfo(adminLogin, adminPassword));
    			IDfSession dfSession = sMgr.getSession(myRepository);
    			
    			try {
    				if (dfSession.getUser(null).getUserPrivileges() != IDfUser.DF_PRIVILEGE_SUPERUSER) {
    					throw new DfException(MessageFormat.format("{0} is not a superuser.", dfSession.getUser(null).getUserName()));
    				}
    
    				PrintWriter printWriterLog = new PrintWriter(new File(args[1])) {
    					@Override
    					public void println(String x) {
    						super.println(x);
    						super.flush();
    						System.out.println(x);
    					}
    				};
    				
    				HashSet<String> docsIdsSet = new HashSet<String>();
    				File fileToCreate = null;
    
    				for (int i = 2; i < args.length; i++) {
    					if (i == 2) {
    						fileToCreate = new File(args[i]);
    					} else {
    						docsIdsSet.add(args[i]);
    					}
    				}
    
    				int cpt = 0;
    
    				PrintWriter printWriterIdsFile = new PrintWriter(fileToCreate);
    				try {
    					final int lineSize = 100;
    
    					IDfCollection dfCollection = getDocumentIdsToProcess(dfSession);
    					try {
    						List<String> list = new ArrayList<String>();
    						while (dfCollection.next()) {
    							cpt++;
    							IDfId dfId = dfCollection.getId("r_object_id");
    							list.add(dfId.getId());
    							if (list.size() == lineSize) {
    								printWriterIdsFile.println(StringUtils.join(list, ','));
    								printWriterIdsFile.flush();
    								list.clear();
    							}
    						}
    						if (list.size() > 0) {
    							printWriterIdsFile.println(StringUtils.join(list, ','));
    							printWriterIdsFile.flush();
    							list.clear();
    						}
    					} finally {
    						dfCollection.close();
    					}
    
    				} finally {
    					printWriterLog.write(MessageFormat.format("There {0,choice,0#are no documents|1#is one document|1<are {0,number,integer} documents} to process.", cpt));
    					printWriterLog.close();
    				}
    
    			} finally {
    				sMgr.release(dfSession);
    			}
    		} catch (Throwable e) {
    			e.printStackTrace();
    		}
    	}
    	
    	
    	/**
    	 * Get the documents for the scope's current execution
    	 * @param session
    	 * @return
    	 * @throws Throwable
    	 */
    	public static IDfCollection getDocumentIdsToProcess(IDfSession session) throws Throwable {
    		IDfCollection collection = null;
    		
    		StringBuilder sb = new StringBuilder();
    		sb.append(" SELECT DISTINCT docsall.r_object_id FROM my_document (ALL) docsall WHERE docsall.i_chronicle_id  ");
    		sb.append(" 	IN ( SELECT docs.i_chronicle_id  from my_document docs ");
    		sb.append(" 		WHERE ANY docs.r_aspect_name = 'my_aspect' and docs.my_aspect.is_ok=1  ");
    		sb.append(" 		AND docs.r_content_size>0 ");
    		//....
    		sb.append(" 	) ");
    
    		System.out.println(MessageFormat.format("Building and execution of query: {0}", sb.toString()));
    		IDfQuery dfQuery = new DfQuery(sb.toString());
    		collection = dfQuery.execute(session, IDfQuery.DF_READ_QUERY);					
    		return collection;
    	}
    	
    }
    

  • So, on the DCTM server, in the folder D:\App\MyFolder4DCTM, there will be:
    o My_ScriptProcess.cmd
    o My_ScriptProcess.ps1
    o MyJavaLuLib.jar : containing all needed classes
    o \lib : commons-collections-3.2.jar + commons-configuration-1.5.jar + commons-io-1.2.jar + commons-logging-1.1.1.jar + ojdbc6.jar + commons-csv-1.1.jar …etc.
    o \dfc : all JARs and DLLs of DFC (dfc.jar,Dfc.dll, …etc).
    o \log : log files

Just a last point, in the POWERSHELL script the below command allows debugging of remote server execution from local IDE (Composer) via the port 9797:
“-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y”
however, if this instruction is uncommented, the execution is put on hold until the launch of the IDE on the port.

Best regards,

Huseyin OZVEREN

Hi,

Here, a simple example using the Samba Java CIFS Client Library. JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java. CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive …). This client is used extensively in production on large Intranets.

Some resources:
https://jcifs.samba.org/
http://blog.icodejava.com/875/java-tutorial-using-jcifs-to-copy-files-to-shared-network-drive-using-username-and-password/

package com.huo.test.javacifs;

import java.io.File;
import java.text.MessageFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileFilter;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

/**
 * Class Test SAMBA for CIFS library
 * @author huseyino001
 */
public class TestCIFS implements Runnable {
	
	private NtlmPasswordAuthentication ntlmPasswordAuthentication = null;
	private SmbFile inputFolder;
	private int nbOfRetentionDays;

	public static void main(String[] args) {
		// Creation of ExecutorService
		final ScheduledExecutorService executorServiceOnceScanning = Executors.newSingleThreadScheduledExecutor();

		try {
			System.out.println(" ############################## EXECUTION "+TestCIFS.class+" - START ############################## ");
			final TestCIFS testCIFS = new TestCIFS();
			//
			NtlmPasswordAuthentication ntlmPasswordAuthentication = new NtlmPasswordAuthentication("LU", "huseyin", "mypassword");
			testCIFS.ntlmPasswordAuthentication = ntlmPasswordAuthentication;
			//
			testCIFS.inputFolder = new SmbFile("", testCIFS.ntlmPasswordAuthentication);
			System.out.println("Input folder = "+ testCIFS.inputFolder.getCanonicalPath());
			//
			testCIFS.nbOfRetentionDays = 7;
			System.out.println("Nb of retention days = "+ testCIFS.nbOfRetentionDays);
			
			// Once scanning execution
			executorServiceOnceScanning.submit(testCIFS);

			executorServiceOnceScanning.shutdown();

		} catch (Throwable e) {
			e.printStackTrace();
		}finally{
			executorServiceOnceScanning.shutdown();
		}
	}

	
	@Override
	public void run() {
		try {
			processDeletingSubFolders(this);
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			System.out.println(" ############################## EXECUTION "+TestCIFS.class+" - END ############################## ");
		}
	}


	
	private void processDeletingSubFolders(final TestCIFS testCIFS) {
		try {
			System.out.println(MessageFormat.format("Scanning \"input\" directory for deleting folders : \"{0}\" - START" + IOUtils.LINE_SEPARATOR, testCIFS.inputFolder.getCanonicalPath()));

			for (final SmbFile aFolderInINPUT_SmbFile : testCIFS.inputFolder.listFiles(new SmbFileFilter() {
				@Override
				public boolean accept(SmbFile aFolderInINPUT_SmbFile) throws SmbException {
					boolean ret = false;
					
					if(aFolderInINPUT_SmbFile.isDirectory() 
						&& aFolderInINPUT_SmbFile.canRead() 
						&& aFolderInINPUT_SmbFile.canWrite() 
						&& aFolderInINPUT_SmbFile.getName().startsWith("Folder_TO_DELETE_")){
						
						if(aFolderInINPUT_SmbFile.getLastModified()>0){
							Calendar calLastModified = GregorianCalendar.getInstance();
							calLastModified.setTimeInMillis(aFolderInINPUT_SmbFile.getLastModified());

							Calendar calRetention = GregorianCalendar.getInstance();
							calRetention.add(Calendar.DAY_OF_MONTH, -testCIFS.nbOfRetentionDays);

							ret = calLastModified.compareTo(calRetention)<0;
						}
					}
					return ret; 
				}
			})) {
					System.out.println(MessageFormat.format("Deleting \"{0}\" - START", aFolderInINPUT_SmbFile));
					try {
						System.out.println(MessageFormat.format("{0}={1}", "Folder to delete", aFolderInINPUT_SmbFile.getCanonicalPath()));
						deleteDirectory(aFolderInINPUT_SmbFile);
			
						
					} catch (Throwable e) {
						StringBuilder sb = new StringBuilder(MessageFormat.format("Unable to delete folder {0}", aFolderInINPUT_SmbFile));
						sb.append(IOUtils.LINE_SEPARATOR);
						sb.append(e.getMessage());
						System.out.println(sb.toString());
						e.printStackTrace();
					}
					System.out.println(MessageFormat.format("Deleting \"{0}\" - END", aFolderInINPUT_SmbFile));
			}// FOR-END
			System.out.println(MessageFormat.format("Scanning \"input\" directory for deleting folders : \"{0}\" - END" + IOUtils.LINE_SEPARATOR, testCIFS.inputFolder.getCanonicalPath()));

		} catch (Exception e) {
			System.out.println("Listing of \""+testCIFS.inputFolder.getCanonicalPath()+"\" directory failed ");
			e.printStackTrace();
		}
	}
	
	
	private void deleteDirectory(SmbFile aSmbFile) throws Exception{
		if(aSmbFile!=null){
			aSmbFile.delete();
			if(aSmbFile.exists()){
				FileUtils.deleteDirectory(new File(aSmbFile.getUncPath()));
			}
		}
	}
	
	private void deleteFile(SmbFile aSmbFile) throws Exception{
		if(aSmbFile!=null){
			final File fileToDelete = new File(aSmbFile.getCanonicalPath());
			if (!fileToDelete.delete()) {
				aSmbFile.delete();
			}
		}
	}
	
}

Best regards,

Huseyin

Page 1 of 54:1 2 3 4 »Last »
bottom-img
Copyright ® 2012 Huseyin Ozveren. No reproduction, even partial, can be used from this site and all its contents including text, documents, images, etc.. without the express permission of the author.