Examples of FileStore


Examples of com.google.enterprise.connector.persist.FileStore

    ConnectorTestUtils.deleteAllFiles(connectorDir);
    // Then recreate it empty
    assertTrue(ConnectorTestUtils.mkdirs(connectorDir));

    // Force use of FileStore PersistentStore.
    FileStore fileStore = new FileStore();
    fileStore.setTypeMap(typeMap);
    InstanceInfo.setPersistentStore(fileStore);

    // Jam a properties file with encrypted passwords into the connector dir,
    // making it look like it was persisted.
    Properties props = new Properties();
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.file.FileStore

            File.separator + clusterID;

        logger.logToAll(Logger.INFO,
            "Backup persistent store for HA cluster " + clusterID);

        FileStore fileStore = new FileStore(backupDir, false);

        // for backup, need to clear the store before storing anything.
        fileStore.clearAll(false);

        JDBCStore jdbcStore = null;
        try {
            jdbcStore = (JDBCStore)StoreManager.getStore();

            /*
             * For data that are not broker specific, i.e. properties, change
             * records, consumers, brokers, and sessions, we will store
             * those data on the top level directory (a.k.a cluster filestore).
             */

            // Properties table
            Properties properties = jdbcStore.getAllProperties();
            Iterator propItr = properties.entrySet().iterator();
            while (propItr.hasNext()) {
                Map.Entry entry = (Map.Entry)propItr.next();
                fileStore.updateProperty(
                    (String)entry.getKey(), entry.getValue(), false);

            }
            propItr = null; properties = null;

            // Configuration Change Record table
            List<ChangeRecordInfo> records = jdbcStore.getAllConfigRecords();
            for (int i = 0, len = records.size(); i < len; i++) {
                fileStore.storeConfigChangeRecord(
                    records.get(i).getTimestamp(),
                    (byte[])records.get(i).getRecord(), false);
            }
            records = null;

            // Consumer table
            Consumer[] consumerArray = jdbcStore.getAllInterests();
            for (int i = 0; i < consumerArray.length; i++) {
                fileStore.storeInterest(consumerArray[i], false);
            }
            consumerArray = null;

            // Broker & Session table - store all HABrokerInfo as a property
            HashMap bkrMap = jdbcStore.getAllBrokerInfos(true);
            List haBrokers = new ArrayList(bkrMap.values());
            fileStore.updateProperty(STORE_PROPERTY_HABROKERS, haBrokers, true);

            /*
             * For each broker in the cluster, we will store broker specific
             * data, destinations, messages, transactions, acknowledgements
             * in their own filestore (a.k.a broker filestore).
             */
            Iterator bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                // Backup data for each broker
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                String brokerID = bkrInfo.getId();

                logger.logToAll(Logger.INFO,
                    "Backup persistent data for broker " + brokerID);

                FileStore bkrFS = null;
                JMSBridgeStore jmsbridgeStore = null;
                try {
                    String instanceRootDir = backupDir + File.separator + brokerID;
                    bkrFS = new FileStore(instanceRootDir, false);
                    bkrFS.clearAll(false);

                    // Destination table.
                    Destination[] dstArray = jdbcStore.getAllDestinations(brokerID);
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        DestinationUID did = dstArray[i].getDestinationUID();
                        Destination dst = bkrFS.getDestination(did);
                        if (dst == null) {
                            // Store the destination if not found
                            bkrFS.storeDestination(dstArray[i]false);
                        }
                    }

                    // Storing messages for each destination.
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        Enumeration e = jdbcStore.messageEnumeration(dstArray[i]);
                        try {
                        for (; e.hasMoreElements();) {
                            DestinationUID did = dstArray[i].getDestinationUID();
                            Packet message = (Packet)e.nextElement();
                            SysMessageID mid = message.getSysMessageID();

                            // Get interest states for the message; Consumer State table
                            HashMap stateMap = jdbcStore.getInterestStates(did, mid);
                            if (stateMap == null || stateMap.isEmpty()) {
                                bkrFS.storeMessage(did, message, false);
                            } else {
                                int size = stateMap.size();
                                ConsumerUID[] iids = new ConsumerUID[size];
                                int[] states  = new int[size];
                                Iterator stateItr = stateMap.entrySet().iterator();
                                int j = 0;
                                while (stateItr.hasNext()) {
                                    Map.Entry entry = (Map.Entry)stateItr.next();
                                    iids[j] = (ConsumerUID)entry.getKey();
                                    states[j] = ((Integer)entry.getValue()).intValue();
                                    j++;
                                }
                                bkrFS.storeMessage(did, message, iids, states, false);
                            }

                        }

                        } finally {
                        jdbcStore.closeEnumeration(e);
                        }
                    }

                    // Transaction table
                    Collection txnList = jdbcStore.getTransactions(brokerID);
                    Iterator txnItr = txnList.iterator();
                    while (txnItr.hasNext()) {
                        TransactionUID tid = (TransactionUID)txnItr.next();
                        TransactionInfo txnInfo = jdbcStore.getTransactionInfo(tid);
                        TransactionAcknowledgement txnAck[] =
                            jdbcStore.getTransactionAcks(tid);
                        bkrFS.storeTransaction(tid, txnInfo, false);
                        for (int i = 0, len = txnAck.length; i < len; i++) {
                            bkrFS.storeTransactionAck(tid, txnAck[i], false);
                        }
                    }

                    /**************************************************
                     * JMSBridge
                     **************************************************/

                    Properties bp = new Properties();
                    bp.setProperty("instanceRootDir", instanceRootDir);
                    bp.setProperty("reset", "true");
                    bp.setProperty("logdomain", "imqdbmgr");
                    bp.setProperty("identityName", Globals.getIdentityName());


                    BridgeServiceManager.getExportedService(
                        "com.sun.messaging.bridge.service.JMSBridgeStore", "JMS", bp);

                    List bnames = jdbcStore.getJMSBridgesByBroker(brokerID, null);
                    Collections.sort(bnames);

                    String bname = null;
                    String currbname = null;
                    Iterator itr = bnames.iterator();
                    while (itr.hasNext()) {
                        bname = (String)itr.next();
                        if (currbname == null || !currbname.equals(bname)) {
                            currbname = bname;
                            bp.setProperty("jmsbridge", bname);
                            if (jmsbridgeStore != null) {
                                jmsbridgeStore.closeJMSBridgeStore();
                                jmsbridgeStore = null;
                            }
                            logger.logToAll(logger.INFO, "Backup JMS bridge "+bname);
                            jmsbridgeStore = (JMSBridgeStore)BridgeServiceManager.getExportedService(
                                             "com.sun.messaging.bridge.service.JMSBridgeStore", "JMS", bp);
                            List lrs = jdbcStore.getLogRecordsByNameByBroker(bname, brokerID, null);
                            logger.logToAll(logger.INFO, "\tBackup JMS bridge "+bname+" with "+lrs.size()+" TM log records");
                            byte[] lr = null;
                            Iterator itr1 = lrs.iterator();
                            while (itr1.hasNext()) {
                                lr = (byte[])itr1.next();
                                jmsbridgeStore.storeTMLogRecord(null, lr, currbname, true, null);
                            }
                         }
                    }

                } finally {
                    bkrFS.close();
                    if (jmsbridgeStore != null) jmsbridgeStore.closeJMSBridgeStore();
                }
            }

            logger.logToAll(Logger.INFO, "Backup persistent store complete.");
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.file.FileStore

            File.separator + clusterID;

        logger.logToAll(Logger.INFO,
            "Restore persistent store for HA cluster " + clusterID + " from backup dir: " + backupDir);

        FileStore fileStore = new FileStore(backupDir, false);

        // Brokers table.
        JDBCStore jdbcStore = null;
        try {
            // Re-create the jdbc store
            doRecreate();

            jdbcStore = (JDBCStore)StoreManager.getStore();

            /*
             * For data that are not broker specific, i.e. properties, change
             * records, consumers, brokers, and sessions, we will retrieve
             * those data from the top level directory (a.k.a cluster filestore).
             */

            // Properties table
            List haBrokers = null;
            Properties properties = fileStore.getAllProperties();
            Iterator propItr = properties.entrySet().iterator();
            while (propItr.hasNext()) {
                Map.Entry entry = (Map.Entry)propItr.next();
                String name = (String)entry.getKey();
                if (name.equals(STORE_PROPERTY_HABROKERS)) {
                    // Retrieve all HABrokerInfo from a property
                    haBrokers = (List)entry.getValue();
                } else {
                    jdbcStore.updateProperty(name, entry.getValue(), false);
                }
            }
            propItr = null; properties = null;

            if (haBrokers == null || haBrokers.isEmpty()) {
                throw new BrokerException(br.getKString(
                    BrokerResources.X_LOAD_ALL_BROKERINFO_FAILED));
            }

            // Configuration Change Record table
            List<ChangeRecordInfo> records = fileStore.getAllConfigRecords();
            for (int i = 0, len = records.size(); i < len; i++) {
                jdbcStore.storeConfigChangeRecord(
                    records.get(i).getTimestamp(),
                    records.get(i).getRecord(), false);
            }
            records = null;

            // Consumer table
            Consumer[] consumerArray = fileStore.getAllInterests();
            for (int i = 0; i < consumerArray.length; i++) {
                jdbcStore.storeInterest(consumerArray[i], false);
            }
            consumerArray = null;

            // Broker & Session table.
            Iterator bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                jdbcStore.addBrokerInfo(bkrInfo, false);
            }

            /*
             * For each broker in the cluster, we will retrieve broker specific
             * data, destinations, messages, transactions, acknowledgements
             * from their own filestore (a.k.a broker filestore).
             */
            bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                // Backup data for each broker
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                String brokerID = bkrInfo.getId();
                long sessionID = bkrInfo.getSessionID();

                logger.logToAll(Logger.INFO,
                    "Restore persistent data for broker " + brokerID);

                FileStore bkrFS = null;
                JMSBridgeStore jmsbridgeStore = null;
                try {
                    String instanceRootDir = backupDir + File.separator + brokerID;
                    bkrFS = new FileStore(instanceRootDir, false);

                    // Destination table.
                    Destination[] dstArray = bkrFS.getAllDestinations();
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        DestinationUID did = dstArray[i].getDestinationUID();
                        Destination dst = jdbcStore.getDestination(did);
                        if (dst == null) {
                            // Store the destination if not found
                            jdbcStore.storeDestination(dstArray[i], sessionID);
                        }
                    }

                    // Retrieve messages for each destination.
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        for (Enumeration e = bkrFS.messageEnumeration(dstArray[i]);
                            e.hasMoreElements();) {
                            DestinationUID did = dstArray[i].getDestinationUID();
                            Packet message = (Packet)e.nextElement();
                            SysMessageID mid = message.getSysMessageID();

                            // Get interest states for the message; Consumer State table
                            HashMap stateMap = bkrFS.getInterestStates(did, mid);
                            if (stateMap == null || stateMap.isEmpty()) {
                                jdbcStore.storeMessage(
                                    did, message, null, null, sessionID, false);
                            } else {
                                int size = stateMap.size();
                                ConsumerUID[] iids = new ConsumerUID[size];
                                int[] states  = new int[size];
                                Iterator stateItr = stateMap.entrySet().iterator();
                                int j = 0;
                                while (stateItr.hasNext()) {
                                    Map.Entry entry = (Map.Entry)stateItr.next();
                                    iids[j] = (ConsumerUID)entry.getKey();
                                    states[j] = ((Integer)entry.getValue()).intValue();
                                    j++;
                                }
                                jdbcStore.storeMessage(
                                    did, message, iids, states, sessionID, false);
                            }
                        }
                    }

                    // Transaction table
                    Collection txnList = bkrFS.getTransactions(brokerID);
                    Iterator txnItr = txnList.iterator();
                    while (txnItr.hasNext()) {
                        TransactionUID tid = (TransactionUID)txnItr.next();
                        TransactionInfo txnInfo = bkrFS.getTransactionInfo(tid);
                        TransactionAcknowledgement txnAck[] =
                            bkrFS.getTransactionAcks(tid);
                        jdbcStore.storeTransaction(tid, txnInfo, sessionID);
                        for (int i = 0, len = txnAck.length; i < len; i++) {
                            jdbcStore.storeTransactionAck(tid, txnAck[i], false);
                        }
                    }

                    /**************************************************
                     * JMSBridge
                     **************************************************/

                    Properties bp = new Properties();
                    bp.setProperty("instanceRootDir", instanceRootDir);
                    bp.setProperty("reset", "false");
                    bp.setProperty("logdomain", "imqdbmgr");

                    jmsbridgeStore = (JMSBridgeStore)BridgeServiceManager.getExportedService(
                                     "com.sun.messaging.bridge.service.JMSBridgeStore", "JMS", bp);

                    if (jmsbridgeStore != null) {

                    List bnames = jmsbridgeStore.getJMSBridges(null);
                    String bname = null;
                    Iterator itr = bnames.iterator();
                    while (itr.hasNext()) {
                        bname = (String)itr.next();
                        jdbcStore.addJMSBridge(bname, true, null);
                    }
                    jmsbridgeStore.closeJMSBridgeStore();
                    jmsbridgeStore = null;

                    bname = null;
                    itr = bnames.iterator();
                    while (itr.hasNext()) {
                        bname = (String)itr.next();
                        bp.setProperty("jmsbridge", bname);
                        if (jmsbridgeStore != null) {
                            jmsbridgeStore.closeJMSBridgeStore();
                            jmsbridgeStore = null;
                        }
                        logger.logToAll(logger.INFO, "Restore JMS bridge "+bname);
                        jmsbridgeStore = (JMSBridgeStore)BridgeServiceManager.getExportedService(
                                         "com.sun.messaging.bridge.service.JMSBridgeStore", "JMS", bp);
                        List xids = jmsbridgeStore.getTMLogRecordKeysByName(bname, null);

                        logger.logToAll(logger.INFO, "\tRestore JMS bridge "+bname+" with "+xids.size()+" TM log records");

                        String xid = null;
                        byte[] lr = null;
                        Iterator itr1 = xids.iterator();
                        while (itr1.hasNext()) {
                            xid = (String)itr1.next();
                            lr = jmsbridgeStore.getTMLogRecord(xid, bname, null);
                            if (lr == null) {
                                logger.logToAll(Logger.INFO,
                                        "JMSBridge TM log record not found for "+xid);
                                continue;
                           
                            jdbcStore.storeTMLogRecord(xid, lr, bname, true, null);  
                         }
                    }
                    }

                } finally {
                    bkrFS.close();
                    if (jmsbridgeStore != null) jmsbridgeStore.closeJMSBridgeStore();
                }
            }

            logger.logToAll(Logger.INFO, "Restore persistent store complete.");
