public void importResource() {

        m_resourceIdWasNull = false;

        try {
            if (m_throwable != null) {
                getReport().println(m_throwable);
                getReport().addError(m_throwable);

                CmsMessageContainer message = Messages.get().container(
                    Messages.ERR_IMPORTEXPORT_ERROR_IMPORTING_RESOURCES_0);
                if (LOG.isDebugEnabled()) {
                    LOG.debug(message.key(), m_throwable);
                }
                m_throwable = null;
                m_importACEs = false;
                m_resource = null;

                return;
            }

            // apply name translation and import path
            String translatedName = getRequestContext().addSiteRoot(
                CmsStringUtil.joinPaths(m_parameters.getDestinationPath(), m_destination));

            boolean resourceImmutable = checkImmutable(translatedName);
            translatedName = getRequestContext().removeSiteRoot(translatedName);
            // if the resource is not immutable and not on the exclude list, import it
            if (!resourceImmutable) {
                // print out the information to the report
                getReport().print(Messages.get().container(Messages.RPT_IMPORTING_0), I_CmsReport.FORMAT_NOTE);
                getReport().print(
                    org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_ARGUMENT_1,
                        translatedName));
                getReport().print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));

                boolean exists = getCms().existsResource(translatedName, CmsResourceFilter.ALL);

                byte[] content = null;
                // get the file content

                if (m_source != null) {
                    content = m_helper.getFileBytes(m_source);
                }
                int size = 0;
                if (content != null) {
                    size = content.length;
                }
                setDefaultsForEmptyResourceFields();
                // create a new CmsResource
                CmsResource resource = createResourceObjectFromFields(translatedName, size);

                if (m_resourceBuilder.getType().isFolder()
                    || m_resourceIdWasNull
                    || hasContentInVfsOrImport(resource)) {
                    // import this resource in the VFS
                    m_resource = getCms().importResource(
                        translatedName,
                        resource,
                        content,
                        new ArrayList<CmsProperty>(m_properties.values()));
                }

                if (m_resource != null) {
                    m_indexToStructureId.put(Integer.valueOf(m_fileCounter), m_resource.getStructureId());
                }

                // only set permissions if the resource did not exists or if the keep permissions flag is not set
                m_importACEs = (m_resource != null) && (!exists || !m_parameters.isKeepPermissions());

                if (m_resource != null) {
                    getReport().println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    if (OpenCms.getResourceManager().getResourceType(
                        m_resource.getTypeId()) instanceof I_CmsLinkParseable) {
                        // store for later use
                        m_parseables.add(m_resource);
                    }
                    if (LOG.isInfoEnabled()) {
                        LOG.info(
                            Messages.get().getBundle().key(
                                Messages.LOG_IMPORTING_4,
                                new Object[] {
                                    String.valueOf(m_fileCounter),
                                    String.valueOf(m_totalFiles),
                                    translatedName,
                                    m_destination}));
                    }
                } else {
                    // resource import failed, since no CmsResource was created
                    getReport().print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE);
                    getReport().println(
                        org.opencms.report.Messages.get().container(
                            org.opencms.report.Messages.RPT_ARGUMENT_1,
                            translatedName));

                    if (LOG.isInfoEnabled()) {
                        LOG.info(
                            Messages.get().getBundle().key(
                                Messages.LOG_SKIPPING_3,
                                String.valueOf(m_fileCounter),
                                String.valueOf(m_totalFiles),
                                translatedName));
                    }
                }
            } else {
                m_resource = null;
                // skip the file import, just print out the information to the report
                getReport().print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE);
                getReport().println(
                    org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_ARGUMENT_1,
                        translatedName));

                if (LOG.isInfoEnabled()) {
                    LOG.info(
                        Messages.get().getBundle().key(
                            Messages.LOG_SKIPPING_3,
                            String.valueOf(m_fileCounter),
                            String.valueOf(m_totalFiles),
                            translatedName));
                }
                // do not import ACEs
                m_importACEs = false;
            }
        } catch (Exception e) {
            m_resource = null;
            m_importACEs = false;

            getReport().println(e);
            getReport().addError(e);

            CmsMessageContainer message = Messages.get().container(
                Messages.ERR_IMPORTEXPORT_ERROR_IMPORTING_RESOURCES_0);
            if (LOG.isDebugEnabled()) {
                LOG.debug(message.key(), e);
            }

            return;
        }
    }
