- 浏览: 43880 次
- 性别:
- 来自: 上海
-
文章分类
最新评论
-
sgelove:
忘了说明了,实例变量只能定义在实例方法内部。
在ruby里所有的东西都是实例, 包括类 -
sgelove:
class T1
@v1 = "#{self. ...
在ruby里所有的东西都是实例, 包括类 -
易卡螺丝君:
2.3.5已经fix了
让 ruby 1.9.1 + rails 2.3.3 + mysql 完美工作 -
arkxu:
k_cancer 写道e:/ruby/lib/ruby/sit ...
rails 升级到2.2你可能会遇到的问题及解决方法 -
k_cancer:
e:/ruby/lib/ruby/site_ruby/1.8/ ...
rails 升级到2.2你可能会遇到的问题及解决方法
CAS 和Liferay的整合网上到处都有,我在此也不再鳌述。CAS和Alfresco的整合推荐一篇blog,你看了之后也就知道怎么做了:
http://athenalogics.blogspot.com/2008/07/how-to-casify-alfresco-cms_567.html
本文所要讲的是在CAS和Liferay已经整合好的前提下, 把Alfresco部署成Liferay的portlet并且和CAS整合。
我试了网上有一些别的方法无一成功,也有人说存在bug无法整合。至少根据我前面的blog讲share liferay session的方法给alfresco portlet是不可行的。alfresco的用户认证这里确实有bug。
当然,首先你需要把Alfresco部署成portlet,我这里用到的是Alfresco community version 2.1, Liferay 5.1.0
部署Liferay portlet 通常的做法是 Hotdeploy. 也就是把alfresco.war放到$user_home/liferay/deploy
之后会在Webapp下面产生一个新的alfresco的app, 到它的lib下面把portlet-api删掉,因为这个和liferay的相冲突。然再把附件中的liferay portlet描述文件copy到alfresco/WEB-INF下面. 注意,附件里的web.xml中用到的portlet-class是我自己修改过的。
这样你的alfresco就可以被添加到liferay里面了.
当然,如果你不想使用hotdeploy(通常写自动产生server的script的人最讨厌这个), 那么可以参考这个script的相应部分: http://tempo.intalio.org/tempo/trunk/rsc/scripts/create_tomcat.rb
接下来,Alfresco portlet的用户管理的基本思路是在PortletSession里是否存在'AuthenticationHelper.AUTHENTICATION_USER'这个属性,如果存在的话就取出里面的User去做验证。通过的话就可以访问。基于这个原理,我在原有的portlet-class上做了一些改动,下面的portlet class的全文:
从上面的代码可以看出,拿去认证的用户是从Liferay的Session里拿到的当前登陆的用户,我们认为这个用户如果在alfresco里存在的话,那么也是可以访问alfresco的。这里我并没有完全整合用户认证,而是做了一个各个系统之间用户的对应关系。比如CAS的用户名和Liferay的Screen Name必须是一样的。那么从上面的代码中我们可以看到Liferay的用户的First Name必须和Alfresco的用户名一样。
更完善的三者整合是在这里: http://liferay.cignex.com/ 当然他们的方法就是中央管理了用户(LDAP)而不需要user mapping了
接下来,你只要在你的mysql里面创建一个名为alfresco的数据库,然后创建相应的用户。再start server就好了。
所有的portlet描述文件和这个portlet-class都在附件的包里. enjoy~
http://athenalogics.blogspot.com/2008/07/how-to-casify-alfresco-cms_567.html
本文所要讲的是在CAS和Liferay已经整合好的前提下, 把Alfresco部署成Liferay的portlet并且和CAS整合。
我试了网上有一些别的方法无一成功,也有人说存在bug无法整合。至少根据我前面的blog讲share liferay session的方法给alfresco portlet是不可行的。alfresco的用户认证这里确实有bug。
当然,首先你需要把Alfresco部署成portlet,我这里用到的是Alfresco community version 2.1, Liferay 5.1.0
部署Liferay portlet 通常的做法是 Hotdeploy. 也就是把alfresco.war放到$user_home/liferay/deploy
之后会在Webapp下面产生一个新的alfresco的app, 到它的lib下面把portlet-api删掉,因为这个和liferay的相冲突。然再把附件中的liferay portlet描述文件copy到alfresco/WEB-INF下面. 注意,附件里的web.xml中用到的portlet-class是我自己修改过的。
这样你的alfresco就可以被添加到liferay里面了.
当然,如果你不想使用hotdeploy(通常写自动产生server的script的人最讨厌这个), 那么可以参考这个script的相应部分: http://tempo.intalio.org/tempo/trunk/rsc/scripts/create_tomcat.rb
接下来,Alfresco portlet的用户管理的基本思路是在PortletSession里是否存在'AuthenticationHelper.AUTHENTICATION_USER'这个属性,如果存在的话就取出里面的User去做验证。通过的话就可以访问。基于这个原理,我在原有的portlet-class上做了一些改动,下面的portlet class的全文:
/* * Copyright (C) 2005-2007 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * As a special exception to the terms and conditions of version 2.0 of * the GPL, you may redistribute this Program in connection with Free/Libre * and Open Source Software ("FLOSS") applications as described in Alfresco's * FLOSS exception. You should have recieved a copy of the text describing * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ package org.intalio.tempo.web; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.util.Iterator; import java.util.List; import javax.faces.application.ViewHandler; import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletException; import javax.portlet.PortletRequest; import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletSession; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.UnavailableException; import javax.servlet.http.HttpServletRequest; import javax.transaction.UserTransaction; import org.alfresco.config.ConfigService; import org.alfresco.i18n.I18NUtil; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.security.AuthenticationService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.TempFileProvider; import org.alfresco.web.app.Application; import org.alfresco.web.app.portlet.AlfrescoDefaultViewSelector; import org.alfresco.web.app.servlet.AuthenticationHelper; import org.alfresco.web.app.servlet.AuthenticationStatus; import org.alfresco.web.bean.ErrorBean; import org.alfresco.web.bean.FileUploadBean; import org.alfresco.web.bean.LoginBean; import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.User; import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.LanguagesConfigElement; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.portlet.PortletFileUpload; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.myfaces.portlet.MyFacesGenericPortlet; import org.apache.myfaces.portlet.PortletUtil; import org.springframework.web.context.WebApplicationContext; import com.liferay.portal.service.UserServiceUtil; /** * Class to extend the MyFacesGenericPortlet to provide behaviour specific to * Alfresco web client. Handles upload of multi-part forms through a JSR-168 * Portlet, generic error handling and session login authentication. * * @author Gavin Cornwell, Kevin Roast */ public class AlfrescoFacesPortlet extends MyFacesGenericPortlet { private static final String PREF_ALF_USERNAME = "_alfUserName"; private static final String SESSION_LAST_VIEW_ID = "_alfLastViewId"; private static final String ERROR_PAGE_PARAM = "error-page"; private static final String ERROR_OCCURRED = "error-occurred"; private List<String> m_languages; private static Log logger = LogFactory.getLog(AlfrescoFacesPortlet.class); private String loginPage = null; private String errorPage = null; /** * Called by the portlet container to allow the portlet to process an action * request. */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { Application.setInPortalServer(true); // Set the current locale I18NUtil.setLocale(Application.getLanguage(request.getPortletSession())); boolean isMultipart = PortletFileUpload.isMultipartContent(request); try { // NOTE: Due to filters not being called within portlets we can not // make use // of the MyFaces file upload support, therefore we are using a pure // portlet request/action to handle file uploads until there is a // solution. if (isMultipart) { if (logger.isDebugEnabled()) logger.debug("Handling multipart request..."); PortletSession session = request.getPortletSession(); // get the file from the request and put it in the session DiskFileItemFactory factory = new DiskFileItemFactory(); PortletFileUpload upload = new PortletFileUpload(factory); List<FileItem> fileItems = upload.parseRequest(request); Iterator<FileItem> iter = fileItems.iterator(); FileUploadBean bean = new FileUploadBean(); while (iter.hasNext()) { FileItem item = iter.next(); String filename = item.getName(); if (item.isFormField() == false) { if (logger.isDebugEnabled()) logger.debug("Processing uploaded file: " + filename); // workaround a bug in IE where the full path is // returned // IE is only available for Windows so only check for // the Windows path separator int idx = filename.lastIndexOf('\\'); if (idx == -1) { // if there is no windows path separator check for // *nix idx = filename.lastIndexOf('/'); } if (idx != -1) { filename = filename.substring(idx + File.separator.length()); } File tempFile = TempFileProvider.createTempFile("alfresco", ".upload"); item.write(tempFile); bean.setFile(tempFile); bean.setFileName(filename); bean.setFilePath(tempFile.getAbsolutePath()); session.setAttribute(FileUploadBean.FILE_UPLOAD_BEAN_NAME, bean, PortletSession.PORTLET_SCOPE); } } // Set the VIEW_ID parameter to tell the faces portlet bridge to // treat the request // as a JSF request, this will send us back to the previous page // we came from. String lastViewId = (String) request.getPortletSession().getAttribute(SESSION_LAST_VIEW_ID); if (lastViewId != null) { response.setRenderParameter(VIEW_ID, lastViewId); } } else { User user = (User) request.getPortletSession().getAttribute(AuthenticationHelper.AUTHENTICATION_USER); if (user != null) { // setup the authentication context try { WebApplicationContext ctx = (WebApplicationContext) getPortletContext().getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); AuthenticationService auth = (AuthenticationService) ctx.getBean("AuthenticationService"); auth.validate(user.getTicket()); // save last username into portlet preferences, get from // LoginBean state LoginBean loginBean = (LoginBean) request.getPortletSession().getAttribute(AuthenticationHelper.LOGIN_BEAN); if (loginBean != null) { // TODO: Need to login to the Portal to get a user // here to store prefs against // so not really a suitable solution as they get // thrown away at present! // Also would need to store prefs PER user - so auto // login for each...? String oldValue = request.getPreferences().getValue(PREF_ALF_USERNAME, null); if (oldValue == null || oldValue.equals(loginBean.getUsernameInternal()) == false) { if (request.getPreferences().isReadOnly(PREF_ALF_USERNAME) == false) { request.getPreferences().setValue(PREF_ALF_USERNAME, loginBean.getUsernameInternal()); request.getPreferences().store(); } } } // do the normal JSF processing super.processAction(request, response); } catch (AuthenticationException authErr) { // remove User object as it's now useless request.getPortletSession().removeAttribute(AuthenticationHelper.AUTHENTICATION_USER); } } else { // do the normal JSF processing as we may be on the login // page super.processAction(request, response); } } } catch (Throwable e) { if (getErrorPage() != null) { handleError(request, response, e); } else { logger.warn("No error page configured, re-throwing exception"); if (e instanceof PortletException) { throw (PortletException) e; } else if (e instanceof IOException) { throw (IOException) e; } else { throw new PortletException(e); } } } } /** * @see org.apache.myfaces.portlet.MyFacesGenericPortlet#facesRender(javax.portlet.RenderRequest, * javax.portlet.RenderResponse) */ protected void facesRender(RenderRequest request, RenderResponse response) throws PortletException, IOException { try { User user = (User) request.getPortletSession().getAttribute(AuthenticationHelper.AUTHENTICATION_USER); if (user == null) { Method getHttpServletRequest = request.getClass().getMethod("getHttpServletRequest"); HttpServletRequest hsr = (HttpServletRequest) getHttpServletRequest.invoke(request); Long userID = (Long) hsr.getSession().getAttribute("USER_ID"); com.liferay.portal.model.User liferayUser = UserServiceUtil.getUserById(userID); String userName = liferayUser.getScreenName(); logger.debug("user name for alfresco is:" + userName); getPortletContext().removeAttribute("loggedin"); setAuthenticatedUser(request, userName); } } catch (Throwable e) { // do nothing } Application.setInPortalServer(true); // Set the current locale I18NUtil.setLocale(Application.getLanguage(request.getPortletSession())); if (request.getParameter(ERROR_OCCURRED) != null) { String errorPage = Application.getErrorPage(getPortletContext()); if (logger.isDebugEnabled()) logger.debug("An error has occurred, redirecting to error page: " + errorPage); response.setContentType("text/html"); PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(errorPage); dispatcher.include(request, response); } else { WebApplicationContext ctx = (WebApplicationContext) getPortletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); AuthenticationService auth = (AuthenticationService) ctx.getBean("AuthenticationService"); // if we have no User object in the session then an HTTP Session // timeout must have occured // use the viewId to check that we are not already on the login page PortletSession session = request.getPortletSession(); String viewId = request.getParameter(VIEW_ID); // keep track of last view id so we can use it as return page from // multi-part requests request.getPortletSession().setAttribute(SESSION_LAST_VIEW_ID, viewId); User user = (User) request.getPortletSession().getAttribute(AuthenticationHelper.AUTHENTICATION_USER); if (user == null && (viewId == null || viewId.equals(getLoginPage()) == false)) { if (AuthenticationHelper.portalGuestAuthenticate(ctx, session, auth) == AuthenticationStatus.Guest) { if (logger.isDebugEnabled()) logger.debug("Guest access successful."); // perform the forward to the page processed by the Faces // servlet response.setContentType("text/html"); request.getPortletSession().setAttribute(PortletUtil.PORTLET_REQUEST_FLAG, "true"); // get the start location as configured by the web-client // config ConfigService configService = (ConfigService) ctx.getBean("webClientConfigService"); ClientConfigElement configElement = (ClientConfigElement) configService.getGlobalConfig().getConfigElement("client"); if (NavigationBean.LOCATION_MYALFRESCO.equals(configElement.getInitialLocation())) { nonFacesRequest(request, response, "/jsp/dashboards/container.jsp"); } else { nonFacesRequest(request, response, "/jsp/browse/browse.jsp"); } } else { if (logger.isDebugEnabled()) logger.debug("No valid User login, requesting login page. ViewId: " + viewId); // set last used username as special session value used by // the LoginBean session.setAttribute(AuthenticationHelper.SESSION_USERNAME, request.getPreferences().getValue(PREF_ALF_USERNAME, null)); // login page is the default portal page response.setContentType("text/html"); request.getPortletSession().setAttribute(PortletUtil.PORTLET_REQUEST_FLAG, "true"); nonFacesRequest(request, response); } } else { if (session.getAttribute(AuthenticationHelper.SESSION_INVALIDATED) != null) { // remove the username preference value as explicit logout // was requested by the user if (request.getPreferences().isReadOnly(PREF_ALF_USERNAME) == false) { request.getPreferences().reset(PREF_ALF_USERNAME); } session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED); } try { if (user != null) { if (logger.isDebugEnabled()) logger.debug("Validating ticket: " + user.getTicket()); // setup the authentication context auth.validate(user.getTicket()); } // do the normal JSF processing String loggedin = (String) getPortletContext().getAttribute("loggedin"); logger.debug("logged in?:" + loggedin); if (loggedin != null && loggedin.equalsIgnoreCase("true")) { super.facesRender(request, response); } else { getPortletContext().setAttribute("loggedin", "true"); response.setContentType("text/html"); request.getPortletSession().setAttribute(PortletUtil.PORTLET_REQUEST_FLAG, "true"); nonFacesRequest(request, response, "/jsp/browse/browse.jsp"); } } catch (AuthenticationException authErr) { // ticket is no longer valid! if (logger.isDebugEnabled()) logger.debug("Invalid ticket, requesting login page."); // remove User object as it's now useless request.getPortletSession().removeAttribute(AuthenticationHelper.AUTHENTICATION_USER); // login page is the default portal page response.setContentType("text/html"); request.getPortletSession().setAttribute(PortletUtil.PORTLET_REQUEST_FLAG, "true"); nonFacesRequest(request, response); } catch (Throwable e) { if (getErrorPage() != null) { handleError(request, response, e); } else { logger.warn("No error page configured, re-throwing exception"); if (e instanceof PortletException) { throw (PortletException) e; } else if (e instanceof IOException) { throw (IOException) e; } else { throw new PortletException(e); } } } } } } /** * Handles errors that occur during a process action request */ private void handleError(ActionRequest request, ActionResponse response, Throwable error) throws PortletException, IOException { // get the error bean from the session and set the error that occurred. PortletSession session = request.getPortletSession(); ErrorBean errorBean = (ErrorBean) session.getAttribute(ErrorBean.ERROR_BEAN_NAME, PortletSession.PORTLET_SCOPE); if (errorBean == null) { errorBean = new ErrorBean(); session.setAttribute(ErrorBean.ERROR_BEAN_NAME, errorBean, PortletSession.PORTLET_SCOPE); } errorBean.setLastError(error); response.setRenderParameter(ERROR_OCCURRED, "true"); } /** * Handles errors that occur during a render request */ private void handleError(RenderRequest request, RenderResponse response, Throwable error) throws PortletException, IOException { // get the error bean from the session and set the error that occurred. PortletSession session = request.getPortletSession(); ErrorBean errorBean = (ErrorBean) session.getAttribute(ErrorBean.ERROR_BEAN_NAME, PortletSession.PORTLET_SCOPE); if (errorBean == null) { errorBean = new ErrorBean(); session.setAttribute(ErrorBean.ERROR_BEAN_NAME, errorBean, PortletSession.PORTLET_SCOPE); } errorBean.setLastError(error); // if the faces context is available set the current view to the browse // page // so that the error page goes back to the application (rather than // going back // to the same page which just throws the error again meaning we can // never leave // the error page) FacesContext context = FacesContext.getCurrentInstance(); if (context != null) { ViewHandler viewHandler = context.getApplication().getViewHandler(); // TODO: configure the portlet error return page UIViewRoot view = viewHandler.createView(context, "/jsp/browse/browse.jsp"); context.setViewRoot(view); } // get the error page and include that instead String errorPage = getErrorPage(); if (logger.isDebugEnabled()) logger.debug("An error has occurred, redirecting to error page: " + errorPage); response.setContentType("text/html"); PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(errorPage); dispatcher.include(request, response); } /** * @see org.apache.myfaces.portlet.MyFacesGenericPortlet#setDefaultViewSelector() */ protected void setDefaultViewSelector() throws UnavailableException { super.setDefaultViewSelector(); if (this.defaultViewSelector == null) { this.defaultViewSelector = new AlfrescoDefaultViewSelector(); } } /** * @return Retrieves the configured login page */ private String getLoginPage() { if (this.loginPage == null) { this.loginPage = Application.getLoginPage(getPortletContext()); } return this.loginPage; } /** * @return Retrieves the configured error page */ private String getErrorPage() { if (this.errorPage == null) { this.errorPage = Application.getErrorPage(getPortletContext()); } return this.errorPage; } private void setAuthenticatedUser(PortletRequest req, String userName) { WebApplicationContext ctx = (WebApplicationContext) getPortletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); TransactionService transactionService = serviceRegistry.getTransactionService(); NodeService nodeService = serviceRegistry.getNodeService(); AuthenticationComponent authComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); AuthenticationService authService = (AuthenticationService) ctx.getBean("authenticationService"); PersonService personService = (PersonService) ctx.getBean("personService"); // Get a list of the available locales ConfigService configServiceService = (ConfigService) ctx.getBean("webClientConfigService"); LanguagesConfigElement configElement = (LanguagesConfigElement) configServiceService.getConfig("Languages").getConfigElement( LanguagesConfigElement.CONFIG_ELEMENT_ID); m_languages = configElement.getLanguages(); // Set up the user information UserTransaction tx = transactionService.getUserTransaction(); NodeRef homeSpaceRef = null; User user; try { tx.begin(); // Set the authentication authComponent.setCurrentUser(userName); user = new User(userName, authService.getCurrentTicket(), personService.getPerson(userName)); homeSpaceRef = (NodeRef) nodeService.getProperty(personService.getPerson(userName), ContentModel.PROP_HOMEFOLDER); if (homeSpaceRef == null) { logger.warn("Home Folder is null for user '" + userName + "', using company_home."); homeSpaceRef = (NodeRef) nodeService.getRootNode(Repository.getStoreRef()); } user.setHomeSpaceId(homeSpaceRef.getId()); tx.commit(); } catch (Throwable ex) { logger.error(ex); try { tx.rollback(); } catch (Exception ex2) { logger.error("Failed to rollback transaction", ex2); } if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } else { throw new RuntimeException("Failed to set authenticated user", ex); } } // Store the user req.getPortletSession().setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user); req.getPortletSession().setAttribute(LoginBean.LOGIN_EXTERNAL_AUTH, Boolean.TRUE); logger.debug("...authenticated user is: " + user.getUserName() + user.getTicket()); } }
从上面的代码可以看出,拿去认证的用户是从Liferay的Session里拿到的当前登陆的用户,我们认为这个用户如果在alfresco里存在的话,那么也是可以访问alfresco的。这里我并没有完全整合用户认证,而是做了一个各个系统之间用户的对应关系。比如CAS的用户名和Liferay的Screen Name必须是一样的。那么从上面的代码中我们可以看到Liferay的用户的First Name必须和Alfresco的用户名一样。
更完善的三者整合是在这里: http://liferay.cignex.com/ 当然他们的方法就是中央管理了用户(LDAP)而不需要user mapping了
接下来,你只要在你的mysql里面创建一个名为alfresco的数据库,然后创建相应的用户。再start server就好了。
create database alfresco; grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option; grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;
所有的portlet描述文件和这个portlet-class都在附件的包里. enjoy~
- alfresco.zip (30.4 KB)
- 下载次数: 31
评论
1 楼
arkxu
2008-09-22
我已经完全正和了Alfreso 3.0 beta, Lifera 5.1.1和ApacheDS 1.4.x.
commit到branch/5.3,具体请见:
http://tempo.intalio.org/tempo/branches/5.3/rsc/alfresco/
commit到branch/5.3,具体请见:
http://tempo.intalio.org/tempo/branches/5.3/rsc/alfresco/
相关推荐
- **Alfresco**:一种企业级文档管理和协作平台的集成方案。 - **Multiple Portal Instances**:在单一服务器上部署多个Liferay实例,满足不同部门或项目的独立运营需求。 ### 结论 Liferay Portal 4.2的安装过程...
软件工程第三章实验报告.docx
第三章-第八节通信礼仪.ppt
智能家居股份合作协议.docx
内容概要:本文详细介绍了基于西门子S7-1200 PLC的双轴定位控制系统在电池焊接项目中的应用。主要内容涵盖双轴定位算法的设计与实现,包括使用SCL语言编写的运动控制函数块,以及梯形图用于处理IO互锁和焊接时序控制。文中还讨论了威纶通触摸屏的界面设计,如动态元素映射、宏指令的应用,以及电气图纸的安全回路设计。此外,文章分享了多个调试技巧和注意事项,如加速度参数设置、伺服驱动器订货号核对、BOM清单管理等。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是熟悉PLC编程和触摸屏界面设计的专业人士。 使用场景及目标:适用于需要深入了解PLC编程、运动控制算法、触摸屏界面设计及电气图纸绘制的工程项目。目标是提高双轴定位控制系统的精度和稳定性,确保电池焊接的质量和安全性。 其他说明:文中提供了完整的工程文件包下载链接,并强调了在实际应用中需要注意的具体事项,如硬件配置检查、参数调整等。
内容概要:本文详细介绍了如何利用Simulink和Carsim进行联合仿真,实现基于PID(比例-积分-微分)和MPC(模型预测控制)的自适应巡航控制系统。首先阐述了Carsim参数设置的关键步骤,特别是cpar文件的配置,包括车辆基本参数、悬架系统参数和转向系统参数的设定。接着展示了Matlab S函数的编写方法,分别针对PID控制和MPC控制提供了详细的代码示例。随后讨论了Simulink中车辆动力学模型的搭建,强调了模块间的正确连接和参数设置的重要性。最后探讨了远程指导的方式,帮助解决仿真过程中可能出现的问题。 适合人群:从事汽车自动驾驶领域的研究人员和技术人员,尤其是对Simulink和Carsim有一定了解并希望深入学习联合仿真的从业者。 使用场景及目标:适用于需要验证和优化自适应巡航控制、定速巡航及紧急避撞等功能的研究和开发项目。目标是提高车辆行驶的安全性和舒适性,确保控制算法的有效性和可靠性。 其他说明:文中不仅提供了理论知识,还有大量实用的代码示例和避坑指南,有助于读者快速上手并应用于实际工作中。此外,还提到了远程调试技巧,进一步提升了仿真的成功率。
内容概要:本文深入探讨了利用MATLAB/Simulink搭建变压器励磁涌流仿真模型的方法和技术。首先介绍了空载合闸励磁涌流仿真模型的搭建步骤,包括选择和配置电源模块、变压器模块以及设置相关参数。文中详细讲解了如何通过代码生成交流电压信号和设置变压器的变比,同时强调了铁芯饱和特性和合闸角控制的重要性。此外,还讨论了电源简化模型的应用及其优势,如使用受控电压源替代复杂电源模块。为了更好地理解和分析仿真结果,文章提供了绘制励磁涌流曲线的具体方法,并展示了如何提取和分析涌流特征量,如谐波含量和谐波畸变率。最后,文章指出通过调整电源和变压器参数,可以实现针对不同应用场景的定制化仿真,从而为实际工程应用提供理论支持和技术指导。 适合人群:从事电力系统研究、变压器设计及相关领域的科研人员、工程师和技术爱好者。 使用场景及目标:适用于希望深入了解变压器励磁涌流特性的研究人员,旨在帮助他们掌握MATLAB/Simulink仿真工具的使用技巧,提高对励磁涌流现象的理解和预测能力,进而优化继电保护系统的设计。 其他说明:文中不仅提供了详细的建模步骤和代码示例,还分享了一些实用的经验和技巧,如考虑磁滞效应对涌流的影响、避免理想断路器带来的误差等。这些内容有助于读者在实践中获得更加准确可靠的仿真结果。
内容概要:本文详细介绍了利用三菱FX3U PLC与Factory IO通讯仿真进行PID液位调节的方法,旨在降低学习PID控制的成本和难度。文中首先指出了传统硬件学习PID控制面临的高昂成本和复杂接线问题,随后介绍了仿真程序的优势,包括PID配置参数、调节参数、自整定和手动整定的学习方法。接着阐述了所需的设备和软件环境,以及具体的代码示例和寄存器配置。最后,通过实例展示了如何通过仿真环境进行PID参数调整和测试,验证了该方案的有效性和实用性。 适合人群:初学者和有一定PLC基础的技术人员,特别是那些希望通过低成本方式学习PID控制的人群。 使用场景及目标:适用于希望在不购买昂贵硬件的情况下,快速掌握PID控制原理和技术的应用场景。目标是通过仿真环境,熟悉PID参数配置和调整,最终能够应用于实际工业控制系统中。 其他说明:本文不仅提供了理论指导,还给出了详细的实践步骤和代码示例,使读者能够在实践中更好地理解和掌握PID控制技术。同时,强调了仿真环境与实际项目的相似性,便于知识迁移。
智慧城市树木二维码智能管理系统概述.docx
内容概要:本文详细介绍了基于.NET框架和Oracle数据库构建的大型MES(制造执行系统)生产制造管理系统的源码结构及其技术特点。该系统采用了BS架构,适用于Web端和WPF客户端,涵盖了从数据库设计、业务逻辑处理到前端展示等多个方面。文中不仅提供了具体的代码示例,还深入剖析了系统的技术难点,如Oracle数据库的高效连接方式、多线程处理、实时数据推送以及高级特性(如分区表、压缩技术和批量操作)的应用。此外,作者还分享了一些关于系统部署和维护的经验。 适合人群:主要面向拥有五年以上.NET开发经验的专业人士,特别是那些对Oracle数据库有一定了解并且参与过大中型项目开发的技术人员。 使用场景及目标:①帮助开发者深入了解MES系统的工作原理和技术实现;②为现有的MES系统提供优化思路;③作为学习资料,用于掌握.NET框架与Oracle数据库的最佳实践。 其他说明:尽管缺少完整的安装说明和数据库备份文件,但凭借丰富的代码片段和技术细节,这套源码仍然是一个宝贵的学习资源。同时,文中提到的一些技术点也可以应用于其他类型的工业控制系统或企业管理信息系统。
lesson6_点阵.zip
OpenNMS 依赖组件 jicmp 的完整解析与安装指南 一、jicmp 的核心作用 ICMP 协议支持 jicmp(Java Interface for ICMP)是 OpenNMS 实现网络设备可达性检测(如 Ping)的关键组件,通过原生代码高效处理 ICMP 报文,替代纯 Java 实现的性能瓶颈17。 依赖版本要求:OpenNMS 33.1.5 需 jicmp >= 3.0.0,以支持 IPv6 及多线程优化7。 与 jicmp6 的协同 jicmp6 是 jicmp 的扩展组件,专用于 IPv6 网络环境检测,二者共同构成 OpenNMS 网络监控的底层通信基础78。 二、jicmp 安装问题的根源 仓库版本不匹配 OpenNMS 官方旧版仓库(如 opennms-repo-stable-rhel6)仅提供 jicmp-2.0.5 及更早版本,无法满足新版 OpenNMS 的依赖需求78。 典型错误:Available: jicmp-2.0.5-1.el6.i386,但 Requires: jicmp >= 3.0.07。 手动编译未注册到包管理器 手动编译的 jicmp 未生成 RPM 包,导致 yum 无法识别已安装的依赖,仍尝试从仓库拉取旧版本57。 三、解决方案:正确安装 jicmp 3.0 通过源码编译生成 RPM 包 bash Copy Code # 安装编译工具链 yum install -y rpm-build checkinstall gcc-c++ autoconf automake libtool # 编译并生成 jicmp-3.0.0 RPM wget https://sourceforge.net/projects/opennms/files/JICMP/stable-3.x/j
机械CAD零件图.ppt
内容概要:本文详细介绍了制冷站智能群控管理系统的构成及其核心技术实现。首先阐述了系统的四大组成部分:环境感知模块、数据处理模块、决策控制模块以及设备控制模块。接着通过具体的Python代码示例展示了如何利用MQTT协议进行设备间的通信,实现了温度控制等功能。此外,文中还探讨了数据处理中的噪声过滤方法、设备控制中的状态锁定机制、以及采用强化学习进行能效优化的具体案例。最后展望了未来的发展方向,如引入能量管理和AI集成等。 适合人群:从事制冷站自动化控制领域的工程师和技术人员,尤其是对智能群控管理系统感兴趣的从业者。 使用场景及目标:适用于希望提升制冷站自动化水平的企业和个人。目标在于提高系统的稳定性和效率,减少人为干预,实现节能减排。 其他说明:文章不仅提供了理论性的介绍,还有大量的实战经验和代码片段分享,有助于读者更好地理解和应用相关技术。
内容概要:本文详细介绍了将卷积神经网络(CNN)从软件到硬件的全过程部署,特别是在FPGA上的实现方法。首先,作者使用TensorFlow 2构建了一个简单的CNN模型,并通过Python代码实现了模型的训练和权值导出。接着,作者用Verilog手写了CNN加速器的硬件代码,展示了如何通过参数化配置优化加速效果。硬件部分采用了滑动窗口和流水线结构,确保高效执行卷积操作。此外,文中还讨论了硬件调试过程中遇到的问题及其解决方案,如ReLU激活函数的零值处理和权值存储顺序的对齐问题。最后,作者强调了参数化设计的重要性,使得硬件可以在速度和面积之间灵活调整。 适合人群:对深度学习和FPGA感兴趣的开发者,尤其是有一定编程基础和技术背景的研究人员。 使用场景及目标:适用于希望深入了解CNN算法硬件实现的人群,目标是掌握从软件到硬件的完整部署流程,以及如何通过FPGA加速深度学习任务。 其他说明:文中提供了详细的代码片段和调试经验,有助于读者更好地理解和实践。同时,项目代码可在GitHub上获取,方便进一步研究和改进。
内容概要:本文详细介绍了无人驾驶车辆高速MPC(模型预测控制)控制系统的复现过程,主要涉及MATLAB和CarSim软件工具的应用。作者通过调整caraim文件、构建Simulink控制逻辑以及优化MPC算法,将原有的直线跟车场景成功转换为双移线场景。文中不仅展示了具体的技术实现步骤,如路径点设置、权重矩阵调整、采样时间对齐等,还分享了调试过程中遇到的问题及其解决方案,如参数不匹配、模型不收敛等。最终实现了车辆在虚拟环境中按预定双移线轨迹行驶的目标。 适合人群:从事无人驾驶车辆研究和技术开发的专业人士,尤其是对MPC控制算法感兴趣的工程师。 使用场景及目标:适用于需要深入了解无人驾驶车辆控制系统的设计与实现的研究人员和技术开发者。目标是帮助读者掌握如何利用MATLAB和CarSim进行无人驾驶车辆的模拟实验,特别是在高速场景下的双移线控制。 其他说明:文章强调了MPC在高速场景下的挑战性和调参技巧,提供了宝贵的实践经验。同时提醒读者注意环境配置、控制器核心代码解析以及联合仿真可能出现的问题。
监控场景下基于CLIP的细粒度目标检测方法.pdf
内容概要:本文详细介绍了如何使用MATLAB进行频谱和功率谱分析,涵盖了从基础概念到高级应用的各个方面。首先,通过生成人工信号并绘制时域图,帮助读者熟悉基本操作。接着,深入探讨了频谱分析的关键步骤,如快速傅里叶变换(FFT)、窗口函数的选择、频谱横坐标的正确转换等。对于功率谱分析,则介绍了Welch法及其具体实现。针对真实数据处理,讨论了如何读取外部数据、处理非均匀采样、去除趋势项等问题,并提供了多种实用技巧,如滑动平均、自动标注主要频率成分等。此外,还强调了一些常见的错误和注意事项,确保读者能够避免常见陷阱。 适用人群:适用于具有一定MATLAB基础的科研人员、工程师和技术爱好者,特别是那些从事信号处理、通信工程、机械振动分析等领域的人士。 使用场景及目标:① 学习如何使用MATLAB进行频谱和功率谱分析;② 掌握处理实际工程中复杂信号的方法;③ 提高对信号特征的理解能力,以便更好地应用于故障诊断、质量检测等实际工作中。 其他说明:文中提供的代码片段可以直接用于实践,读者可以根据自己的需求进行适当修改。通过跟随文中的步骤,读者不仅能够学会如何绘制频谱图和功率谱图,还能深入了解背后的数学原理和技术细节。 标签1,MATLAB,频谱分析,功率谱,Welch法,FFT
内容概要:本文详细介绍了基于FAST与MATLAB/Simulink联合仿真平台,对5MW非线性风力发电机进行统一变桨(CPC)和独立变桨(IPC)控制策略的研究。首先,通过将OpenFAST编译成Simulink可调用的S-Function模块,构建了联合仿真环境。接着,分别实现了统一变桨和独立变桨的PID控制器,并在三维湍流风场中进行了性能测试。结果显示,独立变桨在转速稳定性和载荷控制方面表现出色,能够显著降低叶根挥舞弯矩和偏航力矩,从而提高风机的可靠性和使用寿命。然而,独立变桨也带来了作动器磨损增加的问题。 适合人群:从事风电控制系统设计、仿真建模以及希望深入了解变桨控制策略的研发工程师和技术研究人员。 使用场景及目标:适用于需要评估不同变桨控制策略在复杂风场条件下的性能表现,优化风机运行效率和可靠性,以及探索新的控制算法的应用场景。 其他说明:文中提供了详细的模型搭建步骤、关键代码片段和仿真结果分析,并附有相关参考文献和GitHub资源链接,方便读者进一步深入研究。