git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@581 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c6231670d2
commit
34c9918e53
|
@ -4,6 +4,6 @@
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
||||||
<classpathentry kind="lib" path="/home/manuele/ISTI-projects/D4Science/development/svn/DEV/GCORE/CONTAINER/lib/org.gcube.informationsystem.registry.stubs.jar"/>
|
<classpathentry kind="lib" path="/Dependencies/ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -281,63 +281,58 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
String ID = inputMessage.getUniqueID();
|
String ID = inputMessage.getUniqueID();
|
||||||
String type = inputMessage.getType();
|
String type = inputMessage.getType();
|
||||||
if (ID == null || ID.compareTo("") ==0) {
|
if (ID == null || ID.compareTo("") ==0) {
|
||||||
logger.debug("ID missing ");
|
logger.warn("Resource ID is missing");
|
||||||
throw new RemoteException("Error, ID missing");
|
throw new RemoteException("Resource ID is missing");
|
||||||
}
|
}
|
||||||
//check if the UniqueID exist
|
//check if the UniqueID exist
|
||||||
if (!(isResourceCreated(ID))){
|
|
||||||
GCUBEResource resource = null;
|
/*GCUBEResource resource = null;
|
||||||
try {
|
try {
|
||||||
resource = RegistryUtil.getProfileFromIS(ID,this.getResourceClass(type).getClass());
|
resource = RegistryUtil.getProfileFromIS(ID,this.getResourceClass(type).getClass());
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
logger.error("Error gettign profile from IS ");
|
logger.error("Error gettign profile from IS ");
|
||||||
return new RemoveResourceResponse();
|
return new RemoveResourceResponse();
|
||||||
}
|
}*/
|
||||||
if( resource == null) return new RemoveResourceResponse();
|
//if( resource == null) return new RemoveResourceResponse();
|
||||||
else {
|
//else {
|
||||||
logger.debug("Try to remove the resource from the IS-IC");
|
logger.debug("trying to remove the resource from the IS-IC");
|
||||||
try {
|
try {
|
||||||
new ProfileManager().removeFromISIC(ID, resource.getType(), ServiceContext.getContext().getCredentials());
|
new ProfileManager().removeFromISIC(ID, type, ServiceContext.getContext().getCredentials());
|
||||||
|
logger.debug("resource removed");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to remove the resource", e);
|
logger.error("Unable to remove the resource", e);
|
||||||
throw ServiceContext.getContext().getDefaultException("", e).toFault("Unable to remove the resource: the remote IS-IC returns an error");
|
throw ServiceContext.getContext().getDefaultException("", e).toFault("Unable to remove the resource: the remote IS-IC returns an error");
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
return new RemoveResourceResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
ProfileResource resource = getProfileResource(ID );
|
|
||||||
resource.removeProfile();
|
|
||||||
RegistryServiceAddressingLocator locator = new RegistryServiceAddressingLocator();
|
|
||||||
RegistryPortType portType = locator.getRegistryPortTypePort(resource.getEPR());
|
|
||||||
//destroy resource
|
|
||||||
portType.destroy(new Destroy());
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.error("Error removing resource for ID "+ e);
|
|
||||||
throw new RemoteException();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (type.compareTo(GCUBEHostingNode.TYPE) == 0) {
|
if (type.compareTo(GCUBEHostingNode.TYPE) == 0)
|
||||||
RegistryUtil.unregisterRIRelatedToGHN(ID,this);
|
RegistryUtil.unregisterRIRelatedToGHN(ID,this);
|
||||||
}
|
} catch (Exception e) {
|
||||||
}
|
logger.error("Error removing profile related to this GHNID for ID ", e);
|
||||||
catch (Exception e) {
|
|
||||||
logger.error("Error removing profile related to this GHNID for ID "+ e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
logger.info(" Profile destroyed");
|
|
||||||
try {
|
|
||||||
updateCounterInfo(ID,type,OperationType.destroy.name(),Calendar.getInstance());
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
logger.warn("Error updating counting info for resource with ID " + ID);
|
|
||||||
//e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isResourceCreated(ID)){
|
||||||
|
//destroy the resource
|
||||||
|
try{
|
||||||
|
ProfileResource resource = getProfileResource(ID );
|
||||||
|
resource.removeProfile();
|
||||||
|
RegistryServiceAddressingLocator locator = new RegistryServiceAddressingLocator();
|
||||||
|
RegistryPortType portType = locator.getRegistryPortTypePort(resource.getEPR());
|
||||||
|
portType.destroy(new Destroy());
|
||||||
|
logger.info(" profile resource destroyed");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
logger.error("Error removing resource for ID ", e);
|
||||||
|
throw new RemoteException();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
updateCounterInfo(ID,type,OperationType.destroy.name(),Calendar.getInstance());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
logger.warn("Error updating counting info for resource with ID " + ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
return new RemoveResourceResponse();
|
return new RemoveResourceResponse();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -349,7 +344,6 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
* @param methodName The Method Name
|
* @param methodName The Method Name
|
||||||
*/
|
*/
|
||||||
private void logSecurityInfo(String methodName) {
|
private void logSecurityInfo(String methodName) {
|
||||||
|
|
||||||
logger.info("Security info for method "+ methodName );
|
logger.info("Security info for method "+ methodName );
|
||||||
String identity = SecurityManager.getManager().getCaller();
|
String identity = SecurityManager.getManager().getCaller();
|
||||||
logger.info("The caller is: " + identity);
|
logger.info("The caller is: " + identity);
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class ProfileManager {
|
||||||
|
|
||||||
protected static final GCUBELog logger=new GCUBELog(ProfileManager.class);
|
protected static final GCUBELog logger=new GCUBELog(ProfileManager.class);
|
||||||
|
|
||||||
protected static final String ISICpostfix = "ISICService";
|
protected static final String ISICpostfix = "DISICService";
|
||||||
|
|
||||||
protected URL isIcAddress;
|
protected URL isIcAddress;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.io.StringWriter;
|
||||||
import org.apache.axis.message.addressing.Address;
|
import org.apache.axis.message.addressing.Address;
|
||||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||||
|
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||||
import org.gcube.common.core.resources.GCUBEService;
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
|
@ -22,7 +23,7 @@ public class RegistryRemoveTest {
|
||||||
|
|
||||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||||
|
|
||||||
ExtendedGSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
ExtendedGSSCredential cred; // =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
||||||
|
|
||||||
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||||
|
|
||||||
|
@ -35,11 +36,11 @@ public class RegistryRemoveTest {
|
||||||
}
|
}
|
||||||
RemoveResourceMessage message = new RemoveResourceMessage();
|
RemoveResourceMessage message = new RemoveResourceMessage();
|
||||||
|
|
||||||
managerSec.useCredentials(cred);
|
//managerSec.useCredentials(cred);
|
||||||
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope("/gcube/devsec"),managerSec);
|
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope(args[2]),managerSec);
|
||||||
try {
|
try {
|
||||||
StringWriter writer =new StringWriter();
|
StringWriter writer =new StringWriter();
|
||||||
message.setType(GCUBEService.TYPE);
|
message.setType(GCUBEHostingNode.TYPE);
|
||||||
message.setUniqueID(args[1]);
|
message.setUniqueID(args[1]);
|
||||||
registryFactoryPortType.removeResource(message);
|
registryFactoryPortType.removeResource(message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue