some logging changes, test improvements, style check

This commit is contained in:
bhlowe
2019-07-31 10:24:56 -07:00
parent 1c7c05710e
commit 77d1c615eb
17 changed files with 1323 additions and 1293 deletions

View File

@@ -2,222 +2,222 @@
<code_scheme name="GoogleStyle">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
<option name="USE_TAB_CHARACTER" value="false"/>
<option name="SMART_TABS" value="false"/>
<option name="LABEL_INDENT_SIZE" value="0"/>
<option name="LABEL_INDENT_ABSOLUTE" value="false"/>
<option name="USE_RELATIVE_INDENTS" value="false"/>
</value>
</option>
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="INSERT_INNER_CLASS_IMPORTS" value="true"/>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
<value/>
</option>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true"/>
<emptyLine/>
<package name="" withSubpackages="true" static="false"/>
</value>
</option>
<option name="RIGHT_MARGIN" value="100" />
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_P_AT_EMPTY_LINES" value="false" />
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="RIGHT_MARGIN" value="100"/>
<option name="JD_ALIGN_PARAM_COMMENTS" value="false"/>
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false"/>
<option name="JD_P_AT_EMPTY_LINES" value="false"/>
<option name="JD_KEEP_EMPTY_PARAMETER" value="false"/>
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false"/>
<option name="JD_KEEP_EMPTY_RETURN" value="false"/>
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0"/>
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0"/>
<option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
<option name="ALIGN_MULTILINE_FOR" value="false"/>
<option name="CALL_PARAMETERS_WRAP" value="1"/>
<option name="METHOD_PARAMETERS_WRAP" value="1"/>
<option name="EXTENDS_LIST_WRAP" value="1"/>
<option name="THROWS_KEYWORD_WRAP" value="1"/>
<option name="METHOD_CALL_CHAIN_WRAP" value="1"/>
<option name="BINARY_OPERATION_WRAP" value="1"/>
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
<option name="TERNARY_OPERATION_WRAP" value="1"/>
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
<option name="ARRAY_INITIALIZER_WRAP" value="1"/>
<option name="WRAP_COMMENTS" value="true"/>
<option name="IF_BRACE_FORCE" value="3"/>
<option name="DOWHILE_BRACE_FORCE" value="3"/>
<option name="WHILE_BRACE_FORCE" value="3"/>
<option name="FOR_BRACE_FORCE" value="3"/>
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
<AndroidXmlCodeStyleSettings>
<option name="USE_CUSTOM_SETTINGS" value="true" />
<option name="USE_CUSTOM_SETTINGS" value="true"/>
<option name="LAYOUT_SETTINGS">
<value>
<option name="INSERT_BLANK_LINE_BEFORE_TAG" value="false" />
<option name="INSERT_BLANK_LINE_BEFORE_TAG" value="false"/>
</value>
</option>
</AndroidXmlCodeStyleSettings>
<JSCodeStyleSettings>
<option name="INDENT_CHAINED_CALLS" value="false" />
<option name="INDENT_CHAINED_CALLS" value="false"/>
</JSCodeStyleSettings>
<Python>
<option name="USE_CONTINUATION_INDENT_FOR_ARGUMENTS" value="true" />
<option name="USE_CONTINUATION_INDENT_FOR_ARGUMENTS" value="true"/>
</Python>
<TypeScriptCodeStyleSettings>
<option name="INDENT_CHAINED_CALLS" value="false" />
<option name="INDENT_CHAINED_CALLS" value="false"/>
</TypeScriptCodeStyleSettings>
<XML>
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
<option name="XML_ALIGN_ATTRIBUTES" value="false"/>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true"/>
</XML>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="ECMA Script Level 4">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
<option name="ALIGN_MULTILINE_FOR" value="false"/>
<option name="CALL_PARAMETERS_WRAP" value="1"/>
<option name="METHOD_PARAMETERS_WRAP" value="1"/>
<option name="EXTENDS_LIST_WRAP" value="1"/>
<option name="BINARY_OPERATION_WRAP" value="1"/>
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
<option name="TERNARY_OPERATION_WRAP" value="1"/>
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
<option name="ARRAY_INITIALIZER_WRAP" value="1"/>
<option name="IF_BRACE_FORCE" value="3"/>
<option name="DOWHILE_BRACE_FORCE" value="3"/>
<option name="WHILE_BRACE_FORCE" value="3"/>
<option name="FOR_BRACE_FORCE" value="3"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1"/>
<option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
<option name="ALIGN_MULTILINE_RESOURCES" value="false"/>
<option name="ALIGN_MULTILINE_FOR" value="false"/>
<option name="CALL_PARAMETERS_WRAP" value="1"/>
<option name="METHOD_PARAMETERS_WRAP" value="1"/>
<option name="EXTENDS_LIST_WRAP" value="1"/>
<option name="THROWS_KEYWORD_WRAP" value="1"/>
<option name="METHOD_CALL_CHAIN_WRAP" value="1"/>
<option name="BINARY_OPERATION_WRAP" value="1"/>
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
<option name="TERNARY_OPERATION_WRAP" value="1"/>
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
<option name="ARRAY_INITIALIZER_WRAP" value="1"/>
<option name="WRAP_COMMENTS" value="true"/>
<option name="IF_BRACE_FORCE" value="3"/>
<option name="DOWHILE_BRACE_FORCE" value="3"/>
<option name="WHILE_BRACE_FORCE" value="3"/>
<option name="FOR_BRACE_FORCE" value="3"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<option name="RIGHT_MARGIN" value="80"/>
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
<option name="ALIGN_MULTILINE_FOR" value="false"/>
<option name="CALL_PARAMETERS_WRAP" value="1"/>
<option name="METHOD_PARAMETERS_WRAP" value="1"/>
<option name="BINARY_OPERATION_WRAP" value="1"/>
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
<option name="TERNARY_OPERATION_WRAP" value="1"/>
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
<option name="ARRAY_INITIALIZER_WRAP" value="1"/>
<option name="IF_BRACE_FORCE" value="3"/>
<option name="DOWHILE_BRACE_FORCE" value="3"/>
<option name="WHILE_BRACE_FORCE" value="3"/>
<option name="FOR_BRACE_FORCE" value="3"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<option name="RIGHT_MARGIN" value="80" />
<option name="RIGHT_MARGIN" value="80"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="2"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="protobuf">
<option name="RIGHT_MARGIN" value="80" />
<option name="RIGHT_MARGIN" value="80"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="2"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Python">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="RIGHT_MARGIN" value="80" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="RIGHT_MARGIN" value="80"/>
<option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SASS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="2"/>
<option name="TAB_SIZE" value="2"/>
</indentOptions>
<arrangement>
<rules>
@@ -226,7 +226,7 @@
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -237,7 +237,7 @@
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -249,7 +249,7 @@
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -260,7 +260,7 @@
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -271,7 +271,7 @@
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -283,7 +283,7 @@
<match>
<AND>
<NAME>.*:.*Style</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -295,7 +295,7 @@
<match>
<AND>
<NAME>.*:layout_width</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -306,7 +306,7 @@
<match>
<AND>
<NAME>.*:layout_height</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -317,7 +317,7 @@
<match>
<AND>
<NAME>.*:layout_weight</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -328,7 +328,7 @@
<match>
<AND>
<NAME>.*:layout_margin</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -339,7 +339,7 @@
<match>
<AND>
<NAME>.*:layout_marginTop</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -350,7 +350,7 @@
<match>
<AND>
<NAME>.*:layout_marginBottom</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -361,7 +361,7 @@
<match>
<AND>
<NAME>.*:layout_marginStart</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -372,7 +372,7 @@
<match>
<AND>
<NAME>.*:layout_marginEnd</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -383,7 +383,7 @@
<match>
<AND>
<NAME>.*:layout_marginLeft</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -394,7 +394,7 @@
<match>
<AND>
<NAME>.*:layout_marginRight</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -405,7 +405,7 @@
<match>
<AND>
<NAME>.*:layout_.*</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -417,7 +417,7 @@
<match>
<AND>
<NAME>.*:padding</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -428,7 +428,7 @@
<match>
<AND>
<NAME>.*:paddingTop</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -439,7 +439,7 @@
<match>
<AND>
<NAME>.*:paddingBottom</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -450,7 +450,7 @@
<match>
<AND>
<NAME>.*:paddingStart</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -461,7 +461,7 @@
<match>
<AND>
<NAME>.*:paddingEnd</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -472,7 +472,7 @@
<match>
<AND>
<NAME>.*:paddingLeft</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -483,7 +483,7 @@
<match>
<AND>
<NAME>.*:paddingRight</NAME>
<XML_ATTRIBUTE />
<XML_ATTRIBUTE/>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -537,62 +537,62 @@
</arrangement>
</codeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
<option name="INDENT_CLASS_MEMBERS" value="2" />
<option name="INDENT_VISIBILITY_KEYWORDS" value="1" />
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
<option name="FUNCTION_PARAMETERS_WRAP" value="5" />
<option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
<option name="SPACE_BEFORE_SUPERCLASS_COLON" value="false" />
<option name="INDENT_NAMESPACE_MEMBERS" value="0"/>
<option name="INDENT_C_STRUCT_MEMBERS" value="2"/>
<option name="INDENT_CLASS_MEMBERS" value="2"/>
<option name="INDENT_VISIBILITY_KEYWORDS" value="1"/>
<option name="INDENT_INSIDE_CODE_BLOCK" value="2"/>
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true"/>
<option name="FUNCTION_PARAMETERS_WRAP" value="5"/>
<option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5"/>
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5"/>
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true"/>
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false"/>
<option name="SPACE_BEFORE_SUPERCLASS_COLON" value="false"/>
</Objective-C>
<Objective-C-extensions>
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
<option name="RELEASE_STYLE" value="IVAR" />
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK"/>
<option name="RELEASE_STYLE" value="IVAR"/>
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE"/>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function"/>
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod"/>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod"/>
</class>
<extensions>
<pair source="cc" header="h" />
<pair source="c" header="h" />
<pair source="cc" header="h"/>
<pair source="c" header="h"/>
</extensions>
</Objective-C-extensions>
<codeStyleSettings language="ObjectiveC">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
<option name="BLANK_LINES_AROUND_CLASS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="RIGHT_MARGIN" value="80"/>
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0"/>
<option name="BLANK_LINES_AFTER_IMPORTS" value="0"/>
<option name="BLANK_LINES_AROUND_CLASS" value="0"/>
<option name="BLANK_LINES_AROUND_METHOD" value="0"/>
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0"/>
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false"/>
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
<option name="ASSIGNMENT_WRAP" value="1"/>
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="INDENT_SIZE" value="2"/>
<option name="CONTINUATION_INDENT_SIZE" value="4"/>
</indentOptions>
</codeStyleSettings>
</code_scheme>

