- Das SciOrganization Modul kompiliert wieder. Es wurde falschlicherweise eine Klasse aus einem Modul verwendet das keine Abhängigkeit des SciOrganization-Moduls ist.
- Rumpf für den Exporter für Publikationsdaten: Application-Klasse und Servlet und das drumherum (Inititalizer, Loader, PDL). - Kommentare in BaseApplicationServlet ergänzt. git-svn-id: https://svn.libreccm.org/ccm/trunk@728 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0f1c3750af
commit
7afcab2687
|
|
@ -49,6 +49,14 @@ import org.apache.log4j.Logger;
|
||||||
* {@link #doService(HttpServletRequest,HttpServletResponse,Application)} to
|
* {@link #doService(HttpServletRequest,HttpServletResponse,Application)} to
|
||||||
* perform application-private dispatch to UI code.</p>
|
* perform application-private dispatch to UI code.</p>
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* The application will be available at the path
|
||||||
|
* <code>www.example.org/ccm/applicationname</code>, where
|
||||||
|
* <code>applicationname</code> is
|
||||||
|
* the name defined for the application and <code>www.example.org</code> the
|
||||||
|
* URL of the server.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
* @see com.arsdigita.web.BaseServlet
|
* @see com.arsdigita.web.BaseServlet
|
||||||
* @see com.arsdigita.web.DispatcherServlet
|
* @see com.arsdigita.web.DispatcherServlet
|
||||||
* @see com.arsdigita.web.RedirectSignal
|
* @see com.arsdigita.web.RedirectSignal
|
||||||
|
|
@ -65,7 +73,10 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
* <p>The ID of the application whose service is requested. This
|
* <p>The ID of the application whose service is requested. This
|
||||||
* request attribute must be set by a previous servlet or filter
|
* request attribute must be set by a previous servlet or filter
|
||||||
* before this servlet can proceed. In CCM, the default servlet,
|
* before this servlet can proceed. In CCM, the default servlet,
|
||||||
* DispatcherServlet, sets this attribute.</p>
|
* {@link DispatcherServlet}, sets this attribute using the
|
||||||
|
* {@link BaseDispatcher}. <strong>Important:</strong> This does only work
|
||||||
|
* if the application is called using an URL like
|
||||||
|
* <code>http://www.example.org/ccm/application</code>!</p>
|
||||||
*/
|
*/
|
||||||
public static final String APPLICATION_ID_ATTRIBUTE =
|
public static final String APPLICATION_ID_ATTRIBUTE =
|
||||||
BaseApplicationServlet.class.getName() + ".application_id";
|
BaseApplicationServlet.class.getName() + ".application_id";
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import org.apache.log4j.Logger;
|
||||||
* <b>Subject zu change!</b>
|
* <b>Subject zu change!</b>
|
||||||
*
|
*
|
||||||
* Note: Database initialization (Startup() ) has been moved to
|
* Note: Database initialization (Startup() ) has been moved to
|
||||||
* CCMAplicationContextListener).
|
* CCMApplicationContextListener).
|
||||||
*
|
*
|
||||||
* <p>Users of this class may implement {@link
|
* <p>Users of this class may implement {@link
|
||||||
* #doService(HttpServletRequest,HttpServletResponse)} to service a
|
* #doService(HttpServletRequest,HttpServletResponse)} to service a
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<initializer class="com.arsdigita.cms.contenttypes.ExpertiseInitializer"/>
|
<initializer class="com.arsdigita.cms.contenttypes.ExpertiseInitializer"/>
|
||||||
<initializer class="com.arsdigita.cms.contenttypes.ReviewInitializer"/>
|
<initializer class="com.arsdigita.cms.contenttypes.ReviewInitializer"/>
|
||||||
<initializer class="com.arsdigita.cms.contenttypes.SciAuthorInitializer"/>
|
<initializer class="com.arsdigita.cms.contenttypes.SciAuthorInitializer"/>
|
||||||
|
<initializer class="com.arsdigita.cms.scipublications.PublicationExporterInitializer"/>
|
||||||
</provides>
|
</provides>
|
||||||
<scripts>
|
<scripts>
|
||||||
<schema directory="ccm-sci-publications"/>
|
<schema directory="ccm-sci-publications"/>
|
||||||
|
|
@ -63,5 +64,6 @@
|
||||||
<data class="com.arsdigita.cms.contenttypes.ExpertiseLoader"/>
|
<data class="com.arsdigita.cms.contenttypes.ExpertiseLoader"/>
|
||||||
<data class="com.arsdigita.cms.contenttypes.ReviewLoader"/>
|
<data class="com.arsdigita.cms.contenttypes.ReviewLoader"/>
|
||||||
<data class="com.arsdigita.cms.contenttypes.SciAuthorLoader"/>
|
<data class="com.arsdigita.cms.contenttypes.SciAuthorLoader"/>
|
||||||
|
<data class="com.arsdigita.cms.scipublications.PublicationExporterLoader"/>
|
||||||
</scripts>
|
</scripts>
|
||||||
</load>
|
</load>
|
||||||
|
|
|
||||||
|
|
@ -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/";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
|
||||||
|
|
||||||
|
<!-- Servlets for the sci-publications applications -->
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>PublicationExporter</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.scipublications.PublicationExporterServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>PublicationExporter</servlet-name>
|
||||||
|
<url-pattern>/scipublicationsexporter/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
||||||
|
|
@ -125,7 +125,7 @@ public class SciProjectPropertyForm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitleLabel() {
|
public String getTitleLabel() {
|
||||||
return (String) PublicationGlobalizationUtil.globalize(
|
return (String) SciOrganizationGlobalizationUtil.globalize(
|
||||||
"sciorganizations.ui.project.title").localize();
|
"sciorganizations.ui.project.title").localize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue