[maven-release-plugin] copy for tag chemistry-opencmis-0.13.0-RC1
git-svn-id: https://svn.apache.org/repos/asf/chemistry/opencmis/tags/chemistry-opencmis-0.13.0-RC1@1670131 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/chemistry-opencmis-dist/pom.xml b/chemistry-opencmis-dist/pom.xml
index ccdb186..d07f791 100644
--- a/chemistry-opencmis-dist/pom.xml
+++ b/chemistry-opencmis-dist/pom.xml
@@ -131,38 +131,6 @@
</activation>
<build>
<plugins>
- <!-- Fetches docs from ${docs.download.directory} -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.1.1</version>
- <inherited>false</inherited>
- <executions>
- <execution>
- <id>fetch-docs</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>exec</goal>
- </goals>
- <configuration>
- <executable>wget</executable>
- <arguments>
- <argument>--directory-prefix=${docs.download.directory}</argument>
- <argument>--domains=chemistry.apache.org</argument>
- <argument>--mirror</argument>
- <argument>-k</argument>
- <argument>-np</argument>
- <argument>--include-directories=/java/</argument>
- <argument>--exclude-directories=/java/0.4.0/maven/,/java/0.5.0/maven/,/java/0.6.0/maven/,/java/0.7.0/maven/</argument>
- <argument>${docs.start.url}</argument>
- </arguments>
- <successCodes>
- <successCode>8</successCode>
- </successCodes>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
@@ -180,9 +148,6 @@
<descriptor>
src/main/assembly/server-webapps-assembly.xml
</descriptor>
- <descriptor>
- src/main/assembly/docs-assembly.xml
- </descriptor>
</descriptors>
</configuration>
</execution>
diff --git a/chemistry-opencmis-dist/src/main/assembly/docs-assembly.xml b/chemistry-opencmis-dist/src/main/assembly/docs-assembly.xml
deleted file mode 100644
index eb1289f..0000000
--- a/chemistry-opencmis-dist/src/main/assembly/docs-assembly.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Lice nsed to the Apache Software Foundation (ASF) under one or
- more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding
- copyright ownership. The ASF licenses this file to you under the
- Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain
- a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions
- and limitations under the License.
- -->
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
- <!-- To build this, run "mvn package assembly:assembly" -->
- <id>docs</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/downloaded-site/chemistry.apache.org/java</directory>
- <outputDirectory>sitedocs</outputDirectory>
- <includes>
- <include>**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${parentBasedir}/target/site/apidocs</directory>
- <outputDirectory>javadocs</outputDirectory>
- <includes>
- <include>**</include>
- </includes>
- </fileSet>
- <!-- license, readme, etc. calculated at build time -->
- <fileSet>
- <directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
- <outputDirectory>/</outputDirectory>
- <excludes>
- <exclude>DEPENDENCIES</exclude>
- <exclude>NOTICE</exclude>
- </excludes>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/src/main/resources</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>DEPENDENCIES</include>
- <include>NOTICE</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/trunk/README.txt b/trunk/README.txt
deleted file mode 100644
index 86fefff..0000000
--- a/trunk/README.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-=========================
-Apache Chemistry OpenCMIS
-=========================
-
-OpenCMIS is a collection of Java libraries, frameworks and tools around
-the CMIS (Content Management Interoperability Services) specification.
-
-OpenCMIS supports the specification versions
- - CMIS 1.0 <http://docs.oasis-open.org/cmis/CMIS/v1.0/cmis-spec-v1.0.html>
- - CMIS 1.1 <http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html>
-
-
-Building OpenCMIS
-=================
-
-You can build OpenCMIS like this:
-
- mvn clean install
-
-You need Maven 3 with Java 6 (or higher) for the build.
-Set the environment variable MAVEN_OPTS to
-'-Xmx1024m -XX:MaxPermSize=256m' to give Maven more memory.
-
-License (see also package specific LICENSE files)
-=================================================
-
-Collective work: Copyright 2010-2015 The Apache Software Foundation.
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Dependencies with "Weak Copyleft" or dual licenses
-==================================================
-
-OpenCMIS uses some libraries with open source licenses that require reciprocal
-licensing when modified. These libraries are included in unmodified binary
-form and can be redistributed under terms that are compatible with the
-Apache License.
-
-Some libraries used by OpenCMIS are dual-licensed under different open source
-licenses. These libraries are redistributed under the license whose terms
-are compatible with the Apache License.
-
-See LICENSE file included in all Apache Chemistry OpenCMIS packages for
-full licensing details.
-
diff --git a/trunk/_dev/Formatting_presets.xml b/trunk/_dev/Formatting_presets.xml
deleted file mode 100644
index a2d2771..0000000
--- a/trunk/_dev/Formatting_presets.xml
+++ /dev/null
@@ -1,290 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<profiles version="11">
-<profile kind="CodeFormatterProfile" name="OpenCMIS" version="11">
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-</profile>
-</profiles>
diff --git a/trunk/_dev/codetemplates.xml b/trunk/_dev/codetemplates.xml
deleted file mode 100644
index dce79e2..0000000
--- a/trunk/_dev/codetemplates.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-${package_declaration}
-
-${typecomment}
-${type_declaration}</template></templates>
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/README b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/README
deleted file mode 100644
index afc0933..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/README
+++ /dev/null
@@ -1,127 +0,0 @@
-OpenCMIS Android Client
-=======================
-
-The OpenCMIS Android Client provides a collection of methods to access and manage CMIS Repository.
-
-
-OpenCMIS Client Bindings supported
-----------------------------------
-OpenCMIS Android Client supports the AtomPub Binding and the Browser Binding.
-The Web Service Binding (SOAP protocol) is not supported by this library.
-
-
-Android Version Supported
--------------------------
-Previous versions of Android don't contain all dependencies required to run and use OpenCMIS Android client.
-It's only since Android 2.3 (aka Gingerbread) everything works.
-In other terms, Android client supports Android 2.3 and above.
-
--------------------------
- !!! IMPORTANT NOTE !!!
--------------------------
-OpenCMIS Android Client is a SYNCHRONOUS library !
-It's highly recommended that you encapsulate all CMIS operations in background thread.
-In Android it's possible to use
-+ Services
-+ Loaders
-+ AsyncTask
-+ Thread/Handler
-
-For more information on Thread and background task : <http://developer.android.com/guide/components/processes-and-threads.html>
-
-
-Importing the Android OpenCMIS Client into your Android Project
----------------------------------------------------------------
-
-The Android OpenCMIS Client requires SLF4J for android.
-Download it from here: <http://www.slf4j.org/android/>
-
-Put the Android OpenCMIS Client Jar and SLF4J jar into your Android project libs folder.
-Now you're ready to use OpenCMIS inside your project.
-
-For more information on Project libs folder : <http://tools.android.com/recent/dealingwithdependenciesinandroidprojects>
-
-Importing the Android OpenCMIS Client with Maven
-------------------------------------------------
-If you use Maven to build your Android Project, it's possible to add this library as Maven dependency.
-
-Add to your pom project :
-
-<dependencies>
- ...
- <dependency>
- <groupId>com.google.android</groupId>
- <artifactId>annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis-android-client</artifactId>
- <version>x.z.y</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-android</artifactId>
- <version>1.7.5</version>
- </dependency>
- ...
-</dependencies>
-
-
-Code sample
------------
-This code sample illustrates how to display in a simple TextView a list of folder children.
-
-public class FirstOpenCMISActivity extends Activity {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- new FirstOpenCMISAsyncTask().execute();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.activity_main, menu);
- return true;
- }
-
-
- private class FirstOpenCMISAsyncTask extends AsyncTask<Void, Void, String>
- {
- @Override
- protected String doInBackground(Void... arg0) {
-
- SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
- Map<String, String> parameter = new HashMap<String, String>();
- parameter.put(SessionParameter.USER, "admin");
- parameter.put(SessionParameter.PASSWORD, "admin");
- parameter.put(SessionParameter.ATOMPUB_URL, "http://192.168.1.100:8080/inmemory/atom/");
- parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
- Repository repository = sessionFactory.getRepositories(parameter).get(0);
- parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());
- Session session = sessionFactory.createSession(parameter);
-
- String listChildren = "";
- Folder mediaFolder = (Folder) session.getObjectByPath("/media");
- ItemIterable<CmisObject> children = mediaFolder.getChildren();
- for (CmisObject o : children) {
- listChildren += o.getName() + " - " + o.getType().getDisplayName() + " - " + o.getCreatedBy() + "\b\n";
- }
-
- return listChildren;
- }
-
- @Override
- protected void onPostExecute(String result) {
- TextView tv = (TextView) (FirstOpenCMISActivity.this).findViewById(R.id.opencmis_text);
- tv.setText(result);
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/pom.xml b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/pom.xml
deleted file mode 100644
index f005d91..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/pom.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
- <!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions
- and limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis</artifactId>
- <version>0.13.0</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>chemistry-opencmis-android-client</artifactId>
- <name>OpenCMIS Android Client</name>
- <packaging>jar</packaging>
-
- <properties>
- <parentBasedir>../../</parentBasedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>com.google.android</groupId>
- <artifactId>android</artifactId>
- <version>2.3.3</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <configuration>
- <target>
- <property name="gendir" value="${project.build.directory}/opencmis-core" />
-
- <property name="basedir" value="${maven.basedir}" />
- <property name="commons-api" value="${basedir}/../../chemistry-opencmis-commons/chemistry-opencmis-commons-api" />
- <property name="commons-impl" value="${basedir}/../../chemistry-opencmis-commons/chemistry-opencmis-commons-impl" />
- <property name="client-bindings" value="${basedir}/../../chemistry-opencmis-client/chemistry-opencmis-client-bindings" />
- <property name="client-api" value="${basedir}/../../chemistry-opencmis-client/chemistry-opencmis-client-api" />
- <property name="client-impl" value="${basedir}/../../chemistry-opencmis-client/chemistry-opencmis-client-impl" />
-
- <property name="sourcefiles" value="src/main/java" />
-
- <copy todir="${gendir}">
- <fileset dir="${commons-api}/${sourcefiles}">
- <include name="**/*.java" />
- </fileset>
- </copy>
-
- <copy todir="${gendir}">
- <fileset dir="${commons-impl}/${sourcefiles}">
- <include name="**/*.java" />
- <exclude name="**/tube/**" />
- <exclude name="**/jaxb/**" />
- <exclude name="**/webservices/**" />
- <exclude name="**/impl/WSConverter.*" />
- <exclude name="**/impl/XMLConverter.*" />
- <exclude name="**/impl/XMLConverter.*" />
- <exclude name="**/impl/XMLUtils.*" />
- <exclude name="**/impl/XMLWalker.*" />
- </fileset>
- </copy>
-
- <copy todir="${gendir}">
- <fileset dir="${client-bindings}/${sourcefiles}">
- <include name="**/*.java" />
- <exclude name="**/spi/LTPAWSSecurityAuthenticationProvider.*" />
- <exclude name="**/spi/local/**" />
- <exclude name="**/spi/http/DefaultHttpInvoker.*" />
- <exclude name="**/spi/http/ApacheClientHttpInvoker.*" />
- <exclude name="**/spi/webservices/**" />
- <exclude name="**/spi/atompub/**" />
- </fileset>
- </copy>
-
- <copy todir="${gendir}">
- <fileset dir="${client-api}/${sourcefiles}">
- <include name="**/*.java" />
- </fileset>
- </copy>
-
- <copy todir="${gendir}">
- <fileset dir="${client-impl}/${sourcefiles}">
- <include name="**/*.java" />
- <exclude name="**/TypeUtils.java" />
- <exclude name="**/osgi/**" />
- </fileset>
- </copy>
-
- <replace dir="${gendir}" token="javax.xml.ws.handler.HandlerResolver" value="org.apache.chemistry.opencmis.client.bindings.spi.HandlerResolver" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/opencmis-core</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>pack</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <descriptors>
- <descriptor>
- src/main/assembly/assembly.xml
- </descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
-</project>
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/assembly/assembly.xml b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/assembly/assembly.xml
deleted file mode 100644
index 933eefa..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or
- more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding
- copyright ownership. The ASF licenses this file to you under the
- Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain
- a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions
- and limitations under the License.
- -->
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
- <id>pack</id>
- <formats>
- <format>zip</format>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <files>
- <file>
- <source>README</source>
- <outputDirectory></outputDirectory>
- </file>
- <file>
- <source>${project.build.directory}/${project.build.finalName}.jar</source>
- <outputDirectory></outputDirectory>
- </file>
- </files>
-
- <fileSets>
- <!-- license, readme, etc. calculated at build time -->
- <fileSet>
- <directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
- <outputDirectory>/</outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/HandlerResolver.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/HandlerResolver.java
deleted file mode 100644
index 3f3bbaa..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/HandlerResolver.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi;
-
-/**
- * Dummy interface, which replaces a JAX-WS interface that doesn't exits on
- * Android.
- */
-public interface HandlerResolver {
-
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
deleted file mode 100644
index 338e71f..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
+++ /dev/null
@@ -1,981 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
-import org.apache.chemistry.opencmis.client.bindings.impl.RepositoryInfoCache;
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.LinkAccess;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomBase;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.RepositoryWorkspace;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.ServiceDoc;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpInvoker;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.SessionParameter;
-import org.apache.chemistry.opencmis.commons.data.Ace;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisFilterNotValidException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisProxyAuthenticationException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
-import org.xmlpull.v1.XmlSerializer;
-
-/**
- * Base class for all AtomPub client services.
- */
-public abstract class AbstractAtomPubService implements LinkAccess {
-
- protected enum IdentifierType {
- ID, PATH
- }
-
- protected static final String NAME_COLLECTION = "collection";
- protected static final String NAME_URI_TEMPLATE = "uritemplate";
- protected static final String NAME_PATH_SEGMENT = "pathSegment";
- protected static final String NAME_RELATIVE_PATH_SEGMENT = "relativePathSegment";
- protected static final String NAME_NUM_ITEMS = "numItems";
-
- private BindingSession session;
-
- /**
- * Sets the current session.
- */
- protected void setSession(BindingSession session) {
- this.session = session;
- }
-
- /**
- * Gets the current session.
- */
- protected BindingSession getSession() {
- return session;
- }
-
- /**
- * Gets the HTTP Invoker object.
- */
- protected HttpInvoker getHttpInvoker() {
- return CmisBindingsHelper.getHttpInvoker(session);
- }
-
- /**
- * Returns the service document URL of this session.
- */
- protected String getServiceDocURL() {
- Object url = session.get(SessionParameter.ATOMPUB_URL);
- if (url instanceof String) {
- return (String) url;
- }
-
- return null;
- }
-
- /**
- * Return the CMIS version of the given repository.
- */
- protected CmisVersion getCmisVersion(String repositoryId) {
- if (CmisBindingsHelper.getForcedCmisVersion(session) != null) {
- return CmisBindingsHelper.getForcedCmisVersion(session);
- }
-
- RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session);
- RepositoryInfo info = cache.get(repositoryId);
-
- if (info == null) {
- List<RepositoryInfo> infoList = getRepositoriesInternal(repositoryId);
- if (isNotEmpty(infoList)) {
- info = infoList.get(0);
- cache.put(info);
- }
- }
-
- return (info == null ? CmisVersion.CMIS_1_0 : info.getCmisVersion());
- }
-
- // ---- link cache ----
-
- /**
- * Returns the link cache or creates a new cache if it doesn't exist.
- */
- protected LinkCache getLinkCache() {
- LinkCache linkCache = (LinkCache) getSession().get(SpiSessionParameter.LINK_CACHE);
- if (linkCache == null) {
- linkCache = new LinkCache(getSession());
- getSession().put(SpiSessionParameter.LINK_CACHE, linkCache);
- }
-
- return linkCache;
- }
-
- /**
- * Gets a link from the cache.
- */
- protected String getLink(String repositoryId, String id, String rel, String type) {
- if (repositoryId == null) {
- throw new CmisInvalidArgumentException("Repository id must be set!");
- }
-
- if (id == null) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- return getLinkCache().getLink(repositoryId, id, rel, type);
- }
-
- /**
- * Gets a link from the cache.
- */
- protected String getLink(String repositoryId, String id, String rel) {
- return getLink(repositoryId, id, rel, null);
- }
-
- /**
- * Gets a link from the cache if it is there or loads it into the cache if
- * it is not there.
- */
- public String loadLink(String repositoryId, String id, String rel, String type) {
- String link = getLink(repositoryId, id, rel, type);
- if (link == null) {
- getObjectInternal(repositoryId, IdentifierType.ID, id, ReturnVersion.THIS, null, null, null, null, null,
- null, null);
- link = getLink(repositoryId, id, rel, type);
- }
-
- return link;
- }
-
- /**
- * Gets the content link from the cache if it is there or loads it into the
- * cache if it is not there.
- */
- public String loadContentLink(String repositoryId, String id) {
- return loadLink(repositoryId, id, AtomPubParser.LINK_REL_CONTENT, null);
- }
-
- /**
- * Gets a rendition content link from the cache if it is there or loads it
- * into the cache if it is not there.
- */
- public String loadRenditionContentLink(String repositoryId, String id, String streamId) {
- return loadLink(repositoryId, id, Constants.REL_ALTERNATE, streamId);
- }
-
- /**
- * Adds a link to the cache.
- */
- protected void addLink(String repositoryId, String id, String rel, String type, String link) {
- getLinkCache().addLink(repositoryId, id, rel, type, link);
- }
-
- /**
- * Adds a link to the cache.
- */
- protected void addLink(String repositoryId, String id, AtomLink link) {
- getLinkCache().addLink(repositoryId, id, link.getRel(), link.getType(), link.getHref());
- }
-
- /**
- * Removes all links of an object.
- */
- protected void removeLinks(String repositoryId, String id) {
- getLinkCache().removeLinks(repositoryId, id);
- }
-
- /**
- * Locks the link cache.
- */
- protected void lockLinks() {
- getLinkCache().lockLinks();
- }
-
- /**
- * Unlocks the link cache.
- */
- protected void unlockLinks() {
- getLinkCache().unlockLinks();
- }
-
- /**
- * Checks a link throw an appropriate exception.
- */
- protected void throwLinkException(String repositoryId, String id, String rel, String type) {
- int index = getLinkCache().checkLink(repositoryId, id, rel, type);
-
- switch (index) {
- case 0:
- throw new CmisObjectNotFoundException("Unknown repository!");
- case 1:
- throw new CmisObjectNotFoundException("Unknown object!");
- case 2:
- throw new CmisNotSupportedException("Operation not supported by the repository for this object!");
- case 3:
- throw new CmisNotSupportedException("No link with matching media type!");
- case 4:
- throw new CmisRuntimeException("Nothing wrong! Either this is a bug or a threading issue.");
- default:
- throw new CmisRuntimeException("Unknown error!");
- }
- }
-
- /**
- * Gets a type link from the cache.
- */
- protected String getTypeLink(String repositoryId, String typeId, String rel, String type) {
- if (repositoryId == null) {
- throw new CmisInvalidArgumentException("Repository id must be set!");
- }
-
- if (typeId == null) {
- throw new CmisInvalidArgumentException("Type id must be set!");
- }
-
- return getLinkCache().getTypeLink(repositoryId, typeId, rel, type);
- }
-
- /**
- * Gets a type link from the cache.
- */
- protected String getTypeLink(String repositoryId, String typeId, String rel) {
- return getTypeLink(repositoryId, typeId, rel, null);
- }
-
- /**
- * Gets a link from the cache if it is there or loads it into the cache if
- * it is not there.
- */
- protected String loadTypeLink(String repositoryId, String typeId, String rel, String type) {
- String link = getTypeLink(repositoryId, typeId, rel, type);
- if (link == null) {
- getTypeDefinitionInternal(repositoryId, typeId);
- link = getTypeLink(repositoryId, typeId, rel, type);
- }
-
- return link;
- }
-
- /**
- * Adds a type link to the cache.
- */
- protected void addTypeLink(String repositoryId, String typeId, String rel, String type, String link) {
- getLinkCache().addTypeLink(repositoryId, typeId, rel, type, link);
- }
-
- /**
- * Adds a type link to the cache.
- */
- protected void addTypeLink(String repositoryId, String typeId, AtomLink link) {
- getLinkCache().addTypeLink(repositoryId, typeId, link.getRel(), link.getType(), link.getHref());
- }
-
- /**
- * Removes all links of a type.
- */
- protected void removeTypeLinks(String repositoryId, String id) {
- getLinkCache().removeTypeLinks(repositoryId, id);
- }
-
- /**
- * Locks the type link cache.
- */
- protected void lockTypeLinks() {
- getLinkCache().lockTypeLinks();
- }
-
- /**
- * Unlocks the type link cache.
- */
- protected void unlockTypeLinks() {
- getLinkCache().unlockTypeLinks();
- }
-
- /**
- * Gets a collection from the cache.
- */
- protected String getCollection(String repositoryId, String collection) {
- return getLinkCache().getCollection(repositoryId, collection);
- }
-
- /**
- * Gets a collection from the cache if it is there or loads it into the
- * cache if it is not there.
- */
- protected String loadCollection(String repositoryId, String collection) {
- String link = getCollection(repositoryId, collection);
- if (link == null) {
- // cache repository info
- getRepositoriesInternal(repositoryId);
- link = getCollection(repositoryId, collection);
- }
-
- return link;
- }
-
- /**
- * Adds a collection to the cache.
- */
- protected void addCollection(String repositoryId, String collection, String link) {
- getLinkCache().addCollection(repositoryId, collection, link);
- }
-
- /**
- * Gets a repository link from the cache.
- */
- protected String getRepositoryLink(String repositoryId, String rel) {
- return getLinkCache().getRepositoryLink(repositoryId, rel);
- }
-
- /**
- * Gets a repository link from the cache if it is there or loads it into the
- * cache if it is not there.
- */
- protected String loadRepositoryLink(String repositoryId, String rel) {
- String link = getRepositoryLink(repositoryId, rel);
- if (link == null) {
- // cache repository info
- getRepositoriesInternal(repositoryId);
- link = getRepositoryLink(repositoryId, rel);
- }
-
- return link;
- }
-
- /**
- * Adds a repository link to the cache.
- */
- protected void addRepositoryLink(String repositoryId, String rel, String link) {
- getLinkCache().addRepositoryLink(repositoryId, rel, link);
- }
-
- /**
- * Adds a repository link to the cache.
- */
- protected void addRepositoryLink(String repositoryId, AtomLink link) {
- addRepositoryLink(repositoryId, link.getRel(), link.getHref());
- }
-
- /**
- * Gets an URI template from the cache.
- */
- protected String getTemplateLink(String repositoryId, String type, Map<String, Object> parameters) {
- return getLinkCache().getTemplateLink(repositoryId, type, parameters);
- }
-
- /**
- * Gets a template link from the cache if it is there or loads it into the
- * cache if it is not there.
- */
- protected String loadTemplateLink(String repositoryId, String type, Map<String, Object> parameters) {
- String link = getTemplateLink(repositoryId, type, parameters);
- if (link == null) {
- // cache repository info
- getRepositoriesInternal(repositoryId);
- link = getTemplateLink(repositoryId, type, parameters);
- }
-
- return link;
- }
-
- /**
- * Adds an URI template to the cache.
- */
- protected void addTemplate(String repositoryId, String type, String link) {
- getLinkCache().addTemplate(repositoryId, type, link);
- }
-
- // ---- exceptions ----
-
- /**
- * Converts a HTTP status code into an Exception.
- */
- protected CmisBaseException convertStatusCode(int code, String message, String errorContent, Throwable t) {
- String exception = extractException(errorContent);
- message = extractErrorMessage(message, errorContent);
-
- switch (code) {
- case 301:
- case 302:
- case 303:
- case 307:
- return new CmisConnectionException("Redirects are not supported (HTTP status code " + code + "): "
- + message, errorContent, t);
- case 400:
- if (CmisFilterNotValidException.EXCEPTION_NAME.equals(exception)) {
- return new CmisFilterNotValidException(message, errorContent, t);
- }
- return new CmisInvalidArgumentException(message, errorContent, t);
- case 401:
- return new CmisUnauthorizedException(message, errorContent, t);
- case 403:
- if (CmisStreamNotSupportedException.EXCEPTION_NAME.equals(exception)) {
- return new CmisStreamNotSupportedException(message, errorContent, t);
- }
- return new CmisPermissionDeniedException(message, errorContent, t);
- case 404:
- return new CmisObjectNotFoundException(message, errorContent, t);
- case 405:
- return new CmisNotSupportedException(message, errorContent, t);
- case 407:
- return new CmisProxyAuthenticationException(message, errorContent, t);
- case 409:
- if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equals(exception)) {
- return new CmisContentAlreadyExistsException(message, errorContent, t);
- } else if (CmisVersioningException.EXCEPTION_NAME.equals(exception)) {
- return new CmisVersioningException(message, errorContent, t);
- } else if (CmisUpdateConflictException.EXCEPTION_NAME.equals(exception)) {
- return new CmisUpdateConflictException(message, errorContent, t);
- } else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equals(exception)) {
- return new CmisNameConstraintViolationException(message, errorContent, t);
- }
- return new CmisConstraintException(message, errorContent, t);
- default:
- if (CmisStorageException.EXCEPTION_NAME.equals(exception)) {
- return new CmisStorageException(message, errorContent, t);
- }
- return new CmisRuntimeException(message, errorContent, t);
- }
- }
-
- protected String extractException(String errorContent) {
- if (errorContent == null) {
- return null;
- }
-
- int begin = errorContent.indexOf("<!--exception-->");
- int end = errorContent.indexOf("<!--/exception-->");
-
- if (begin == -1 || end == -1 || begin > end) {
- return null;
- }
-
- return errorContent.substring(begin + "<!--exception-->".length(), end);
- }
-
- protected String extractErrorMessage(String message, String errorContent) {
- if (errorContent == null) {
- return message;
- }
-
- int begin = errorContent.indexOf("<!--message-->");
- int end = errorContent.indexOf("<!--/message-->");
-
- if (begin == -1 || end == -1 || begin > end) {
- return message;
- }
-
- return errorContent.substring(begin + "<!--message-->".length(), end);
- }
-
- // ---- helpers ----
-
- protected boolean is(String name, AtomElement element) {
- return name.equals(element.getName().getLocalPart());
- }
-
- protected boolean isStr(String name, AtomElement element) {
- return is(name, element) && (element.getObject() instanceof String);
- }
-
- protected boolean isInt(String name, AtomElement element) {
- return is(name, element) && (element.getObject() instanceof BigInteger);
- }
-
- protected boolean isNextLink(AtomElement element) {
- return Constants.REL_NEXT.equals(((AtomLink) element.getObject()).getRel());
- }
-
- /**
- * Creates a CMIS object with properties and policy ids.
- */
- protected ObjectDataImpl createObject(Properties properties, String changeToken, List<String> policies) {
- ObjectDataImpl object = new ObjectDataImpl();
-
- if (properties == null) {
- properties = new PropertiesImpl();
- if (changeToken != null) {
- ((PropertiesImpl) properties)
- .addProperty(new PropertyStringImpl(PropertyIds.CHANGE_TOKEN, changeToken));
- }
- } else if (changeToken != null && !properties.getProperties().containsKey(PropertyIds.CHANGE_TOKEN)) {
- properties = new PropertiesImpl(properties);
- ((PropertiesImpl) properties).addProperty(new PropertyStringImpl(PropertyIds.CHANGE_TOKEN, changeToken));
- }
- object.setProperties(properties);
-
- if (policies != null && !policies.isEmpty()) {
- PolicyIdListImpl policyIdList = new PolicyIdListImpl();
- policyIdList.setPolicyIds(policies);
- object.setPolicyIds(policyIdList);
- }
-
- return object;
- }
-
- /**
- * Creates a CMIS object that only contains an id in the property list.
- */
- protected ObjectData createIdObject(String objectId) {
- ObjectDataImpl object = new ObjectDataImpl();
-
- PropertiesImpl properties = new PropertiesImpl();
- object.setProperties(properties);
-
- properties.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_ID, objectId));
-
- return object;
- }
-
- /**
- * Parses an input stream.
- */
- @SuppressWarnings("unchecked")
- protected <T extends AtomBase> T parse(InputStream stream, Class<T> clazz) {
- AtomPubParser parser = new AtomPubParser(stream);
-
- try {
- parser.parse();
- } catch (Exception e) {
- throw new CmisConnectionException("Parsing exception!", e);
- }
-
- AtomBase parseResult = parser.getResults();
-
- if (!clazz.isInstance(parseResult)) {
- throw new CmisConnectionException("Unexpected document! Received: "
- + (parseResult == null ? "something unknown" : parseResult.getType()));
- }
-
- return (T) parseResult;
- }
-
- /**
- * Performs a GET on an URL, checks the response code and returns the
- * result.
- */
- protected Response read(UrlBuilder url) {
- // make the call
- // Log.d("URL", url.toString());
- Response resp = getHttpInvoker().invokeGET(url, session);
-
- // check response code
- if (resp.getResponseCode() != 200) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- return resp;
- }
-
- /**
- * Performs a POST on an URL, checks the response code and returns the
- * result.
- */
- protected Response post(UrlBuilder url, String contentType, Output writer) {
- // make the call
- // Log.d("URL", url.toString());
- Response resp = getHttpInvoker().invokePOST(url, contentType, writer, session);
-
- // check response code
- if (resp.getResponseCode() != 201) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- return resp;
- }
-
- /**
- * Performs a PUT on an URL, checks the response code and returns the
- * result.
- */
- protected Response put(UrlBuilder url, String contentType, Output writer) {
- return put(url, contentType, null, writer);
- }
-
- /**
- * Performs a PUT on an URL, checks the response code and returns the
- * result.
- */
- protected Response put(UrlBuilder url, String contentType, Map<String, String> headers, Output writer) {
- // make the call
- // Log.d("URL", url.toString());
- Response resp = getHttpInvoker().invokePUT(url, contentType, headers, writer, session);
-
- // check response code
- if ((resp.getResponseCode() < 200) || (resp.getResponseCode() > 299)) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- return resp;
- }
-
- /**
- * Performs a DELETE on an URL, checks the response code and returns the
- * result.
- */
- protected void delete(UrlBuilder url) {
- // make the call
- // Log.d("URL", url.toString());
- Response resp = getHttpInvoker().invokeDELETE(url, session);
-
- // check response code
- if (resp.getResponseCode() != 204) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
- }
-
- // ---- common operations ----
-
- /**
- * Checks if at least one ACE list is not empty.
- */
- protected boolean isAclMergeRequired(Acl addAces, Acl removeAces) {
- return (addAces != null && addAces.getAces() != null && !addAces.getAces().isEmpty())
- || (removeAces != null && removeAces.getAces() != null && !removeAces.getAces().isEmpty());
- }
-
- /**
- * Merges the new ACL from original, add and remove ACEs lists.
- */
- protected Acl mergeAcls(Acl originalAces, Acl addAces, Acl removeAces) {
- Map<String, Set<String>> originals = convertAclToMap(originalAces);
- Map<String, Set<String>> adds = convertAclToMap(addAces);
- Map<String, Set<String>> removes = convertAclToMap(removeAces);
- List<Ace> newAces = new ArrayList<Ace>();
-
- // iterate through the original ACEs
- for (Map.Entry<String, Set<String>> ace : originals.entrySet()) {
-
- // add permissions
- Set<String> addPermissions = adds.get(ace.getKey());
- if (addPermissions != null) {
- ace.getValue().addAll(addPermissions);
- }
-
- // remove permissions
- Set<String> removePermissions = removes.get(ace.getKey());
- if (removePermissions != null) {
- ace.getValue().removeAll(removePermissions);
- }
-
- // create new ACE
- if (!ace.getValue().isEmpty()) {
- newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
- new ArrayList<String>(ace.getValue())));
- }
- }
-
- // find all ACEs that should be added but are not in the original ACE
- // list
- for (Map.Entry<String, Set<String>> ace : adds.entrySet()) {
- if (!originals.containsKey(ace.getKey()) && !ace.getValue().isEmpty()) {
- newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
- new ArrayList<String>(ace.getValue())));
- }
- }
-
- return new AccessControlListImpl(newAces);
- }
-
- /**
- * Converts a list of ACEs into Map for better handling.
- */
- private static Map<String, Set<String>> convertAclToMap(Acl acl) {
- Map<String, Set<String>> result = new HashMap<String, Set<String>>();
-
- if (acl == null || acl.getAces() == null) {
- return result;
- }
-
- for (Ace ace : acl.getAces()) {
- // don't consider indirect ACEs - we can't change them
- if (!ace.isDirect()) {
- // ignore
- continue;
- }
-
- // although a principal must not be null, check it
- if (ace.getPrincipal() == null || ace.getPrincipal().getId() == null) {
- // ignore
- continue;
- }
-
- Set<String> permissions = result.get(ace.getPrincipal().getId());
- if (permissions == null) {
- permissions = new HashSet<String>();
- result.put(ace.getPrincipal().getId(), permissions);
- }
-
- if (ace.getPermissions() != null) {
- permissions.addAll(ace.getPermissions());
- }
- }
-
- return result;
- }
-
- /**
- * Retrieves the Service Document from the server and caches the repository
- * info objects, collections, links, URI templates, etc.
- */
- @SuppressWarnings("unchecked")
- protected List<RepositoryInfo> getRepositoriesInternal(String repositoryId) {
- List<RepositoryInfo> repInfos = new ArrayList<RepositoryInfo>();
-
- // retrieve service doc
- UrlBuilder url = new UrlBuilder(getServiceDocURL());
- url.addParameter(Constants.PARAM_REPOSITORY_ID, repositoryId);
-
- // read and parse
- Response resp = read(url);
- ServiceDoc serviceDoc = parse(resp.getStream(), ServiceDoc.class);
-
- // walk through the workspaces
- for (RepositoryWorkspace ws : serviceDoc.getWorkspaces()) {
- if (ws.getId() == null) {
- // found a non-CMIS workspace
- continue;
- }
-
- for (AtomElement element : ws.getElements()) {
- if (is(NAME_COLLECTION, element)) {
- Map<String, String> colMap = (Map<String, String>) element.getObject();
- addCollection(ws.getId(), colMap.get("collectionType"), colMap.get("href"));
- } else if (element.getObject() instanceof AtomLink) {
- addRepositoryLink(ws.getId(), (AtomLink) element.getObject());
- } else if (is(NAME_URI_TEMPLATE, element)) {
- Map<String, String> tempMap = (Map<String, String>) element.getObject();
- addTemplate(ws.getId(), tempMap.get("type"), tempMap.get("template"));
- } else if (element.getObject() instanceof RepositoryInfo) {
- repInfos.add((RepositoryInfo) element.getObject());
- }
- }
- }
-
- return repInfos;
- }
-
- /**
- * Retrieves an object from the server and caches the links.
- */
- protected ObjectData getObjectInternal(String repositoryId, IdentifierType idOrPath, String objectIdOrPath,
- ReturnVersion returnVersion, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeAcl, ExtensionsData extension) {
-
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put(Constants.PARAM_ID, objectIdOrPath);
- parameters.put(Constants.PARAM_PATH, objectIdOrPath);
- parameters.put(Constants.PARAM_RETURN_VERSION, returnVersion);
- parameters.put(Constants.PARAM_FILTER, filter);
- parameters.put(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- parameters.put(Constants.PARAM_ACL, includeAcl);
- parameters.put(Constants.PARAM_POLICY_IDS, includePolicyIds);
- parameters.put(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- parameters.put(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-
- String link = loadTemplateLink(repositoryId, (idOrPath == IdentifierType.ID ? Constants.TEMPLATE_OBJECT_BY_ID
- : Constants.TEMPLATE_OBJECT_BY_PATH), parameters);
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- // workaround for missing template parameter in the CMIS spec
- if (returnVersion != null && returnVersion != ReturnVersion.THIS) {
- url.addParameter(Constants.PARAM_RETURN_VERSION, returnVersion);
- }
-
- // read and parse
- Response resp = read(url);
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- lockLinks();
- ObjectData result = null;
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- result = (ObjectData) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- return result;
- }
-
- /**
- * Retrieves a type definition.
- */
- protected TypeDefinition getTypeDefinitionInternal(String repositoryId, String typeId) {
-
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put(Constants.PARAM_ID, typeId);
-
- String link = loadTemplateLink(repositoryId, Constants.TEMPLATE_TYPE_BY_ID, parameters);
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository!");
- }
-
- // read and parse
- Response resp = read(new UrlBuilder(link));
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- lockTypeLinks();
- TypeDefinition result = null;
- try {
- // clean up cache
- removeTypeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof TypeDefinition) {
- result = (TypeDefinition) element.getObject();
- }
- }
- } finally {
- unlockTypeLinks();
- }
-
- return result;
- }
-
- /**
- * Retrieves the ACL of an object.
- */
- public Acl getAclInternal(String repositoryId, String objectId, Boolean onlyBasicPermissions,
- ExtensionsData extension) {
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_ONLY_BASIC_PERMISSIONS, onlyBasicPermissions);
-
- // read and parse
- Response resp = read(url);
- AtomAcl acl = parse(resp.getStream(), AtomAcl.class);
-
- return acl.getACL();
- }
-
- /**
- * Updates the ACL of an object.
- */
- protected AtomAcl updateAcl(String repositoryId, String objectId, final Acl acl, AclPropagation aclPropagation) {
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
- }
-
- UrlBuilder aclUrl = new UrlBuilder(link);
- aclUrl.addParameter(Constants.PARAM_ACL_PROPAGATION, aclPropagation);
-
- final CmisVersion cmisVersion = getCmisVersion(repositoryId);
-
- // update
- Response resp = put(aclUrl, Constants.MEDIATYPE_ACL, new Output() {
- public void write(OutputStream out) throws Exception {
- XmlSerializer writer = XMLUtils.createWriter(out);
- XMLUtils.startXmlDocument(writer);
- XMLConverter.writeAcl(writer, cmisVersion, true, acl);
- XMLUtils.endXmlDocument(writer);
- }
- });
-
- // parse new entry
- return parse(resp.getStream(), AtomAcl.class);
- }
-
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
deleted file mode 100644
index 3daf17a..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.spi.AclService;
-import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
-
-/**
- * ACL Service AtomPub client.
- */
-public class AclServiceImpl extends AbstractAtomPubService implements AclService, ExtendedAclService {
-
- /**
- * Constructor.
- */
- public AclServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
- AclPropagation aclPropagation, ExtensionsData extension) {
-
- // fetch the current ACL
- Acl originalAces = getAcl(repositoryId, objectId, false, null);
-
- // if no changes required, just return the ACL
- if (!isAclMergeRequired(addAces, removeAces)) {
- return originalAces;
- }
-
- // merge ACLs
- Acl newACL = mergeAcls(originalAces, addAces, removeAces);
-
- // update ACL
- AtomAcl acl = updateAcl(repositoryId, objectId, newACL, aclPropagation);
- Acl result = acl.getACL();
-
- return result;
- }
-
- public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
- return getAclInternal(repositoryId, objectId, onlyBasicPermissions, extension);
- }
-
- public Acl setAcl(String repositoryId, String objectId, Acl aces) {
- AtomAcl acl = updateAcl(repositoryId, objectId, aces, AclPropagation.OBJECTONLY);
- Acl result = acl.getACL();
-
- return result;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
deleted file mode 100644
index 00a936d..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ATOM_ID;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ATOM_TITLE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ATOM_UPDATED;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT_BASE64;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT_FILENAME;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT_MEDIATYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ENTRY;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.PropertyData;
-import org.apache.chemistry.opencmis.commons.data.PropertyString;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.impl.Base64;
-import org.apache.chemistry.opencmis.commons.impl.DateTimeHelper;
-import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateImpl;
-import org.xmlpull.v1.XmlSerializer;
-
-/**
- * Writes a CMIS Atom entry to an output stream.
- */
-public class AtomEntryWriter {
-
- private static final int BUFFER_SIZE = 8 * 1024;
-
- private final CmisVersion cmisVersion;
- private final ObjectData object;
- private final ContentStream contentStream;
- private final InputStream stream;
- private final TypeDefinition typeDef;
- private final BulkUpdateImpl bulkUpdate;
-
- /**
- * Constructor for objects.
- */
- public AtomEntryWriter(ObjectData object, CmisVersion cmisVersion) {
- this(object, cmisVersion, null);
- }
-
- /**
- * Constructor for objects.
- */
- public AtomEntryWriter(ObjectData object, CmisVersion cmisVersion, ContentStream contentStream) {
- if ((object == null) || (object.getProperties() == null)) {
- throw new CmisInvalidArgumentException("Object and properties must not be null!");
- }
-
- if ((contentStream != null) && (contentStream.getMimeType() == null)) {
- throw new CmisInvalidArgumentException("Media type must be set if a stream is present!");
- }
-
- this.object = object;
- this.cmisVersion = cmisVersion;
- this.contentStream = contentStream;
- if (contentStream != null && contentStream.getStream() != null) {
- InputStream in = contentStream.getStream();
-
- // avoid double buffering
- if (!(in instanceof BufferedInputStream) && !(in instanceof ByteArrayInputStream)) {
- stream = new BufferedInputStream(in, BUFFER_SIZE);
- } else {
- stream = in;
- }
- } else {
- stream = null;
- }
- this.typeDef = null;
- this.bulkUpdate = null;
- }
-
- /**
- * Constructor for types.
- */
- public AtomEntryWriter(TypeDefinition type, CmisVersion cmisVersion) {
- if (type == null) {
- throw new CmisInvalidArgumentException("Type must not be null!");
- }
-
- this.typeDef = type;
- this.cmisVersion = cmisVersion;
- this.object = null;
- this.contentStream = null;
- this.stream = null;
- this.bulkUpdate = null;
- }
-
- /**
- * Constructor for bulk updates.
- */
- public AtomEntryWriter(BulkUpdateImpl bulkUpdate) {
- if (bulkUpdate == null) {
- throw new CmisInvalidArgumentException("Bulk update data must not be null!");
- }
-
- this.bulkUpdate = bulkUpdate;
- this.typeDef = null;
- this.cmisVersion = CmisVersion.CMIS_1_1;
- this.object = null;
- this.contentStream = null;
- this.stream = null;
- }
-
- /**
- * Writes the entry to an output stream.
- *
- * @throws IOException
- * @throws IllegalStateException
- * @throws IllegalArgumentException
- */
- public void write(OutputStream out) throws IOException {
- XmlSerializer writer = XMLUtils.createWriter(out);
-
- // start doc
- XMLUtils.startXmlDocument(writer);
-
- // start entry
- writer.startTag(XMLConstants.NAMESPACE_ATOM, TAG_ENTRY);
-
- writer.attribute("", XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
- writer.attribute("", XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
- writer.attribute("", XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
-
- if (contentStream != null && contentStream.getFileName() != null) {
- writer.attribute("", XMLConstants.PREFIX_APACHE_CHEMISTY,XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
- }
-
-
- // atom:id
- writeTag(writer, XMLConstants.NAMESPACE_ATOM, TAG_ATOM_ID, "urn:uuid:00000000-0000-0000-0000-00000000000");
-
- // atom:title
- writeTag(writer, XMLConstants.NAMESPACE_ATOM, TAG_ATOM_TITLE, getTitle());
-
- // atom:updated
- writeTag(writer, XMLConstants.NAMESPACE_ATOM, TAG_ATOM_UPDATED, getUpdated());
-
- // content
- if (stream != null) {
- writer.startTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT);
-
- writeTag(writer, XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT_MEDIATYPE, contentStream.getMimeType());
-
- if (contentStream.getFileName() != null) {
- XMLUtils.write(writer, XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY,
- TAG_CONTENT_FILENAME, contentStream.getFileName());
- }
-
- writer.startTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT_BASE64);
- writeContent(writer);
- writer.endTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT_BASE64);
-
- writer.endTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT);
- }
-
- // object
- if (object != null) {
- XMLConverter.writeObject(writer, cmisVersion, XMLConstants.NAMESPACE_RESTATOM, object);
- }
-
- // type
- if (typeDef != null) {
- XMLConverter.writeTypeDefinition(writer, cmisVersion, XMLConstants.NAMESPACE_RESTATOM, typeDef);
- }
-
- // bulk update
- if (bulkUpdate != null) {
- XMLConverter.writeBulkUpdate(writer, XMLConstants.NAMESPACE_RESTATOM, bulkUpdate);
- }
-
- // end entry
- writer.endTag(XMLConstants.NAMESPACE_ATOM, TAG_ENTRY);
-
- // end document
- XMLUtils.endXmlDocument(writer);
- }
-
- // ---- internal ----
-
- private String getTitle() {
- String result = "";
-
- if (object != null) {
- PropertyData<?> nameProperty = object.getProperties().getProperties().get(PropertyIds.NAME);
- if (nameProperty instanceof PropertyString) {
- result = ((PropertyString) nameProperty).getFirstValue();
- }
- }
-
- if (typeDef != null) {
- if (typeDef.getDisplayName() != null) {
- result = typeDef.getDisplayName();
- }
- }
-
- if (bulkUpdate != null) {
- result = "Bulk Update Properties";
- }
-
- return result;
- }
-
- private void writeContent(XmlSerializer writer) throws IOException {
- @SuppressWarnings("resource")
- Base64.InputStream b64stream = new Base64.InputStream(stream, Base64.ENCODE);
-
- char[] buffer = new char[BUFFER_SIZE];
- int pos = 0;
- int b;
-
- while ((b = b64stream.read()) > -1) {
- buffer[pos++] = (char) (b & 0xFF);
- if (pos == buffer.length) {
- writer.text(buffer, 0, buffer.length);
- pos = 0;
- }
- }
- if (pos > 0) {
- writer.text(buffer, 0, pos);
- }
- }
-
- private static String getUpdated() {
- return DateTimeHelper.formatXmlDateTime(new GregorianCalendar(TimeZone.getTimeZone("GMT")));
- }
-
- private static void writeTag(XmlSerializer writer, String tagNameSpace, String tagName, String text)
- throws IOException {
- writer.startTag(tagNameSpace, tagName);
- writer.text(text);
- writer.endTag(tagNameSpace, tagName);
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
deleted file mode 100644
index ff31962..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.CONTENT_SRC;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_HREF;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_REL;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACL;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ALLOWABLEACTIONS;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CHILDREN;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_COLLECTION;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_COLLECTION_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ENTRY;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_FEED;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_HTML;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_LINK;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_NUM_ITEMS;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_PATH_SEGMENT;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_RELATIVE_PATH_SEGMENT;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPOSITORY_INFO;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_SERVICE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_TEMPLATE_TEMPLATE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_TEMPLATE_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_URI_TEMPLATE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_WORKSPACE;
-
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAllowableActions;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomBase;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.HtmlDoc;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.RepositoryWorkspace;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.ServiceDoc;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.IOUtils;
-import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
-import org.apache.chemistry.opencmis.commons.impl.XMLConstraints;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-/**
- * AtomPub Parser.
- */
-public class AtomPubParser {
-
- // public constants
- public static final String LINK_REL_CONTENT = "@@content@@";
-
- private final InputStream stream;
- private AtomBase parseResult;
-
- public AtomPubParser(InputStream stream) {
- if (stream == null) {
- throw new IllegalArgumentException("No stream.");
- }
-
- this.stream = stream;
- }
-
- /**
- * Parses the stream.
- */
- public void parse() throws XmlPullParserException {
- XmlPullParser parser = XMLUtils.createParser(stream);
-
- try {
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
- if (TAG_FEED.equals(name.getLocalPart())) {
- parseResult = parseFeed(parser);
- break;
- } else if (TAG_ENTRY.equals(name.getLocalPart())) {
- parseResult = parseEntry(parser);
- break;
- }
- } else if (XMLConstants.NAMESPACE_CMIS.equals(name.getNamespaceURI())) {
- if (TAG_ALLOWABLEACTIONS.equals(name.getLocalPart())) {
- parseResult = parseAllowableActions(parser);
- break;
- } else if (TAG_ACL.equals(name.getLocalPart())) {
- parseResult = parseACL(parser);
- break;
- }
- } else if (XMLConstants.NAMESPACE_APP.equals(name.getNamespaceURI())) {
- if (TAG_SERVICE.equals(name.getLocalPart())) {
- parseResult = parseServiceDoc(parser);
- break;
- }
- } else if (TAG_HTML.equalsIgnoreCase(name.getLocalPart())) {
- parseResult = new HtmlDoc();
- break;
- }
- }
-
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- } finally {
- // make sure the stream is read and closed in all cases
- IOUtils.consumeAndClose(stream);
- }
- }
-
- /**
- * Return the parse results.
- */
- public AtomBase getResults() {
- return parseResult;
- }
-
- /**
- * Parses a service document.
- */
- private static ServiceDoc parseServiceDoc(XmlPullParser parser) throws XmlPullParserException {
- ServiceDoc result = new ServiceDoc();
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_APP.equals(name.getNamespaceURI())) {
- if (TAG_WORKSPACE.equals(name.getLocalPart())) {
- result.addWorkspace(parseWorkspace(parser));
- } else {
- XMLUtils.skip(parser);
- }
- } else {
- XMLUtils.skip(parser);
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Parses a workspace element in a service document.
- */
- private static RepositoryWorkspace parseWorkspace(XmlPullParser parser) throws XmlPullParserException {
- RepositoryWorkspace workspace = new RepositoryWorkspace();
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- AtomElement element = parseWorkspaceElement(parser);
-
- // check if we can extract the workspace id
- if ((element != null) && (element.getObject() instanceof RepositoryInfo)) {
- workspace.setId(((RepositoryInfo) element.getObject()).getId());
- }
-
- // add to workspace
- workspace.addElement(element);
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return workspace;
- }
-
- /**
- * Parses an Atom feed.
- */
- private AtomFeed parseFeed(XmlPullParser parser) throws XmlPullParserException {
- AtomFeed result = new AtomFeed();
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
- if (TAG_LINK.equals(name.getLocalPart())) {
- result.addElement(parseLink(parser));
- } else if (TAG_ENTRY.equals(name.getLocalPart())) {
- result.addEntry(parseEntry(parser));
- } else {
- XMLUtils.skip(parser);
- }
- } else if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
- if (TAG_NUM_ITEMS.equals(name.getLocalPart())) {
- result.addElement(parseBigInteger(parser));
- } else {
- XMLUtils.skip(parser);
- }
- } else {
- XMLUtils.skip(parser);
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return result;
- }
-
- /**
- * Parses an Atom entry.
- *
- * @throws XmlPullParserException
- */
- private AtomEntry parseEntry(XmlPullParser parser) throws XmlPullParserException {
- AtomEntry result = new AtomEntry();
-
- XMLUtils.next(parser);
-
- // walk through all tags in entry
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- AtomElement element = parseElement(parser);
- if (element != null) {
- // add to entry
- result.addElement(element);
-
- // find and set object id
- if (element.getObject() instanceof ObjectData) {
- result.setId(((ObjectData) element.getObject()).getId());
- } else if (element.getObject() instanceof TypeDefinition) {
- result.setId(((TypeDefinition) element.getObject()).getId());
- }
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return result;
- }
-
- /**
- * Parses an Allowable Actions document.
- */
- private static AtomAllowableActions parseAllowableActions(XmlPullParser parser) throws XmlPullParserException {
- return new AtomAllowableActions(XMLConverter.convertAllowableActions(parser));
- }
-
- /**
- * Parses an ACL document.
- */
- private static AtomAcl parseACL(XmlPullParser parser) throws XmlPullParserException {
- return new AtomAcl(XMLConverter.convertAcl(parser));
- }
-
- /**
- * Parses an element.
- *
- * @throws XmlPullParserException
- */
- private AtomElement parseElement(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
- if (TAG_OBJECT.equals(name.getLocalPart())) {
- return new AtomElement(name, XMLConverter.convertObject(parser));
- } else if (TAG_PATH_SEGMENT.equals(name.getLocalPart())
- || TAG_RELATIVE_PATH_SEGMENT.equals(name.getLocalPart())) {
- return parseText(parser);
- } else if (TAG_TYPE.equals(name.getLocalPart())) {
- return new AtomElement(name, XMLConverter.convertTypeDefinition(parser));
- } else if (TAG_CHILDREN.equals(name.getLocalPart())) {
- return parseChildren(parser);
- }
- } else if (XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
- if (TAG_LINK.equals(name.getLocalPart())) {
- return parseLink(parser);
- } else if (TAG_CONTENT.equals(name.getLocalPart())) {
- return parseAtomContentSrc(parser);
- }
- }
-
- // we don't know it - skip it
- XMLUtils.skip(parser);
-
- return null;
- }
-
- /**
- * Parses a children element.
- */
- private AtomElement parseChildren(XmlPullParser parser) throws XmlPullParserException {
- AtomElement result = null;
- QName childName = new QName(parser.getNamespace(), parser.getName());
-
- XMLUtils.next(parser);
-
- // walk through the children tag
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
- if (TAG_FEED.equals(name.getLocalPart())) {
- result = new AtomElement(childName, parseFeed(parser));
- } else {
- XMLUtils.skip(parser);
- }
- } else {
- XMLUtils.skip(parser);
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return result;
- }
-
- /**
- * Parses a workspace element.
- */
- private static AtomElement parseWorkspaceElement(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
-
- if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
- if (TAG_REPOSITORY_INFO.equals(name.getLocalPart())) {
- return new AtomElement(name, XMLConverter.convertRepositoryInfo(parser));
- } else if (TAG_URI_TEMPLATE.equals(name.getLocalPart())) {
- return parseTemplate(parser);
- }
- } else if (XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
- if (TAG_LINK.equals(name.getLocalPart())) {
- return parseLink(parser);
- }
- } else if (XMLConstants.NAMESPACE_APP.equals(name.getNamespaceURI())) {
- if (TAG_COLLECTION.equals(name.getLocalPart())) {
- return parseCollection(parser);
- }
- }
-
- // we don't know it - skip it
- XMLUtils.skip(parser);
-
- return null;
- }
-
- /**
- * Parses a collection tag.
- */
- private static AtomElement parseCollection(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- Map<String, String> result = new HashMap<String, String>();
-
- result.put("href", parser.getAttributeValue(null, "href"));
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName tagName = new QName(parser.getNamespace(), parser.getName());
- if (XMLConstants.NAMESPACE_RESTATOM.equals(tagName.getNamespaceURI())
- && TAG_COLLECTION_TYPE.equals(tagName.getLocalPart())) {
- result.put("collectionType", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
- } else {
- XMLUtils.skip(parser);
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return new AtomElement(name, result);
- }
-
- /**
- * Parses a template tag.
- */
- private static AtomElement parseTemplate(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- Map<String, String> result = new HashMap<String, String>();
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName tagName = new QName(parser.getNamespace(), parser.getName());
- if (XMLConstants.NAMESPACE_RESTATOM.equals(tagName.getNamespaceURI())) {
- if (TAG_TEMPLATE_TEMPLATE.equals(tagName.getLocalPart())) {
- result.put("template", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
- } else if (TAG_TEMPLATE_TYPE.equals(tagName.getLocalPart())) {
- result.put("type", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
- } else {
- XMLUtils.skip(parser);
- }
- } else {
- XMLUtils.skip(parser);
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
- }
-
- XMLUtils.next(parser);
-
- return new AtomElement(name, result);
- }
-
- /**
- * Parses a link tag.
- */
- private static AtomElement parseLink(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- AtomLink result = new AtomLink();
-
- // save attributes
- for (int i = 0; i < parser.getAttributeCount(); i++) {
- if (LINK_REL.equals(parser.getAttributeName(i))) {
- result.setRel(parser.getAttributeValue(i));
- } else if (LINK_HREF.equals(parser.getAttributeName(i))) {
- result.setHref(parser.getAttributeValue(i));
- } else if (LINK_TYPE.equals(parser.getAttributeName(i))) {
- result.setType(parser.getAttributeValue(i));
- }
- }
-
- // skip enclosed tags, if any
- XMLUtils.skip(parser);
-
- return new AtomElement(name, result);
- }
-
- /**
- * Parses a link tag.
- */
- private static AtomElement parseAtomContentSrc(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- AtomLink result = new AtomLink();
- result.setRel(LINK_REL_CONTENT);
-
- // save attributes
- for (int i = 0; i < parser.getAttributeCount(); i++) {
- if (CONTENT_SRC.equals(parser.getAttributeName(i))) {
- result.setHref(parser.getAttributeValue(i));
- }
- }
-
- // skip enclosed tags, if any
- XMLUtils.skip(parser);
-
- return new AtomElement(name, result);
- }
-
- /**
- * Parses a text tag.
- *
- * @throws XmlPullParserException
- */
- private static AtomElement parseText(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- return new AtomElement(name, XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
- }
-
- /**
- * Parses a text tag and convert it into an integer.
- */
- private static AtomElement parseBigInteger(XmlPullParser parser) throws XmlPullParserException {
- QName name = new QName(parser.getNamespace(), parser.getName());
- return new AtomElement(name, new BigInteger(XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH)));
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java
deleted file mode 100644
index 699cf29..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Constants for AtomPub.
- */
-public final class CmisAtomPubConstants {
-
- private CmisAtomPubConstants() {
- }
-
- // service doc
- public static final String TAG_SERVICE = "service";
- public static final String TAG_WORKSPACE = "workspace";
- public static final String TAG_REPOSITORY_INFO = "repositoryInfo";
- public static final String TAG_COLLECTION = "collection";
- public static final String TAG_COLLECTION_TYPE = "collectionType";
- public static final String TAG_URI_TEMPLATE = "uritemplate";
- public static final String TAG_TEMPLATE_TEMPLATE = "template";
- public static final String TAG_TEMPLATE_TYPE = "type";
- public static final String TAG_LINK = "link";
-
- // atom
- public static final String TAG_ATOM_ID = "id";
- public static final String TAG_ATOM_TITLE = "title";
- public static final String TAG_ATOM_UPDATED = "updated";
-
- // feed
- public static final String TAG_FEED = "feed";
-
- // entry
- public static final String TAG_ENTRY = "entry";
- public static final String TAG_OBJECT = "object";
- public static final String TAG_NUM_ITEMS = "numItems";
- public static final String TAG_PATH_SEGMENT = "pathSegment";
- public static final String TAG_RELATIVE_PATH_SEGMENT = "relativePathSegment";
- public static final String TAG_TYPE = "type";
- public static final String TAG_CHILDREN = "children";
- public static final String TAG_CONTENT = "content";
- public static final String TAG_CONTENT_MEDIATYPE = "mediatype";
- public static final String TAG_CONTENT_BASE64 = "base64";
- public static final String TAG_CONTENT_FILENAME = "filename";
-
- public static final String ATTR_DOCUMENT_TYPE = "cmisTypeDocumentDefinitionType";
- public static final String ATTR_FOLDER_TYPE = "cmisTypeFolderDefinitionType";
- public static final String ATTR_RELATIONSHIP_TYPE = "cmisTypeRelationshipDefinitionType";
- public static final String ATTR_POLICY_TYPE = "cmisTypePolicyDefinitionType";
- public static final String ATTR_ITEM_TYPE = "cmisTypeItemDefinitionType";
- public static final String ATTR_SECONDARY_TYPE = "cmisTypeSecondaryDefinitionType";
-
- // allowable actions
- public static final String TAG_ALLOWABLEACTIONS = "allowableActions";
-
- // ACL
- public static final String TAG_ACL = "acl";
-
- // HTML
- public static final String TAG_HTML = "html";
-
- // links
- public static final String LINK_REL = "rel";
- public static final String LINK_HREF = "href";
- public static final String LINK_TYPE = "type";
- public static final String CONTENT_SRC = "src";
-
- // Android Parser Specific
- public static final String TAG_PROPERTY = "property";
- public static final String ATTR_PROPERTY_ID = "id";
- public static final String ATTR_PROPERTY_LOCALNAME = "localName";
- public static final String ATTR_PROPERTY_DISPLAYNAME = "displayName";
- public static final String ATTR_PROPERTY_QUERYNAME = "queryName";
- public static final String ATTR_PROPERTY_VALUE = "value";
- public static final String ATTR_PROPERTY_DATATYPE = "type";
- public static final String ATTR_PROPERTY_CARDINALITY = "cardinality";
-
- public static final String TAG_REPINFO_ID = "repositoryId";
- public static final String TAG_REPINFO_NAME = "repositoryName";
- public static final String TAG_REPINFO_DESCRIPTION = "repositoryDescription";
- public static final String TAG_REPINFO_VENDOR = "vendorName";
- public static final String TAG_REPINFO_PRODUCT = "productName";
- public static final String TAG_REPINFO_PRODUCT_VERSION = "productVersion";
- public static final String TAG_REPINFO_ROOT_FOLDER_ID = "rootFolderId";
- public static final String TAG_REPINFO_REPOSITORY_URL = "repositoryUrl";
- public static final String TAG_REPINFO_ROOT_FOLDER_URL = "rootFolderUrl";
- public static final String TAG_REPINFO_CAPABILITIES = "capabilities";
- public static final String TAG_REPINFO_ACL_CAPABILITY = "aclCapability";
- public static final String TAG_REPINFO_CHANGE_LOCK_TOKEN = "latestChangeLogToken";
- public static final String TAG_REPINFO_CMIS_VERSION_SUPPORTED = "cmisVersionSupported";
- public static final String TAG_REPINFO_THIN_CLIENT_URI = "thinClientURI";
- public static final String TAG_REPINFO_CHANGES_INCOMPLETE = "changesIncomplete";
- public static final String TAG_REPINFO_CHANGES_ON_TYPE = "changesOnType";
- public static final String TAG_REPINFO_PRINCIPAL_ANONYMOUS = "principalAnonymous";
- public static final String TAG_REPINFO_PRINCIPAL_ANYONE = "principalAnyone";
-
- public static final Set<String> REPINFO_KEYS = new HashSet<String>();
- static {
- REPINFO_KEYS.add(TAG_REPINFO_ID);
- REPINFO_KEYS.add(TAG_REPINFO_NAME);
- REPINFO_KEYS.add(TAG_REPINFO_DESCRIPTION);
- REPINFO_KEYS.add(TAG_REPINFO_VENDOR);
- REPINFO_KEYS.add(TAG_REPINFO_PRODUCT);
- REPINFO_KEYS.add(TAG_REPINFO_PRODUCT_VERSION);
- REPINFO_KEYS.add(TAG_REPINFO_ROOT_FOLDER_ID);
- REPINFO_KEYS.add(TAG_REPINFO_REPOSITORY_URL);
- REPINFO_KEYS.add(TAG_REPINFO_ROOT_FOLDER_URL);
- REPINFO_KEYS.add(TAG_REPINFO_CAPABILITIES);
- REPINFO_KEYS.add(TAG_REPINFO_ACL_CAPABILITY);
- REPINFO_KEYS.add(TAG_REPINFO_CHANGE_LOCK_TOKEN);
- REPINFO_KEYS.add(TAG_REPINFO_CMIS_VERSION_SUPPORTED);
- REPINFO_KEYS.add(TAG_REPINFO_THIN_CLIENT_URI);
- REPINFO_KEYS.add(TAG_REPINFO_CHANGES_INCOMPLETE);
- REPINFO_KEYS.add(TAG_REPINFO_CHANGES_ON_TYPE);
- REPINFO_KEYS.add(TAG_REPINFO_PRINCIPAL_ANONYMOUS);
- REPINFO_KEYS.add(TAG_REPINFO_PRINCIPAL_ANYONE);
- }
-
- public static final String TAG_ACLCAP_ACL_PROPAGATION = "propagation";
- public static final String TAG_ACLCAP_SUPPORTED_PERMISSIONS = "supportedPermissions";
- public static final String TAG_ACLCAP_PERMISSIONS = "permissions";
- public static final String TAG_ACLCAP_PERMISSION_PERMISSION = "permission";
- public static final String TAG_ACLCAP_PERMISSION_DESCRIPTION = "description";
- public static final String TAG_ACLCAP_MAPPING = "mapping";
- public static final String TAG_ACLCAP_MAPPING_KEY = "key";
- public static final String TAG_ACLCAP_MAPPING_PERMISSION = "permission";
- public static final String TAG_ACLCAP_DIRECT = "direct";
-
- public static final String TAG_CAP_CONTENT_STREAM_UPDATES = "capabilityContentStreamUpdatability";
- public static final String TAG_CAP_CHANGES = "capabilityChanges";
- public static final String TAG_CAP_RENDITIONS = "capabilityRenditions";
- public static final String TAG_CAP_GET_DESCENDANTS = "capabilityGetDescendants";
- public static final String TAG_CAP_GET_FOLDER_TREE = "capabilityGetFolderTree";
- public static final String TAG_CAP_MULTIFILING = "capabilityMultifiling";
- public static final String TAG_CAP_UNFILING = "capabilityUnfiling";
- public static final String TAG_CAP_VERSION_SPECIFIC_FILING = "capabilityVersionSpecificFiling";
- public static final String TAG_CAP_PWC_SEARCHABLE = "capabilityPWCSearchable";
- public static final String TAG_CAP_PWC_UPDATABLE = "capabilityPWCUpdatable";
- public static final String TAG_CAP_ALL_VERSIONS_SEARCHABLE = "capabilityAllVersionsSearchable";
- public static final String TAG_CAP_QUERY = "capabilityQuery";
- public static final String TAG_CAP_JOIN = "capabilityJoin";
- public static final String TAG_CAP_ACL = "capabilityACL";
-
- public static final String ATTR_PROPERTY_TYPE_ID = "id";
- public static final String ATTR_PROPERTY_DEFINITION_ID = "propertyDefinitionId";
- public static final String ATTR_PROPERTY_TYPE_LOCALNAME = "localName";
- public static final String ATTR_PROPERTY_TYPE_LOCALNAMESPACE = "localNamespace";
- public static final String ATTR_PROPERTY_TYPE_DISPLAYNAME = "displayName";
- public static final String ATTR_PROPERTY_TYPE_QUERYNAME = "queryName";
- public static final String ATTR_PROPERTY_TYPE_DESCRIPTION = "description";
- public static final String ATTR_PROPERTY_TYPE_PROPERTY_TYPE = "propertyType";
- public static final String ATTR_PROPERTY_TYPE_CARDINALITY = "cardinality";
- public static final String ATTR_PROPERTY_TYPE_UPDATABILITY = "updatability";
- public static final String ATTR_PROPERTY_TYPE_INHERITED = "inherited";
- public static final String ATTR_PROPERTY_TYPE_REQUIRED = "required";
- public static final String ATTR_PROPERTY_TYPE_QUERYABLE = "queryable";
- public static final String ATTR_PROPERTY_TYPE_ORDERABLE = "orderable";
- public static final String ATTR_PROPERTY_TYPE_OPENCHOICE = "openChoice";
-
- public static final String ATTR_PROPERTY_TYPE_MAX_LENGTH = "maxLength";
- public static final String ATTR_PROPERTY_TYPE_MIN_VALUE = "minValue";
- public static final String ATTR_PROPERTY_TYPE_MAX_VALUE = "maxValue";
- public static final String ATTR_PROPERTY_TYPE_PRECISION = "precision";
- public static final String ATTR_PROPERTY_TYPE_RESOLUTION = "resolution";
-
- public static final String TAG_RENDITION = "rendition";
- public static final String TAG_RENDITION_STREAM_ID = "streamId";
- public static final String TAG_RENDITION_MIMETYPE = "mimeType";
- public static final String TAG_RENDITION_LENGTH = "length";
- public static final String TAG_RENDITION_KIND = "kind";
- public static final String TAG_RENDITION_TITLE = "title";
- public static final String TAG_RENDITION_HEIGHT = "height";
- public static final String TAG_RENDITION_WIDTH = "width";
- public static final String TAG_RENDITION_DOCUMENT_ID = "renditionDocumentId";
-
- public static final String TAG_ACE_PRINCIPAL = "principal";
- public static final String TAG_ACE_PRINCIPAL_ID = "principalId";
- public static final String TAG_ACE_DIRECT = "direct";
-
- public static final String TYPE_ID = "id";
- public static final String TYPE_LOCALNAME = "localName";
- public static final String TYPE_LOCALNAMESPACE = "localNamespace";
- public static final String TYPE_DISPLAYNAME = "displayName";
- public static final String TYPE_QUERYNAME = "queryName";
- public static final String TYPE_DESCRIPTION = "description";
- public static final String TYPE_BASE_ID = "baseId";
- public static final String TYPE_PARENT_ID = "parentId";
- public static final String TYPE_CREATABLE = "creatable";
- public static final String TYPE_FILEABLE = "fileable";
- public static final String TYPE_QUERYABLE = "queryable";
- public static final String TYPE_FULLTEXT_INDEXED = "fulltextIndexed";
- public static final String TYPE_INCLUDE_IN_SUPERTYPE_QUERY = "includedInSupertypeQuery";
- public static final String TYPE_CONTROLABLE_POLICY = "controllablePolicy";
- public static final String TYPE_CONTROLABLE_ACL = "controllableACL";
- public static final String TYPE_PROPERTY_DEFINITIONS = "propertyDefinitions";
- public static final String TYPE_CONTENTSTREAM_ALLOWED = "contentStreamAllowed"; // document
- public static final String TYPE_VERSIONABLE = "versionable"; // document
-
- public static final String TAG_VALUE = "value";
- public static final String TAG_QUERY = "query";
- public static final String TAG_QUERY_STATEMENT = "statement";
-
- public static final String TAG_OBJECT_PROPERTIES = "properties";
- public static final String TAG_OBJECT_ALLOWABLE_ACTIONS = "allowableActions";
- public static final String TAG_OBJECT_RELATIONSHIPS = "relationships";
- public static final String TAG_OBJECT_CHANGE_EVENT_INFO = "changeEventInfo";
- public static final String TAG_OBJECT_ACL = "acl";
- public static final String TAG_OBJECT_EXACT_ACL = "exactACL";
- public static final String TAG_OBJECT_POLICY_IDS = "policyIds";
- public static final String TAG_OBJECT_RENDITION = "rendition";
-
- public static final Set<String> OBJECT_KEYS = new HashSet<String>();
- static {
- OBJECT_KEYS.add(TAG_OBJECT_PROPERTIES);
- OBJECT_KEYS.add(TAG_OBJECT_ALLOWABLE_ACTIONS);
- OBJECT_KEYS.add(TAG_OBJECT_RELATIONSHIPS);
- OBJECT_KEYS.add(TAG_OBJECT_CHANGE_EVENT_INFO);
- OBJECT_KEYS.add(TAG_OBJECT_ACL);
- OBJECT_KEYS.add(TAG_OBJECT_EXACT_ACL);
- OBJECT_KEYS.add(TAG_OBJECT_POLICY_IDS);
- OBJECT_KEYS.add(TAG_OBJECT_RENDITION);
- }
-
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java
deleted file mode 100644
index 684e99b..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi;
-import org.apache.chemistry.opencmis.commons.spi.AclService;
-import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
-import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
-import org.apache.chemistry.opencmis.commons.spi.NavigationService;
-import org.apache.chemistry.opencmis.commons.spi.ObjectService;
-import org.apache.chemistry.opencmis.commons.spi.PolicyService;
-import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
-import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
-import org.apache.chemistry.opencmis.commons.spi.VersioningService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * CMIS AtomPub SPI implementation.
- */
-public class CmisAtomPubSpi implements CmisSpi {
-
- private static final Logger LOG = LoggerFactory.getLogger(CmisAtomPubSpi.class);
-
- private final BindingSession session;
-
- private final RepositoryService repositoryService;
- private final NavigationService navigationService;
- private final ObjectService objectService;
- private final VersioningService versioningService;
- private final DiscoveryService discoveryService;
- private final MultiFilingService multiFilingService;
- private final RelationshipService relationshipService;
- private final PolicyService policyService;
- private final AclService aclService;
-
- /**
- * Constructor.
- */
- public CmisAtomPubSpi(BindingSession session) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session {}: Initializing AtomPub SPI...", session.getSessionId());
- }
-
- this.session = session;
-
- repositoryService = new RepositoryServiceImpl(session);
- navigationService = new NavigationServiceImpl(session);
- objectService = new ObjectServiceImpl(session);
- versioningService = new VersioningServiceImpl(session);
- discoveryService = new DiscoveryServiceImpl(session);
- multiFilingService = new MultiFilingServiceImpl(session);
- relationshipService = new RelationshipServiceImpl(session);
- policyService = new PolicyServiceImpl(session);
- aclService = new AclServiceImpl(session);
- }
-
- public RepositoryService getRepositoryService() {
- return repositoryService;
- }
-
- public NavigationService getNavigationService() {
- return navigationService;
- }
-
- public ObjectService getObjectService() {
- return objectService;
- }
-
- public DiscoveryService getDiscoveryService() {
- return discoveryService;
- }
-
- public VersioningService getVersioningService() {
- return versioningService;
- }
-
- public MultiFilingService getMultiFilingService() {
- return multiFilingService;
- }
-
- public RelationshipService getRelationshipService() {
- return relationshipService;
- }
-
- public PolicyService getPolicyService() {
- return policyService;
- }
-
- public AclService getAclService() {
- return aclService;
- }
-
- public void clearAllCaches() {
- session.remove(SpiSessionParameter.LINK_CACHE);
- }
-
- public void clearRepositoryCache(String repositoryId) {
- LinkCache linkCache = (LinkCache) session.get(SpiSessionParameter.LINK_CACHE);
- if (linkCache != null) {
- linkCache.clearRepository(repositoryId);
- }
- }
-
- public void close() {
- // no-op for AtomPub
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
deleted file mode 100644
index 0250183..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.util.ArrayList;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.QueryTypeImpl;
-import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
-import org.apache.chemistry.opencmis.commons.spi.ExtendedHolder;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.xmlpull.v1.XmlSerializer;
-
-/**
- * Discovery Service AtomPub client.
- */
-public class DiscoveryServiceImpl extends AbstractAtomPubService implements DiscoveryService {
-
- /**
- * Constructor.
- */
- public DiscoveryServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
- String filter, Boolean includePolicyIds, Boolean includeACL, BigInteger maxItems, ExtensionsData extension) {
- ObjectListImpl result = new ObjectListImpl();
-
- // find the link
- String link = null;
- UrlBuilder url = null;
-
- // if the application doesn't know the change log token but the link to
- // the next Atom feed
- if (changeLogToken instanceof ExtendedHolder && changeLogToken.getValue() == null) {
- link = (String) ((ExtendedHolder<String>) changeLogToken).getExtraValue(Constants.REP_REL_CHANGES);
- if (link != null) {
- url = new UrlBuilder(link);
- }
- }
-
- // if the application didn't provide a link to next Atom feed
- if (link == null) {
- link = loadRepositoryLink(repositoryId, Constants.REP_REL_CHANGES);
- if (link != null) {
- url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_CHANGE_LOG_TOKEN,
- (changeLogToken == null ? null : changeLogToken.getValue()));
- url.addParameter(Constants.PARAM_PROPERTIES, includeProperties);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_POLICY_IDS, includePolicyIds);
- url.addParameter(Constants.PARAM_ACL, includeACL);
- url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
- }
- }
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or content changes not supported!");
- }
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
- String lastChangeLogToken = null;
-
- // handle top level
- String nextLink = null;
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- nextLink = ((AtomLink) element.getObject()).getHref();
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- } else if (isStr("changeLogToken", element)) {
- lastChangeLogToken = (String) element.getObject();
- }
- }
-
- // get the changes
- if (!feed.getEntries().isEmpty()) {
- result.setObjects(new ArrayList<ObjectData>(feed.getEntries().size()));
-
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData hit = null;
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof ObjectData) {
- hit = (ObjectData) element.getObject();
- }
- }
-
- if (hit != null) {
- result.getObjects().add(hit);
- }
- }
- }
-
- if (changeLogToken != null) {
- // the AtomPub binding cannot return a new change log token,
- // but an OpenCMIS server uses a proprietary tag
- changeLogToken.setValue(lastChangeLogToken);
-
- // but we can provide the link to the next Atom feed
- if (changeLogToken instanceof ExtendedHolder && nextLink != null) {
- ((ExtendedHolder<String>) changeLogToken).setExtraValue(Constants.REP_REL_CHANGES, nextLink);
- }
- }
-
- return result;
- }
-
- public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectListImpl result = new ObjectListImpl();
-
- // find the link
- String link = loadCollection(repositoryId, Constants.COLLECTION_QUERY);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or query not supported!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // compile query request
- final QueryTypeImpl query = new QueryTypeImpl();
- query.setStatement(statement);
- query.setSearchAllVersions(searchAllVersions);
- query.setIncludeAllowableActions(includeAllowableActions);
- query.setIncludeRelationships(includeRelationships);
- query.setRenditionFilter(renditionFilter);
- query.setMaxItems(maxItems);
- query.setSkipCount(skipCount);
-
- final CmisVersion cmisVersion = getCmisVersion(repositoryId);
-
- // post the query and parse results
- Response resp = post(url, Constants.MEDIATYPE_QUERY, new Output() {
- public void write(OutputStream out) throws Exception {
- XmlSerializer writer = XMLUtils.createWriter(out);
- XMLUtils.startXmlDocument(writer);
- XMLConverter.writeQuery(writer, cmisVersion, query);
- XMLUtils.endXmlDocument(writer);
- }
- });
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // handle top level
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- }
- }
-
- // get the result set
- if (!feed.getEntries().isEmpty()) {
- result.setObjects(new ArrayList<ObjectData>(feed.getEntries().size()));
-
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData hit = null;
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof ObjectData) {
- hit = (ObjectData) element.getObject();
- }
- }
-
- if (hit != null) {
- result.getObjects().add(hit);
- }
- }
- }
-
- return result;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java
deleted file mode 100644
index 950c7ff..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.chemistry.opencmis.client.bindings.cache.Cache;
-import org.apache.chemistry.opencmis.client.bindings.cache.impl.CacheImpl;
-import org.apache.chemistry.opencmis.client.bindings.cache.impl.ContentTypeCacheLevelImpl;
-import org.apache.chemistry.opencmis.client.bindings.cache.impl.LruCacheLevelImpl;
-import org.apache.chemistry.opencmis.client.bindings.cache.impl.MapCacheLevelImpl;
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.commons.SessionParameter;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.IOUtils;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-
-/**
- * Link cache.
- */
-public class LinkCache implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final Set<String> KNOWN_LINKS = new HashSet<String>();
-
- static {
- KNOWN_LINKS.add(Constants.REL_ACL);
- KNOWN_LINKS.add(Constants.REL_DOWN);
- KNOWN_LINKS.add(Constants.REL_UP);
- KNOWN_LINKS.add(Constants.REL_FOLDERTREE);
- KNOWN_LINKS.add(Constants.REL_RELATIONSHIPS);
- KNOWN_LINKS.add(Constants.REL_SELF);
- KNOWN_LINKS.add(Constants.REL_ALLOWABLEACTIONS);
- KNOWN_LINKS.add(Constants.REL_EDITMEDIA);
- KNOWN_LINKS.add(Constants.REL_POLICIES);
- KNOWN_LINKS.add(Constants.REL_VERSIONHISTORY);
- KNOWN_LINKS.add(Constants.REL_WORKINGCOPY);
- KNOWN_LINKS.add(AtomPubParser.LINK_REL_CONTENT);
- }
-
- private static final int CACHE_SIZE_REPOSITORIES = 10;
- private static final int CACHE_SIZE_TYPES = 100;
- private static final int CACHE_SIZE_OBJECTS = 400;
-
- private final Cache linkCache;
- private final Cache typeLinkCache;
- private final Cache collectionLinkCache;
- private final Cache templateCache;
- private final Cache repositoryLinkCache;
-
- /**
- * Constructor.
- */
- public LinkCache(BindingSession session) {
- int repCount = session.get(SessionParameter.CACHE_SIZE_REPOSITORIES, CACHE_SIZE_REPOSITORIES);
- if (repCount < 1) {
- repCount = CACHE_SIZE_REPOSITORIES;
- }
-
- int typeCount = session.get(SessionParameter.CACHE_SIZE_TYPES, CACHE_SIZE_TYPES);
- if (typeCount < 1) {
- typeCount = CACHE_SIZE_TYPES;
- }
-
- int objCount = session.get(SessionParameter.CACHE_SIZE_LINKS, CACHE_SIZE_OBJECTS);
- if (objCount < 1) {
- objCount = CACHE_SIZE_OBJECTS;
- }
-
- linkCache = new CacheImpl("Link Cache");
- linkCache.initialize(new String[] {
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository
- LruCacheLevelImpl.class.getName() + " " + LruCacheLevelImpl.MAX_ENTRIES + "=" + objCount, // id
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=12", // rel
- ContentTypeCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=3,"
- + MapCacheLevelImpl.SINGLE_VALUE + "=true" // type
- });
-
- typeLinkCache = new CacheImpl("Type Link Cache");
- typeLinkCache.initialize(new String[] {
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository
- LruCacheLevelImpl.class.getName() + " " + LruCacheLevelImpl.MAX_ENTRIES + "=" + typeCount, // id
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=12", // rel
- ContentTypeCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=3,"
- + MapCacheLevelImpl.SINGLE_VALUE + "=true"// type
- });
-
- collectionLinkCache = new CacheImpl("Collection Link Cache");
- collectionLinkCache.initialize(new String[] {
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=8" // collection
- });
-
- templateCache = new CacheImpl("URI Template Cache");
- templateCache.initialize(new String[] {
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=6" // type
- });
-
- repositoryLinkCache = new CacheImpl("Repository Link Cache");
- repositoryLinkCache.initialize(new String[] {
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository
- MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=6" // rel
- });
- }
-
- /**
- * Adds a link.
- */
- public void addLink(String repositoryId, String id, String rel, String type, String link) {
- if (KNOWN_LINKS.contains(rel)) {
- linkCache.put(link, repositoryId, id, rel, type);
- } else if (Constants.REL_ALTERNATE.equals(rel)) {
- // use streamId instead of type as discriminating parameter
- String streamId = extractStreamId(link);
- if (streamId != null) {
- linkCache.put(link, repositoryId, id, rel, streamId);
- }
- }
- }
-
- /**
- * Tries to extract a streamId from an alternate link.
- */
- // this is not strictly in the spec
- protected String extractStreamId(String link) {
- int i = link.lastIndexOf('?');
- if (i > 0) {
- String[] params = link.substring(i + 1).split("&");
- for (String param : params) {
- String[] parts = param.split("=", 2);
- if (parts[0].equals(Constants.PARAM_STREAM_ID) && parts.length == 2) {
- return parts[1];
- }
- }
- }
- return null;
- }
-
- /**
- * Removes all links of an object.
- */
- public void removeLinks(String repositoryId, String id) {
- linkCache.remove(repositoryId, id);
- }
-
- /**
- * Gets a link.
- */
- public String getLink(String repositoryId, String id, String rel, String type) {
- return (String) linkCache.get(repositoryId, id, rel, type);
- }
-
- /**
- * Gets a link.
- */
- public String getLink(String repositoryId, String id, String rel) {
- return getLink(repositoryId, id, rel, null);
- }
-
- /**
- * Checks a link.
- */
- public int checkLink(String repositoryId, String id, String rel, String type) {
- return linkCache.check(repositoryId, id, rel, type);
- }
-
- /**
- * Locks the link cache.
- */
- public void lockLinks() {
- linkCache.writeLock();
- }
-
- /**
- * Unlocks the link cache.
- */
- public void unlockLinks() {
- linkCache.writeUnlock();
- }
-
- /**
- * Adds a type link.
- */
- public void addTypeLink(String repositoryId, String id, String rel, String type, String link) {
- if (KNOWN_LINKS.contains(rel)) {
- typeLinkCache.put(link, repositoryId, id, rel, type);
- }
- }
-
- /**
- * Removes all links of a type.
- */
- public void removeTypeLinks(String repositoryId, String id) {
- typeLinkCache.remove(repositoryId, id);
- }
-
- /**
- * Gets a type link.
- */
- public String getTypeLink(String repositoryId, String id, String rel, String type) {
- return (String) typeLinkCache.get(repositoryId, id, rel, type);
- }
-
- /**
- * Locks the type link cache.
- */
- public void lockTypeLinks() {
- typeLinkCache.writeLock();
- }
-
- /**
- * Unlocks the type link cache.
- */
- public void unlockTypeLinks() {
- typeLinkCache.writeUnlock();
- }
-
- /**
- * Adds a collection.
- */
- public void addCollection(String repositoryId, String collection, String link) {
- collectionLinkCache.put(link, repositoryId, collection);
- }
-
- /**
- * Gets a collection.
- */
- public String getCollection(String repositoryId, String collection) {
- return (String) collectionLinkCache.get(repositoryId, collection);
- }
-
- /**
- * Adds an URI template.
- */
- public void addTemplate(String repositoryId, String type, String link) {
- templateCache.put(link, repositoryId, type);
- }
-
- /**
- * Gets an URI template and replaces place holders with the given
- * parameters.
- */
- public String getTemplateLink(String repositoryId, String type, Map<String, Object> parameters) {
- String template = (String) templateCache.get(repositoryId, type);
- if (template == null) {
- return null;
- }
-
- StringBuilder result = new StringBuilder();
- StringBuilder param = new StringBuilder();
-
- boolean paramMode = false;
- for (int i = 0; i < template.length(); i++) {
- char c = template.charAt(i);
-
- if (paramMode) {
- if (c == '}') {
- paramMode = false;
-
- String paramValue = UrlBuilder.normalizeParameter(parameters.get(param.toString()));
- if (paramValue != null) {
- result.append(IOUtils.encodeURL(paramValue));
- }
-
- param = new StringBuilder();
- } else {
- param.append(c);
- }
- } else {
- if (c == '{') {
- paramMode = true;
- } else {
- result.append(c);
- }
- }
- }
-
- return result.toString();
- }
-
- /**
- * Adds a collection.
- */
- public void addRepositoryLink(String repositoryId, String rel, String link) {
- repositoryLinkCache.put(link, repositoryId, rel);
- }
-
- /**
- * Gets a collection.
- */
- public String getRepositoryLink(String repositoryId, String rel) {
- return (String) repositoryLinkCache.get(repositoryId, rel);
- }
-
- /**
- * Removes all entries of the given repository from the caches.
- */
- public void clearRepository(String repositoryId) {
- linkCache.remove(repositoryId);
- typeLinkCache.remove(repositoryId);
- collectionLinkCache.remove(repositoryId);
- templateCache.remove(repositoryId);
- repositoryLinkCache.remove(repositoryId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "Link Cache [link cache=" + linkCache + ", type link cache=" + typeLinkCache
- + ", collection link cache=" + collectionLinkCache + ", repository link cache=" + repositoryLinkCache
- + ", template cache=" + templateCache + "]";
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/MultiFilingServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/MultiFilingServiceImpl.java
deleted file mode 100644
index da28d14..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/MultiFilingServiceImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
-
-/**
- * MultiFiling Service AtomPub client.
- */
-public class MultiFilingServiceImpl extends AbstractAtomPubService implements MultiFilingService {
-
- /**
- * Constructor.
- */
- public MultiFilingServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
- ExtensionsData extension) {
- if (objectId == null) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions);
-
- // set up object and writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId), getCmisVersion(repositoryId));
-
- // post addObjectToFolder request
- post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
- }
-
- public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
- if (objectId == null) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- // find the link
- String link = loadCollection(repositoryId, Constants.COLLECTION_UNFILED);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or unfiling not supported!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_REMOVE_FROM, folderId);
-
- // set up object and writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId), getCmisVersion(repositoryId));
-
- // post removeObjectFromFolder request
- post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
deleted file mode 100644
index f15e159..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomBase;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderData;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
-import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectInFolderContainerImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectInFolderDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectInFolderListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectParentDataImpl;
-import org.apache.chemistry.opencmis.commons.spi.NavigationService;
-
-/**
- * Navigation Service AtomPub client.
- */
-public class NavigationServiceImpl extends AbstractAtomPubService implements NavigationService {
-
- /**
- * Constructor.
- */
- public NavigationServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectInFolderListImpl result = new ObjectInFolderListImpl();
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ORDER_BY, orderBy);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
- url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
- url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
- url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // handle top level
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- }
- }
-
- // get the children
- if (!feed.getEntries().isEmpty()) {
- result.setObjects(new ArrayList<ObjectInFolderData>(feed.getEntries().size()));
-
- for (AtomEntry entry : feed.getEntries()) {
- ObjectInFolderDataImpl child = null;
- String pathSegment = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (isStr(NAME_PATH_SEGMENT, element)) {
- pathSegment = (String) element.getObject();
- } else if (element.getObject() instanceof ObjectData) {
- child = new ObjectInFolderDataImpl();
- child.setObject((ObjectData) element.getObject());
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (child != null) {
- child.setPathSegment(pathSegment);
- result.getObjects().add(child);
- }
- }
- }
-
- return result;
- }
-
- public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_DEPTH, depth);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
- url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // process tree
- addDescendantsLevel(repositoryId, feed, result);
-
- return result;
- }
-
- public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
- ObjectData result = null;
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_UP, Constants.MEDIATYPE_ENTRY);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_UP, Constants.MEDIATYPE_ENTRY);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, filter);
-
- // read
- Response resp = read(url);
-
- AtomBase base = parse(resp.getStream(), AtomBase.class);
-
- // get the entry
- AtomEntry entry = null;
- if (base instanceof AtomFeed) {
- AtomFeed feed = (AtomFeed) base;
- if (feed.getEntries().isEmpty()) {
- throw new CmisRuntimeException("Parent feed is empty!");
- }
- entry = feed.getEntries().get(0);
- } else if (base instanceof AtomEntry) {
- entry = (AtomEntry) base;
- } else {
- throw new CmisRuntimeException("Unexpected document!");
- }
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- result = (ObjectData) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- return result;
- }
-
- public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_FOLDERTREE, Constants.MEDIATYPE_DESCENDANTS);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_FOLDERTREE, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_DEPTH, depth);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
- url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // process tree
- addDescendantsLevel(repositoryId, feed, result);
-
- return result;
- }
-
- public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includeRelativePathSegment, ExtensionsData extension) {
- List<ObjectParentData> result = new ArrayList<ObjectParentData>();
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_UP, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- // root and unfiled objects have no UP link
- return result;
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
- url.addParameter(Constants.PARAM_RELATIVE_PATH_SEGMENT, includeRelativePathSegment);
-
- // read and parse
- Response resp = read(url);
-
- AtomBase base = parse(resp.getStream(), AtomBase.class);
-
- if (base instanceof AtomFeed) {
- // it's a feed
- AtomFeed feed = (AtomFeed) base;
-
- // walk through the feed
- for (AtomEntry entry : feed.getEntries()) {
- ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);
-
- if (objectParent != null) {
- result.add(objectParent);
- }
- }
- } else if (base instanceof AtomEntry) {
- // it's an entry
- AtomEntry entry = (AtomEntry) base;
-
- ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);
-
- if (objectParent != null) {
- result.add(objectParent);
- }
- }
-
- return result;
- }
-
- private ObjectParentDataImpl processParentEntry(AtomEntry entry, String repositoryId) {
- ObjectParentDataImpl result = null;
- String relativePathSegment = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- result = new ObjectParentDataImpl((ObjectData) element.getObject());
- } else if (is(NAME_RELATIVE_PATH_SEGMENT, element)) {
- relativePathSegment = (String) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (result != null) {
- result.setRelativePathSegment(relativePathSegment);
- }
-
- return result;
- }
-
- public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectListImpl result = new ObjectListImpl();
-
- // find the link
- String link = loadCollection(repositoryId, Constants.COLLECTION_CHECKEDOUT);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or checkedout collection not supported!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FOLDER_ID, folderId);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ORDER_BY, orderBy);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
- url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
- url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // handle top level
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- }
- }
-
- // get the documents
- if (!feed.getEntries().isEmpty()) {
- result.setObjects(new ArrayList<ObjectData>(feed.getEntries().size()));
-
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData child = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- child = (ObjectData) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (child != null) {
- result.getObjects().add(child);
- }
- }
- }
-
- return result;
- }
-
- // ---- internal ----
-
- /**
- * Adds descendants level recursively.
- */
- private void addDescendantsLevel(String repositoryId, AtomFeed feed, List<ObjectInFolderContainer> containerList) {
- if ((feed == null) || (feed.getEntries().isEmpty())) {
- return;
- }
-
- // walk through the feed
- for (AtomEntry entry : feed.getEntries()) {
- ObjectInFolderDataImpl objectInFolder = null;
- String pathSegment = null;
- List<ObjectInFolderContainer> childContainerList = new ArrayList<ObjectInFolderContainer>();
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- objectInFolder = new ObjectInFolderDataImpl((ObjectData) element.getObject());
- } else if (is(NAME_PATH_SEGMENT, element)) {
- pathSegment = (String) element.getObject();
- } else if (element.getObject() instanceof AtomFeed) {
- addDescendantsLevel(repositoryId, (AtomFeed) element.getObject(), childContainerList);
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (objectInFolder != null) {
- objectInFolder.setPathSegment(pathSegment);
- ObjectInFolderContainerImpl childContainer = new ObjectInFolderContainerImpl(objectInFolder);
- childContainer.setChildren(childContainerList);
- containerList.add(childContainer);
- }
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
deleted file mode 100644
index a644a86..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAllowableActions;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.AllowableActions;
-import org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
-import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.data.PropertyData;
-import org.apache.chemistry.opencmis.commons.data.PropertyId;
-import org.apache.chemistry.opencmis.commons.data.PropertyString;
-import org.apache.chemistry.opencmis.commons.data.RenditionData;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
-import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.IOUtils;
-import org.apache.chemistry.opencmis.commons.impl.MimeHelper;
-import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PartialContentStreamImpl;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.apache.chemistry.opencmis.commons.spi.ObjectService;
-
-/**
- * Object Service AtomPub client.
- */
-public class ObjectServiceImpl extends AbstractAtomPubService implements ObjectService {
-
- /**
- * Constructor.
- */
- public ObjectServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public String createDocument(String repositoryId, Properties properties, String folderId,
- ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- checkCreateProperties(properties);
-
- // find the link
- String link = null;
-
- if (folderId == null) {
- // Creation of unfiled objects via AtomPub is not defined in the
- // CMIS 1.0 specification. This implementation follow the CMIS 1.1
- // draft and POSTs the document to the Unfiled collection.
-
- link = loadCollection(repositoryId, Constants.COLLECTION_UNFILED);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or unfiling not supported!");
- }
- } else {
- link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_VERSIONIG_STATE, versioningState);
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId), contentStream);
-
- // post the new folder object
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // handle ACL modifications
- handleAclModifications(repositoryId, entry, addAces, removeAces);
-
- return entry.getId();
- }
-
- public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
- String folderId, VersioningState versioningState, List<String> policies, Acl addACEs, Acl removeACEs,
- ExtensionsData extension) {
- throw new CmisNotSupportedException("createDocumentFromSource is not supported by the AtomPub binding!");
- }
-
- public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
- Acl addAces, Acl removeAces, ExtensionsData extension) {
- checkCreateProperties(properties);
-
- // find the link
- String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId));
-
- // post the new folder object
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // handle ACL modifications
- handleAclModifications(repositoryId, entry, addAces, removeAces);
-
- return entry.getId();
- }
-
- public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
- Acl addAces, Acl removeAces, ExtensionsData extension) {
- checkCreateProperties(properties);
-
- // find the link
- String link = null;
-
- if (folderId == null) {
- // Creation of unfiled objects via AtomPub is not defined in the
- // CMIS 1.0 specification. This implementation follow the CMIS 1.1
- // draft and POSTs the policy to the Unfiled collection.
-
- link = loadCollection(repositoryId, Constants.COLLECTION_UNFILED);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or unfiling not supported!");
- }
- } else {
- link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId));
-
- // post the new folder object
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // handle ACL modifications
- handleAclModifications(repositoryId, entry, addAces, removeAces);
-
- return entry.getId();
- }
-
- public String createItem(String repositoryId, Properties properties, String folderId, List<String> policies,
- Acl addAces, Acl removeAces, ExtensionsData extension) {
- checkCreateProperties(properties);
-
- // find the link
- String link = null;
-
- if (folderId == null) {
- link = loadCollection(repositoryId, Constants.COLLECTION_UNFILED);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or unfiling not supported!");
- }
- } else {
- link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId));
-
- // post the new folder object
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // handle ACL modifications
- handleAclModifications(repositoryId, entry, addAces, removeAces);
-
- return entry.getId();
- }
-
- public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- checkCreateProperties(properties);
-
- // find source id
- PropertyData<?> sourceIdProperty = properties.getProperties().get(PropertyIds.SOURCE_ID);
- if (!(sourceIdProperty instanceof PropertyId)) {
- throw new CmisInvalidArgumentException("Source Id is not set!");
- }
-
- String sourceId = ((PropertyId) sourceIdProperty).getFirstValue();
- if (sourceId == null) {
- throw new CmisInvalidArgumentException("Source Id is not set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, sourceId, Constants.REL_RELATIONSHIPS, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, sourceId, Constants.REL_RELATIONSHIPS, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId));
-
- // post the new folder object
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // handle ACL modifications
- handleAclModifications(repositoryId, entry, addAces, removeAces);
-
- return entry.getId();
- }
-
- public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- Properties properties, ExtensionsData extension) {
- // we need an object id
- if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId.getValue(), Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- if (changeToken != null) {
- // not required by the CMIS specification
- // -> keep for backwards compatibility with older OpenCMIS servers
- url.addParameter(Constants.PARAM_CHANGE_TOKEN, changeToken.getValue());
- }
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, changeToken == null ? null
- : changeToken.getValue(), null), getCmisVersion(repositoryId));
-
- // update
- Response resp = put(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse new entry
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- // set object id
- objectId.setValue(entry.getId());
-
- if (changeToken != null) {
- changeToken.setValue(null); // just in case
- }
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- // extract new change token
- if (changeToken != null) {
- ObjectData object = (ObjectData) element.getObject();
-
- if (object.getProperties() != null) {
- Object changeTokenStr = object.getProperties().getProperties()
- .get(PropertyIds.CHANGE_TOKEN);
- if (changeTokenStr instanceof PropertyString) {
- changeToken.setValue(((PropertyString) changeTokenStr).getFirstValue());
- }
- }
- }
- }
- }
- } finally {
- unlockLinks();
- }
- }
-
- public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(String repositoryId,
- List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties properties,
- List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds, ExtensionsData extension) {
- // find link
- String link = loadCollection(repositoryId, Constants.COLLECTION_BULK_UPDATE);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or bulk update properties is not supported!");
- }
-
- // set up writer
- final BulkUpdateImpl bulkUpdate = new BulkUpdateImpl();
- bulkUpdate.setObjectIdAndChangeToken(objectIdAndChangeToken);
- bulkUpdate.setProperties(properties);
- bulkUpdate.setAddSecondaryTypeIds(addSecondaryTypeIds);
- bulkUpdate.setRemoveSecondaryTypeIds(removeSecondaryTypeIds);
-
- final AtomEntryWriter entryWriter = new AtomEntryWriter(bulkUpdate);
-
- // post the new folder object
- Response resp = post(new UrlBuilder(link), Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
- List<BulkUpdateObjectIdAndChangeToken> result = new ArrayList<BulkUpdateObjectIdAndChangeToken>(feed
- .getEntries().size());
-
- // get the results
- if (!feed.getEntries().isEmpty()) {
-
- for (AtomEntry entry : feed.getEntries()) {
- // walk through the entry
- // we are not interested in the links this time because they
- // could belong to a new document version
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof ObjectData) {
- ObjectData object = (ObjectData) element.getObject();
- String id = object.getId();
- if (id != null) {
- String changeToken = null;
- PropertyData<?> changeTokenProp = object.getProperties().getProperties()
- .get(PropertyIds.CHANGE_TOKEN);
- if (changeTokenProp instanceof PropertyString) {
- changeToken = ((PropertyString) changeTokenProp).getFirstValue();
- }
-
- result.add(new BulkUpdateObjectIdAndChangeTokenImpl(id, changeToken));
- }
- }
- }
- }
- }
-
- return result;
- }
-
- public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions);
-
- delete(url);
- }
-
- public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
- UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
-
- // find the down links
- String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, null);
- String childrenLink = null;
-
- if (link != null) {
- // found only a children link, but no descendants link
- // -> try folder tree link
- childrenLink = link;
- link = null;
- } else {
- // found no or two down links
- // -> get only the descendants link
- link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- if (link == null) {
- link = loadLink(repositoryId, folderId, Constants.REL_FOLDERTREE, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- if (link == null) {
- link = loadLink(repositoryId, folderId, Constants.REL_FOLDERTREE, Constants.MEDIATYPE_FEED);
- }
-
- if (link == null) {
- link = childrenLink;
- }
-
- if (link == null) {
- throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions);
- url.addParameter(Constants.PARAM_UNFILE_OBJECTS, unfileObjects);
- url.addParameter(Constants.PARAM_CONTINUE_ON_FAILURE, continueOnFailure);
-
- // make the call
- Response resp = getHttpInvoker().invokeDELETE(url, getSession());
-
- // check response code
- if (resp.getResponseCode() == 200 || resp.getResponseCode() == 202 || resp.getResponseCode() == 204) {
- return new FailedToDeleteDataImpl();
- }
-
- // If the server returned an internal server error, get the remaining
- // children of the folder. We only retrieve the first level, since
- // getDescendants() is not supported by all repositories.
- if (resp.getResponseCode() == 500) {
- link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link != null) {
- url = new UrlBuilder(link);
- // we only want the object ids
- url.addParameter(Constants.PARAM_FILTER, "cmis:objectId");
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, false);
- url.addParameter(Constants.PARAM_RELATIONSHIPS, IncludeRelationships.NONE);
- url.addParameter(Constants.PARAM_RENDITION_FILTER, "cmis:none");
- url.addParameter(Constants.PARAM_PATH_SEGMENT, false);
- // 1000 children should be enough to indicate a problem
- url.addParameter(Constants.PARAM_MAX_ITEMS, 1000);
- url.addParameter(Constants.PARAM_SKIP_COUNT, 0);
-
- // read and parse
- resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // prepare result
- FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
- List<String> ids = new ArrayList<String>();
- result.setIds(ids);
-
- // get the children ids
- for (AtomEntry entry : feed.getEntries()) {
- ids.add(entry.getId());
- }
-
- return result;
- }
- }
-
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_ALLOWABLEACTIONS,
- Constants.MEDIATYPE_ALLOWABLEACTION);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_ALLOWABLEACTIONS,
- Constants.MEDIATYPE_ALLOWABLEACTION);
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // read and parse
- Response resp = read(url);
- AtomAllowableActions allowableActions = parse(resp.getStream(), AtomAllowableActions.class);
-
- return allowableActions.getAllowableActions();
- }
-
- public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
- BigInteger length, ExtensionsData extension) {
- // find the link
- String link = null;
- if (streamId != null) {
- // use the alternate link per spec
- link = loadLink(repositoryId, objectId, Constants.REL_ALTERNATE, streamId);
- if (link != null) {
- streamId = null; // we have a full URL now
- }
- }
- if (link == null) {
- link = loadLink(repositoryId, objectId, AtomPubParser.LINK_REL_CONTENT, null);
- }
-
- if (link == null) {
- throw new CmisConstraintException("No content stream");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- // using the content URL and adding a streamId param
- // is not spec-compliant
- url.addParameter(Constants.PARAM_STREAM_ID, streamId);
-
- // get the content
- Response resp = getHttpInvoker().invokeGET(url, getSession(), offset, length);
-
- // check response code
- if ((resp.getResponseCode() != 200) && (resp.getResponseCode() != 206)) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- ContentStreamImpl result;
- if (resp.getResponseCode() == 206) {
- result = new PartialContentStreamImpl();
- } else {
- result = new ContentStreamImpl();
- }
-
- String filename = null;
- String contentDisposition = resp.getHeader("Content-Disposition");
- if (contentDisposition != null) {
- filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
- }
-
- result.setFileName(filename);
- result.setLength(resp.getContentLength());
- result.setMimeType(resp.getContentTypeHeader());
- result.setStream(resp.getStream());
-
- return result;
- }
-
- public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeACL, ExtensionsData extension) {
-
- return getObjectInternal(repositoryId, IdentifierType.ID, objectId, ReturnVersion.THIS, filter,
- includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeACL, extension);
- }
-
- public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeACL, ExtensionsData extension) {
-
- return getObjectInternal(repositoryId, IdentifierType.PATH, path, ReturnVersion.THIS, filter,
- includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeACL, extension);
- }
-
- public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
- ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, objectId, ReturnVersion.THIS, filter,
- Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, extension);
-
- return object.getProperties();
- }
-
- public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, objectId, ReturnVersion.THIS,
- PropertyIds.OBJECT_ID, Boolean.FALSE, IncludeRelationships.NONE, renditionFilter, Boolean.FALSE,
- Boolean.FALSE, extension);
-
- List<RenditionData> result = object.getRenditions();
- if (result == null) {
- result = Collections.emptyList();
- }
-
- return result;
- }
-
- public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
- ExtensionsData extension) {
- if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- if ((targetFolderId == null) || (targetFolderId.length() == 0) || (sourceFolderId == null)
- || (sourceFolderId.length() == 0)) {
- throw new CmisInvalidArgumentException("Source and target folder must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, targetFolderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throwLinkException(repositoryId, targetFolderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_SOURCE_FOLDER_ID, sourceFolderId);
-
- // set up object and writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId.getValue()),
- getCmisVersion(repositoryId));
-
- // post move request
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- objectId.setValue(entry.getId());
- }
-
- public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
- Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
- setOrAppendContent(repositoryId, objectId, overwriteFlag, changeToken, contentStream, true, false, extension);
- }
-
- public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ExtensionsData extension) {
- // we need an object id
- if ((objectId == null) || (objectId.getValue() == null)) {
- throw new CmisInvalidArgumentException("Object ID must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- if (changeToken != null) {
- url.addParameter(Constants.PARAM_CHANGE_TOKEN, changeToken.getValue());
- }
-
- delete(url);
-
- objectId.setValue(null);
- if (changeToken != null) {
- changeToken.setValue(null);
- }
- }
-
- public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
- setOrAppendContent(repositoryId, objectId, null, changeToken, contentStream, isLastChunk, true, extension);
- }
-
- // ---- internal ----
-
- private static void checkCreateProperties(Properties properties) {
- if ((properties == null) || (properties.getProperties() == null)) {
- throw new CmisInvalidArgumentException("Properties must be set!");
- }
-
- if (!properties.getProperties().containsKey(PropertyIds.OBJECT_TYPE_ID)) {
- throw new CmisInvalidArgumentException("Property " + PropertyIds.OBJECT_TYPE_ID + " must be set!");
- }
-
- if (properties.getProperties().containsKey(PropertyIds.OBJECT_ID)) {
- throw new CmisInvalidArgumentException("Property " + PropertyIds.OBJECT_ID + " must not be set!");
- }
- }
-
- /**
- * Handles ACL modifications of newly created objects.
- */
- private void handleAclModifications(String repositoryId, AtomEntry entry, Acl addAces, Acl removeAces) {
- if (!isAclMergeRequired(addAces, removeAces)) {
- return;
- }
-
- Acl originalAces = getAclInternal(repositoryId, entry.getId(), Boolean.FALSE, null);
-
- if (originalAces != null) {
- // merge and update ACL
- Acl newACL = mergeAcls(originalAces, addAces, removeAces);
- if (newACL != null) {
- updateAcl(repositoryId, entry.getId(), newACL, null);
- }
- }
- }
-
- /**
- * Sets or appends content.
- */
- private void setOrAppendContent(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
- Holder<String> changeToken, ContentStream contentStream, boolean isLastChunk, boolean append,
- ExtensionsData extension) {
- // we need an object id
- if ((objectId == null) || (objectId.getValue() == null)) {
- throw new CmisInvalidArgumentException("Object ID must be set!");
- }
-
- // we need content
- if ((contentStream == null) || (contentStream.getStream() == null) || (contentStream.getMimeType() == null)) {
- throw new CmisInvalidArgumentException("Content must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- if (changeToken != null) {
- url.addParameter(Constants.PARAM_CHANGE_TOKEN, changeToken.getValue());
- }
-
- if (append) {
- url.addParameter(Constants.PARAM_APPEND, Boolean.TRUE);
- url.addParameter(Constants.PARAM_IS_LAST_CHUNK, isLastChunk);
- } else {
- url.addParameter(Constants.PARAM_OVERWRITE_FLAG, overwriteFlag);
- }
-
- final InputStream stream = contentStream.getStream();
-
- // Content-Disposition header for the filename
- Map<String, String> headers = null;
- if (contentStream.getFileName() != null) {
- headers = Collections
- .singletonMap(
- MimeHelper.CONTENT_DISPOSITION,
- MimeHelper.encodeContentDisposition(MimeHelper.DISPOSITION_ATTACHMENT,
- contentStream.getFileName()));
- }
-
- // send content
- Response resp = put(url, contentStream.getMimeType(), headers, new Output() {
- public void write(OutputStream out) throws IOException {
- IOUtils.copy(stream, out);
- }
- });
-
- // check response code further
- if ((resp.getResponseCode() != 200) && (resp.getResponseCode() != 201) && (resp.getResponseCode() != 204)) {
- throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
- }
-
- objectId.setValue(null);
- if (changeToken != null) {
- changeToken.setValue(null);
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java
deleted file mode 100644
index f6c6b67..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.spi.PolicyService;
-
-/**
- * Policy Service AtomPub client.
- */
-public class PolicyServiceImpl extends AbstractAtomPubService implements PolicyService {
-
- /**
- * Constructor.
- */
- public PolicyServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up object and writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId), getCmisVersion(repositoryId));
-
- // post applyPolicy request
- post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
- }
-
- public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
- ExtensionsData extension) {
- List<ObjectData> result = new ArrayList<ObjectData>();
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, filter);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // get the policies
- if (!feed.getEntries().isEmpty()) {
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData policy = null;
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof ObjectData) {
- policy = (ObjectData) element.getObject();
- }
- }
-
- if (policy != null) {
- result.add(policy);
- }
- }
- }
-
- return result;
- }
-
- public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- // we need a policy id
- if (policyId == null) {
- throw new CmisInvalidArgumentException("Policy id must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, PropertyIds.OBJECT_ID);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // find the policy
- String policyLink = null;
- boolean found = false;
-
- if (!feed.getEntries().isEmpty()) {
- for (AtomEntry entry : feed.getEntries()) {
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- AtomLink atomLink = (AtomLink) element.getObject();
- if (Constants.REL_SELF.equals(atomLink.getRel())) {
- policyLink = atomLink.getHref();
- }
- } else if (element.getObject() instanceof ObjectData) {
- String id = ((ObjectData) element.getObject()).getId();
- if (policyId.equals(id)) {
- found = true;
- }
- }
- }
-
- if (found) {
- break;
- }
- }
- }
-
- // if found, delete it
- if (found && (policyLink != null)) {
- delete(new UrlBuilder(policyLink));
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java
deleted file mode 100644
index f3dee3e..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
-import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
-import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
-
-/**
- * Relationship Service AtomPub client.
- */
-public class RelationshipServiceImpl extends AbstractAtomPubService implements RelationshipService {
-
- /**
- * Constructor.
- */
- public RelationshipServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
- RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectListImpl result = new ObjectListImpl();
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_RELATIONSHIPS, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_RELATIONSHIPS, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_SUB_RELATIONSHIP_TYPES, includeSubRelationshipTypes);
- url.addParameter(Constants.PARAM_RELATIONSHIP_DIRECTION, relationshipDirection);
- url.addParameter(Constants.PARAM_TYPE_ID, typeId);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
- url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
- url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // handle top level
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- }
- }
-
- // get the children
- if (!feed.getEntries().isEmpty()) {
- result.setObjects(new ArrayList<ObjectData>(feed.getEntries().size()));
-
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData relationship = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- relationship = (ObjectData) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (relationship != null) {
- result.getObjects().add(relationship);
- }
- }
-
- }
-
- return result;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
deleted file mode 100644
index 978b5fc..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionListImpl;
-import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
-
-/**
- * Repository Service AtomPub client.
- */
-public class RepositoryServiceImpl extends AbstractAtomPubService implements RepositoryService {
-
- /**
- * Constructor.
- */
- public RepositoryServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
- return getRepositoriesInternal(null);
- }
-
- public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
- List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId);
-
- if (repositoryInfos.size() == 0) {
- throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
- }
-
- if (repositoryInfos.size() == 1) {
- return repositoryInfos.get(0);
- }
-
- // find the repository
- for (RepositoryInfo info : repositoryInfos) {
- if (info.getId() == null) {
- continue;
- }
-
- if (info.getId().equals(repositoryId)) {
- return info;
- }
- }
-
- throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
- }
-
- public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
- return getTypeDefinitionInternal(repositoryId, typeId);
- }
-
- public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- TypeDefinitionListImpl result = new TypeDefinitionListImpl();
-
- // find the link
- String link = null;
- if (typeId == null) {
- link = loadCollection(repositoryId, Constants.COLLECTION_TYPES);
- } else {
- link = loadTypeLink(repositoryId, typeId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
- }
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or type!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
- url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
- url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // handle top level
- for (AtomElement element : feed.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- if (isNextLink(element)) {
- result.setHasMoreItems(Boolean.TRUE);
- }
- } else if (isInt(NAME_NUM_ITEMS, element)) {
- result.setNumItems((BigInteger) element.getObject());
- }
- }
-
- result.setList(new ArrayList<TypeDefinition>(feed.getEntries().size()));
-
- // get the children
- if (!feed.getEntries().isEmpty()) {
- for (AtomEntry entry : feed.getEntries()) {
- TypeDefinition child = null;
-
- lockTypeLinks();
- try {
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof TypeDefinition) {
- child = (TypeDefinition) element.getObject();
- }
- }
- } finally {
- unlockTypeLinks();
- }
-
- if (child != null) {
- result.getList().add(child);
- }
- }
- }
-
- return result;
- }
-
- public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
- Boolean includePropertyDefinitions, ExtensionsData extension) {
- List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();
-
- // find the link
- String link = null;
- if (typeId == null) {
- link = loadRepositoryLink(repositoryId, Constants.REP_REL_TYPEDESC);
- } else {
- link = loadTypeLink(repositoryId, typeId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
- }
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or type!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_DEPTH, depth);
- url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // process tree
- addTypeDescendantsLevel(repositoryId, feed, result);
-
- return result;
- }
-
- /**
- * Adds type descendants level recursively.
- */
- private void addTypeDescendantsLevel(String repositoryId, AtomFeed feed, List<TypeDefinitionContainer> containerList) {
- if ((feed == null) || (feed.getEntries().isEmpty())) {
- return;
- }
-
- // walk through the feed
- for (AtomEntry entry : feed.getEntries()) {
- TypeDefinitionContainerImpl childContainer = null;
- List<TypeDefinitionContainer> childContainerList = new ArrayList<TypeDefinitionContainer>();
-
- // walk through the entry
- lockTypeLinks();
- try {
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof TypeDefinition) {
- childContainer = new TypeDefinitionContainerImpl((TypeDefinition) element.getObject());
- } else if (element.getObject() instanceof AtomFeed) {
- addTypeDescendantsLevel(repositoryId, (AtomFeed) element.getObject(), childContainerList);
- }
- }
- } finally {
- unlockTypeLinks();
- }
-
- if (childContainer != null) {
- childContainer.setChildren(childContainerList);
- containerList.add(childContainer);
- }
- }
- }
-
- public TypeDefinition createType(String repositoryId, TypeDefinition type, ExtensionsData extension) {
- if (type == null) {
- throw new CmisInvalidArgumentException("Type definition must be set!");
- }
-
- String parentId = type.getParentTypeId();
- if (parentId == null) {
- throw new CmisInvalidArgumentException("Type definition has no parent type id!");
- }
-
- // find the link
- String link = loadTypeLink(repositoryId, parentId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or parent type!");
- }
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(type, getCmisVersion(repositoryId));
-
- // post the new type definition
- Response resp = post(new UrlBuilder(link), Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- lockTypeLinks();
- TypeDefinition result = null;
- try {
- // clean up cache
- removeTypeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof TypeDefinition) {
- result = (TypeDefinition) element.getObject();
- }
- }
- } finally {
- unlockTypeLinks();
- }
-
- return result;
- }
-
- public TypeDefinition updateType(String repositoryId, TypeDefinition type, ExtensionsData extension) {
- if (type == null) {
- throw new CmisInvalidArgumentException("Type definition must be set!");
- }
-
- String typeId = type.getId();
- if (typeId == null) {
- throw new CmisInvalidArgumentException("Type definition has no type id!");
- }
-
- // find the link
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put(Constants.PARAM_ID, typeId);
-
- String link = loadTemplateLink(repositoryId, Constants.TEMPLATE_TYPE_BY_ID, parameters);
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or type!");
- }
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(type, getCmisVersion(repositoryId));
-
- // post the new type definition
- Response resp = put(new UrlBuilder(link), Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- lockTypeLinks();
- TypeDefinition result = null;
- try {
- // clean up cache
- removeTypeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof TypeDefinition) {
- result = (TypeDefinition) element.getObject();
- }
- }
- } finally {
- unlockTypeLinks();
- }
-
- return result;
- }
-
- public void deleteType(String repositoryId, String typeId, ExtensionsData extension) {
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put(Constants.PARAM_ID, typeId);
-
- String link = loadTemplateLink(repositoryId, Constants.TEMPLATE_TYPE_BY_ID, parameters);
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository!");
- }
-
- delete(new UrlBuilder(link));
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/SpiSessionParameter.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/SpiSessionParameter.java
deleted file mode 100644
index 8612f51..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/SpiSessionParameter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-/**
- * Internal session parameters.
- */
-public final class SpiSessionParameter {
-
- public static final String LINK_CACHE = "org.apache.chemistry.opencmis.binding.atompub.linkcache";
-
- private SpiSessionParameter() {
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
deleted file mode 100644
index af7741a..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomElement;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Output;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.apache.chemistry.opencmis.commons.spi.VersioningService;
-
-/**
- * Versioning Service AtomPub client.
- */
-public class VersioningServiceImpl extends AbstractAtomPubService implements VersioningService {
-
- /**
- * Constructor.
- */
- public VersioningServiceImpl(BindingSession session) {
- setSession(session);
- }
-
- public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
- Holder<Boolean> contentCopied) {
- if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- // find the link
- String link = loadCollection(repositoryId, Constants.COLLECTION_CHECKEDOUT);
-
- if (link == null) {
- throw new CmisObjectNotFoundException("Unknown repository or checkedout collection not supported!");
- }
-
- UrlBuilder url = new UrlBuilder(link);
-
- // set up object and writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId.getValue()),
- getCmisVersion(repositoryId));
-
- // post move request
- Response resp = post(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse the response
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- objectId.setValue(entry.getId());
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (contentCopied != null) {
- contentCopied.setValue(null);
- }
- }
-
- public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
- }
-
- // prefer working copy link if available
- // (workaround for non-compliant repositories)
- String wcLink = getLink(repositoryId, objectId, Constants.REL_WORKINGCOPY, Constants.MEDIATYPE_ENTRY);
- if (wcLink != null) {
- link = wcLink;
- }
-
- delete(new UrlBuilder(link));
- }
-
- public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
- ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
- ExtensionsData extension) {
- // we need an object id
- if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
- throw new CmisInvalidArgumentException("Object id must be set!");
- }
-
- // find the link
- String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId.getValue(), Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
- }
-
- // prefer working copy link if available
- // (workaround for non-compliant repositories)
- String wcLink = getLink(repositoryId, objectId.getValue(), Constants.REL_WORKINGCOPY, Constants.MEDIATYPE_ENTRY);
- if (wcLink != null) {
- link = wcLink;
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_CHECKIN_COMMENT, checkinComment);
- url.addParameter(Constants.PARAM_MAJOR, major);
- url.addParameter(Constants.PARAM_CHECK_IN, "true");
-
- // set up writer
- final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
- getCmisVersion(repositoryId), contentStream);
-
- // update
- Response resp = put(url, Constants.MEDIATYPE_ENTRY, new Output() {
- public void write(OutputStream out) throws IOException {
- entryWriter.write(out);
- }
- });
-
- // parse new entry
- AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
-
- // we expect a CMIS entry
- if (entry.getId() == null) {
- throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
- }
-
- // set object id
- objectId.setValue(entry.getId());
-
- AccessControlListImpl originalAces = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- // extract current ACL
- ObjectData object = (ObjectData) element.getObject();
- if (object.getAcl() != null) {
- originalAces = new AccessControlListImpl(object.getAcl().getAces());
- originalAces.setExact(object.isExactAcl());
- }
- }
- }
- } finally {
- unlockLinks();
- }
-
- // handle ACL modifications
- if ((originalAces != null) && (isAclMergeRequired(addAces, removeAces))) {
- // merge and update ACL
- Acl newACL = mergeAcls(originalAces, addAces, removeAces);
- if (newACL != null) {
- updateAcl(repositoryId, entry.getId(), newACL, null);
- }
- }
- }
-
- public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
- Boolean includeAllowableActions, ExtensionsData extension) {
- List<ObjectData> result = new ArrayList<ObjectData>();
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_VERSIONHISTORY, Constants.MEDIATYPE_FEED);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_VERSIONHISTORY, Constants.MEDIATYPE_FEED);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_FILTER, filter);
- url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-
- // read and parse
- Response resp = read(url);
- AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
-
- // get the versions
- if (!feed.getEntries().isEmpty()) {
- for (AtomEntry entry : feed.getEntries()) {
- ObjectData version = null;
-
- lockLinks();
- try {
- // clean up cache
- removeLinks(repositoryId, entry.getId());
-
- // walk through the entry
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof AtomLink) {
- addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof ObjectData) {
- version = (ObjectData) element.getObject();
- }
- }
- } finally {
- unlockLinks();
- }
-
- if (version != null) {
- result.add(version);
- }
- }
- }
-
- return result;
- }
-
- public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
- Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {
-
- ReturnVersion returnVersion = ReturnVersion.LATEST;
- if ((major != null) && (major.booleanValue())) {
- returnVersion = ReturnVersion.LASTESTMAJOR;
- }
-
- return getObjectInternal(repositoryId, IdentifierType.ID, objectId, returnVersion, filter,
- includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeACL, extension);
- }
-
- public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
- Boolean major, String filter, ExtensionsData extension) {
-
- ReturnVersion returnVersion = ReturnVersion.LATEST;
- if ((major != null) && (major.booleanValue())) {
- returnVersion = ReturnVersion.LASTESTMAJOR;
- }
-
- ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, objectId, returnVersion, filter,
- Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, extension);
-
- return object.getProperties();
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java
deleted file mode 100644
index 34f711f..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import org.apache.chemistry.opencmis.commons.data.Acl;
-
-/**
- * AtomAcl.
- */
-public class AtomAcl extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private Acl acl;
-
- public AtomAcl() {
- super();
- }
-
- public AtomAcl(Acl acl) {
- this();
- this.acl = acl;
- }
-
- @Override
- public String getType() {
- return "ACL";
- }
-
- public Acl getACL() {
- return acl;
- }
-
- public void setACL(Acl acl) {
- this.acl = acl;
- }
-}
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java
deleted file mode 100644
index eef0f25..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import org.apache.chemistry.opencmis.commons.data.AllowableActions;
-
-/**
- * AtomAllowableActions.
- */
-public class AtomAllowableActions extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private AllowableActions allowableActions;
-
- public AtomAllowableActions() {
- super();
- }
-
- public AtomAllowableActions(AllowableActions allowableActions) {
- this();
- this.allowableActions = allowableActions;
- }
-
- @Override
- public String getType() {
- return "Allowable Actions";
- }
-
- public AllowableActions getAllowableActions() {
- return allowableActions;
- }
-
- public void setAllowableActions(AllowableActions allowableActions) {
- this.allowableActions = allowableActions;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java
deleted file mode 100644
index 5a269c1..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Base type for Atom responses.
- */
-public abstract class AtomBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final List<AtomElement> elements = new ArrayList<AtomElement>();
-
- protected AtomBase() {
- }
-
- public abstract String getType();
-
- public List<AtomElement> getElements() {
- return elements;
- }
-
- public void addElement(AtomElement element) {
- if (element != null) {
- elements.add(element);
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java
deleted file mode 100644
index 34a5b8d..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * Atom Element.
- */
-public class AtomElement implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final QName name;
- private final Object object;
-
- public AtomElement(QName name, Object object) {
- this.name = name;
- this.object = object;
- }
-
- public QName getName() {
- return name;
- }
-
- public Object getObject() {
- return object;
- }
-
- @Override
- public String toString() {
- return name + ": " + object;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java
deleted file mode 100644
index 0318f75..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-/**
- * Atom Entry.
- */
-public class AtomEntry extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private String id;
-
- public AtomEntry() {
- super();
- }
-
- @Override
- public String getType() {
- return "Atom Entry";
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public String toString() {
- return "Entry \"" + id + "\": " + getElements();
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java
deleted file mode 100644
index 75cad1b..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Atom Feed.
- */
-public class AtomFeed extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private final List<AtomEntry> entries = new ArrayList<AtomEntry>();
-
- public AtomFeed() {
- }
-
- @Override
- public String getType() {
- return "Atom Feed";
- }
-
- public List<AtomEntry> getEntries() {
- return entries;
- }
-
- public void addEntry(AtomEntry entry) {
- if (entry != null) {
- entries.add(entry);
- }
- }
-
- @Override
- public String toString() {
- return "Feed : " + getElements() + " " + entries;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java
deleted file mode 100644
index 2190f83..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import java.io.Serializable;
-
-/**
- * Atom Link.
- */
-public class AtomLink implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private String rel;
- private String type;
- private String href;
-
- public AtomLink() {
- }
-
- public String getRel() {
- return rel;
- }
-
- public void setRel(String rel) {
- this.rel = rel;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- @Override
- public String toString() {
- return "Link: rel=\"" + rel + "\" type=\"" + type + "\" href=\"" + href + "\"";
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java
deleted file mode 100644
index ab2e83f..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-public class HtmlDoc extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getType() {
- return "HTML document";
- }
-
-}
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java
deleted file mode 100644
index 5bd2d43..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-/**
- * Repository workspace.
- */
-public class RepositoryWorkspace extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private String id;
-
- public RepositoryWorkspace() {
- }
-
- @Override
- public String getType() {
- return "Repository Workspace";
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public String toString() {
- return "Workspace \"" + id + "\": " + getElements();
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java
deleted file mode 100644
index 0a3a5b4..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Service Doc.
- */
-public class ServiceDoc extends AtomBase {
-
- private static final long serialVersionUID = 1L;
-
- private final List<RepositoryWorkspace> workspaces = new ArrayList<RepositoryWorkspace>();
-
- public ServiceDoc() {
- }
-
- @Override
- public String getType() {
- return "Service Document";
- }
-
- public List<RepositoryWorkspace> getWorkspaces() {
- return workspaces;
- }
-
- public void addWorkspace(RepositoryWorkspace ws) {
- if (ws != null) {
- workspaces.add(ws);
- }
- }
-
- @Override
- public String toString() {
- return "Service Doc: " + workspaces;
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java
deleted file mode 100644
index 8a738c8..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.http;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketTimeoutException;
-import java.util.Collections;
-import java.util.List;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
-import org.apache.http.Header;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.conn.ConnectTimeoutException;
-import org.apache.http.conn.params.ConnManagerPNames;
-import org.apache.http.conn.params.ConnPerRouteBean;
-import org.apache.http.conn.scheme.LayeredSocketFactory;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
-import org.apache.http.cookie.Cookie;
-import org.apache.http.cookie.CookieOrigin;
-import org.apache.http.cookie.CookieSpec;
-import org.apache.http.cookie.CookieSpecFactory;
-import org.apache.http.cookie.MalformedCookieException;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
-import org.apache.http.impl.cookie.CookieSpecBase;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-
-/**
- * A {@link HttpInvoker} that uses The Apache HTTP client.
- */
-public class ApacheClientHttpInvoker extends AbstractApacheClientHttpInvoker {
-
- private static final String IGNORE_COOKIES = "ignoreCookies";
-
- protected DefaultHttpClient createHttpClient(UrlBuilder url, BindingSession session) {
- // set params
- HttpParams params = createDefaultHttpParams(session);
- params.setParameter(ClientPNames.COOKIE_POLICY, IGNORE_COOKIES);
-
- // set max connection
- String maxConnStr = System.getProperty("http.maxConnections", "5");
- int maxConn = 5;
- try {
- maxConn = Integer.parseInt(maxConnStr);
- } catch (NumberFormatException nfe) {
- // ignore
- }
- params.setIntParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, maxConn * 4);
- params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(maxConn));
-
- // set up scheme registry
- SchemeRegistry registry = new SchemeRegistry();
- registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
- registry.register(new Scheme("https", getSSLSocketFactory(url, session), 443));
-
- // set up connection manager
- ThreadSafeClientConnManager connManager = new ThreadSafeClientConnManager(params, registry);
-
- // set up proxy
- ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(registry, null);
-
- // set up client
- DefaultHttpClient httpclient = new DefaultHttpClient(connManager, params);
- httpclient.setRoutePlanner(routePlanner);
- httpclient.getCookieSpecs().register(IGNORE_COOKIES, new IgnoreSpecFactory());
-
- return httpclient;
- }
-
- /**
- * Builds a SSL Socket Factory for the Apache HTTP Client.
- */
- private LayeredSocketFactory getSSLSocketFactory(final UrlBuilder url, final BindingSession session) {
- // get authentication provider
- AuthenticationProvider authProvider = CmisBindingsHelper.getAuthenticationProvider(session);
-
- // check SSL Socket Factory
- final SSLSocketFactory sf = authProvider.getSSLSocketFactory();
- if (sf == null) {
- // no custom factory -> return default factory
- return org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory();
- }
-
- // check hostame verifier and use default if not set
- final HostnameVerifier hv = (authProvider.getHostnameVerifier() == null ? new BrowserCompatHostnameVerifier()
- : authProvider.getHostnameVerifier());
-
- // build new socket factory
- return new LayeredSocketFactory() {
-
- public boolean isSecure(Socket sock) {
- return true;
- }
-
- public Socket createSocket() throws IOException {
- return (SSLSocket) sf.createSocket();
- }
-
- public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
- SSLSocket sslSocket = (SSLSocket) sf.createSocket(socket, host, port, autoClose);
- verify(hv, host, sslSocket);
-
- return sslSocket;
- }
-
- public Socket connectSocket(Socket sock, String host, int port, InetAddress localAddress, int localPort,
- HttpParams params) throws IOException {
- SSLSocket sslSocket = (SSLSocket) (sock != null ? sock : createSocket());
-
- if (localAddress != null || localPort > 0) {
- if (localPort < 0) {
- localPort = 0;
- }
-
- InetSocketAddress isa = new InetSocketAddress(localAddress, localPort);
- sslSocket.bind(isa);
- }
-
- InetSocketAddress remoteAddress = new InetSocketAddress(host, port);
-
- int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
- int soTimeout = HttpConnectionParams.getSoTimeout(params);
-
- try {
- sslSocket.setSoTimeout(soTimeout);
- sslSocket.connect(remoteAddress, connTimeout);
- } catch (SocketTimeoutException ex) {
- closeSocket(sock);
- throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out!");
- }
-
- verify(hv, host, sslSocket);
-
- return sslSocket;
- }
- };
- }
-
- /**
- * A cookies spec factory that ignores cookies.
- */
- private static class IgnoreSpecFactory implements CookieSpecFactory {
- public CookieSpec newInstance(final HttpParams params) {
- return new CookieSpecBase() {
- public int getVersion() {
- return 0;
- }
-
- public List<Cookie> parse(Header header, CookieOrigin origin) throws MalformedCookieException {
- return Collections.emptyList();
- }
-
- public List<Header> formatCookies(List<Cookie> cookies) {
- return Collections.emptyList();
- }
-
- public Header getVersionHeader() {
- return null;
- }
- };
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
deleted file mode 100644
index 09380c1..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client.bindings.spi.http;
-
-import java.io.BufferedOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.GZIPOutputStream;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSocketFactory;
-
-import org.apache.chemistry.opencmis.client.bindings.impl.ClientVersion;
-import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
-import org.apache.chemistry.opencmis.commons.SessionParameter;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DefaultHttpInvoker implements HttpInvoker {
-
- private static final Logger LOG = LoggerFactory.getLogger(DefaultHttpInvoker.class);
-
- private static final int BUFFER_SIZE = 2 * 1024 * 1024;
-
- public DefaultHttpInvoker() {
- }
-
- public Response invokeGET(UrlBuilder url, BindingSession session) {
- return invoke(url, "GET", null, null, null, session, null, null);
- }
-
- public Response invokeGET(UrlBuilder url, BindingSession session, BigInteger offset, BigInteger length) {
- return invoke(url, "GET", null, null, null, session, offset, length);
- }
-
- public Response invokePOST(UrlBuilder url, String contentType, Output writer, BindingSession session) {
- return invoke(url, "POST", contentType, null, writer, session, null, null);
- }
-
- public Response invokePUT(UrlBuilder url, String contentType, Map<String, String> headers, Output writer,
- BindingSession session) {
- return invoke(url, "PUT", contentType, headers, writer, session, null, null);
- }
-
- public Response invokeDELETE(UrlBuilder url, BindingSession session) {
- return invoke(url, "DELETE", null, null, null, session, null, null);
- }
-
- private Response invoke(UrlBuilder url, String method, String contentType, Map<String, String> headers,
- Output writer, BindingSession session, BigInteger offset, BigInteger length) {
- int respCode = -1;
-
- try {
- // log before connect
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session {}: {} {}", session.getSessionId(), method, url);
- }
-
- // connect
- HttpURLConnection conn = (HttpURLConnection) (new URL(url.toString())).openConnection();
- conn.setRequestMethod(method);
- conn.setDoInput(true);
- conn.setDoOutput(writer != null);
- conn.setAllowUserInteraction(false);
- conn.setUseCaches(false);
- conn.setRequestProperty("User-Agent", ClientVersion.OPENCMIS_CLIENT);
-
- // timeouts
- int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1);
- if (connectTimeout >= 0) {
- conn.setConnectTimeout(connectTimeout);
- }
-
- int readTimeout = session.get(SessionParameter.READ_TIMEOUT, -1);
- if (readTimeout >= 0) {
- conn.setReadTimeout(readTimeout);
- }
-
- // set content type
- if (contentType != null) {
- conn.setRequestProperty("Content-Type", contentType);
- }
- // set other headers
- if (headers != null) {
- for (Map.Entry<String, String> header : headers.entrySet()) {
- conn.addRequestProperty(header.getKey(), header.getValue());
- }
- }
-
- // authenticate
- AuthenticationProvider authProvider = CmisBindingsHelper.getAuthenticationProvider(session);
- if (authProvider != null) {
- Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString());
- if (httpHeaders != null) {
- for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
- if (header.getKey() != null && header.getValue() != null && !header.getValue().isEmpty()) {
- String key = header.getKey();
- if (key.equalsIgnoreCase("user-agent")) {
- conn.setRequestProperty("User-Agent", header.getValue().get(0));
- } else {
- for (String value : header.getValue()) {
- if (value != null) {
- conn.addRequestProperty(key, value);
- }
- }
- }
- }
- }
- }
-
- if (conn instanceof HttpsURLConnection) {
- SSLSocketFactory sf = authProvider.getSSLSocketFactory();
- if (sf != null) {
- ((HttpsURLConnection) conn).setSSLSocketFactory(sf);
- }
-
- HostnameVerifier hv = authProvider.getHostnameVerifier();
- if (hv != null) {
- ((HttpsURLConnection) conn).setHostnameVerifier(hv);
- }
- }
- }
-
- // range
- if ((offset != null) || (length != null)) {
- StringBuilder sb = new StringBuilder("bytes=");
-
- if ((offset == null) || (offset.signum() == -1)) {
- offset = BigInteger.ZERO;
- }
-
- sb.append(offset.toString());
- sb.append('-');
-
- if ((length != null) && (length.signum() == 1)) {
- sb.append(offset.add(length.subtract(BigInteger.ONE)).toString());
- }
-
- conn.setRequestProperty("Range", sb.toString());
- }
-
- // compression
- Object compression = session.get(SessionParameter.COMPRESSION);
- if ((compression != null) && Boolean.parseBoolean(compression.toString())) {
- conn.setRequestProperty("Accept-Encoding", "gzip,deflate");
- }
-
- // locale
- if (session.get(CmisBindingsHelper.ACCEPT_LANGUAGE) instanceof String) {
- conn.setRequestProperty("Accept-Language", session.get(CmisBindingsHelper.ACCEPT_LANGUAGE).toString());
- }
-
- // send data
- if (writer != null) {
-
- //Not supported with All server.
- //conn.setChunkedStreamingMode((64 * 1024) - 1);
-
- OutputStream connOut = null;
-
- Object clientCompression = session.get(SessionParameter.CLIENT_COMPRESSION);
- if ((clientCompression != null) && Boolean.parseBoolean(clientCompression.toString())) {
- conn.setRequestProperty("Content-Encoding", "gzip");
- connOut = new GZIPOutputStream(conn.getOutputStream(), 4096);
- } else {
- connOut = conn.getOutputStream();
- }
-
- OutputStream out = new BufferedOutputStream(connOut, BUFFER_SIZE);
- writer.write(out);
- out.flush();
-
- if (connOut instanceof GZIPOutputStream) {
- ((GZIPOutputStream) connOut).finish();
- }
- }
-
- // connect
- conn.connect();
-
- // get stream, if present
- respCode = conn.getResponseCode();
- InputStream inputStream = null;
- if ((respCode == 200) || (respCode == 201) || (respCode == 203) || (respCode == 206)) {
- inputStream = conn.getInputStream();
- }
-
- // log after connect
- if (LOG.isTraceEnabled()) {
- LOG.trace("Session {}: {} {} > Headers: {}", session.getSessionId(), method, url, conn
- .getHeaderFields().toString());
- }
-
- // forward response HTTP headers
- if (authProvider != null) {
- authProvider.putResponseHeaders(url.toString(), respCode, conn.getHeaderFields());
- }
-
- // get the response
- return new Response(respCode, conn.getResponseMessage(), conn.getHeaderFields(), inputStream,
- conn.getErrorStream());
- } catch (Exception e) {
- String status = (respCode > 0 ? " (HTTP status code " + respCode + ")" : "");
- throw new CmisConnectionException("Cannot access \"" + url + "\"" + status + ": " + e.getMessage(), e);
- }
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
deleted file mode 100644
index 9b90e19..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
+++ /dev/null
@@ -1,2743 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.commons.impl;
-
-import static org.apache.chemistry.opencmis.commons.impl.XMLConstants.*;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.GregorianCalendar;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.chemistry.opencmis.commons.data.Ace;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
-import org.apache.chemistry.opencmis.commons.data.AllowableActions;
-import org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
-import org.apache.chemistry.opencmis.commons.data.ChangeEventInfo;
-import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
-import org.apache.chemistry.opencmis.commons.data.CreatablePropertyTypes;
-import org.apache.chemistry.opencmis.commons.data.ExtensionFeature;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.NewTypeSettableAttributes;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.PermissionMapping;
-import org.apache.chemistry.opencmis.commons.data.PolicyIdList;
-import org.apache.chemistry.opencmis.commons.data.Principal;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.data.PropertyBoolean;
-import org.apache.chemistry.opencmis.commons.data.PropertyData;
-import org.apache.chemistry.opencmis.commons.data.PropertyDateTime;
-import org.apache.chemistry.opencmis.commons.data.PropertyDecimal;
-import org.apache.chemistry.opencmis.commons.data.PropertyHtml;
-import org.apache.chemistry.opencmis.commons.data.PropertyId;
-import org.apache.chemistry.opencmis.commons.data.PropertyInteger;
-import org.apache.chemistry.opencmis.commons.data.PropertyString;
-import org.apache.chemistry.opencmis.commons.data.PropertyUri;
-import org.apache.chemistry.opencmis.commons.data.RenditionData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.Choice;
-import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyBooleanDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDateTimeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDecimalDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyHtmlDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyIdDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyIntegerDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyStringDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyUriDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeMutability;
-import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.enums.Action;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityOrderBy;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
-import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions;
-import org.apache.chemistry.opencmis.commons.enums.Cardinality;
-import org.apache.chemistry.opencmis.commons.enums.ChangeType;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
-import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
-import org.apache.chemistry.opencmis.commons.enums.DateTimeResolution;
-import org.apache.chemistry.opencmis.commons.enums.DecimalPrecision;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
-import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions;
-import org.apache.chemistry.opencmis.commons.enums.Updatability;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyData;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AllowableActionsImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChangeEventInfoDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.CreatablePropertyTypesImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ExtensionFeatureImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ItemTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.NewTypeSettableAttributesImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionDefinitionDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionMappingDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.QueryTypeImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.SecondaryTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlSerializer;
-
-public final class XMLConverter {
-
- private static final Logger LOG = LoggerFactory.getLogger(XMLConverter.class);
-
- private XMLConverter() {
- }
-
- // ---------------
- // --- writers ---
- // ---------------
-
- public static void writeRepositoryInfo(XmlSerializer writer, CmisVersion cmisVersion, String namespace,
- RepositoryInfo source) throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(namespace, TAG_REPOSITORY_INFO);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_ID, source.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_NAME, source.getName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_DESCRIPTION, source.getDescription());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_VENDOR, source.getVendorName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT, source.getProductName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT_VERSION, source.getProductVersion());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_ROOT_FOLDER_ID, source.getRootFolderId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGE_LOG_TOKEN,
- source.getLatestChangeLogToken());
- writeRepositoryCapabilities(writer, cmisVersion, source.getCapabilities());
- writeAclCapabilities(writer, cmisVersion, source.getAclCapabilities());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CMIS_VERSION_SUPPORTED,
- source.getCmisVersionSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_THIN_CLIENT_URI, source.getThinClientUri());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_INCOMPLETE,
- source.getChangesIncomplete());
- if (source.getChangesOnType() != null) {
- for (BaseTypeId baseType : source.getChangesOnType()) {
- if (cmisVersion == CmisVersion.CMIS_1_0 && baseType == BaseTypeId.CMIS_ITEM) {
- LOG.warn("Receiver only understands CMIS 1.0 but the Changes On Type list in the Repository info contains the base type Item. "
- + "The Item base type has been removed from the list.");
- continue;
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_ON_TYPE, baseType);
- }
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANONYMOUS,
- source.getPrincipalIdAnonymous());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANYONE,
- source.getPrincipalIdAnyone());
- if (cmisVersion != CmisVersion.CMIS_1_0 && source.getExtensionFeatures() != null) {
- for (ExtensionFeature feature : source.getExtensionFeatures()) {
- writeExtendedFeatures(writer, cmisVersion, feature);
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(namespace, TAG_REPOSITORY_INFO);
- }
-
- public static void writeRepositoryCapabilities(XmlSerializer writer, CmisVersion cmisVersion,
- RepositoryCapabilities source) throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_REPINFO_CAPABILITIES);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ACL, source.getAclCapability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ALL_VERSIONS_SEARCHABLE,
- source.isAllVersionsSearchableSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CHANGES, source.getChangesCapability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CONTENT_STREAM_UPDATABILITY,
- source.getContentStreamUpdatesCapability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_GET_DESCENDANTS, source.isGetDescendantsSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_GET_FOLDER_TREE, source.isGetFolderTreeSupported());
- if (cmisVersion != CmisVersion.CMIS_1_0) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ORDER_BY, source.getOrderByCapability());
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_MULTIFILING, source.isMultifilingSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_PWC_SEARCHABLE, source.isPwcSearchableSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_PWC_UPDATABLE, source.isPwcUpdatableSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_QUERY, source.getQueryCapability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_RENDITIONS, source.getRenditionsCapability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_UNFILING, source.isUnfilingSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_VERSION_SPECIFIC_FILING,
- source.isVersionSpecificFilingSupported());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_JOIN, source.getJoinCapability());
- if (cmisVersion != CmisVersion.CMIS_1_0) {
- if (source.getCreatablePropertyTypes() != null) {
- CreatablePropertyTypes creatablePropertyTypes = source.getCreatablePropertyTypes();
-
- writer.startTag(NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES);
-
- if (creatablePropertyTypes.canCreate() != null) {
- for (PropertyType pt : creatablePropertyTypes.canCreate()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE,
- pt);
- }
- }
-
- writeExtensions(writer, creatablePropertyTypes);
- writer.endTag(NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES);
- }
- if (source.getNewTypeSettableAttributes() != null) {
- NewTypeSettableAttributes newTypeSettableAttributes = source.getNewTypeSettableAttributes();
-
- writer.startTag(NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_ID,
- newTypeSettableAttributes.canSetId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAME,
- newTypeSettableAttributes.canSetLocalName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
- TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAMESPACE,
- newTypeSettableAttributes.canSetLocalNamespace());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DISPLAYNAME,
- newTypeSettableAttributes.canSetDisplayName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYNAME,
- newTypeSettableAttributes.canSetQueryName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DESCRIPTION,
- newTypeSettableAttributes.canSetDescription());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CREATEABLE,
- newTypeSettableAttributes.canSetCreatable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FILEABLE,
- newTypeSettableAttributes.canSetFileable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYABLE,
- newTypeSettableAttributes.canSetQueryable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
- TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FULLTEXTINDEXED,
- newTypeSettableAttributes.canSetFulltextIndexed());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
- TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_INCLUDEDINSUPERTYTPEQUERY,
- newTypeSettableAttributes.canSetIncludedInSupertypeQuery());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
- TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEPOLICY,
- newTypeSettableAttributes.canSetControllablePolicy());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
- TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEACL,
- newTypeSettableAttributes.canSetControllableAcl());
-
- writeExtensions(writer, newTypeSettableAttributes);
- writer.endTag(NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES);
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_REPINFO_CAPABILITIES);
- }
-
- public static void writeAclCapabilities(XmlSerializer writer, CmisVersion cmisVersion, AclCapabilities source)
- throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_REPINFO_ACL_CAPABILITIES);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_SUPPORTED_PERMISSIONS,
- source.getSupportedPermissions());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_ACL_PROPAGATION, source.getAclPropagation());
- if (source.getPermissions() != null) {
- for (PermissionDefinition pd : source.getPermissions()) {
- writer.startTag(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSIONS);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_PERMISSION, pd.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_DESCRIPTION,
- pd.getDescription());
-
- writeExtensions(writer, pd);
- writer.endTag(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSIONS);
- }
- }
- if (source.getPermissionMapping() != null) {
- for (PermissionMapping pm : source.getPermissionMapping().values()) {
- writer.startTag(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_MAPPING);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_KEY, pm.getKey());
- if (pm.getPermissions() != null) {
- for (String perm : pm.getPermissions()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_PERMISSION, perm);
- }
- }
-
- writeExtensions(writer, pm);
- writer.endTag(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_MAPPING);
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_REPINFO_ACL_CAPABILITIES);
- }
-
- public static void writeExtendedFeatures(XmlSerializer writer, CmisVersion cmisVersion, ExtensionFeature source)
- throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_REPINFO_EXTENDED_FEATURES);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_ID, source.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_URL, source.getUrl());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_COMMON_NAME, source.getCommonName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_VERSION_LABEL, source.getVersionLabel());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DESCRIPTION, source.getDescription());
- if (source.getFeatureData() != null) {
- for (Map.Entry<String, String> data : source.getFeatureData().entrySet()) {
- writer.startTag(NAMESPACE_CMIS, TAG_FEATURE_DATA);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DATA_KEY, data.getKey());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DATA_VALUE, data.getValue());
-
- writer.endTag(NAMESPACE_CMIS, TAG_FEATURE_DATA);
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_REPINFO_EXTENDED_FEATURES);
- }
-
- // --------------------------
- // --- definition writers ---
- // --------------------------
-
- public static void writeTypeDefinition(XmlSerializer writer, CmisVersion cmisVersion, String namespace,
- TypeDefinition source) throws IOException {
- if (source == null) {
- return;
- }
-
- if (cmisVersion == CmisVersion.CMIS_1_0) {
- if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) {
- LOG.warn("Receiver only understands CMIS 1.0. It may not able to handle an Item type definition.");
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY) {
- LOG.warn("Receiver only understands CMIS 1.0. It may not able to handle a Secondary type definition.");
- }
- }
-
- writer.setPrefix(PREFIX_XSI, NAMESPACE_XSI);
- writer.startTag(namespace, TAG_TYPE);
- writer.attribute("", XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
-
- if (source.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_DOCUMENT_TYPE);
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_FOLDER_TYPE);
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_RELATIONSHIP_TYPE);
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_POLICY_TYPE);
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_ITEM_TYPE);
- } else if (source.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY) {
- writer.attribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_SECONDARY_TYPE);
- } else {
- throw new CmisRuntimeException("Type definition has no base type id!");
- }
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ID, source.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_LOCALNAME, source.getLocalName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_LOCALNAMESPACE, source.getLocalNamespace());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_DISPLAYNAME, source.getDisplayName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_QUERYNAME, source.getQueryName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_DESCRIPTION, source.getDescription());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_BASE_ID, source.getBaseTypeId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_PARENT_ID, source.getParentTypeId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CREATABLE, source.isCreatable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_FILEABLE, source.isFileable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_QUERYABLE, source.isQueryable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_FULLTEXT_INDEXED, source.isFulltextIndexed());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_INCLUDE_IN_SUPERTYPE_QUERY,
- source.isIncludedInSupertypeQuery());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_POLICY, source.isControllablePolicy());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_ACL, source.isControllableAcl());
- if (cmisVersion != CmisVersion.CMIS_1_0 && source.getTypeMutability() != null) {
- TypeMutability tm = source.getTypeMutability();
-
- writer.startTag(NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_CREATE, tm.canCreate());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_UPDATE, tm.canUpdate());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_DELETE, tm.canDelete());
-
- writeExtensions(writer, tm);
- writer.endTag(NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY);
- }
- if (source.getPropertyDefinitions() != null) {
- for (PropertyDefinition<?> pd : source.getPropertyDefinitions().values()) {
- writePropertyDefinition(writer, cmisVersion, pd);
- }
- }
-
- if (source instanceof DocumentTypeDefinition) {
- DocumentTypeDefinition docDef = (DocumentTypeDefinition) source;
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_VERSIONABLE, docDef.isVersionable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTENTSTREAM_ALLOWED,
- docDef.getContentStreamAllowed());
- }
-
- if (source instanceof RelationshipTypeDefinition) {
- RelationshipTypeDefinition relDef = (RelationshipTypeDefinition) source;
- if (relDef.getAllowedSourceTypeIds() != null) {
- for (String id : relDef.getAllowedSourceTypeIds()) {
- if (id != null) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_SOURCE_TYPES, id);
- }
- }
- }
- if (relDef.getAllowedTargetTypeIds() != null) {
- for (String id : relDef.getAllowedTargetTypeIds()) {
- if (id != null) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_TARGET_TYPES, id);
- }
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(namespace, TAG_TYPE);
- }
-
- public static void writePropertyDefinition(XmlSerializer writer, CmisVersion cmisVersion,
- PropertyDefinition<?> source) throws IOException {
- if (source == null) {
- return;
- }
-
- if (source.getPropertyType() == null) {
- throw new CmisRuntimeException("Property type for property definition '" + source.getId() + "' is not set!");
- }
-
- String tagName = "";
- switch (source.getPropertyType()) {
- case STRING:
- tagName = TAG_TYPE_PROP_DEF_STRING;
- break;
- case ID:
- tagName = TAG_TYPE_PROP_DEF_ID;
- break;
- case INTEGER:
- tagName = TAG_TYPE_PROP_DEF_INTEGER;
- break;
- case BOOLEAN:
- tagName = TAG_TYPE_PROP_DEF_BOOLEAN;
- break;
- case DATETIME:
- tagName = TAG_TYPE_PROP_DEF_DATETIME;
- break;
- case DECIMAL:
- tagName = TAG_TYPE_PROP_DEF_DECIMAL;
- break;
- case HTML:
- tagName = TAG_TYPE_PROP_DEF_HTML;
- break;
- case URI:
- tagName = TAG_TYPE_PROP_DEF_URI;
- break;
- default:
- throw new CmisRuntimeException("Property defintion has no property type!");
- }
- writer.startTag(NAMESPACE_CMIS, tagName);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ID, source.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAME, source.getLocalName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAMESPACE,
- source.getLocalNamespace());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DISPLAYNAME, source.getDisplayName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYNAME, source.getQueryName());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DESCRIPTION, source.getDescription());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PROPERTY_TYPE, source.getPropertyType());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CARDINALITY, source.getCardinality());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_UPDATABILITY, source.getUpdatability());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_INHERITED, source.isInherited());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_REQUIRED, source.isRequired());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYABLE, source.isQueryable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ORDERABLE, source.isOrderable());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_OPENCHOICE, source.isOpenChoice());
-
- if (source instanceof PropertyStringDefinition) {
- PropertyStringDefinition def = (PropertyStringDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyStringImpl((String) null, def.getDefaultValue()), true);
- }
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_LENGTH, def.getMaxLength());
- } else if (source instanceof PropertyIdDefinition) {
- PropertyIdDefinition def = (PropertyIdDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyIdImpl((String) null, def.getDefaultValue()), true);
- }
- } else if (source instanceof PropertyIntegerDefinition) {
- PropertyIntegerDefinition def = (PropertyIntegerDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyIntegerImpl((String) null, def.getDefaultValue()), true);
- }
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
- } else if (source instanceof PropertyBooleanDefinition) {
- PropertyBooleanDefinition def = (PropertyBooleanDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyBooleanImpl((String) null, def.getDefaultValue()), true);
- }
- } else if (source instanceof PropertyDateTimeDefinition) {
- PropertyDateTimeDefinition def = (PropertyDateTimeDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyDateTimeImpl((String) null, def.getDefaultValue()), true);
- }
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_RESOLUTION,
- def.getDateTimeResolution());
- } else if (source instanceof PropertyDecimalDefinition) {
- PropertyDecimalDefinition def = (PropertyDecimalDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyDecimalImpl((String) null, def.getDefaultValue()), true);
- }
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PRECISION, def.getPrecision());
- } else if (source instanceof PropertyHtmlDefinition) {
- PropertyHtmlDefinition def = (PropertyHtmlDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyHtmlImpl((String) null, def.getDefaultValue()), true);
- }
- } else if (source instanceof PropertyUriDefinition) {
- PropertyUriDefinition def = (PropertyUriDefinition) source;
-
- if (def.getDefaultValue() != null) {
- writeProperty(writer, new PropertyUriImpl((String) null, def.getDefaultValue()), true);
- }
- }
-
- if (source.getChoices() != null) {
- for (Choice<?> c : source.getChoices()) {
- if (c != null) {
- writeChoice(writer, source.getPropertyType(), c);
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, tagName);
- }
-
- @SuppressWarnings("unchecked")
- public static void writeChoice(XmlSerializer writer, PropertyType propType, Choice<?> source) throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE);
-
- if (source.getDisplayName() != null) {
- writer.attribute("", ATTR_PROPERTY_TYPE_CHOICE_DISPLAYNAME, source.getDisplayName());
- }
-
- if (source.getValue() != null) {
- switch (propType) {
- case STRING:
- case ID:
- case HTML:
- case URI:
- for (String value : (List<String>) source.getValue()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
- }
- break;
- case INTEGER:
- for (BigInteger value : (List<BigInteger>) source.getValue()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
- }
- break;
- case BOOLEAN:
- for (Boolean value : (List<Boolean>) source.getValue()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
- }
- break;
- case DATETIME:
- for (GregorianCalendar value : (List<GregorianCalendar>) source.getValue()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
- }
- break;
- case DECIMAL:
- for (BigDecimal value : (List<BigDecimal>) source.getValue()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
- }
- break;
- default:
- }
- }
-
- if (source.getChoice() != null) {
- for (Choice<?> c : source.getChoice()) {
- if (c != null) {
- writeChoice(writer, propType, c);
- }
- }
- }
-
- writer.endTag(NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE);
- }
-
- // -----------------------
- // --- object writers ---
- // -----------------------
-
- public static void writeObject(XmlSerializer writer, CmisVersion cmisVersion, String namespace, ObjectData source)
- throws IOException {
- writeObject(writer, cmisVersion, false, TAG_OBJECT, namespace, source);
- }
-
- public static void writeObject(XmlSerializer writer, CmisVersion cmisVersion, boolean root, String name,
- String namespace, ObjectData source) throws IOException {
-
- if (source == null) {
- return;
- }
-
- if (cmisVersion == CmisVersion.CMIS_1_0) {
- if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) {
- LOG.warn("Receiver only understands CMIS 1.0. It may not be able to handle an Item object.");
- }
- }
-
- if (root) {
- writer.startTag(NAMESPACE_CMIS, name);
- writer.attribute("", PREFIX_CMIS, NAMESPACE_CMIS);
- namespace = NAMESPACE_CMIS;
- } else {
- writer.startTag(namespace, name);
- }
-
- if (source.getProperties() != null) {
- Properties properties = source.getProperties();
-
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_PROPERTIES);
-
- if (properties.getPropertyList() != null) {
- for (PropertyData<?> property : properties.getPropertyList()) {
- writeProperty(writer, property, false);
- }
- }
-
- writeExtensions(writer, properties);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_PROPERTIES);
- }
- if (source.getAllowableActions() != null) {
- writeAllowableActions(writer, cmisVersion, false, source.getAllowableActions());
- }
- if (source.getRelationships() != null) {
- for (ObjectData rel : source.getRelationships()) {
- if (rel != null) {
- writeObject(writer, cmisVersion, false, TAG_OBJECT_RELATIONSHIP, NAMESPACE_CMIS, rel);
- }
- }
- }
- if (source.getChangeEventInfo() != null) {
- ChangeEventInfo info = source.getChangeEventInfo();
-
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_CHANGE_EVENT_INFO);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TYPE, info.getChangeType());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TIME, info.getChangeTime());
-
- writeExtensions(writer, info);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_CHANGE_EVENT_INFO);
- }
- if (source.getAcl() != null) {
- writeAcl(writer, cmisVersion, false, source.getAcl());
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_OBJECT_EXACT_ACL, source.isExactAcl());
- if (source.getPolicyIds() != null) {
- PolicyIdList pids = source.getPolicyIds();
-
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_POLICY_IDS);
-
- if (pids.getPolicyIds() != null) {
- for (String id : pids.getPolicyIds()) {
- if (id != null) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_POLICY_ID, id);
- }
- }
- }
-
- writeExtensions(writer, pids);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_POLICY_IDS);
- }
- if (source.getRenditions() != null) {
- for (RenditionData rend : source.getRenditions()) {
- if (rend != null) {
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_RENDITION);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_STREAM_ID, rend.getStreamId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_MIMETYPE, rend.getMimeType());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_LENGTH, rend.getBigLength());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_KIND, rend.getKind());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_TITLE, rend.getTitle());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_HEIGHT, rend.getBigHeight());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_WIDTH, rend.getBigWidth());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_DOCUMENT_ID,
- rend.getRenditionDocumentId());
-
- writeExtensions(writer, rend);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_RENDITION);
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(namespace, name);
- }
-
- @SuppressWarnings("unchecked")
- public static void writeProperty(XmlSerializer writer, PropertyData<?> source, boolean isDefaultValue)
- throws IOException {
- if (source == null) {
- return;
- }
-
- String tagName = TAG_PROPERTY_TYPE_DEAULT_VALUE;
- if (isDefaultValue) {
- tagName = TAG_PROPERTY_TYPE_DEAULT_VALUE;
- } else {
- if (source instanceof PropertyString) {
- tagName = TAG_PROP_STRING;
- } else if (source instanceof PropertyId) {
- tagName = TAG_PROP_ID;
- } else if (source instanceof PropertyInteger) {
- tagName = TAG_PROP_INTEGER;
- } else if (source instanceof PropertyBoolean) {
- tagName = TAG_PROP_BOOLEAN;
- } else if (source instanceof PropertyDateTime) {
- tagName = TAG_PROP_DATETIME;
- } else if (source instanceof PropertyDecimal) {
- tagName = TAG_PROP_DECIMAL;
- } else if (source instanceof PropertyHtml) {
- tagName = TAG_PROP_HTML;
- } else if (source instanceof PropertyUri) {
- tagName = TAG_PROP_URI;
- } else {
- throw new CmisRuntimeException("Invalid property!");
- }
- }
-
- writer.startTag(NAMESPACE_CMIS, tagName);
-
- if (source.getId() != null) {
- writer.attribute(null, ATTR_PROPERTY_ID, source.getId());
- }
- if (source.getDisplayName() != null) {
- writer.attribute(null, ATTR_PROPERTY_DISPLAYNAME, source.getDisplayName());
- }
- if (source.getLocalName() != null) {
- writer.attribute(null, ATTR_PROPERTY_LOCALNAME, source.getLocalName());
- }
- if (source.getQueryName() != null) {
- writer.attribute(null, ATTR_PROPERTY_QUERYNAME, source.getQueryName());
- }
-
- if ((source instanceof PropertyString) || (source instanceof PropertyId) || (source instanceof PropertyHtml)
- || (source instanceof PropertyUri)) {
- List<String> values = (List<String>) source.getValues();
- if (values != null) {
- for (String value : values) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
- }
- }
- } else if (source instanceof PropertyInteger) {
- List<BigInteger> values = ((PropertyInteger) source).getValues();
- if (values != null) {
- for (BigInteger value : values) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
- }
- }
- } else if (source instanceof PropertyBoolean) {
- List<Boolean> values = ((PropertyBoolean) source).getValues();
- if (values != null) {
- for (Boolean value : values) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
- }
- }
- } else if (source instanceof PropertyDateTime) {
- List<GregorianCalendar> values = ((PropertyDateTime) source).getValues();
- if (values != null) {
- for (GregorianCalendar value : values) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
- }
- }
- } else if (source instanceof PropertyDecimal) {
- List<BigDecimal> values = ((PropertyDecimal) source).getValues();
- if (values != null) {
- for (BigDecimal value : values) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, tagName);
- }
-
- public static void writeAllowableActions(XmlSerializer writer, CmisVersion cmisVersion, boolean root,
- AllowableActions source) throws IOException {
- if (source == null) {
- return;
- }
-
- if (root) {
- writer.startTag(NAMESPACE_CMIS, "allowableActions");
- writer.attribute("", PREFIX_CMIS, NAMESPACE_CMIS);
- } else {
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_ALLOWABLE_ACTIONS);
- }
-
- if (source.getAllowableActions() != null) {
- for (Action action : Action.values()) {
- if (source.getAllowableActions().contains(action)) {
- if (action == Action.CAN_CREATE_ITEM && cmisVersion == CmisVersion.CMIS_1_0) {
- LOG.warn("Receiver only understands CMIS 1.0 but the Allowable Actions contain the canCreateItem action. "
- + "The canCreateItem action has been removed from the Allowable Actions.");
- continue;
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, action.value(), Boolean.TRUE);
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_ALLOWABLE_ACTIONS);
- }
-
- public static void writeAcl(XmlSerializer writer, CmisVersion cmisVersion, boolean root, Acl source)
- throws IOException {
- if (source == null) {
- return;
- }
-
- if (root) {
- writer.startTag(NAMESPACE_CMIS, "acl");
- writer.attribute("", PREFIX_CMIS, NAMESPACE_CMIS);
- } else {
- writer.startTag(NAMESPACE_CMIS, TAG_OBJECT_ACL);
- }
-
- if (source.getAces() != null) {
- for (Ace ace : source.getAces()) {
- if (ace != null) {
- writer.startTag(NAMESPACE_CMIS, TAG_ACL_PERMISSISONS);
-
- if (ace.getPrincipal() != null) {
- Principal principal = ace.getPrincipal();
-
- writer.startTag(NAMESPACE_CMIS, TAG_ACE_PRINCIPAL);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_PRINCIPAL_ID, principal.getId());
-
- writeExtensions(writer, principal);
- writer.endTag(NAMESPACE_CMIS, TAG_ACE_PRINCIPAL);
- }
- if (ace.getPermissions() != null) {
- for (String perm : ace.getPermissions()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_PERMISSIONS, perm);
- }
- }
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_IS_DIRECT, ace.isDirect());
-
- writeExtensions(writer, ace);
- writer.endTag(NAMESPACE_CMIS, TAG_ACL_PERMISSISONS);
- }
- }
- }
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_OBJECT_ACL);
- }
-
- // -------------
- // --- query ---
- // -------------
-
- public static void writeQuery(XmlSerializer writer, CmisVersion cmisVersion, QueryTypeImpl source)
- throws IOException {
- if (source == null) {
- return;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_QUERY);
- writer.attribute(null, XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_STATEMENT, source.getStatement());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_SEARCHALLVERSIONS, source.getSearchAllVersions());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_INCLUDEALLOWABLEACTIONS,
- source.getIncludeAllowableActions());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_INCLUDERELATIONSHIPS,
- source.getIncludeRelationships());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_RENDITIONFILTER, source.getRenditionFilter());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_MAXITEMS, source.getMaxItems());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_QUERY_SKIPCOUNT, source.getSkipCount());
-
- writeExtensions(writer, source);
- writer.endTag(NAMESPACE_CMIS, TAG_QUERY);
- }
-
- // -------------------
- // --- bulk update ---
- // -------------------
-
- public static void writeBulkUpdate(XmlSerializer writer, String namespace, BulkUpdateImpl bulkUpdate)
- throws IOException {
- if (bulkUpdate == null || bulkUpdate.getObjectIdAndChangeToken() == null) {
- return;
- }
-
- writer.startTag(namespace, TAG_BULK_UPDATE);
-
- for (BulkUpdateObjectIdAndChangeToken idAndToken : bulkUpdate.getObjectIdAndChangeToken()) {
- if (idAndToken == null) {
- continue;
- }
-
- writer.startTag(NAMESPACE_CMIS, TAG_BULK_UPDATE_ID_AND_TOKEN);
-
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_IDANDTOKEN_ID, idAndToken.getId());
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_IDANDTOKEN_CHANGETOKEN, idAndToken.getChangeToken());
-
- writeExtensions(writer, idAndToken);
- writer.endTag(NAMESPACE_CMIS, TAG_BULK_UPDATE_ID_AND_TOKEN);
- }
-
- if (bulkUpdate.getProperties() != null) {
- Properties properties = bulkUpdate.getProperties();
- writer.startTag(NAMESPACE_CMIS, TAG_BULK_UPDATE_PROPERTIES);
-
- if (properties.getPropertyList() != null) {
- for (PropertyData<?> property : properties.getPropertyList()) {
- writeProperty(writer, property, false);
- }
- }
-
- writeExtensions(writer, properties);
- writer.endTag(NAMESPACE_CMIS, TAG_BULK_UPDATE_PROPERTIES);
- }
-
- if (bulkUpdate.getAddSecondaryTypeIds() != null) {
- for (String id : bulkUpdate.getAddSecondaryTypeIds()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_BULK_UPDATE_ADD_SECONDARY_TYPES, id);
- }
- }
-
- if (bulkUpdate.getRemoveSecondaryTypeIds() != null) {
- for (String id : bulkUpdate.getRemoveSecondaryTypeIds()) {
- XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_BULK_UPDATE_REMOVE_SECONDARY_TYPES, id);
- }
- }
-
- writer.endTag(namespace, TAG_BULK_UPDATE);
- }
-
- // -------------------------
- // --- extension writers ---
- // -------------------------
-
- public static void writeExtensions(XmlSerializer writer, ExtensionsData source) throws IOException {
- if (source == null) {
- return;
- }
-
- LinkedList<String> ns = new LinkedList<String>();
-
- if (source.getExtensions() != null) {
- for (CmisExtensionElement element : source.getExtensions()) {
- if (element == null) {
- continue;
- }
-
- writeExtensionElement(writer, element, ns);
- }
- }
- }
-
- private static void writeExtensionElement(XmlSerializer writer, CmisExtensionElement source, LinkedList<String> ns)
- throws IOException {
- if (source == null || source.getName() == null) {
- return;
- }
-
- String namespace = null;
- // boolean addedNamespace = false;
-
- if (source.getNamespace() != null) {
- /*
- * String prefix = writer.getPrefix(source.getNamespace(), false);
- * if (prefix == null) { int p = ns.indexOf(source.getNamespace());
- *
- * if (p == -1) { prefix = "e" + (ns.size() + 1);
- * ns.add(source.getNamespace()); addedNamespace = true; } else {
- * prefix = "e" + (p + 1); } }
- */
-
- namespace = source.getNamespace();
- writer.startTag(source.getNamespace(), source.getName());
-
- /*
- * if (addedNamespace) { writer.attribute("", prefix,
- * source.getNamespace()); }
- */
- } else {
- writer.startTag(null, source.getName());
- }
-
- if (source.getAttributes() != null) {
- for (Map.Entry<String, String> attr : source.getAttributes().entrySet()) {
- writer.attribute(null, attr.getKey(), attr.getValue());
- }
- }
-
- if (source.getValue() != null) {
- writer.text(source.getValue());
- } else {
- if (source.getChildren() != null) {
- for (CmisExtensionElement child : source.getChildren()) {
- writeExtensionElement(writer, child, ns);
- }
- }
- }
-
- writer.endTag(namespace, source.getName());
-
- /*
- * if (addedNamespace) { ns.removeLast(); }
- */
- }
-
- // ---------------
- // --- parsers ---
- // ---------------
-
- public static RepositoryInfo convertRepositoryInfo(XmlPullParser parser) throws XmlPullParserException {
- return REPOSITORY_INFO_PARSER.walk(parser);
- }
-
- public static TypeDefinition convertTypeDefinition(XmlPullParser parser) throws XmlPullParserException {
- return TYPE_DEF_PARSER.walk(parser);
- }
-
- public static ObjectData convertObject(XmlPullParser parser) throws XmlPullParserException {
- return OBJECT_PARSER.walk(parser);
- }
-
- public static QueryTypeImpl convertQuery(XmlPullParser parser) throws XmlPullParserException {
- return QUERY_PARSER.walk(parser);
- }
-
- public static AllowableActions convertAllowableActions(XmlPullParser parser) throws XmlPullParserException {
- return ALLOWABLE_ACTIONS_PARSER.walk(parser);
- }
-
- public static Acl convertAcl(XmlPullParser parser) throws XmlPullParserException {
- return ACL_PARSER.walk(parser);
- }
-
- public static BulkUpdateImpl convertBulkUpdate(XmlPullParser parser) throws XmlPullParserException {
- return BULK_UPDATE_PARSER.walk(parser);
- }
-
- // ------------------------------
- // --- repository info parser ---
- // ------------------------------
-
- private static final XMLWalker<RepositoryInfoImpl> REPOSITORY_INFO_PARSER = new XMLWalker<RepositoryInfoImpl>() {
- @Override
- protected RepositoryInfoImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new RepositoryInfoImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, RepositoryInfoImpl target)
- throws XmlPullParserException {
-
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_REPINFO_ID)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_NAME)) {
- target.setName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_DESCRIPTION)) {
- target.setDescription(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_VENDOR)) {
- target.setVendorName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_PRODUCT)) {
- target.setProductName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_PRODUCT_VERSION)) {
- target.setProductVersion(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_ROOT_FOLDER_ID)) {
- target.setRootFolder(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_CHANGE_LOG_TOKEN)) {
- target.setLatestChangeLogToken(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_CAPABILITIES)) {
- target.setCapabilities(CAPABILITIES_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_ACL_CAPABILITIES)) {
- target.setAclCapabilities(ACL_CAPABILITIES_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_CMIS_VERSION_SUPPORTED)) {
- target.setCmisVersionSupported(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_THIN_CLIENT_URI)) {
- target.setThinClientUri(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_CHANGES_INCOMPLETE)) {
- target.setChangesIncomplete(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_CHANGES_ON_TYPE)) {
- target.setChangesOnType(addToList(target.getChangesOnType(), readEnum(parser, BaseTypeId.class)));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_PRINCIPAL_ID_ANONYMOUS)) {
- target.setPrincipalAnonymous(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_PRINCIPAL_ID_ANYONE)) {
- target.setPrincipalAnyone(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_REPINFO_EXTENDED_FEATURES)) {
- target.setExtensionFeature(addToList(target.getExtensionFeatures(),
- EXTENDED_FEATURES_PARSER.walk(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<RepositoryCapabilitiesImpl> CAPABILITIES_PARSER = new XMLWalker<RepositoryCapabilitiesImpl>() {
- @Override
- protected RepositoryCapabilitiesImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new RepositoryCapabilitiesImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, RepositoryCapabilitiesImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_CAP_ACL)) {
- target.setCapabilityAcl(readEnum(parser, CapabilityAcl.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_ALL_VERSIONS_SEARCHABLE)) {
- target.setAllVersionsSearchable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_CHANGES)) {
- target.setCapabilityChanges(readEnum(parser, CapabilityChanges.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_CONTENT_STREAM_UPDATABILITY)) {
- target.setCapabilityContentStreamUpdates(readEnum(parser, CapabilityContentStreamUpdates.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_GET_DESCENDANTS)) {
- target.setSupportsGetDescendants(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_GET_FOLDER_TREE)) {
- target.setSupportsGetFolderTree(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_ORDER_BY)) {
- target.setCapabilityOrderBy(readEnum(parser, CapabilityOrderBy.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_MULTIFILING)) {
- target.setSupportsMultifiling(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_PWC_SEARCHABLE)) {
- target.setIsPwcSearchable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_PWC_UPDATABLE)) {
- target.setIsPwcUpdatable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_QUERY)) {
- target.setCapabilityQuery(readEnum(parser, CapabilityQuery.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_RENDITIONS)) {
- target.setCapabilityRendition(readEnum(parser, CapabilityRenditions.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_UNFILING)) {
- target.setSupportsUnfiling(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_VERSION_SPECIFIC_FILING)) {
- target.setSupportsVersionSpecificFiling(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_JOIN)) {
- target.setCapabilityJoin(readEnum(parser, CapabilityJoin.class));
- return true;
- }
-
- if (isTag(name, TAG_CAP_CREATABLE_PROPERTY_TYPES)) {
- target.setCreatablePropertyTypes(CREATABLE_PROPERTY_TYPES_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES)) {
- target.setNewTypeSettableAttributes(NEW_TYPES_SETTABLE_ATTRIBUTES_PARSER.walk(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<CreatablePropertyTypesImpl> CREATABLE_PROPERTY_TYPES_PARSER = new XMLWalker<CreatablePropertyTypesImpl>() {
- @Override
- protected CreatablePropertyTypesImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new CreatablePropertyTypesImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, CreatablePropertyTypesImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE)) {
- target.canCreate().add(readEnum(parser, PropertyType.class));
- return true;
- }
- }
- return false;
- }
- };
-
- private static final XMLWalker<NewTypeSettableAttributesImpl> NEW_TYPES_SETTABLE_ATTRIBUTES_PARSER = new XMLWalker<NewTypeSettableAttributesImpl>() {
- @Override
- protected NewTypeSettableAttributesImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new NewTypeSettableAttributesImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, NewTypeSettableAttributesImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_ID)) {
- target.setCanSetId(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAME)) {
- target.setCanSetLocalName(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAMESPACE)) {
- target.setCanSetLocalNamespace(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DISPLAYNAME)) {
- target.setCanSetDisplayName(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYNAME)) {
- target.setCanSetQueryName(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DESCRIPTION)) {
- target.setCanSetDescription(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CREATEABLE)) {
- target.setCanSetCreatable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FILEABLE)) {
- target.setCanSetFileable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYABLE)) {
- target.setCanSetQueryable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FULLTEXTINDEXED)) {
- target.setCanSetFulltextIndexed(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_INCLUDEDINSUPERTYTPEQUERY)) {
- target.setCanSetIncludedInSupertypeQuery(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEPOLICY)) {
- target.setCanSetControllablePolicy(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEACL)) {
- target.setCanSetControllableAcl(readBoolean(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AclCapabilitiesDataImpl> ACL_CAPABILITIES_PARSER = new XMLWalker<AclCapabilitiesDataImpl>() {
- @Override
- protected AclCapabilitiesDataImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new AclCapabilitiesDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AclCapabilitiesDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACLCAP_SUPPORTED_PERMISSIONS)) {
- target.setSupportedPermissions(readEnum(parser, SupportedPermissions.class));
- return true;
- }
-
- if (isTag(name, TAG_ACLCAP_ACL_PROPAGATION)) {
- target.setAclPropagation(readEnum(parser, AclPropagation.class));
- return true;
- }
-
- if (isTag(name, TAG_ACLCAP_PERMISSIONS)) {
- target.setPermissionDefinitionData(addToList(target.getPermissions(),
- PERMISSION_DEFINITION_PARSER.walk(parser)));
- return true;
- }
-
- if (isTag(name, TAG_ACLCAP_PERMISSION_MAPPING)) {
- PermissionMapping pm = PERMISSION_MAPPING_PARSER.walk(parser);
-
- Map<String, PermissionMapping> mapping = target.getPermissionMapping();
- mapping.put(pm.getKey(), pm);
-
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<PermissionDefinitionDataImpl> PERMISSION_DEFINITION_PARSER = new XMLWalker<PermissionDefinitionDataImpl>() {
- @Override
- protected PermissionDefinitionDataImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new PermissionDefinitionDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, PermissionDefinitionDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACLCAP_PERMISSION_PERMISSION)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_ACLCAP_PERMISSION_DESCRIPTION)) {
- target.setDescription(readText(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<PermissionMappingDataImpl> PERMISSION_MAPPING_PARSER = new XMLWalker<PermissionMappingDataImpl>() {
- @Override
- protected PermissionMappingDataImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new PermissionMappingDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, PermissionMappingDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACLCAP_MAPPING_KEY)) {
- target.setKey(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_ACLCAP_MAPPING_PERMISSION)) {
- target.setPermissions(addToList(target.getPermissions(), readText(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<ExtensionFeatureImpl> EXTENDED_FEATURES_PARSER = new XMLWalker<ExtensionFeatureImpl>() {
- @Override
- protected ExtensionFeatureImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new ExtensionFeatureImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, ExtensionFeatureImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_FEATURE_ID)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_URL)) {
- target.setUrl(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_COMMON_NAME)) {
- target.setCommonName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_VERSION_LABEL)) {
- target.setVersionLabel(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_DESCRIPTION)) {
- target.setDescription(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_DATA)) {
- String[] data = FEATURE_DATA_PARSER.walk(parser);
-
- Map<String, String> featureData = target.getFeatureData();
- featureData.put(data[0], data[1]);
-
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<String[]> FEATURE_DATA_PARSER = new XMLWalker<String[]>() {
- @Override
- protected String[] prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new String[2];
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, String[] target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_FEATURE_DATA_KEY)) {
- target[0] = readText(parser);
- return true;
- }
-
- if (isTag(name, TAG_FEATURE_DATA_VALUE)) {
- target[1] = readText(parser);
- return true;
- }
- }
-
- return false;
- }
- };
-
- // --------------------------
- // --- definition parsers ---
- // --------------------------
-
- private static final XMLWalker<AbstractTypeDefinition> TYPE_DEF_PARSER = new XMLWalker<AbstractTypeDefinition>() {
- @Override
- protected AbstractTypeDefinition prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
-
- AbstractTypeDefinition result = null;
-
- String typeAttr = parser.getAttributeValue(NAMESPACE_XSI, "type");
- if (typeAttr != null) {
- if (typeAttr.endsWith(ATTR_DOCUMENT_TYPE)) {
- result = new DocumentTypeDefinitionImpl();
- } else if (typeAttr.endsWith(ATTR_FOLDER_TYPE)) {
- result = new FolderTypeDefinitionImpl();
- } else if (typeAttr.endsWith(ATTR_RELATIONSHIP_TYPE)) {
- result = new RelationshipTypeDefinitionImpl();
- ((RelationshipTypeDefinitionImpl) result).setAllowedSourceTypes(new ArrayList<String>());
- ((RelationshipTypeDefinitionImpl) result).setAllowedTargetTypes(new ArrayList<String>());
- } else if (typeAttr.endsWith(ATTR_POLICY_TYPE)) {
- result = new PolicyTypeDefinitionImpl();
- } else if (typeAttr.endsWith(ATTR_ITEM_TYPE)) {
- result = new ItemTypeDefinitionImpl();
- } else if (typeAttr.endsWith(ATTR_SECONDARY_TYPE)) {
- result = new SecondaryTypeDefinitionImpl();
- }
- }
-
- if (result == null) {
- throw new CmisInvalidArgumentException("Cannot read type definition!");
- }
-
- return result;
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AbstractTypeDefinition target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_TYPE_ID)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_LOCALNAME)) {
- target.setLocalName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_LOCALNAMESPACE)) {
- target.setLocalNamespace(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_DISPLAYNAME)) {
- target.setDisplayName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_QUERYNAME)) {
- target.setQueryName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_DESCRIPTION)) {
- target.setDescription(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_BASE_ID)) {
- BaseTypeId baseType = readEnum(parser, BaseTypeId.class);
- if (baseType == null) {
- throw new CmisInvalidArgumentException("Invalid base type!");
- }
-
- target.setBaseTypeId(baseType);
- return true;
- }
-
- if (isTag(name, TAG_TYPE_PARENT_ID)) {
- target.setParentTypeId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_CREATABLE)) {
- target.setIsCreatable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_FILEABLE)) {
- target.setIsFileable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_QUERYABLE)) {
- target.setIsQueryable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_FULLTEXT_INDEXED)) {
- target.setIsFulltextIndexed(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_INCLUDE_IN_SUPERTYPE_QUERY)) {
- target.setIsIncludedInSupertypeQuery(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_CONTROLABLE_POLICY)) {
- target.setIsControllablePolicy(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_CONTROLABLE_ACL)) {
- target.setIsControllableAcl(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_TYPE_MUTABILITY)) {
- target.setTypeMutability(TYPE_MUTABILITY_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_PROP_DEF_STRING) || isTag(name, TAG_TYPE_PROP_DEF_ID)
- || isTag(name, TAG_TYPE_PROP_DEF_BOOLEAN) || isTag(name, TAG_TYPE_PROP_DEF_INTEGER)
- || isTag(name, TAG_TYPE_PROP_DEF_DATETIME) || isTag(name, TAG_TYPE_PROP_DEF_DECIMAL)
- || isTag(name, TAG_TYPE_PROP_DEF_HTML) || isTag(name, TAG_TYPE_PROP_DEF_URI)) {
- target.addPropertyDefinition(PROPERTY_TYPE_PARSER.walk(parser));
- return true;
- }
-
- if (target instanceof DocumentTypeDefinitionImpl) {
- if (isTag(name, TAG_TYPE_VERSIONABLE)) {
- ((DocumentTypeDefinitionImpl) target).setIsVersionable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_CONTENTSTREAM_ALLOWED)) {
- ((DocumentTypeDefinitionImpl) target).setContentStreamAllowed(readEnum(parser,
- ContentStreamAllowed.class));
- return true;
- }
- }
-
- if (target instanceof RelationshipTypeDefinitionImpl) {
- if (isTag(name, TAG_TYPE_ALLOWED_SOURCE_TYPES)) {
- RelationshipTypeDefinitionImpl relTarget = (RelationshipTypeDefinitionImpl) target;
- relTarget
- .setAllowedSourceTypes(addToList(relTarget.getAllowedSourceTypeIds(), readText(parser)));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_ALLOWED_TARGET_TYPES)) {
- RelationshipTypeDefinitionImpl relTarget = (RelationshipTypeDefinitionImpl) target;
- relTarget
- .setAllowedTargetTypes(addToList(relTarget.getAllowedTargetTypeIds(), readText(parser)));
- return true;
- }
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<TypeMutabilityImpl> TYPE_MUTABILITY_PARSER = new XMLWalker<TypeMutabilityImpl>() {
- @Override
- protected TypeMutabilityImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new TypeMutabilityImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, TypeMutabilityImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_TYPE_TYPE_MUTABILITY_CREATE)) {
- target.setCanCreate(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_TYPE_MUTABILITY_UPDATE)) {
- target.setCanUpdate(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_TYPE_TYPE_MUTABILITY_DELETE)) {
- target.setCanDelete(readBoolean(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AbstractPropertyDefinition<?>> PROPERTY_TYPE_PARSER = new XMLWalker<AbstractPropertyDefinition<?>>() {
- @Override
- protected AbstractPropertyDefinition<?> prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- AbstractPropertyDefinition<?> result = null;
-
- if (isTag(name, TAG_TYPE_PROP_DEF_STRING)) {
- result = new PropertyStringDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_ID)) {
- result = new PropertyIdDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_BOOLEAN)) {
- result = new PropertyBooleanDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_INTEGER)) {
- result = new PropertyIntegerDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_DATETIME)) {
- result = new PropertyDateTimeDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_DECIMAL)) {
- result = new PropertyDecimalDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_HTML)) {
- result = new PropertyHtmlDefinitionImpl();
- } else if (isTag(name, TAG_TYPE_PROP_DEF_URI)) {
- result = new PropertyUriDefinitionImpl();
- }
-
- if (result == null) {
- throw new CmisInvalidArgumentException("Cannot read property type definition!");
- }
-
- return result;
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AbstractPropertyDefinition<?> target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_PROPERTY_TYPE_ID)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_LOCALNAME)) {
- target.setLocalName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_LOCALNAMESPACE)) {
- target.setLocalNamespace(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_DISPLAYNAME)) {
- target.setDisplayName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_QUERYNAME)) {
- target.setQueryName(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_DESCRIPTION)) {
- target.setDescription(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_PROPERTY_TYPE)) {
- PropertyType propType = readEnum(parser, PropertyType.class);
- if (propType == null) {
- throw new CmisInvalidArgumentException("Invalid property type!");
- }
-
- target.setPropertyType(propType);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CARDINALITY)) {
- Cardinality cardinality = readEnum(parser, Cardinality.class);
- if (cardinality == null) {
- throw new CmisInvalidArgumentException("Invalid cardinality!");
- }
-
- target.setCardinality(cardinality);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_UPDATABILITY)) {
- Updatability updatability = readEnum(parser, Updatability.class);
- if (updatability == null) {
- throw new CmisInvalidArgumentException("Invalid updatability!");
- }
-
- target.setUpdatability(updatability);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_INHERITED)) {
- target.setIsInherited(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_REQUIRED)) {
- target.setIsRequired(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_QUERYABLE)) {
- target.setIsQueryable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_ORDERABLE)) {
- target.setIsOrderable(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_OPENCHOICE)) {
- target.setIsOpenChoice(readBoolean(parser));
- return true;
- }
-
- if (target instanceof PropertyStringDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyString prop = PROPERTY_STRING_PARSER.walk(parser);
- ((PropertyStringDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_STRING_PARSER.addToChoiceList(parser, (PropertyStringDefinitionImpl) target);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_MAX_LENGTH)) {
- ((PropertyStringDefinitionImpl) target).setMaxLength(readInteger(parser));
- return true;
- }
- } else if (target instanceof PropertyIdDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyId prop = PROPERTY_ID_PARSER.walk(parser);
- ((PropertyIdDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_STRING_PARSER.addToChoiceList(parser, (PropertyIdDefinitionImpl) target);
- return true;
- }
- } else if (target instanceof PropertyBooleanDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyBoolean prop = PROPERTY_BOOLEAN_PARSER.walk(parser);
- ((PropertyBooleanDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_BOOLEAN_PARSER.addToChoiceList(parser, (PropertyBooleanDefinitionImpl) target);
- return true;
- }
- } else if (target instanceof PropertyIntegerDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyInteger prop = PROPERTY_INTEGER_PARSER.walk(parser);
- ((PropertyIntegerDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_INTEGER_PARSER.addToChoiceList(parser, (PropertyIntegerDefinitionImpl) target);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_MAX_VALUE)) {
- ((PropertyIntegerDefinitionImpl) target).setMaxValue(readInteger(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_MIN_VALUE)) {
- ((PropertyIntegerDefinitionImpl) target).setMinValue(readInteger(parser));
- return true;
- }
- } else if (target instanceof PropertyDateTimeDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyDateTime prop = PROPERTY_DATETIME_PARSER.walk(parser);
- ((PropertyDateTimeDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_DATETIME_PARSER.addToChoiceList(parser, (PropertyDateTimeDefinitionImpl) target);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_RESOLUTION)) {
- ((PropertyDateTimeDefinitionImpl) target).setDateTimeResolution(readEnum(parser,
- DateTimeResolution.class));
- return true;
- }
- } else if (target instanceof PropertyDecimalDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyDecimal prop = PROPERTY_DECIMAL_PARSER.walk(parser);
- ((PropertyDecimalDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_DECIMAL_PARSER.addToChoiceList(parser, (PropertyDecimalDefinitionImpl) target);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_MAX_VALUE)) {
- ((PropertyDecimalDefinitionImpl) target).setMaxValue(readDecimal(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_MIN_VALUE)) {
- ((PropertyDecimalDefinitionImpl) target).setMinValue(readDecimal(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_PRECISION)) {
- try {
- ((PropertyDecimalDefinitionImpl) target).setPrecision(DecimalPrecision
- .fromValue(readInteger(parser)));
- } catch (IllegalArgumentException e) {
- // invalid enum value - ignore
- }
- return true;
- }
- } else if (target instanceof PropertyHtmlDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyHtml prop = PROPERTY_HTML_PARSER.walk(parser);
- ((PropertyHtmlDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_STRING_PARSER.addToChoiceList(parser, (PropertyHtmlDefinitionImpl) target);
- return true;
- }
- } else if (target instanceof PropertyUriDefinitionImpl) {
- if (isTag(name, TAG_PROPERTY_TYPE_DEAULT_VALUE)) {
- PropertyUri prop = PROPERTY_URI_PARSER.walk(parser);
- ((PropertyUriDefinitionImpl) target).setDefaultValue(prop.getValues());
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE)) {
- CHOICE_STRING_PARSER.addToChoiceList(parser, (PropertyUriDefinitionImpl) target);
- return true;
- }
- }
- }
-
- return false;
- }
- };
-
- private static final ChoiceAtomPubXMLWalker<String> CHOICE_STRING_PARSER = new ChoiceAtomPubXMLWalker<String>() {
- @Override
- protected ChoiceImpl<String> createTarget(XmlPullParser parser, QName name) {
- return new ChoiceImpl<String>();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, ChoiceImpl<String> target) throws XmlPullParserException {
- target.setValue(addToList(target.getValue(), readText(parser)));
- }
-
- protected void addChoice(XmlPullParser parser, ChoiceImpl<String> target) throws XmlPullParserException {
- target.setChoice(addToList(target.getChoice(), CHOICE_STRING_PARSER.walk(parser)));
- }
- };
-
- private static final ChoiceAtomPubXMLWalker<Boolean> CHOICE_BOOLEAN_PARSER = new ChoiceAtomPubXMLWalker<Boolean>() {
- @Override
- protected ChoiceImpl<Boolean> createTarget(XmlPullParser parser, QName name) {
- return new ChoiceImpl<Boolean>();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, ChoiceImpl<Boolean> target) throws XmlPullParserException {
- target.setValue(addToList(target.getValue(), readBoolean(parser)));
- }
-
- protected void addChoice(XmlPullParser parser, ChoiceImpl<Boolean> target) throws XmlPullParserException {
- target.setChoice(addToList(target.getChoice(), CHOICE_BOOLEAN_PARSER.walk(parser)));
- }
- };
-
- private static final ChoiceAtomPubXMLWalker<BigInteger> CHOICE_INTEGER_PARSER = new ChoiceAtomPubXMLWalker<BigInteger>() {
- @Override
- protected ChoiceImpl<BigInteger> createTarget(XmlPullParser parser, QName name) {
- return new ChoiceImpl<BigInteger>();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, ChoiceImpl<BigInteger> target) throws XmlPullParserException {
- target.setValue(addToList(target.getValue(), readInteger(parser)));
- }
-
- protected void addChoice(XmlPullParser parser, ChoiceImpl<BigInteger> target) throws XmlPullParserException {
- target.setChoice(addToList(target.getChoice(), CHOICE_INTEGER_PARSER.walk(parser)));
- }
- };
-
- private static final ChoiceAtomPubXMLWalker<GregorianCalendar> CHOICE_DATETIME_PARSER = new ChoiceAtomPubXMLWalker<GregorianCalendar>() {
- @Override
- protected ChoiceImpl<GregorianCalendar> createTarget(XmlPullParser parser, QName name) {
- return new ChoiceImpl<GregorianCalendar>();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, ChoiceImpl<GregorianCalendar> target)
- throws XmlPullParserException {
- target.setValue(addToList(target.getValue(), readDateTime(parser)));
- }
-
- protected void addChoice(XmlPullParser parser, ChoiceImpl<GregorianCalendar> target)
- throws XmlPullParserException {
- target.setChoice(addToList(target.getChoice(), CHOICE_DATETIME_PARSER.walk(parser)));
- }
- };
-
- private static final ChoiceAtomPubXMLWalker<BigDecimal> CHOICE_DECIMAL_PARSER = new ChoiceAtomPubXMLWalker<BigDecimal>() {
- @Override
- protected ChoiceImpl<BigDecimal> createTarget(XmlPullParser parser, QName name) {
- return new ChoiceImpl<BigDecimal>();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, ChoiceImpl<BigDecimal> target) throws XmlPullParserException {
- target.setValue(addToList(target.getValue(), readDecimal(parser)));
- }
-
- protected void addChoice(XmlPullParser parser, ChoiceImpl<BigDecimal> target) throws XmlPullParserException {
- target.setChoice(addToList(target.getChoice(), CHOICE_DECIMAL_PARSER.walk(parser)));
- }
- };
-
- private abstract static class ChoiceAtomPubXMLWalker<T> extends XMLWalker<ChoiceImpl<T>> {
-
- public void addToChoiceList(XmlPullParser parser, AbstractPropertyDefinition<T> propDef)
- throws XmlPullParserException {
- propDef.setChoices(addToList(propDef.getChoices(), walk(parser)));
- }
-
- protected abstract ChoiceImpl<T> createTarget(XmlPullParser parser, QName name);
-
- @Override
- protected ChoiceImpl<T> prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- ChoiceImpl<T> result = createTarget(parser, name);
-
- if (parser.getAttributeCount() > 0) {
- for (int i = 0; i < parser.getAttributeCount(); i++) {
- String attr = parser.getAttributeName(i);
- if (ATTR_PROPERTY_TYPE_CHOICE_DISPLAYNAME.equals(attr)) {
- result.setDisplayName(parser.getAttributeValue(i));
- }
- }
- }
-
- return result;
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, ChoiceImpl<T> target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE_VALUE)) {
- addValue(parser, target);
- return true;
- }
-
- if (isTag(name, TAG_PROPERTY_TYPE_CHOICE_CHOICE)) {
- addChoice(parser, target);
- return true;
- }
- }
-
- return false;
- }
-
- protected abstract void addValue(XmlPullParser parser, ChoiceImpl<T> target) throws XmlPullParserException;
-
- protected abstract void addChoice(XmlPullParser parser, ChoiceImpl<T> target) throws XmlPullParserException;
- }
-
- // ---------------------------------
- // --- objects and lists parsers ---
- // ---------------------------------
-
- private static final XMLWalker<ObjectDataImpl> OBJECT_PARSER = new XMLWalker<ObjectDataImpl>() {
- @Override
- protected ObjectDataImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new ObjectDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, ObjectDataImpl target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_OBJECT_PROPERTIES)) {
- target.setProperties(PROPERTIES_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_ALLOWABLE_ACTIONS)) {
- target.setAllowableActions(ALLOWABLE_ACTIONS_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_RELATIONSHIP)) {
- target.setRelationships(addToList(target.getRelationships(), OBJECT_PARSER.walk(parser)));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_CHANGE_EVENT_INFO)) {
- target.setChangeEventInfo(CHANGE_EVENT_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_ACL)) {
- target.setAcl(ACL_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_EXACT_ACL)) {
- target.setIsExactAcl(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_POLICY_IDS)) {
- target.setPolicyIds(POLICY_IDS_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_OBJECT_RENDITION)) {
- target.setRenditions(addToList(target.getRenditions(), RENDITION_PARSER.walk(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<PropertiesImpl> PROPERTIES_PARSER = new XMLWalker<PropertiesImpl>() {
- @Override
- protected PropertiesImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new PropertiesImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, PropertiesImpl target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_PROP_STRING)) {
- target.addProperty(PROPERTY_STRING_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_ID)) {
- target.addProperty(PROPERTY_ID_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_BOOLEAN)) {
- target.addProperty(PROPERTY_BOOLEAN_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_INTEGER)) {
- target.addProperty(PROPERTY_INTEGER_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_DATETIME)) {
- target.addProperty(PROPERTY_DATETIME_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_DECIMAL)) {
- target.addProperty(PROPERTY_DECIMAL_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_HTML)) {
- target.addProperty(PROPERTY_HTML_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_PROP_URI)) {
- target.addProperty(PROPERTY_URI_PARSER.walk(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AllowableActionsImpl> ALLOWABLE_ACTIONS_PARSER = new XMLWalker<AllowableActionsImpl>() {
- @Override
- protected AllowableActionsImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new AllowableActionsImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AllowableActionsImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- try {
- Action action = Action.fromValue(name.getLocalPart());
-
- Set<Action> actions = target.getAllowableActions();
-
- if (Boolean.TRUE.equals(readBoolean(parser))) {
- actions.add(action);
- }
-
- return true;
- } catch (IllegalArgumentException e) {
- // extension tag -> ignore
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<ChangeEventInfoDataImpl> CHANGE_EVENT_PARSER = new XMLWalker<ChangeEventInfoDataImpl>() {
- @Override
- protected ChangeEventInfoDataImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new ChangeEventInfoDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, ChangeEventInfoDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_CHANGE_EVENT_TYPE)) {
- target.setChangeType(readEnum(parser, ChangeType.class));
- return true;
- }
-
- if (isTag(name, TAG_CHANGE_EVENT_TIME)) {
- target.setChangeTime(readDateTime(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AccessControlListImpl> ACL_PARSER = new XMLWalker<AccessControlListImpl>() {
- @Override
- protected AccessControlListImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new AccessControlListImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AccessControlListImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACL_PERMISSISONS)) {
- target.setAces(addToList(target.getAces(), ACE_PARSER.walk(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AccessControlEntryImpl> ACE_PARSER = new XMLWalker<AccessControlEntryImpl>() {
- @Override
- protected AccessControlEntryImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new AccessControlEntryImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AccessControlEntryImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACE_PRINCIPAL)) {
- target.setPrincipal(PRINCIPAL_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_ACE_PERMISSIONS)) {
- target.setPermissions(addToList(target.getPermissions(), readText(parser)));
- return true;
- }
-
- if (isTag(name, TAG_ACE_IS_DIRECT)) {
- target.setDirect(readBoolean(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<AccessControlPrincipalDataImpl> PRINCIPAL_PARSER = new XMLWalker<AccessControlPrincipalDataImpl>() {
- @Override
- protected AccessControlPrincipalDataImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new AccessControlPrincipalDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, AccessControlPrincipalDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_ACE_PRINCIPAL_ID)) {
- target.setId(readText(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<PolicyIdListImpl> POLICY_IDS_PARSER = new XMLWalker<PolicyIdListImpl>() {
- @Override
- protected PolicyIdListImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new PolicyIdListImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, PolicyIdListImpl target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_POLICY_ID)) {
- target.setPolicyIds(addToList(target.getPolicyIds(), readText(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<RenditionDataImpl> RENDITION_PARSER = new XMLWalker<RenditionDataImpl>() {
- @Override
- protected RenditionDataImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new RenditionDataImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, RenditionDataImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_RENDITION_STREAM_ID)) {
- target.setStreamId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_MIMETYPE)) {
- target.setMimeType(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_LENGTH)) {
- target.setBigLength(readInteger(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_KIND)) {
- target.setKind(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_TITLE)) {
- target.setTitle(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_HEIGHT)) {
- target.setBigHeight(readInteger(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_WIDTH)) {
- target.setBigWidth(readInteger(parser));
- return true;
- }
-
- if (isTag(name, TAG_RENDITION_DOCUMENT_ID)) {
- target.setRenditionDocumentId(readText(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- // ------------------------
- // --- property parsers ---
- // ------------------------
-
- private static final PropertyAtomPubXMLWalker<PropertyStringImpl> PROPERTY_STRING_PARSER = new PropertyStringAtomPubXMLWalker<PropertyStringImpl>() {
- @Override
- protected PropertyStringImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyStringImpl();
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyIdImpl> PROPERTY_ID_PARSER = new PropertyStringAtomPubXMLWalker<PropertyIdImpl>() {
- @Override
- protected PropertyIdImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyIdImpl();
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyHtmlImpl> PROPERTY_HTML_PARSER = new PropertyStringAtomPubXMLWalker<PropertyHtmlImpl>() {
- @Override
- protected PropertyHtmlImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyHtmlImpl();
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyUriImpl> PROPERTY_URI_PARSER = new PropertyStringAtomPubXMLWalker<PropertyUriImpl>() {
- @Override
- protected PropertyUriImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyUriImpl();
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyBooleanImpl> PROPERTY_BOOLEAN_PARSER = new PropertyAtomPubXMLWalker<PropertyBooleanImpl>() {
- @Override
- protected PropertyBooleanImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyBooleanImpl();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, PropertyBooleanImpl target) throws XmlPullParserException {
- target.setValues(addToList(target.getValues(), readBoolean(parser)));
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyIntegerImpl> PROPERTY_INTEGER_PARSER = new PropertyAtomPubXMLWalker<PropertyIntegerImpl>() {
- @Override
- protected PropertyIntegerImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyIntegerImpl();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, PropertyIntegerImpl target) throws XmlPullParserException {
- target.setValues(addToList(target.getValues(), readInteger(parser)));
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyDecimalImpl> PROPERTY_DECIMAL_PARSER = new PropertyAtomPubXMLWalker<PropertyDecimalImpl>() {
- @Override
- protected PropertyDecimalImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyDecimalImpl();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, PropertyDecimalImpl target) throws XmlPullParserException {
- target.setValues(addToList(target.getValues(), readDecimal(parser)));
- }
- };
-
- private static final PropertyAtomPubXMLWalker<PropertyDateTimeImpl> PROPERTY_DATETIME_PARSER = new PropertyAtomPubXMLWalker<PropertyDateTimeImpl>() {
- @Override
- protected PropertyDateTimeImpl createTarget(XmlPullParser parser, QName name) {
- return new PropertyDateTimeImpl();
- }
-
- @Override
- protected void addValue(XmlPullParser parser, PropertyDateTimeImpl target) throws XmlPullParserException {
- target.setValues(addToList(target.getValues(), readDateTime(parser)));
- }
- };
-
- private abstract static class PropertyAtomPubXMLWalker<T extends AbstractPropertyData<?>> extends XMLWalker<T> {
-
- protected abstract T createTarget(XmlPullParser parser, QName name);
-
- @Override
- protected T prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- T result = createTarget(parser, name);
-
- if (parser.getAttributeCount() > 0) {
- for (int i = 0; i < parser.getAttributeCount(); i++) {
- String attr = parser.getAttributeName(i);
- if (ATTR_PROPERTY_ID.equals(attr)) {
- result.setId(parser.getAttributeValue(i));
- } else if (ATTR_PROPERTY_LOCALNAME.equals(attr)) {
- result.setLocalName(parser.getAttributeValue(i));
- } else if (ATTR_PROPERTY_DISPLAYNAME.equals(attr)) {
- result.setDisplayName(parser.getAttributeValue(i));
- } else if (ATTR_PROPERTY_QUERYNAME.equals(attr)) {
- result.setQueryName(parser.getAttributeValue(i));
- }
- }
- }
-
- return result;
- }
-
- protected abstract void addValue(XmlPullParser parser, T target) throws XmlPullParserException;
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, T target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_PROPERTY_VALUE)) {
- addValue(parser, target);
- return true;
- }
- }
-
- return false;
- }
-
- }
-
- private abstract static class PropertyStringAtomPubXMLWalker<T extends AbstractPropertyData<String>> extends
- PropertyAtomPubXMLWalker<T> {
- @Override
- protected void addValue(XmlPullParser parser, T target) throws XmlPullParserException {
- target.setValues(addToList(target.getValues(), readText(parser)));
- }
- }
-
- // --------------------
- // --- query parser ---
- // --------------------
-
- private static final XMLWalker<QueryTypeImpl> QUERY_PARSER = new XMLWalker<QueryTypeImpl>() {
- @Override
- protected QueryTypeImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new QueryTypeImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, QueryTypeImpl target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_QUERY_STATEMENT)) {
- target.setStatement(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_SEARCHALLVERSIONS)) {
- target.setSearchAllVersions(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_INCLUDEALLOWABLEACTIONS)) {
- target.setIncludeAllowableActions(readBoolean(parser));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_INCLUDERELATIONSHIPS)) {
- target.setIncludeRelationships(readEnum(parser, IncludeRelationships.class));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_RENDITIONFILTER)) {
- target.setRenditionFilter(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_MAXITEMS)) {
- target.setMaxItems(readInteger(parser));
- return true;
- }
-
- if (isTag(name, TAG_QUERY_SKIPCOUNT)) {
- target.setSkipCount(readInteger(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-
- // --------------------------
- // --- bulk update parser ---
- // --------------------------
-
- private static final XMLWalker<BulkUpdateImpl> BULK_UPDATE_PARSER = new XMLWalker<BulkUpdateImpl>() {
- @Override
- protected BulkUpdateImpl prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException {
- return new BulkUpdateImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, BulkUpdateImpl target) throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_BULK_UPDATE_ID_AND_TOKEN)) {
- target.setObjectIdAndChangeToken(addToList(target.getObjectIdAndChangeToken(),
- ID_AND_TOKEN_PARSER.walk(parser)));
- return true;
- }
-
- if (isTag(name, TAG_BULK_UPDATE_PROPERTIES)) {
- target.setProperties(PROPERTIES_PARSER.walk(parser));
- return true;
- }
-
- if (isTag(name, TAG_BULK_UPDATE_ADD_SECONDARY_TYPES)) {
- target.setAddSecondaryTypeIds(addToList(target.getAddSecondaryTypeIds(), readText(parser)));
- return true;
- }
-
- if (isTag(name, TAG_BULK_UPDATE_REMOVE_SECONDARY_TYPES)) {
- target.setRemoveSecondaryTypeIds(addToList(target.getRemoveSecondaryTypeIds(), readText(parser)));
- return true;
- }
- }
-
- return false;
- }
- };
-
- private static final XMLWalker<BulkUpdateObjectIdAndChangeTokenImpl> ID_AND_TOKEN_PARSER = new XMLWalker<BulkUpdateObjectIdAndChangeTokenImpl>() {
- @Override
- protected BulkUpdateObjectIdAndChangeTokenImpl prepareTarget(XmlPullParser parser, QName name)
- throws XmlPullParserException {
- return new BulkUpdateObjectIdAndChangeTokenImpl();
- }
-
- @Override
- protected boolean read(XmlPullParser parser, QName name, BulkUpdateObjectIdAndChangeTokenImpl target)
- throws XmlPullParserException {
- if (isCmisNamespace(name)) {
- if (isTag(name, TAG_IDANDTOKEN_ID)) {
- target.setId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_IDANDTOKEN_NEWID)) {
- target.setNewId(readText(parser));
- return true;
- }
-
- if (isTag(name, TAG_IDANDTOKEN_CHANGETOKEN)) {
- target.setChangeToken(readText(parser));
- return true;
- }
- }
-
- return false;
- }
- };
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
deleted file mode 100644
index 019ad28..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.commons.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.GregorianCalendar;
-
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.w3c.dom.Document;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlSerializer;
-
-import android.util.Xml;
-
-public final class XMLUtils {
-
- private XMLUtils() {
- }
-
- // --------------
- // --- writer ---
- // --------------
-
- /**
- * Creates a new XML writer.
- */
- public static XmlSerializer createWriter(OutputStream out) throws IOException {
- assert out != null;
-
- XmlSerializer writer = Xml.newSerializer();
- writer.setOutput(out, IOUtils.UTF8);
-
- return writer;
- }
-
- /**
- * Starts a XML document.
- */
- public static void startXmlDocument(XmlSerializer writer) throws IOException {
- assert writer != null;
-
- writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
- writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
- writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
- writer.setPrefix(XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
-
- writer.startDocument("UTF-8", false);
- }
-
- /**
- * Ends a XML document.
- */
- public static void endXmlDocument(XmlSerializer writer) throws IOException {
- assert writer != null;
-
- // end document
- writer.endDocument();
- writer.flush();
- writer.toString();
- }
-
- /**
- * Writes a String tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, String value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- if (namespace == null) {
- writer.startTag(null, tag);
- } else {
- writer.startTag(namespace, tag);
- }
- writer.text(value);
- writer.endTag(namespace, tag);
- }
-
- /**
- * Writes an Integer tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigInteger value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- write(writer, prefix, namespace, tag, value.toString());
- }
-
- /**
- * Writes a Decimal tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigDecimal value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- write(writer, prefix, namespace, tag, value.toString());
- }
-
- /**
- * Writes a DateTime tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, GregorianCalendar value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- write(writer, prefix, namespace, tag, DateTimeHelper.formatXmlDateTime(value));
- }
-
- /**
- * Writes a Boolean tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Boolean value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- write(writer, prefix, namespace, tag, value ? "true" : "false");
- }
-
- /**
- * Writes an Enum tag.
- */
- public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Enum<?> value)
- throws IOException {
- assert writer != null;
-
- if (value == null) {
- return;
- }
-
- Object enumValue;
- try {
- enumValue = value.getClass().getMethod("value", new Class[0]).invoke(value, new Object[0]);
- } catch (Exception e) {
- throw new IllegalStateException("Cannot get enum value", e);
- }
-
- write(writer, prefix, namespace, tag, enumValue.toString());
- }
-
- // ---------------
- // ---- parser ---
- // ---------------
-
- /**
- * Creates a new XML parser with OpenCMIS default settings.
- */
- public static XmlPullParser createParser(InputStream stream) throws XmlPullParserException {
- XmlPullParser parser = Xml.newPullParser();
- parser.setInput(stream, IOUtils.UTF8);
- return parser;
- }
-
- /**
- * Moves the parser to the next element.
- */
- public static boolean next(XmlPullParser parser) {
- assert parser != null;
-
- try {
- if (hasNext(parser)) {
- parser.next();
- return true;
- }
- return false;
- } catch (Exception e) {
- // EOF exceptions
- return false;
- }
- }
-
- public static boolean hasNext(XmlPullParser parser) throws XmlPullParserException {
- assert parser != null;
-
- return parser.getEventType() != XmlPullParser.END_DOCUMENT;
- }
-
- /**
- * Skips a tag or subtree.
- */
- public static void skip(XmlPullParser parser) throws XmlPullParserException {
- assert parser != null;
-
- int level = 1;
- while (next(parser)) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- level++;
- } else if (event == XmlPullParser.END_TAG) {
- level--;
- if (level == 0) {
- break;
- }
- }
- }
-
- next(parser);
- }
-
- /**
- * Moves the parser to the next start element.
- *
- * @return <code>true</code> if another start element has been found,
- * <code>false</code> otherwise
- */
- public static boolean findNextStartElemenet(XmlPullParser parser) throws XmlPullParserException, IOException {
- assert parser != null;
-
- while (true) {
- int event = parser.getEventType();
-
- if (event == XmlPullParser.START_TAG) {
- return true;
- }
-
- if (hasNext(parser)) {
- parser.next();
- } else {
- return false;
- }
- }
- }
-
- /**
- * Parses a tag that contains text.
- */
- public static String readText(XmlPullParser parser, int maxLength) throws XmlPullParserException {
- assert parser != null;
- assert maxLength >= 0;
-
- StringBuilder sb = new StringBuilder();
-
- next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.END_TAG) {
- break;
- } else if (event == XmlPullParser.TEXT) {
- int len = 0;
- if (parser.getText() != null) {
- len = parser.getText().length();
- }
- if (len > 0) {
- if (sb.length() + len > maxLength) {
- throw new CmisInvalidArgumentException("String limit exceeded!");
- }
- sb.append(parser.getText());
- }
- } else if (event == XmlPullParser.START_TAG) {
- throw new XmlPullParserException("Unexpected tag: " + parser.getName());
- }
-
- if (!next(parser)) {
- break;
- }
- }
-
- next(parser);
-
- return sb.toString();
- }
-
- // ------------------
- // ---- DOM stuff ---
- // ------------------
-
- public static Document newDomDocument() {
- throw new CmisRuntimeException("This method should never be used on Android!");
- }
-}
diff --git a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java b/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java
deleted file mode 100644
index 71e9b7f..0000000
--- a/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.commons.impl;
-
-import static org.apache.chemistry.opencmis.commons.impl.XMLUtils.next;
-import static org.apache.chemistry.opencmis.commons.impl.XMLUtils.skip;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-public abstract class XMLWalker<T> {
- public T walk(XmlPullParser parser) throws XmlPullParserException {
- final T result = prepareTarget(parser, new QName(parser.getNamespace(), parser.getName()));
-
- next(parser);
-
- // walk through all tags
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.START_TAG) {
- QName name = new QName(parser.getNamespace(), parser.getName());
- if (!read(parser, name, result)) {
- if (result instanceof ExtensionsData) {
- handleExtension(parser, (ExtensionsData) result);
- } else {
- skip(parser);
- }
- }
- } else if (event == XmlPullParser.END_TAG) {
- break;
- } else {
- if (!next(parser)) {
- break;
- }
- }
- }
-
- next(parser);
-
- return result;
- }
-
- protected boolean isCmisNamespace(QName name) {
- return XMLConstants.NAMESPACE_CMIS.hashCode() == name.getNamespaceURI().hashCode()
- && XMLConstants.NAMESPACE_CMIS.equals(name.getNamespaceURI());
- }
-
- protected boolean isAtomNamespace(QName name) {
- return XMLConstants.NAMESPACE_ATOM.hashCode() == name.getNamespaceURI().hashCode()
- && XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI());
- }
-
- protected boolean isTag(QName name, String tag) {
- return tag.hashCode() == name.getLocalPart().hashCode() && tag.equals(name.getLocalPart());
- }
-
- protected void handleExtension(XmlPullParser parser, ExtensionsData extData) throws XmlPullParserException {
- List<CmisExtensionElement> extensions = extData.getExtensions();
- if (extensions == null) {
- extensions = new ArrayList<CmisExtensionElement>();
- extData.setExtensions(extensions);
- }
-
- if (extensions.size() + 1 > XMLConstraints.MAX_EXTENSIONS_WIDTH) {
- throw new CmisInvalidArgumentException("Too many extensions!");
- }
-
- extensions.add(handleExtensionLevel(parser, 0));
- }
-
- private CmisExtensionElement handleExtensionLevel(final XmlPullParser parser, final int level)
- throws XmlPullParserException {
- final QName name = new QName(parser.getNamespace(), parser.getName());
- Map<String, String> attributes = null;
- StringBuilder sb = new StringBuilder();
- List<CmisExtensionElement> children = null;
-
- if (parser.getAttributeCount() > 0) {
- attributes = new HashMap<String, String>();
-
- for (int i = 0; i < parser.getAttributeCount(); i++) {
- attributes.put(parser.getAttributeName(i), parser.getAttributeValue(i));
- }
- }
-
- next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XmlPullParser.END_TAG) {
- break;
- } else if (event == XmlPullParser.TEXT) {
- String s = parser.getText();
- if (s != null) {
- if (sb.length() + s.length() > XMLConstraints.MAX_STRING_LENGTH) {
- throw new CmisInvalidArgumentException("String limit exceeded!");
- }
- sb.append(s);
- }
- } else if (event == XmlPullParser.START_TAG) {
- if (level + 1 > XMLConstraints.MAX_EXTENSIONS_DEPTH) {
- throw new CmisInvalidArgumentException("Extensions tree too deep!");
- }
-
- if (children == null) {
- children = new ArrayList<CmisExtensionElement>();
- }
-
- if (children.size() + 1 > XMLConstraints.MAX_EXTENSIONS_WIDTH) {
- throw new CmisInvalidArgumentException("Extensions tree too wide!");
- }
-
- children.add(handleExtensionLevel(parser, level + 1));
-
- continue;
- }
-
- if (!next(parser)) {
- break;
- }
- }
-
- next(parser);
-
- if (children != null) {
- return new CmisExtensionElementImpl(name.getNamespaceURI(), name.getLocalPart(), attributes, children);
- } else {
- return new CmisExtensionElementImpl(name.getNamespaceURI(), name.getLocalPart(), attributes, sb.toString());
- }
- }
-
- protected <S> List<S> addToList(List<S> list, S value) {
- if (list == null || list.isEmpty()) {
- list = new ArrayList<S>();
- }
- list.add(value);
-
- return list;
- }
-
- protected String readText(final XmlPullParser parser) throws XmlPullParserException {
- return XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH);
- }
-
- protected Boolean readBoolean(final XmlPullParser parser) throws XmlPullParserException {
- String value = readText(parser);
-
- if ("true".equals(value) || "1".equals(value)) {
- return Boolean.TRUE;
- }
-
- if ("false".equals(value) || "0".equals(value)) {
- return Boolean.FALSE;
- }
-
- throw new CmisInvalidArgumentException("Invalid boolean value!");
- }
-
- protected BigInteger readInteger(final XmlPullParser parser) throws XmlPullParserException {
- String value = readText(parser);
-
- try {
- return new BigInteger(value);
- } catch (NumberFormatException e) {
- throw new CmisInvalidArgumentException("Invalid integer value!", e);
- }
- }
-
- protected BigDecimal readDecimal(final XmlPullParser parser) throws XmlPullParserException {
- String value = readText(parser);
-
- try {
- return new BigDecimal(value);
- } catch (NumberFormatException e) {
- throw new CmisInvalidArgumentException("Invalid decimal value!", e);
- }
- }
-
- protected GregorianCalendar readDateTime(final XmlPullParser parser) throws XmlPullParserException {
- String value = readText(parser);
-
- GregorianCalendar result = DateTimeHelper.parseXmlDateTime(value);
- if (result == null) {
- throw new CmisInvalidArgumentException("Invalid datetime value!");
- }
-
- return result;
- }
-
- @SuppressWarnings("unchecked")
- public <E extends Enum<E>> E readEnum(final XmlPullParser parser, final Class<E> clazz)
- throws XmlPullParserException {
-
- return CmisEnumHelper.fromValue(readText(parser), clazz);
- }
-
- protected abstract T prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException;
-
- protected abstract boolean read(XmlPullParser parser, QName name, T target) throws XmlPullParserException;
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml
deleted file mode 100644
index 0b11763..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis</artifactId>
- <version>0.13.0</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>chemistry-opencmis-bridge</artifactId>
- <name>OpenCMIS Bridge WAR packaging</name>
- <packaging>war</packaging>
-
- <properties>
- <parentBasedir>../../</parentBasedir>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <archive>
- <manifestEntries>
- <Bundle-Name>org.apache.chemistry.opencmis.bridge</Bundle-Name>
- <Bundle-SymbolicName>org.apache.chemistry.opencmis.bridge</Bundle-SymbolicName>
- <Bundle-Version>0.0.1</Bundle-Version>
- <Import-Package>javax.servlet,javax.servlet.http,javax.servlet.resources</Import-Package>
- <Bundle-Classpath>.</Bundle-Classpath>
- <Web-ContextPath>bridge</Web-ContextPath>
- </manifestEntries>
- </archive>
- <overlays>
- <overlay>
- </overlay>
- <overlay>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-server-bindings-war</artifactId>
- <includes>
- <include>**</include>
- <include>META-INF/THIRD-PARTY-LICENSES</include>
- </includes>
- </overlay>
- </overlays>
- <archiveClasses>true</archiveClasses>
- <attachClasses>true</attachClasses>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.9</version>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-commons-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis-commons-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-client-bindings</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-server-support</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-server-bindings-war</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <!-- copy the dependencies from the server bindings here, because mvn eclipse ignores them from a .war -->
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
deleted file mode 100644
index 93036bd..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge;
-
-import java.io.File;
-import java.math.BigInteger;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil;
-import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.commons.server.CmisService;
-import org.apache.chemistry.opencmis.server.support.wrapper.CallContextAwareCmisService;
-import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
-
-public abstract class AbstractBridgeServiceFactory extends AbstractServiceFactory {
-
- public static final String BRIDGE_TEMP_DIRECTORY = "bridge.tempDirectory";
- public static final String BRIDGE_MEMORY_THERESHOLD = "bridge.memoryThreshold";
- public static final String BRIDGE_MAX_CONTENT_SIZE = "bridge.maxContentSize";
-
- public static final String SERVICE_CLASS = "service.class";
- public static final String SERVICE_DEFAULT_MAX_ITEMS_OBJECTS = "service.defaultMaxItems";
- public static final String SERVICE_DEFAULT_DEPTH_OBJECTS = "service.defaultDepth";
- public static final String SERVICE_DEFAULT_MAX_ITEMS_TYPES = "service.defaultTypesMaxItems";
- public static final String SERVICE_DEFAULT_DEPTH_TYPES = "service.defaultTypesDepth";
-
- private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(100000);
- private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(100);
- private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(1000);
- private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(10);
-
- private ThreadLocal<CallContextAwareCmisService> threadLocalService = new ThreadLocal<CallContextAwareCmisService>();
-
- private Map<String, String> parameters;
-
- private Class<?> serviceClass;
-
- private BigInteger defaultMaxItems;
- private BigInteger defaultDepth;
- private BigInteger defaultTypesMaxItems;
- private BigInteger defaultTypesDepth;
-
- private File tempDirectory;
- private int memoryThreshold;
- private long maxContentSize;
-
- @Override
- public void init(Map<String, String> parameters) {
- this.parameters = parameters;
-
- // get bridge configuration
- String tempDirectoryStr = parameters.get(BRIDGE_TEMP_DIRECTORY);
- tempDirectory = (tempDirectoryStr == null || tempDirectoryStr.trim().length() == 0 ? super.getTempDirectory()
- : new File(tempDirectoryStr.trim()));
-
- try {
- String memoryThresholdStr = parameters.get(BRIDGE_MEMORY_THERESHOLD);
- memoryThreshold = (memoryThresholdStr == null || memoryThresholdStr.trim().length() == 0 ? super
- .getMemoryThreshold() : Integer.parseInt(memoryThresholdStr.trim()));
-
- String maxContentSizeStr = parameters.get(BRIDGE_MAX_CONTENT_SIZE);
- maxContentSize = (maxContentSizeStr == null || maxContentSizeStr.trim().length() == 0 ? super
- .getMaxContentSize() : Long.parseLong(maxContentSizeStr.trim()));
- } catch (NumberFormatException e) {
- throw new RuntimeException("Could not parse bride configuration values: " + e.getMessage(), e);
- }
-
- // find service class
- String className = parameters.get(SERVICE_CLASS);
- if (className == null || className.trim().length() == 0) {
- throw new RuntimeException("Service class name is not set!");
- }
-
- try {
- serviceClass = ClassLoaderUtil.loadClass(className);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Service class name cannot be found: " + e.getMessage(), e);
- }
-
- if (serviceClass.isAssignableFrom(FilterCmisService.class)) {
- throw new RuntimeException("Service class is not a sub class of FilterCmisService!");
- }
-
- // get service defaults
- try {
- defaultMaxItems = getBigIntegerParameter(SERVICE_DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_MAX_ITEMS_OBJECTS);
- defaultDepth = getBigIntegerParameter(SERVICE_DEFAULT_DEPTH_OBJECTS, DEFAULT_DEPTH_OBJECTS);
- defaultTypesMaxItems = getBigIntegerParameter(SERVICE_DEFAULT_MAX_ITEMS_TYPES, DEFAULT_MAX_ITEMS_TYPES);
- defaultTypesDepth = getBigIntegerParameter(SERVICE_DEFAULT_DEPTH_TYPES, DEFAULT_DEPTH_TYPES);
- } catch (NumberFormatException e) {
- throw new RuntimeException("Could not parse service default values: " + e.getMessage(), e);
- }
- }
-
- @Override
- public CmisService getService(CallContext context) {
- CallContextAwareCmisService service = threadLocalService.get();
- if (service == null) {
- service = new ConformanceCmisServiceWrapper(createService(context), defaultTypesMaxItems,
- defaultTypesDepth, defaultMaxItems, defaultDepth);
- threadLocalService.set(service);
- }
-
- service.setCallContext(context);
-
- return service;
- }
-
- /**
- * Creates a new service instance.
- */
- protected abstract FilterCmisService createService(CallContext context);
-
- protected Class<?> getServiceClass() {
- return serviceClass;
- }
-
- protected Map<String, String> getParameters() {
- return parameters;
- }
-
- @Override
- public File getTempDirectory() {
- return tempDirectory;
- }
-
- @Override
- public int getMemoryThreshold() {
- return memoryThreshold;
- }
-
- @Override
- public long getMaxContentSize() {
- return maxContentSize;
- }
-
- /**
- * Gets a BigInteger parameter from the parameters.
- */
- protected BigInteger getBigIntegerParameter(String key, BigInteger def) {
- String value = parameters.get(key);
- if (value == null || value.trim().length() == 0) {
- return def;
- }
-
- return new BigInteger(value);
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java
deleted file mode 100644
index e331c99..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.commons.spi.AclService;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
-import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
-import org.apache.chemistry.opencmis.commons.spi.NavigationService;
-import org.apache.chemistry.opencmis.commons.spi.ObjectService;
-import org.apache.chemistry.opencmis.commons.spi.PolicyService;
-import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
-import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
-import org.apache.chemistry.opencmis.commons.spi.VersioningService;
-
-/**
- * Provides a framework to cache a {@link CmisBinding} object for a
- * {@link FilterCmisService}.
- */
-public abstract class CachedBindingCmisService extends FilterCmisService {
-
- private static final long serialVersionUID = 1L;
-
- private CmisBinding clientBinding;
-
- @Override
- public void setCallContext(CallContext context) {
- super.setCallContext(context);
-
- clientBinding = getCmisBindingFromCache();
- if (clientBinding == null) {
- clientBinding = putCmisBindingIntoCache(createCmisBinding());
- }
- }
-
- /**
- * Returns a cached {@link CmisBinding} object or <code>null</code> if no
- * appropriate object can be found in the cache.
- */
- public abstract CmisBinding getCmisBindingFromCache();
-
- /**
- * Puts the provided {@link CmisBinding} object into the cache and
- * associates it somehow with the current {@link CallContext}.
- *
- * The implementation may return another {@link CmisBinding} object if
- * another thread has already added an object for the current
- * {@link CallContext}.
- */
- public abstract CmisBinding putCmisBindingIntoCache(CmisBinding binding);
-
- /**
- * Creates a new {@link CmisBinding} object based on the current
- * {@link CallContext}.
- */
- public abstract CmisBinding createCmisBinding();
-
- /**
- * Returns the current {@link CmisBinding} object.
- */
- public CmisBinding getCmisBinding() {
- return clientBinding;
- }
-
- /**
- * Returns the current {@link HttpServletRequest}.
- */
- public HttpServletRequest getHttpServletRequest() {
- return (HttpServletRequest) getCallContext().get(CallContext.HTTP_SERVLET_REQUEST);
- }
-
- @Override
- public RepositoryService getRepositoryService() {
- return clientBinding.getRepositoryService();
- }
-
- @Override
- public NavigationService getNavigationService() {
- return clientBinding.getNavigationService();
- }
-
- @Override
- public ObjectService getObjectService() {
- return clientBinding.getObjectService();
- }
-
- @Override
- public VersioningService getVersioningService() {
- return clientBinding.getVersioningService();
- }
-
- @Override
- public DiscoveryService getDiscoveryService() {
- return clientBinding.getDiscoveryService();
- }
-
- @Override
- public MultiFilingService getMultiFilingService() {
- return clientBinding.getMultiFilingService();
- }
-
- @Override
- public RelationshipService getRelationshipService() {
- return clientBinding.getRelationshipService();
- }
-
- @Override
- public AclService getAclService() {
- return clientBinding.getAclService();
- }
-
- @Override
- public PolicyService getPolicyService() {
- return clientBinding.getPolicyService();
- }
-
- @Override
- public void close() {
- super.close();
- clientBinding = null;
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
deleted file mode 100644
index 8cf466f..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.commons.data.Ace;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.AllowableActions;
-import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
-import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.data.RenditionData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
-import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
-import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
-import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
-import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
-import org.apache.chemistry.opencmis.commons.spi.AclService;
-import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
-import org.apache.chemistry.opencmis.commons.spi.NavigationService;
-import org.apache.chemistry.opencmis.commons.spi.ObjectService;
-import org.apache.chemistry.opencmis.commons.spi.PolicyService;
-import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
-import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
-import org.apache.chemistry.opencmis.commons.spi.VersioningService;
-import org.apache.chemistry.opencmis.server.support.wrapper.CallContextAwareCmisService;
-
-/**
- * Forwards incoming calls to a CMIS repository.
- */
-public abstract class FilterCmisService extends AbstractCmisService implements CallContextAwareCmisService,
- Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private CallContext context;
-
- /**
- * Called after the object has been created.
- *
- * @param parameters
- * the parameters provided to bridge service factory
- * @param lock
- * a lock object shared by all service instances
- */
- public void init(Map<String, String> parameters) {
- }
-
- /**
- * Called at the beginning of a request.
- */
- public void setCallContext(CallContext context) {
- this.context = context;
- }
-
- /**
- * Returns the current call context.
- */
- public CallContext getCallContext() {
- return context;
- }
-
- /**
- * Returns a client repository service.
- */
- public abstract RepositoryService getRepositoryService();
-
- /**
- * Returns a client navigation service.
- */
- public abstract NavigationService getNavigationService();
-
- /**
- * Returns a client object service.
- */
- public abstract ObjectService getObjectService();
-
- /**
- * Returns a client versioning service.
- */
- public abstract VersioningService getVersioningService();
-
- /**
- * Returns a client discovery service.
- */
- public abstract DiscoveryService getDiscoveryService();
-
- /**
- * Returns a client multifiling service.
- */
- public abstract MultiFilingService getMultiFilingService();
-
- /**
- * Returns a client relationship service.
- */
- public abstract RelationshipService getRelationshipService();
-
- /**
- * Returns a client ACL service.
- */
- public abstract AclService getAclService();
-
- /**
- * Returns a client policy service.
- */
- public abstract PolicyService getPolicyService();
-
- @Override
- public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
- return getRepositoryService().getRepositoryInfo(repositoryId, extension);
- }
-
- @Override
- public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
- return getRepositoryService().getRepositoryInfos(extension);
- }
-
- @Override
- public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getRepositoryService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
- skipCount, extension);
- }
-
- @Override
- public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
- Boolean includePropertyDefinitions, ExtensionsData extension) {
- return getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions,
- extension);
- }
-
- @Override
- public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
- return getRepositoryService().getTypeDefinition(repositoryId, typeId, extension);
- }
-
- @Override
- public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getNavigationService().getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
- }
-
- @Override
- public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- return getNavigationService().getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, extension);
- }
-
- @Override
- public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- return getNavigationService().getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, extension);
- }
-
- @Override
- public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includeRelativePathSegment, ExtensionsData extension) {
- return getNavigationService().getObjectParents(repositoryId, objectId, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includeRelativePathSegment, extension);
- }
-
- @Override
- public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
- return getNavigationService().getFolderParent(repositoryId, folderId, filter, extension);
- }
-
- @Override
- public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getNavigationService().getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
- includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
- }
-
- @Override
- public String create(String repositoryId, Properties properties, String folderId, ContentStream contentStream,
- VersioningState versioningState, List<String> policies, ExtensionsData extension) {
- return super.create(repositoryId, properties, folderId, contentStream, versioningState, policies, extension);
- }
-
- @Override
- public String createDocument(String repositoryId, Properties properties, String folderId,
- ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- return getObjectService().createDocument(repositoryId, properties, folderId, contentStream, versioningState,
- policies, addAces, removeAces, extension);
- }
-
- @Override
- public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
- String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
- ExtensionsData extension) {
- return getObjectService().createDocumentFromSource(repositoryId, sourceId, properties, folderId,
- versioningState, policies, addAces, removeAces, extension);
- }
-
- @Override
- public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
- Acl addAces, Acl removeAces, ExtensionsData extension) {
- return getObjectService().createFolder(repositoryId, properties, folderId, policies, addAces, removeAces,
- extension);
- }
-
- @Override
- public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- return getObjectService()
- .createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
- }
-
- @Override
- public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
- Acl addAces, Acl removeAces, ExtensionsData extension) {
- return getObjectService().createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces,
- extension);
- }
-
- @Override
- public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
- return getObjectService().getAllowableActions(repositoryId, objectId, extension);
- }
-
- @Override
- public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeAcl, ExtensionsData extension) {
- return getObjectService().getObject(repositoryId, objectId, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
- }
-
- @Override
- public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
- return getObjectService().getProperties(repositoryId, objectId, filter, extension);
- }
-
- @Override
- public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getObjectService()
- .getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
- }
-
- @Override
- public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeAcl, ExtensionsData extension) {
- return getObjectService().getObjectByPath(repositoryId, path, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
- }
-
- @Override
- public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
- BigInteger length, ExtensionsData extension) {
- return getObjectService().getContentStream(repositoryId, objectId, streamId, offset, length, extension);
- }
-
- @Override
- public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- Properties properties, ExtensionsData extension) {
- getObjectService().updateProperties(repositoryId, objectId, changeToken, properties, extension);
- }
-
- @Override
- public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
- ExtensionsData extension) {
- getObjectService().moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
- }
-
- @Override
- public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
- getObjectService().deleteObject(repositoryId, objectId, allVersions, extension);
- }
-
- @Override
- public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
- ExtensionsData extension) {
- // TODO: rework -> object cache
- getObjectService().deleteObject(repositoryId, objectId, allVersions, extension);
- }
-
- @Override
- public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
- UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
- return getObjectService().deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure,
- extension);
- }
-
- @Override
- public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
- Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
- getObjectService().setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream,
- extension);
- }
-
- @Override
- public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ExtensionsData extension) {
- getObjectService().deleteContentStream(repositoryId, objectId, changeToken, extension);
- }
-
- @Override
- public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
- Holder<Boolean> contentCopied) {
- getVersioningService().checkOut(repositoryId, objectId, extension, contentCopied);
- }
-
- @Override
- public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
- getVersioningService().cancelCheckOut(repositoryId, objectId, extension);
- }
-
- @Override
- public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
- ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
- ExtensionsData extension) {
- getVersioningService().checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment,
- policies, addAces, removeAces, extension);
- }
-
- @Override
- public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
- Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
- return getVersioningService()
- .getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
- includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
- extension);
- }
-
- @Override
- public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
- Boolean major, String filter, ExtensionsData extension) {
- return getVersioningService().getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major,
- filter, extension);
- }
-
- @Override
- public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
- Boolean includeAllowableActions, ExtensionsData extension) {
- return getVersioningService().getAllVersions(repositoryId, objectId, versionSeriesId, filter,
- includeAllowableActions, extension);
- }
-
- @Override
- public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
- String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
- return getDiscoveryService().getContentChanges(repositoryId, changeLogToken, includeProperties, filter,
- includePolicyIds, includeAcl, maxItems, extension);
- }
-
- @Override
- public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
- Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getDiscoveryService().query(repositoryId, statement, searchAllVersions, includeAllowableActions,
- includeRelationships, renditionFilter, maxItems, skipCount, extension);
- }
-
- @Override
- public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
- ExtensionsData extension) {
- getMultiFilingService().addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
- }
-
- @Override
- public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
- getMultiFilingService().removeObjectFromFolder(repositoryId, objectId, folderId, extension);
- }
-
- @Override
- public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
- RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
- BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- return getRelationshipService().getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
- relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
- }
-
- @Override
- public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
- AclPropagation aclPropagation, ExtensionsData extension) {
- return getAclService().applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
- }
-
- @Override
- public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
- Acl orgAcl = getAclService().getAcl(repositoryId, objectId, Boolean.FALSE, null);
-
- Acl removeAces = null;
- if (orgAcl != null && orgAcl.getAces() != null && !orgAcl.getAces().isEmpty()) {
- List<Ace> directAces = new ArrayList<Ace>();
-
- for (Ace ace : orgAcl.getAces()) {
- if (ace.isDirect()) {
- directAces.add(ace);
- }
- }
-
- if (!directAces.isEmpty()) {
- removeAces = new AccessControlListImpl(directAces);
- }
- }
-
- return getAclService().applyAcl(repositoryId, objectId, aces, removeAces, aclPropagation, null);
- }
-
- @Override
- public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
- return getAclService().getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
- }
-
- @Override
- public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- getPolicyService().applyPolicy(repositoryId, policyId, objectId, extension);
- }
-
- @Override
- public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
- ExtensionsData extension) {
- return getPolicyService().getAppliedPolicies(repositoryId, objectId, filter, extension);
- }
-
- @Override
- public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- getPolicyService().removePolicy(repositoryId, policyId, objectId, extension);
- }
-
- @Override
- public ObjectInfo getObjectInfo(String repositoryId, String objectId) {
- // TODO: add intelligent object info cache
- return super.getObjectInfo(repositoryId, objectId);
- }
-
- @Override
- protected ObjectInfo getObjectInfoIntern(String repositoryId, ObjectData object) {
- // TODO: add intelligent object info cache
- return super.getObjectInfoIntern(repositoryId, object);
- }
-
- @Override
- public void close() {
- super.close();
- context = null;
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java
deleted file mode 100644
index 040121b..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
-import org.apache.chemistry.opencmis.commons.SessionParameter;
-import org.apache.chemistry.opencmis.commons.enums.BindingType;
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-
-/**
- * Creates a {@link CmisBinding} object for a set of parameters and a
- * {@link CallContext}.
- */
-public class SimpleCmisBindingFactory {
-
- private static final CmisBindingFactory BINDING_FACTORY = CmisBindingFactory.newInstance();
-
- public static CmisBinding createCmisBinding(CallContext context, Map<String, String> bindingParameters) {
- Map<String, String> parameters = new HashMap<String, String>(bindingParameters);
-
- // forward user name and password
- parameters.put(SessionParameter.USER, context.getUsername());
- parameters.put(SessionParameter.PASSWORD, context.getPassword());
-
- // create the binding object
- String bindingTypeStr = parameters.get(SessionParameter.BINDING_TYPE);
- BindingType bindingType = BindingType.fromValue(bindingTypeStr);
-
- CmisBinding binding = null;
- switch (bindingType) {
- case WEBSERVICES:
- binding = BINDING_FACTORY.createCmisWebServicesBinding(parameters);
- break;
- case BROWSER:
- binding = BINDING_FACTORY.createCmisBrowserBinding(parameters);
- break;
- default:
- binding = BINDING_FACTORY.createCmisAtomPubBinding(parameters);
- break;
- }
-
- return binding;
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java
deleted file mode 100644
index fd8df18..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.httpsession;
-
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.apache.chemistry.opencmis.bridge.AbstractBridgeServiceFactory;
-import org.apache.chemistry.opencmis.bridge.FilterCmisService;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-
-public class HttpSessionBridgeServiceFactory extends AbstractBridgeServiceFactory {
-
- private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
-
- @Override
- protected FilterCmisService createService(CallContext context) {
- HttpSessionCmisService service = null;
- try {
- service = (HttpSessionCmisService) getServiceClass().newInstance();
- } catch (Exception e) {
- throw new CmisRuntimeException("Could not create service instance: " + e, e);
- }
-
- service.init(getParameters(), lock);
-
- return service;
- }
-
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java
deleted file mode 100644
index aea3916..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.httpsession;
-
-import java.util.Map;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.servlet.http.HttpSession;
-
-import org.apache.chemistry.opencmis.bridge.CachedBindingCmisService;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-
-/**
- * Uses HTTP sessions to cache {@link CmisBinding} objects.
- */
-public abstract class HttpSessionCmisService extends CachedBindingCmisService {
-
- private static final long serialVersionUID = 1L;
-
- /** Key in the HTTP session. **/
- public static final String CMIS_BINDING = "org.apache.chemistry.opencmis.bridge.binding";
-
- private ReentrantReadWriteLock lock;
-
- public void init(Map<String, String> parameters, ReentrantReadWriteLock lock) {
- init(parameters);
- this.lock = lock;
- }
-
- @Override
- public CmisBinding getCmisBindingFromCache() {
- HttpSession httpSession = getHttpSession(false);
- if (httpSession == null) {
- return null;
- }
-
- lock.readLock().lock();
- try {
- return (CmisBinding) httpSession.getAttribute(CMIS_BINDING);
- } finally {
- lock.readLock().unlock();
- }
- }
-
- @Override
- public CmisBinding putCmisBindingIntoCache(CmisBinding binding) {
- HttpSession httpSession = getHttpSession(true);
-
- lock.writeLock().lock();
- try {
- CmisBinding existingBinding = (CmisBinding) httpSession.getAttribute(CMIS_BINDING);
- if (existingBinding == null) {
- httpSession.setAttribute(CMIS_BINDING, binding);
- } else {
- binding = existingBinding;
- }
-
- return binding;
- } finally {
- lock.writeLock().unlock();
- }
- }
-
- /**
- * Returns the current {@link HttpSession}.
- *
- * @param create
- * <code>true</code> to create a new session, <code>false</code>
- * to return <code>null</code> if there is no current session
- */
- public HttpSession getHttpSession(boolean create) {
- return getHttpServletRequest().getSession(create);
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java
deleted file mode 100644
index 9efbf1e..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.httpsession.sample;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.bridge.FilterCmisService;
-import org.apache.chemistry.opencmis.bridge.client.SimpleCmisBindingFactory;
-import org.apache.chemistry.opencmis.bridge.httpsession.HttpSessionCmisService;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-
-/**
- * Very simple example of a concrete {@link FilterCmisService} implementation.
- */
-public class SimpleForwardingCmisService extends HttpSessionCmisService {
-
- private static final long serialVersionUID = 1L;
-
- private static final String BINDING_PARAMETERS_PREFIX = "forwarding.binding.";
-
- private Map<String, String> bindingParameters;
-
- @Override
- public void init(Map<String, String> parameters) {
- super.init(parameters);
-
- // gather binding parameters
- bindingParameters = new HashMap<String, String>();
-
- for (Map.Entry<String, String> p : parameters.entrySet()) {
- if (p.getKey().startsWith(BINDING_PARAMETERS_PREFIX)) {
- bindingParameters.put(p.getKey().substring(BINDING_PARAMETERS_PREFIX.length()), p.getValue());
- }
- }
- }
-
- @Override
- public CmisBinding createCmisBinding() {
- return SimpleCmisBindingFactory.createCmisBinding(getCallContext(), bindingParameters);
- }
-
- @Override
- public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
-
- RepositoryInfo repInfo = getCmisBinding().getRepositoryService().getRepositoryInfo(repositoryId, extension);
-
- RepositoryInfoImpl newRepInfo = new RepositoryInfoImpl(repInfo);
- newRepInfo.setDescription(repInfo.getDescription() + " (forwarded by the OpenCMIS Bridge)");
-
- return newRepInfo;
- }
-
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java
deleted file mode 100644
index 2494230..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.lrucache;
-
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-
-/**
- * Simple LRU cache for {@link CmisBinding} objects. The cache key is consists
- * of the repository id and the user.
- */
-public class CmisBindingCache implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
- private final LinkedHashMap<String, CmisBinding> cache;
-
- public CmisBindingCache(final int size) {
- cache = new LinkedHashMap<String, CmisBinding>(size + 1, 0.70f, true) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public boolean removeEldestEntry(Map.Entry<String, CmisBinding> eldest) {
- return size() > size;
- }
- };
- }
-
- public CmisBinding getCmisBinding(CallContext context) {
- lock.writeLock().lock();
- try {
- return cache.get(getCacheKey(context));
- } finally {
- lock.writeLock().unlock();
- }
- }
-
- public CmisBinding putCmisBinding(CallContext context, CmisBinding binding) {
- lock.writeLock().lock();
- try {
- String key = getCacheKey(context);
- CmisBinding extistingBinding = cache.get(getCacheKey(context));
- if (extistingBinding == null) {
- cache.put(key, binding);
- } else {
- binding = extistingBinding;
- }
-
- return binding;
- } finally {
- lock.writeLock().unlock();
- }
- }
-
- protected String getCacheKey(CallContext context) {
- String repositoryId = context.getRepositoryId();
- String user = context.getUsername();
-
- String key = (repositoryId == null ? "" : repositoryId);
- if (user != null) {
- key = key + "\n" + user;
- }
-
- return key;
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java
deleted file mode 100644
index 7343e7e..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.lrucache;
-
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.bridge.AbstractBridgeServiceFactory;
-import org.apache.chemistry.opencmis.bridge.FilterCmisService;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-
-public class LruCacheBridgeServiceFactory extends AbstractBridgeServiceFactory {
-
- public static final String CACHE_SIZE = "cache.size";
- public static final int DEFAULT_CACHE_SIZE = 1000;
-
- private CmisBindingCache cache;
-
- @Override
- public void init(Map<String, String> parameters) {
- super.init(parameters);
-
- // initialize LRU cache
- int size = 0;
- try {
- String sizeStr = parameters.get(CACHE_SIZE);
- size = (sizeStr == null || sizeStr.trim().length() == 0 ? DEFAULT_CACHE_SIZE : Integer.parseInt(sizeStr
- .trim()));
- } catch (NumberFormatException e) {
- throw new RuntimeException("Could not parse cache configuration values: " + e.getMessage(), e);
- }
-
- cache = new CmisBindingCache(size);
- }
-
- @Override
- protected FilterCmisService createService(CallContext context) {
- LruCacheCmisService service = null;
- try {
- service = (LruCacheCmisService) getServiceClass().newInstance();
- } catch (Exception e) {
- throw new CmisRuntimeException("Could not create service instance: " + e, e);
- }
-
- service.init(getParameters(), cache);
-
- return service;
- }
-}
\ No newline at end of file
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java
deleted file mode 100644
index 9c09b19..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.bridge.lrucache;
-
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.bridge.CachedBindingCmisService;
-import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-
-/**
- * Uses a LRU cache to cache {@link CmisBinding} objects.
- */
-public abstract class LruCacheCmisService extends CachedBindingCmisService {
-
- private static final long serialVersionUID = 1L;
-
- private CmisBindingCache cache;
-
- public void init(Map<String, String> parameters, CmisBindingCache cache) {
- init(parameters);
- this.cache = cache;
- }
-
- @Override
- public CmisBinding getCmisBindingFromCache() {
- return cache.getCmisBinding(getCallContext());
- }
-
- @Override
- public CmisBinding putCmisBindingIntoCache(CmisBinding binding) {
- return cache.putCmisBinding(getCallContext(), binding);
- }
-}
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/LICENSE b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/LICENSE
deleted file mode 100644
index c34e7b9..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/LICENSE
+++ /dev/null
@@ -1,206 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
----
-
-Please see also THRID-PARTY-LICENSES.
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/NOTICE b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/NOTICE
deleted file mode 100644
index a4fbbe2..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/META-INF/NOTICE
+++ /dev/null
@@ -1,22 +0,0 @@
-
-OpenCMIS Bridge
-Copyright 2009-2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
-OpenCMIS contains code from the following Open Source projects:
-
-- Base64
- Copyright (c) 2010 Robert Harder
- Public Domain, <http://iharder.net/base64>
-
-- JSON.simple
- Copyright (c) 2012 Yidong Fang
- Apache License 2.0, <http://code.google.com/p/json-simple/>
-
-
-OpenCMIS contains OASIS CMIS 1.0 and CMIS 1.1 schema and WSDL files.
-Copyright (c) 2010 and 2013 OASIS Open
-<https://www.oasis-open.org/committees/cmis>
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties
deleted file mode 100644
index 2ac5d7e..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-###########################################################
-#
-# Bridge configuration
-#
-# Note: class MUST be set
-#
-###########################################################
-
-class=org.apache.chemistry.opencmis.bridge.httpsession.HttpSessionBridgeServiceFactory
-# bridge.tempDirectory=/tmp
-# bridge.memoryThreshold=4194304
-# bridge.maxContentSize=4294967296
-
-# cache.size=1000
-
-
-###########################################################
-#
-# Service configuration
-#
-# Note: service.class MUST be set
-#
-###########################################################
-
-service.class=org.apache.chemistry.opencmis.bridge.httpsession.sample.SimpleForwardingCmisService
-# service.defaultMaxItems=100000
-# service.defaultDepth=-1
-# service.defaultTypesMaxItems=1000
-# service.defaultTypesDepth=10
-
-
-###########################################################
-#
-# Sample configuration for the SimpleForwardingCmisService
-#
-# Note: user name and password are added on-the-fly
-#
-###########################################################
-
-forwarding.binding.org.apache.chemistry.opencmis.binding.spi.type=browser
-forwarding.binding.org.apache.chemistry.opencmis.binding.browser.url=http://localhost:8080/inmemory/browser
-forwarding.binding.org.apache.chemistry.opencmis.binding.compression=true
-forwarding.binding.org.apache.chemistry.opencmis.binding.cookies=true
diff --git a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml b/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 729d73e..0000000
--- a/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<web-app version="2.4"
- xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>OpenCMIS Bridge</display-name>
-
- <listener>
- <listener-class>org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener</listener-class>
- </listener>
-
- <listener>
- <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>cmisws</servlet-name>
- <servlet-class>org.apache.chemistry.opencmis.server.impl.webservices.CmisWebServicesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>cmisatom</servlet-name>
- <servlet-class>org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet</servlet-class>
- <init-param>
- <param-name>callContextHandler</param-name>
- <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
- </init-param>
- <load-on-startup>2</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>cmisbrowser</servlet-name>
- <servlet-class>org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet</servlet-class>
- <init-param>
- <param-name>callContextHandler</param-name>
- <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
- </init-param>
- <load-on-startup>2</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>cmisws</servlet-name>
- <url-pattern>/services/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>cmisatom</servlet-name>
- <url-pattern>/atom/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>cmisbrowser</servlet-name>
- <url-pattern>/browser/*</url-pattern>
- </servlet-mapping>
-
- <session-config>
- <session-timeout>60</session-timeout>
- </session-config>
-</web-app>
diff --git a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/pom.xml b/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/pom.xml
deleted file mode 100644
index 83a8007..0000000
--- a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis</artifactId>
- <version>0.13.0</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>chemistry-opencmis-client-api</artifactId>
- <name>OpenCMIS Client API</name>
- <packaging>jar</packaging>
-
- <properties>
- <parentBasedir>../../</parentBasedir>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>${felix.plugin.version}</version>
- <extensions>true</extensions>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.chemistry.opencmis.client;version=${project.version},
- org.apache.chemistry.opencmis.client.api.*;version=${project.version}
- </Export-Package>
- <Bundle-DocURL>${project.url}</Bundle-DocURL>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>chemistry-opencmis-commons-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionFactoryFinder.java b/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionFactoryFinder.java
deleted file mode 100644
index ecf4c25..0000000
--- a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionFactoryFinder.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Method;
-
-import org.apache.chemistry.opencmis.client.api.SessionFactory;
-
-/**
- * Finds a {@link SessionFactory} implementation and creates a factory object.
- * <p>
- * Sample code:
- * <p>
- *
- * <pre>
- * SessionFactory factory = SessionFactoryFinder.find();
- *
- * Map<String, String> parameter = new HashMap<String, String>();
- * parameter.put(SessionParameter.USER, "Otto");
- * parameter.put(SessionParameter.PASSWORD, "****");
- *
- * parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost/cmis/atom");
- * parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
- * parameter.put(SessionParameter.REPOSITORY_ID, "myRepository");
- * ...
- * Session session = factory.createSession(parameter);
- * </pre>
- *
- * @see SessionFactory
- */
-public final class SessionFactoryFinder {
-
- /**
- * Private constructor.
- */
- private SessionFactoryFinder() {
- }
-
- /**
- * Creates a default {@link SessionFactory} object.
- *
- * @return the newly created {@link SessionFactory} object
- *
- * @throws ClassNotFoundException
- * if the session factory class cannot be found
- * @throws InstantiationException
- * if the session factory object cannot be instantiated
- */
- public static SessionFactory find() throws ClassNotFoundException, InstantiationException {
- return find("org.apache.chemistry.opencmis.client.SessionFactory", null);
- }
-
- /**
- * Creates a {@link SessionFactory} object.
- *
- * @param factoryId
- * the factory ID of the {@link SessionFactory}
- *
- * @return the newly created {@link SessionFactory} object
- *
- * @throws ClassNotFoundException
- * if the session factory class cannot be found
- * @throws InstantiationException
- * if the session factory object cannot be instantiated
- */
- public static SessionFactory find(String factoryId) throws ClassNotFoundException, InstantiationException {
- return find(factoryId, null);
- }
-
- /**
- * Creates a {@link SessionFactory} object.
- *
- * @param factoryId
- * the factory ID of the {@link SessionFactory}
- * @param classLoader
- * the class loader to use
- *
- * @return the newly created {@link SessionFactory} object
- *
- * @throws ClassNotFoundException
- * if the session factory class cannot be found
- * @throws InstantiationException
- * if the session factory object cannot be instantiated
- */
- public static SessionFactory find(String factoryId, ClassLoader classLoader) throws ClassNotFoundException,
- InstantiationException {
- return find(factoryId, classLoader, "org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl");
- }
-
- /**
- * Creates a {@link SessionFactory} object.
- *
- * @param factoryId
- * the factory ID of the {@link SessionFactory}
- * @param classLoader
- * the class loader to use
- * @param fallbackClassName
- * the name of the class to use if no other class name has been
- * provided
- *
- * @return the newly created {@link SessionFactory} object
- *
- * @throws ClassNotFoundException
- * if the session factory class cannot be found
- * @throws InstantiationException
- * if the session factory object cannot be instantiated
- */
- private static SessionFactory find(String factoryId, ClassLoader classLoader, String fallbackClassName)
- throws ClassNotFoundException, InstantiationException {
- ClassLoader cl = classLoader;
- if (cl == null) {
- cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- cl = SessionFactoryFinder.class.getClassLoader();
- }
- }
-
- String factoryClassName = null;
-
- if (factoryId != null) {
- factoryClassName = System.getProperty(factoryId);
-
- if (factoryClassName == null) {
- String serviceId = "META-INF/services/" + factoryId;
- InputStream stream = cl.getResourceAsStream(serviceId);
- if (stream != null) {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
- factoryClassName = reader.readLine();
- } catch (IOException e) {
- factoryClassName = null;
- } finally {
- try {
- if (reader != null) {
- reader.close();
- } else {
- stream.close();
- }
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
- }
-
- if (factoryClassName == null) {
- factoryClassName = fallbackClassName;
- }
-
- Class<?> clazz = cl.loadClass(factoryClassName);
-
- SessionFactory result = null;
- try {
- Method newInstanceMethod = clazz.getMethod("newInstance", new Class[0]);
-
- if (!SessionFactory.class.isAssignableFrom(newInstanceMethod.getReturnType())) {
- throw new ClassNotFoundException("newInstance() method does not return a SessionFactory object!");
- }
-
- try {
- result = (SessionFactory) newInstanceMethod.invoke(null, new Object[0]);
- } catch (Exception e) {
- throw new InstantiationException("Could not create SessionFactory object!");
- }
- } catch (NoSuchMethodException nsme) {
- if (!SessionFactory.class.isAssignableFrom(clazz)) {
- throw new ClassNotFoundException("The class does not implemnt the SessionFactory interface!", nsme);
- }
-
- try {
- result = (SessionFactory) clazz.newInstance();
- } catch (Exception e) {
- throw new InstantiationException("Could not create SessionFactory object!");
- }
- }
-
- return result;
- }
-}
diff --git a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java b/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
deleted file mode 100644
index 47031d3..0000000
--- a/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.chemistry.opencmis.client;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.chemistry.opencmis.client.api.ObjectFactory;
-import org.apache.chemistry.opencmis.client.api.SessionFactory;
-import org.apache.chemistry.opencmis.commons.SessionParameter;
-import org.apache.chemistry.opencmis.commons.enums.BindingType;
-import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
-import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
-
-/**
- * A map with convenience methods to set session parameters.
- * <p>
- * Sample code:
- * <p>
- *
- * <pre>
- * SessionFactory factory = ...
- *
- * SessionParameterMap parameter = new SessionParameterMap();
- *
- * parameter.setBasicAuthentication("Otto", "****");
- * parameter.setAtomPubBindingUrl("http://localhost/cmis/atom");
- * parameter.setRepositoryId("myRepository");
- * ...
- * Session session = factory.createSession(parameter);
- * </pre>
- *
- * @see SessionParameter
- * @see SessionFactory
- */
-public class SessionParameterMap extends LinkedHashMap<String, String> {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates an empty map.
- */
- public SessionParameterMap() {
- super();
- }
-
- /**
- * Creates a map with the same mappings as the specified map.
- *
- * @param map
- * the map whose mappings are to be placed in this map
- */
- public SessionParameterMap(Map<? extends String, ? extends String> map) {
- super(map);
- }
-
- /**
- * Sets a long value.
- *
- * @param key
- * the key
- * @param value
- * the value
- *
- * @return the previous value for this key or {@code null}
- */
- public String put(String key, long value) {
- return put(key, Long.toString(value));
- }
-
- /**
- * Sets a boolean value.
- *
- * @param key
- * the key
- * @param value
- * the value
- *
- * @return the previous value for this key or {@code null}
- */
- public String put(String key, boolean value) {
- return put(key, value ? "true" : "false");
- }
-
- /**
- * Sets the AtomPub URL and sets the binding to AtomPub.
- *
- * @param url
- * the AtomPub binding URL
- */
- public void setAtomPubBindingUrl(String url) {
- if (url == null) {
- remove(SessionParameter.BINDING_TYPE);
- remove(SessionParameter.ATOMPUB_URL);
- } else {
- put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
- put(SessionParameter.ATOMPUB_URL, url);
- }
- }
-
- /**
- * Sets the Web Services WSDL URL and sets the binding to Web Services.
- * Assumes that all CMIS services have the same WSDL URL.
- *
- * @param url
- * the Web Services WSDL URL
- */
- public void setWebServicesBindingUrl(String url) {
- if (url == null) {
- remove(SessionParameter.BINDING_TYPE);
- remove(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE);
- remove(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE);
- remove(SessionParameter.WEBSERVICES_OBJECT_SERVICE);
- remove(SessionParameter.WEBSERVICES_VERSIONING_SERVICE);
- remove(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE);
- remove(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE);
- remove(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE);
- remove(SessionParameter.WEBSERVICES_ACL_SERVICE);
- remove(SessionParameter.WEBSERVICES_POLICY_SERVICE);
- } else {
- put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
- put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
- put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
- put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url);
- put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url);
- put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url);
- put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url);
- put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url);
- put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
- put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
- }
- }
-
- /**
- * Sets the Web Service memory threshold.
- *
- * @param threshold
- * the threshold in bytes
- */
- public void setWebServicesMemoryThreshold(long threshold) {
- put(SessionParameter.WEBSERVICES_MEMORY_THRESHOLD, threshold);
- }
-
- /**
- * Sets the Browser URL and sets the binding to Browser.
- *
- * @param url
- * the Browser binding URL
- */
- public void setBrowserBindingUrl(String url) {
- if (url == null) {
- remove(SessionParameter.BINDING_TYPE);
- remove(SessionParameter.BROWSER_URL);
- } else {
- put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
- put(SessionParameter.BROWSER_URL, url);
- }
- }
-
- /**
- * Sets whether properties should be sent in the succinct format or not.
- * Only relevant for the browser binding.
- *
- * @param succinct
- * {@code true} if properties should be sent in the succinct
- * format, {@code false} otherwise
- */
- public void setBrowserBindingSuccinct(boolean succinct) {
- put(SessionParameter.BROWSER_SUCCINCT, succinct);
- }
-
- /**
- * Sets the local service factory and sets the binding to Local.
- *
- * @param serviceFactoryClass
- * the local service factory class
- */
- public void setLocalBindingClass(Class<? extends CmisServiceFactory> serviceFactoryClass) {
- if (serviceFactoryClass == null) {
- remove(SessionParameter.BINDING_TYPE);
- remove(SessionParameter.LOCAL_FACTORY);
- } else {
- put(SessionParameter.BINDING_TYPE, BindingType.LOCAL.value());
- put(SessionParameter.LOCAL_FACTORY, serviceFactoryClass.getName());
- }
- }
-
- /**
- * Sets the repository ID.
- *
- * @param repositoryId
- * the repository ID
- */
- public void setRepositoryId(String repositoryId) {
- if (repositoryId == null) {
- remove(SessionParameter.REPOSITORY_ID);
- } else {
- put(SessionParameter.REPOSITORY_ID, repositoryId);
- }
- }
-
- /**
- * Sets user and password.
- *
- * @param user
- * the user
- * @param password
- * the password
- */
- public void setUserAndPassword(String user, String password) {
- if (user == null) {
- remove(SessionParameter.USER);
- remove(SessionParameter.PASSWORD);
- } else {
- put(SessionParameter.USER, user);
- put(SessionParameter.PASSWORD, password);
- }
- }
-
- /**
- * Sets bearer token.
- *
- * @param token
- * the bearer token
- */
- public void setBearerToken(String token) {
- if (token == null) {
- remove(SessionParameter.OAUTH_ACCESS_TOKEN);
- } else {
- put(SessionParameter.OAUTH_ACCESS_TOKEN, token);
- }
- }
-
- /**
- * Turns all authentication off if the standard authentication provider is
- * used.
- */
- public void setNoAuthentication() {
- put(SessionParameter.AUTH_HTTP_BASIC, false);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
-
- remove(SessionParameter.AUTHENTICATION_PROVIDER_CLASS);
- }
-
- /**
- * Turns basic authentication on and UsernameToken authentication off if the
- * standard authentication provider is used.
- *
- * @param user
- * the user
- *
- * @param password
- * the password
- */
- public void setBasicAuthentication(String user, String password) {
- if (user == null) {
- throw new IllegalArgumentException("User must be set!");
- }
-
- setUserAndPassword(user, password);
-
- put(SessionParameter.AUTH_HTTP_BASIC, true);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
-
- remove(SessionParameter.AUTHENTICATION_PROVIDER_CLASS);
- }
-
- /**
- * Turns UsernameToken authentication on for the Web Services binding if the
- * standard authentication provider is used.
- *
- * @param user
- * the user
- * @param password
- * the password
- * @param basicAuth
- * {@code true} if basic authentication should be used in
- * addition to the UsernameToken authentication (required by some
- * servers), {@code false} otherwise
- */
- public void setUsernameTokenAuthentication(String user, String password, boolean basicAuth) {
- if (user == null) {
- throw new IllegalArgumentException("User must be set!");
- }
-
- setUserAndPassword(user, password);
-
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, true);
- put(SessionParameter.AUTH_HTTP_BASIC, basicAuth);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
-
- remove(SessionParameter.AUTHENTICATION_PROVIDER_CLASS);
- }
-
- /**
- * Turns NTLM authentication on and basic authentication and UsernameToken
- * authentication off.
- * <p>
- * <em>Works only in single user environments and only with NTLMv1!</em>
- *
- * @param user
- * the user
- * @param password
- * the password
- */
- public void setNtlmAuthentication(String user, String password) {
- if (user == null) {
- throw new IllegalArgumentException("User must be set!");
- }
-
- setUserAndPassword(user, password);
-
- put(SessionParameter.AUTH_HTTP_BASIC, false);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
- put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
- "org.apache.chemistry.opencmis.client.bindings.spi.NTLMAuthenticationProvider");
- }
-
- /**
- * Turns simple OAuth 2.0 bearer token authentication on and basic
- * authentication and UsernameToken authentication off.
- * <p>
- * This authentication method does not refresh the token when it expires.
- *
- * @param token
- * the bearer token
- */
- public void setOAuthBearerTokenAuthentication(String token) {
- if (token == null) {
- throw new IllegalArgumentException("Token must be set!");
- }
-
- setBearerToken(token);
-
- put(SessionParameter.AUTH_HTTP_BASIC, false);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, true);
- put(SessionParameter.OAUTH_ACCESS_TOKEN, token);
-
- remove(SessionParameter.AUTHENTICATION_PROVIDER_CLASS);
- }
-
- /**
- * Turns OAuth 2.0 authentication on and basic authentication and
- * UsernameToken authentication off.
- * <p>
- * This authentication method requests a new token and refreshes the token
- * when it expires.
- *
- * @param tokenEntpoint
- * the token endpoint URL
- * @param clientId
- * the client ID
- * @param clientSecret
- * the client secret if required, {@code null} otherwise
- * @param code
- * the authorization code
- * @param redirectUri
- * the redirect URI if required, {@code null} otherwise
- */
- public void setOAuthAuthentication(String tokenEntpoint, String clientId, String clientSecret, String code,
- String redirectUri) {
- if (tokenEntpoint == null || tokenEntpoint.length() == 0) {
- throw new IllegalArgumentException("Token endpoint must be set!");
- }
-
- if (clientId == null || clientId.length() == 0) {
- throw new IllegalArgumentException("Client ID must be set!");
- }
-
- put(SessionParameter.AUTH_HTTP_BASIC, false);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
-
- put(SessionParameter.OAUTH_TOKEN_ENDPOINT, tokenEntpoint);
- put(SessionParameter.OAUTH_CLIENT_ID, clientId);
-
- if (clientSecret == null) {
- remove(SessionParameter.OAUTH_CLIENT_SECRET);
- } else {
- put(SessionParameter.OAUTH_CLIENT_SECRET, clientSecret);
- }
-
- if (code == null) {
- remove(SessionParameter.OAUTH_CODE);
- } else {
- put(SessionParameter.OAUTH_CODE, code);
- }
-
- if (redirectUri == null) {
- remove(SessionParameter.OAUTH_REDIRECT_URI);
- } else {
- put(SessionParameter.OAUTH_REDIRECT_URI, redirectUri);
- }
-
- put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
- "org.apache.chemistry.opencmis.client.bindings.spi.OAuthAuthenticationProvider");
- }
-
- /**
- * Turns OAuth 2.0 authentication on and basic authentication and
- * UsernameToken authentication off.
- * <p>
- * This authentication method uses the provided token and refreshes the
- * token when it expires.
- *
- * @param tokenEntpoint
- * the token endpoint URL
- * @param clientId
- * the client ID
- * @param clientSecret
- * the client secret if required, {@code null} otherwise
- * @param accessToken
- * the bearer access token
- * @param refreshToken
- * the refresh token
- * @param expirationTimestamp
- * the timestamp when the access token expires
- */
- public void setOAuthAuthentication(String tokenEntpoint, String clientId, String clientSecret, String accessToken,
- String refreshToken, long expirationTimestamp) {
- if (tokenEntpoint == null || tokenEntpoint.length() == 0) {
- throw new IllegalArgumentException("Token endpoint must be set!");
- }
-
- if (clientId == null || clientId.length() == 0) {
- throw new IllegalArgumentException("Client ID must be set!");
- }
-
- put(SessionParameter.AUTH_HTTP_BASIC, false);
- put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, false);
- put(SessionParameter.AUTH_OAUTH_BEARER, false);
-
- put(SessionParameter.OAUTH_TOKEN_ENDPOINT, tokenEntpoint);
- put(SessionParameter.OAUTH_CLIENT_ID, clientId);
-
- if (clientSecret == null) {
- remove(SessionParameter.OAUTH_CLIENT_SECRET);
- } else {
- put(SessionParameter.OAUTH_CLIENT_SECRET, clientSecret);
- }
-
- if (accessToken == null) {
- remove(SessionParameter.OAUTH_ACCESS_TOKEN);
- } else {
- put(SessionParameter.OAUTH_ACCESS_TOKEN, accessToken);
- }
-
- if (refreshToken == null) {
- remove(SessionParameter.OAUTH_REFRESH_TOKEN);
- } else {
- put(SessionParameter.OAUTH_REFRESH_TOKEN, refreshToken);
- }
-
- if (expirationTimestamp < 0) {
- remove(SessionParameter.OAUTH_EXPIRATION_TIMESTAMP);
- } else {
- put(SessionParameter.OAUTH_EXPIRATION_TIMESTAMP, expirationTimestamp);
- }
-
- put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
- "org.apache.chemistry.opencmis.client.bindings.spi.OAuthAuthenticationProvider");
- }
-
- /**
- * Sets the locale of the session.
- *
- * @param locale
- * the locale
- */
- public void setLocale(Locale locale) {
- if (locale == null) {
- remove(SessionParameter.LOCALE_ISO639_LANGUAGE);
- remove(SessionParameter.LOCALE_ISO3166_COUNTRY);
- remove(SessionParameter.LOCALE_VARIANT);
- } else {
- if (locale.getLanguage()