Sfoglia il codice sorgente

add hook to handle missing filesystems

feature/fake-advanced-filesystem
Gabriele Zigurella 2 anni fa
parent
commit
f86cce86d3
  1. 22
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/.classpath
  2. 36
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/.project
  3. 6
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/build.xml
  4. 3
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/META-INF/MANIFEST.MF
  5. 5
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/lib/.gitignore
  6. 9
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-hook.xml
  7. 11
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-plugin-package.properties
  8. 9
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-releng.properties
  9. 1
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/META-INF/javadocs-all.xml
  10. 2
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/META-INF/javadocs-rt.xml
  11. 153
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/com/liferay/portlet/documentlibrary/service/FakeDLFileEntryLocalServiceImpl.java
  12. 3
      liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/web.xml

22
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/.classpath

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="docroot/WEB-INF/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.liferay.ide.eclipse.server.tomcat.runtimeClasspathProvider/Liferay v6.2 CE (Tomcat 7)">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.liferay.ide.eclipse.server.plugin.container/hook">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="docroot/WEB-INF/classes"/>
</classpath>

36
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/.project

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fake-advanced-filesystem-hook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

6
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/build.xml

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="fake-advanced-filesystem-hook" basedir=".">
<import file="C:/liferay-sviluppo/6_2/liferay-plugins-sdk-6.2-ee-sp11/hooks/build-common-hook.xml" />
</project>

3
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/META-INF/MANIFEST.MF

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

5
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/lib/.gitignore vendored

@ -0,0 +1,5 @@
/commons-logging.jar
/log4j.jar
/util-bridges.jar
/util-java.jar
/util-taglib.jar

9
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-hook.xml

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<service>
<service-type>com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService</service-type>
<service-impl>com.liferay.portlet.documentlibrary.service.FakeDLFileEntryLocalServiceImpl</service-impl>
</service>
</hook>

11
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-plugin-package.properties

@ -0,0 +1,11 @@
name=Sample Wrapper
module-group-id=liferay
module-incremental-version=1
tags=
short-description=This hook shows how to wrap Liferay's core services and models.
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+

9
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/liferay-releng.properties

@ -0,0 +1,9 @@
bundle=false
category=
demo-url=
dependent-apps=
labs=true
marketplace=false
public=true
support-url=
supported=false

1
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/META-INF/javadocs-all.xml

@ -0,0 +1 @@
<?xml version="1.0"?>

2
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/META-INF/javadocs-rt.xml

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<javadocs></javadocs>

153
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/src/com/liferay/portlet/documentlibrary/service/FakeDLFileEntryLocalServiceImpl.java

@ -0,0 +1,153 @@
package com.liferay.portlet.documentlibrary.service;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class FakeDLFileEntryLocalServiceImpl extends DLFileEntryLocalServiceWrapper {
@Override
public File getFile(long userId, long fileEntryId, String version,
boolean incrementCounter, int increment) throws PortalException,
SystemException {
File file = null;
try{
file = super.getFile(userId, fileEntryId, version, incrementCounter, increment);
} catch (Exception e){
try {
file = File.createTempFile("fakeFile", ".fake");
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return file;
}
@Override
public File getFile(long userId, long fileEntryId, String version,
boolean incrementCounter) throws PortalException, SystemException {
File file = null;
try{
file = super.getFile(userId, fileEntryId, version, incrementCounter);
} catch (Exception e){
try {
file = File.createTempFile("fakeFile", ".fake");
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return file;
}
@Override
public InputStream getFileAsStream(long userId, long fileEntryId,
String version, boolean incrementCounter, int increment)
throws PortalException, SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(userId, fileEntryId, version, incrementCounter, increment);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
@Override
public InputStream getFileAsStream(long userId, long fileEntryId,
String version, boolean incrementCounter) throws PortalException,
SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(userId, fileEntryId, version, incrementCounter);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
@Override
public InputStream getFileAsStream(long userId, long fileEntryId,
String version) throws PortalException, SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(userId, fileEntryId, version);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
@Override
public InputStream getFileAsStream(long fileEntryId, String version,
boolean incrementCounter, int increment) throws PortalException,
SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(fileEntryId, version, incrementCounter, increment);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
@Override
public InputStream getFileAsStream(long fileEntryId, String version,
boolean incrementCounter) throws PortalException, SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(fileEntryId, version, incrementCounter);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
@Override
public InputStream getFileAsStream(long fileEntryId, String version)
throws PortalException, SystemException {
InputStream stream = null;
try{
stream = super.getFileAsStream(fileEntryId, version);
} catch (Exception e){
try {
stream = new FileInputStream(File.createTempFile("fakeFile", ".fake"));
} catch (IOException io) {
_log.error("Fallback fake advanced filesystem failed to create temporary file");
}
}
return stream;
}
public FakeDLFileEntryLocalServiceImpl(
DLFileEntryLocalService dlFileEntryLocalService) {
super(dlFileEntryLocalService);
}
Log _log = LogFactoryUtil.getLog(this.getClass());
}

3
liferay-plugins-sdk-6.2/hooks/fake-advanced-filesystem-hook/docroot/WEB-INF/web.xml

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
</web-app>
Caricamento…
Annulla
Salva