private WSIGService createWSIGService(AID aid, ServiceDescription sd) throws Exception { // Get service prefix & name String servicePrefix = getServicePrefix(sd); String serviceName = servicePrefix + sd.getName(); // Verify if is a wsig service if (!isWSIGService(sd)) { log.info("Service " + serviceName + " discarded (no wsig service)"); return null; } // Verify if the service is already registered if (wsigStore.isServicePresent(serviceName)) { log.info("Service " + serviceName + " of agent " + aid.getName() + " is already registered"); return null; } // Get ontology // FIX-ME elaborate only first ontology String ontoName = null; Iterator ontoIt = sd.getAllOntologies(); if (ontoIt.hasNext()) { ontoName = (String) ontoIt.next(); } if (ontoName == null) { log.info( "Service " + serviceName + " of agent " + aid.getName() + " have not ontology registered"); return null; } // Create ontology instance String ontoClassname = WSIGConfiguration.getInstance().getOntoClassname(ontoName); if (ontoClassname == null) { log.warn("Ontology " + ontoName + " not present in WSIG configuration file"); return null; } Ontology serviceOnto; try { Class ontoClass = Class.forName(ontoClassname); Method getInstanceMethod = ontoClass.getMethod("getInstance"); serviceOnto = (Ontology) getInstanceMethod.invoke(null); } catch (Exception e) { log.warn("Ontology class " + ontoClassname + " not present in WSIG classpath", e); return null; } // Register new onto in anget getContentManager().registerOntology(serviceOnto); // Get mapper class Class mapperClass = getMapperClass(sd); // Create new WSIGService WSIGService wsigService = new WSIGService(); wsigService.setServiceName(serviceName); wsigService.setServicePrefix(servicePrefix); wsigService.setAid(aid); wsigService.setWsdl( new URL(WSIGConfiguration.getInstance().getWsdlUri() + "/" + serviceName + ".wsdl")); wsigService.setOnto(serviceOnto); wsigService.setMapperClass(mapperClass); // Create wsdl SDToWSDL.createWSDLFromSD(this, sd, wsigService); return wsigService; }