Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.ManagerModel


    URL obrModelAppUrl = new URL("file:" + PathUtils.getBaseDir()
        + "/target/classes/" + name + ".OBRMAN.cfg");

    System.out.println(name + " >>> " + obrModelAppUrl);

    ManagerModel model = new ManagerModel("OBRMAN", obrModelAppUrl);

    Set<ManagerModel> models = new HashSet<ManagerModel>();

    models.add(model);
View Full Code Here


  }

  @Override
  public void initializeContext(CompositeType context) {
   
    ManagerModel model = context.getModel(this);
   
    logger.debug("HISTMAN, newComposite(ManagerModel model = "
          +(model==null?"null":model.getManagerName())
          + "CompositeType compositeType = "
          +(context==null?"null":context.getName()));

    if (model == null) { // model is root
      model = CompositeTypeImpl.getRootCompositeType().getModel(this);
    }

   
    HistManData data =new HistManData(loadProperties(model));

    try {

      Builder options = new MongoClientOptions.Builder();

      options.connectTimeout(data.histDBTimeout);

      if(mongoClient==null) {
        mongoClient = new MongoClient(data.histURL, options.build());
      }

      logger.info("trying to connect with database {} in host {}",
          data.histDBName, data.histURL);

      // force connection to be established
      mongoClient.getDatabaseNames();

      db = mongoClient.getDB(data.histDBName);

    } catch (Exception e) {
      logger.error("{} is inactive, it was unable to find the DB in {}",
          this.getName(), data.histURL);
    }

    histDbURLs.put(context.getName(), data.histURL);

    try {

      // force connection to be established
      mongoClient.getDatabaseNames();

      /*
       * if attribute dropComection is true, drop all collections
       */
      if (data.dropCollections.equals("true")) {
        db.getCollection(Entities).drop();
        db.getCollection(ChangedAttributes).drop();
        db.getCollection(Links).drop();
      }

    } catch (MongoException e) {
      logger.error("no Mongo Database at URL {} name {}", model.getURL(),
          data.histDBName);
      stop();
    }

  }
View Full Code Here

         if (! modelFileName.startsWith(declaration.getName()))
           continue;
        
              String managerName = modelFileName.substring(declaration.getName().length()+1, modelFileName.lastIndexOf(".cfg"));
              URL modelURL = context.getBundle().getEntry(modelFileName);
        managerModels.add(new ManagerModel(managerName, modelURL));
        }
       
    }
View Full Code Here

  public static Model loadModel(OBRMan obrManager, CompositeType context, BundleContext osgiContext)  {

    /*
     * Get the model, if specified
     */
    ManagerModel model = context.getModel(obrManager);
    if (model == null || model.getURL() == null)
      return null;
   
    /*
     * Try to load the model from the specified location, as a map of properties
     */
    Properties configuration = null;
    try {
      configuration = new Properties();
      configuration.load(model.getURL().openStream());

      return new Model(obrManager, context, configuration, osgiContext);

    } catch (IOException e) {
      logger.error("Invalid OBRMAN Model. Cannot read stream " + model.getURL(), e.getCause());
      return null;
    }

  }
View Full Code Here

    /*
     * Look for specified root configuration for managers
     */
   
    for (Map.Entry<String,URL> managerConfiguration : CST.rootConfiguration.entrySet()) {
      models.add(new ManagerModel(managerConfiguration.getKey(),managerConfiguration.getValue()));
    }

  }
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.ManagerModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.