View File

@@ -1,129 +1,129 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>onvif-java</artifactId>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>onvif-java</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf.services.ws-discovery</groupId> -->
<!-- <artifactId>cxf-services-ws-discovery-api</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf.services.ws-discovery</groupId> -->
<!-- <artifactId>cxf-services-ws-discovery-service</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf.services.ws-discovery</groupId> -->
<!-- <artifactId>cxf-services-ws-discovery-api</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf.services.ws-discovery</groupId> -->
<!-- <artifactId>cxf-services-ws-discovery-service</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.onvif</groupId>
<artifactId>onvif-ws-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.onvif</groupId>
<artifactId>onvif-ws-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl -->
<!-- For Discovery -->
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl -->
<!-- For Discovery -->
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
<!-- For discovery using cxf -->
<!-- https://mvnrepository.com/artifact/org.apache.cxf.services.ws-discovery/cxf-services-ws-discovery-api -->
<!--
<dependency>
<groupId>org.apache.cxf.services.ws-discovery</groupId>
<artifactId>cxf-services-ws-discovery-api</artifactId>
<version>${cxf.version}</version>
</dependency>
-->
<!-- For discovery using cxf -->
<!-- https://mvnrepository.com/artifact/org.apache.cxf.services.ws-discovery/cxf-services-ws-discovery-api -->
<!--
<dependency>
<groupId>org.apache.cxf.services.ws-discovery</groupId>
<artifactId>cxf-services-ws-discovery-api</artifactId>
<version>${cxf.version}</version>
</dependency>
-->
<!-- Java 9+ javax dependencies start -->
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<!-- Java 9+ javax dependencies start -->
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<!-- Java 9+ javax dependencies end -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<!-- Java 9+ javax dependencies end -->
<!-- LOGGINBG... for testing -->
<!-- LOGGINBG... for testing -->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencies>
<!--
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.release}</release>
</configuration>
</plugin>
</plugins>
</build>
-->
<!--
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.release}</release>
</configuration>
</plugin>
</plugins>
</build>
-->
</project>

View File

@@ -1,99 +1,92 @@
package de.onvif.soap;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.transport.http.HTTPConduit;
import javax.net.ssl.*;
import javax.xml.ws.BindingProvider;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.xml.ws.BindingProvider;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.transport.http.HTTPConduit;
public class NaiveSSLHelper {
public static void makeWebServiceClientTrustEveryone(
Object webServicePort) {
if (webServicePort instanceof BindingProvider) {
BindingProvider bp = (BindingProvider) webServicePort;
Map requestContext = bp.getRequestContext();
requestContext.put(JAXWS_SSL_SOCKET_FACTORY, getTrustingSSLSocketFactory());
requestContext.put(JAXWS_HOSTNAME_VERIFIER,
new NaiveHostnameVerifier());
} else {
throw new IllegalArgumentException(
"Web service port "
+ webServicePort.getClass().getName()
+ " does not implement "
+ BindingProvider.class.getName());
}
}
public static void makeWebServiceClientTrustEveryone(Object webServicePort) {
if (webServicePort instanceof BindingProvider) {
BindingProvider bp = (BindingProvider) webServicePort;
Map requestContext = bp.getRequestContext();
requestContext.put(JAXWS_SSL_SOCKET_FACTORY, getTrustingSSLSocketFactory());
requestContext.put(JAXWS_HOSTNAME_VERIFIER, new NaiveHostnameVerifier());
} else {
throw new IllegalArgumentException(
"Web service port "
+ webServicePort.getClass().getName()
+ " does not implement "
+ BindingProvider.class.getName());
}
}
public static SSLSocketFactory getTrustingSSLSocketFactory() {
return SSLSocketFactoryHolder.INSTANCE;
}
public static SSLSocketFactory getTrustingSSLSocketFactory() {
return SSLSocketFactoryHolder.INSTANCE;
}
private static SSLSocketFactory createSSLSocketFactory() {
TrustManager[] trustManagers = new TrustManager[] {
new NaiveTrustManager()
};
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("TLS");
sslContext.init(new KeyManager[0], trustManagers,
new SecureRandom());
return sslContext.getSocketFactory();
} catch (GeneralSecurityException e) {
return null;
}
}
private static SSLSocketFactory createSSLSocketFactory() {
TrustManager[] trustManagers = new TrustManager[] {new NaiveTrustManager()};
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("TLS");
sslContext.init(new KeyManager[0], trustManagers, new SecureRandom());
return sslContext.getSocketFactory();
} catch (GeneralSecurityException e) {
return null;
}
}
public static void makeCxfWebServiceClientTrustEveryone(HTTPConduit http) {
TrustManager[] trustManagers = new TrustManager[]{
new NaiveTrustManager()
};
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setSecureSocketProtocol("TLS");
tlsParams.setKeyManagers(new KeyManager[0]);
tlsParams.setTrustManagers(trustManagers);
tlsParams.setDisableCNCheck(true);
http.setTlsClientParameters(tlsParams);
}
public static void makeCxfWebServiceClientTrustEveryone(HTTPConduit http) {
TrustManager[] trustManagers = new TrustManager[] {new NaiveTrustManager()};
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setSecureSocketProtocol("TLS");
tlsParams.setKeyManagers(new KeyManager[0]);
tlsParams.setTrustManagers(trustManagers);
tlsParams.setDisableCNCheck(true);
http.setTlsClientParameters(tlsParams);
}
private interface SSLSocketFactoryHolder {
SSLSocketFactory INSTANCE = createSSLSocketFactory();
}
private interface SSLSocketFactoryHolder {
SSLSocketFactory INSTANCE = createSSLSocketFactory();
}
private static class NaiveHostnameVerifier implements
HostnameVerifier {
@Override
public boolean verify(String hostName,
SSLSession session) {
return true;
}
}
private static class NaiveHostnameVerifier implements HostnameVerifier {
@Override
public boolean verify(String hostName, SSLSession session) {
return true;
}
}
private static class NaiveTrustManager implements
X509TrustManager {
private static class NaiveTrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] certs,
String authType) throws CertificateException {
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType)
throws CertificateException {}
@Override
public void checkServerTrusted(X509Certificate[] certs,
String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType)
throws CertificateException {}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
private static final java.lang.String JAXWS_HOSTNAME_VERIFIER =
"com.sun.xml.internal.ws.transport.https.client.hostname.verifier";
private static final java.lang.String JAXWS_SSL_SOCKET_FACTORY =
"com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory";
private static final java.lang.String JAXWS_HOSTNAME_VERIFIER =
"com.sun.xml.internal.ws.transport.https.client.hostname.verifier";
private static final java.lang.String JAXWS_SSL_SOCKET_FACTORY =
"com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory";
}

View File

