Hi all,
I have implemented DFS default File open functionality using Applet(open with corresponding Editing Application using setPostTransfer method of DFS) .I can run successfully as a stant alone applet.However I want to implement the same in web application.so when the End user gives object id of document,
the corresponding document has to be downloaded to end user m/c and has to be opened in the default Editor automatically.(ex.word doc. should be opened in MS word).I converted the applet code as a jar file and embedded in web page.I am able to get service context,jessin id and other stuffs.
when i invoked openFile() applet method by passing object id thru java script from web application i am getting below Exception..
Jun 11, 2009 9:04:50 PM INFO: invoked runtime: java.lang.ProcessImpl@82c23d
Jun 11, 2009 9:04:51 PM INFO: connected, uid: 39
jsessionId = PmcvKxkZh2GJnCDhs2yxH21VM1Gr1rQKTpQk6Jc92fhF2jlBjcvb!-1104115736, Connection ID = 39
Debug starts
params:PmcvKxkZh2GJnCDhs2yxH21VM1Gr1rQKTpQk6Jc92fhF2jlBjcvb!-1104115736,39
Debug 1
Debug 2
Debug 3
Debug 4
Debug 5
Debug 6
Debug 7
Debug 8
Debug 9
Debug 10
setmethod jsession id = PmcvKxkZh2GJnCDhs2yxH21VM1Gr1rQKTpQk6Jc92fhF2jlBjcvb!-1104115736
setmethod uid = 39
Debug 11 ===== OBJECT ID = 0900000180032ec9
Debug 12
Debug 13
com.emc.documentum.fs.rt.ServiceInvocationRuntimeException: Failed to retrieve session id from AgentService at "http://192.168.1.61:7001/services/core/"
at com.emc.documentum.fs.rt.context.impl.HttpSessionRetriever.retrieveHttpSessionId(HttpSessionRetriever.java:68)
at com.emc.documentum.fs.rt.context.impl.HttpSessionRetriever.getHttpSessionId(HttpSessionRetriever.java:33)
at com.emc.documentum.fs.rt.context.impl.HttpSessionInvocationHandler.invoke(HttpSessionInvocationHandler.java:54)
at com.emc.documentum.fs.rt.context.impl.OperationOptionsHandler.invoke(OperationOptionsHandler.java:48)
at com.emc.documentum.fs.rt.context.impl.ContextThreadLocalInvocationHandler.invoke(ContextThreadLocalInvocationHandler.java:36)
at com.emc.documentum.fs.rt.context.impl.ReturnedContentTransformationHandler.invoke(ReturnedContentTransformationHandler.java:34)
at com.emc.documentum.fs.rt.context.impl.ServiceContextInvocationHandler.invoke(ServiceContextInvocationHandler.java:30)
at $Proxy12.get(Unknown Source)
at com.mycompany.UcfInvoker$1.run(UcfInvoker.java:137)
at java.security.AccessController.doPrivileged(Native Method)
at com.mycompany.UcfInvoker.openFile(UcfInvoker.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
Caused by: java.lang.NullPointerException
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:281)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:596)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:543)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:370)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:256)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:616)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:319)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:302)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
at javax.xml.ws.Service.getPort(Service.java:92)
at com.emc.documentum.fs.rt.services.AgentService.getAgentServicePort(AgentService.java:56)
at com.emc.documentum.fs.rt.context.impl.HttpSessionRetriever.createAgentService(HttpSessionRetriever.java:49)
at com.emc.documentum.fs.rt.context.impl.HttpSessionRetriever.retrieveHttpSessionId(HttpSessionRetriever.java:58)
... 25 more
This is my code
package com.mycompany;
import java.applet.Applet;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.List;
import sun.plugin.javascript.JSObject;
import com.emc.documentum.fs.datamodel.core.DataObject;
import com.emc.documentum.fs.datamodel.core.DataPackage;
import com.emc.documentum.fs.datamodel.core.ObjectId;
import com.emc.documentum.fs.datamodel.core.ObjectIdentity;
import com.emc.documentum.fs.datamodel.core.ObjectIdentitySet;
import com.emc.documentum.fs.datamodel.core.OperationOptions;
import com.emc.documentum.fs.datamodel.core.content.ActivityInfo;
import com.emc.documentum.fs.datamodel.core.content.Content;
import com.emc.documentum.fs.datamodel.core.content.ContentTransferMode;
import com.emc.documentum.fs.datamodel.core.context.RepositoryIdentity;
import com.emc.documentum.fs.datamodel.core.profiles.ContentProfile;
import com.emc.documentum.fs.datamodel.core.profiles.ContentTransferProfile;
import com.emc.documentum.fs.datamodel.core.profiles.FormatFilter;
import com.emc.documentum.fs.datamodel.core.profiles.PermissionProfile;
import com.emc.documentum.fs.datamodel.core.profiles.PermissionTypeFilter;
import com.emc.documentum.fs.datamodel.core.profiles.PropertyFilterMode;
import com.emc.documentum.fs.datamodel.core.profiles.PropertyProfile;
import com.emc.documentum.fs.rt.ServiceException;
import com.emc.documentum.fs.rt.ServiceInvocationException;
import com.emc.documentum.fs.rt.context.ContextFactory;
import com.emc.documentum.fs.rt.context.IServiceContext;
import com.emc.documentum.fs.rt.context.ServiceFactory;
import com.emc.documentum.fs.rt.ucf.UcfConnection;
import com.emc.documentum.fs.services.core.CoreServiceException;
import com.emc.documentum.fs.services.core.client.IObjectService;
public class UcfInvoker extends Applet{
// replace the following with customer's info
private static String username = "Administrator";
private static String password = "admin";
private static String docbase = "testdocbase";
private static String serverUrl = "http://192.168.1.61:7001";
String jsessionId=null;
String uId=null;
IServiceContext context =null;
Content docContent = null;
IObjectService service=null;
public void init ()
{
try
{
try{
UcfConnection connection = new UcfConnection(new URL("http://192.168.1.61:7001/services/core/"));
System.out.println("jsessionId = " + connection.getJsessionId() + ", Connection ID = " + connection.getUid());
System.out.println("Debug starts");
service = getObjectService(connection.getJsessionId(),connection.getUid());
setsessionId(connection.getJsessionId());
setuId(connection.getUid());
JSObject win = (JSObject) JSObject.getWindow(this);
win.call("setHtmlFormIdsFromApplet", new Object[]{connection.getJsessionId(),connection.getUid()});
}
catch (Exception ce)
{
throw new Exception(ce);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public IObjectService getObjectService (String jsessionId1,String uid1 )
throws ServiceInvocationException
{
String jsessionId = jsessionId1;
String uid = uid1;
System.out.println("params:" + jsessionId +"," + uid );
System.out.println("Debug 1");
context = ContextFactory.getInstance().newContext();
System.out.println("Debug 2");
context.addIdentity(new RepositoryIdentity(docbase, username, password, ""));
System.out.println("Debug 3");
ActivityInfo activity = new ActivityInfo(jsessionId, null, uid, true);
System.out.println("Debug 4");
activity.setAutoCloseConnection(false);
System.out.println("Debug 5");
ContentTransferProfile ct = new ContentTransferProfile();
System.out.println("Debug 6");
ct.setTransferMode(ContentTransferMode.UCF);
System.out.println("Debug 7");
ct.setActivityInfo(activity);
System.out.println("Debug 8");
context.setProfile(ct);
System.out.println("Debug 9");
IObjectService service = ServiceFactory.getInstance().getRemoteService( IObjectService.class, context, "core", serverUrl + "/services");
System.out.println("Debug 10");
return service;
}
public void openFile(String objId1)
throws CoreServiceException, ServiceException
{
final String objId2=objId1;
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
ObjectId objId = new ObjectId(objId2);
System.out.println("Debug 11 ===== OBJECT ID = "+objId2);
ObjectIdentity objectIdentity = new ObjectIdentity<ObjectId>(objId, docbase);
ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
List<ObjectIdentity> objIdList = objectIdSet.getIdentities();
objIdList.add(objectIdentity);
OperationOptions operationOptions = new OperationOptions();
ContentProfile contentProfile = new ContentProfile();
PropertyProfile propertyProfile = new PropertyProfile(PropertyFilterMode.ALL);
PermissionProfile permissionProfile = new PermissionProfile();
permissionProfile.setPermissionTypeFilter(PermissionTypeFilter.ANY);
operationOptions.setPermissionProfile(permissionProfile);
operationOptions.setPropertyProfile(propertyProfile);
contentProfile.setFormatFilter(FormatFilter.ANY);
contentProfile.setPostTransferAction("dfs:view");
System.out.println("Debug 12");
operationOptions.setContentProfile(contentProfile);
ContentTransferProfile profile = new ContentTransferProfile();
profile.setTransferMode(ContentTransferMode.UCF);
operationOptions.setContentTransferProfile(profile);
operationOptions.setProfile(contentProfile);
operationOptions.setProfile(profile);
context.setProfile(profile);
System.out.println("Debug 13");
try{
DataPackage dataPackage = service.get(objectIdSet, operationOptions);
System.out.println("Debug 14");
DataObject dataObject = dataPackage.getDataObjects().get(0);
Iterator<Content> it = dataObject.getContents().iterator();
System.out.println("debug 15 ---"+contentProfile.getPostTransferAction());
}catch(Exception e){
e.printStackTrace();
}
return null;
}
});
}
public void setsessionId(String sess) {
jsessionId=sess;
System.out.println("setmethod jsession id = "+ jsessionId);
}
public void setuId(String uuid) {
uId=uuid;
System.out.println("setmethod uid = "+ uId);
}
public String getuId() {
System.out.println("getmethod jsession id = "+ jsessionId);
return jsessionId;
}
public String getsessionId() {
System.out.println("getmethod jsession id = "+ uId);
return uId;
}
public void start ()
{
}
}
Any one has experience in this can share ur ideas...