10 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/old/Default suite/testng.xml.html:
--------------------------------------------------------------------------------
1 | testng.xml for Default suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Default suite">
<test verbose="2" name="Default test">
<classes>
<class name="br.com.trustsystems.elfinder.service.GoogleDriveVolumeTest"/>
</classes>
</test> <!-- Default test -->
</suite> <!-- Default suite -->
--------------------------------------------------------------------------------
/google-driver/filemanagejsp/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@page contentType="text/html" pageEncoding="UTF-8"%>
2 |
4 |
5 |
6 |
7 | File Upload Example in JSP and Servlet - Java web application
8 |
9 |
10 |
11 |
12 |
Choose File to Upload in Server
13 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/junitreports/TEST-br.com.trustsystems.elfinder.service.GoogleDriveVolumeTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vstorage-elfinder-java-connector
2 | Elfinder is a an open-source file manager for web, written in JavaScript using jQuery UI.
3 | https://github.com/Studio-42/elFinder
4 |
5 | There are some server connector use php, java, C#...
6 | The current Java connector is missing implement for Google Drive volume (or I could'n find it on internet).
7 |
8 | This implementation integrates Google Dirve as a Cloud volumne to java-connector which is implemented based on java-connector (https://github.com/trustsystems/elfinder-java-connector).
9 |
10 | The main customization is in folder: https://github.com/coderhoami4/vstorage-elfinder-java-connector/tree/master/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/impl/googledriver
11 |
12 | 
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/google-driver/filemanagejsp/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FileUploadHandler
6 | FileUploadHandler
7 |
8 |
9 | FileUploadHandler
10 | /upload
11 |
12 |
13 |
14 |
15 |
16 | 30
17 |
18 |
19 |
20 |
21 | index.jsp
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/resources/spring/root-applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 | XML root de configuração do Spring container (WebApplicationContext).
12 | http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-factory-xml-import
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Trustsystems Desenvolvimento de Sistemas LTDA
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/google-driver/file-app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/google-driver/filemanagejsp/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/old/Default suite/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Results for Default suite
4 |
5 |
6 |
7 |
8 |
61 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | Elfinder Demo Web Application
7 |
8 |
9 |
10 | org.springframework.web.context.ContextLoaderListener
11 |
12 |
13 |
14 | Root Application Context
15 | contextConfigLocation
16 | classpath:spring/root-applicationContext.xml
17 |
18 |
19 |
20 | dispatcher
21 | org.springframework.web.servlet.DispatcherServlet
22 |
23 | contextConfigLocation
24 | classpath:spring/mvc-applicationContext.xml
25 |
26 | 1
27 |
28 |
29 |
30 | dispatcher
31 | /
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/resources/spring/mvc-applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 | XML de configurações - Spring Web MVC.
15 | http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Trustsystems Desenvolvimento de Sistemas, LTDA.
2 |
3 | Redistribution and use in source and binary forms, with or without modification,
4 | are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this
7 | list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation
11 | and/or other materials provided with the distribution.
12 |
13 | 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
14 | may be used to endorse or promote products derived from this software without
15 | specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
26 | OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/license/description.ftl:
--------------------------------------------------------------------------------
1 | <#--
2 | #%L
3 | %%
4 | Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | %%
6 | Redistribution and use in source and binary forms, with or without modification,
7 | are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | may be used to endorse or promote products derived from this software without
18 | specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | OF THE POSSIBILITY OF SUCH DAMAGE.
30 | #L%
31 | -->
32 |
--------------------------------------------------------------------------------
/google-driver/file-app/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | org.myexample
6 | file-app
7 | 0.0.1-SNAPSHOT
8 | jar
9 |
10 | file-app
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 |
16 |
17 |
18 |
19 | junit
20 | junit
21 | 3.8.1
22 | test
23 |
24 |
25 | com.google.api-client
26 | google-api-client
27 | 1.22.0
28 |
29 |
30 |
31 | com.google.oauth-client
32 | google-oauth-client-java6
33 | 1.11.0-beta
34 |
35 |
36 |
37 | com.google.apis
38 | google-api-services-drive
39 | v3-rev27-1.22.0
40 |
41 |
42 |
43 |
44 | com.google.oauth-client
45 | google-oauth-client-jetty
46 | 1.11.0-beta
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/google-driver/file-app/target/classes/META-INF/maven/org.myexample/file-app/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | org.myexample
6 | file-app
7 | 0.0.1-SNAPSHOT
8 | jar
9 |
10 | file-app
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 |
16 |
17 |
18 |
19 | junit
20 | junit
21 | 3.8.1
22 | test
23 |
24 |
25 | com.google.api-client
26 | google-api-client
27 | 1.22.0
28 |
29 |
30 |
31 | com.google.oauth-client
32 | google-oauth-client-java6
33 | 1.11.0-beta
34 |
35 |
36 |
37 | com.google.apis
38 | google-api-services-drive
39 | v3-rev27-1.22.0
40 |
41 |
42 |
43 |
44 | com.google.oauth-client
45 | google-oauth-client-jetty
46 | 1.11.0-beta
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/old/Default suite/methods.html:
--------------------------------------------------------------------------------
1 |
Methods run, sorted chronologically
>> means before, << means after
Default suite(Hover the method name to see the test class name)
2 |
Default suite(Hover the method name to see the test class name)
2 |
3 |
Time
Delta (ms)
Suite configuration
Test configuration
Class configuration
Groups configuration
Method configuration
Test method
Thread
Instances
4 |
16/09/09 15:31:48
0
fromPathTest
5 |
main@12793227
6 |
16/09/09 15:31:48
302
getSizeTest
7 |
main@12793227
8 |
16/09/09 15:31:48
574
openInputStreamTest
9 |
main@12793227
10 |
16/09/09 15:31:46
-1162
>>setUp
11 |
main@12793227
12 |
13 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/Target.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core;
33 |
34 | public interface Target {
35 |
36 | Volume getVolume();
37 |
38 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/VolumeBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core;
33 |
34 | public interface VolumeBuilder {
35 |
36 | T build();
37 | }
38 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/service/ThumbnailWidth.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.service;
33 |
34 | public interface ThumbnailWidth {
35 |
36 | int getThumbnailWidth();
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/ElfinderCommandFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | public interface ElfinderCommandFactory {
35 |
36 | ElfinderCommand get(String commandName);
37 |
38 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/service/ElfinderStorageFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.service;
33 |
34 | public interface ElfinderStorageFactory {
35 |
36 | ElfinderStorage getVolumeSource();
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/ElfinderCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.core.ElfinderContext;
35 |
36 | public interface ElfinderCommand {
37 |
38 | void execute(ElfinderContext context) throws Exception;
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/VolumeSecurity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core;
33 |
34 | import br.com.trustsystems.elfinder.core.impl.SecurityConstraint;
35 |
36 | public interface VolumeSecurity {
37 |
38 | String getVolumePattern();
39 |
40 | SecurityConstraint getSecurityConstraint();
41 |
42 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/content/detect/Detector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.content.detect;
33 |
34 | import java.io.IOException;
35 | import java.io.InputStream;
36 | import java.nio.file.Path;
37 |
38 | public interface Detector {
39 |
40 | String detect(InputStream inputStream) throws IOException;
41 |
42 | String detect(Path path) throws IOException;
43 | }
44 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/webapp/WEB-INF/views/home.jsp:
--------------------------------------------------------------------------------
1 | <%@page contentType="text/html" pageEncoding="UTF-8" %>
2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
3 |
4 |
5 |
6 |
7 | elFinder 2.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | ">
16 | ">
17 |
18 |
19 | ">
20 |
21 |
22 |
25 |
26 |
27 |
37 |
38 |
39 |
40 |
41 |
42 |
Volume: Root (Hard Disk): can new/rename/delete/download file and folder
43 |
Volume: Google Driver: This one is a cloud Volumn (Google Driver API), for now only can explore a folder and download file; other features still not implement
An ObjectFactory allows you to programatically
12 | * construct new instances of the Java representation
13 | * for XML content. The Java representation of XML
14 | * content can consist of schema derived interfaces
15 | * and classes representing the binding of schema
16 | * type definitions, element declarations and model
17 | * groups. Factory methods for each of these are
18 | * provided in this class.
19 | *
20 | */
21 | @XmlRegistry
22 | public class ObjectFactory {
23 |
24 |
25 | /**
26 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: br.com.trustsystems.elfinder.configuration.jaxb
27 | *
28 | */
29 | public ObjectFactory() {
30 | }
31 |
32 | /**
33 | * Create an instance of {@link ElfinderConfiguration }
34 | *
35 | */
36 | public ElfinderConfiguration createElfinderConfiguration() {
37 | return new ElfinderConfiguration();
38 | }
39 |
40 | /**
41 | * Create an instance of {@link ElfinderConfiguration.Volume }
42 | *
43 | */
44 | public ElfinderConfiguration.Volume createElfinderConfigurationVolume() {
45 | return new ElfinderConfiguration.Volume();
46 | }
47 |
48 | /**
49 | * Create an instance of {@link ElfinderConfiguration.Thumbnail }
50 | *
51 | */
52 | public ElfinderConfiguration.Thumbnail createElfinderConfigurationThumbnail() {
53 | return new ElfinderConfiguration.Thumbnail();
54 | }
55 |
56 | /**
57 | * Create an instance of {@link ElfinderConfiguration.Volume.Constraint }
58 | *
59 | */
60 | public ElfinderConfiguration.Volume.Constraint createElfinderConfigurationVolumeConstraint() {
61 | return new ElfinderConfiguration.Volume.Constraint();
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/google-driver/filemanagejsp/src/main/java/FileUploadHandler.java:
--------------------------------------------------------------------------------
1 | import java.io.IOException;
2 | import java.io.InputStream;
3 |
4 | import javax.servlet.ServletException;
5 | import javax.servlet.annotation.MultipartConfig;
6 | import javax.servlet.http.HttpServlet;
7 | import javax.servlet.http.HttpServletRequest;
8 | import javax.servlet.http.HttpServletResponse;
9 |
10 | import org.apache.commons.fileupload.FileItemIterator;
11 | import org.apache.commons.fileupload.FileItemStream;
12 | import org.apache.commons.fileupload.servlet.ServletFileUpload;
13 |
14 | import com.google.api.services.drive.Drive;
15 |
16 | @MultipartConfig
17 | @SuppressWarnings("serial")
18 | public class FileUploadHandler extends HttpServlet {
19 |
20 | @Override
21 | protected void doPost(HttpServletRequest request,
22 | HttpServletResponse response) throws ServletException, IOException {
23 |
24 | if (ServletFileUpload.isMultipartContent(request)) {
25 | try {
26 | // Build a new authorized API client service.
27 | Drive service = DriveCommon.getDriveService();
28 |
29 | String folderId = DriveCommon.CheckExistingFolder(service, "MyTest");
30 |
31 | if (folderId == null) {
32 | folderId = DriveCommon.CreateFolder(service, "MyTest");
33 | }
34 |
35 | ServletFileUpload upload = new ServletFileUpload();
36 | FileItemIterator iter = upload.getItemIterator(request);
37 |
38 | while (iter.hasNext()) {
39 | FileItemStream item = iter.next();
40 |
41 | if (!item.isFormField()) {
42 | InputStream stream = item.openStream();
43 | String fileId = DriveCommon.InsertFile(service, item.getName(), folderId, item.getContentType(), stream);
44 | System.out.println("file Id: "+fileId);
45 | }
46 | }
47 |
48 | // File uploaded successfully
49 | request.setAttribute("message", "File Uploaded Successfully");
50 |
51 | } catch (Exception ex) {
52 | request.setAttribute("message", "File Upload Failed due to "
53 | + ex);
54 | }
55 | } else {
56 | request.setAttribute("message",
57 | "Sorry this Servlet only handles file upload request");
58 | }
59 |
60 | request.getRequestDispatcher("/result.jsp").forward(request, response);
61 | }
62 |
63 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/webapp/resources/css/theme.css:
--------------------------------------------------------------------------------
1 | /**
2 | * MacOS X like theme for elFinder.
3 | * Required jquery ui "smoothness" theme.
4 | *
5 | * @author Dmitry (dio) Levashov
6 | **/
7 |
8 | /* dialogs */
9 | .std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; }
10 |
11 | /* navbar */
12 | .elfinder .elfinder-navbar { background:#dde4eb; }
13 | .elfinder-navbar .ui-state-hover { background:transparent; border-color:transparent; }
14 | .elfinder-navbar .ui-state-active { background: #3875d7; border-color:#3875d7; color:#fff; }
15 | .elfinder-navbar .elfinder-droppable-active {background:#A7C6E5 !important;}
16 | /* disabled elfinder */
17 | .elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; }
18 |
19 |
20 | /* current directory */
21 | /* selected file in "icons" view */
22 | .elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { background:#ccc; }
23 |
24 | /* list view*/
25 | .elfinder-cwd table thead td.ui-state-hover { background:#ddd; }
26 | .elfinder-cwd table tr:nth-child(odd) { background-color:#edf3fe; }
27 | .elfinder-cwd table tr {
28 | border: 1px solid transparent;
29 | border-top:1px solid #fff;
30 | }
31 |
32 | /* common selected background/color */
33 | .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover,
34 | .elfinder-cwd table td.ui-state-hover,
35 | .elfinder-button-menu .ui-state-hover { background: #3875d7; color:#fff;}
36 | /* disabled elfinder */
37 | .elfinder-disabled .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover,
38 | .elfinder-disabled .elfinder-cwd table td.ui-state-hover { background:#dadada;}
39 |
40 | /* statusbar */
41 | .elfinder .elfinder-statusbar { color:#555; }
42 | .elfinder .elfinder-statusbar a { text-decoration:none; color:#555;}
43 |
44 |
45 | .std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;}
46 |
47 | /* contextmenu */
48 | .elfinder-contextmenu .ui-state-hover { background: #3875d7; color:#fff; }
49 | .elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../img/arrows-active.png'); }
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/ElfinderContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core;
33 |
34 | import br.com.trustsystems.elfinder.service.ElfinderStorageFactory;
35 |
36 | import javax.servlet.http.HttpServletRequest;
37 | import javax.servlet.http.HttpServletResponse;
38 |
39 | public interface ElfinderContext {
40 |
41 | ElfinderStorageFactory getVolumeSourceFactory();
42 |
43 | HttpServletRequest getRequest();
44 |
45 | HttpServletResponse getResponse();
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/service/impl/DefaultThumbnailWidth.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.service.impl;
33 |
34 | import br.com.trustsystems.elfinder.service.ThumbnailWidth;
35 |
36 | public class DefaultThumbnailWidth implements ThumbnailWidth {
37 |
38 | private int thumbnailWidth;
39 |
40 | @Override
41 | public int getThumbnailWidth() {
42 | return thumbnailWidth;
43 | }
44 |
45 | public void setThumbnailWidth(int thumbnailWidth) {
46 | this.thumbnailWidth = thumbnailWidth;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/archiver/ArchiverOption.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.archiver;
33 |
34 | import org.json.JSONObject;
35 |
36 | /**
37 | * Archiver Options.
38 | *
39 | * @author Thiago Gutenberg Carvalho da Costa
40 | */
41 | public enum ArchiverOption {
42 |
43 | INSTANCE;
44 |
45 | public static final JSONObject JSON_INSTANCE = new JSONObject(INSTANCE);
46 |
47 | public String[] getCreate() {
48 | return ArchiverType.SUPPORTED_MIME_TYPES;
49 | }
50 |
51 | public String[] getExtract() {
52 | return ArchiverType.SUPPORTED_MIME_TYPES;
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/emailable-report.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/google-driver/filemanagejsp/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.myexample
5 | filemanagejsp
6 | war
7 | 0.0.1-SNAPSHOT
8 | filemanagejsp Maven Webapp
9 | http://maven.apache.org
10 |
11 |
12 | junit
13 | junit
14 | 3.8.1
15 | test
16 |
17 |
18 |
19 | javax.servlet
20 | javax.servlet-api
21 | 3.0.1
22 |
23 |
24 |
25 |
26 | commons-fileupload
27 | commons-fileupload
28 | 1.3.2
29 |
30 |
31 |
32 | commons-io
33 | commons-io
34 | 2.5
35 |
36 |
37 |
38 | com.google.api-client
39 | google-api-client
40 | 1.22.0
41 |
42 |
43 |
44 | com.google.oauth-client
45 | google-oauth-client-java6
46 | 1.11.0-beta
47 |
48 |
49 |
50 | com.google.apis
51 | google-api-services-drive
52 | v3-rev27-1.22.0
53 |
54 |
55 |
56 |
57 | com.google.oauth-client
58 | google-oauth-client-jetty
59 | 1.11.0-beta
60 |
61 |
62 |
63 |
64 | filemanagejsp
65 |
66 |
67 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/service/impl/DefaultElfinderStorageFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.service.impl;
33 |
34 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorageFactory;
36 |
37 | public class DefaultElfinderStorageFactory implements ElfinderStorageFactory {
38 |
39 | private ElfinderStorage elfinderStorage;
40 |
41 | @Override
42 | public ElfinderStorage getVolumeSource() {
43 | return elfinderStorage;
44 | }
45 |
46 | public void setElfinderStorage(ElfinderStorage elfinderStorage) {
47 | this.elfinderStorage = elfinderStorage;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/service/ElfinderStorage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.service;
33 |
34 | import br.com.trustsystems.elfinder.core.Target;
35 | import br.com.trustsystems.elfinder.core.Volume;
36 | import br.com.trustsystems.elfinder.core.VolumeSecurity;
37 |
38 | import java.io.IOException;
39 | import java.util.List;
40 | import java.util.Locale;
41 |
42 | public interface ElfinderStorage {
43 |
44 | Target fromHash(String hash);
45 |
46 | String getHash(Target target) throws IOException;
47 |
48 | String getVolumeId(Volume volume);
49 |
50 | Locale getVolumeLocale(Volume volume);
51 |
52 | VolumeSecurity getVolumeSecurity(Target target);
53 |
54 | List getVolumes();
55 |
56 | List getVolumeSecurities();
57 |
58 | ThumbnailWidth getThumbnailWidth();
59 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/impl/DefaultVolumeSecurity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core.impl;
33 |
34 | import br.com.trustsystems.elfinder.core.VolumeSecurity;
35 |
36 | public class DefaultVolumeSecurity implements VolumeSecurity {
37 |
38 | private final String volumePattern;
39 | private final SecurityConstraint securityConstraint;
40 |
41 | public DefaultVolumeSecurity(String volumePattern, SecurityConstraint securityConstraint) {
42 | this.volumePattern = volumePattern;
43 | this.securityConstraint = securityConstraint;
44 | }
45 |
46 | @Override
47 | public String getVolumePattern() {
48 | return volumePattern;
49 | }
50 |
51 | @Override
52 | public SecurityConstraint getSecurityConstraint() {
53 | return securityConstraint;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/impl/googledriver/GoogleDriveTarget.java:
--------------------------------------------------------------------------------
1 | package br.com.trustsystems.elfinder.core.impl.googledriver;
2 |
3 | import org.json.JSONObject;
4 |
5 | import com.google.api.client.util.DateTime;
6 | import com.google.api.services.drive.model.File;
7 |
8 | import br.com.trustsystems.elfinder.core.Target;
9 | import br.com.trustsystems.elfinder.core.Volume;
10 |
11 | public class GoogleDriveTarget implements Target {
12 |
13 | private final Volume volume;
14 | private final File file;
15 |
16 | public GoogleDriveTarget(Volume volume) {
17 | this(volume, null);
18 | }
19 |
20 | public GoogleDriveTarget(Volume volume, File file) {
21 | this.volume = volume;
22 | this.file = file;
23 | }
24 |
25 | @Override
26 | public Volume getVolume() {
27 | return volume;
28 | }
29 |
30 | public String getName() {
31 | if (this.getFile() == null) {
32 | return null;
33 | }
34 | return this.getFile().getName();
35 | }
36 |
37 | public String getParentId() {
38 | if (this.getFile() == null || this.getFile().getParents()== null || this.getFile().getParents().size() == 0) {
39 | return null;
40 | }
41 | return this.getFile().getParents().get(0);
42 | }
43 |
44 | public String getId() {
45 | if (this.getFile() == null) {
46 | return "root";
47 | }
48 | return this.getFile().getId();
49 | }
50 |
51 | public String getMimeType() {
52 | if (this.getFile() == null) {
53 | return null;
54 | }
55 | String mimeType = this.getFile().getMimeType();
56 | if ("application/vnd.google-apps.folder".equals(mimeType)) {
57 | return "directory";
58 | }
59 | return mimeType;
60 | }
61 |
62 | public long getLastModified() {
63 | if (this.getFile() == null) {
64 | return 0;
65 | }
66 | DateTime modifiedTime = this.getFile().getModifiedTime();
67 | if (modifiedTime == null) {
68 | return 0;
69 | }
70 | return modifiedTime.getValue();
71 | }
72 |
73 | public boolean isFolder() {
74 | if (this.getFile() == null) {
75 | return false;
76 | }
77 | return "directory".equals(this.getMimeType());
78 | }
79 |
80 | public File getFile() {
81 | return file;
82 | }
83 |
84 | public long getSize() {
85 | if (this.getFile() == null) {
86 | return 0L;
87 | }
88 | Long s = file.getSize();
89 | if (s == null) {
90 | return 0;
91 | }
92 | return s.longValue();
93 | }
94 |
95 | @Override
96 | public String toString() {
97 | return JSONObject.valueToString(file);
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/impl/SecurityConstraint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core.impl;
33 |
34 | public class SecurityConstraint {
35 |
36 | private boolean locked = false;
37 | private boolean readable = true;
38 | private boolean writable = true;
39 |
40 | public boolean isLocked() {
41 | return locked;
42 | }
43 |
44 | public void setLocked(boolean locked) {
45 | this.locked = locked;
46 | }
47 |
48 | public boolean isReadable() {
49 | return readable;
50 | }
51 |
52 | public void setReadable(boolean readable) {
53 | this.readable = readable;
54 | }
55 |
56 | public boolean isWritable() {
57 | return writable;
58 | }
59 |
60 | public void setWritable(boolean writable) {
61 | this.writable = writable;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/impl/NIO2FileSystemTarget.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core.impl;
33 |
34 | import br.com.trustsystems.elfinder.core.Target;
35 | import br.com.trustsystems.elfinder.core.Volume;
36 |
37 | import java.nio.file.Path;
38 |
39 | public class NIO2FileSystemTarget implements Target {
40 |
41 | private final Path path;
42 | private final Volume volume;
43 |
44 | public NIO2FileSystemTarget(NIO2FileSystemVolume volume, Path path) {
45 | this.path = path;
46 | this.volume = volume;
47 | }
48 |
49 | @Override
50 | public Volume getVolume() {
51 | return volume;
52 | }
53 |
54 | public Path getPath() {
55 | return path;
56 | }
57 |
58 | @Override
59 | public String toString() {
60 | return path.toAbsolutePath().toString();
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/test/resources/elfinder-configuration_vincent.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
37 |
38 | 80
39 |
40 |
41 | filesystem
42 | Root
43 | /var/lib/openshift/574b9f757628e128170000b6/
44 | en_US
45 |
46 | false
47 | true
48 | true
49 |
50 |
51 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/resources/elfinder-configuration_openshift_need_reaname.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
37 |
38 | 80
39 |
40 |
41 | filesystem
42 | Root
43 | /var/lib/openshift/574b9f757628e128170000b6/wildfly/test
44 |
45 | en_US
46 |
47 | false
48 | true
49 | true
50 |
51 |
52 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/LsCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 | import java.util.HashMap;
41 | import java.util.Map;
42 |
43 | public class LsCommand extends AbstractJsonCommand implements ElfinderCommand {
44 | @Override
45 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
46 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
47 |
48 | Map files = new HashMap<>();
49 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
50 | addChildren(files, volumeHandler);
51 |
52 | json.put(ElFinderConstants.ELFINDER_PARAMETER_LIST, files.values());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/TreeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 | import java.util.HashMap;
41 | import java.util.Map;
42 |
43 | public class TreeCommand extends AbstractJsonCommand implements ElfinderCommand {
44 | @Override
45 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
46 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
47 |
48 | Map files = new HashMap<>();
49 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
50 | addSubFolders(files, volumeHandler);
51 |
52 | json.put(ElFinderConstants.ELFINDER_PARAMETER_TREE, buildJsonFilesArray(request, files.values()));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/MkfileCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 |
41 | public class MkfileCommand extends AbstractJsonCommand implements ElfinderCommand {
42 | @Override
43 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
44 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
45 | final String fileName = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_NAME);
46 |
47 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
48 | VolumeHandler newFile = new VolumeHandler(volumeHandler, fileName);
49 | newFile.createFile();
50 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, new Object[]{getTargetInfo(request, newFile)});
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/MkdirCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 |
41 | public class MkdirCommand extends AbstractJsonCommand implements ElfinderCommand {
42 | @Override
43 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
44 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
45 | final String dirName = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_NAME);
46 |
47 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
48 | VolumeHandler directory = new VolumeHandler(volumeHandler, dirName);
49 | directory.createFolder();
50 |
51 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, new Object[]{getTargetInfo(request, directory)});
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/DimCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.imageio.ImageIO;
40 | import javax.servlet.http.HttpServletRequest;
41 | import java.awt.image.BufferedImage;
42 |
43 | public class DimCommand extends AbstractJsonCommand implements ElfinderCommand {
44 | public static final String SEPARATOR = "x";
45 |
46 | @Override
47 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
48 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
49 |
50 | BufferedImage image;
51 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
52 | image = ImageIO.read(volumeHandler.openInputStream());
53 |
54 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_DIM, image.getWidth() + SEPARATOR + image.getHeight());
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/GetCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.apache.commons.io.IOUtils;
38 | import org.json.JSONObject;
39 |
40 | import javax.servlet.http.HttpServletRequest;
41 | import java.io.InputStream;
42 |
43 | public class GetCommand extends AbstractJsonCommand implements ElfinderCommand {
44 |
45 | public static final String ENCODING = "utf-8";
46 |
47 | @Override
48 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
49 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
50 | final VolumeHandler vh = findTarget(elfinderStorage, target);
51 | final InputStream is = vh.openInputStream();
52 | final String content = IOUtils.toString(is, ENCODING);
53 | is.close();
54 | json.put(ElFinderConstants.ELFINDER_PARAMETER_CONTENT, content);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/resources/elfinder-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
37 |
38 | 80
39 |
40 |
41 | filesystem
42 | Root
43 | /
44 | en_US
45 |
46 | false
47 | true
48 | true
49 |
50 |
51 |
64 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/ParentsCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 | import java.util.HashMap;
41 | import java.util.Map;
42 |
43 | public class ParentsCommand extends AbstractJsonCommand implements ElfinderCommand {
44 | @Override
45 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
46 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
47 |
48 | Map files = new HashMap<>();
49 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
50 |
51 | while (!volumeHandler.isRoot()) {
52 | addSubFolders(files, volumeHandler);
53 | volumeHandler = volumeHandler.getParent();
54 | }
55 |
56 | json.put(ElFinderConstants.ELFINDER_PARAMETER_TREE, buildJsonFilesArray(request, files.values()));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/PutCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.apache.commons.io.IOUtils;
38 | import org.json.JSONObject;
39 |
40 | import javax.servlet.http.HttpServletRequest;
41 | import java.io.OutputStream;
42 |
43 | public class PutCommand extends AbstractJsonCommand implements ElfinderCommand {
44 |
45 | public static final String ENCODING = "utf-8";
46 |
47 | @Override
48 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
49 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
50 |
51 | VolumeHandler file = findTarget(elfinderStorage, target);
52 | OutputStream os = file.openOutputStream();
53 | IOUtils.write(request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_CONTENT), os, ENCODING);
54 | os.close();
55 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_CHANGED, new Object[]{getTargetInfo(request, file)});
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/test/resources/elfinder-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
37 |
38 | 80
39 |
40 |
41 | filesystem
42 | My Books
43 | /Users/thiago/Development/books
44 | pt_BR
45 |
46 | false
47 | true
48 | true
49 |
50 |
51 |
52 | filesystem
53 | My JDBC Drivers
54 | /Users/thiago/Development/jdbc/drivers
55 | pt_BR
56 |
57 | true
58 | true
59 | false
60 |
61 |
62 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/RenameCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 |
41 | public class RenameCommand extends AbstractJsonCommand implements ElfinderCommand {
42 | @Override
43 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
44 | final String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
45 | final String newName = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_NAME);
46 |
47 | VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
48 | VolumeHandler destination = new VolumeHandler(volumeHandler.getParent(), newName);
49 | volumeHandler.renameTo(destination);
50 |
51 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, new Object[]{getTargetInfo(request, destination)});
52 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_REMOVED, new String[]{target});
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/SizeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.core.Target;
36 | import br.com.trustsystems.elfinder.core.Volume;
37 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
38 | import org.json.JSONObject;
39 |
40 | import javax.servlet.http.HttpServletRequest;
41 | import java.util.List;
42 |
43 | /**
44 | * Defines how to execute the size command.
45 | *
46 | * @author Thiago Gutenberg Carvalho da Costa
47 | */
48 | public class SizeCommand extends AbstractJsonCommand implements ElfinderCommand {
49 |
50 | @Override
51 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
52 | final String[] targets = request.getParameterValues(ElFinderConstants.ELFINDER_PARAMETER_TARGETS);
53 |
54 | List targetList = findTargets(elfinderStorage, targets);
55 |
56 | long size = 0;
57 | for (Target target : targetList) {
58 | Volume volume = target.getVolume();
59 | size += volume.getSize(target);
60 | }
61 |
62 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_SIZE, size);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/test-output/Default suite/Default test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNG: Default test
4 |
5 |
6 |
7 |
11 |
53 |
54 |
55 |
56 |
Default test
57 |
58 |
Tests passed/Failed/Skipped:
3/0/0
59 |
60 |
Started on:
Fri Sep 09 15:31:46 ICT 2016
61 |
62 |
Total time:
2 seconds (2627 ms)
63 |
64 |
Included groups:
65 |
66 |
Excluded groups:
67 |
68 |
69 | (Hover the method name to see the test class name)
70 |
71 |
PASSED TESTS
72 |
Test method
73 |
Exception
74 |
Time (seconds)
75 |
Instance
76 |
77 |
78 |
fromPathTest Test class: br.com.trustsystems.elfinder.service.GoogleDriveVolumeTest
93 |
94 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/AbstractJsonCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import org.json.JSONObject;
37 |
38 | import javax.servlet.http.HttpServletRequest;
39 | import javax.servlet.http.HttpServletResponse;
40 | import java.io.PrintWriter;
41 |
42 | public abstract class AbstractJsonCommand extends AbstractCommand {
43 |
44 | public static final String APPLICATION_JSON_CHARSET_UTF_8 = "application/json; charset=UTF-8";
45 |
46 | protected abstract void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json)
47 | throws Exception;
48 |
49 | @Override
50 | final public void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, HttpServletResponse response)
51 | throws Exception {
52 |
53 | JSONObject json = new JSONObject();
54 |
55 | try (PrintWriter writer = response.getWriter()) {
56 | execute(elfinderStorage, request, json);
57 | response.setContentType(APPLICATION_JSON_CHARSET_UTF_8);
58 | json.write(writer);
59 | writer.flush();
60 | logger.debug(json.toString());
61 | } catch (Exception e) {
62 | logger.error("Unable to execute abstract json command", e);
63 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ERROR, e.getMessage());
64 | }
65 | }
66 |
67 | }
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/RmCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 | import java.nio.file.DirectoryNotEmptyException;
41 | import java.util.ArrayList;
42 | import java.util.List;
43 |
44 | public class RmCommand extends AbstractJsonCommand implements ElfinderCommand {
45 |
46 | @Override
47 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
48 | String[] targets = request.getParameterValues(ElFinderConstants.ELFINDER_PARAMETER_TARGETS);
49 | List removed = new ArrayList<>();
50 |
51 | for (String target : targets) {
52 | VolumeHandler vh = findTarget(elfinderStorage, target);
53 | try {
54 | vh.delete();
55 | removed.add(vh.getHash());
56 | } catch (DirectoryNotEmptyException dne) {
57 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ERROR, "Directory not empty!");
58 | }
59 |
60 |
61 | }
62 |
63 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_REMOVED, removed.toArray());
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/archiver/Archiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.archiver;
33 |
34 | import br.com.trustsystems.elfinder.core.Target;
35 |
36 | import java.io.IOException;
37 |
38 | /**
39 | * Archiver interface.
40 | *
41 | * @author Thiago Gutenberg Carvalho da Costa
42 | */
43 | public interface Archiver {
44 |
45 | /**
46 | * Gets the archive name.
47 | *
48 | * @return the archive name
49 | */
50 | String getArchiveName();
51 |
52 | /**
53 | * Gets the archive mimetype.
54 | *
55 | * @return the archive mimetype
56 | */
57 | String getMimeType();
58 |
59 | /**
60 | * Gets the archive extension.
61 | *
62 | * @return the archive extension
63 | */
64 | String getExtension();
65 |
66 | /**
67 | * Creates the compress archive for the given targets.
68 | *
69 | * @param targets the targets to compress.
70 | * @return the target of the compress archive.
71 | * @throws IOException if something goes wrong.
72 | */
73 | Target compress(Target... targets) throws IOException;
74 |
75 | /**
76 | * Decompress the archive for the given target
77 | *
78 | * @param target the compress archive to decompress.
79 | * @return the target folder of the decompressed targets.
80 | * @throws IOException if something goes wrong.
81 | */
82 | Target decompress(Target target) throws IOException;
83 | }
84 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/spring/ElfinderWebApplicationInitializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.spring;
33 |
34 | import org.springframework.web.WebApplicationInitializer;
35 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
36 | import org.springframework.web.servlet.DispatcherServlet;
37 |
38 | import javax.servlet.ServletContext;
39 | import javax.servlet.ServletException;
40 | import javax.servlet.ServletRegistration;
41 |
42 | /**
43 | * Elfinder Spring Web Application Initializer.
44 | *
45 | * @author Thiago Gutenberg Carvalho da Costa
46 | */
47 | public class ElfinderWebApplicationInitializer implements WebApplicationInitializer {
48 |
49 | public static final String SERVLET_NAME = "elfinder";
50 |
51 | @Override
52 | public final void onStartup(ServletContext servletContext) throws ServletException {
53 |
54 | AnnotationConfigWebApplicationContext rootWebApplicationContext = new AnnotationConfigWebApplicationContext();
55 | rootWebApplicationContext.setDisplayName("Elfinder Java Connector");
56 | rootWebApplicationContext.setServletContext(servletContext);
57 | rootWebApplicationContext.register(ElfinderRootConfig.class);
58 | rootWebApplicationContext.refresh();
59 |
60 | ServletRegistration.Dynamic dispatcher = servletContext.addServlet(SERVLET_NAME, new DispatcherServlet(rootWebApplicationContext));
61 | dispatcher.addMapping("/" + SERVLET_NAME + "/*");
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/core/Volume.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.core;
33 |
34 | import java.io.IOException;
35 | import java.io.InputStream;
36 | import java.io.OutputStream;
37 | import java.util.List;
38 |
39 | public interface Volume {
40 |
41 | void createFile(Target target) throws IOException;
42 |
43 | void createFolder(Target target) throws IOException;
44 |
45 | void deleteFile(Target target) throws IOException;
46 |
47 | void deleteFolder(Target target) throws IOException;
48 |
49 | boolean exists(Target target);
50 |
51 | Target fromPath(String path);
52 |
53 | long getLastModified(Target target) throws IOException;
54 |
55 | String getMimeType(Target target) throws IOException;
56 |
57 | String getAlias();
58 |
59 | String getName(Target target);
60 |
61 | Target getParent(Target target);
62 |
63 | String getPath(Target target) throws IOException;
64 |
65 | Target getRoot();
66 |
67 | long getSize(Target target) throws IOException;
68 |
69 | boolean hasChildFolder(Target target) throws IOException;
70 |
71 | boolean isFolder(Target target);
72 |
73 | boolean isRoot(Target target) throws IOException;
74 |
75 | Target[] listChildren(Target target) throws IOException;
76 |
77 | InputStream openInputStream(Target target) throws IOException;
78 |
79 | OutputStream openOutputStream(Target target) throws IOException;
80 |
81 | void rename(Target origin, Target destination) throws IOException;
82 |
83 | List search(String target) throws IOException;
84 | }
85 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/configuration/ElfinderConfigurationUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.configuration;
33 |
34 | import java.net.URI;
35 |
36 | /**
37 | * Utility class to handle the Elfinder Configuration file path.
38 | *
39 | * @author Thiago Gutenberg Carvalho da Costa
40 | */
41 | public final class ElfinderConfigurationUtils {
42 |
43 | private ElfinderConfigurationUtils() {
44 | // suppress default constructor
45 | // for noninstantiability
46 | throw new AssertionError();
47 | }
48 |
49 | public static String treatPath(String path) {
50 | if (path != null && !path.trim().isEmpty()) {
51 |
52 | final String uriSuffix = "file:";
53 | final String slash = "/";
54 |
55 | path = path.trim();
56 | path = path.replaceAll("//", slash);
57 | path = path.replaceAll("\\\\", slash);
58 | path = path.replaceAll("\\s+", " ");
59 | path = path.replaceAll("[\\p{Z}]", "%20");
60 |
61 | StringBuilder sb = new StringBuilder();
62 | if (!path.startsWith(uriSuffix)) {
63 | if (path.startsWith(slash)) {
64 | sb.append(uriSuffix).append(path);
65 | } else {
66 | sb.append(uriSuffix).append(slash).append(path);
67 | }
68 | }
69 | return sb.toString();
70 | }
71 | return path;
72 | }
73 |
74 | public static URI toURI(String path) {
75 | return URI.create(treatPath(path));
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/concurrency/GenericCache.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.concurrency;
33 |
34 | import java.util.concurrent.*;
35 |
36 | public class GenericCache {
37 |
38 | private final ConcurrentMap> cache = new ConcurrentHashMap<>();
39 |
40 | private Future createFutureIfAbsent(final K key, final Callable callable) {
41 | Future future = cache.get(key);
42 | if (future == null) {
43 | final FutureTask futureTask = new FutureTask<>(callable);
44 | future = cache.putIfAbsent(key, futureTask);
45 | if (future == null) {
46 | future = futureTask;
47 | futureTask.run();
48 | }
49 | }
50 | return future;
51 | }
52 |
53 | public V getValue(final K key, final Callable callable) throws InterruptedException, ExecutionException {
54 | try {
55 | final Future future = createFutureIfAbsent(key, callable);
56 | return future.get();
57 | } catch (final InterruptedException | ExecutionException | RuntimeException e) {
58 | cache.remove(key);
59 | throw e;
60 | }
61 | }
62 |
63 | public void setValueIfAbsent(final K key, final V value) {
64 | createFutureIfAbsent(key, new Callable() {
65 | @Override
66 | public V call() throws Exception {
67 | return value;
68 | }
69 | });
70 | }
71 |
72 | public void removeValue(final K key) {
73 | cache.remove(key);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/test/java/br/com/trustsystems/elfinder/service/GoogleDriveVolumeTest.java:
--------------------------------------------------------------------------------
1 | package br.com.trustsystems.elfinder.service;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.io.OutputStream;
6 |
7 | import org.apache.commons.io.IOUtils;
8 | import org.testng.annotations.AfterClass;
9 | import org.testng.annotations.BeforeClass;
10 | import org.testng.annotations.Test;
11 |
12 | import br.com.trustsystems.elfinder.core.Target;
13 | import br.com.trustsystems.elfinder.core.Volume;
14 | import br.com.trustsystems.elfinder.core.impl.googledriver.GoogleDriveTarget;
15 | import br.com.trustsystems.elfinder.core.impl.googledriver.GoogleDriveVolume;
16 | public class GoogleDriveVolumeTest {
17 |
18 | private static Volume volume;
19 |
20 | @BeforeClass
21 | public static void setUp() {
22 | volume = GoogleDriveVolume.builder("Google Driver", "hoamicoder1.json").build();
23 | }
24 |
25 | @AfterClass(enabled = false)
26 | public static void tearDown() {
27 | }
28 |
29 | @Test(enabled = true)
30 | public void fromPathTest() throws IOException {
31 | Target target = volume.fromPath("root");
32 | printTarget(target);
33 | }
34 |
35 | @Test(enabled = false)
36 | public void getRootTest() throws IOException {
37 | Target rootTarget = volume.getRoot();
38 | printTarget(rootTarget);
39 | }
40 |
41 | @Test(enabled = false)
42 | public void listChildrenTest() throws IOException {
43 | Target[] listChildren = volume.listChildren(volume.getRoot());
44 | int length = listChildren.length;
45 | System.out.println("Volume#listChildren(Target target): " + length);
46 | for (Target childTarget : listChildren) {
47 | GoogleDriveTarget child = ((GoogleDriveTarget)childTarget);
48 | printTarget(child);
49 | }
50 | }
51 |
52 | @Test(enabled = false)
53 | public void getParentTest() throws IOException {
54 | Target target = volume.getRoot();
55 | Target[] listChildren = volume.listChildren(target);
56 | for (Target childTarget : listChildren) {
57 | printTarget(childTarget);
58 | GoogleDriveTarget parent = (GoogleDriveTarget)volume.getParent(childTarget);
59 | printTarget(parent);
60 | }
61 | }
62 |
63 | @Test(enabled = false)
64 | public void createFolderTest() throws IOException {
65 | Target target = volume.getRoot();
66 | volume.createFolder(target);
67 | }
68 |
69 | @Test(enabled = true)
70 | public void getSizeTest() throws IOException {
71 | Target target = volume.fromPath("0B3AqhzC4YrigSmNDM0Z6bG8yZDg");// 0B3AqhzC4Yrigc3RhcnRlcl9maWxl
72 | long size = volume.getSize(target);
73 | System.out.println(size);
74 | }
75 |
76 | @Test(enabled = true)
77 | public void openInputStreamTest() throws IOException {
78 | Target target = volume.fromPath("0B3AqhzC4YrigSmNDM0Z6bG8yZDg");
79 | OutputStream out = System.out;
80 | try (InputStream is = volume.openInputStream(target)) {
81 | IOUtils.copy(is, out);
82 | out.flush();
83 | out.close();
84 | }
85 |
86 | }
87 |
88 | private void printTarget(Target target) {
89 | GoogleDriveTarget gtarget = (GoogleDriveTarget) target;
90 | System.out.printf("%s (%s) %s \n", gtarget.getName(), gtarget.getId(), gtarget.getMimeType()) ;
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/content/detect/NIO2FileTypeDetector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.content.detect;
33 |
34 | import org.apache.tika.Tika;
35 |
36 | import java.io.IOException;
37 | import java.io.InputStream;
38 | import java.nio.file.Files;
39 | import java.nio.file.Path;
40 |
41 | /**
42 | * NIO file type detector implementation that uses Tika API.
43 | *
44 | * @author Thiago Gutenberg Carvalho da Costa
45 | */
46 | public class NIO2FileTypeDetector extends java.nio.file.spi.FileTypeDetector implements Detector {
47 |
48 | private final Tika tika = new Tika();
49 |
50 | /**
51 | * Gets mime type from the given input stream.
52 | *
53 | * @return the mime type.
54 | * @throws IOException if the stream can not be read.
55 | */
56 | @Override
57 | public String detect(InputStream inputStream) throws IOException {
58 | return tika.detect(inputStream);
59 | }
60 |
61 | /**
62 | * Gets mime type from the given file path.
63 | *
64 | * @return the mime type.
65 | * @throws IOException if the file can not be read.
66 | */
67 | @Override
68 | public String detect(Path path) throws IOException {
69 | if (Files.isDirectory(path)) {
70 | return "directory";
71 | }
72 | return tika.detect(path);
73 | }
74 |
75 | /**
76 | * Gets mime type from the given file path.
77 | *
78 | * @return the mime type.
79 | * @throws IOException if the file can not be read.
80 | */
81 | @Override
82 | public String probeContentType(Path path) throws IOException {
83 | return detect(path);
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/archiver/ArchiverType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.archiver;
33 |
34 | /**
35 | * Archiver Supported Types.
36 | *
37 | * @author Thiago Gutenberg Carvalho da Costa
38 | */
39 | public enum ArchiverType {
40 |
41 | TAR {
42 | @Override
43 | public Archiver getStrategy() {
44 | return new TarArchiver();
45 | }
46 | },
47 | ZIP {
48 | @Override
49 | public Archiver getStrategy() {
50 | return new ZipArchiver();
51 | }
52 | },
53 | GZIP {
54 | @Override
55 | public Archiver getStrategy() {
56 | return new GzipArchiver();
57 | }
58 | };
59 |
60 | // convenient
61 |
62 | public static ArchiverType of(String mimeType) {
63 | for (ArchiverType archiverType : values()) {
64 | if (archiverType.getStrategy().getMimeType().equalsIgnoreCase(mimeType)) {
65 | return archiverType;
66 | }
67 | }
68 | throw new RuntimeException(String.format("Archive type (%s) not supported", mimeType));
69 | }
70 |
71 | public static String[] SUPPORTED_MIME_TYPES = {
72 | ZIP.getMimeType(),
73 | TAR.getMimeType(),
74 | GZIP.getMimeType()
75 | };
76 |
77 | // shortcuts
78 |
79 | public String getMimeType() {
80 | return getStrategy().getMimeType();
81 | }
82 |
83 | public String getExtension() {
84 | return getStrategy().getExtension();
85 | }
86 |
87 | public String getArchiveName() {
88 | return getStrategy().getArchiveName();
89 | }
90 |
91 | public abstract Archiver getStrategy();
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/archiver/TarArchiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.archiver;
33 |
34 | import org.apache.commons.compress.archivers.ArchiveEntry;
35 | import org.apache.commons.compress.archivers.ArchiveInputStream;
36 | import org.apache.commons.compress.archivers.ArchiveOutputStream;
37 | import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
38 | import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
39 | import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
40 |
41 | import java.io.BufferedInputStream;
42 | import java.io.BufferedOutputStream;
43 | import java.io.IOException;
44 |
45 | /**
46 | * Tar Archive Implementation.
47 | *
48 | * @author Thiago Gutenberg Carvalho da Costa
49 | */
50 | public class TarArchiver extends AbstractArchiver implements Archiver {
51 |
52 | @Override
53 | public String getMimeType() {
54 | return "application/x-tar";
55 | }
56 |
57 | @Override
58 | public String getExtension() {
59 | return ".tar";
60 | }
61 |
62 | @Override
63 | public ArchiveEntry createArchiveEntry(String targetPath, long targetSize, byte[] targetBytes) {
64 | TarArchiveEntry tarEntry = new TarArchiveEntry(targetPath);
65 | tarEntry.setSize(targetSize);
66 | return tarEntry;
67 | }
68 |
69 | @Override
70 | public ArchiveOutputStream createArchiveOutputStream(BufferedOutputStream bufferedOutputStream) throws IOException {
71 | return new TarArchiveOutputStream(bufferedOutputStream);
72 | }
73 |
74 | @Override
75 | public ArchiveInputStream createArchiveInputStream(BufferedInputStream bufferedInputStream) throws IOException {
76 | return new TarArchiveInputStream(bufferedInputStream);
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/UploadCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.apache.commons.fileupload.FileItemStream;
38 | import org.apache.commons.io.IOUtils;
39 | import org.json.JSONObject;
40 |
41 | import javax.servlet.http.HttpServletRequest;
42 | import java.io.InputStream;
43 | import java.io.OutputStream;
44 | import java.util.ArrayList;
45 | import java.util.List;
46 |
47 | public class UploadCommand extends AbstractJsonCommand implements ElfinderCommand {
48 |
49 | @Override
50 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
51 |
52 | List files = (List) request.getAttribute(FileItemStream.class.getName());
53 | List added = new ArrayList<>();
54 |
55 | String target = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
56 | VolumeHandler parentDir = findTarget(elfinderStorage, target);
57 |
58 | for (FileItemStream file : files) {
59 | String fileName = file.getName();
60 | VolumeHandler newFile = new VolumeHandler(parentDir, fileName);
61 | newFile.createFile();
62 | InputStream is = file.openStream();
63 | OutputStream os = newFile.openOutputStream();
64 |
65 | IOUtils.copy(is, os);
66 | os.close();
67 | is.close();
68 |
69 | added.add(newFile);
70 | }
71 |
72 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, buildJsonFilesArray(request, added));
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/ArchiveCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.core.Target;
36 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
37 | import br.com.trustsystems.elfinder.service.VolumeHandler;
38 | import br.com.trustsystems.elfinder.support.archiver.Archiver;
39 | import br.com.trustsystems.elfinder.support.archiver.ArchiverType;
40 | import org.json.JSONObject;
41 |
42 | import javax.servlet.http.HttpServletRequest;
43 | import java.util.List;
44 |
45 | /**
46 | * Defines how to execute the archive command.
47 | *
48 | * @author Thiago Gutenberg Carvalho da Costa
49 | */
50 | public class ArchiveCommand extends AbstractJsonCommand implements ElfinderCommand {
51 |
52 | @Override
53 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
54 | final String[] targets = request.getParameterValues(ElFinderConstants.ELFINDER_PARAMETER_TARGETS);
55 | final String type = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TYPE);
56 |
57 | List targetList = findTargets(elfinderStorage, targets);
58 |
59 | try {
60 | Archiver archiver = ArchiverType.of(type).getStrategy();
61 | Target targetArchive = archiver.compress(targetList.toArray(new Target[targetList.size()]));
62 |
63 | Object[] archiveInfos = {getTargetInfo(request, new VolumeHandler(targetArchive, elfinderStorage))};
64 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, archiveInfos);
65 |
66 | } catch (Exception e) {
67 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ERROR, "Unable to create the archive! Error: " + e);
68 | }
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/elfinder/elfinder-demo-master/src/main/resources/elfinder-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
37 |
38 | 80
39 |
40 |
41 | filesystem
42 | Root (Hard Disk)
43 |
46 | D:/test
47 | en_US
48 |
49 | false
50 | true
51 | true
52 |
53 |
54 |
55 | googledrive
56 | Google Drive
57 |
60 | C:/Users/vu.dao/.credentials/hoamicoder1.json
61 | en_US
62 |
63 | false
64 | true
65 | true
66 |
67 |
68 |
69 |
82 |
84 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/ExtractCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.core.Target;
36 | import br.com.trustsystems.elfinder.core.Volume;
37 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
38 | import br.com.trustsystems.elfinder.service.VolumeHandler;
39 | import br.com.trustsystems.elfinder.support.archiver.Archiver;
40 | import br.com.trustsystems.elfinder.support.archiver.ArchiverType;
41 | import org.json.JSONObject;
42 |
43 | import javax.servlet.http.HttpServletRequest;
44 |
45 | /**
46 | * Defines how to execute the extract command.
47 | *
48 | * @author Thiago Gutenberg Carvalho da Costa
49 | */
50 | public class ExtractCommand extends AbstractJsonCommand implements ElfinderCommand {
51 |
52 | @Override
53 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
54 | final String targetHash = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_TARGET);
55 |
56 | Target targetCompressed = elfinderStorage.fromHash(targetHash);
57 | Volume targetCompressedVolume = targetCompressed.getVolume();
58 | String mimeType = targetCompressedVolume.getMimeType(targetCompressed);
59 |
60 | try {
61 | Archiver archiver = ArchiverType.of(mimeType).getStrategy();
62 | Target decompressTarget = archiver.decompress(targetCompressed);
63 |
64 | Object[] archiveInfos = {getTargetInfo(request, new VolumeHandler(decompressTarget, elfinderStorage))};
65 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, archiveInfos);
66 |
67 | } catch (Exception e) {
68 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ERROR, "Unable to extract the archive! Error: " + e);
69 | }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/PasteCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.json.JSONObject;
38 |
39 | import javax.servlet.http.HttpServletRequest;
40 | import java.util.ArrayList;
41 | import java.util.List;
42 |
43 | public class PasteCommand extends AbstractJsonCommand implements ElfinderCommand {
44 | public static final String INT_CUT = "1";
45 |
46 | @Override
47 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
48 | final String[] targets = request.getParameterValues(ElFinderConstants.ELFINDER_PARAMETER_TARGETS);
49 | final String destination = request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_FILE_DESTINATION);
50 | final boolean cut = INT_CUT.equals(request.getParameter(ElFinderConstants.ELFINDER_PARAMETER_CUT));
51 |
52 | List added = new ArrayList<>();
53 | List removed = new ArrayList<>();
54 |
55 | VolumeHandler vhDst = findTarget(elfinderStorage, destination);
56 |
57 | for (String target : targets) {
58 | VolumeHandler vhTarget = findTarget(elfinderStorage, target);
59 | final String name = vhTarget.getName();
60 | VolumeHandler newFile = new VolumeHandler(vhDst, name);
61 | createAndCopy(vhTarget, newFile);
62 | added.add(newFile);
63 |
64 | if (cut) {
65 | vhTarget.delete();
66 | removed.add(vhTarget.getHash());
67 | }
68 | }
69 |
70 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, buildJsonFilesArray(request, added));
71 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_REMOVED, removed.toArray());
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/support/archiver/GzipArchiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.support.archiver;
33 |
34 | import org.apache.commons.compress.archivers.ArchiveEntry;
35 | import org.apache.commons.compress.archivers.ArchiveInputStream;
36 | import org.apache.commons.compress.archivers.ArchiveOutputStream;
37 | import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
38 | import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
39 | import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
40 | import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
41 | import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
42 |
43 | import java.io.BufferedInputStream;
44 | import java.io.BufferedOutputStream;
45 | import java.io.IOException;
46 |
47 | /**
48 | * Gzip Archiver Implementation.
49 | *
50 | * @author Thiago Gutenberg Carvalho da Costa
51 | */
52 | public class GzipArchiver extends AbstractArchiver implements Archiver {
53 |
54 | @Override
55 | public String getMimeType() {
56 | return "application/x-gzip";
57 | }
58 |
59 | @Override
60 | public String getExtension() {
61 | return ".tgz";
62 | }
63 |
64 | @Override
65 | public ArchiveEntry createArchiveEntry(String targetPath, long targetSize, byte[] targetBytes) {
66 | TarArchiveEntry targzEntry = new TarArchiveEntry(targetPath);
67 | targzEntry.setSize(targetSize);
68 | return targzEntry;
69 | }
70 |
71 | @Override
72 | public ArchiveOutputStream createArchiveOutputStream(BufferedOutputStream bufferedOutputStream) throws IOException {
73 | return new TarArchiveOutputStream(new GzipCompressorOutputStream(bufferedOutputStream));
74 | }
75 |
76 | @Override
77 | public ArchiveInputStream createArchiveInputStream(BufferedInputStream bufferedInputStream) throws IOException {
78 | return new TarArchiveInputStream(new GzipCompressorInputStream(bufferedInputStream));
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/DuplicateCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.ElFinderConstants;
35 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
36 | import br.com.trustsystems.elfinder.service.VolumeHandler;
37 | import org.apache.commons.io.FilenameUtils;
38 | import org.json.JSONObject;
39 |
40 | import javax.servlet.http.HttpServletRequest;
41 | import java.util.ArrayList;
42 | import java.util.List;
43 |
44 | public class DuplicateCommand extends AbstractJsonCommand implements ElfinderCommand {
45 | @Override
46 | protected void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, JSONObject json) throws Exception {
47 | final String[] targets = request.getParameterValues(ElFinderConstants.ELFINDER_PARAMETER_TARGETS);
48 |
49 | List added = new ArrayList<>();
50 |
51 | for (String target : targets) {
52 | final VolumeHandler volumeHandler = findTarget(elfinderStorage, target);
53 | final String name = volumeHandler.getName();
54 | String baseName = FilenameUtils.getBaseName(name);
55 | final String extension = FilenameUtils.getExtension(name);
56 |
57 | int i = 1;
58 | VolumeHandler newFile;
59 | baseName = baseName.replaceAll("\\(\\d+\\)$", "");
60 |
61 | while (true) {
62 | String newName = String.format("%s(%d)%s", baseName, i, (extension == null || extension.isEmpty() ? ""
63 | : "." + extension));
64 | newFile = new VolumeHandler(volumeHandler.getParent(), newName);
65 | if (!newFile.exists()) {
66 | break;
67 | }
68 | i++;
69 | }
70 |
71 | createAndCopy(volumeHandler, newFile);
72 | added.add(newFile);
73 | }
74 | json.put(ElFinderConstants.ELFINDER_JSON_RESPONSE_ADDED, buildJsonFilesArray(request, added));
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/elfinder/elfinder-java-connector-master/src/main/java/br/com/trustsystems/elfinder/command/TmbCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * %%
4 | * Copyright (C) 2015 Trustsystems Desenvolvimento de Sistemas, LTDA.
5 | * %%
6 | * Redistribution and use in source and binary forms, with or without modification,
7 | * are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the Trustsystems Desenvolvimento de Sistemas, LTDA. nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | * #L%
31 | */
32 | package br.com.trustsystems.elfinder.command;
33 |
34 | import br.com.trustsystems.elfinder.service.ElfinderStorage;
35 | import br.com.trustsystems.elfinder.service.VolumeHandler;
36 | import com.mortennobel.imagescaling.DimensionConstrain;
37 | import com.mortennobel.imagescaling.ResampleOp;
38 | import org.joda.time.DateTime;
39 | import org.joda.time.format.DateTimeFormat;
40 | import org.joda.time.format.DateTimeFormatter;
41 |
42 | import javax.imageio.ImageIO;
43 | import javax.servlet.http.HttpServletRequest;
44 | import javax.servlet.http.HttpServletResponse;
45 | import java.awt.image.BufferedImage;
46 | import java.io.ByteArrayOutputStream;
47 | import java.io.InputStream;
48 |
49 | public class TmbCommand extends AbstractCommand implements ElfinderCommand {
50 | @Override
51 | public void execute(ElfinderStorage elfinderStorage, HttpServletRequest request, HttpServletResponse response) throws Exception {
52 |
53 | String target = request.getParameter("target");
54 | VolumeHandler fsi = super.findTarget(elfinderStorage, target);
55 |
56 | final DateTime dateTime = new DateTime();
57 | final String pattern = "d MMM yyyy HH:mm:ss 'GMT'";
58 | final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(pattern);
59 |
60 | try (InputStream is = fsi.openInputStream()) {
61 | BufferedImage image = ImageIO.read(is);
62 | int width = 80;
63 | ResampleOp rop = new ResampleOp(DimensionConstrain.createMaxDimension(width, -1));
64 | rop.setNumberOfThreads(4);
65 | BufferedImage b = rop.filter(image, null);
66 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
67 | ImageIO.write(b, "png", baos);
68 |
69 | response.setHeader("Last-Modified", dateTimeFormatter.print(dateTime));
70 | response.setHeader("Expires", dateTimeFormatter.print(dateTime.plusYears(2)));
71 |
72 | ImageIO.write(b, "png", response.getOutputStream());
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------