<commit_before>package org.fiteagle.adapters.openstack;

import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.OWL2;
import com.woorea.openstack.nova.model.*;
import info.openmultinet.ontology.vocabulary.*;

import java.util.*;

import org.fiteagle.abstractAdapter.AbstractAdapter;
import org.fiteagle.abstractAdapter.dm.AdapterEventListener;
import org.fiteagle.adapters.openstack.client.IOpenstackClient;
import org.fiteagle.adapters.openstack.client.OpenstackClient;
import org.fiteagle.adapters.openstack.client.OpenstackParser;
import org.fiteagle.adapters.openstack.client.model.Image;
import org.fiteagle.adapters.openstack.client.model.Images;
import org.fiteagle.adapters.openstack.client.model.Server;
import org.fiteagle.adapters.openstack.client.model.ServerForCreate;
import org.fiteagle.adapters.openstack.client.model.Servers;
import org.fiteagle.adapters.openstack.dm.OpenstackAdapterMDBSender;
import org.fiteagle.api.core.IMessageBus;
import org.fiteagle.api.core.MessageBusOntologyModel;
import org.fiteagle.api.core.OntologyModelUtil;

import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;

import javax.enterprise.concurrent.ManagedThreadFactory;
import javax.naming.InitialContext;
import javax.naming.NamingException;


public class OpenstackAdapter extends AbstractAdapter {

  private IOpenstackClient openstackClient;
  private OpenstackParser openstackParser;

  private static Resource adapter;
  public static List<Property> resourceInstanceProperties = new ArrayList<Property>();
  
  private Model adapterModel;
  private Resource adapterInstance;
  
  public static Map<String, OpenstackAdapter> adapterInstances = new HashMap<>();
//  private List<AdapterEventListener> myListeners = new ArrayList<AdapterEventListener>();;
  private OpenstackAdapterMDBSender listener;

  public static OpenstackAdapter getTestInstance(IOpenstackClient openstackClient){
    OpenstackAdapter instance = (OpenstackAdapter) adapterInstances.values().iterator().next();
    OpenstackAdapter testInstance = new OpenstackAdapter(instance.getAdapterInstance(), openstackClient);
    testInstance.updateAdapterDescription();
    return testInstance;
  }
  
  static {
    Model adapterModel = OntologyModelUtil.loadModel("ontologies/openstack.ttl", IMessageBus.SERIALIZATION_TURTLE);
    
    ResIterator adapterIterator = adapterModel.listSubjectsWithProperty(RDFS.subClassOf, MessageBusOntologyModel.classAdapter);
    if (adapterIterator.hasNext()) {
      adapter = adapterIterator.next();
    }
    
    createDefaultAdapterInstance(adapterModel);
  }
  
  private static void createDefaultAdapterInstance(Model adapterModel){
 //   Resource adapterInstance = adapterModel.createResource(OntologyModelUtil.getResourceNamespace()+"Openstack-1");

    adapter = adapterModel.createResource(Omn_domain_pc.VMServer);
    adapter.addProperty(RDFS.subClassOf,MessageBusOntologyModel.classAdapter);
    adapter.addProperty(Omn_lifecycle.implements_,Omn_domain_pc.VM);

    Resource adapterInstance = ModelFactory.createDefaultModel().createResource(OntologyModelUtil.getResourceNamespace()+"VMServer-1");
    adapterInstance.addProperty(RDF.type, Omn_domain_pc.VMServer);
    adapterInstance.addProperty(RDF.type, OWL2.NamedIndividual);
    adapterInstance.addProperty(RDFS.label, adapterInstance.getLocalName());
    adapterInstance.addProperty(RDFS.comment, "An openstack vm server that can handle different VMs.");
    adapterInstance.addProperty(Geo.lat,"52.5258083");
    adapterInstance.addProperty(Geo.long_,"13.3172764");
    adapterInstance.addProperty(Omn_resource.isExclusive,"false");

//    Resource testbed = adapterModel.createResource("http://federation.av.tu-berlin.de/about#AV_Smart_Communication_Testbed");
//    adapterInstance.addProperty(Omn_federation.partOfFederation, testbed);
//
//    StmtIterator resourceIterator = adapter.listProperties(Omn_lifecycle.implements_);
//    if (resourceIterator.hasNext()) {
//      Resource resource = resourceIterator.next().getObject().asResource();
//
//      adapterInstance.addProperty(Omn_lifecycle.canImplement, resource);
//      ResIterator propertiesIterator = adapterModel.listSubjectsWithProperty(RDFS.domain, resource);
//      while (propertiesIterator.hasNext()) {
//        Property p = adapterModel.getProperty(propertiesIterator.next().getURI());
//        resourceInstanceProperties.add(p);
//      }
//    }
    
    new OpenstackAdapter(adapterInstance, new OpenstackClient());
  }
  <commit_msg>hard coding ref for linked data<commit_after>package org.fiteagle.adapters.openstack;

import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.OWL2;
import com.woorea.openstack.nova.model.*;
import info.openmultinet.ontology.vocabulary.*;

import java.util.*;

import org.fiteagle.abstractAdapter.AbstractAdapter;
import org.fiteagle.abstractAdapter.dm.AdapterEventListener;
import org.fiteagle.adapters.openstack.client.IOpenstackClient;
import org.fiteagle.adapters.openstack.client.OpenstackClient;
import org.fiteagle.adapters.openstack.client.OpenstackParser;
import org.fiteagle.adapters.openstack.client.model.Image;
import org.fiteagle.adapters.openstack.client.model.Images;
import org.fiteagle.adapters.openstack.client.model.Server;
import org.fiteagle.adapters.openstack.client.model.ServerForCreate;
import org.fiteagle.adapters.openstack.client.model.Servers;
import org.fiteagle.adapters.openstack.dm.OpenstackAdapterMDBSender;
import org.fiteagle.api.core.IMessageBus;
import org.fiteagle.api.core.MessageBusOntologyModel;
import org.fiteagle.api.core.OntologyModelUtil;

import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;

import javax.enterprise.concurrent.ManagedThreadFactory;
import javax.naming.InitialContext;
import javax.naming.NamingException;


public class OpenstackAdapter extends AbstractAdapter {

