Compare commits
No commits in common. "0.17" and "0.4" have entirely different histories.
61 changed files with 220 additions and 284 deletions
24
.classpath
24
.classpath
|
@ -2,21 +2,21 @@
|
|||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar" sourcepath="lib/commons-lang3-3.1-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/joda-time-2.3.jar" sourcepath="lib/joda-time-2.3-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.0.jar" sourcepath="lib/devinsy-strings-0.4.0-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar" sourcepath="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.5-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar" sourcepath="lib/UnitTesting/junit-4.11-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-cmdexec-0.4.1.jar" sourcepath="lib/devinsy-cmdexec-0.4.1-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-2.5.jar" sourcepath="lib/commons-io-2.5-src.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-2.11.0.jar" sourcepath="lib/commons-io-2.11.0-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-lang3-3.12.0.jar" sourcepath="lib/commons-lang3-3.12.0-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-cmdexec-0.17.0.jar" sourcepath="lib/devinsy-cmdexec-0.17.0-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-strings-0.17.0.jar" sourcepath="lib/devinsy-strings-0.17.0-sources.zip"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -10,20 +10,16 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
|||
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
|
@ -31,20 +27,17 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
|
|||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
|
@ -128,12 +121,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
|||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
|
@ -163,8 +155,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
|
|||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
|
@ -189,17 +179,13 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
|||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
|
@ -246,8 +232,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
|
|||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
|
@ -284,12 +268,9 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
|
|||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
|
@ -315,10 +296,6 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
|
|||
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<faceted-project>
|
||||
<fixed facet="jst.java"/>
|
||||
<fixed facet="jst.utility"/>
|
||||
<installed facet="jst.java" version="6.0"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="jst.java" version="17"/>
|
||||
</faceted-project>
|
||||
|
|
|
@ -11,8 +11,8 @@ This software is released under the GNU LGPL.
|
|||
|
||||
## Requirements
|
||||
|
||||
- Java 11
|
||||
- Eclipse 4.16 (202006).
|
||||
- Java 1.6
|
||||
- Eclipse Kepler
|
||||
|
||||
## Context
|
||||
Several useful Java classes.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Thu Oct 14 18:12:14 CEST 2021
|
||||
#Thu May 04 22:58:25 CEST 2017
|
||||
build.number=1
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
product.name=devinsy-unix
|
||||
product.revision.major=0
|
||||
product.revision.minor=17
|
||||
product.revision.minor=4
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/slf4j-api-1.7.5-sources.jar
Normal file
BIN
lib/Logs/slf4j-api-1.7.5-sources.jar
Normal file
Binary file not shown.
BIN
lib/Logs/slf4j-api-1.7.5.jar
Normal file
BIN
lib/Logs/slf4j-api-1.7.5.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/slf4j-log4j12-1.7.5-sources.jar
Normal file
BIN
lib/Logs/slf4j-log4j12-1.7.5-sources.jar
Normal file
Binary file not shown.
BIN
lib/Logs/slf4j-log4j12-1.7.5.jar
Normal file
BIN
lib/Logs/slf4j-log4j12-1.7.5.jar
Normal file
Binary file not shown.
18
lib/README
18
lib/README
|
@ -1,17 +1,9 @@
|
|||
== Description of used libraries.
|
||||
|
||||
Standards:
|
||||
- commons-io
|
||||
- commons-lang: useful tools (StringUtils…)
|
||||
- devinsy-strings
|
||||
- devinsy-cmdexec
|
||||
|
||||
Logging:
|
||||
Description of used libraries:
|
||||
- commons-lang: useful tools (StringUtils...)
|
||||
- hamcrest-core: required by junit
|
||||
- joda-time: useful DateTime library
|
||||
- junit: unit tests API
|
||||
- log4j: log API
|
||||
- slf4j-api: facade log API
|
||||
- slf4j-log4j12: adaptation layer between slf4j and log4j
|
||||
|
||||
Testing:
|
||||
- hamcrest-core: required by JUnit
|
||||
- junit: unit tests API
|
||||
|
BIN
lib/UnitTesting/junit-4.11-sources.jar
Normal file
BIN
lib/UnitTesting/junit-4.11-sources.jar
Normal file
Binary file not shown.
BIN
lib/UnitTesting/junit-4.11.jar
Normal file
BIN
lib/UnitTesting/junit-4.11.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/commons-io-2.5-javadoc.jar
Normal file
BIN
lib/commons-io-2.5-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/commons-io-2.5-src.jar
Normal file
BIN
lib/commons-io-2.5-src.jar
Normal file
Binary file not shown.
BIN
lib/commons-io-2.5.jar
Normal file
BIN
lib/commons-io-2.5.jar
Normal file
Binary file not shown.
BIN
lib/commons-lang3-3.1-sources.jar
Normal file
BIN
lib/commons-lang3-3.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/commons-lang3-3.1.jar
Normal file
BIN
lib/commons-lang3-3.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/devinsy-cmdexec-0.4.1-sources.zip
Normal file
BIN
lib/devinsy-cmdexec-0.4.1-sources.zip
Normal file
Binary file not shown.
BIN
lib/devinsy-cmdexec-0.4.1.jar
Normal file
BIN
lib/devinsy-cmdexec-0.4.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/devinsy-strings-0.4.0-sources.zip
Normal file
BIN
lib/devinsy-strings-0.4.0-sources.zip
Normal file
Binary file not shown.
BIN
lib/devinsy-strings-0.4.0.jar
Normal file
BIN
lib/devinsy-strings-0.4.0.jar
Normal file
Binary file not shown.
BIN
lib/joda-time-2.3-sources.jar
Normal file
BIN
lib/joda-time-2.3-sources.jar
Normal file
Binary file not shown.
BIN
lib/joda-time-2.3.jar
Normal file
BIN
lib/joda-time-2.3.jar
Normal file
Binary file not shown.
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,15 +16,23 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.util;
|
||||
package fr.devinsy.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The Class ChangeableFile.
|
||||
* The Class CachedFile.
|
||||
*
|
||||
* @author Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||
*/
|
||||
|
||||
public class ChangeableFile
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChangeableFile.class);
|
||||
|
||||
private File sourceFile;
|
||||
private long sourceTime;
|
||||
|
||||
|
@ -111,3 +119,5 @@ public class ChangeableFile
|
|||
this.sourceTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.util;
|
||||
package fr.devinsy.util;
|
||||
|
||||
/**
|
||||
* The Class Property.
|
||||
|
@ -28,11 +28,6 @@ public class Property
|
|||
|
||||
/**
|
||||
* Utility class has not to have a constructor.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public Property(final String name, final String value)
|
||||
{
|
||||
|
@ -40,43 +35,21 @@ public class Property
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(final String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value.
|
||||
*
|
||||
* @param value
|
||||
* the new value
|
||||
*/
|
||||
public void setValue(final String value)
|
||||
{
|
||||
this.value = value;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.util;
|
||||
package fr.devinsy.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,11 +16,11 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import fr.devinsy.unix.util.ChangeableFile;
|
||||
import fr.devinsy.util.ChangeableFile;
|
||||
|
||||
/**
|
||||
* The Class EtcGroupFile.
|
||||
|
@ -144,8 +144,10 @@ public class EtcGroupFile extends ChangeableFile
|
|||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.devinsy.unix.util.ChangeableFile#refresh()
|
||||
/**
|
||||
* This method returns the updated groups.
|
||||
*
|
||||
* @return the groups
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
@ -65,7 +65,7 @@ public class EtcGroupFileReader
|
|||
Group group = new Group();
|
||||
group.setName(tokens[0]);
|
||||
group.setPassword(tokens[1]);
|
||||
group.setGid(Integer.valueOf(tokens[2]).intValue());
|
||||
group.setGid((new Integer(tokens[2])).intValue());
|
||||
|
||||
// Manage the case of empty shell.
|
||||
if (tokens.length == 4)
|
||||
|
@ -105,3 +105,5 @@ public class EtcGroupFileReader
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,12 +16,17 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import fr.devinsy.unix.util.ChangeableFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.util.ChangeableFile;
|
||||
|
||||
/**
|
||||
* The Class EtcPasswdFile.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class EtcPasswdFile extends ChangeableFile
|
||||
{
|
||||
|
@ -31,6 +36,8 @@ public class EtcPasswdFile extends ChangeableFile
|
|||
private static final EtcPasswdFile instance = new EtcPasswdFile();
|
||||
}
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EtcPasswdFile.class);
|
||||
|
||||
private Users users;
|
||||
|
||||
/**
|
||||
|
@ -99,8 +106,10 @@ public class EtcPasswdFile extends ChangeableFile
|
|||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.devinsy.unix.util.ChangeableFile#refresh()
|
||||
/**
|
||||
* Updated users.
|
||||
*
|
||||
* @return the users
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
||||
|
@ -143,3 +152,5 @@ public class EtcPasswdFile extends ChangeableFile
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* The Class EtcPasswdFileReader.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class EtcPasswdFileReader
|
||||
{
|
||||
|
@ -65,8 +66,8 @@ public class EtcPasswdFileReader
|
|||
User user = new User();
|
||||
user.setLogin(tokens[0]);
|
||||
user.setPassword(tokens[1]);
|
||||
user.setUid(Integer.valueOf(tokens[2]).intValue());
|
||||
user.setGid(Integer.valueOf(tokens[3]).intValue());
|
||||
user.setUid((new Integer(tokens[2])).intValue());
|
||||
user.setGid((new Integer(tokens[3])).intValue());
|
||||
user.setRealName(tokens[4]);
|
||||
user.setHomeDirectory(tokens[5]);
|
||||
|
||||
|
@ -108,3 +109,5 @@ public class EtcPasswdFileReader
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,13 +16,14 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* The Class Group.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Group
|
||||
{
|
||||
|
@ -88,9 +89,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the members.
|
||||
*
|
||||
* @return the members
|
||||
*/
|
||||
public Vector<String> getMembers()
|
||||
{
|
||||
|
@ -103,9 +102,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
|
@ -118,9 +115,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the password.
|
||||
*
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
|
@ -133,9 +128,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gid.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int gid()
|
||||
{
|
||||
|
@ -148,9 +141,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Members.
|
||||
*
|
||||
* @return the vector
|
||||
*/
|
||||
public Vector<String> members()
|
||||
{
|
||||
|
@ -163,9 +154,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String name()
|
||||
{
|
||||
|
@ -178,9 +167,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Passwd.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String passwd()
|
||||
{
|
||||
|
@ -193,10 +180,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the gid.
|
||||
*
|
||||
* @param gid
|
||||
* the new gid
|
||||
*/
|
||||
public void setGid(final int gid)
|
||||
{
|
||||
|
@ -204,10 +188,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(final String name)
|
||||
{
|
||||
|
@ -215,10 +196,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the passwd.
|
||||
*
|
||||
* @param password
|
||||
* the new passwd
|
||||
*/
|
||||
public void setPasswd(final String password)
|
||||
{
|
||||
|
@ -226,10 +204,7 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the password.
|
||||
*
|
||||
* @param password
|
||||
* the new password
|
||||
*/
|
||||
public void setPassword(final String password)
|
||||
{
|
||||
|
@ -250,3 +225,5 @@ public class Group
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
@ -24,9 +24,11 @@ import java.util.Vector;
|
|||
/**
|
||||
* The Class Groups.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Groups extends Vector<Group>
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 5802487312198869603L;
|
||||
|
||||
// static private final Logger logger =
|
||||
|
@ -89,11 +91,7 @@ public class Groups extends Vector<Group>
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the by gid.
|
||||
*
|
||||
* @param gid
|
||||
* the gid
|
||||
* @return the by gid
|
||||
*/
|
||||
public Group getByGid(final int gid)
|
||||
{
|
||||
|
@ -252,3 +250,5 @@ public class Groups extends Vector<Group>
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
@ -26,15 +26,16 @@ import org.apache.commons.lang3.SystemUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.cmdexec.CmdExecException;
|
||||
import fr.devinsy.cmdexec.CmdExecUtils;
|
||||
import fr.devinsy.strings.StringsUtils;
|
||||
import fr.devinsy.unix.acl.Acl;
|
||||
import fr.devinsy.unix.acl.AclManager;
|
||||
import fr.devinsy.util.cmdexec.CmdExecException;
|
||||
import fr.devinsy.util.cmdexec.CmdExecUtils;
|
||||
import fr.devinsy.util.strings.StringListUtils;
|
||||
import fr.devinsy.util.unix.acl.Acl;
|
||||
import fr.devinsy.util.unix.acl.AclManager;
|
||||
|
||||
/**
|
||||
* The Class Unix.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Unix
|
||||
{
|
||||
|
@ -50,8 +51,8 @@ public class Unix
|
|||
* the text
|
||||
* @param path
|
||||
* the path
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void appendToFile(final String text, final String path) throws UnixException
|
||||
{
|
||||
|
@ -98,15 +99,6 @@ public class Unix
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bash.
|
||||
*
|
||||
* @param command
|
||||
* the command
|
||||
* @return the string
|
||||
* @throws CmdExecException
|
||||
* the cmd exec exception
|
||||
*/
|
||||
public static String bash(final String... command) throws CmdExecException
|
||||
{
|
||||
String result;
|
||||
|
@ -131,8 +123,8 @@ public class Unix
|
|||
* the changes
|
||||
* @param path
|
||||
* the path
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void chmod(final String changes, final String path) throws UnixException
|
||||
{
|
||||
|
@ -165,8 +157,8 @@ public class Unix
|
|||
* the id
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void clearAcl(final String id, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -180,8 +172,8 @@ public class Unix
|
|||
* the group
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void clearAclGroup(final String group, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -195,8 +187,8 @@ public class Unix
|
|||
* the login
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void clearAclUser(final String login, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -208,8 +200,8 @@ public class Unix
|
|||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void createUserAccount(final String login) throws UnixException
|
||||
{
|
||||
|
@ -230,8 +222,8 @@ public class Unix
|
|||
* the login
|
||||
* @param name
|
||||
* the name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name) throws UnixException
|
||||
{
|
||||
|
@ -258,8 +250,8 @@ public class Unix
|
|||
* the name
|
||||
* @param home
|
||||
* the home
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name, final String home) throws UnixException
|
||||
{
|
||||
|
@ -303,8 +295,8 @@ public class Unix
|
|||
* the home
|
||||
* @param password
|
||||
* the password
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name, final String home, final String password) throws UnixException
|
||||
{
|
||||
|
@ -328,8 +320,8 @@ public class Unix
|
|||
*
|
||||
* @param group
|
||||
* the group
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void deleteGroup(final String group) throws UnixException
|
||||
{
|
||||
|
@ -354,12 +346,7 @@ public class Unix
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete user account.
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void deleteUserAccount(final String login) throws UnixException
|
||||
{
|
||||
|
@ -415,8 +402,8 @@ public class Unix
|
|||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl data
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static String getAclData(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -434,8 +421,8 @@ public class Unix
|
|||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl users
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static String[] getAclUsers(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -490,8 +477,8 @@ public class Unix
|
|||
* the source path
|
||||
* @param targetPath
|
||||
* the target path
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void link(final String sourcePath, final String targetPath) throws UnixException
|
||||
{
|
||||
|
@ -537,8 +524,8 @@ public class Unix
|
|||
* the target login
|
||||
* @param sourceHomeDirectory
|
||||
* the source home directory
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void modifyLogin(final String sourceLogin, final String targetLogin, final String sourceHomeDirectory) throws UnixException
|
||||
{
|
||||
|
@ -614,8 +601,8 @@ public class Unix
|
|||
* the changes
|
||||
* @param path
|
||||
* the path
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void recursiveChmod(final String changes, final String path) throws UnixException
|
||||
{
|
||||
|
@ -741,19 +728,19 @@ public class Unix
|
|||
*
|
||||
* @param args
|
||||
* the new facl
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static void setfacl(final String... args) throws UnixException
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] command = ArrayUtils.insert(0, args, "setfacl");
|
||||
String[] command = ArrayUtils.add(args, 0, "setfacl");
|
||||
sudo(command);
|
||||
}
|
||||
catch (CmdExecException exception)
|
||||
{
|
||||
throw new UnixException("Error running setfacl command for " + StringsUtils.toStringWithBrackets(args) + ":" + exception.getMessage() + ".", exception);
|
||||
throw new UnixException("Error running setfacl command for " + StringListUtils.toStringWithBrackets(args) + ":" + exception.getMessage() + ".", exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -801,7 +788,6 @@ public class Unix
|
|||
* @param newRealName
|
||||
* the new real name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void setRealName(final String login, final String newRealName) throws UnixException
|
||||
{
|
||||
|
@ -868,7 +854,7 @@ public class Unix
|
|||
|
||||
if (SystemUtils.IS_OS_UNIX)
|
||||
{
|
||||
String[] newCommand = ArrayUtils.insert(0, command, SUDO);
|
||||
String[] newCommand = ArrayUtils.add(command, 0, SUDO);
|
||||
result = CmdExecUtils.run(newCommand);
|
||||
}
|
||||
else
|
||||
|
@ -959,3 +945,5 @@ public class Unix
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2016-2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
/**
|
||||
* The Class UnixException.
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,11 +16,12 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
/**
|
||||
* The Class User.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class User
|
||||
{
|
||||
|
@ -408,3 +409,5 @@ public class User
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
@ -24,6 +24,7 @@ import java.util.Vector;
|
|||
/**
|
||||
* The Class Users.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Users extends Vector<User>
|
||||
{
|
||||
|
@ -40,12 +41,8 @@ public class Users extends Vector<User>
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the all.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return true, if successful
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.Vector#addAll(java.util.Collection)
|
||||
*/
|
||||
public boolean addAll(final Users source)
|
||||
{
|
||||
|
@ -215,3 +212,5 @@ public class Users extends Vector<User>
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010, 2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2010, 2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.acl;
|
||||
package fr.devinsy.util.unix.acl;
|
||||
|
||||
/**
|
||||
* The Class Acl.
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010, 2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2010, 2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.acl;
|
||||
package fr.devinsy.util.unix.acl;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2010,2013-2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.acl;
|
||||
package fr.devinsy.util.unix.acl;
|
||||
|
||||
/**
|
||||
* The Class AclEntry.
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2010,2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.acl;
|
||||
package fr.devinsy.util.unix.acl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -26,10 +26,10 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.cmdexec.CmdExecException;
|
||||
import fr.devinsy.strings.StringsUtils;
|
||||
import fr.devinsy.unix.Unix;
|
||||
import fr.devinsy.unix.UnixException;
|
||||
import fr.devinsy.util.cmdexec.CmdExecException;
|
||||
import fr.devinsy.util.strings.StringListUtils;
|
||||
import fr.devinsy.util.unix.Unix;
|
||||
import fr.devinsy.util.unix.UnixException;
|
||||
|
||||
/**
|
||||
* The Class AclManager.
|
||||
|
@ -118,7 +118,6 @@ public class AclManager
|
|||
* the file path name
|
||||
* @return the acl
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static Acl getAcl(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -220,8 +219,6 @@ public class AclManager
|
|||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl data
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static String getAclData(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -302,7 +299,8 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static boolean isUsed(final AclEntry.Type type, final String id, final String filePathName, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -356,7 +354,6 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final AclEntry.Type type, final String id, final String filePath, final String[] filePathNames, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -422,8 +419,8 @@ public class AclManager
|
|||
* @param depth
|
||||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
public static boolean isUsed(final String id, final String filePathName, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -473,7 +470,6 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final String id, final String[] filePathNames, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -520,12 +516,14 @@ public class AclManager
|
|||
{
|
||||
try
|
||||
{
|
||||
String[] newArgs = ArrayUtils.insert(0, args, "setfacl");
|
||||
String[] newArgs = ArrayUtils.add(args, 0, "setfacl");
|
||||
Unix.sudo(newArgs);
|
||||
}
|
||||
catch (CmdExecException exception)
|
||||
{
|
||||
throw new UnixException("Error running setfacl command for " + StringsUtils.toStringWithBrackets(args) + ":" + exception.getMessage() + ".");
|
||||
throw new UnixException("Error running setfacl command for " + StringListUtils.toStringWithBrackets(args) + ":" + exception.getMessage() + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,9 +16,9 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.demo;
|
||||
package fr.devinsy.util.unix.demo;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.util.strings.StringList;
|
||||
|
||||
/**
|
||||
* The Class UnixDemo.
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,11 +16,10 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix.linux;
|
||||
package fr.devinsy.util.unix.linux;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -30,12 +29,13 @@ import org.apache.commons.lang3.time.DurationFormatUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.unix.util.Property;
|
||||
import fr.devinsy.unix.util.PropertyList;
|
||||
import fr.devinsy.util.Property;
|
||||
import fr.devinsy.util.PropertyList;
|
||||
|
||||
/**
|
||||
* The Class Linux.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Linux
|
||||
{
|
||||
|
@ -207,7 +207,6 @@ public class Linux
|
|||
*
|
||||
* @return the string
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String readProcCpuinfo0() throws IOException
|
||||
{
|
||||
|
@ -237,7 +236,7 @@ public class Linux
|
|||
{
|
||||
String result;
|
||||
|
||||
result = FileUtils.readFileToString(new File("/proc/cpuinfo"), StandardCharsets.UTF_8);
|
||||
result = FileUtils.readFileToString(new File("/proc/cpuinfo"));
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -254,7 +253,7 @@ public class Linux
|
|||
{
|
||||
String result;
|
||||
|
||||
result = FileUtils.readFileToString(new File("/proc/meminfo"), StandardCharsets.UTF_8);
|
||||
result = FileUtils.readFileToString(new File("/proc/meminfo"));
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -265,13 +264,12 @@ public class Linux
|
|||
*
|
||||
* @return the string
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String readProcUptimeFile() throws IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = FileUtils.readFileToString(new File("/proc/uptime"), StandardCharsets.UTF_8);
|
||||
result = FileUtils.readFileToString(new File("/proc/uptime"));
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -288,7 +286,7 @@ public class Linux
|
|||
{
|
||||
String result;
|
||||
|
||||
result = FileUtils.readFileToString(new File("/proc/version"), StandardCharsets.UTF_8);
|
||||
result = FileUtils.readFileToString(new File("/proc/version"));
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -311,16 +309,16 @@ public class Linux
|
|||
|
||||
if (debianFile.exists())
|
||||
{
|
||||
result = "Debian " + FileUtils.readFileToString(debianFile, StandardCharsets.UTF_8);
|
||||
result = "Debian " + FileUtils.readFileToString(debianFile);
|
||||
}
|
||||
else if (redhatFile.exists())
|
||||
{
|
||||
result = FileUtils.readFileToString(redhatFile, StandardCharsets.UTF_8);
|
||||
result = FileUtils.readFileToString(redhatFile);
|
||||
}
|
||||
else if (suseFile.exists())
|
||||
{
|
||||
// TODO
|
||||
result = "SUSE " + FileUtils.readFileToString(debianFile, StandardCharsets.UTF_8);
|
||||
result = "SUSE " + FileUtils.readFileToString(debianFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -338,3 +336,5 @@ public class Linux
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -23,8 +23,6 @@ import java.io.File;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import fr.devinsy.unix.util.ChangeableFile;
|
||||
|
||||
/**
|
||||
* The Class ChangeableFileTest.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010,2013-2015,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2010,2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -16,13 +16,13 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Devinsy-unix. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package fr.devinsy.unix;
|
||||
package fr.devinsy.util.unix;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import fr.devinsy.unix.linux.Linux;
|
||||
import fr.devinsy.util.unix.linux.Linux;
|
||||
|
||||
/**
|
||||
* The Class LinuxTest.
|
Loading…
Reference in a new issue