четверг, 27 октября 2011 г.

Интеграция Liferay Portal 6 и Alfresco 4.0



подключение Alfresco v4 к Liferay v6 при помощи портлетов.


В интернете есть достаточно много информации о том как использовать возможности alfresco в портале liferay.
Официальные wiki,инструкции разработчиков,есть даже видео-инструкция.
Однако, у меня получилось подружить эти две системы не сразу.
В этой части я опишу на примере все что я делал и чего не делал.


Итак, первым делом смотрим очень подробную видео инструкцию на Youtube и спасибо тем кто её сделал :)





Из инструкции мы поняли что, для того чтобы alfresco портлеты заработали нам необходимо внести изменения всего в 3 конфигурационных файла (если изменять server.xml, то в 4), два в Alfresco и один в liferay, потом скопировать папку shared из Alfresco в Liferay и задеплоить WAR файл с портлетами в наш лайфрей, после чего добавить тестового юзера и посмотреть как это все заработает.

Для чистоты эксперемента будем работать с  версиями этих систем из коробки.
Начнем с того что скачаем Liferay v 6.0.4 (Tomcat) и Alfresco 4.0.a.


Распакуем содержимое только что скачанного архива Liferay на диск C: 
Субд для портала устанавливать небудем ибо для теста она ненужна.

Стандартно, из коробки, Liferay настроен на порт 8080, мы ничего менять не будем оставим как есть.

Теперь, время установить Alfresco:








Так как Alfresco тоже на Томкате, нам необходимо изменить некоторые порты для исключения конфликтов.



 Порт сервера базы данных оставляем без изменений.

 Для своей задачи мне было необходимо менять порты в Alfresco,а не в Liferay.


Настройка.

Для того, чтобы alfresco смогла увидеть пользователей из Liferay, в файл C:\Alfresco\tomcat\shared\classes\alfresco-global.properties нужно добавить следующие строки:



### Enable external authentication

authentication.chain=alfrescoNtlm1:alfrescoNtlm,external1:external
external.authentication.proxyUserName=


Так выглядит мой файл alfresco-global.properties :


###############################
## Common Alfresco Properties #
###############################

### Enable external authentication
authentication.chain=alfrescoNtlm1:alfrescoNtlm,external1:external
external.authentication.proxyUserName=


dir.root=C:/Alfresco/alf_data


alfresco.context=alfresco
alfresco.host=127.0.0.1
alfresco.port=8081
alfresco.protocol=http

share.context=share
share.host=127.0.0.1
share.port=8081
share.protocol=http

### database connection properties ###
db.driver=org.postgresql.Driver
db.username=alfresco
db.password=12345
db.name=alfresco
db.url=jdbc:postgresql://localhost:5432/${db.name}

### FTP Server Configuration ###
ftp.enabled=true
ftp.port=21
ftp.ipv6.enabled=false

### RMI service ports ###
alfresco.rmi.services.port=50500
avm.rmi.service.port=0
avmsync.rmi.service.port=0
attribute.rmi.service.port=0
authentication.rmi.service.port=0
repo.rmi.service.port=0
action.rmi.service.port=0
deployment.rmi.service.port=0

### External executable locations ###
ooo.exe=C:/Alfresco/openoffice/App/openoffice/program/soffice.exe
ooo.enabled=true
ooo.port=8100
ooo.port=8100
img.root=C:/Alfresco/imagemagick
img.dyn=${img.root}/lib
img.exe=${img.root}/convert
swf.exe=C:/Alfresco/swftools/pdf2swf.exe
jodconverter.enabled=false 
jodconverter.officeHome=C:/Alfresco/openoffice/App/openoffice 
jodconverter.portNumbers=8100 

### Initial admin password ###
alfresco_user_store.adminpassword=9a27e562f08a874ac72987a0ec740be0

### E-mail site invitation setting ###
notification.email.siteinvite=false

### File Protocol Root ###
protocols.rootPath=/${spaces.company_home.childname}/${spaces.sites.childname}

### License location ###
dir.license.external=C:/Alfresco

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port=8443

### BPM Engine ###
system.workflow.engine.jbpm.enabled=false


Далее изменим файл C:\Alfresco\tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml, мой файл выглядит так :



<alfresco-config>

   <!-- Overriding endpoints to reference a remote Alfresco server -->
   <config evaluator="string-compare" condition="Remote">
      <remote>
         <endpoint>
            <id>alfresco-noauth</id>
            <name>Alfresco - unauthenticated access</name>
            <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8081/alfresco/s</endpoint-url>
            <identity>none</identity>
         </endpoint>

         <endpoint>
            <id>alfresco-feed</id>
            <name>Alfresco Feed</name>
            <description>Alfresco Feed - supports basic HTTP authentication</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://localhost:8081/alfresco/s</endpoint-url>
            <basic-auth>true</basic-auth>
            <identity>user</identity>
         </endpoint>

         <connector>
            <id>alfrescoCookie</id>
            <name>Alfresco Connector</name>
            <description>Connects to an Alfresco instance using cookie-based authentication</description>
     <class>org.springframework.extensions.webscripts.connector.AlfrescoConnector</class>
         </connector>

         <endpoint>
            <id>alfresco</id>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>
            <connector-id>alfrescoCookie</connector-id>
            <endpoint-url>http://localhost:8081/alfresco/wcs</endpoint-url>
            <identity>user</identity>
            <external-auth>true</external-auth>

         </endpoint>

      </remote>

   </config>

</alfresco-config>


Теперь, как сказано в инструкции, необходимо скопировать папку shared из C:\Alfresco\tomcat\ в C:\liferay-portal-6.0.6\tomcat-6.0.29
Далее правим файл C:\liferay-portal-6.0.6\tomcat-6.0.29\conf\catalina.properties


В этом файле нас интересует параметр shared.loader
В нашем случае ему нужно присвоить значение :

${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar



В итоге мой файл выглядит вот так:



# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License.  You may obtain a copy of the License at

#

#     http://www.apache.org/licenses/LICENSE-2.0

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageDefinition unless the
# corresponding RuntimePermission ("defineClassInPackage."+package) has
# been granted.
#
# by default, no packages are restricted for definition, and none of
# the class loaders supplied with the JDK call checkPackageDefinition.
#
package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.
#
#
# List of comma-separated paths defining the contents of the "common" 
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common" 
# loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class 
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext/*.jar
#
# List of comma-separated paths defining the contents of the "server" 
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank, the "common" loader will be used as Catalina's "server" 
# loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class 
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
server.loader=
#
# List of comma-separated paths defining the contents of the "shared" 
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class 
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository 
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

#
# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000


Деплоим Alfresco портлеты.
Копируем файл C:\Alfresco\tomcat\ webapps\share.war в C:\liferay-portal-6.0.6\deploy

Теперь запускаем Alfresco и Liferay, добавляем портлет на отдельную страницу.


Каждый портлет Alfresco должен быть на отдельной странице.


Пользователи.


При созании пользователя в Liferay он автоматически создастся в Alfresco, при заходе пользователей которые уже были в портале на страницу с портлетом, эти пользователи также будут автоматически создаватся в Alfresco.












Комментариев нет:

Отправить комментарий