Package net.timewalker.ffmq3.storage.data

Examples of net.timewalker.ffmq3.storage.data.LinkedDataStore


   * @see net.timewalker.ffmq3.utils.Checkable#check()
   */
  public void check() throws JMSException
    {
      if (StringTools.isEmpty(name))
          throw new InvalidDescriptorException("Missing user name in security descriptor");
      if (password == null)
          throw new InvalidDescriptorException("Missing password definition for user "+name);
    }
View Full Code Here


            // Check temporary destinations scope (JMS Spec 4.4.3 p2)
            session.checkTemporaryDestinationScope(localTopic);
           
            // Deploy a local queue for this consumer
            TopicDefinition topicDef = this.localTopic.getDefinition();
            QueueDefinition tempDef = topicDef.createQueueDefinition(topicRef.getTopicName(), subscriberId, !isDurable());           
            if (engine.localQueueExists(tempDef.getName()))
                this.localQueue = engine.getLocalQueue(tempDef.getName());
            else
                this.localQueue = engine.createQueue(tempDef);
           
            // Register on both the queue and topic
            this.localQueue.registerConsumer(this);
View Full Code Here

           
            // Check temporary destinations scope (JMS Spec 4.4.3 p2)
            session.checkTemporaryDestinationScope(localTopic);
           
            // Deploy a local queue for this consumer
            TopicDefinition topicDef = this.localTopic.getDefinition();
            QueueDefinition tempDef = topicDef.createQueueDefinition(topicRef.getTopicName(), subscriberId, !isDurable());           
            if (engine.localQueueExists(tempDef.getName()))
                this.localQueue = engine.getLocalQueue(tempDef.getName());
            else
                this.localQueue = engine.createQueue(tempDef);
           
View Full Code Here

   */
  public void checkPermission(String resourceName, String action) throws JMSException
  {
    for (int i = 0; i < privileges.size(); i++)
    {
      Privilege privilege = (Privilege)privileges.get(i);
      if (privilege.matches(resourceName, action))
        return;
    }
    throw new FFMQException("Access denied to resource '"+resourceName+"' for action '"+action+"'","ACCESS_DENIED");
  }
View Full Code Here

            currentUser.setName(getRequired(attributes, "name"));
            currentUser.setPassword(getRequired(attributes, "password"));
        }
        if (currentPath.equals("security/users/user/privilege"))
        {
            currentPrivilege = new Privilege();
            currentPrivilege.setResourcePattern(getRequired(attributes, "resource"));
            currentPrivilege.setActions(getRequired(attributes, "actions"));
        }
    }
View Full Code Here

    String msgBase = StringTools.rightPad("DATA-", 1000, 'X');
    byte[] data = msgBase.getBytes();
   
    BlockBasedDataStoreTools.create(storeId, new File("target/test"), 200, 512, true);
    LinkedDataStore store = createStore(storeId, new File("target/test"));
   
    for (int i = 0; i < 500; i++)
    {
      for (int j = 0; j < 10; j++)
      {
        int previous = store.first();
        previous = store.store(data, previous);
        if (previous == -1)
                  throw new IllegalStateException("No space left !");
      }
      store.commitChanges();
      for (int j = 0; j < 10; j++)
      {
        store.delete(store.first());
      }
      store.commitChanges();
    }
   
    store.close();
  }
View Full Code Here

    String msgBase = StringTools.rightPad("DATA-", 1000, 'X');
    byte[] data = msgBase.getBytes();
   
    BlockBasedDataStoreTools.create(storeId, new File("target/test"), 200, 512, true);
    LinkedDataStore store = createStore(storeId, new File("target/test"));
   
    for (int i = 0; i < 500; i++)
    {
      for (int j = 0; j < 10; j++)
      {
        int previous = store.first();
        previous = store.store(data, previous);
        if (previous == -1)
                  throw new IllegalStateException("No space left !");
      }
      //store.commitChanges();
      for (int j = 0; j < 10; j++)
      {
        store.delete(store.first());
      }
      //store.commitChanges();
    }
   
    store.close();
  }
View Full Code Here

        settings.setIntProperty("persistentStore.maxBlockCount", 10000);
        settings.setIntProperty("persistentStore.autoExtendAmount", 500);
        settings.setBooleanProperty("persistentStore.useJournal", false);       
        QueueDefinition queueDef = new QueueDefinition(settings);
       
      LinkedDataStore dataStore = new BlockBasedDataStore(queueDef);
        dataStore.init();
       
    return dataStore;
    }