public void importResource ( ) { m_resourceIdWasNull = false ; try { if ( m_throwable != null ) { getReport ( ) . println ( m_throwable ) ; getReport ( ) . addError ( m_throwable ) ; CmsMessageContainer message = Messages . get ( ) . container ( Messages . ERR_IMPORTEXPORT_ERROR_IMPORTING_RESOURCES_0 ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( message . key ( ) , m_throwable ) ; } m_throwable = null ; m_importACEs = false ; m_resource = null ; return ; } String translatedName = getRequestContext ( ) . addSiteRoot ( CmsStringUtil . joinPaths ( m_parameters . getDestinationPath ( ) , m_destination ) ) ; boolean resourceImmutable = checkImmutable ( translatedName ) ; translatedName = getRequestContext ( ) . removeSiteRoot ( translatedName ) ; if ( ! resourceImmutable ) { getReport ( ) . print ( Messages . get ( ) . container ( Messages . RPT_IMPORTING_0 ) , I_CmsReport . FORMAT_NOTE ) ; getReport ( ) . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , translatedName ) ) ; getReport ( ) . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; boolean exists = getCms ( ) . existsResource ( translatedName , CmsResourceFilter . ALL ) ; byte [ ] content = null ; if ( m_source != null ) { content = m_helper . getFileBytes ( m_source ) ; } int size = 0 ; if ( content != null ) { size = content . length ; } setDefaultsForEmptyResourceFields ( ) ; CmsResource resource = createResourceObjectFromFields ( translatedName , size ) ; if ( m_resourceBuilder . getType ( ) . isFolder ( ) || m_resourceIdWasNull || hasContentInVfsOrImport ( resource ) ) { m_resource = getCms ( ) . importResource ( translatedName , resource , content , new ArrayList < CmsProperty > ( m_properties . values ( ) ) ) ; } if ( m_resource != null ) { m_indexToStructureId . put ( Integer . valueOf ( m_fileCounter ) , m_resource . getStructureId ( ) ) ; } m_importACEs = ( m_resource != null ) && ( ! exists || ! m_parameters . isKeepPermissions ( ) ) ; if ( m_resource != null ) { getReport ( ) . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; if ( OpenCms . getResourceManager ( ) . getResourceType ( m_resource . getTypeId ( ) ) instanceof I_CmsLinkParseable ) { m_parseables . add ( m_resource ) ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_IMPORTING_4 , new Object [ ] { String . valueOf ( m_fileCounter ) , String . valueOf ( m_totalFiles ) , translatedName , m_destination } ) ) ; } } else { getReport ( ) . print ( Messages . get ( ) . container ( Messages . RPT_SKIPPING_0 ) , I_CmsReport . FORMAT_NOTE ) ; getReport ( ) . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , translatedName ) ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SKIPPING_3 , String . valueOf ( m_fileCounter ) , String . valueOf ( m_totalFiles ) , translatedName ) ) ; } } } else { m_resource = null ; getReport ( ) . print ( Messages . get ( ) . container ( Messages . RPT_SKIPPING_0 ) , I_CmsReport . FORMAT_NOTE ) ; getReport ( ) . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , translatedName ) ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SKIPPING_3 , String . valueOf ( m_fileCounter ) , String . valueOf ( m_totalFiles ) , translatedName ) ) ; } m_importACEs = false ; } } catch ( Exception e ) { m_resource = null ; m_importACEs = false ; getReport ( ) . println ( e ) ; getReport ( ) . addError ( e ) ; CmsMessageContainer message = Messages . get ( ) . container ( Messages . ERR_IMPORTEXPORT_ERROR_IMPORTING_RESOURCES_0 ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( message . key ( ) , e ) ; } return ; } }
Imports a resource from the current xml data.<p>

@see #addResourceAttributesRules(Digester, String)
@see #addResourcePropertyRules(Digester, String)