View Full Code Here

Examples of java.nio.file.FileStore

      }

      @Override
      public long getAvailableSpace() {
        try {
          final FileStore fileStore = Files.getFileStore(root);
          return fileStore.getUsableSpace();
        }
        catch (IOException e) {
          throw new BlobStoreException(e, null);
        }
      }
View Full Code Here

Examples of net.java.trueupdate.core.io.FileStore

                    void zipFile(final File file, final String name)
                    throws IOException {
                        Copy.copy(source(file), sink(entry(name)));
                    }

                    Source source(File file) { return new FileStore(file); }

                    Sink sink(ZipEntry entry) {
                        return new ZipEntrySink(entry, output);
                    }
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.dao.FileStore

  }

  public ForsendelsesArkiv createForsendesesArkiv() {
    JdbcHelper jdbcHelper = new JdbcHelper();
    jdbcHelper.createTable( "FORSENDELSESARKIV" );
    FileStore fileStore = new FileStore("target", new PdfGeneratorImpl("target"));
    return new ForsendelsesArkiv( fileStore, jdbcHelper.getJdbcTemplate(), altinnFacade );
  }
View Full Code Here

Examples of org.apache.catalina.session.FileStore

        mgr.setMaxActiveSessions(maxSessions);
        //FIXME: what is the replacement for setCheckInterval
        //mgr.setCheckInterval(reapInterval);       
        mgr.setMaxIdleBackup(0);           // FIXME: Make configurable

        FileStore store = new FileStore();
        //store.setCheckInterval(storeReapInterval);
        store.setDirectory(directory);
        mgr.setStore(store);
       
        //for intra-vm session locking
        StandardContext sctx = (StandardContext) ctx;
        sctx.restrictedSetPipeline(new PESessionLockingStandardPipeline(sctx));       
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.segment.file.FileStore

        String size = lookup(context, SIZE);
        if (size == null) {
            size = System.getProperty(SIZE, "256");
        }

        store = new FileStore(
                new File(directory),
                Integer.parseInt(size), "64".equals(mode));

        delegate = new SegmentNodeStore(store);
        observerTracker = new ObserverTracker(delegate);
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.segment.file.FileStore

            // unable to retrieve the checkpoint; use root state instead
            current = store.getRoot();
        }

        // 2. init filestore
        FileStore backup = new FileStore(destination, MAX_FILE_SIZE, false);
        try {
            Journal journal = backup.getJournal("root");

            SegmentNodeState state = new SegmentNodeState(
                    backup.getWriter().getDummySegment(), journal.getHead());
            SegmentNodeBuilder builder = state.builder();

            String beforeCheckpoint = state.getString("checkpoint");
            if (beforeCheckpoint == null) {
                // 3.1 no stored checkpoint, so do the initial full backup
                builder.setChildNode("root", current);
            } else {
                // 3.2 try to retrieve the previously backed up checkpoint
                NodeState before = store.retrieve(beforeCheckpoint);
                if (before != null) {
                    // the previous checkpoint is no longer available,
                    // so use the backed up state as the basis of the
                    // incremental backup diff
                    before = state.getChildNode("root");
                }
                current.compareAgainstBaseState(
                        before, new ApplyDiff(builder.child("root")));
            }
            builder.setProperty("checkpoint", checkpoint);

            // 4. commit the backup
            journal.setHead(
                    state.getRecordId(), builder.getNodeState().getRecordId());
        } finally {
            backup.close();
        }

        log.debug("Backup done in {} ms.", System.currentTimeMillis() - s);
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.segment.file.FileStore

            @Override
            protected Repository[] internalSetUpCluster(int n) throws Exception {
                Repository[] cluster = new Repository[n];
                stores = new FileStore[cluster.length];
                for (int i = 0; i < cluster.length; i++) {
                    stores[i] = new FileStore(
                            new File(base, unique),
                            maxFileSizeMB, cacheSizeMB, memoryMapping);
                    Oak oak = new Oak(new SegmentNodeStore(stores[i]));
                    cluster[i] = new Jcr(oak).createRepository();
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.