diff --git a/ccm-core/src/com/arsdigita/web/BaseApplicationServlet.java b/ccm-core/src/com/arsdigita/web/BaseApplicationServlet.java index 8ed6dc3ab..050e7b44b 100755 --- a/ccm-core/src/com/arsdigita/web/BaseApplicationServlet.java +++ b/ccm-core/src/com/arsdigita/web/BaseApplicationServlet.java @@ -49,6 +49,14 @@ import org.apache.log4j.Logger; * {@link #doService(HttpServletRequest,HttpServletResponse,Application)} to * perform application-private dispatch to UI code.

* + *

+ * The application will be available at the path + * www.example.org/ccm/applicationname, where + * applicationname is + * the name defined for the application and www.example.org the + * URL of the server. + *

+ * * @see com.arsdigita.web.BaseServlet * @see com.arsdigita.web.DispatcherServlet * @see com.arsdigita.web.RedirectSignal @@ -65,7 +73,10 @@ public abstract class BaseApplicationServlet extends BaseServlet { *

The ID of the application whose service is requested. This * request attribute must be set by a previous servlet or filter * before this servlet can proceed. In CCM, the default servlet, - * DispatcherServlet, sets this attribute.

+ * {@link DispatcherServlet}, sets this attribute using the + * {@link BaseDispatcher}. Important: This does only work + * if the application is called using an URL like + * http://www.example.org/ccm/application!

*/ public static final String APPLICATION_ID_ATTRIBUTE = BaseApplicationServlet.class.getName() + ".application_id"; diff --git a/ccm-core/src/com/arsdigita/web/BaseServlet.java b/ccm-core/src/com/arsdigita/web/BaseServlet.java index e131dc5b4..1528b5cc7 100755 --- a/ccm-core/src/com/arsdigita/web/BaseServlet.java +++ b/ccm-core/src/com/arsdigita/web/BaseServlet.java @@ -47,7 +47,7 @@ import org.apache.log4j.Logger; * Subject zu change! * * Note: Database initialization (Startup() ) has been moved to - * CCMAplicationContextListener). + * CCMApplicationContextListener). * *

