As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Io estenderei una classe esistente di Alfresco, e farei l'override dello spring context referenziando la classe estesa.Senza cambiare il file di Spring di Alfresco, ma creandone uno che fa l'override di quello esistente.Questo tipicamente è il modo più pulito di lavorare con Spring.Hope this helps.
Devi installare nel tuo IDE l'Alfresco SDK ed associare tutti i sorgenti alle relative librerie
Poi devi creare una classe java che estende l'opportuna classe dichiarata nello Spring context di Mozilla Rhino
/* * 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.alfresco.util; import java.io.IOException; import java.io.InputStream; import java.io.Reader; /** * Content * * @author dcaruana */ public interface Content { /** * Gets content as a string * * @return content as a string * @throws IOException */ public String getContent() throws IOException; /** * Gets the content mimetype * * @return mimetype */ public String getMimetype(); /** * Gets the content encoding * * @return encoding */ public String getEncoding(); /** * Gets the content length (in bytes) * * @return length */ public long getSize(); /** * Gets the content input stream * * @return input stream */ public InputStream getInputStream(); /** * Gets the content reader (which is sensitive to encoding) * * @return */ public Reader getReader() throws IOException; }
public InputStream getElementsByName();
Infine devi dichiarare il nuovo Spring context da dichiarare dentro il classloader condiviso dell'application server per fare l'overriding dei bean coinvolti.
<bean id="nomeclasse" parent="baseJavaScriptExtension" class=" qualcosa "> <property name="extensionName"> <value>oggetto</value> </property> </bean>
ho installato nell'IDE (eclipse) la SDK ed ho importato tutte le librerie (tranne la remote-api-doc che non c'è nel mio sdke la web-client-doc in cui mancano dei files); fin quì tutto (quasi) OK.
<bean id="nomeclasse" parent="baseJavaScriptExtension" class=" qualcosa "> <property name="extensionName"> <value>oggetto</value> </property></bean>
Esatto. Poiché hai importato i sorgenti di Alfresco, avrai anche disponibili le classi dichiarate nello spring context dedicate a Rhino.HTH.
/* * @Author: Valerio */ package org.alfresco.util; import java.io.IOException; import java.io.InputStream; import java.io.Reader; /** * Content * * @author valerio */ public interface Contenuto { /** * Gets content as a string * * @return content as a string * @throws IOException */ public String getContent() throws IOException; /** * Gets the content mimetype * * @return mimetype */ public String getMimetype(); /** * Gets the element specified * * @return element */ public String getElementsByName(); /** * Gets the content encoding * * @return encoding */ public String getEncoding(); /** * Gets the content length (in bytes) * * @return length */ public long getSize(); /** * Gets the content input stream * * @return input stream */ public InputStream getInputStream(); /** * Gets the content reader (which is sensitive to encoding) * * @return */ public Reader getReader() throws IOException; }
//file: contenuto.java package org.alfresco.util; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.lang.Object; import java.lang.String; public abstract interface contenuto { //method public abstract String getContent() throws IOException; public abstract String getMimetype(); public abstract String getElementsByName(); public abstract String getEncoding(); public abstract long getSize(); public abstract InputStream getInputStream(); public abstract Reader getReader() throws IOException; }
<bean id="Contenuto" parent="baseJavaScriptExtension" class="?????"> <property name="extensionName"> <value>cont</value> <!–così facendo dovrei poter utilizzare il metodo document.cont.getElementsByName(nomedell'elemento)–> </property> </bean>