View Full Code Here

    String msgBase = StringTools.rightPad("DATA-", msgSize, 'X');

    BlockBasedDataStoreTools.create(storeId, new File("target/test"),
                                    200, blockSize, true);
    LinkedDataStore store = createStore(storeId, new File("target/test"));

    // -------------------------------------------------------------------
    // Insert some messages

    long startTime = System.currentTimeMillis();
    int previous = -1;
    for (int n = 0; n < msgCount; n++)
    {
      byte[] data = (msgBase + n).getBytes();
      previous = store.store(data, previous);
      if (previous == -1)
          throw new IllegalStateException("No space left !");
      // System.out.println(store);
    }
    store.commitChanges();
    long endTime = System.currentTimeMillis();
    System.out.println("Insertion time " + (endTime - startTime) + " ms");

    //System.out.println(store);
    store.close();

    // -------------------------------------------------------------------
    // Reload store

    store = createStore(storeId, new File("target/test"));

    //System.out.println(store);
    int count = 0;
    int current = store.first();
    while (current != -1)
    {
      store.retrieve(current);
      current = store.next(current);
      count++;
    }
    // System.out.println(store);
    assertEquals(msgCount, count);
    assertEquals(msgCount, store.size());
    // System.out.println(store);

    // -------------------------------------------------------------------
    // Delete half the messages

    count = 0;
    current = store.first();
    while (current != -1)
    {
      int next = store.next(current);
      if (next != -1)
        next = store.next(next);

      store.delete(current);
      count++;

      current = next;
    }
    store.commitChanges();
    assertEquals(msgCount - count, store.size());
    // System.out.println(store);
    store.close();

    // -------------------------------------------------------------------
    // Reload store
    store = createStore(storeId, new File("target/test"));
    assertEquals(msgCount - count, store.size());
    //System.out.println(store);

    // -------------------------------------------------------------------
    // Add back some messages

    int pos = -1;
    for (int n = 0; n < count; n++)
    {
      byte[] data = (msgBase + n).getBytes();
      previous = store.store(data, pos);
      if (previous == -1)
                throw new IllegalStateException("No space left !");
     
      pos = store.next(previous);
      if (pos != -1)
        pos = store.next(pos);
      // pos+=2+data.length/BLOCK_SIZE;
    }
    store.commitChanges();
    assertEquals(msgCount, store.size());
    System.out.println(store);

    store.close();

    // -------------------------------------------------------------------
    // Reload store

    store = createStore(storeId, new File("target/test"));
    assertEquals(msgCount, store.size());

    System.out.println(store);
   
    count = 0;
    current = store.first();
    while (current != -1)
    {
      store.retrieve(current);
      current = store.next(current);
      count++;
    }
    assertEquals(msgCount, count);
    assertEquals(msgCount, store.size());

    store.close();

    // -------------------------------------------------------------------
    // Delete everything

    store = createStore(storeId, new File("target/test"));
    assertEquals(msgCount, store.size());

    count = 0;
    startTime = System.currentTimeMillis();
    current = store.first();
    while (current != -1)
    {
      int next = store.next(current);
      store.delete(current);
      current = next;
      count++;
    }
    store.commitChanges();
    endTime = System.currentTimeMillis();
    System.out.println("Deletion time " + (endTime - startTime) + " ms");
    assertEquals(msgCount, count);
    assertEquals(0, store.size());
    assertEquals(-1, store.first());

    store.close();

    // -------------------------------------------------------------------
    // Reload store

    store = createStore(storeId, new File("target/test"));
    assertEquals(0, store.size());
    assertEquals(-1, store.first());

    store.close();
  }
View Full Code Here

        settings.setBooleanProperty("persistentStore.useJournal", true);
        settings.setIntProperty("persistentStore.maxBlockCount", 10000);
        settings.setIntProperty("persistentStore.autoExtendAmount", 500);
        QueueDefinition queueDef = new QueueDefinition(settings);
     
    LinkedDataStore dataStore = new JournalingBlockBasedDataStore(queueDef,asyncTaskManager);
        dataStore.init();
       
    return dataStore;
  }
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.storage.data.LinkedDataStore

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.