Skip to Content
0
Former Member
Aug 03, 2005 at 02:24 PM

Error in simple java code.

20 Views

Hi folks,

I am having some problem to compile this code, anybody can help me please ?

Thanks a lot.

Patricio.

-


package Duck02;

import java.util.List;

import com.sapportals.portal.prt.component.*;

import com.sapportals.wcm.repository.IResource;

import com.sapportals.wcm.repository.ResourceContext;

import com.sapportals.wcm.repository.ResourceFactory;

import com.sapportals.wcm.util.uri.RID;

import com.sapportals.portal.security.usermanagement.IUser;

import com.sap.netweaver.bc.rf.common.exception.*;

public class MyFirstComponent extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

IResourceContext resourceContext = new ResourceContext(user);

RID rid = RID.getRID("/etc");

try {

IResource resource = ResourceFactory.getInstance().getResource(rid, resourceContext);

if( resource != null ) {

// resource found

System.out.println("resource " + resource.getRID() + " found");

} else {

// resource not found

System.out.println("resource " + resource.getRID() + " does not exist");

}

}

catch( ResourceException e ) {

// problem while retrieving the resource

System.out.println(

"exception while trying to get resource " + e.getRID()

+ ": " + e.getMessage()

);

}

}

}