@@ -62,16 +62,27 @@ public class OnvifDevice {
private static boolean verbose = false; // enable/disable logging of SOAP messages
final SimpleSecurityHandler securityHandler;
private static URL cleanURL(URL u) throws ConnectException {
if (u == null) throw new ConnectException("null url not allowed");
String f = u.getFile();
if (!f.isEmpty()) {
String out = u.toString().replace(f, "");
try {
return new URL(out);
} catch (MalformedURLException e) {
throw new ConnectException("MalformedURLException " + u);
}
}
return u;
}
/*
* @param url is http://host or http://host:port or https://host or https://host:port
* @param user Username you need to login, or "" for none
* @param password User's password to login, or "" for none
*/
public OnvifDevice(URL url, String user, String password)
throws ConnectException, SOAPException, MalformedURLException {
this.url = url;
String f = url.getFile();
if (!f.isEmpty()) throw new MalformedURLException("Expected empty file in URL, not:" + f);
public OnvifDevice(URL url, String user, String password) throws ConnectException, SOAPException {
this.url = cleanURL(url);
securityHandler =
!user.isEmpty() && !password.isEmpty() ? new SimpleSecurityHandler(user, password) : null;
init();
@@ -289,8 +300,8 @@ public class OnvifDevice {
return getSnapshotUri(0);
}
public String getRTSPUri() {
return getRTSPUri(0);
public String getStreamUri() {
return getStreamUri(0);
}
// Get snapshot uri for profile with index
@@ -300,12 +311,12 @@ public class OnvifDevice {
return "";
}
public String getRTSPUri(int index) {
return getRTSPUri(media.getProfiles().get(index).getToken());
public String getStreamUri(int index) {
return getStreamUri(media.getProfiles().get(index).getToken());
}
// returns rtsp://host[:port]/path_for_rtsp
public String getRTSPUri(String profileToken) {
public String getStreamUri(String profileToken) {
StreamSetup streamSetup = new StreamSetup();
Transport t = new Transport();
t.setProtocol(TransportProtocol.RTSP);

View File

@@ -36,8 +36,8 @@ import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;
/*
Utility class to add user/password onvif credentials to SOAP communications
*/
Utility class to add user/password onvif credentials to SOAP communications
*/
public class SimpleSecurityHandler implements SOAPHandler<SOAPMessageContext> {
private final String username;

View File

@@ -1,6 +1,5 @@
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out

View File

@@ -1,13 +0,0 @@
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:tns="http://schemas.xmlsoap.org/ws/2005/04/discovery">
<soap:Header>
<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action>
<wsa:MessageID>urn:uuid:c032cfdd-c3ca-49dc-820e-ee6696ad63e2</wsa:MessageID>
<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
</soap:Header>
<soap:Body>
<tns:Probe />
</soap:Body>
</soap:Envelope>

View File

@@ -6,16 +6,17 @@ import java.io.StringWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Logger;
import org.apache.cxf.common.logging.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class calls OnvifDiscovery and for each device URL found, calls TestDevice
* This assumes all onvif devices on your network use the same username and password.
* Class calls OnvifDiscovery and for each device URL found, calls TestDevice This assumes all onvif
* devices on your network use the same username and password.
*
* @author Brad Lowe
*/
public class DiscoverAndTest {
private static final Logger LOG = LogUtils.getL7dLogger(TestDevice.class);
private static final Logger LOG = LoggerFactory.getLogger(TestDevice.class);
public static String discoverAndTest(String user, String password) {
String sep = "\n";
@@ -38,10 +39,10 @@ public class DiscoverAndTest {
results.add(u.toString() + ":" + result);
} catch (Throwable e) {
bad++;
LOG.severe("error:" + u + " " + e.toString());
LOG.error("error:" + u, e);
// This is a bit of a hack. When a camera is password protected (it should be!)
// and the password is not provided or wrong, a "Unable to Send Message" exception
// is thrown. This is not clear-- buried in the stack track is the real cause.
// may be thrown. This is not clear-- buried in the stack track is the real cause.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
@@ -58,8 +59,16 @@ public class DiscoverAndTest {
public static void main(String[] args) {
// get user and password.. we will ignore device host
OnvifCredentials creds = GetTestDevice.getOnvifCredentials(args);
if (creds.getPassword().isEmpty()) LOG.info("Warning: No password for discover and test...");
LOG.info(discoverAndTest(creds.getUser(), creds.getPassword()));
String user = "";
String password = "";
if (args.length > 0) user = args[0];
if (args.length > 1) password = args[1];
if (password.isEmpty()) {
LOG.info(
"Warning: No password for discover and test... run with common user password as arguments");
}
// OnvifDevice.setVerbose(true);
LOG.info(discoverAndTest(user, password));
}
}

View File

@@ -1,22 +1,18 @@
package org.onvif.client;
import de.onvif.discovery.OnvifDiscovery;
import org.apache.cxf.common.logging.LogUtils;
import java.net.URL;
import java.util.Collection;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DiscoveryTest {
private static final Logger LOG = LogUtils.getL7dLogger(DiscoveryTest.class);
private static final Logger LOG = LoggerFactory.getLogger(DiscoveryTest.class);
public static void main(String[] args) {
Collection<URL> urls = OnvifDiscovery.discoverOnvifURLs();
for (URL u : urls) {
LOG.info(u.toString());
}
}
public static void main(String[] args) {
Collection<URL> urls = OnvifDiscovery.discoverOnvifURLs();
for (URL u : urls) {
LOG.info(u.toString());
}
}
}

View File

@@ -1,119 +1,116 @@
package org.onvif.client;
import org.apache.cxf.common.logging.LogUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GetTestDevice {
static String PROPERTY_NAME="ONVIF_HOST";
private static final Logger LOG = LogUtils.getL7dLogger(GetTestDevice.class);
static String PROPERTY_NAME = "ONVIF_HOST";
private static final Logger LOG = LoggerFactory.getLogger(GetTestDevice.class);
// Get a camera host, user name, and password for tests.
// Add an environment variable or java Property called "TEST_CAM" and set to host,user,password,profile
// or modify resource/onvif.properties
// Get a camera host, user name, and password for tests.
// Add an environment variable or java Property called "TEST_CAM" and set to
// host,user,password,profile
// or modify resource/onvif.properties
public static OnvifCredentials getOnvifCredentials(String args[]) {
public static OnvifCredentials getOnvifCredentials(String[] args) {
OnvifCredentials creds = getFromArgs(args);
if (creds!=null) return creds;
OnvifCredentials creds = getFromArgs(args);
if (creds != null) return creds;
creds = getFromProperties();
if (creds!=null) return creds;
try {
creds = getFirstFromResource("/onvif.properties");
if (creds != null) return creds;
}catch(IOException ioe)
{
LOG.log(Level.WARNING, "Error", ioe);
}
try {
creds = getFromStandardInput();
if (creds != null) return creds;
}catch(IOException ioe)
{
LOG.log(Level.WARNING, "Error", ioe);
}
creds = getFromProperties();
if (creds != null) return creds;
try {
creds = getFirstFromResource("/onvif.properties");
if (creds != null) return creds;
} catch (IOException ioe) {
LOG.error("Error", ioe);
}
try {
creds = getFromStandardInput();
if (creds != null) return creds;
} catch (IOException ioe) {
LOG.error("Error", ioe);
}
LOG.info("Unable to get default test onvif credentials");
return new OnvifCredentials("","","","");
}
LOG.info("Unable to get default test onvif credentials");
return new OnvifCredentials("", "", "", "");
}
// arguments to any test app can be host user password profilename
// if no arguments passed, returns null.
// All arguments optional.
public static OnvifCredentials getFromArgs(String[] args) {
if (args==null||args.length==0) return null;
String host="",user="",password="",profile="";
host = args[0];
if (args.length > 1) user = args[1];
if (args.length > 2) password = args[2];
if (args.length > 3) profile = args[3];
return new OnvifCredentials(host,user,password,profile);
}
// arguments to any test app can be host user password profilename
// if no arguments passed, returns null.
// All arguments optional.
public static OnvifCredentials getFromArgs(String[] args) {
if (args == null || args.length == 0) return null;
String host = "", user = "", password = "", profile = "";
host = args[0];
if (args.length > 1) user = args[1];
if (args.length > 2) password = args[2];
if (args.length > 3) profile = args[3];
return new OnvifCredentials(host, user, password, profile);
}
public static OnvifCredentials getFromProperties() {
String test = null;
if (test == null) test = System.getProperty(PROPERTY_NAME);
if (test == null) test = System.getenv(PROPERTY_NAME);
public static OnvifCredentials getFromProperties() {
String test = null;
if (test == null) test = System.getProperty(PROPERTY_NAME);
if (test == null) test = System.getenv(PROPERTY_NAME);
if (test != null) {
return parse(test);
}
return null;
}
if (test != null) {
return parse(test);
}
return null;
}
private static OnvifCredentials getFromStandardInput() throws IOException {
private static OnvifCredentials getFromStandardInput() throws IOException {
System.out.println("Getting camera credentials from standard input");
InputStreamReader inputStream = new InputStreamReader(System.in, "utf-8");
BufferedReader keyboardInput = new BufferedReader(inputStream);
System.out.println("Please enter camera IP (with port if not 80):");
String cameraAddress = keyboardInput.readLine();
System.out.println("Please enter camera username:");
String user = keyboardInput.readLine();
System.out.println("Please enter camera password:");
String password = keyboardInput.readLine();
System.out.println("Please enter camera profile [or enter to use first]:");
String profile = keyboardInput.readLine();
OnvifCredentials creds = new OnvifCredentials(cameraAddress, user, password, profile);
return creds;
}
private static OnvifCredentials getFirstFromResource(String resource) throws IOException {
System.out.println("Getting camera credentials from standard input");
InputStreamReader inputStream = new InputStreamReader(System.in, StandardCharsets.UTF_8);
BufferedReader keyboardInput = new BufferedReader(inputStream);
System.out.println("Please enter camera IP (with port if not 80):");
String cameraAddress = keyboardInput.readLine();
System.out.println("Please enter camera username:");
String user = keyboardInput.readLine();
System.out.println("Please enter camera password:");
String password = keyboardInput.readLine();
System.out.println("Please enter camera profile [or enter to use first]:");
String profile = keyboardInput.readLine();
OnvifCredentials creds = new OnvifCredentials(cameraAddress, user, password, profile);
return creds;
}
InputStream res = GetTestDevice.class.getResourceAsStream(resource);
if (res != null) {
Scanner s = new Scanner(res, "UTF-8").useDelimiter("\\A");
while (s.hasNextLine()) {
String line = s.nextLine();
if (!line.isEmpty() && !line.startsWith("#"))
return parse(line.substring(line.indexOf("=")+1));
}
}
return null;
}
private static OnvifCredentials getFirstFromResource(String resource) throws IOException {
// warning, this breaks if password contains a comma.
public static OnvifCredentials parse(String i) {
String host = "", user = "", password = "", profile = "";
if (i != null) {
if (i.contains(",")) {
String sp[] = i.split(",");
if (sp.length > 0) host = sp[0];
if (sp.length > 1) user = sp[1];
if (sp.length > 2) password = sp[2];
if (sp.length > 3) profile = sp[3];
InputStream res = GetTestDevice.class.getResourceAsStream(resource);
if (res != null) {
Scanner s = new Scanner(res, StandardCharsets.UTF_8).useDelimiter("\\A");
while (s.hasNextLine()) {
String line = s.nextLine();
if (!line.isEmpty() && !line.startsWith("#"))
return parse(line.substring(line.indexOf("=") + 1));
}
}
return null;
}
} else host = i;
}
return new OnvifCredentials(host, user, password, profile);
}
// warning, this breaks if password contains a comma.
public static OnvifCredentials parse(String i) {
String host = "", user = "", password = "", profile = "";
if (i != null) {
if (i.contains(",")) {
String[] sp = i.split(",");
if (sp.length > 0) host = sp[0];
if (sp.length > 1) user = sp[1];
if (sp.length > 2) password = sp[2];
if (sp.length > 3) profile = sp[3];
} else host = i;
}
return new OnvifCredentials(host, user, password, profile);
}
}

View File

@@ -1,55 +1,55 @@
package org.onvif.client;
public class OnvifCredentials {
private String host; // 92.168.xx.yy, or http://host[:port]
private String user; // admin
private String password; // secret
private String profile; // "MediaProfile000" If empty, will use first profile.
private String host; // 92.168.xx.yy, or http://host[:port]
private String user; // admin
private String password; // secret
private String profile; // "MediaProfile000" If empty, will use first profile.
public OnvifCredentials(String host, String user, String password, String profile) {
this.host = host;
this.user = user;
this.password = password;
this.profile = profile;
}
public OnvifCredentials(String host, String user, String password, String profile) {
this.host = host;
this.user = user;
this.password = password;
this.profile = profile;
}
public String getHost() {
return host;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public void setHost(String host) {
this.host = host;
}
public String getUser() {
return user;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password) {
this.password = password;
}
public String getProfile() {
return profile;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public String toString() {
return host; // + "," + user+ "," + "****,"++ "#" + profile;
}
public String toString() {
return host; // + "," + user+ "," + "****,"++ "#" + profile;
}
public String details() {
return host + "," + user + "," + password + "," + profile;
}
public String details() {
return host + "," + user + "," + password + "," + profile;
}
}

View File

@@ -1,90 +1,96 @@
package org.onvif.client;
import de.onvif.soap.OnvifDevice;
import org.onvif.ver10.schema.Profile;
import javax.xml.soap.SOAPException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.util.List;
import javax.xml.soap.SOAPException;
import org.onvif.ver10.schema.Profile;
public class ReadCommandsFromStdInput {
private static final String INFO = "Commands:\n \n url: Get snapshort URL.\n info: Get information about each valid command.\n profiles: Get all profiles.\n inspect: Get device details.\n exit: Exit this application.";
private static final String INFO =
"Commands:\n \n url: Get snapshort URL.\n info: Get information about each valid command.\n profiles: Get all profiles.\n inspect: Get device details.\n exit: Exit this application.";
public static void main(String args[]) {
InputStreamReader inputStream = new InputStreamReader(System.in);
BufferedReader keyboardInput = new BufferedReader(inputStream);
String input, cameraAddress, user, password;
public static void main(String[] args) {
InputStreamReader inputStream = new InputStreamReader(System.in);
BufferedReader keyboardInput = new BufferedReader(inputStream);
String input, cameraAddress, user, password;
try {
System.out.println("Please enter camera IP (with port if not 80):");
cameraAddress = keyboardInput.readLine();
System.out.println("Please enter camera username:");
user = keyboardInput.readLine();
System.out.println("Please enter camera password:");
password = keyboardInput.readLine();
if (cameraAddress==null||user==null||password==null) throw new IOException("No input");
} catch (IOException e1) {
e1.printStackTrace();
return;
}
try {
System.out.println("Please enter camera IP (with port if not 80):");
cameraAddress = keyboardInput.readLine();
System.out.println("Please enter camera username:");
user = keyboardInput.readLine();
System.out.println("Please enter camera password:");
password = keyboardInput.readLine();
if (cameraAddress == null || user == null || password == null)
throw new IOException("No input");
} catch (IOException e1) {
e1.printStackTrace();
return;
}
System.out.println("Connect to camera, please wait ...");
OnvifDevice cam;
try {
cam = new OnvifDevice(cameraAddress, user, password);
} catch (MalformedURLException | ConnectException | SOAPException e1) {
System.err.println("No connection to camera, please try again.");
return;
}
System.out.println("Connect to camera, please wait ...");
OnvifDevice cam;
try {
cam = new OnvifDevice(cameraAddress, user, password);
} catch (MalformedURLException | ConnectException | SOAPException e1) {
System.err.println("No connection to camera, please try again.");
return;
}
System.out.println("Connection to camera successful!");
System.out.println("Connection to camera successful!");
while (true) {
try {
System.out.println();
System.out.println("Enter a command (type \"info\" to get commands):");
input = keyboardInput.readLine();
if (input==null) break;
switch (input) {
case "url": {
List<Profile> profiles = cam.getMedia().getProfiles();
for (Profile p : profiles) {
System.out.println("URL from Profile \'" + p.getName() + "\': " + cam.getMedia().getSnapshotUri(p.getToken()));
}
break;
}
case "profiles":
List<Profile> profiles = cam.getMedia().getProfiles();
System.out.println("Number of profiles: " + profiles.size());
for (Profile p : profiles) {
System.out.println(" Profile " + p.getName() + " token is: " + p.getToken());
}
break;
case "info":
System.out.println(INFO);
break;
case "inspect":
System.out.println(TestDevice.inspect(cam));
break;
while (true) {
try {
System.out.println();
System.out.println("Enter a command (type \"info\" to get commands):");
input = keyboardInput.readLine();
if (input == null) break;
switch (input) {
case "url":
{
List<Profile> profiles = cam.getMedia().getProfiles();
for (Profile p : profiles) {
System.out.println(
"URL from Profile \'"
+ p.getName()
+ "\': "
+ cam.getMedia().getSnapshotUri(p.getToken()));
}
break;
}
case "profiles":
List<Profile> profiles = cam.getMedia().getProfiles();
System.out.println("Number of profiles: " + profiles.size());
for (Profile p : profiles) {
System.out.println(" Profile " + p.getName() + " token is: " + p.getToken());
}
break;
case "info":
System.out.println(INFO);
break;
case "inspect":
System.out.println(TestDevice.inspect(cam));
break;
case "quit":
case "exit":
case "end":
return;
default:
System.out.println("Unknown command!");
System.out.println();
System.out.println(INFO);
break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
case "quit":
case "exit":
case "end":
return;
default:
System.out.println("Unknown command!");
System.out.println();
System.out.println(INFO);
break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -1,72 +1,56 @@
package org.onvif.client;
import de.onvif.soap.OnvifDevice;
import de.onvif.utils.OnvifUtils;
import org.apache.commons.io.FileUtils;
import org.onvif.ver10.media.wsdl.Media;
import org.onvif.ver10.schema.*;
import org.onvif.ver20.ptz.wsdl.PTZ;
import javax.xml.soap.SOAPException;
import java.io.File;
import java.io.FileInputStream;
import java.lang.Object;
import java.net.ConnectException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
public class SimpleTest {
// This test reads connection params from a properties file and take a
// screenshot
public static void main(String[] args) throws Exception {
// This test reads connection params from a properties file and take a
// screenshot
public static void main(String[] args) throws Exception {
final Map<String, OnvifDevice> onvifCameras = new HashMap<>();
final Map<String, OnvifCredentials> credentialsMap = new HashMap<>();
final String propFileRelativePath = "src/test/resources/onvif.properties";
final Properties config = new Properties();
final File f = new File(propFileRelativePath);
if (!f.exists()) throw new Exception("fnf: " + f.getAbsolutePath());
config.load(new FileInputStream(f));
final Map<String, OnvifDevice> onvifCameras = new HashMap<>();
final Map<String, OnvifCredentials> credentialsMap = new HashMap<>();
final String propFileRelativePath = "src/test/resources/onvif.properties";
final Properties config = new Properties();
final File f = new File(propFileRelativePath);
if (!f.exists()) throw new Exception("fnf: " + f.getAbsolutePath());
config.load(new FileInputStream(f));
for (Object k : config.keySet()) {
String line = config.get(k.toString()).toString();
OnvifCredentials credentials = GetTestDevice.parse(line);
if (credentials != null) {
try {
System.out.println("Connect to camera, please wait ...");
OnvifDevice cam =
new OnvifDevice(
credentials.getHost(), credentials.getUser(), credentials.getPassword());
System.out.printf("Connected to device %s (%s)%n", cam.getDeviceInfo(), k.toString());
System.out.println(TestDevice.inspect(cam));
for (Object k:config.keySet())
{
String line = config.get(k.toString()).toString();
OnvifCredentials credentials = GetTestDevice.parse(line);
if (credentials!=null)
{
try {
System.out.println("Connect to camera, please wait ...");
OnvifDevice cam = new OnvifDevice(credentials.getHost(), credentials.getUser(), credentials.getPassword());
System.out.printf("Connected to device %s (%s)%n", cam.getDeviceInfo(), k.toString());
System.out.println(TestDevice.inspect(cam));
String snapshotUri = cam.getSnapshotUri();
if (!snapshotUri.isEmpty()) {
File tempFile = File.createTempFile("tmp", ".jpg");
String snapshotUri = cam.getSnapshotUri();
if (!snapshotUri.isEmpty()) {
File tempFile = File.createTempFile("tmp", ".jpg");
// Note: This will likely fail if the camera/device is password protected.
// embedding the user:password@ into the URL will not work with FileUtils.copyURLToFile
FileUtils.copyURLToFile(new URL(snapshotUri), tempFile);
System.out.println(
"snapshot: " + tempFile.getAbsolutePath() + " length:" + tempFile.length());
}
// Note: This will likely fail if the camera/device is password protected.
// embedding the user:password@ into the URL will not work with FileUtils.copyURLToFile
FileUtils.copyURLToFile(new URL(snapshotUri), tempFile);
System.out.println("snapshot: " + tempFile.getAbsolutePath() + " length:" + tempFile.length());
}
}catch(Throwable th)
{
System.err.println("Error on device: "+k);
th.printStackTrace();
}
}
}
}
}
} catch (Throwable th) {
System.err.println("Error on device: " + k);
th.printStackTrace();
}
}
}
}
}

View File

@@ -3,176 +3,194 @@ package org.onvif.client;
import de.onvif.beans.DeviceInfo;
import de.onvif.soap.OnvifDevice;
import de.onvif.utils.OnvifUtils;
import org.apache.cxf.common.logging.LogUtils;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import javax.xml.soap.SOAPException;
import org.onvif.ver10.device.wsdl.DeviceServiceCapabilities;
import org.onvif.ver10.events.wsdl.EventPortType;
import org.onvif.ver10.events.wsdl.GetEventProperties;
import org.onvif.ver10.events.wsdl.GetEventPropertiesResponse;
import org.onvif.ver10.media.wsdl.Media;
import org.onvif.ver10.schema.*;
import org.onvif.ver10.schema.AudioSource;
import org.onvif.ver10.schema.PTZPreset;
import org.onvif.ver10.schema.PTZStatus;
import org.onvif.ver10.schema.Profile;
import org.onvif.ver10.schema.VideoSource;
import org.onvif.ver20.imaging.wsdl.ImagingPort;
import org.onvif.ver20.ptz.wsdl.Capabilities;
import org.onvif.ver20.ptz.wsdl.PTZ;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.soap.SOAPException;
import java.io.IOException;
import java.lang.Object;
import java.net.URL;
import java.util.List;
import java.util.logging.Logger;
/**
* @author Brad Lowe
*/
/** @author Brad Lowe */
public class TestDevice {
private static final Logger LOG = LogUtils.getL7dLogger(TestDevice.class);
private static final Logger LOG = LoggerFactory.getLogger(TestDevice.class);
public static String testCamera(OnvifCredentials creds) throws SOAPException, IOException {
URL u = creds.getHost().startsWith("http") ? new URL(creds.getHost()) : new URL("http://" + creds.getHost());
return testCamera(u, creds.getUser(), creds.getPassword());
}
public static String testCamera(OnvifCredentials creds) throws SOAPException, IOException {
URL u =
creds.getHost().startsWith("http")
? new URL(creds.getHost())
: new URL("http://" + creds.getHost());
return testCamera(u, creds.getUser(), creds.getPassword());
}
static String sep = "\n";
static String sep = "\n";
// This method returns information about an initialized OnvifDevice.
// This could throw an uncaught SOAP or other error on some cameras...
// Would accept Pull Requests on printing out additional information about devices.
public static String inspect(OnvifDevice device) {
String out = "";
DeviceInfo info = device.getDeviceInfo();
out += "DeviceInfo:" +sep + "\t" + info + sep;
DeviceServiceCapabilities caps = device.getDevice().getServiceCapabilities();
out += "\tgetServiceCapabilities: " + OnvifUtils.format(caps) + sep;
out += "\tgetServiceCapabilities.getSystem: " + OnvifUtils.format(caps.getSystem()) + sep;
// This method returns information about an initialized OnvifDevice.
// This could throw an uncaught SOAP or other error on some cameras...
// Would accept Pull Requests on printing out additional information about devices.
public static String inspect(OnvifDevice device) {
String out = "";
DeviceInfo info = device.getDeviceInfo();
out += "DeviceInfo:" + sep + "\t" + info + sep;
DeviceServiceCapabilities caps = device.getDevice().getServiceCapabilities();
String sysCaps = OnvifUtils.format(caps);
sysCaps = sysCaps.replace("],", "],\t\n");
out += "\tgetServiceCapabilities: " + sysCaps + sep;
// out += "\tgetServiceCapabilities.getSystem: " + OnvifUtils.format(caps.getSystem()) + sep;
Media media = device.getMedia();
media.getVideoSources();
List<Profile> profiles = media.getProfiles();
out += "Media Profiles: " + profiles.size() + sep;
for (Profile profile : profiles) {
String profileToken = profile.getToken();
String rtsp = device.getRTSPUri(profileToken);
out += "\tProfile: " + profile.getName() + " token=" + profile.getToken() + sep;
out += "\t\trtsp: " + rtsp + sep;
out += "\t\tsnapshot: " + device.getSnapshotUri(profileToken) + sep;
out += "\t\tdetails:" + OnvifUtils.format(profile) + sep;
}
Media media = device.getMedia();
List<VideoSource> videoSources = media.getVideoSources();
out += "VideoSources: " + videoSources.size() + sep;
for (VideoSource v : videoSources)
out += "\t" + OnvifUtils.format(v) + sep;
media.getVideoSources();
List<Profile> profiles = media.getProfiles();
out += "Media Profiles: " + profiles.size() + sep;
for (Profile profile : profiles) {
String profileToken = profile.getToken();
String rtsp = device.getStreamUri(profileToken);
out += "\tProfile: " + profile.getName() + " token=" + profile.getToken() + sep;
out += "\t\tstream: " + rtsp + sep;
out += "\t\tsnapshot: " + device.getSnapshotUri(profileToken) + sep;
out += "\t\tdetails:" + OnvifUtils.format(profile) + sep;
}
List<AudioSource> audioSources = media.getAudioSources();
out += "AudioSources: " + audioSources.size() + sep;
for (AudioSource a : audioSources)
out += "\t" + OnvifUtils.format(a) + sep;
try {
List<VideoSource> videoSources = media.getVideoSources();
out += "VideoSources: " + videoSources.size() + sep;
for (VideoSource v : videoSources) out += "\t" + OnvifUtils.format(v) + sep;
ImagingPort imaging = device.getImaging();
if (imaging != null && videoSources.size() > 0) {
String token = videoSources.get(0).getToken();
ImagingPort imaging = device.getImaging();
if (imaging != null && videoSources.size() > 0) {
String token = videoSources.get(0).getToken();
out += "Imaging:" + token + sep;
try {
org.onvif.ver20.imaging.wsdl.Capabilities image_caps = imaging.getServiceCapabilities();
out += "\tgetServiceCapabilities=" + OnvifUtils.format(image_caps) + sep;
out += "Imaging:" + token + sep;
try {
org.onvif.ver20.imaging.wsdl.Capabilities image_caps = imaging.getServiceCapabilities();
out += "\tgetServiceCapabilities=" + OnvifUtils.format(image_caps) + sep;
if (token != null) {
out +=
"\tgetImagingSettings="
+ OnvifUtils.format(imaging.getImagingSettings(token))
+ sep;
out += "\tgetMoveOptions=" + OnvifUtils.format(imaging.getMoveOptions(token)) + sep;
out += "\tgetStatus=" + OnvifUtils.format(imaging.getStatus(token)) + sep;
out += "\tgetOptions=" + OnvifUtils.format(imaging.getOptions(token)) + sep;
}
} catch (Throwable th) {
out += "Imaging unavailable:" + th.getMessage() + sep;
}
}
} catch (Throwable th) {
// this can fail if the device doesn't support video sources.
out += "VideoSources: " + th.getMessage() + sep;
}
try {
// This may throw a SoapFaultException with the message "This device does not support audio"
List<AudioSource> audioSources = media.getAudioSources();
out += "AudioSources: " + audioSources.size() + sep;
for (AudioSource a : audioSources) out += "\t" + OnvifUtils.format(a) + sep;
} catch (Throwable th) {
out += "AudioSources Unavailable: " + th.getMessage() + sep;
}
if (token != null) {
out += "\tgetImagingSettings=" + OnvifUtils.format(imaging.getImagingSettings(token)) + sep;
out += "\tgetMoveOptions=" + OnvifUtils.format(imaging.getMoveOptions(token)) + sep;
out += "\tgetStatus=" + OnvifUtils.format(imaging.getStatus(token)) + sep;
out += "\tgetOptions=" + OnvifUtils.format(imaging.getOptions(token)) + sep;
}
} catch (Throwable th) {
out += "error=" + th.getMessage() + sep;
}
}
try {
EventPortType events = device.getEvents();
if (events != null) {
out += "Events:" + sep;
out +=
"\tgetServiceCapabilities=" + OnvifUtils.format(events.getServiceCapabilities()) + sep;
GetEventProperties getEventProperties = new GetEventProperties();
GetEventPropertiesResponse getEventPropertiesResp =
events.getEventProperties(getEventProperties);
out += "\tMessageContentFilterDialects:" + sep;
for (String f : getEventPropertiesResp.getMessageContentFilterDialect())
out += ("\t\t" + f + sep);
out += "\tTopicExpressionDialects:" + sep;
for (String f : getEventPropertiesResp.getTopicExpressionDialect())
out += ("\t\t" + f + sep);
EventPortType events = device.getEvents();
if (events != null) {
out += "Events:" + sep;
out += "\tgetServiceCapabilities=" + OnvifUtils.format(events.getServiceCapabilities()) + sep;
out += "\tTopics:" + sep;
StringBuffer tree = new StringBuffer();
for (Object object : getEventPropertiesResp.getTopicSet().getAny()) {
Element e = (Element) object;
printTree(e, e.getNodeName(), tree);
// WsNotificationTest.printTree(e, e.getNodeName());
}
out += tree;
}
} catch (Throwable th) {
out += "Events Unavailable: " + th.getMessage() + sep;
}
PTZ ptz = device.getPtz();
if (ptz != null) {
String profileToken = profiles.get(0).getToken();
try {
Capabilities ptz_caps = ptz.getServiceCapabilities();
out += "PTZ:" + sep;
out += "\tgetServiceCapabilities=" + OnvifUtils.format(ptz_caps) + sep;
PTZStatus s = ptz.getStatus(profileToken);
out += "\tgetStatus=" + OnvifUtils.format(s) + sep;
// out += "ptz.getConfiguration=" + ptz.getConfiguration(profileToken) + sep;
List<PTZPreset> presets = ptz.getPresets(profileToken);
if (presets != null && !presets.isEmpty()) {
out += "\tPresets:" + presets.size() + sep;
for (PTZPreset p : presets) out += "\t\t" + OnvifUtils.format(p) + sep;
}
} catch (Throwable th) {
out += "PTZ: Unavailable" + th.getMessage() + sep;
}
}
GetEventProperties getEventProperties = new GetEventProperties();
GetEventPropertiesResponse getEventPropertiesResp = events.getEventProperties(getEventProperties);
out += "\tMessageContentFilterDialects:" + sep;
for (String f : getEventPropertiesResp.getMessageContentFilterDialect())
out += ("\t\t" + f + sep);
out += "\tTopicExpressionDialects:" + sep;
for (String f : getEventPropertiesResp.getTopicExpressionDialect())
out += ("\t\t" + f + sep);
return out;
}
out += "\tTopics:" + sep;
StringBuffer tree = new StringBuffer();
for (Object object : getEventPropertiesResp.getTopicSet().getAny()) {
Element e = (Element) object;
printTree(e, e.getNodeName(), tree);
// WsNotificationTest.printTree(e, e.getNodeName());
}
out += tree;
public static void printTree(Node node, String name, StringBuffer buffer) {
}
if (node.hasChildNodes()) {
NodeList nodes = node.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
printTree(n, name + " - " + n.getNodeName(), buffer);
}
} else {
buffer.append("\t\t" + name + " - " + node.getNodeName() + "\n");
}
}
public static String testCamera(URL url, String user, String password)
throws SOAPException, IOException {
LOG.info("Testing camera:" + url);
OnvifDevice device = new OnvifDevice(url, user, password);
return inspect(device);
}
PTZ ptz = device.getPtz();
if (ptz != null) {
out += "PTZ:" + sep;
String profileToken = profiles.get(0).getToken();
Capabilities ptz_caps = ptz.getServiceCapabilities();
out += "\tgetServiceCapabilities=" + OnvifUtils.format(ptz_caps) + sep;
PTZStatus s = ptz.getStatus(profileToken);
out += "\tgetStatus=" + OnvifUtils.format(s) + sep;
// out += "ptz.getConfiguration=" + ptz.getConfiguration(profileToken) + sep;
List<PTZPreset> presets = ptz.getPresets(profileToken);
if (presets != null && !presets.isEmpty()) {
out += "\tPresets:" + presets.size() + sep;
for (PTZPreset p : presets)
out += "\t\t" + OnvifUtils.format(p) + sep;
}
}
return out;
}
public static void printTree(Node node, String name, StringBuffer buffer) {
if (node.hasChildNodes()) {
NodeList nodes = node.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
printTree(n, name + " - " + n.getNodeName(), buffer);
}
} else {
buffer.append("\t\t"+ name + " - " + node.getNodeName() + "\n");
}
}
public static String testCamera(URL url, String user, String password) throws SOAPException, IOException {
OnvifDevice device = new OnvifDevice(url, user, password);
return inspect(device);
}
public static void main(String[] args) {
try {
OnvifCredentials creds = GetTestDevice.getOnvifCredentials(args);
String out = testCamera(creds);
LOG.info("\n" + out + "\n");
} catch (Throwable th) {
LOG.warning("Error "+th);
th.printStackTrace();
}
}
public static void main(String[] args) {
OnvifCredentials creds = GetTestDevice.getOnvifCredentials(args);
try {
// OnvifDevice.setVerbose(true);
String out = testCamera(creds);
LOG.info("\n" + out + "\n");
} catch (Throwable th) {
LOG.error("Failed for " + creds, th);
th.printStackTrace();
}
}
}

View File

@@ -1,6 +1,15 @@
package org.onvif.client;
import de.onvif.soap.OnvifDevice;
import java.io.File;
import java.io.IOException;
import java.net.ConnectException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import javax.xml.bind.JAXBElement;
import javax.xml.soap.SOAPException;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.commons.io.FileUtils;
import org.apache.cxf.wsn.client.Consumer;
@@ -11,10 +20,24 @@ import org.apache.cxf.wsn.services.JaxwsNotificationBroker;
import org.oasis_open.docs.wsn.b_2.FilterType;
import org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType;
import org.oasis_open.docs.wsn.b_2.TopicExpressionType;
import org.oasis_open.docs.wsn.bw_2.*;
import org.oasis_open.docs.wsn.bw_2.InvalidFilterFault;
import org.oasis_open.docs.wsn.bw_2.InvalidMessageContentExpressionFault;
import org.oasis_open.docs.wsn.bw_2.InvalidProducerPropertiesExpressionFault;
import org.oasis_open.docs.wsn.bw_2.InvalidTopicExpressionFault;
import org.oasis_open.docs.wsn.bw_2.NotifyMessageNotSupportedFault;
import org.oasis_open.docs.wsn.bw_2.SubscribeCreationFailedFault;
import org.oasis_open.docs.wsn.bw_2.TopicExpressionDialectUnknownFault;
import org.oasis_open.docs.wsn.bw_2.TopicNotSupportedFault;
import org.oasis_open.docs.wsn.bw_2.UnacceptableInitialTerminationTimeFault;
import org.oasis_open.docs.wsn.bw_2.UnrecognizedPolicyRequestFault;
import org.oasis_open.docs.wsn.bw_2.UnsupportedPolicyRequestFault;
import org.oasis_open.docs.wsrf.rw_2.ResourceUnknownFault;
import org.onvif.ver10.events.wsdl.*;
import org.onvif.ver10.events.wsdl.CreatePullPointSubscription;
import org.onvif.ver10.events.wsdl.CreatePullPointSubscription.SubscriptionPolicy;
import org.onvif.ver10.events.wsdl.CreatePullPointSubscriptionResponse;
import org.onvif.ver10.events.wsdl.EventPortType;
import org.onvif.ver10.events.wsdl.GetEventProperties;
import org.onvif.ver10.events.wsdl.GetEventPropertiesResponse;
import org.onvif.ver10.schema.Capabilities;
import org.onvif.ver10.schema.CapabilityCategory;
import org.onvif.ver10.schema.MediaUri;
@@ -23,220 +46,226 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.bind.JAXBElement;
import javax.xml.soap.SOAPException;
import java.io.File;
import java.io.IOException;
import java.net.ConnectException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
public class WsNotificationTest {
// This is a work in progress class...any help is welcome ;)
// A good idea could be to follow this guide:
// https://access.redhat.com/documentation/en-us/red_hat_jboss_a-mq/6.1/html-single/ws-notification_guide/index#WSNTutorial
// This is a work in progress class...any help is welcome ;)
// A good idea could be to follow this guide:
// https://access.redhat.com/documentation/en-us/red_hat_jboss_a-mq/6.1/html-single/ws-notification_guide/index#WSNTutorial
public static void main(String args[]) throws IOException {
OnvifCredentials creds = GetTestDevice.getOnvifCredentials(args);
System.out.println("Connect to camera, please wait ...");
public static void main(String[] args) throws IOException {
OnvifCredentials creds = GetTestDevice.getOnvifCredentials(args);
System.out.println("Connect to camera, please wait ...");
OnvifDevice cam = null;
try {
cam = new OnvifDevice(creds.getHost(), creds.getUser(), creds.getPassword());
} catch (ConnectException | SOAPException e1) {
System.err.println("No connection to device with ip " + creds + ", please try again.");
System.exit(0);
}
System.out.println("Connected to device " + cam.getDeviceInfo());
OnvifDevice cam = null;
try {
cam = new OnvifDevice(creds.getHost(), creds.getUser(), creds.getPassword());
} catch (ConnectException | SOAPException e1) {
System.err.println("No connection to device with ip " + creds + ", please try again.");
System.exit(0);
}
System.out.println("Connected to device " + cam.getDeviceInfo());
// get device capabilities
Capabilities cap = cam.getDevice().getCapabilities(Arrays.asList(CapabilityCategory.ALL));
System.out.println(cap.getDevice().toString());
// print profiles
printProfiles(cam);
// takeScreenShot(profileToken, cam);
// presets
// List<PTZPreset> presets = cam.getPtz().getPresets(profileToken);
// presets.forEach(x->System.out.println(x.getName()));
// get device capabilities
Capabilities cap = cam.getDevice().getCapabilities(Arrays.asList(CapabilityCategory.ALL));
System.out.println(cap.getDevice().toString());
// print profiles
printProfiles(cam);
// takeScreenShot(profileToken, cam);
// presets
// List<PTZPreset> presets = cam.getPtz().getPresets(profileToken);
// presets.forEach(x->System.out.println(x.getName()));
EventPortType eventWs = cam.getEvents();
GetEventProperties getEventProperties = new GetEventProperties();
GetEventPropertiesResponse getEventPropertiesResp = eventWs.getEventProperties(getEventProperties);
getEventPropertiesResp.getMessageContentFilterDialect().forEach(x -> System.out.println(x));
getEventPropertiesResp.getTopicExpressionDialect().forEach(x -> System.out.println(x));
for (Object object : getEventPropertiesResp.getTopicSet().getAny()) {
Element e = (Element) object;
printTree(e, e.getNodeName());
}
EventPortType eventWs = cam.getEvents();
GetEventProperties getEventProperties = new GetEventProperties();
GetEventPropertiesResponse getEventPropertiesResp =
eventWs.getEventProperties(getEventProperties);
getEventPropertiesResp.getMessageContentFilterDialect().forEach(x -> System.out.println(x));
getEventPropertiesResp.getTopicExpressionDialect().forEach(x -> System.out.println(x));
for (Object object : getEventPropertiesResp.getTopicSet().getAny()) {
Element e = (Element) object;
printTree(e, e.getNodeName());
}
org.oasis_open.docs.wsn.b_2.ObjectFactory objectFactory = new org.oasis_open.docs.wsn.b_2.ObjectFactory();
CreatePullPointSubscription pullPointSubscription = new CreatePullPointSubscription();
FilterType filter = new FilterType();
TopicExpressionType topicExp = new TopicExpressionType();
topicExp.getContent().add("tns1:RuleEngine//.");// every event in that
// topic
topicExp.setDialect("http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet");
JAXBElement<?> topicExpElem = objectFactory.createTopicExpression(topicExp);
filter.getAny().add(topicExpElem);
pullPointSubscription.setFilter(filter);
org.onvif.ver10.events.wsdl.ObjectFactory eventObjFactory = new org.onvif.ver10.events.wsdl.ObjectFactory();
SubscriptionPolicy subcriptionPolicy = eventObjFactory.createCreatePullPointSubscriptionSubscriptionPolicy();
pullPointSubscription.setSubscriptionPolicy(subcriptionPolicy);
String timespan = "PT10S";// every 10 seconds
// String timespan = "PT1M";//every 1 minute
pullPointSubscription.setInitialTerminationTime(objectFactory.createSubscribeInitialTerminationTime(timespan));
org.oasis_open.docs.wsn.b_2.ObjectFactory objectFactory =
new org.oasis_open.docs.wsn.b_2.ObjectFactory();
CreatePullPointSubscription pullPointSubscription = new CreatePullPointSubscription();
FilterType filter = new FilterType();
TopicExpressionType topicExp = new TopicExpressionType();
topicExp.getContent().add("tns1:RuleEngine//."); // every event in that
// topic
topicExp.setDialect("http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet");
JAXBElement<?> topicExpElem = objectFactory.createTopicExpression(topicExp);
filter.getAny().add(topicExpElem);
pullPointSubscription.setFilter(filter);
org.onvif.ver10.events.wsdl.ObjectFactory eventObjFactory =
new org.onvif.ver10.events.wsdl.ObjectFactory();
SubscriptionPolicy subcriptionPolicy =
eventObjFactory.createCreatePullPointSubscriptionSubscriptionPolicy();
pullPointSubscription.setSubscriptionPolicy(subcriptionPolicy);
String timespan = "PT10S"; // every 10 seconds
// String timespan = "PT1M";//every 1 minute
pullPointSubscription.setInitialTerminationTime(
objectFactory.createSubscribeInitialTerminationTime(timespan));
try {
CreatePullPointSubscriptionResponse resp = eventWs.createPullPointSubscription(pullPointSubscription);
try {
CreatePullPointSubscriptionResponse resp =
eventWs.createPullPointSubscription(pullPointSubscription);
// Start a consumer that will listen for notification messages
// We'll just print the text content out for now.
String eventConsumerAddress = "http://localhost:9001/MyConsumer";
Consumer consumer = new Consumer(new Consumer.Callback() {
public void notify(NotificationMessageHolderType message) {
Object o = message.getMessage().getAny();
System.out.println(message.getMessage().getAny());
if (o instanceof Element) {
System.out.println(((Element) o).getTextContent());
}
}
}, eventConsumerAddress);
// Start a consumer that will listen for notification messages
// We'll just print the text content out for now.
String eventConsumerAddress = "http://localhost:9001/MyConsumer";
Consumer consumer =
new Consumer(
new Consumer.Callback() {
public void notify(NotificationMessageHolderType message) {
Object o = message.getMessage().getAny();
System.out.println(message.getMessage().getAny());
if (o instanceof Element) {
System.out.println(((Element) o).getTextContent());
}
}
},
eventConsumerAddress);
String queuePort = "8182";
String brokerPort = "8181";
String brokerAddress = "http://localhost:" + brokerPort + "/wsn/NotificationBroker";
ActiveMQConnectionFactory activemq = new ActiveMQConnectionFactory(
"vm:(broker:(tcp://localhost:" + queuePort + ")?persistent=false)");
JaxwsNotificationBroker notificationBrokerServer = new JaxwsNotificationBroker("WSNotificationBroker",
activemq);
notificationBrokerServer.setAddress(brokerAddress);
notificationBrokerServer.init();
String queuePort = "8182";
String brokerPort = "8181";
String brokerAddress = "http://localhost:" + brokerPort + "/wsn/NotificationBroker";
ActiveMQConnectionFactory activemq =
new ActiveMQConnectionFactory(
"vm:(broker:(tcp://localhost:" + queuePort + ")?persistent=false)");
JaxwsNotificationBroker notificationBrokerServer =
new JaxwsNotificationBroker("WSNotificationBroker", activemq);
notificationBrokerServer.setAddress(brokerAddress);
notificationBrokerServer.init();
// Create a subscription for a Topic on the broker
NotificationBroker notificationBroker = new NotificationBroker(brokerAddress);
// PublisherCallback publisherCallback = new PublisherCallback();
// Publisher publisher = new Publisher(publisherCallback,
// "http://localhost:" + port2 + "/test/publisher");
Subscription subscription = notificationBroker.subscribe(consumer, "tns1:RuleEngine");
// Create a subscription for a Topic on the broker
NotificationBroker notificationBroker = new NotificationBroker(brokerAddress);
// PublisherCallback publisherCallback = new PublisherCallback();
// Publisher publisher = new Publisher(publisherCallback,
// "http://localhost:" + port2 + "/test/publisher");
Subscription subscription = notificationBroker.subscribe(consumer, "tns1:RuleEngine");
// Device
// Trigger/Relay
// OperationMode/ShutdownInitiated
// OperationMode/UploadInitiated
// HardwareFailure/FanFailure
// HardwareFailure/PowerSupplyFailure
// HardwareFailure/StorageFailure
// HardwareFailure/TemperatureCritical
// VideoSource
// tns1:VideoSource/CameraRedirected
// tns1:VideoSource/SignalLoss
// tns1:VideoSource/MotionAlarm
// VideoEncoder
// VideoAnalytics
// RuleEngine
// LineDetector/Crossed
// FieldDetector/ObjectsInside
// PTZController
// PTZPresets/Invoked
// PTZPresets/Reached
// PTZPresets/Aborted
// PTZPresets/Left
// AudioSource
// AudioEncoder
// UserAlarm
// MediaControl
// RecordingConfig
// RecordingHistory
// VideoOutput
// AudioOutput
// VideoDecoder
// AudioDecoder
// Receiver
// MediaConfiguration
// VideoSourceConfiguration
// AudioSourceConfiguration
// VideoEncoderConfiguration
// AudioEncoderConfiguration
// VideoAnalyticsConfiguration
// PTZConfiguration
// MetaDataConfiguration
// Device
// Trigger/Relay
// OperationMode/ShutdownInitiated
// OperationMode/UploadInitiated
// HardwareFailure/FanFailure
// HardwareFailure/PowerSupplyFailure
// HardwareFailure/StorageFailure
// HardwareFailure/TemperatureCritical
// VideoSource
// tns1:VideoSource/CameraRedirected
// tns1:VideoSource/SignalLoss
// tns1:VideoSource/MotionAlarm
// VideoEncoder
// VideoAnalytics
// RuleEngine
// LineDetector/Crossed
// FieldDetector/ObjectsInside
// PTZController
// PTZPresets/Invoked
// PTZPresets/Reached
// PTZPresets/Aborted
// PTZPresets/Left
// AudioSource
// AudioEncoder
// UserAlarm
// MediaControl
// RecordingConfig
// RecordingHistory
// VideoOutput
// AudioOutput
// VideoDecoder
// AudioDecoder
// Receiver
// MediaConfiguration
// VideoSourceConfiguration
// AudioSourceConfiguration
// VideoEncoderConfiguration
// AudioEncoderConfiguration
// VideoAnalyticsConfiguration
// PTZConfiguration
// MetaDataConfiguration
// Wait for some messages to accumulate in the pull point
Thread.sleep(50_000);
// Wait for some messages to accumulate in the pull point
Thread.sleep(50_000);
// Cleanup and exit
subscription.unsubscribe();
consumer.stop();
// Cleanup and exit
subscription.unsubscribe();
consumer.stop();
} catch (TopicNotSupportedFault | TopicExpressionDialectUnknownFault | InvalidTopicExpressionFault
| InvalidMessageContentExpressionFault | InvalidProducerPropertiesExpressionFault
| UnacceptableInitialTerminationTimeFault | NotifyMessageNotSupportedFault | ResourceUnknownFault
| UnsupportedPolicyRequestFault | InvalidFilterFault | SubscribeCreationFailedFault
| UnrecognizedPolicyRequestFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (TopicNotSupportedFault
| TopicExpressionDialectUnknownFault
| InvalidTopicExpressionFault
| InvalidMessageContentExpressionFault
| InvalidProducerPropertiesExpressionFault
| UnacceptableInitialTerminationTimeFault
| NotifyMessageNotSupportedFault
| ResourceUnknownFault
| UnsupportedPolicyRequestFault
| InvalidFilterFault
| SubscribeCreationFailedFault
| UnrecognizedPolicyRequestFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void printTree(Node node, String name) {
if (node.hasChildNodes()) {
NodeList nodes = node.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
printTree(n, name + " - " + n.getNodeName());
}
} else System.out.println(name + " - " + node.getNodeName());
}
public static void printTree(Node node, String name) {
if (node.hasChildNodes()) {
NodeList nodes = node.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
printTree(n, name + " - " + n.getNodeName());
}
} else
System.out.println(name + " - " + node.getNodeName());
}
private static void takeScreenShot(String profileToken, OnvifDevice cam) {
try {
MediaUri sceenshotUri = cam.getMedia().getSnapshotUri(profileToken);
File tempFile = File.createTempFile("bosc", ".jpg");
// tempFile.deleteOnExit();
FileUtils.copyURLToFile(new URL(sceenshotUri.getUri()), tempFile);
Runtime.getRuntime().exec("nautilus " + tempFile.getAbsolutePath());
Thread.sleep(10000);
} catch (ConnectException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void takeScreenShot(String profileToken, OnvifDevice cam) {
try {
MediaUri sceenshotUri = cam.getMedia().getSnapshotUri(profileToken);
File tempFile = File.createTempFile("bosc", ".jpg");
// tempFile.deleteOnExit();
FileUtils.copyURLToFile(new URL(sceenshotUri.getUri()), tempFile);
Runtime.getRuntime().exec("nautilus " + tempFile.getAbsolutePath());
Thread.sleep(10000);
} catch (ConnectException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void printProfiles(OnvifDevice cam) {
private static void printProfiles(OnvifDevice cam) {
List<Profile> profiles = cam.getMedia().getProfiles();
for (Profile p : profiles) {
System.out.printf(
"Profile: [token=%s,name=%s,snapshotUri=%s]%n",
p.getToken(), p.getName(), cam.getMedia().getSnapshotUri(p.getToken()).getUri());
}
}
List<Profile> profiles = cam.getMedia().getProfiles();
for (Profile p : profiles) {
System.out.printf("Profile: [token=%s,name=%s,snapshotUri=%s]%n", p.getToken(), p.getName(),
cam.getMedia().getSnapshotUri(p.getToken()).getUri());
}
}
public static class PublisherCallback implements Publisher.Callback {
final CountDownLatch subscribed = new CountDownLatch(1);
final CountDownLatch unsubscribed = new CountDownLatch(1);
public static class PublisherCallback implements Publisher.Callback {
final CountDownLatch subscribed = new CountDownLatch(1);
final CountDownLatch unsubscribed = new CountDownLatch(1);
public void subscribe(TopicExpressionType topic) {
subscribed.countDown();
}
public void subscribe(TopicExpressionType topic) {
subscribed.countDown();
}
public void unsubscribe(TopicExpressionType topic) {
unsubscribed.countDown();
}
}
}
public void unsubscribe(TopicExpressionType topic) {
unsubscribed.countDown();
}
}
}

View File

@@ -1,189 +1,189 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>onvif-ws-client</artifactId>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>onvif-ws-client</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf</groupId> -->
<!-- <artifactId>cxf-rt-transports-http-hc</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf</groupId> -->
<!-- <artifactId>cxf-rt-transports-http-hc</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- Java 9+ javax dependencies start -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- Java 9+ javax dependencies start -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
<!-- Java 9+ javax dependencies end -->
<dependency>
<groupId>org.apache.cxf.services.wsn</groupId>
<artifactId>cxf-services-wsn-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
<!-- Java 9+ javax dependencies end -->
<dependency>
<groupId>org.apache.cxf.services.wsn</groupId>
<artifactId>cxf-services-wsn-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- For creating human readable toString() functions in generated classes. -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<!-- For creating human readable toString() functions in generated classes. -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>generate-ws-stubs</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<!--
// TODO: Consider moving generated sources to separate folder and excluse from source control.
<sourceRoot>${basedir}/generated/src/main/java</sourceRoot>
-->
<includes>
<include>*.wsdl</include>
</includes>
<defaultOptions>
<extraargs>
<!-- DataMapper compatibility requires that the boolean getters
and setters follow naming conventions for other getters and setters. -->
<extraarg>-xjc-Xbg</extraarg>
<extraarg>-xjc-Xts</extraarg> <!-- added for toString() builder -->
<extraarg>-verbose</extraarg>
<extraarg>-suppress-generated-date</extraarg>
<extraarg>-wsdlLocation</extraarg>
<extraarg>null</extraarg>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>generate-ws-stubs</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<!--
// TODO: Consider moving generated sources to separate folder and excluse from source control.
<sourceRoot>${basedir}/generated/src/main/java</sourceRoot>
-->
<includes>
<include>*.wsdl</include>
</includes>
<defaultOptions>
<extraargs>
<!-- DataMapper compatibility requires that the boolean getters
and setters follow naming conventions for other getters and setters. -->
<extraarg>-xjc-Xbg</extraarg>
<extraarg>-xjc-Xts</extraarg> <!-- added for toString() builder -->
<extraarg>-verbose</extraarg>
<extraarg>-suppress-generated-date</extraarg>
<extraarg>-wsdlLocation</extraarg>
<extraarg>null</extraarg>
<extraarg>-catalog</extraarg>
<extraarg>${basedir}/src/main/resources/wsdl/jax-ws-catalog.xml</extraarg>
<extraarg>-catalog</extraarg>
<extraarg>${basedir}/src/main/resources/wsdl/jax-ws-catalog.xml</extraarg>
</extraargs>
</defaultOptions>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>3.1.0</version>
</dependency>
<!-- Boolean getters/setters -->
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-boolean</artifactId>
<version>3.1.0</version>
</dependency>
<!-- ToString -->
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>3.3.0</version>
</dependency>
</extraargs>
</defaultOptions>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>3.1.0</version>
</dependency>
<!-- Boolean getters/setters -->
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-boolean</artifactId>
<version>3.1.0</version>
</dependency>
<!-- ToString -->
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.6.1</version>
</dependency>
<!-- for java 10+ -->
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<!-- for java 10+ -->
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</dependencies>
</plugin>
</plugins>
</build>
</project>

145
pom.xml
View File

@@ -1,81 +1,82 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.onvif</groupId>
<artifactId>onvif</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<java.version>1.8</java.version>
<cxf.version>3.3.2</cxf.version> <!-- 3.1.10 -->
<checkstyle-maven-plugin.version>3.0.0</checkstyle-maven-plugin.version>
<javax.activation.version>1.2.0</javax.activation.version>
<jaxb.api.version>2.3.1</jaxb.api.version> <!-- 2.3.0, 2.3.1 or 2.4.0-b180830.0359 -->
<java.release>8</java.release>
<!-- <java.version>1.10</java.version>-->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<java.version>1.8</java.version>
<cxf.version>3.3.2</cxf.version> <!-- 3.1.10 -->
<checkstyle-maven-plugin.version>3.0.0</checkstyle-maven-plugin.version>
<javax.activation.version>1.2.0</javax.activation.version>
<jaxb.api.version>2.3.1</jaxb.api.version> <!-- 2.3.0, 2.3.1 or 2.4.0-b180830.0359 -->
<java.release>8</java.release>
<!-- <java.version>1.10</java.version>-->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>onvif-ws-client</module>
<module>onvif-java</module>
</modules>
<modules>
<module>onvif-ws-client</module>
<module>onvif-java</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<jdkToolchain>
<version>${java.release}</version>
</jdkToolchain>
<!-- <release>${java.release}</release> -->
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<jdkToolchain>
<version>${java.release}</version>
</jdkToolchain>
<!-- <release>${java.release}</release> -->
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-maven-plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-maven-plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-maven-plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-maven-plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
<distributionManagement>
<repository>
<id>internal</id>
<url>file://${project.build.directory}/mvn-repo</url>
</repository>
</distributionManagement>
<distributionManagement>
<repository>
<id>internal</id>
<url>file://${project.build.directory}/mvn-repo</url>
</repository>
</distributionManagement>
</project>