Package org.glassfish.ha.store.api

Examples of org.glassfish.ha.store.api.BackingStoreFactory


    @Override
    public <T extends Serializable> void  createBackingStore(String persistenceType, String storeName, Class<T> metadataClass, HashMap vendorMap) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Create backing store invoked with persistence type " + persistenceType + " and store name " + storeName);
        }
        BackingStoreFactory factory = habitat.getComponent(BackingStoreFactory.class, persistenceType);
        BackingStoreConfiguration<String, T> conf = new BackingStoreConfiguration<String, T>();

        if(gmsAdapterService.isGmsEnabled()) {
            clusterName = gmsAdapterService.getGMSAdapter().getClusterName();
            instanceName = gmsAdapterService.getGMSAdapter().getModule().getInstanceName();
        }
        conf.setStoreName(storeName)
                .setClusterName(clusterName)
                .setInstanceName(instanceName)
                .setStoreType(persistenceType)
                .setKeyClazz(String.class).setValueClazz(metadataClass)
                .setClassLoader(this.getClass().getClassLoader());
        if (vendorMap != null) {
            conf.getVendorSpecificSettings().putAll(vendorMap);
        }

        try {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("About to create backing store " + conf);
            }
            this.backingStore = factory.createBackingStore(conf);
        } catch (BackingStoreException e) {
            _logger.log(Level.WARNING, "Could not create backing store", e)
        }
        Object obj = conf.getVendorSpecificSettings().get("key.mapper");
        if (obj != null && obj instanceof GlassFishHAReplicaPredictor) {
View Full Code Here


                persistenceStoreType = "file";
            }
        }


        BackingStoreFactory factory = null;
        try {
            factory = habitat.getComponent(BackingStoreFactory.class, persistenceStoreType);
        } catch (Exception ex) {
            _logger.log(Level.WARNING, "Could not instantiate backing store factory for type: " + persistenceStoreType, ex);
            persistenceStoreType = "noop";
            try {
                factory = habitat.getComponent(BackingStoreFactory.class, persistenceStoreType);
            } catch (Exception ex2) {
                _logger.log(Level.WARNING, "Could not instantiate backing store factory for type: " + persistenceStoreType, ex2);
                throw new BackingStoreException("Could not instantiate BackingStore Factory for persistence type: " + persistenceStoreType, ex);
            }
        }

        BackingStoreConfiguration<Serializable, SimpleMetadata> conf = new BackingStoreConfiguration<Serializable, SimpleMetadata>();
        String storeName = ejbDescriptor.getName() + "-" + ejbDescriptor.getUniqueId() + "-BackingStore";

        _logger.log(Level.INFO, "StatefulContainerBuilder.buildStoreManager() storeName: " + storeName);
       
        String subDirName = "";

        subDirName += ejbDescriptor.getName() + "-" + ejbDescriptor.getUniqueId();
       
        conf.setShortUniqueName(""+ejbDescriptor.getUniqueId()).setStoreName(storeName)
                .setStoreType(persistenceStoreType)
                .setBaseDirectory(new File(ejbContainerConfig.getSessionStore(), subDirName))
                .setKeyClazz(Serializable.class)
                .setValueClazz(SimpleMetadata.class)
                .setClassLoader(StatefulContainerBuilder.class.getClassLoader());


        Map<String, Object> vendorMap = conf.getVendorSpecificSettings();
        vendorMap.put("local.caching", true);
        vendorMap.put("start.gms", false);
        vendorMap.put("async.replication", asyncReplication);
        vendorMap.put("broadcast.remove.expired", false);
        vendorMap.put("value.class.is.thread.safe", true);
        vendorMap.put("key.transformer", keyGen);

        if (gmsAdapterService != null) {
            GMSAdapter gmsAdapter = gmsAdapterService.getGMSAdapter();
            if (gmsAdapter != null) {
                conf.setClusterName(gmsAdapter.getClusterName());
                conf.setInstanceName(gmsAdapter.getModule().getInstanceName());
            }
        }


        try {
            sfsbContainer.setSfsbHaPersistenceType(persistenceStoreType);
            this.backingStore = factory.createBackingStore(conf);
        } catch (Exception ex) {
            _logger.log(Level.WARNING, "Could not instantiate BackingStore for persistence type: " + persistenceStoreType, ex);
            throw new BackingStoreException("Could not instantiate BackingStore for persistence type: " + persistenceStoreType, ex);
        }
        _logger.log(Level.WARNING, "StatefulContainerbuilder instantiated store: " +
View Full Code Here

    @Override
    public <T extends Serializable> void  createBackingStore(String persistenceType, String storeName, Class<T> metadataClass, HashMap vendorMap) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Create backing store invoked with persistence type " + persistenceType + " and store name " + storeName);
        }
        BackingStoreFactory factory = habitat.getComponent(BackingStoreFactory.class, persistenceType);
        BackingStoreConfiguration<String, T> conf = new BackingStoreConfiguration<String, T>();

        if(gmsAdapterService.isGmsEnabled()) {
            clusterName = gmsAdapterService.getGMSAdapter().getClusterName();
            instanceName = gmsAdapterService.getGMSAdapter().getModule().getInstanceName();
        }
        conf.setStoreName(storeName)
                .setClusterName(clusterName)
                .setInstanceName(instanceName)
                .setStoreType(persistenceType)
                .setKeyClazz(String.class).setValueClazz(metadataClass)
                .setClassLoader(this.getClass().getClassLoader());
        if (vendorMap != null) {
            conf.getVendorSpecificSettings().putAll(vendorMap);
        }

        try {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("About to create backing store " + conf);
            }
            this.backingStore = factory.createBackingStore(conf);
        } catch (BackingStoreException e) {
            _logger.log(Level.WARNING, "Could not create backing store", e)
        }
        Object obj = conf.getVendorSpecificSettings().get("key.mapper");
        if (obj != null && obj instanceof GlassFishHAReplicaPredictor) {
View Full Code Here

   
    protected static synchronized BackingStore getSsoEntryMetadataBackingStore(
            String persistenceType, String storeName, Habitat habitat) {

        if (ssoEntryMetadataBackingStore == null) {
            BackingStoreFactory factory = habitat.getComponent(BackingStoreFactory.class, persistenceType);
            BackingStoreConfiguration<String, HASingleSignOnEntryMetadata> conf =
                    new BackingStoreConfiguration<String, HASingleSignOnEntryMetadata>();

            String clusterName = "";
            String instanceName = "";
            GMSAdapterService gmsAdapterService = habitat.getComponent(GMSAdapterService.class);
            if(gmsAdapterService.isGmsEnabled()) {
                clusterName = gmsAdapterService.getGMSAdapter().getClusterName();
                instanceName = gmsAdapterService.getGMSAdapter().getModule().getInstanceName();
            }

            conf.setStoreName(storeName)
                    .setClusterName(clusterName)
                    .setInstanceName(instanceName)
                    .setStoreType(persistenceType)
                    .setKeyClazz(String.class).setValueClazz(HASingleSignOnEntryMetadata.class);

            try {
                ssoEntryMetadataBackingStore = factory.createBackingStore(conf);
            } catch (BackingStoreException e) {
                e.printStackTrace()
            }
        }
View Full Code Here

    Events events;

    @Override
    public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(BackingStoreConfiguration<K, V> conf) throws BackingStoreException {
        try {
            BackingStoreFactory storeFactory = habitat.getService(BackingStoreFactory.class, "shoal-backing-store-factory");
            return storeFactory.createBackingStore(conf);
        } catch (Exception ex) {
            throw new BackingStoreException("Exception while created shoal cache", ex);
        }
    }
View Full Code Here

    }

    @Override
    public BackingStoreTransaction createBackingStoreTransaction() {
        try {
            BackingStoreFactory storeFactory = habitat.getService(BackingStoreFactory.class, "shoal-backing-store-factory");
            return storeFactory.createBackingStoreTransaction();
        } catch (Exception ex) {
            //FIXME avoid runtime exception
            throw new RuntimeException("Exception while created shoal cache", ex);
        }
    }
View Full Code Here

    Events events;

    @Override
    public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(BackingStoreConfiguration<K, V> conf) throws BackingStoreException {
        try {
            BackingStoreFactory storeFactory = habitat.getService(BackingStoreFactory.class, "shoal-backing-store-factory");
            return storeFactory.createBackingStore(conf);
        } catch (IllegalStateException ex) {
            String msg = "ReplicatedBackingStore requires GMS to be running in the target cluster before the application is deployed. ";
            throw new BackingStoreException("Exception while creating replicated BackingStore. " + msg, ex);
        } catch (Exception ex) {
            throw new BackingStoreException("Exception while creating shoal cache", ex);
View Full Code Here

    }

    @Override
    public BackingStoreTransaction createBackingStoreTransaction() {
        try {
            BackingStoreFactory storeFactory = habitat.getService(BackingStoreFactory.class, "shoal-backing-store-factory");
            return storeFactory.createBackingStoreTransaction();
        } catch (Exception ex) {
            //FIXME avoid runtime exception
            throw new RuntimeException("Exception while creating shoal cache", ex);
        }
    }
View Full Code Here

    @Override
    public void createBackingStore(String persistenceType, String storeName, Class<T> metadataClass, Map<String, Object> vendorMap) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Create backing store invoked with persistence type " + persistenceType + " and store name " + storeName);
        }
        BackingStoreFactory factory = services.getService(BackingStoreFactory.class, persistenceType);
        BackingStoreConfiguration<String, T> conf = new BackingStoreConfiguration<String, T>();

        if(gmsAdapterService.isGmsEnabled()) {
            clusterName = gmsAdapterService.getGMSAdapter().getClusterName();
            instanceName = gmsAdapterService.getGMSAdapter().getModule().getInstanceName();
        }
        conf.setStoreName(storeName)
                .setClusterName(clusterName)
                .setInstanceName(instanceName)
                .setStoreType(persistenceType)
                .setKeyClazz(String.class).setValueClazz(metadataClass)
                .setClassLoader(this.getClass().getClassLoader());
        if (vendorMap != null) {
            conf.getVendorSpecificSettings().putAll(vendorMap);
        }

        try {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("About to create backing store " + conf);
            }
            this.backingStore = factory.createBackingStore(conf);
        } catch (BackingStoreException e) {
            _logger.log(Level.WARNING, COULD_NOT_CREATE_BACKING_STORE, e);
        }
        Object obj = conf.getVendorSpecificSettings().get("key.mapper");
        if (obj != null && obj instanceof GlassFishHAReplicaPredictor) {
View Full Code Here

                    new BackingStoreConfiguration<String, NonceInfo>();
            bsConfig.setClusterName(props.get(CNonceCacheFactory.CLUSTER_NAME_PROP)).
                    setInstanceName(props.get(CNonceCacheFactory.INSTANCE_NAME_PROP)).
                    setStoreName(storeName).setKeyClazz(String.class)
                    .setValueClazz(NonceInfo.class);
            BackingStoreFactory bsFactory = services.getService(BackingStoreFactory.class, BS_TYPE_REPLICATED);
            backingStore = bsFactory.createBackingStore(bsConfig);
        } catch (BackingStoreException ex) {
            logger.log(Level.WARNING, null, ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.ha.store.api.BackingStoreFactory

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.