git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@17742 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9a92bc5c0a
commit
3a4ccef8e1
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.vremanagement.vremodeler.consumers;
|
package org.gcube.vremanagement.vremodeler.consumers;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||||
String operation=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
|
String operation=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
|
||||||
logger.info("notification received for genericResource "+id+" and operation "+operation);
|
logger.info("notification received for genericResource "+id+" and operation "+operation);
|
||||||
|
|
||||||
if (id.compareTo(this.functionalityResourceId)==0 && (operation.compareTo("update")==0 || operation.compareTo("create")==0)){
|
if (id.compareTo(this.functionalityResourceId)==0 && (operation.compareTo("update")==0)){
|
||||||
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
|
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
|
||||||
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
|
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
|
||||||
ISClient client=GHNContext.getImplementation(ISClient.class);
|
ISClient client=GHNContext.getImplementation(ISClient.class);
|
||||||
|
@ -58,10 +59,19 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||||
logger.trace("notification received for generic resource with operation create");
|
logger.trace("notification received for generic resource with operation create");
|
||||||
ISClient client=GHNContext.getImplementation(ISClient.class);
|
ISClient client=GHNContext.getImplementation(ISClient.class);
|
||||||
GCUBEGenericResourceQuery query= client.getQuery(GCUBEGenericResourceQuery.class);
|
GCUBEGenericResourceQuery query= client.getQuery(GCUBEGenericResourceQuery.class);
|
||||||
query.addAtomicConditions(new AtomicCondition("/ID",this.functionalityResourceId));
|
query.addAtomicConditions(new AtomicCondition("/ID",id));
|
||||||
GCUBEGenericResource resource =client.execute(query, ServiceContext.getContext().getScope()).get(0);
|
GCUBEGenericResource resource =client.execute(query, ServiceContext.getContext().getScope()).get(0);
|
||||||
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(resource.getSecondaryType()))
|
|
||||||
new GenericResourceHandler().add(resource);
|
if (resource.getName().compareTo("FuctionalitiesResource")==0){
|
||||||
|
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
|
||||||
|
KGCUBEGenericFunctionalityResource functResource=new KGCUBEGenericFunctionalityResource();
|
||||||
|
StringWriter sw= new StringWriter();
|
||||||
|
resource.store(sw);
|
||||||
|
functResource.load(new StringReader(sw.toString()));
|
||||||
|
functionalityHandler.add(functResource);
|
||||||
|
} else
|
||||||
|
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(resource.getSecondaryType()))
|
||||||
|
new GenericResourceHandler().add(resource);
|
||||||
}else if (operation.compareTo("destroy")==0){
|
}else if (operation.compareTo("destroy")==0){
|
||||||
logger.trace("notification received for generic resource with operation destroy");
|
logger.trace("notification received for generic resource with operation destroy");
|
||||||
new GenericResourceHandler().drop(id);
|
new GenericResourceHandler().drop(id);
|
||||||
|
|
|
@ -56,8 +56,12 @@ public class ServiceContext extends GCUBEServiceContext{
|
||||||
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
|
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
|
||||||
ServiceContext.getContext().setScope(scope);
|
ServiceContext.getContext().setScope(scope);
|
||||||
|
|
||||||
this.setSecondaryTypeGenericResourceRequired(((String)this.getProperty("GenericResourceToAdd", true)).split(","));
|
ArrayList<String> genResList= new ArrayList<String>();
|
||||||
|
for (String gen:((String)this.getProperty("GenericResourceToAdd", true)).split(","))
|
||||||
|
genResList.add(gen.trim());
|
||||||
|
this.setSecondaryTypeGenericResourceRequired(genResList.toArray(new String[0]));
|
||||||
|
|
||||||
|
|
||||||
GCUBESecurityManager secMan= new GCUBESecurityManagerImpl(){
|
GCUBESecurityManager secMan= new GCUBESecurityManagerImpl(){
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecurityEnabled() {
|
public boolean isSecurityEnabled() {
|
||||||
|
|
Loading…
Reference in New Issue