Package org.apache.ivory.entity.store

Examples of org.apache.ivory.entity.store.ConfigurationStore


                listeners.replace("org.apache.ivory.service.SharedLibraryHostingService", ""));
        ConfigurationStore.get().init();
    }
   
    protected void cleanupStore() throws IvoryException {
        ConfigurationStore store = ConfigurationStore.get();
        for(EntityType type:EntityType.values()) {
            Collection<String> entities = store.getEntities(type);
            for(String entity:entities)
                store.remove(type, entity);
        }
    }
View Full Code Here


        }
    }

    protected void storeEntity(EntityType type, String name) throws Exception {
        Unmarshaller unmarshaller = type.getUnmarshaller();
        ConfigurationStore store = ConfigurationStore.get();
        store.remove(type, name);
    switch (type) {
    case CLUSTER:
                Cluster cluster = (Cluster) unmarshaller.unmarshal(this.getClass().getResource(CLUSTER_XML));
                cluster.setName(name);
                ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(conf.get("fs.default.name"));
                store.publish(type, cluster);
                break;

            case FEED:
                Feed feed = (Feed) unmarshaller.unmarshal(this.getClass().getResource(FEED_XML));
                feed.setName(name);
                store.publish(type, feed);
                break;

            case PROCESS:
                Process process = (Process) unmarshaller.unmarshal(this.getClass().getResource(PROCESS_XML));
                process.setName(name);
                FileSystem fs =dfsCluster.getFileSystem();
                fs.mkdirs(new Path(process.getWorkflow().getPath()));
                if (!fs.exists(new Path(process.getWorkflow()+"/lib"))) {
                  fs.mkdirs(new Path(process.getWorkflow()+"/lib"));
                }
                store.publish(type, process);
                break;
        }
    }
View Full Code Here

                break;
        }
    }

    public void setup() throws Exception {
    ConfigurationStore store = ConfigurationStore.get();
    for (EntityType type : EntityType.values()) {
      for (String name : store.getEntities(type)) {
        store.remove(type, name);
      }
    }
        storeEntity(EntityType.CLUSTER, "corp");
        storeEntity(EntityType.FEED, "clicks");
        storeEntity(EntityType.FEED, "impressions");
View Full Code Here

        ConfigurationStore.get().init();
       
    }
   
    protected void cleanupStore() throws IvoryException {
        ConfigurationStore store = ConfigurationStore.get();
        for(EntityType type:EntityType.values()) {
            Collection<String> entities = store.getEntities(type);
            for(String entity:entities)
                store.remove(type, entity);
        }
    }
View Full Code Here

        }
    }

    protected void storeEntity(EntityType type, String name) throws Exception {
        Unmarshaller unmarshaller = type.getUnmarshaller();
        ConfigurationStore store = ConfigurationStore.get();
        store.remove(type, name);
    switch (type) {
    case CLUSTER:
                Cluster cluster = (Cluster) unmarshaller.unmarshal(this.getClass().getResource(CLUSTER_XML));
                cluster.setName(name);
                ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(conf.get("fs.default.name"));
                store.publish(type, cluster);
                break;

            case FEED:
                Feed feed = (Feed) unmarshaller.unmarshal(this.getClass().getResource(FEED_XML));
                feed.setName(name);
                store.publish(type, feed);
                break;

            case PROCESS:
                Process process = (Process) unmarshaller.unmarshal(this.getClass().getResource(PROCESS_XML));
                process.setName(name);
                store.publish(type, process);
                break;
        }
    }
View Full Code Here

                break;
        }
    }

    public void setup() throws Exception {
    ConfigurationStore store = ConfigurationStore.get();
    for (EntityType type : EntityType.values()) {
      for (String name : store.getEntities(type)) {
        store.remove(type, name);
      }
    }
    storeEntity(EntityType.CLUSTER , "testCluster");
    storeEntity(EntityType.PROCESS, "sample");
        storeEntity(EntityType.FEED, "raw-logs");
        storeEntity(EntityType.FEED, "clicks");
        Unmarshaller unmarshaller = EntityType.PROCESS.getUnmarshaller();
        Process process = (Process) unmarshaller.unmarshal(this.getClass().getResource(PROCESS_XML2));
        process.setName("sample2");
        store.publish(EntityType.PROCESS, process);
    }
View Full Code Here

  private static final long HOUR_IN_MS = 3600000L;
  private static final long DAY_IN_MS = 86400000L;
  private static final long MONTH_IN_MS = 2592000000L;

  public static <T extends Entity> T getEntity(EntityType type, String entityName) throws IvoryException {
    ConfigurationStore configStore = ConfigurationStore.get();
    T entity = configStore.get(type, entityName);
    if (entity == null) {
      throw new EntityNotRegisteredException(entityName + " (" + type + ") not found");
    }
    return entity;       
  }
View Full Code Here

    }

    public Set<Entity> getDependents(Entity entity) throws IvoryException {
        Node entityNode = new Node(entity.getEntityType(), entity.getName());
        if (graph.containsKey(entityNode)) {
            ConfigurationStore store = ConfigurationStore.get();
            Set<Entity> dependents = new HashSet<Entity>();
            for (Node node : graph.get(entityNode)) {
                Entity dependentEntity = store.get(node.type, node.name);
                assert dependentEntity != null : "Unable to find " + node;
                dependents.add(dependentEntity);
            }
            return dependents;
        } else {
View Full Code Here

  }

  public static Date getCutOffTime(Entity entity, String nominalTime)
      throws IvoryException {

    ConfigurationStore store = ConfigurationStore.get();
    ExpressionHelper evaluator = ExpressionHelper.get();
    Date instanceStart = EntityUtil.parseDateUTC(nominalTime);
    ExpressionHelper.setReferenceDate(instanceStart);
    Date endTime = new Date();
    Date feedCutOff = new Date(0);
    if (entity.getEntityType() == EntityType.FEED) {
      if (((Feed) entity).getLateArrival() == null) {
        LOG.debug("Feed's " + entity.getName()
            + " late arrival cut-off is not configured, returning");
        return feedCutOff;
      }
      String lateCutOff = ((Feed) entity).getLateArrival().getCutOff()
          .toString();
      endTime = EntityUtil.parseDateUTC(nominalTime);
      long feedCutOffPeriod = evaluator.evaluate(lateCutOff, Long.class);
      endTime = addTime(endTime, (int) feedCutOffPeriod);
      return endTime;
    } else if (entity.getEntityType() == EntityType.PROCESS) {
      Process process = (Process) entity;
      for (LateInput lp : process.getLateProcess().getLateInputs()) {
        Feed feed = null;
        String endInstanceTime = "";
        for (Input input : process.getInputs().getInputs()) {
          if (input.getName().equals(lp.getInput())) {
            endInstanceTime = input.getEnd();
            feed = store.get(EntityType.FEED, input.getFeed());
            break;
          }
        }
        if (feed.getLateArrival() == null) {
          LOG.debug("Feed's " + feed.getName()
View Full Code Here

    @BeforeMethod
    public void setUp() throws Exception {
        super.setup();
       
        ConfigurationStore store = ConfigurationStore.get();
        Cluster cluster = store.get(EntityType.CLUSTER, "corp");
        ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl);

        Process process = store.get(EntityType.PROCESS, "clicksummary");
        Path wfpath = new Path(process.getWorkflow().getPath());
        assert new Path(hdfsUrl).getFileSystem(new Configuration()).mkdirs(wfpath);
    }
View Full Code Here

TOP

Related Classes of org.apache.ivory.entity.store.ConfigurationStore

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.