Package org.codehaus.aspectwerkz.extension.objectfactory

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory


                final Class indexFieldType = index.getFieldType();
                final Class indexType = (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here


        final ObjectIndex index = (ObjectIndex)m_jispIndexes.get(indexName);
        final Class indexType = (Class)m_jispIndexTypes.get(indexName);

        Object obj = null;
        try {
            ObjectFactory factory = new DefaultObjectFactory(
                    indexType, new Class[]{key.getClass()}, new Object[]{key});

            m_readWriteLock.readLock().acquire();
            try {
                obj = m_database.read(
                        (KeyObject)factory.newInstance(), index, m_loader);
            }
            finally {
                m_readWriteLock.readLock().release();
            }
        }
View Full Code Here

        if (!indexTypeFrom.equals(indexTypeTo)) {
            throw new RuntimeException("from A to index must be of the same index type");
        }

        try {
            ObjectFactory fromFactory = new DefaultObjectFactory(
                    indexTypeFrom,
                    new Class[]{from.getClass()},
                    new Object[]{from});

            m_readWriteLock.readLock().acquire();
            try {
                final BTreeObjectIterator iterator =
                        m_database.createIterator((BTreeIndex)indexFrom);

                if (!iterator.moveTo((KeyObject)fromFactory.newInstance())) {
                    throw new RuntimeException("record " + from + " does not exist");
                }
                do {
                    final Object item = iterator.getObject();
                    if (item != null) {
View Full Code Here

                final Class indexType =
                        (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here

        for (Iterator it = btreeIndexes.iterator(); it.hasNext();) {

            final IndexDefinition indexDef = (IndexDefinition)it.next();
            final String jispIndexType = getJispIndexType(indexDef.getType());

            ObjectFactory factory = new DefaultObjectFactory(jispIndexType);

            final StringBuffer indexFile = new StringBuffer();
            indexFile.append(m_indexDir);
            indexFile.append(File.separator);
            indexFile.append(indexDef.getName());

            File killit = new File(indexFile.toString());
            if (killit.exists()) killit.delete();

            final BTreeIndex index = new BTreeIndex(
                    indexFile.toString(),
                    INDEX_ORDER,
                    (KeyObject)factory.newInstance(),
                    false, m_loader);

            indexes.add(index);

            m_jispIndexes.put(indexDef.getName(), index);
View Full Code Here

                final Class indexFieldType = index.getFieldType();
                final Class indexType = (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here

        final ObjectIndex index = (ObjectIndex)m_jispIndexes.get(indexName);
        final Class indexType = (Class)m_jispIndexTypes.get(indexName);

        Object obj = null;
        try {
            ObjectFactory factory = new DefaultObjectFactory(
                    indexType, new Class[]{key.getClass()}, new Object[]{key});

            m_readWriteLock.readLock().acquire();
            try {
                obj = m_database.read(
                        (KeyObject)factory.newInstance(), index, m_loader);
            }
            finally {
                m_readWriteLock.readLock().release();
            }
        }
View Full Code Here

        if (!indexTypeFrom.equals(indexTypeTo)) {
            throw new RuntimeException("from A to index must be of the same index type");
        }

        try {
            ObjectFactory fromFactory = new DefaultObjectFactory(
                    indexTypeFrom,
                    new Class[]{from.getClass()},
                    new Object[]{from});

            m_readWriteLock.readLock().acquire();
            try {
                final BTreeObjectIterator iterator =
                        m_database.createIterator((BTreeIndex)indexFrom);

                if (!iterator.moveTo((KeyObject)fromFactory.newInstance())) {
                    throw new RuntimeException("record " + from + " does not exist");
                }
                do {
                    final Object item = iterator.getObject();
                    if (item != null) {
View Full Code Here

                final Class indexType =
                        (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here

        for (Iterator it = btreeIndexes.iterator(); it.hasNext();) {

            final IndexDefinition indexDef = (IndexDefinition)it.next();
            final String jispIndexType = getJispIndexType(indexDef.getType());

            ObjectFactory factory = new DefaultObjectFactory(jispIndexType);

            final StringBuffer indexFile = new StringBuffer();
            indexFile.append(m_indexDir);
            indexFile.append(File.separator);
            indexFile.append(indexDef.getName());

            File killit = new File(indexFile.toString());
            if (killit.exists()) killit.delete();

            final BTreeIndex index = new BTreeIndex(
                    indexFile.toString(),
                    INDEX_ORDER,
                    (KeyObject)factory.newInstance(),
                    false, m_loader);

            indexes.add(index);

            m_jispIndexes.put(indexDef.getName(), index);
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

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.