2008-04-15 19:28:28 +02:00
|
|
|
package org.gcube.informationsystem.registry.test;
|
|
|
|
|
|
|
|
import java.io.StringWriter;
|
|
|
|
|
|
|
|
import org.apache.axis.message.addressing.Address;
|
|
|
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
|
|
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
2008-05-03 01:53:30 +02:00
|
|
|
import org.gcube.common.core.resources.GCUBEHostingNode;
|
2008-05-06 00:44:24 +02:00
|
|
|
import org.gcube.common.core.resources.GCUBERunningInstance;
|
2008-04-15 19:28:28 +02:00
|
|
|
import org.gcube.common.core.resources.GCUBEService;
|
|
|
|
import org.gcube.common.core.scope.GCUBEScope;
|
|
|
|
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
|
|
|
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
|
|
|
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
|
|
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
|
|
|
|
|
|
|
import org.gridforum.jgss.ExtendedGSSCredential;
|
|
|
|
|
|
|
|
public class RegistryRemoveTest {
|
|
|
|
|
|
|
|
public static void main (String[]args ) throws Exception {
|
|
|
|
|
|
|
|
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
|
|
|
|
|
|
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
|
|
|
|
2008-05-03 01:53:30 +02:00
|
|
|
ExtendedGSSCredential cred; // =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
2008-04-15 19:28:28 +02:00
|
|
|
|
|
|
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
|
|
|
|
|
|
|
RegistryFactoryPortType registryFactoryPortType= null;
|
|
|
|
try {
|
|
|
|
factoryEPR.setAddress(new Address(args[0]));
|
|
|
|
registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR);
|
|
|
|
}catch(Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
RemoveResourceMessage message = new RemoveResourceMessage();
|
|
|
|
|
2008-05-03 01:53:30 +02:00
|
|
|
//managerSec.useCredentials(cred);
|
|
|
|
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope(args[2]),managerSec);
|
2008-04-15 19:28:28 +02:00
|
|
|
try {
|
|
|
|
StringWriter writer =new StringWriter();
|
2008-05-03 01:53:30 +02:00
|
|
|
message.setType(GCUBEHostingNode.TYPE);
|
2008-04-15 19:28:28 +02:00
|
|
|
message.setUniqueID(args[1]);
|
|
|
|
registryFactoryPortType.removeResource(message);
|
|
|
|
|
|
|
|
} catch(Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
System.out.println("Profile with ID "+ args[1]+ "has been succesfully removed");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|