Quản lý cấu hình web - part 41 ppsx

10 191 0
Quản lý cấu hình web - part 41 ppsx

Đang tải... (xem toàn văn)

Thông tin tài liệu

Leveraging Alfresco Framework for WCM [ 382 ] Search text in ROOT folder and for all web forms This will search in all of the sub-folders of ROOT in the current web project and will also search for all the web forms. The Reset All button will reset all search criteria. Search will return the search results with the lename and corresponding path. The following screenshot shows a snap of the search screen, which searches for the text Alfresco in the current web project's Staging Sandbox. Search text in particular web form content This will search the text in all the sub-folders of ROOT in the current web project and will also search in a specic, selected web form as shown in the following screenshot: Download from Wow! eBook <www.wowebook.com> Chapter 11 [ 383 ] Search text in particular folder of web project This will search the specied text in the particular selected folder within the web project. The Folder Tree component allows you to choose the folder in which you want to search the text. The following screenshot shows the Folder Tree component and the search result: Download from Wow! eBook <www.wowebook.com> Leveraging Alfresco Framework for WCM [ 384 ] Search text in particular web form and in particular folder of web project This will search the specied text in a particular folder selected with the help of the Folder Tree component and also search the content created using the specied web form. The Select WebForm combo box will fetch all web forms associated with the current web project: Metadata extraction for WCM The case study we discussed in the previous section was for the free text search with advanced search criteria in the WCM. In this section, we will discuss how we can perform the search based on the metadata of particular content. Alfresco provides some of the metadata extractors, which are responsible for extracting the metadata from the added or updated content at the server side. Alfresco has different extractors for handling different types of mimetypes for DM. Download from Wow! eBook <www.wowebook.com> Chapter 11 [ 385 ] In this section, we will see how we can congure XML Metadata Extractor for WCM. We will take the example of news content, which we are creating with the help of a news web form. 1. To Activate metadata extraction for WCM, rename the wcm-xml-metadata- extracter-context.xml.sample le available in the <alf_home>/tomcat/ shared/classes/alfresco/extension folder to wcm-xml-metadata- extracter-context.xml. This le will have bean declaration for WCM Metadata extraction, as follows: <bean id="avmMetadataExtracterRegistry" class="org.alfresco.repo.content.metadata. MetadataExtracterRegistry" /> <property name="invokePolicies"> <value>true</value> </property> <property name="metadataExtracterRegistry"> <ref bean="avmMetadataExtracterRegistry" /> </property> </bean> 2. The AVMNodeService res policies for content creation and update that are listened to by avmMetadataExtractors, which is responsible for initiating the metadata extraction for content newly created or updated. 3. To congure an extractor to handle XML content, rst we need to congure XpathMetadataExtracter, as follows: <property name="xpathMappingProperties"> <bean class="org.springframework.beans.factory.config. PropertiesFactoryBean"> <property name="location"> <value> classpath:alfresco/extension/News-Xpath-Mappings. properties </value> </property> </bean> </property> Download from Wow! eBook <www.wowebook.com> Leveraging Alfresco Framework for WCM [ 386 ] Here, News-Xpath-Mappings.properties stored in the alfresco/ extension folder will have mappings of XPath as follows: # Name Space namespace.prefix.trn=http://www.alfrescobook.com/webforms # XPATH Mappings short_title=news/shortTitle/text() content_header=news/contentHeader/text() content_sub_header=news/contentSubHeader/text() news_date=news/newsDate/text() 4. Now we need to map this property with the properties of a content model; for that again, we need to congure property as follows: <property name="mappingProperties"> <bean class="org.springframework.beans.factory.config. PropertiesFactoryBean"> <property name="location"> <value>classpath:alfresco/extension/Content-Model-Mappings. properties </value> </property> </bean> </property> 5. Here Content-Model-Mappings.properties stored in the alfresco/ extension folder will have a mapping of properties of the content model as: namespace.prefix.cignex=http://www.cignex.com # Mappings short_title=shortTitle content_header=contentHeader content_sub_header=contentSubHeader news_date=newsDate 6. Now we need to select the extractor as XMLMetadataExtractor and congure bean for this as: <bean id="extracter.xml.sample.XMLMetadataExtracter" class="org.alfresco.repo.content.metadata.xml. XmlMetadataExtracter" parent="baseMetadataExtracter"> <property name="registry"> <ref bean="avmMetadataExtracterRegistry" /> </property> <property name="overwritePolicy"> <value>EAGER</value> </property> <property name="selectors"> <list> Download from Wow! eBook <www.wowebook.com> Chapter 11 [ 387 ] <ref bean="extracter.xml.sample.selector.XPathSelector" /> </list> </property> </bean> 7. We also need to create a custom content model to dene our custom properties. In this example, we are considering news as one content type, so we need to create a custom aspect with the properties of news as: <aspect name="cignex:news"> <title>Cignex News</title> <properties> <property name="cignex:shortTitle"> <title>Short Title</title> <type>d:text</type> <index enabled="true"/> </property> <property name="cignex:contentHeader"> <title>Content Header</title> <type>d:text</type> <index enabled="true"/> </property> <property name="cignex:contentSubHeader"> <title>Content Sub Header</title> <type>d:text</type> <index enabled="true"/> </property> <property name="cignex:newsDate"> <title>News Date</title> <type>d:date</type> <index enabled="true"/> </property> </properties> </aspect> 8. Now we can search based on any custom property (metadata). You can add search criteria as: @cignex\:shortTitle:"CignexNews",@cignex\:contentHeader:"Cignex*" 9. You can use any of the previously mentioned approaches using Java or JavaScript API, among others, to perform the search by providing this criteria. Download the sample code les for the WCM metadata extractor from the Packt website. Download from Wow! eBook <www.wowebook.com> Leveraging Alfresco Framework for WCM [ 388 ] Summary As Alfresco itself provides many services, using WCM as part of Alfresco we can leverage all these services and capabilities of Alfresco DM in WCM and can use WCM as an enhanced repository. In this chapter, we learned the following points: • Leveraging Membership and Security Mechanism along with the LDAP example • FFMPEG Integration with Alfresco and using DM Business Rules • Copying content from DM to WCM • Using image transformation in WCM • Leveraging Advance Search with custom UI • Using WCM Metadata Extractor to allow metadata search in WCM In the next chapter, we will discuss the Administrative tasks to maintain and upgrade the system. Download from Wow! eBook <www.wowebook.com> WCM Administration Maintaining and upgrading the system is as equally important as implementing it. A well-maintained system will give the highest return on investments. This chapter provides a high-level overview of administering and maintaining your Alfresco implementation. It includes information about backing up your valuable content, upgrading your system to newer versions, enabling full audit trail, and setting up a multi-tenant system conguration. You will also nd general maintenance tips such as maintaining log les and periodically updating your admin password. By the end of this chapter you will have learned how to: • Back up your data on a regular basis for storage and retrieval • Perform general maintenance tasks such as examining log les • Upgrade your Alfresco application to newer versions • Provide Administrator rights • Clean up deployment history Data backup This is one of the most important, yet also one of the most neglected, areas of computing. Backing up your data should be at the top of your computer maintenance list—right next to virus protection. Without data backup, you are running the risk of losing your data. Data loss can happen in many ways. One of the most common causes is the physical failure of the media that the data is stored on. In some situations, users of the system might have deleted the content due to some error. No matter what, your data is your intellectual property and you need to protect it by doing proper backups regularly. Download from Wow! eBook <www.wowebook.com> WCM Administration [ 390 ] List of items to back up Alfresco stores the content information in both the database and the lesystem. You need to back up both the lesystem and relational database. As a part of the implementation, you might have customized Alfresco, and hence you need to back up customization les. If you have used an external membership system such as Active Directory or OpenLDAP, then you might have to back up the user and group data as well. You can set up automated processes to back up data periodically. On Linux operating systems, you can write a cron job to run a back-up script on a regular basis. Similarly, all other operating systems support back-up utilities. Most often, people tend to store the back-up data on the same server. This might create issues when the server crashes. Hence, it is recommended to move the back-up data on to some other external server to store it. Now, let's examine various types of data which need to be backed up. Content stored in lesystem Typically, the content in the lesystem is stored in your <install_folder>/ alf_data folder as shown in the following screenshot. The folder contentstore contains the binary content with all of the versions. The folders lucene-indexes and backup-lucene-indexes contain search information. The folder audit.contentstore contains audit trail details: Download from Wow! eBook <www.wowebook.com> Chapter 12 [ 391 ] You need to back up the entire folder alf_data and the contents. Most of the operating systems provide back-up utilities. If you are a Windows user, you may use the back-up utility that comes with Microsoft Windows XP (it is installed by default with the XP Home version). You will nd it from the Start menu under All Programs | Accessories | System Tools | Backup. When you start it, you are presented with the back-up wizard. Metadata stored in a relational database A relational database contains a bunch of tables dened as per the Alfresco schema. These tables hold information about users, security, audit, spaces, metadata, rules, scripts, and various business processes (jBPM). Most of the database vendors (commercial or open source) provide utilities to take the database dump. Based on the database you have selected during installation (MySQL, Oracle, or MS SQL Server), you can use an appropriate utility to take the database dump. The MySQL database provides a utility called mysqldump to back up both the database table denitions and contents. It can be used to dump a database or a collection of databases for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump contains SQL statements to create the table or populate it, or both. The following is the command to take database backup in MySQL: Syntax: mysqldump [options] db_name [tables] [> output_file_name] An example command is: > mysqldump alfresco > alfresco_outfile.sql Customization les You might be customizing your Alfresco application over a period of time. Typically, you might have added or updated the following les: • Logos, images, and stylesheets • JSP les (dashboard) • Presentation templates • Conguration les, property les • Files in the extension folder • Custom application code (WAR le, source Java les, and so on) Download from Wow! eBook <www.wowebook.com> . <www.wowebook.com> Leveraging Alfresco Framework for WCM [ 384 ] Search text in particular web form and in particular folder of web project This will search the specied text in a particular. Alfresco in the current web project's Staging Sandbox. Search text in particular web form content This will search the text in all the sub-folders of ROOT in the current web project and will. content, which we are creating with the help of a news web form. 1. To Activate metadata extraction for WCM, rename the wcm-xml-metadata- extracter-context.xml.sample le available in the <alf_home>/tomcat/ shared/classes/alfresco/extension

Ngày đăng: 05/07/2014, 20:21

Tài liệu cùng người dùng

Tài liệu liên quan