Users of this class may implement {@link * #doService(HttpServletRequest,HttpServletResponse)} to service a diff --git a/ccm-sci-publications/pdl/com/arsdigita/scipublications/PublicationExporter.pdl b/ccm-sci-publications/pdl/com/arsdigita/scipublications/PublicationExporter.pdl new file mode 100644 index 000000000..fcc32f516 --- /dev/null +++ b/ccm-sci-publications/pdl/com/arsdigita/scipublications/PublicationExporter.pdl @@ -0,0 +1,28 @@ +// +// Copyright (C) 2011 Jens Pelzetter, for the Center of Social Politics (ZeS) of +// the University of Bremen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// + + +model com.arsdigita.cms.scipublications; + +import com.arsdigita.web.Application; + +object type PublicationExporter extends Application { + reference key (publication_exporter.application_id); +} diff --git a/ccm-sci-publications/src/ccm-sci-publications.load b/ccm-sci-publications/src/ccm-sci-publications.load index 856ff9533..f61d25620 100644 --- a/ccm-sci-publications/src/ccm-sci-publications.load +++ b/ccm-sci-publications/src/ccm-sci-publications.load @@ -42,6 +42,7 @@ + @@ -63,5 +64,6 @@ + diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporter.java new file mode 100644 index 000000000..51b416b21 --- /dev/null +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporter.java @@ -0,0 +1,34 @@ +package com.arsdigita.cms.scipublications; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.web.Application; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + */ +public class PublicationExporter extends Application { + + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.scipublications.PublicationExporter"; + + public PublicationExporter(DataObject dobj) { + super(dobj); + } + + public PublicationExporter(OID oid) throws DataObjectNotFoundException{ + super(oid); + } + + public PublicationExporter(BigDecimal key) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, key)); + } + + @Override + public String getServletPath() { + return "/scipublicationsexporter/"; + } + +} diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterInitializer.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterInitializer.java new file mode 100644 index 000000000..71d1965ad --- /dev/null +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterInitializer.java @@ -0,0 +1,33 @@ +package com.arsdigita.cms.scipublications; + +import com.arsdigita.db.DbHelper; +import com.arsdigita.persistence.pdl.ManifestSource; +import com.arsdigita.persistence.pdl.NameFilter; +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.DomainInitEvent; +import com.arsdigita.runtime.PDLInitializer; +import com.arsdigita.runtime.RuntimeConfig; + +/** + * + * @author Jens Pelzetter + */ +public class PublicationExporterInitializer extends CompoundInitializer { + + public PublicationExporterInitializer() { + final String url = RuntimeConfig.getConfig().getJDBCURL(); + final int database = DbHelper.getDatabaseFromURL(url); + + add(new PDLInitializer(new ManifestSource("empty.pdl.mf", + new NameFilter((DbHelper. + getDatabaseSuffix( + database)), + "pdl")))); + + } + + @Override + public void init(DomainInitEvent e) { + super.init(e); + } +} diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterLoader.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterLoader.java new file mode 100644 index 000000000..1d9f70c5d --- /dev/null +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterLoader.java @@ -0,0 +1,64 @@ +package com.arsdigita.cms.scipublications; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; +import com.arsdigita.loader.PackageLoader; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.runtime.ScriptContext; +import com.arsdigita.web.Application; +import com.arsdigita.web.ApplicationSetup; +import com.arsdigita.web.ApplicationType; +import org.apache.log4j.Logger; + +/** + * + * @author Jens Pelzetter + */ +public class PublicationExporterLoader extends PackageLoader { + + private static final Logger logger = Logger.getLogger( + PublicationExporterLoader.class); + + @Override + public void run(final ScriptContext ctx) { + + new KernelExcursion() { + + @Override + protected void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + + ApplicationSetup setup = new ApplicationSetup(logger); + + setup.setApplicationObjectType( + PublicationExporter.BASE_DATA_OBJECT_TYPE); + setup.setKey("scipubliationsexporter"); + setup.setTitle("sci-publication Exporter"); + setup.setDescription( + "Exports publication data in various formats"); + //setup.setSingleton(true); + setup.setInstantiator(new ACSObjectInstantiator() { + @Override + public DomainObject doNewInstance(DataObject dataObject) { + return new PublicationExporter(dataObject); + } + }); + + ApplicationType type = setup.run(); + type.save(); + + if (!Application.isInstalled( + PublicationExporter.BASE_DATA_OBJECT_TYPE, "/scipublicationsexporter/")) { + Application app = Application.createApplication(type, + "scipublicationsexporter", + "PublicationExporter", + null); + app.save(); + } + + } + }.run(); + } +} diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterServlet.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterServlet.java new file mode 100644 index 000000000..be326529d --- /dev/null +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/PublicationExporterServlet.java @@ -0,0 +1,27 @@ +package com.arsdigita.cms.scipublications; + +import com.arsdigita.web.Application; +import com.arsdigita.web.BaseApplicationServlet; +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Jens Pelzetter + */ +public class PublicationExporterServlet extends BaseApplicationServlet { + + private static final long serialVersionUID = -632365939651657874L; + + @Override + protected void doService(HttpServletRequest request, + HttpServletResponse response, + Application app) throws ServletException, + IOException { + response.setContentType("application/text"); + response.setHeader("Content-Disposition", "attachment; filename=ccm-publication-exporter.txt"); + response.getWriter().append("This is the sci-publication-exporter"); + } +} diff --git a/ccm-sci-publications/web/WEB-INF/web.scipublications.xml b/ccm-sci-publications/web/WEB-INF/web.scipublications.xml new file mode 100644 index 000000000..4d7927547 --- /dev/null +++ b/ccm-sci-publications/web/WEB-INF/web.scipublications.xml @@ -0,0 +1,18 @@ + + + + + + + + PublicationExporter + com.arsdigita.cms.scipublications.PublicationExporterServlet + + + + PublicationExporter + /scipublicationsexporter/* + + + \ No newline at end of file diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java index 19e410963..c1286c565 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java @@ -125,7 +125,7 @@ public class SciProjectPropertyForm @Override public String getTitleLabel() { - return (String) PublicationGlobalizationUtil.globalize( + return (String) SciOrganizationGlobalizationUtil.globalize( "sciorganizations.ui.project.title").localize(); } }