Class XBECatalog

  • All Implemented Interfaces:
    org.exbin.xbup.core.catalog.XBCatalog
    Direct Known Subclasses:
    XBAECatalog

    @ParametersAreNonnullByDefault
    public class XBECatalog
    extends java.lang.Object
    implements org.exbin.xbup.core.catalog.XBCatalog
    Basic level 1 catalog class using Java persistence.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Class,​org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> catalogManagers  
      protected java.util.Map<java.lang.Class,​org.exbin.xbup.core.catalog.base.service.XBCService<?>> catalogServices  
      protected javax.persistence.EntityManager em  
    • Constructor Summary

      Constructors 
      Constructor Description
      XBECatalog()  
      XBECatalog​(javax.persistence.EntityManager em)
      Creates a new instance of XBECatalog.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends org.exbin.xbup.core.catalog.base.manager.XBCManager<?>>
      void
      addCatalogManager​(java.lang.Class<T> type, T manager)  
      <T extends org.exbin.xbup.core.catalog.base.service.XBCService<?>>
      void
      addCatalogService​(java.lang.Class<T> type, T service)  
      java.lang.Long findBlockIdForGroup​(org.exbin.xbup.core.block.declaration.XBGroupDecl group, org.exbin.xbup.core.block.declaration.XBBlockDecl decl)  
      java.lang.Long findBlockIdForGroup​(org.exbin.xbup.core.block.declaration.XBGroup group, org.exbin.xbup.core.block.declaration.XBBlockDecl decl)  
      XBEBlockSpec findBlockSpecByPath​(java.lang.Long[] xbCatalogPath)  
      org.exbin.xbup.core.block.declaration.XBBlockDecl findBlockTypeByPath​(java.lang.Long[] blockSpecCatalogPath, int revision)  
      XBEFormatSpec findFormatSpecByPath​(java.lang.Long[] xbCatalogPath)  
      org.exbin.xbup.core.block.declaration.XBFormatDecl findFormatTypeByPath​(java.lang.Long[] xbCatalogPath, int revision)  
      XBEGroupSpec findGroupSpecByPath​(java.lang.Long[] xbCatalogPath)  
      org.exbin.xbup.core.block.declaration.XBGroupDecl findGroupTypeByPath​(java.lang.Long[] xbCatalogPath, int revision)  
      org.exbin.xbup.core.block.XBBlockType getBasicBlockType​(org.exbin.xbup.core.block.XBBasicBlockType blockType)  
      java.util.List<org.exbin.xbup.core.block.declaration.XBBlockDecl> getBlocks​(org.exbin.xbup.core.catalog.base.XBCGroupSpec spec)  
      org.exbin.xbup.core.block.declaration.XBBlockDecl getBlockType​(org.exbin.xbup.core.block.declaration.XBContext context, int groupId, int blockId)
      Gets block type for specification defined by IDs in given context.
      <T extends org.exbin.xbup.core.catalog.base.manager.XBCManager<?>>
      T
      getCatalogManager​(java.lang.Class<T> managerClass)  
      java.util.List<org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> getCatalogManagers()  
      <T extends org.exbin.xbup.core.catalog.base.service.XBCService<?>>
      T
      getCatalogService​(java.lang.Class<T> serviceClass)  
      java.util.List<org.exbin.xbup.core.catalog.base.service.XBCService<?>> getCatalogServices()  
      javax.persistence.EntityManager getEntityManager()  
      java.util.List<org.exbin.xbup.core.block.declaration.XBGroupDecl> getGroups​(org.exbin.xbup.core.catalog.base.XBCFormatSpec spec)  
      org.exbin.xbup.core.block.declaration.XBContext getRootContext()  
      java.lang.Long[] getSpecPath​(org.exbin.xbup.core.catalog.base.XBCSpec spec)  
      org.exbin.xbup.client.update.XBCUpdateHandler getUpdateHandler()  
      void initCatalog()  
      boolean isShallInit()  
      org.exbin.xbup.core.block.declaration.XBContext processDeclaration​(org.exbin.xbup.core.block.declaration.XBContext parent, org.exbin.xbup.core.parser.token.pull.XBTPullProvider blockProvider)  
      void setRootContext​(org.exbin.xbup.core.block.declaration.XBContext context)  
      void setUpdateHandler​(org.exbin.xbup.client.update.XBCUpdateHandler updateHandler)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • em

        protected javax.persistence.EntityManager em
      • catalogManagers

        protected java.util.Map<java.lang.Class,​org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> catalogManagers
      • catalogServices

        protected java.util.Map<java.lang.Class,​org.exbin.xbup.core.catalog.base.service.XBCService<?>> catalogServices
    • Constructor Detail

      • XBECatalog

        public XBECatalog()
      • XBECatalog

        public XBECatalog​(javax.persistence.EntityManager em)
        Creates a new instance of XBECatalog.
        Parameters:
        em - entity manager
    • Method Detail

      • findFormatSpecByPath

        @Nullable
        public XBEFormatSpec findFormatSpecByPath​(java.lang.Long[] xbCatalogPath)
      • findGroupSpecByPath

        @Nullable
        public XBEGroupSpec findGroupSpecByPath​(java.lang.Long[] xbCatalogPath)
      • findBlockSpecByPath

        @Nullable
        public XBEBlockSpec findBlockSpecByPath​(java.lang.Long[] xbCatalogPath)
      • findFormatTypeByPath

        @Nullable
        public org.exbin.xbup.core.block.declaration.XBFormatDecl findFormatTypeByPath​(java.lang.Long[] xbCatalogPath,
                                                                                       int revision)
        Specified by:
        findFormatTypeByPath in interface org.exbin.xbup.core.catalog.XBCatalog
      • findGroupTypeByPath

        @Nullable
        public org.exbin.xbup.core.block.declaration.XBGroupDecl findGroupTypeByPath​(java.lang.Long[] xbCatalogPath,
                                                                                     int revision)
        Specified by:
        findGroupTypeByPath in interface org.exbin.xbup.core.catalog.XBCatalog
      • findBlockTypeByPath

        @Nullable
        public org.exbin.xbup.core.block.declaration.XBBlockDecl findBlockTypeByPath​(java.lang.Long[] blockSpecCatalogPath,
                                                                                     int revision)
        Specified by:
        findBlockTypeByPath in interface org.exbin.xbup.core.catalog.XBCatalog
      • getRootContext

        @Nonnull
        public org.exbin.xbup.core.block.declaration.XBContext getRootContext()
        Specified by:
        getRootContext in interface org.exbin.xbup.core.catalog.XBCatalog
      • setRootContext

        public void setRootContext​(org.exbin.xbup.core.block.declaration.XBContext context)
      • initCatalog

        public void initCatalog()
      • getGroups

        public java.util.List<org.exbin.xbup.core.block.declaration.XBGroupDecl> getGroups​(org.exbin.xbup.core.catalog.base.XBCFormatSpec spec)
        Specified by:
        getGroups in interface org.exbin.xbup.core.catalog.XBCatalog
      • getBlocks

        public java.util.List<org.exbin.xbup.core.block.declaration.XBBlockDecl> getBlocks​(org.exbin.xbup.core.catalog.base.XBCGroupSpec spec)
        Specified by:
        getBlocks in interface org.exbin.xbup.core.catalog.XBCatalog
      • addCatalogManager

        public <T extends org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> void addCatalogManager​(java.lang.Class<T> type,
                                                                                                         T manager)
        Specified by:
        addCatalogManager in interface org.exbin.xbup.core.catalog.XBCatalog
      • addCatalogService

        public <T extends org.exbin.xbup.core.catalog.base.service.XBCService<?>> void addCatalogService​(java.lang.Class<T> type,
                                                                                                         T service)
        Specified by:
        addCatalogService in interface org.exbin.xbup.core.catalog.XBCatalog
      • getEntityManager

        @Nonnull
        public javax.persistence.EntityManager getEntityManager()
      • getCatalogServices

        @Nonnull
        public java.util.List<org.exbin.xbup.core.catalog.base.service.XBCService<?>> getCatalogServices()
        Specified by:
        getCatalogServices in interface org.exbin.xbup.core.catalog.XBCatalog
      • getCatalogManagers

        @Nonnull
        public java.util.List<org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> getCatalogManagers()
        Specified by:
        getCatalogManagers in interface org.exbin.xbup.core.catalog.XBCatalog
      • getUpdateHandler

        public org.exbin.xbup.client.update.XBCUpdateHandler getUpdateHandler()
      • setUpdateHandler

        public void setUpdateHandler​(org.exbin.xbup.client.update.XBCUpdateHandler updateHandler)
      • isShallInit

        public boolean isShallInit()
      • getCatalogManager

        @Nonnull
        public <T extends org.exbin.xbup.core.catalog.base.manager.XBCManager<?>> T getCatalogManager​(java.lang.Class<T> managerClass)
        Specified by:
        getCatalogManager in interface org.exbin.xbup.core.catalog.XBCatalog
      • getCatalogService

        @Nonnull
        public <T extends org.exbin.xbup.core.catalog.base.service.XBCService<?>> T getCatalogService​(java.lang.Class<T> serviceClass)
        Specified by:
        getCatalogService in interface org.exbin.xbup.core.catalog.XBCatalog
      • findBlockIdForGroup

        public java.lang.Long findBlockIdForGroup​(org.exbin.xbup.core.block.declaration.XBGroup group,
                                                  org.exbin.xbup.core.block.declaration.XBBlockDecl decl)
      • findBlockIdForGroup

        public java.lang.Long findBlockIdForGroup​(org.exbin.xbup.core.block.declaration.XBGroupDecl group,
                                                  org.exbin.xbup.core.block.declaration.XBBlockDecl decl)
      • getBlockType

        public org.exbin.xbup.core.block.declaration.XBBlockDecl getBlockType​(org.exbin.xbup.core.block.declaration.XBContext context,
                                                                              int groupId,
                                                                              int blockId)
        Gets block type for specification defined by IDs in given context.
        Parameters:
        context - current context
        groupId - group ID
        blockId - block ID
        Returns:
        block type declaration
      • processDeclaration

        public org.exbin.xbup.core.block.declaration.XBContext processDeclaration​(org.exbin.xbup.core.block.declaration.XBContext parent,
                                                                                  org.exbin.xbup.core.parser.token.pull.XBTPullProvider blockProvider)
        Specified by:
        processDeclaration in interface org.exbin.xbup.core.catalog.XBCatalog
      • getSpecPath

        public java.lang.Long[] getSpecPath​(org.exbin.xbup.core.catalog.base.XBCSpec spec)
        Specified by:
        getSpecPath in interface org.exbin.xbup.core.catalog.XBCatalog
      • getBasicBlockType

        public org.exbin.xbup.core.block.XBBlockType getBasicBlockType​(org.exbin.xbup.core.block.XBBasicBlockType blockType)
        Specified by:
        getBasicBlockType in interface org.exbin.xbup.core.catalog.XBCatalog