  private IOpenstackClient openstackClient;
  private OpenstackParser openstackParser;

  private static Resource adapter;
  public static List<Property> resourceInstanceProperties = new ArrayList<Property>();
  
  private Model adapterModel;
  private Resource adapterInstance;
  
  public static Map<String, OpenstackAdapter> adapterInstances = new HashMap<>();
//  private List<AdapterEventListener> myListeners = new ArrayList<AdapterEventListener>();;
  private OpenstackAdapterMDBSender listener;

  public static OpenstackAdapter getTestInstance(IOpenstackClient openstackClient){
    OpenstackAdapter instance = (OpenstackAdapter) adapterInstances.values().iterator().next();
    OpenstackAdapter testInstance = new OpenstackAdapter(instance.getAdapterInstance(), openstackClient);
    testInstance.updateAdapterDescription();
    return testInstance;
  }
  
  static {
    Model adapterModel = OntologyModelUtil.loadModel("ontologies/openstack.ttl", IMessageBus.SERIALIZATION_TURTLE);
    
    ResIterator adapterIterator = adapterModel.listSubjectsWithProperty(RDFS.subClassOf, MessageBusOntologyModel.classAdapter);
    if (adapterIterator.hasNext()) {
      adapter = adapterIterator.next();
    }
    
    createDefaultAdapterInstance(adapterModel);
  }
  
  private static void createDefaultAdapterInstance(Model adapterModel){
 //   Resource adapterInstance = adapterModel.createResource(OntologyModelUtil.getResourceNamespace()+"Openstack-1");

    adapter = adapterModel.createResource(Omn_domain_pc.VMServer);
    adapter.addProperty(RDFS.subClassOf,MessageBusOntologyModel.classAdapter);
    adapter.addProperty(Omn_lifecycle.implements_,Omn_domain_pc.VM);
    adapter.addProperty(Omn_lifecycle.childOf, ModelFactory.createDefaultModel().createResource("http://openstack.av.tu-berlin.de"));

    Resource adapterInstance = ModelFactory.createDefaultModel().createResource(OntologyModelUtil.getResourceNamespace()+"VMServer-1");
    adapterInstance.addProperty(RDF.type, Omn_domain_pc.VMServer);
    adapterInstance.addProperty(RDF.type, OWL2.NamedIndividual);
    adapterInstance.addProperty(RDFS.label, adapterInstance.getLocalName());
    adapterInstance.addProperty(RDFS.comment, "An openstack vm server that can handle different VMs.");
    adapterInstance.addProperty(Geo.lat,"52.5258083");
    adapterInstance.addProperty(Geo.long_,"13.3172764");
    adapterInstance.addProperty(Omn_resource.isExclusive,"false");

//    Resource testbed = adapterModel.createResource("http://federation.av.tu-berlin.de/about#AV_Smart_Communication_Testbed");
//    adapterInstance.addProperty(Omn_federation.partOfFederation, testbed);
//
//    StmtIterator resourceIterator = adapter.listProperties(Omn_lifecycle.implements_);
//    if (resourceIterator.hasNext()) {
//      Resource resource = resourceIterator.next().getObject().asResource();
//
//      adapterInstance.addProperty(Omn_lifecycle.canImplement, resource);
//      ResIterator propertiesIterator = adapterModel.listSubjectsWithProperty(RDFS.domain, resource);
//      while (propertiesIterator.hasNext()) {
//        Property p = adapterModel.getProperty(propertiesIterator.next().getURI());
//        resourceInstanceProperties.add(p);
//      }
//    }
    
    new OpenstackAdapter(adapterInstance, new OpenstackClient());
  }
  
{'fraction_non_alphanumeric': 0.10480396380870315, 'fraction_numerical': 0.004739336492890996, 'mean_word_length': 5.807184750733138, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1118911', 'n_tokens_mistral': 2740, 'n_tokens_neox': 2675, 'n_words': 383}