Examples of DataCache


Examples of com.ardor3d.extension.model.collada.jdom.data.DataCache

     * @throws IOException
     *             if the resource can not be loaded for some reason.
     */
    public ColladaStorage load(final ResourceSource resource) throws IOException {
        final ColladaStorage colladaStorage = new ColladaStorage();
        final DataCache dataCache = new DataCache();
        if (_externalJointMapping != null) {
            dataCache.getExternalJointMapping().putAll(_externalJointMapping);
        }
        final ColladaDOMUtil colladaDOMUtil = new ColladaDOMUtil(dataCache);
        final ColladaMaterialUtils colladaMaterialUtils = new ColladaMaterialUtils(this, dataCache, colladaDOMUtil);
        final ColladaMeshUtils colladaMeshUtils = new ColladaMeshUtils(dataCache, colladaDOMUtil, colladaMaterialUtils,
                _optimizeMeshes, _optimizeSettings);
        final ColladaAnimUtils colladaAnimUtils = new ColladaAnimUtils(colladaStorage, dataCache, colladaDOMUtil,
                colladaMeshUtils);
        final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(dataCache, colladaDOMUtil, colladaMaterialUtils,
                colladaMeshUtils, colladaAnimUtils);

        try {
            // Pull in the DOM tree of the Collada resource.
            final Element collada = readCollada(resource, dataCache);

            // if we don't specify a texture locator, add a temporary texture locator at the location of this model
            // resource..
            final boolean addLocator = _textureLocator == null;

            final RelativeResourceLocator loc;
            if (addLocator) {
                loc = new RelativeResourceLocator(resource);
                ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, loc);
            } else {
                loc = null;
            }

            final AssetData assetData = colladaNodeUtils.parseAsset(collada.getChild("asset"));

            // Collada may or may not have a scene, so this can return null.
            final Node scene = colladaNodeUtils.getVisualScene(collada);

            if (_loadAnimations) {
                colladaAnimUtils.parseLibraryAnimations(collada);
            }

            // reattach attachments to scene
            if (scene != null) {
                colladaNodeUtils.reattachAttachments(scene);
            }

            // set our scene into storage
            colladaStorage.setScene(scene);

            // set our asset data into storage
            colladaStorage.setAssetData(assetData);

            // drop our added locator if needed.
            if (addLocator) {
                ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, loc);
            }

            // copy across our mesh colors - only for objects with multiple channels
            final Multimap<MeshData, FloatBuffer> colors = ArrayListMultimap.create();
            final Multimap<MeshData, FloatBuffer> temp = dataCache.getParsedVertexColors();
            for (final MeshData key : temp.keySet()) {
                // only copy multiple channels since their data is lost
                final Collection<FloatBuffer> val = temp.get(key);
                if (val != null && val.size() > 1) {
                    colors.putAll(key, val);
                }
            }
            colladaStorage.setParsedVertexColors(colors);

            // copy across our mesh material info
            colladaStorage.setMeshMaterialInfo(dataCache.getMeshMaterialMap());
            colladaStorage.setMaterialMap(dataCache.getMaterialInfoMap());

            // return storage
            return colladaStorage;
        } catch (final Exception e) {
            throw new IOException("Unable to load collada resource from URL: " + resource, e);
View Full Code Here

Examples of com.espertech.esper.epl.db.DataCache

        validatedExprNodes = desc.getChildEvals();
    }

    public EventTable[] poll(EventBean[][] lookupEventsPerStream, PollResultIndexingStrategy indexingStrategy, ExprEvaluatorContext exprEvaluatorContext)
    {
        DataCache localDataCache = dataCacheThreadLocal.get();
        boolean strategyStarted = false;

        EventTable[] resultPerInputRow = new EventTable[lookupEventsPerStream.length];

        // Get input parameters for each row
        for (int row = 0; row < lookupEventsPerStream.length; row++)
        {
            Object[] lookupValues = new Object[inputParameters.size()];

            // Build lookup keys
            for (int valueNum = 0; valueNum < inputParameters.size(); valueNum++)
            {
                Object parameterValue = validatedExprNodes[valueNum].evaluate(lookupEventsPerStream[row], true, exprEvaluatorContext);
                lookupValues[valueNum] = parameterValue;
            }

            EventTable result = null;

            // try the threadlocal iteration cache, if set
            if (localDataCache != null)
            {
                result = localDataCache.getCached(lookupValues);
            }

            // try the connection cache
            if (result == null)
            {
                result = dataCache.getCached(lookupValues);
                if ((result != null) && (localDataCache != null))
                {
                    localDataCache.put(lookupValues, result);
                }
            }

            if (result != null)     // found in cache
            {
                resultPerInputRow[row] = result;
            }
            else        // not found in cache, get from actual polling (db query)
            {
                try
                {
                    if (!strategyStarted)
                    {
                        pollExecStrategy.start();
                        strategyStarted = true;
                    }

                    // Poll using the polling execution strategy and lookup values
                    List<EventBean> pollResult = pollExecStrategy.poll(lookupValues);

                    // index the result, if required, using an indexing strategy
                    EventTable indexTable = indexingStrategy.index(pollResult, dataCache.isActive());

                    // assign to row
                    resultPerInputRow[row] = indexTable;

                    // save in cache
                    dataCache.put(lookupValues, indexTable);

                    if (localDataCache != null)
                    {
                        localDataCache.put(lookupValues, indexTable);
                    }
                }
                catch (EPException ex)
                {
                    if (strategyStarted)
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.gui.db.DataCache

      JOptionPane.showMessageDialog(null, errMsg, "SQuirreL failed to start", JOptionPane.ERROR_MESSAGE);
      System.exit(-1);
    }

    _cache =
      new DataCache(_driverMgr, _appFiles.getDatabaseDriversFile(), _appFiles.getDatabaseAliasesFile(),
        _resources.getDefaultDriversUrl(), this);

    indicateNewStartupTask(splash, s_stringMgr.getString("Application.splash.createWindowManager"));
    _windowManager = new WindowManager(this, args.getUserInterfaceDebugEnabled());
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.gui.db.DataCache

   }

   public void execute()
   {
      final List<ISQLAlias> aliases = new ArrayList<ISQLAlias>();
      final DataCache cache = _app.getDataCache();
      synchronized (cache)
      {
         for (Iterator<ISQLAlias> it = cache.aliases(); it.hasNext();)
         {
            ISQLAlias alias = it.next();
            if (alias.isConnectAtStartup())
            {
               aliases.add(alias);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.gui.db.DataCache

   */
  public void execute() throws BaseException
  {
    try
    {
      final DataCache cache = _app.getDataCache();
      cache.loadDefaultDrivers(_url);
      new ShowLoadedDriversOnlyCommand(_app, false).execute();
    }
    catch (IOException ex)
    {
      throw new BaseException(ex);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.gui.db.DataCache

   *
   * @throws  IOException    Thrown if an IO error occurs.
   */
  protected void writeToFile(File file) throws IOException, XMLException
  {
    final DataCache cache = _plugin.getApplication().getDataCache();
    cache.saveDrivers(file);
  }
View Full Code Here

Examples of org.apache.openjpa.datacache.DataCache

            if (sm == null)
                return;

            sm.evict();
            if (_evictDataCache && sm.getObjectId() != null) {
                DataCache cache = sm.getMetaData().getDataCache();
                if (cache != null)
                    cache.remove(sm.getObjectId());
            }
        }
        catch (OpenJPAException ke) {
            throw ke;
        } catch (RuntimeException re) {
View Full Code Here

Examples of org.apache.openjpa.datacache.DataCache

            if (sm == null)
                return;

            sm.evict();
            if (_evictDataCache && sm.getObjectId() != null) {
                DataCache cache = _conf.getDataCacheManagerInstance().selectCache(sm);
                if (cache != null)
                    cache.remove(sm.getObjectId());
            }
        }
        catch (OpenJPAException ke) {
            throw ke;
        } catch (RuntimeException re) {
View Full Code Here

Examples of org.apache.openjpa.datacache.DataCache

            endEm(em2);
        }
    }

    public void testCanCacheExtension() throws Exception {
        DataCache cache = cacheManager(factory).getSystemDataCache();

        // first, test caching of newly created objects.
        OpenJPAEntityManager em = (OpenJPAEntityManager) factory
            .createEntityManager();
        Object o;
        Object oid;
        try {
            startTx(em);
            o = new CacheObjectB("foo");
            em.persist(o);
            endTx(em);
            oid = em.getObjectId(o);
            assertNotNull(oid);
            assertNull(cache.get(oid));
        }
        finally {
            endEm(em);
        }

        // now, test caching of data loaded from the data store.
        em = factory.createEntityManager();
        try {
            o = em.find(CacheObjectB.class, oid);
            assertNotNull(o);
            assertNull(cache.get(oid));
        }
        finally {
            endEm(em);
        }
    }
View Full Code Here

Examples of org.apache.openjpa.datacache.DataCache

        }
    }

    public void testGetCache() {
        // first, test caching of newly created objects.
        DataCache defaultCache = cacheManager(factory).getDataCache(
            DataCache.NAME_DEFAULT, false);
        assertNotNull(defaultCache);

        DataCache cache = cacheManager(factory).getSystemDataCache();
        assertEquals(defaultCache, cache);

        ClassMetaData aMeta = repos.getMetaData(CacheObjectA.class, null, true);
        ClassMetaData aChild1Meta = repos.getMetaData(CacheObjectAChild1.class,
            null, true);
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.