Licensing, upgrade configuration, use official license-plugin.
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
d99d97b9d5
commit
41c9c9cd0d
517
gclc-socket/LICENSE.txt
Normal file
517
gclc-socket/LICENSE.txt
Normal file
@ -0,0 +1,517 @@
|
|||||||
|
CeCILL FREE SOFTWARE LICENSE AGREEMENT
|
||||||
|
|
||||||
|
Version 2.1 dated 2013-06-21
|
||||||
|
|
||||||
|
|
||||||
|
Notice
|
||||||
|
|
||||||
|
This Agreement is a Free Software license agreement that is the result
|
||||||
|
of discussions between its authors in order to ensure compliance with
|
||||||
|
the two main principles guiding its drafting:
|
||||||
|
|
||||||
|
* firstly, compliance with the principles governing the distribution
|
||||||
|
of Free Software: access to source code, broad rights granted to users,
|
||||||
|
* secondly, the election of a governing law, French law, with which it
|
||||||
|
is conformant, both as regards the law of torts and intellectual
|
||||||
|
property law, and the protection that it offers to both authors and
|
||||||
|
holders of the economic rights over software.
|
||||||
|
|
||||||
|
The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
|
||||||
|
license are:
|
||||||
|
|
||||||
|
Commissariat à l'énergie atomique et aux énergies alternatives - CEA, a
|
||||||
|
public scientific, technical and industrial research establishment,
|
||||||
|
having its principal place of business at 25 rue Leblanc, immeuble Le
|
||||||
|
Ponant D, 75015 Paris, France.
|
||||||
|
|
||||||
|
Centre National de la Recherche Scientifique - CNRS, a public scientific
|
||||||
|
and technological establishment, having its principal place of business
|
||||||
|
at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
|
||||||
|
|
||||||
|
Institut National de Recherche en Informatique et en Automatique -
|
||||||
|
Inria, a public scientific and technological establishment, having its
|
||||||
|
principal place of business at Domaine de Voluceau, Rocquencourt, BP
|
||||||
|
105, 78153 Le Chesnay cedex, France.
|
||||||
|
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The purpose of this Free Software license agreement is to grant users
|
||||||
|
the right to modify and redistribute the software governed by this
|
||||||
|
license within the framework of an open source distribution model.
|
||||||
|
|
||||||
|
The exercising of this right is conditional upon certain obligations for
|
||||||
|
users so as to preserve this status for all subsequent redistributions.
|
||||||
|
|
||||||
|
In consideration of access to the source code and the rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors only have limited liability.
|
||||||
|
|
||||||
|
In this respect, the risks associated with loading, using, modifying
|
||||||
|
and/or developing or reproducing the software by the user are brought to
|
||||||
|
the user's attention, given its Free Software status, which may make it
|
||||||
|
complicated to use, with the result that its use is reserved for
|
||||||
|
developers and experienced professionals having in-depth computer
|
||||||
|
knowledge. Users are therefore encouraged to load and test the
|
||||||
|
suitability of the software as regards their requirements in conditions
|
||||||
|
enabling the security of their systems and/or data to be ensured and,
|
||||||
|
more generally, to use and operate it in the same conditions of
|
||||||
|
security. This Agreement may be freely reproduced and published,
|
||||||
|
provided it is not altered, and that no provisions are either added or
|
||||||
|
removed herefrom.
|
||||||
|
|
||||||
|
This Agreement may apply to any or all software for which the holder of
|
||||||
|
the economic rights decides to submit the use thereof to its provisions.
|
||||||
|
|
||||||
|
Frequently asked questions can be found on the official website of the
|
||||||
|
CeCILL licenses family (http://www.cecill.info/index.en.html) for any
|
||||||
|
necessary clarification.
|
||||||
|
|
||||||
|
|
||||||
|
Article 1 - DEFINITIONS
|
||||||
|
|
||||||
|
For the purpose of this Agreement, when the following expressions
|
||||||
|
commence with a capital letter, they shall have the following meaning:
|
||||||
|
|
||||||
|
Agreement: means this license agreement, and its possible subsequent
|
||||||
|
versions and annexes.
|
||||||
|
|
||||||
|
Software: means the software in its Object Code and/or Source Code form
|
||||||
|
and, where applicable, its documentation, "as is" when the Licensee
|
||||||
|
accepts the Agreement.
|
||||||
|
|
||||||
|
Initial Software: means the Software in its Source Code and possibly its
|
||||||
|
Object Code form and, where applicable, its documentation, "as is" when
|
||||||
|
it is first distributed under the terms and conditions of the Agreement.
|
||||||
|
|
||||||
|
Modified Software: means the Software modified by at least one
|
||||||
|
Contribution.
|
||||||
|
|
||||||
|
Source Code: means all the Software's instructions and program lines to
|
||||||
|
which access is required so as to modify the Software.
|
||||||
|
|
||||||
|
Object Code: means the binary files originating from the compilation of
|
||||||
|
the Source Code.
|
||||||
|
|
||||||
|
Holder: means the holder(s) of the economic rights over the Initial
|
||||||
|
Software.
|
||||||
|
|
||||||
|
Licensee: means the Software user(s) having accepted the Agreement.
|
||||||
|
|
||||||
|
Contributor: means a Licensee having made at least one Contribution.
|
||||||
|
|
||||||
|
Licensor: means the Holder, or any other individual or legal entity, who
|
||||||
|
distributes the Software under the Agreement.
|
||||||
|
|
||||||
|
Contribution: means any or all modifications, corrections, translations,
|
||||||
|
adaptations and/or new functions integrated into the Software by any or
|
||||||
|
all Contributors, as well as any or all Internal Modules.
|
||||||
|
|
||||||
|
Module: means a set of sources files including their documentation that
|
||||||
|
enables supplementary functions or services in addition to those offered
|
||||||
|
by the Software.
|
||||||
|
|
||||||
|
External Module: means any or all Modules, not derived from the
|
||||||
|
Software, so that this Module and the Software run in separate address
|
||||||
|
spaces, with one calling the other when they are run.
|
||||||
|
|
||||||
|
Internal Module: means any or all Module, connected to the Software so
|
||||||
|
that they both execute in the same address space.
|
||||||
|
|
||||||
|
GNU GPL: means the GNU General Public License version 2 or any
|
||||||
|
subsequent version, as published by the Free Software Foundation Inc.
|
||||||
|
|
||||||
|
GNU Affero GPL: means the GNU Affero General Public License version 3 or
|
||||||
|
any subsequent version, as published by the Free Software Foundation Inc.
|
||||||
|
|
||||||
|
EUPL: means the European Union Public License version 1.1 or any
|
||||||
|
subsequent version, as published by the European Commission.
|
||||||
|
|
||||||
|
Parties: mean both the Licensee and the Licensor.
|
||||||
|
|
||||||
|
These expressions may be used both in singular and plural form.
|
||||||
|
|
||||||
|
|
||||||
|
Article 2 - PURPOSE
|
||||||
|
|
||||||
|
The purpose of the Agreement is the grant by the Licensor to the
|
||||||
|
Licensee of a non-exclusive, transferable and worldwide license for the
|
||||||
|
Software as set forth in Article 5 <#scope> hereinafter for the whole
|
||||||
|
term of the protection granted by the rights over said Software.
|
||||||
|
|
||||||
|
|
||||||
|
Article 3 - ACCEPTANCE
|
||||||
|
|
||||||
|
3.1 The Licensee shall be deemed as having accepted the terms and
|
||||||
|
conditions of this Agreement upon the occurrence of the first of the
|
||||||
|
following events:
|
||||||
|
|
||||||
|
* (i) loading the Software by any or all means, notably, by
|
||||||
|
downloading from a remote server, or by loading from a physical medium;
|
||||||
|
* (ii) the first time the Licensee exercises any of the rights granted
|
||||||
|
hereunder.
|
||||||
|
|
||||||
|
3.2 One copy of the Agreement, containing a notice relating to the
|
||||||
|
characteristics of the Software, to the limited warranty, and to the
|
||||||
|
fact that its use is restricted to experienced users has been provided
|
||||||
|
to the Licensee prior to its acceptance as set forth in Article 3.1
|
||||||
|
<#accepting> hereinabove, and the Licensee hereby acknowledges that it
|
||||||
|
has read and understood it.
|
||||||
|
|
||||||
|
|
||||||
|
Article 4 - EFFECTIVE DATE AND TERM
|
||||||
|
|
||||||
|
|
||||||
|
4.1 EFFECTIVE DATE
|
||||||
|
|
||||||
|
The Agreement shall become effective on the date when it is accepted by
|
||||||
|
the Licensee as set forth in Article 3.1 <#accepting>.
|
||||||
|
|
||||||
|
|
||||||
|
4.2 TERM
|
||||||
|
|
||||||
|
The Agreement shall remain in force for the entire legal term of
|
||||||
|
protection of the economic rights over the Software.
|
||||||
|
|
||||||
|
|
||||||
|
Article 5 - SCOPE OF RIGHTS GRANTED
|
||||||
|
|
||||||
|
The Licensor hereby grants to the Licensee, who accepts, the following
|
||||||
|
rights over the Software for any or all use, and for the term of the
|
||||||
|
Agreement, on the basis of the terms and conditions set forth hereinafter.
|
||||||
|
|
||||||
|
Besides, if the Licensor owns or comes to own one or more patents
|
||||||
|
protecting all or part of the functions of the Software or of its
|
||||||
|
components, the Licensor undertakes not to enforce the rights granted by
|
||||||
|
these patents against successive Licensees using, exploiting or
|
||||||
|
modifying the Software. If these patents are transferred, the Licensor
|
||||||
|
undertakes to have the transferees subscribe to the obligations set
|
||||||
|
forth in this paragraph.
|
||||||
|
|
||||||
|
|
||||||
|
5.1 RIGHT OF USE
|
||||||
|
|
||||||
|
The Licensee is authorized to use the Software, without any limitation
|
||||||
|
as to its fields of application, with it being hereinafter specified
|
||||||
|
that this comprises:
|
||||||
|
|
||||||
|
1. permanent or temporary reproduction of all or part of the Software
|
||||||
|
by any or all means and in any or all form.
|
||||||
|
|
||||||
|
2. loading, displaying, running, or storing the Software on any or all
|
||||||
|
medium.
|
||||||
|
|
||||||
|
3. entitlement to observe, study or test its operation so as to
|
||||||
|
determine the ideas and principles behind any or all constituent
|
||||||
|
elements of said Software. This shall apply when the Licensee
|
||||||
|
carries out any or all loading, displaying, running, transmission or
|
||||||
|
storage operation as regards the Software, that it is entitled to
|
||||||
|
carry out hereunder.
|
||||||
|
|
||||||
|
|
||||||
|
5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
|
||||||
|
|
||||||
|
The right to make Contributions includes the right to translate, adapt,
|
||||||
|
arrange, or make any or all modifications to the Software, and the right
|
||||||
|
to reproduce the resulting software.
|
||||||
|
|
||||||
|
The Licensee is authorized to make any or all Contributions to the
|
||||||
|
Software provided that it includes an explicit notice that it is the
|
||||||
|
author of said Contribution and indicates the date of the creation thereof.
|
||||||
|
|
||||||
|
|
||||||
|
5.3 RIGHT OF DISTRIBUTION
|
||||||
|
|
||||||
|
In particular, the right of distribution includes the right to publish,
|
||||||
|
transmit and communicate the Software to the general public on any or
|
||||||
|
all medium, and by any or all means, and the right to market, either in
|
||||||
|
consideration of a fee, or free of charge, one or more copies of the
|
||||||
|
Software by any means.
|
||||||
|
|
||||||
|
The Licensee is further authorized to distribute copies of the modified
|
||||||
|
or unmodified Software to third parties according to the terms and
|
||||||
|
conditions set forth hereinafter.
|
||||||
|
|
||||||
|
|
||||||
|
5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
|
||||||
|
|
||||||
|
The Licensee is authorized to distribute true copies of the Software in
|
||||||
|
Source Code or Object Code form, provided that said distribution
|
||||||
|
complies with all the provisions of the Agreement and is accompanied by:
|
||||||
|
|
||||||
|
1. a copy of the Agreement,
|
||||||
|
|
||||||
|
2. a notice relating to the limitation of both the Licensor's warranty
|
||||||
|
and liability as set forth in Articles 8 and 9,
|
||||||
|
|
||||||
|
and that, in the event that only the Object Code of the Software is
|
||||||
|
redistributed, the Licensee allows effective access to the full Source
|
||||||
|
Code of the Software for a period of at least three years from the
|
||||||
|
distribution of the Software, it being understood that the additional
|
||||||
|
acquisition cost of the Source Code shall not exceed the cost of the
|
||||||
|
data transfer.
|
||||||
|
|
||||||
|
|
||||||
|
5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
|
||||||
|
|
||||||
|
When the Licensee makes a Contribution to the Software, the terms and
|
||||||
|
conditions for the distribution of the resulting Modified Software
|
||||||
|
become subject to all the provisions of this Agreement.
|
||||||
|
|
||||||
|
The Licensee is authorized to distribute the Modified Software, in
|
||||||
|
source code or object code form, provided that said distribution
|
||||||
|
complies with all the provisions of the Agreement and is accompanied by:
|
||||||
|
|
||||||
|
1. a copy of the Agreement,
|
||||||
|
|
||||||
|
2. a notice relating to the limitation of both the Licensor's warranty
|
||||||
|
and liability as set forth in Articles 8 and 9,
|
||||||
|
|
||||||
|
and, in the event that only the object code of the Modified Software is
|
||||||
|
redistributed,
|
||||||
|
|
||||||
|
3. a note stating the conditions of effective access to the full source
|
||||||
|
code of the Modified Software for a period of at least three years
|
||||||
|
from the distribution of the Modified Software, it being understood
|
||||||
|
that the additional acquisition cost of the source code shall not
|
||||||
|
exceed the cost of the data transfer.
|
||||||
|
|
||||||
|
|
||||||
|
5.3.3 DISTRIBUTION OF EXTERNAL MODULES
|
||||||
|
|
||||||
|
When the Licensee has developed an External Module, the terms and
|
||||||
|
conditions of this Agreement do not apply to said External Module, that
|
||||||
|
may be distributed under a separate license agreement.
|
||||||
|
|
||||||
|
|
||||||
|
5.3.4 COMPATIBILITY WITH OTHER LICENSES
|
||||||
|
|
||||||
|
The Licensee can include a code that is subject to the provisions of one
|
||||||
|
of the versions of the GNU GPL, GNU Affero GPL and/or EUPL in the
|
||||||
|
Modified or unmodified Software, and distribute that entire code under
|
||||||
|
the terms of the same version of the GNU GPL, GNU Affero GPL and/or EUPL.
|
||||||
|
|
||||||
|
The Licensee can include the Modified or unmodified Software in a code
|
||||||
|
that is subject to the provisions of one of the versions of the GNU GPL,
|
||||||
|
GNU Affero GPL and/or EUPL and distribute that entire code under the
|
||||||
|
terms of the same version of the GNU GPL, GNU Affero GPL and/or EUPL.
|
||||||
|
|
||||||
|
|
||||||
|
Article 6 - INTELLECTUAL PROPERTY
|
||||||
|
|
||||||
|
|
||||||
|
6.1 OVER THE INITIAL SOFTWARE
|
||||||
|
|
||||||
|
The Holder owns the economic rights over the Initial Software. Any or
|
||||||
|
all use of the Initial Software is subject to compliance with the terms
|
||||||
|
and conditions under which the Holder has elected to distribute its work
|
||||||
|
and no one shall be entitled to modify the terms and conditions for the
|
||||||
|
distribution of said Initial Software.
|
||||||
|
|
||||||
|
The Holder undertakes that the Initial Software will remain ruled at
|
||||||
|
least by this Agreement, for the duration set forth in Article 4.2 <#term>.
|
||||||
|
|
||||||
|
|
||||||
|
6.2 OVER THE CONTRIBUTIONS
|
||||||
|
|
||||||
|
The Licensee who develops a Contribution is the owner of the
|
||||||
|
intellectual property rights over this Contribution as defined by
|
||||||
|
applicable law.
|
||||||
|
|
||||||
|
|
||||||
|
6.3 OVER THE EXTERNAL MODULES
|
||||||
|
|
||||||
|
The Licensee who develops an External Module is the owner of the
|
||||||
|
intellectual property rights over this External Module as defined by
|
||||||
|
applicable law and is free to choose the type of agreement that shall
|
||||||
|
govern its distribution.
|
||||||
|
|
||||||
|
|
||||||
|
6.4 JOINT PROVISIONS
|
||||||
|
|
||||||
|
The Licensee expressly undertakes:
|
||||||
|
|
||||||
|
1. not to remove, or modify, in any manner, the intellectual property
|
||||||
|
notices attached to the Software;
|
||||||
|
|
||||||
|
2. to reproduce said notices, in an identical manner, in the copies of
|
||||||
|
the Software modified or not.
|
||||||
|
|
||||||
|
The Licensee undertakes not to directly or indirectly infringe the
|
||||||
|
intellectual property rights on the Software of the Holder and/or
|
||||||
|
Contributors, and to take, where applicable, vis-à-vis its staff, any
|
||||||
|
and all measures required to ensure respect of said intellectual
|
||||||
|
property rights of the Holder and/or Contributors.
|
||||||
|
|
||||||
|
|
||||||
|
Article 7 - RELATED SERVICES
|
||||||
|
|
||||||
|
7.1 Under no circumstances shall the Agreement oblige the Licensor to
|
||||||
|
provide technical assistance or maintenance services for the Software.
|
||||||
|
|
||||||
|
However, the Licensor is entitled to offer this type of services. The
|
||||||
|
terms and conditions of such technical assistance, and/or such
|
||||||
|
maintenance, shall be set forth in a separate instrument. Only the
|
||||||
|
Licensor offering said maintenance and/or technical assistance services
|
||||||
|
shall incur liability therefor.
|
||||||
|
|
||||||
|
7.2 Similarly, any Licensor is entitled to offer to its licensees, under
|
||||||
|
its sole responsibility, a warranty, that shall only be binding upon
|
||||||
|
itself, for the redistribution of the Software and/or the Modified
|
||||||
|
Software, under terms and conditions that it is free to decide. Said
|
||||||
|
warranty, and the financial terms and conditions of its application,
|
||||||
|
shall be subject of a separate instrument executed between the Licensor
|
||||||
|
and the Licensee.
|
||||||
|
|
||||||
|
|
||||||
|
Article 8 - LIABILITY
|
||||||
|
|
||||||
|
8.1 Subject to the provisions of Article 8.2, the Licensee shall be
|
||||||
|
entitled to claim compensation for any direct loss it may have suffered
|
||||||
|
from the Software as a result of a fault on the part of the relevant
|
||||||
|
Licensor, subject to providing evidence thereof.
|
||||||
|
|
||||||
|
8.2 The Licensor's liability is limited to the commitments made under
|
||||||
|
this Agreement and shall not be incurred as a result of in particular:
|
||||||
|
(i) loss due the Licensee's total or partial failure to fulfill its
|
||||||
|
obligations, (ii) direct or consequential loss that is suffered by the
|
||||||
|
Licensee due to the use or performance of the Software, and (iii) more
|
||||||
|
generally, any consequential loss. In particular the Parties expressly
|
||||||
|
agree that any or all pecuniary or business loss (i.e. loss of data,
|
||||||
|
loss of profits, operating loss, loss of customers or orders,
|
||||||
|
opportunity cost, any disturbance to business activities) or any or all
|
||||||
|
legal proceedings instituted against the Licensee by a third party,
|
||||||
|
shall constitute consequential loss and shall not provide entitlement to
|
||||||
|
any or all compensation from the Licensor.
|
||||||
|
|
||||||
|
|
||||||
|
Article 9 - WARRANTY
|
||||||
|
|
||||||
|
9.1 The Licensee acknowledges that the scientific and technical
|
||||||
|
state-of-the-art when the Software was distributed did not enable all
|
||||||
|
possible uses to be tested and verified, nor for the presence of
|
||||||
|
possible defects to be detected. In this respect, the Licensee's
|
||||||
|
attention has been drawn to the risks associated with loading, using,
|
||||||
|
modifying and/or developing and reproducing the Software which are
|
||||||
|
reserved for experienced users.
|
||||||
|
|
||||||
|
The Licensee shall be responsible for verifying, by any or all means,
|
||||||
|
the suitability of the product for its requirements, its good working
|
||||||
|
order, and for ensuring that it shall not cause damage to either persons
|
||||||
|
or properties.
|
||||||
|
|
||||||
|
9.2 The Licensor hereby represents, in good faith, that it is entitled
|
||||||
|
to grant all the rights over the Software (including in particular the
|
||||||
|
rights set forth in Article 5 <#scope>).
|
||||||
|
|
||||||
|
9.3 The Licensee acknowledges that the Software is supplied "as is" by
|
||||||
|
the Licensor without any other express or tacit warranty, other than
|
||||||
|
that provided for in Article 9.2 <#good-faith> and, in particular,
|
||||||
|
without any warranty as to its commercial value, its secured, safe,
|
||||||
|
innovative or relevant nature.
|
||||||
|
|
||||||
|
Specifically, the Licensor does not warrant that the Software is free
|
||||||
|
from any error, that it will operate without interruption, that it will
|
||||||
|
be compatible with the Licensee's own equipment and software
|
||||||
|
configuration, nor that it will meet the Licensee's requirements.
|
||||||
|
|
||||||
|
9.4 The Licensor does not either expressly or tacitly warrant that the
|
||||||
|
Software does not infringe any third party intellectual property right
|
||||||
|
relating to a patent, software or any other property right. Therefore,
|
||||||
|
the Licensor disclaims any and all liability towards the Licensee
|
||||||
|
arising out of any or all proceedings for infringement that may be
|
||||||
|
instituted in respect of the use, modification and redistribution of the
|
||||||
|
Software. Nevertheless, should such proceedings be instituted against
|
||||||
|
the Licensee, the Licensor shall provide it with technical and legal
|
||||||
|
expertise for its defense. Such technical and legal expertise shall be
|
||||||
|
decided on a case-by-case basis between the relevant Licensor and the
|
||||||
|
Licensee pursuant to a memorandum of understanding. The Licensor
|
||||||
|
disclaims any and all liability as regards the Licensee's use of the
|
||||||
|
name of the Software. No warranty is given as regards the existence of
|
||||||
|
prior rights over the name of the Software or as regards the existence
|
||||||
|
of a trademark.
|
||||||
|
|
||||||
|
|
||||||
|
Article 10 - TERMINATION
|
||||||
|
|
||||||
|
10.1 In the event of a breach by the Licensee of its obligations
|
||||||
|
hereunder, the Licensor may automatically terminate this Agreement
|
||||||
|
thirty (30) days after notice has been sent to the Licensee and has
|
||||||
|
remained ineffective.
|
||||||
|
|
||||||
|
10.2 A Licensee whose Agreement is terminated shall no longer be
|
||||||
|
authorized to use, modify or distribute the Software. However, any
|
||||||
|
licenses that it may have granted prior to termination of the Agreement
|
||||||
|
shall remain valid subject to their having been granted in compliance
|
||||||
|
with the terms and conditions hereof.
|
||||||
|
|
||||||
|
|
||||||
|
Article 11 - MISCELLANEOUS
|
||||||
|
|
||||||
|
|
||||||
|
11.1 EXCUSABLE EVENTS
|
||||||
|
|
||||||
|
Neither Party shall be liable for any or all delay, or failure to
|
||||||
|
perform the Agreement, that may be attributable to an event of force
|
||||||
|
majeure, an act of God or an outside cause, such as defective
|
||||||
|
functioning or interruptions of the electricity or telecommunications
|
||||||
|
networks, network paralysis following a virus attack, intervention by
|
||||||
|
government authorities, natural disasters, water damage, earthquakes,
|
||||||
|
fire, explosions, strikes and labor unrest, war, etc.
|
||||||
|
|
||||||
|
11.2 Any failure by either Party, on one or more occasions, to invoke
|
||||||
|
one or more of the provisions hereof, shall under no circumstances be
|
||||||
|
interpreted as being a waiver by the interested Party of its right to
|
||||||
|
invoke said provision(s) subsequently.
|
||||||
|
|
||||||
|
11.3 The Agreement cancels and replaces any or all previous agreements,
|
||||||
|
whether written or oral, between the Parties and having the same
|
||||||
|
purpose, and constitutes the entirety of the agreement between said
|
||||||
|
Parties concerning said purpose. No supplement or modification to the
|
||||||
|
terms and conditions hereof shall be effective as between the Parties
|
||||||
|
unless it is made in writing and signed by their duly authorized
|
||||||
|
representatives.
|
||||||
|
|
||||||
|
11.4 In the event that one or more of the provisions hereof were to
|
||||||
|
conflict with a current or future applicable act or legislative text,
|
||||||
|
said act or legislative text shall prevail, and the Parties shall make
|
||||||
|
the necessary amendments so as to comply with said act or legislative
|
||||||
|
text. All other provisions shall remain effective. Similarly, invalidity
|
||||||
|
of a provision of the Agreement, for any reason whatsoever, shall not
|
||||||
|
cause the Agreement as a whole to be invalid.
|
||||||
|
|
||||||
|
|
||||||
|
11.5 LANGUAGE
|
||||||
|
|
||||||
|
The Agreement is drafted in both French and English and both versions
|
||||||
|
are deemed authentic.
|
||||||
|
|
||||||
|
|
||||||
|
Article 12 - NEW VERSIONS OF THE AGREEMENT
|
||||||
|
|
||||||
|
12.1 Any person is authorized to duplicate and distribute copies of this
|
||||||
|
Agreement.
|
||||||
|
|
||||||
|
12.2 So as to ensure coherence, the wording of this Agreement is
|
||||||
|
protected and may only be modified by the authors of the License, who
|
||||||
|
reserve the right to periodically publish updates or new versions of the
|
||||||
|
Agreement, each with a separate number. These subsequent versions may
|
||||||
|
address new issues encountered by Free Software.
|
||||||
|
|
||||||
|
12.3 Any Software distributed under a given version of the Agreement may
|
||||||
|
only be subsequently distributed under the same version of the Agreement
|
||||||
|
or a subsequent version, subject to the provisions of Article 5.3.4
|
||||||
|
<#compatibility>.
|
||||||
|
|
||||||
|
|
||||||
|
Article 13 - GOVERNING LAW AND JURISDICTION
|
||||||
|
|
||||||
|
13.1 The Agreement is governed by French law. The Parties agree to
|
||||||
|
endeavor to seek an amicable solution to any disagreements or disputes
|
||||||
|
that may arise during the performance of the Agreement.
|
||||||
|
|
||||||
|
13.2 Failing an amicable solution within two (2) months as from their
|
||||||
|
occurrence, and unless emergency proceedings are necessary, the
|
||||||
|
disagreements or disputes shall be referred to the Paris Courts having
|
||||||
|
jurisdiction, by the more diligent Party.
|
@ -1,135 +1,171 @@
|
|||||||
|
|
||||||
<!-- GCLC Socket, Socket implementation of GCLC -->
|
<!-- GCLC Socket, Socket implementation of GCLC -->
|
||||||
<!-- Copyright (C) 2014-2017 E. Bigeon -->
|
<!-- Copyright (C) 2014-2017 E. Bigeon -->
|
||||||
<!-- mailto:emmanuel@bigeon.fr -->
|
<!-- mailto:emmanuel@bigeon.fr -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This software is governed by the CeCILL license under French law and -->
|
<!-- This software is governed by the CeCILL license under French law and -->
|
||||||
<!-- abiding by the rules of distribution of free software. You can use, -->
|
<!-- abiding by the rules of distribution of free software. You can use, -->
|
||||||
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
||||||
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
||||||
<!-- "http://www.cecill.info". -->
|
<!-- "http://www.cecill.info". -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
||||||
<!-- modify and redistribute granted by the license, users are provided only -->
|
<!-- modify and redistribute granted by the license, users are provided only -->
|
||||||
<!-- with a limited warranty and the software's author, the holder of the -->
|
<!-- with a limited warranty and the software's author, the holder of the -->
|
||||||
<!-- economic rights, and the successive licensors have only limited -->
|
<!-- economic rights, and the successive licensors have only limited -->
|
||||||
<!-- liability. -->
|
<!-- liability. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
||||||
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
||||||
<!-- software by the user in light of its specific status of free software, -->
|
<!-- software by the user in light of its specific status of free software, -->
|
||||||
<!-- that may mean that it is complicated to manipulate, and that also -->
|
<!-- that may mean that it is complicated to manipulate, and that also -->
|
||||||
<!-- therefore means that it is reserved for developers and experienced -->
|
<!-- therefore means that it is reserved for developers and experienced -->
|
||||||
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
||||||
<!-- encouraged to load and test the software's suitability as regards their -->
|
<!-- encouraged to load and test the software's suitability as regards their -->
|
||||||
<!-- requirements in conditions enabling the security of their systems and/or -->
|
<!-- requirements in conditions enabling the security of their systems and/or -->
|
||||||
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
||||||
<!-- same conditions as regards security. -->
|
<!-- same conditions as regards security. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- The fact that you are presently reading this means that you have had -->
|
<!-- The fact that you are presently reading this means that you have had -->
|
||||||
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Copyright E. Bigeon (2014) -->
|
<!-- Copyright E. Bigeon (2014) -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- emmanuel@bigeon.fr -->
|
<!-- emmanuel@bigeon.fr -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This software is a computer program whose purpose is to -->
|
<!-- This software is a computer program whose purpose is to -->
|
||||||
<!-- Socket implementation of GCLC. -->
|
<!-- Socket implementation of GCLC. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This software is governed by the CeCILL license under French law and -->
|
<!-- This software is governed by the CeCILL license under French law and -->
|
||||||
<!-- abiding by the rules of distribution of free software. You can use, -->
|
<!-- abiding by the rules of distribution of free software. You can use, -->
|
||||||
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
||||||
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
||||||
<!-- "http://www.cecill.info". -->
|
<!-- "http://www.cecill.info". -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
||||||
<!-- modify and redistribute granted by the license, users are provided only -->
|
<!-- modify and redistribute granted by the license, users are provided only -->
|
||||||
<!-- with a limited warranty and the software's author, the holder of the -->
|
<!-- with a limited warranty and the software's author, the holder of the -->
|
||||||
<!-- economic rights, and the successive licensors have only limited -->
|
<!-- economic rights, and the successive licensors have only limited -->
|
||||||
<!-- liability. -->
|
<!-- liability. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
||||||
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
||||||
<!-- software by the user in light of its specific status of free software, -->
|
<!-- software by the user in light of its specific status of free software, -->
|
||||||
<!-- that may mean that it is complicated to manipulate, and that also -->
|
<!-- that may mean that it is complicated to manipulate, and that also -->
|
||||||
<!-- therefore means that it is reserved for developers and experienced -->
|
<!-- therefore means that it is reserved for developers and experienced -->
|
||||||
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
||||||
<!-- encouraged to load and test the software's suitability as regards their -->
|
<!-- encouraged to load and test the software's suitability as regards their -->
|
||||||
<!-- requirements in conditions enabling the security of their systems and/or -->
|
<!-- requirements in conditions enabling the security of their systems and/or -->
|
||||||
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
||||||
<!-- same conditions as regards security. -->
|
<!-- same conditions as regards security. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- The fact that you are presently reading this means that you have had -->
|
<!-- The fact that you are presently reading this means that you have had -->
|
||||||
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Copyright E. Bigeon (2014) -->
|
<!-- Copyright E. Bigeon (2014) -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- emmanuel@bigeon.fr -->
|
<!-- emmanuel@bigeon.fr -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This software is a computer program whose purpose is to -->
|
<!-- This software is a computer program whose purpose is to -->
|
||||||
<!-- Defines the distribution repositories and basic setup for projects
|
<!-- Defines the distribution repositories and basic setup for projects of
|
||||||
of Emmanuel Bigeon. -->
|
Emmanuel Bigeon. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This software is governed by the CeCILL license under French law and -->
|
<!-- This software is governed by the CeCILL license under French law and -->
|
||||||
<!-- abiding by the rules of distribution of free software. You can use, -->
|
<!-- abiding by the rules of distribution of free software. You can use, -->
|
||||||
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
<!-- modify and/or redistribute the software under the terms of the CeCILL -->
|
||||||
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
<!-- license as circulated by CEA, CNRS and INRIA at the following URL -->
|
||||||
<!-- "http://www.cecill.info". -->
|
<!-- "http://www.cecill.info". -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
<!-- As a counterpart to the access to the source code and rights to copy, -->
|
||||||
<!-- modify and redistribute granted by the license, users are provided only -->
|
<!-- modify and redistribute granted by the license, users are provided only -->
|
||||||
<!-- with a limited warranty and the software's author, the holder of the -->
|
<!-- with a limited warranty and the software's author, the holder of the -->
|
||||||
<!-- economic rights, and the successive licensors have only limited -->
|
<!-- economic rights, and the successive licensors have only limited -->
|
||||||
<!-- liability. -->
|
<!-- liability. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
<!-- In this respect, the user's attention is drawn to the risks associated -->
|
||||||
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
<!-- with loading, using, modifying and/or developing or reproducing the -->
|
||||||
<!-- software by the user in light of its specific status of free software, -->
|
<!-- software by the user in light of its specific status of free software, -->
|
||||||
<!-- that may mean that it is complicated to manipulate, and that also -->
|
<!-- that may mean that it is complicated to manipulate, and that also -->
|
||||||
<!-- therefore means that it is reserved for developers and experienced -->
|
<!-- therefore means that it is reserved for developers and experienced -->
|
||||||
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
<!-- professionals having in-depth computer knowledge. Users are therefore -->
|
||||||
<!-- encouraged to load and test the software's suitability as regards their -->
|
<!-- encouraged to load and test the software's suitability as regards their -->
|
||||||
<!-- requirements in conditions enabling the security of their systems and/or -->
|
<!-- requirements in conditions enabling the security of their systems and/or -->
|
||||||
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
<!-- data to be ensured and, more generally, to use and operate it in the -->
|
||||||
<!-- same conditions as regards security. -->
|
<!-- same conditions as regards security. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- The fact that you are presently reading this means that you have had -->
|
<!-- The fact that you are presently reading this means that you have had -->
|
||||||
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
<!-- knowledge of the CeCILL license and that you accept its terms. -->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<artifactId>gclc-socket</artifactId>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<version>1.1.10-SNAPSHOT</version>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<artifactId>gclc-socket</artifactId>
|
||||||
<url>http://www.bigeon.fr/emmanuel</url>
|
<version>1.1.10-SNAPSHOT</version>
|
||||||
<properties>
|
<packaging>jar</packaging>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<url>http://www.bigeon.net</url>
|
||||||
<project.scm.id>git.bigeon.net</project.scm.id>
|
<properties>
|
||||||
</properties>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<dependencies>
|
<project.scm.id>git.code.bigeon.net</project.scm.id>
|
||||||
<dependency>
|
<license.licenseName>cecill_2.1</license.licenseName>
|
||||||
<groupId>fr.bigeon</groupId>
|
<copyright.email>emmanuel@bigeon.fr</copyright.email>
|
||||||
<artifactId>gclc</artifactId>
|
</properties>
|
||||||
<version>2.0.5</version>
|
<dependencies>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>fr.bigeon</groupId>
|
||||||
<groupId>fr.bigeon</groupId>
|
<artifactId>gclc</artifactId>
|
||||||
<artifactId>smu</artifactId>
|
<version>2.0.5</version>
|
||||||
<version>0.0.9</version>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
</dependencies>
|
<groupId>fr.bigeon</groupId>
|
||||||
<parent>
|
<artifactId>smu</artifactId>
|
||||||
<groupId>fr.bigeon.config</groupId>
|
<version>0.0.9</version>
|
||||||
<artifactId>ebigeon-config</artifactId>
|
</dependency>
|
||||||
<version>1.8.2</version>
|
</dependencies>
|
||||||
</parent>
|
<parent>
|
||||||
<name>GCLC Socket</name>
|
<groupId>net.bigeon.config</groupId>
|
||||||
<description>Socket implementation of GCLC</description>
|
<artifactId>ebigeon-config</artifactId>
|
||||||
<scm>
|
<version>1.8.3</version>
|
||||||
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
</parent>
|
||||||
<tag>HEAD</tag>
|
<licenses>
|
||||||
</scm>
|
<license>
|
||||||
<groupId>fr.bigeon.gclc</groupId>
|
<distribution>manual</distribution>
|
||||||
|
<name>CeCILL 2.1</name>
|
||||||
|
<url>https://cecill.info/licences/Licence_CeCILL_V2.1-en.html</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.10.3</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.sevntu-checkstyle</groupId>
|
||||||
|
<artifactId>dsm-maven-plugin</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<email>emmanuel@bigeon.fr</email>
|
||||||
|
<name>Emmanuel Bigeon</name>
|
||||||
|
<url>bigeon.net</url>
|
||||||
|
<roles>
|
||||||
|
<role>PM</role>
|
||||||
|
</roles>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
<name>GCLC Socket</name>
|
||||||
|
<description>Socket implementation of GCLC</description>
|
||||||
|
<scm>
|
||||||
|
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
||||||
|
<tag>HEAD</tag>
|
||||||
|
</scm>
|
||||||
|
<groupId>net.bigeon.gclc</groupId>
|
||||||
|
<inceptionYear>2016</inceptionYear>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,98 +1,100 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.ConnexionManager.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.ConnexionManager.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.util.Collection;
|
* #L%
|
||||||
|
*/
|
||||||
/** A manager for connected elements.
|
import java.util.Collection;
|
||||||
* <p>
|
|
||||||
* Connected elements are given an identifier (unique) at connexion.
|
/** A manager for connected elements.
|
||||||
*
|
* <p>
|
||||||
* @author Emmanuel Bigeon
|
* Connected elements are given an identifier (unique) at connexion.
|
||||||
* @param <T> the type of object connected */
|
*
|
||||||
public interface ConnexionManager<T> {
|
* @author Emmanuel Bigeon
|
||||||
/** Add a connection in the name.
|
* @param <T> the type of object connected */
|
||||||
*
|
public interface ConnexionManager<T> {
|
||||||
* @param handle the connected object
|
/** Add a connection in the name.
|
||||||
* @return the name */
|
*
|
||||||
String addConnexion(T handle);
|
* @param handle the connected object
|
||||||
|
* @return the name */
|
||||||
/** Disconnect an element.
|
String addConnexion(T handle);
|
||||||
*
|
|
||||||
* @param id the element connection id
|
/** Disconnect an element.
|
||||||
* @return the object being disconnected */
|
*
|
||||||
T disconnect(String id);
|
* @param id the element connection id
|
||||||
|
* @return the object being disconnected */
|
||||||
/** Get the connected object.
|
T disconnect(String id);
|
||||||
*
|
|
||||||
* @param id the connexion id
|
/** Get the connected object.
|
||||||
* @return the object */
|
*
|
||||||
T get(String id);
|
* @param id the connexion id
|
||||||
|
* @return the object */
|
||||||
/** Get the connected elements' ids.
|
T get(String id);
|
||||||
*
|
|
||||||
* @return the connected elements' ids */
|
/** Get the connected elements' ids.
|
||||||
Collection<String> getConnected();
|
*
|
||||||
|
* @return the connected elements' ids */
|
||||||
/** Test if a connection is active.
|
Collection<String> getConnected();
|
||||||
*
|
|
||||||
* @param id the connexion id
|
/** Test if a connection is active.
|
||||||
* @return if the connection is active. */
|
*
|
||||||
boolean isConnected(String id);
|
* @param id the connexion id
|
||||||
|
* @return if the connection is active. */
|
||||||
/** Add a lock on the disconnection.
|
boolean isConnected(String id);
|
||||||
* <p>
|
|
||||||
* This lock will <strong>not</strong> prevent calls to
|
/** Add a lock on the disconnection.
|
||||||
* {@link #disconnect(String)}. It will however stop them from completing
|
* <p>
|
||||||
* after the effective disconnection of the specified connection.
|
* This lock will <strong>not</strong> prevent calls to
|
||||||
* <p>
|
* {@link #disconnect(String)}. It will however stop them from completing after
|
||||||
* Calls to {@link #releaseDisconnexionLock(String)} remove a lock (at a
|
* the effective disconnection of the specified connection.
|
||||||
* pace of one for one).
|
* <p>
|
||||||
*
|
* Calls to {@link #releaseDisconnexionLock(String)} remove a lock (at a pace of
|
||||||
* @param id the connexion id */
|
* one for one).
|
||||||
void lockDisconnexion(String id);
|
*
|
||||||
|
* @param id the connexion id */
|
||||||
/** Release one lock on a disconnection
|
void lockDisconnexion(String id);
|
||||||
*
|
|
||||||
* @param id the connexion being released. */
|
/** Release one lock on a disconnection
|
||||||
void releaseDisconnexionLock(String id);
|
*
|
||||||
|
* @param id the connexion being released. */
|
||||||
/** Wait for calls to {@link #disconnect(String)}
|
void releaseDisconnexionLock(String id);
|
||||||
*
|
|
||||||
* @param id the connexion id
|
/** Wait for calls to {@link #disconnect(String)}
|
||||||
* @throws InterruptedException if the wait was interrupted. */
|
*
|
||||||
void waitDisconnexion(String id) throws InterruptedException;
|
* @param id the connexion id
|
||||||
}
|
* @throws InterruptedException if the wait was interrupted. */
|
||||||
|
void waitDisconnexion(String id) throws InterruptedException;
|
||||||
|
}
|
||||||
|
@ -1,173 +1,175 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.DConnexionManager.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.DConnexionManager.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.util.Collection;
|
* #L%
|
||||||
import java.util.HashMap;
|
*/
|
||||||
import java.util.Map;
|
import java.util.Collection;
|
||||||
import java.util.logging.Level;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Logger;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
/** Default implementation of the {@link ConnexionManager}.
|
import java.util.logging.Logger;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon
|
/** Default implementation of the {@link ConnexionManager}.
|
||||||
* @param <T> the connected objects */
|
*
|
||||||
public final class DConnexionManager<T> implements ConnexionManager<T> {
|
* @author Emmanuel Bigeon
|
||||||
|
* @param <T> the connected objects */
|
||||||
/** Class logger. */
|
public final class DConnexionManager<T> implements ConnexionManager<T> {
|
||||||
private static final Logger LOGGER = Logger
|
|
||||||
.getLogger(DConnexionManager.class.getName());
|
/** Class logger. */
|
||||||
/** The connected objects. */
|
private static final Logger LOGGER = Logger
|
||||||
private final Map<String, T> connecteds = new HashMap<>();
|
.getLogger(DConnexionManager.class.getName());
|
||||||
/** The locks for the connexions. */
|
/** The connected objects. */
|
||||||
private final Map<String, Object> locks = new HashMap<>();
|
private final Map<String, T> connecteds = new HashMap<>();
|
||||||
/** The counter for the disconnexion locks. */
|
/** The locks for the connexions. */
|
||||||
private final Map<String, Integer> counters = new HashMap<>();
|
private final Map<String, Object> locks = new HashMap<>();
|
||||||
/** The lock for modification of {@link #counters}. */
|
/** The counter for the disconnexion locks. */
|
||||||
private final Object counterLock = new Object();
|
private final Map<String, Integer> counters = new HashMap<>();
|
||||||
/** The count of connexions. */
|
/** The lock for modification of {@link #counters}. */
|
||||||
private int count = 0;
|
private final Object counterLock = new Object();
|
||||||
|
/** The count of connexions. */
|
||||||
/** Default.constructor. */
|
private int count = 0;
|
||||||
public DConnexionManager() {
|
|
||||||
//
|
/** Default.constructor. */
|
||||||
}
|
public DConnexionManager() {
|
||||||
/* (non-Javadoc)
|
//
|
||||||
* @see
|
}
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#addConnexion(java.lang.Object) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see
|
||||||
public String addConnexion(final T handle) {
|
* fr.bigeon.gclc.socket.ConnexionManager#addConnexion(java.lang.Object) */
|
||||||
final String newID = newID();
|
@Override
|
||||||
connecteds.put(newID, handle);
|
public String addConnexion(final T handle) {
|
||||||
locks.put(newID, new Object());
|
final String newID = newID();
|
||||||
counters.put(newID, Integer.valueOf(0));
|
connecteds.put(newID, handle);
|
||||||
return newID;
|
locks.put(newID, new Object());
|
||||||
}
|
counters.put(newID, Integer.valueOf(0));
|
||||||
|
return newID;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see
|
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#disconnect(java.lang.String) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see
|
||||||
public T disconnect(final String id) {
|
* fr.bigeon.gclc.socket.ConnexionManager#disconnect(java.lang.String) */
|
||||||
if (connecteds.containsKey(id)) {
|
@Override
|
||||||
final T disc = connecteds.remove(id);
|
public T disconnect(final String id) {
|
||||||
final Object lock = locks.get(id);
|
if (connecteds.containsKey(id)) {
|
||||||
synchronized (lock) {
|
final T disc = connecteds.remove(id);
|
||||||
lock.notifyAll();
|
final Object lock = locks.get(id);
|
||||||
}
|
synchronized (lock) {
|
||||||
synchronized (counterLock) {
|
lock.notifyAll();
|
||||||
while (counters.get(id).intValue() > 0) {
|
}
|
||||||
try {
|
synchronized (counterLock) {
|
||||||
counterLock.wait();
|
while (counters.get(id).intValue() > 0) {
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
counterLock.wait();
|
||||||
Thread.currentThread().interrupt();
|
} catch (final InterruptedException e) {
|
||||||
}
|
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
||||||
}
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
return disc;
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return disc;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.socket.ConnexionManager#get(java.lang.String) */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public T get(final String id) {
|
* @see fr.bigeon.gclc.socket.ConnexionManager#get(java.lang.String) */
|
||||||
return connecteds.get(id);
|
@Override
|
||||||
}
|
public T get(final String id) {
|
||||||
|
return connecteds.get(id);
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.socket.ConnexionManager#getConnected() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public Collection<String> getConnected() {
|
* @see fr.bigeon.gclc.socket.ConnexionManager#getConnected() */
|
||||||
return connecteds.keySet();
|
@Override
|
||||||
}
|
public Collection<String> getConnected() {
|
||||||
|
return connecteds.keySet();
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see
|
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#isConnected(java.lang.String) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see
|
||||||
public boolean isConnected(final String id) {
|
* fr.bigeon.gclc.socket.ConnexionManager#isConnected(java.lang.String) */
|
||||||
return connecteds.containsKey(id);
|
@Override
|
||||||
}
|
public boolean isConnected(final String id) {
|
||||||
|
return connecteds.containsKey(id);
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see
|
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#lockDisconnexion(java.lang.String) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see
|
||||||
public void lockDisconnexion(final String id) {
|
* fr.bigeon.gclc.socket.ConnexionManager#lockDisconnexion(java.lang.String) */
|
||||||
if (!connecteds.containsKey(id)) {
|
@Override
|
||||||
return;
|
public void lockDisconnexion(final String id) {
|
||||||
}
|
if (!connecteds.containsKey(id)) {
|
||||||
synchronized (counterLock) {
|
return;
|
||||||
counters.put(id, Integer.valueOf(counters.get(id).intValue() + 1));
|
}
|
||||||
}
|
synchronized (counterLock) {
|
||||||
}
|
counters.put(id, Integer.valueOf(counters.get(id).intValue() + 1));
|
||||||
|
}
|
||||||
/** Get a new identifier for connexion.
|
}
|
||||||
*
|
|
||||||
* @return a new ID */
|
/** Get a new identifier for connexion.
|
||||||
private String newID() {
|
*
|
||||||
return "Client " + count++; //$NON-NLS-1$
|
* @return a new ID */
|
||||||
}
|
private String newID() {
|
||||||
|
return "Client " + count++; //$NON-NLS-1$
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see
|
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#releaseDisconnexionLock(java.lang.
|
/* (non-Javadoc)
|
||||||
* String) */
|
* @see
|
||||||
@Override
|
* fr.bigeon.gclc.socket.ConnexionManager#releaseDisconnexionLock(java.lang.
|
||||||
public void releaseDisconnexionLock(final String id) {
|
* String) */
|
||||||
synchronized (counterLock) {
|
@Override
|
||||||
counters.put(id, Integer
|
public void releaseDisconnexionLock(final String id) {
|
||||||
.valueOf(Math.max(counters.get(id).intValue() - 1, 0)));
|
synchronized (counterLock) {
|
||||||
counterLock.notifyAll();
|
counters.put(id, Integer
|
||||||
}
|
.valueOf(Math.max(counters.get(id).intValue() - 1, 0)));
|
||||||
}
|
counterLock.notifyAll();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see
|
|
||||||
* fr.bigeon.gclc.socket.ConnexionManager#waitDisconnexion(java.lang.String) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see
|
||||||
public void waitDisconnexion(final String id) throws InterruptedException {
|
* fr.bigeon.gclc.socket.ConnexionManager#waitDisconnexion(java.lang.String) */
|
||||||
final Object lock = locks.get(id);
|
@Override
|
||||||
while (connecteds.containsKey(id)) {
|
public void waitDisconnexion(final String id) throws InterruptedException {
|
||||||
synchronized (lock) {
|
final Object lock = locks.get(id);
|
||||||
lock.wait();
|
while (connecteds.containsKey(id)) {
|
||||||
}
|
synchronized (lock) {
|
||||||
}
|
lock.wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,284 +1,286 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.PlugableConsoleInput.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.PlugableConsoleInput.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.BufferedReader;
|
* #L%
|
||||||
import java.io.IOException;
|
*/
|
||||||
import java.io.InputStream;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.io.InputStreamReader;
|
||||||
import java.util.logging.Level;
|
import java.io.PrintStream;
|
||||||
import java.util.logging.Logger;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.logging.Level;
|
||||||
import fr.bigeon.gclc.manager.ConsoleInput;
|
import java.util.logging.Logger;
|
||||||
import fr.bigeon.gclc.manager.ReadingRunnable;
|
|
||||||
import fr.bigeon.gclc.tools.ConstantString;
|
import fr.bigeon.gclc.manager.ConsoleInput;
|
||||||
import fr.bigeon.gclc.tools.StringProvider;
|
import fr.bigeon.gclc.manager.ReadingRunnable;
|
||||||
|
import fr.bigeon.gclc.tools.ConstantString;
|
||||||
/** A console input where the stream can be plugged.
|
import fr.bigeon.gclc.tools.StringProvider;
|
||||||
* <p>
|
|
||||||
* This pluggable console input accepts an input and output to be connected to
|
/** A console input where the stream can be plugged.
|
||||||
* it. The connexion cannot be concurrent, which mean that any connected stream
|
* <p>
|
||||||
* must be disconnected before a new call to
|
* This pluggable console input accepts an input and output to be connected to
|
||||||
* {@link #connect(InputStream, PrintStream)} is done.
|
* it. The connexion cannot be concurrent, which mean that any connected stream
|
||||||
*
|
* must be disconnected before a new call to
|
||||||
* @author Emmanuel Bigeon */
|
* {@link #connect(InputStream, PrintStream)} is done.
|
||||||
public final class PluggableConsoleInput implements ConsoleInput {
|
*
|
||||||
/** The ten constant. */
|
* @author Emmanuel Bigeon */
|
||||||
private static final int TENTH = 10;
|
public final class PluggableConsoleInput implements ConsoleInput {
|
||||||
/** Class logger. */
|
/** The ten constant. */
|
||||||
private static final Logger LOGGER = Logger
|
private static final int TENTH = 10;
|
||||||
.getLogger(PluggableConsoleInput.class.getName());
|
/** Class logger. */
|
||||||
/** The default time out. */
|
private static final Logger LOGGER = Logger
|
||||||
private static final long TIMEOUT = 100;
|
.getLogger(PluggableConsoleInput.class.getName());
|
||||||
/** The prompting. */
|
/** The default time out. */
|
||||||
private boolean prompting = false;
|
private static final long TIMEOUT = 100;
|
||||||
/** If the element is closed. */
|
/** The prompting. */
|
||||||
private boolean closed = false;
|
private boolean prompting = false;
|
||||||
/** The default prompt. */
|
/** If the element is closed. */
|
||||||
private StringProvider prompt = new ConstantString("> "); //$NON-NLS-1$
|
private boolean closed = false;
|
||||||
/** If the input is plugged or buffering. */
|
/** The default prompt. */
|
||||||
private boolean connected = false;
|
private StringProvider prompt = new ConstantString("> "); //$NON-NLS-1$
|
||||||
/** The current connexion (if any). */
|
/** If the input is plugged or buffering. */
|
||||||
private ReadingRunnable connexion;
|
private boolean connected = false;
|
||||||
/** The interrupted status for prompts. */
|
/** The current connexion (if any). */
|
||||||
private boolean interrupted = false;
|
private ReadingRunnable connexion;
|
||||||
/** The last hint hint. */
|
/** The interrupted status for prompts. */
|
||||||
private String hint;
|
private boolean interrupted = false;
|
||||||
/** The output for hints. */
|
/** The last hint hint. */
|
||||||
private PrintStream output;
|
private String hint;
|
||||||
|
/** The output for hints. */
|
||||||
// Locks
|
private PrintStream output;
|
||||||
/** The lock for connexion and disconnexion of actual streams. */
|
|
||||||
private final Object connexionLock = new Object();
|
// Locks
|
||||||
|
/** The lock for connexion and disconnexion of actual streams. */
|
||||||
/** Create the pluggable console input. */
|
private final Object connexionLock = new Object();
|
||||||
public PluggableConsoleInput() {
|
|
||||||
// do nothing
|
/** Create the pluggable console input. */
|
||||||
}
|
public PluggableConsoleInput() {
|
||||||
|
// do nothing
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#close() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public void close() {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#close() */
|
||||||
closed = true;
|
@Override
|
||||||
}
|
public void close() {
|
||||||
|
closed = true;
|
||||||
/** Connect the given input stream to the input and output to the hints
|
}
|
||||||
* writing.
|
|
||||||
*
|
/** Connect the given input stream to the input and output to the hints
|
||||||
* @param stream the input stream
|
* writing.
|
||||||
* @param out the output for hints.
|
*
|
||||||
* @throws IOException if the input is already connected. */
|
* @param stream the input stream
|
||||||
public void connect(final InputStream stream,
|
* @param out the output for hints.
|
||||||
final PrintStream out) throws IOException {
|
* @throws IOException if the input is already connected. */
|
||||||
synchronized (connexionLock) {
|
public void connect(final InputStream stream,
|
||||||
if (connected) {
|
final PrintStream out) throws IOException {
|
||||||
throw new IOException(
|
synchronized (connexionLock) {
|
||||||
"Input already connected to an input stream"); //$NON-NLS-1$
|
if (connected) {
|
||||||
}
|
throw new IOException(
|
||||||
|
"Input already connected to an input stream"); //$NON-NLS-1$
|
||||||
output = out;
|
}
|
||||||
if (prompting) {
|
|
||||||
out.print(hint);
|
output = out;
|
||||||
out.flush();
|
if (prompting) {
|
||||||
}
|
out.print(hint);
|
||||||
|
out.flush();
|
||||||
final InputStreamReader streamReader = new InputStreamReader(
|
}
|
||||||
stream, StandardCharsets.UTF_8);
|
|
||||||
final BufferedReader reader = new BufferedReader(streamReader);
|
final InputStreamReader streamReader = new InputStreamReader(
|
||||||
connexion = new ReadingRunnable(reader);
|
stream, StandardCharsets.UTF_8);
|
||||||
final Thread th = new Thread(connexion, "GCLC Socket - Read input"); //$NON-NLS-1$
|
final BufferedReader reader = new BufferedReader(streamReader);
|
||||||
th.start();
|
connexion = new ReadingRunnable(reader);
|
||||||
connexionLock.notifyAll();
|
final Thread th = new Thread(connexion, "GCLC Socket - Read input"); //$NON-NLS-1$
|
||||||
connected = true;
|
th.start();
|
||||||
}
|
connexionLock.notifyAll();
|
||||||
}
|
connected = true;
|
||||||
|
}
|
||||||
/** Disconnect the current input and hint output. */
|
}
|
||||||
public synchronized void disconnect() {
|
|
||||||
synchronized (connexionLock) {
|
/** Disconnect the current input and hint output. */
|
||||||
if (!connected) {
|
public synchronized void disconnect() {
|
||||||
return;
|
synchronized (connexionLock) {
|
||||||
}
|
if (!connected) {
|
||||||
connected = false;
|
return;
|
||||||
connexion.setRunning(false);
|
}
|
||||||
}
|
connected = false;
|
||||||
}
|
connexion.setRunning(false);
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#getPrompt() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public StringProvider getPrompt() {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#getPrompt() */
|
||||||
return prompt;
|
@Override
|
||||||
}
|
public StringProvider getPrompt() {
|
||||||
|
return prompt;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#interruptPrompt() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public void interruptPrompt() {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#interruptPrompt() */
|
||||||
interrupted = true;
|
@Override
|
||||||
}
|
public void interruptPrompt() {
|
||||||
|
interrupted = true;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#isClosed() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public boolean isClosed() {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#isClosed() */
|
||||||
return closed;
|
@Override
|
||||||
}
|
public boolean isClosed() {
|
||||||
|
return closed;
|
||||||
/** Test if a prompt is occuring.
|
}
|
||||||
*
|
|
||||||
* @return the prompting */
|
/** Test if a prompt is occuring.
|
||||||
public boolean isPrompting() {
|
*
|
||||||
return prompting;
|
* @return the prompting */
|
||||||
}
|
public boolean isPrompting() {
|
||||||
|
return prompting;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public String prompt() throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt() */
|
||||||
return prompt(prompt.apply());
|
@Override
|
||||||
}
|
public String prompt() throws IOException {
|
||||||
|
return prompt(prompt.apply());
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(long) */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public String prompt(final long timeout) throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(long) */
|
||||||
return prompt(prompt.apply(), timeout);
|
@Override
|
||||||
}
|
public String prompt(final long timeout) throws IOException {
|
||||||
|
return prompt(prompt.apply(), timeout);
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(java.lang.String) */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public String prompt(final String message) throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(java.lang.String) */
|
||||||
if (closed) {
|
@Override
|
||||||
throw new IOException();
|
public String prompt(final String message) throws IOException {
|
||||||
}
|
if (closed) {
|
||||||
prompting = true;
|
throw new IOException();
|
||||||
hint = message;
|
}
|
||||||
synchronized (connexionLock) {
|
prompting = true;
|
||||||
hint = message;
|
hint = message;
|
||||||
if (connected) {
|
synchronized (connexionLock) {
|
||||||
output.print(message);
|
hint = message;
|
||||||
output.flush();
|
if (connected) {
|
||||||
}
|
output.print(message);
|
||||||
}
|
output.flush();
|
||||||
|
}
|
||||||
String res = null;
|
}
|
||||||
while (res == null && !interrupted) {
|
|
||||||
try {
|
String res = null;
|
||||||
res = waitMessageOrConnexion(TIMEOUT, TIMEOUT / TENTH);
|
while (res == null && !interrupted) {
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
res = waitMessageOrConnexion(TIMEOUT, TIMEOUT / TENTH);
|
||||||
Thread.currentThread().interrupt();
|
} catch (final InterruptedException e) {
|
||||||
}
|
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
||||||
if (closed) {
|
Thread.currentThread().interrupt();
|
||||||
throw new IOException();
|
}
|
||||||
}
|
if (closed) {
|
||||||
}
|
throw new IOException();
|
||||||
prompting = false;
|
}
|
||||||
return res;
|
}
|
||||||
}
|
prompting = false;
|
||||||
|
return res;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(java.lang.String,
|
|
||||||
* long) */
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see fr.bigeon.gclc.manager.ConsoleInput#prompt(java.lang.String,
|
||||||
public String prompt(final String message,
|
* long) */
|
||||||
final long timeout) throws IOException {
|
@Override
|
||||||
if (closed) {
|
public String prompt(final String message,
|
||||||
throw new IOException();
|
final long timeout) throws IOException {
|
||||||
}
|
if (closed) {
|
||||||
prompting = true;
|
throw new IOException();
|
||||||
synchronized (connexionLock) {
|
}
|
||||||
hint = message;
|
prompting = true;
|
||||||
if (connected) {
|
synchronized (connexionLock) {
|
||||||
output.print(message);
|
hint = message;
|
||||||
output.flush();
|
if (connected) {
|
||||||
}
|
output.print(message);
|
||||||
}
|
output.flush();
|
||||||
|
}
|
||||||
String res = null;
|
}
|
||||||
final long tic = System.currentTimeMillis();
|
|
||||||
long time = System.currentTimeMillis() - tic;
|
String res = null;
|
||||||
while (res == null && !interrupted && time < timeout) {
|
final long tic = System.currentTimeMillis();
|
||||||
try {
|
long time = System.currentTimeMillis() - tic;
|
||||||
res = waitMessageOrConnexion(timeout - time,
|
while (res == null && !interrupted && time < timeout) {
|
||||||
(timeout - time) / TENTH);
|
try {
|
||||||
} catch (final InterruptedException e) {
|
res = waitMessageOrConnexion(timeout - time,
|
||||||
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
(timeout - time) / TENTH);
|
||||||
Thread.currentThread().interrupt();
|
} catch (final InterruptedException e) {
|
||||||
}
|
LOGGER.log(Level.FINE, "Interruption of thread", e); //$NON-NLS-1$
|
||||||
time = System.currentTimeMillis() - tic;
|
Thread.currentThread().interrupt();
|
||||||
if (closed) {
|
}
|
||||||
throw new IOException();
|
time = System.currentTimeMillis() - tic;
|
||||||
}
|
if (closed) {
|
||||||
}
|
throw new IOException();
|
||||||
prompting = false;
|
}
|
||||||
return res;
|
}
|
||||||
}
|
prompting = false;
|
||||||
|
return res;
|
||||||
@Override
|
}
|
||||||
public void setPrompt(final StringProvider prompt) {
|
|
||||||
this.prompt = prompt;
|
@Override
|
||||||
}
|
public void setPrompt(final StringProvider prompt) {
|
||||||
|
this.prompt = prompt;
|
||||||
@Override
|
}
|
||||||
public void setPrompt(String prompt) {
|
|
||||||
setPrompt(new ConstantString(prompt));
|
@Override
|
||||||
}
|
public void setPrompt(String prompt) {
|
||||||
|
setPrompt(new ConstantString(prompt));
|
||||||
/** Wait for a hint or connexion.
|
}
|
||||||
*
|
|
||||||
* @param messageTimeout the timeout on the current connexion hint waiting
|
/** Wait for a hint or connexion.
|
||||||
* @param connexionTimeout the timeout on the new connexion wait
|
*
|
||||||
* @return the hint, or null if not connected or timed out.
|
* @param messageTimeout the timeout on the current connexion hint waiting
|
||||||
* @throws IOException if the reading failed.
|
* @param connexionTimeout the timeout on the new connexion wait
|
||||||
* @throws InterruptedException if the wait was interrupted */
|
* @return the hint, or null if not connected or timed out.
|
||||||
private String waitMessageOrConnexion(final long messageTimeout,
|
* @throws IOException if the reading failed.
|
||||||
final long connexionTimeout) throws IOException,
|
* @throws InterruptedException if the wait was interrupted */
|
||||||
InterruptedException {
|
private String waitMessageOrConnexion(final long messageTimeout,
|
||||||
synchronized (connexionLock) {
|
final long connexionTimeout) throws IOException,
|
||||||
if (connected) {
|
InterruptedException {
|
||||||
return connexion.getNextMessage(messageTimeout);
|
synchronized (connexionLock) {
|
||||||
}
|
if (connected) {
|
||||||
connexionLock.wait(connexionTimeout);
|
return connexion.getNextMessage(messageTimeout);
|
||||||
}
|
}
|
||||||
return null;
|
connexionLock.wait(connexionTimeout);
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,126 +1,128 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.PluggableConsoleOutput.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.PluggableConsoleOutput.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.io.PrintStream;
|
*/
|
||||||
import java.util.ArrayDeque;
|
import java.io.IOException;
|
||||||
import java.util.Deque;
|
import java.io.PrintStream;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
import fr.bigeon.gclc.manager.ConsoleOutput;
|
import java.util.Deque;
|
||||||
|
|
||||||
/** An output that can be hotplugged to an actual output.
|
import fr.bigeon.gclc.manager.ConsoleOutput;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon */
|
/** An output that can be hotplugged to an actual output.
|
||||||
public final class PluggableConsoleOutput implements ConsoleOutput {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** The actual output. */
|
public final class PluggableConsoleOutput implements ConsoleOutput {
|
||||||
private PrintStream out;
|
|
||||||
/** The buffered messages. */
|
/** The actual output. */
|
||||||
private final Deque<String> messages = new ArrayDeque<>();
|
private PrintStream out;
|
||||||
/** If this output is closed. */
|
/** The buffered messages. */
|
||||||
private boolean closed = false;
|
private final Deque<String> messages = new ArrayDeque<>();
|
||||||
|
/** If this output is closed. */
|
||||||
/** Default constructor. */
|
private boolean closed = false;
|
||||||
public PluggableConsoleOutput() {
|
|
||||||
//
|
/** Default constructor. */
|
||||||
}
|
public PluggableConsoleOutput() {
|
||||||
/* (non-Javadoc)
|
//
|
||||||
* @see java.lang.AutoCloseable#close() */
|
}
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public void close() {
|
* @see java.lang.AutoCloseable#close() */
|
||||||
closed = true;
|
@Override
|
||||||
}
|
public void close() {
|
||||||
|
closed = true;
|
||||||
/** Set the output to write to.
|
}
|
||||||
*
|
|
||||||
* @param output the output to set */
|
/** Set the output to write to.
|
||||||
public synchronized void connect(final PrintStream output) {
|
*
|
||||||
out = output;
|
* @param output the output to set */
|
||||||
while (!messages.isEmpty()) {
|
public synchronized void connect(final PrintStream output) {
|
||||||
output.print(messages.pop());
|
out = output;
|
||||||
}
|
while (!messages.isEmpty()) {
|
||||||
}
|
output.print(messages.pop());
|
||||||
|
}
|
||||||
/** Disconnects the output. */
|
}
|
||||||
public synchronized void disconnect() {
|
|
||||||
out = null;
|
/** Disconnects the output. */
|
||||||
}
|
public synchronized void disconnect() {
|
||||||
|
out = null;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleOutput#isClosed() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public boolean isClosed() {
|
* @see fr.bigeon.gclc.manager.ConsoleOutput#isClosed() */
|
||||||
return closed;
|
@Override
|
||||||
}
|
public boolean isClosed() {
|
||||||
|
return closed;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleOutput#print(java.lang.String) */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public synchronized void print(final String text) throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleOutput#print(java.lang.String) */
|
||||||
if (closed) {
|
@Override
|
||||||
throw new IOException("Closed output"); //$NON-NLS-1$
|
public synchronized void print(final String text) throws IOException {
|
||||||
}
|
if (closed) {
|
||||||
if (out == null) {
|
throw new IOException("Closed output"); //$NON-NLS-1$
|
||||||
messages.add(text);
|
}
|
||||||
} else {
|
if (out == null) {
|
||||||
out.print(text);
|
messages.add(text);
|
||||||
}
|
} else {
|
||||||
}
|
out.print(text);
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleOutput#println() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public synchronized void println() throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleOutput#println() */
|
||||||
if (closed) {
|
@Override
|
||||||
throw new IOException("Closed output"); //$NON-NLS-1$
|
public synchronized void println() throws IOException {
|
||||||
}
|
if (closed) {
|
||||||
if (out == null) {
|
throw new IOException("Closed output"); //$NON-NLS-1$
|
||||||
messages.add("\n"); //$NON-NLS-1$
|
}
|
||||||
} else {
|
if (out == null) {
|
||||||
out.println();
|
messages.add("\n"); //$NON-NLS-1$
|
||||||
}
|
} else {
|
||||||
}
|
out.println();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.manager.ConsoleOutput#println(java.lang.String) */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public synchronized void println(final String message) throws IOException {
|
* @see fr.bigeon.gclc.manager.ConsoleOutput#println(java.lang.String) */
|
||||||
print(message);
|
@Override
|
||||||
println();
|
public synchronized void println(final String message) throws IOException {
|
||||||
}
|
print(message);
|
||||||
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,132 +1,134 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.RemoteDisconnectCommand.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.RemoteDisconnectCommand.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.text.MessageFormat;
|
*/
|
||||||
import java.util.Collection;
|
import java.io.IOException;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import fr.bigeon.gclc.command.Command;
|
import java.util.Collection;
|
||||||
import fr.bigeon.gclc.exception.CommandRunException;
|
|
||||||
import fr.bigeon.gclc.exception.CommandRunExceptionType;
|
import fr.bigeon.gclc.command.Command;
|
||||||
import fr.bigeon.gclc.manager.ConsoleInput;
|
import fr.bigeon.gclc.exception.CommandRunException;
|
||||||
import fr.bigeon.gclc.manager.ConsoleOutput;
|
import fr.bigeon.gclc.exception.CommandRunExceptionType;
|
||||||
|
import fr.bigeon.gclc.manager.ConsoleInput;
|
||||||
/** A {@link Command} to disconnect elements from a {@link ConnexionManager}.
|
import fr.bigeon.gclc.manager.ConsoleOutput;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon
|
/** A {@link Command} to disconnect elements from a {@link ConnexionManager}.
|
||||||
* @param <T> the type of connected object */
|
*
|
||||||
public final class RemoteDisconnectCommand<T> extends Command {
|
* @author Emmanuel Bigeon
|
||||||
|
* @param <T> the type of connected object */
|
||||||
/** The connexion manager. */
|
public final class RemoteDisconnectCommand<T> extends Command {
|
||||||
private final ConnexionManager<T> manager;
|
|
||||||
/** If all connexion should be disconnected when no argument have been
|
/** The connexion manager. */
|
||||||
* specified. */
|
private final ConnexionManager<T> manager;
|
||||||
private final boolean all;
|
/** If all connexion should be disconnected when no argument have been
|
||||||
|
* specified. */
|
||||||
/** Create the disconnection command.
|
private final boolean all;
|
||||||
*
|
|
||||||
* @param name the command name
|
/** Create the disconnection command.
|
||||||
* @param manager the manager
|
*
|
||||||
* @param all if all elements should be disconnected when no argument is
|
* @param name the command name
|
||||||
* provided */
|
* @param manager the manager
|
||||||
public RemoteDisconnectCommand(final String name,
|
* @param all if all elements should be disconnected when no argument is
|
||||||
final ConnexionManager<T> manager, final boolean all) {
|
* provided */
|
||||||
super(name);
|
public RemoteDisconnectCommand(final String name,
|
||||||
this.manager = manager;
|
final ConnexionManager<T> manager, final boolean all) {
|
||||||
this.all = all;
|
super(name);
|
||||||
}
|
this.manager = manager;
|
||||||
|
this.all = all;
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.manager.
|
|
||||||
* ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
/* (non-Javadoc)
|
||||||
* java.lang.String[]) */
|
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.manager.
|
||||||
@Override
|
* ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
||||||
public void execute(final ConsoleOutput out, final ConsoleInput in,
|
* java.lang.String[]) */
|
||||||
final String... args) throws CommandRunException {
|
@Override
|
||||||
if (args.length == 0 && all) {
|
public void execute(final ConsoleOutput out, final ConsoleInput in,
|
||||||
final Collection<String> coll = manager.getConnected();
|
final String... args) throws CommandRunException {
|
||||||
for (final String string : coll) {
|
if (args.length == 0 && all) {
|
||||||
manager.disconnect(string);
|
final Collection<String> coll = manager.getConnected();
|
||||||
}
|
for (final String string : coll) {
|
||||||
}
|
manager.disconnect(string);
|
||||||
for (final String string : args) {
|
}
|
||||||
if (manager.isConnected(string)) {
|
}
|
||||||
manager.disconnect(string);
|
for (final String string : args) {
|
||||||
} else {
|
if (manager.isConnected(string)) {
|
||||||
print(out, MessageFormat
|
manager.disconnect(string);
|
||||||
.format("[WARNING] {0} is not connected", string)); //$NON-NLS-1$
|
} else {
|
||||||
}
|
print(out, MessageFormat
|
||||||
}
|
.format("[WARNING] {0} is not connected", string)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/** Print a message if the output is defined.
|
}
|
||||||
*
|
|
||||||
* @param out the output
|
/** Print a message if the output is defined.
|
||||||
* @param string the message
|
*
|
||||||
* @throws CommandRunException if the output exists but cannot be printed
|
* @param out the output
|
||||||
* to */
|
* @param string the message
|
||||||
private void print(final ConsoleOutput out,
|
* @throws CommandRunException if the output exists but cannot be printed
|
||||||
final String string) throws CommandRunException {
|
* to */
|
||||||
if (out != null) {
|
private void print(final ConsoleOutput out,
|
||||||
try {
|
final String string) throws CommandRunException {
|
||||||
out.println(string);
|
if (out != null) {
|
||||||
} catch (final IOException e) {
|
try {
|
||||||
throw new CommandRunException(
|
out.println(string);
|
||||||
CommandRunExceptionType.INTERACTION,
|
} catch (final IOException e) {
|
||||||
"Unable to print to existing output", e, this); //$NON-NLS-1$
|
throw new CommandRunException(
|
||||||
}
|
CommandRunExceptionType.INTERACTION,
|
||||||
}
|
"Unable to print to existing output", e, this); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.command.ICommand#tip() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public String tip() {
|
* @see fr.bigeon.gclc.command.ICommand#tip() */
|
||||||
return "Close a connexion."; //$NON-NLS-1$
|
@Override
|
||||||
}
|
public String tip() {
|
||||||
|
return "Close a connexion."; //$NON-NLS-1$
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.command.Command#usageDetail() */
|
|
||||||
@SuppressWarnings("nls")
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see fr.bigeon.gclc.command.Command#usageDetail() */
|
||||||
protected String usageDetail() {
|
@SuppressWarnings("nls")
|
||||||
return MessageFormat.format(
|
@Override
|
||||||
" If arguments are provided the corresponding connexions are closed, " +
|
protected String usageDetail() {
|
||||||
"otherwise{0}{1} are.",
|
return MessageFormat.format(
|
||||||
System.lineSeparator(), all ? "all connexions" : "none");
|
" If arguments are provided the corresponding connexions are closed, " +
|
||||||
}
|
"otherwise{0}{1} are.",
|
||||||
}
|
System.lineSeparator(), all ? "all connexions" : "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,198 +1,200 @@
|
|||||||
/*
|
package fr.bigeon.gclc.socket;
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
/*-
|
||||||
* mailto:emmanuel@bigeon.fr
|
* #%L
|
||||||
*
|
* GCLC Socket
|
||||||
* This software is governed by the CeCILL license under French law and
|
* %%
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* %%
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* This software is governed by the CeCILL license under French law and
|
||||||
* "http://www.cecill.info".
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
*
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* "http://www.cecill.info".
|
||||||
* with a limited warranty and the software's author, the holder of the
|
*
|
||||||
* economic rights, and the successive licensors have only limited
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* liability.
|
* modify and redistribute granted by the license, users are provided only
|
||||||
*
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
* economic rights, and the successive licensors have only limited
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* liability.
|
||||||
* software by the user in light of its specific status of free software,
|
*
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* therefore means that it is reserved for developers and experienced
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* software by the user in light of its specific status of free software,
|
||||||
* encouraged to load and test the software's suitability as regards their
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* therefore means that it is reserved for developers and experienced
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
* same conditions as regards security.
|
* encouraged to load and test the software's suitability as regards their
|
||||||
*
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* The fact that you are presently reading this means that you have had
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.net.InetAddress;
|
*/
|
||||||
import java.net.ServerSocket;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
import java.net.ServerSocket;
|
||||||
import java.util.logging.Level;
|
import java.net.Socket;
|
||||||
import java.util.logging.Logger;
|
import java.net.SocketException;
|
||||||
|
import java.util.logging.Level;
|
||||||
import fr.bigeon.gclc.ConsoleApplication;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/** This is a socket communicating console consoleManager.
|
import fr.bigeon.gclc.ConsoleApplication;
|
||||||
* <p>
|
|
||||||
* To use this application, the following flow should be used:
|
/** This is a socket communicating console consoleManager.
|
||||||
*
|
* <p>
|
||||||
* <pre>
|
* To use this application, the following flow should be used:
|
||||||
* SocketConsoleApplicationShell shell = new SocketConsoleApplicationShell();
|
*
|
||||||
* ConsoleApplication myApplication = new MyConsoleApplication(shell.getConsoleManager(), ...);
|
* <pre>
|
||||||
* shell.setApplication(myApplication);
|
* SocketConsoleApplicationShell shell = new SocketConsoleApplicationShell();
|
||||||
* Thread th = new Thread(shell);
|
* ConsoleApplication myApplication = new MyConsoleApplication(shell.getConsoleManager(), ...);
|
||||||
* th.start();
|
* shell.setApplication(myApplication);
|
||||||
* </pre>
|
* Thread th = new Thread(shell);
|
||||||
* <p>
|
* th.start();
|
||||||
* This will start the application in a separate thread. The application will be
|
* </pre>
|
||||||
* listening on the given socket and writing back on it. If this is all your
|
* <p>
|
||||||
* application, you should then {@link Thread#join()} the thread to wait for the
|
* This will start the application in a separate thread. The application will be
|
||||||
* end of the execution.
|
* listening on the given socket and writing back on it. If this is all your
|
||||||
*
|
* application, you should then {@link Thread#join()} the thread to wait for the
|
||||||
* @author Emmanuel Bigeon */
|
* end of the execution.
|
||||||
public final class SocketConsoleApplicationShell implements Runnable {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** The class logger. */
|
public final class SocketConsoleApplicationShell implements Runnable {
|
||||||
private static final Logger LOGGER = Logger
|
|
||||||
.getLogger(SocketConsoleApplicationShell.class.getName());
|
/** The class logger. */
|
||||||
/** The listening port. */
|
private static final Logger LOGGER = Logger
|
||||||
private final int port;
|
.getLogger(SocketConsoleApplicationShell.class.getName());
|
||||||
/** The running status. */
|
/** The listening port. */
|
||||||
private boolean running;
|
private final int port;
|
||||||
/** The socket console interface. */
|
/** The running status. */
|
||||||
private SocketConsoleInterface sci;
|
private boolean running;
|
||||||
/** The remote disconnection command. */
|
/** The socket console interface. */
|
||||||
private ConnexionManager<Socket> rdc;
|
private SocketConsoleInterface sci;
|
||||||
/** The application. */
|
/** The remote disconnection command. */
|
||||||
private ConsoleApplication app;
|
private ConnexionManager<Socket> rdc;
|
||||||
|
/** The application. */
|
||||||
/** The server socket. */
|
private ConsoleApplication app;
|
||||||
private ServerSocket serverSocket;
|
|
||||||
/** THe server address. */
|
/** The server socket. */
|
||||||
private final InetAddress addr;
|
private ServerSocket serverSocket;
|
||||||
|
/** THe server address. */
|
||||||
/** Create a socket application shell which will listen on the given port
|
private final InetAddress addr;
|
||||||
* and network interface.
|
|
||||||
*
|
/** Create a socket application shell which will listen on the given port
|
||||||
* @param port the part
|
* and network interface.
|
||||||
* @param addr the inet address */
|
*
|
||||||
public SocketConsoleApplicationShell(final int port,
|
* @param port the part
|
||||||
final InetAddress addr) {
|
* @param addr the inet address */
|
||||||
super();
|
public SocketConsoleApplicationShell(final int port,
|
||||||
this.port = port;
|
final InetAddress addr) {
|
||||||
this.addr = addr;
|
super();
|
||||||
}
|
this.port = port;
|
||||||
|
this.addr = addr;
|
||||||
/** Wait for the identified connection to disconnect.
|
}
|
||||||
*
|
|
||||||
* @param id the connexion id. */
|
/** Wait for the identified connection to disconnect.
|
||||||
private void awaitDisconnexion(final String id) {
|
*
|
||||||
while (rdc.isConnected(id)) {
|
* @param id the connexion id. */
|
||||||
try {
|
private void awaitDisconnexion(final String id) {
|
||||||
rdc.waitDisconnexion(id);
|
while (rdc.isConnected(id)) {
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
LOGGER.log(Level.SEVERE, "Unexpected interruption", e); //$NON-NLS-1$
|
rdc.waitDisconnexion(id);
|
||||||
Thread.currentThread().interrupt();
|
} catch (final InterruptedException e) {
|
||||||
}
|
LOGGER.log(Level.SEVERE, "Unexpected interruption", e); //$NON-NLS-1$
|
||||||
}
|
Thread.currentThread().interrupt();
|
||||||
sci.disconnect();
|
}
|
||||||
}
|
}
|
||||||
|
sci.disconnect();
|
||||||
/** If the port provided was 0, this allows to get the actual port.
|
}
|
||||||
* @return the local port
|
|
||||||
* @see java.net.ServerSocket#getLocalPort()
|
/** If the port provided was 0, this allows to get the actual port.
|
||||||
*/
|
* @return the local port
|
||||||
public int getLocalPort() {
|
* @see java.net.ServerSocket#getLocalPort()
|
||||||
return serverSocket.getLocalPort();
|
*/
|
||||||
}
|
public int getLocalPort() {
|
||||||
|
return serverSocket.getLocalPort();
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see java.lang.Runnable#run() */
|
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
public void run() {
|
* @see java.lang.Runnable#run() */
|
||||||
// Create the server
|
@Override
|
||||||
try (ServerSocket actualServerSocket = new ServerSocket(port, 1,
|
public void run() {
|
||||||
addr)) {
|
// Create the server
|
||||||
serverSocket = actualServerSocket;
|
try (ServerSocket actualServerSocket = new ServerSocket(port, 1,
|
||||||
running = true;
|
addr)) {
|
||||||
// Create the streams
|
serverSocket = actualServerSocket;
|
||||||
runSokectServer();
|
running = true;
|
||||||
} catch (final IOException e) {
|
// Create the streams
|
||||||
LOGGER.severe("Communication error between client and server"); //$NON-NLS-1$
|
runSokectServer();
|
||||||
LOGGER.log(Level.FINE,
|
} catch (final IOException e) {
|
||||||
"Communication error between client and server", e); //$NON-NLS-1$
|
LOGGER.severe("Communication error between client and server"); //$NON-NLS-1$
|
||||||
}
|
LOGGER.log(Level.FINE,
|
||||||
}
|
"Communication error between client and server", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
/** Acctually run the server loop on connexion.
|
}
|
||||||
*
|
|
||||||
* @throws IOException if the communication with the client failed */
|
/** Acctually run the server loop on connexion.
|
||||||
private void runSokectServer() throws IOException {
|
*
|
||||||
while (running && app.isRunning()) {
|
* @throws IOException if the communication with the client failed */
|
||||||
LOGGER.info("Waiting client"); //$NON-NLS-1$
|
private void runSokectServer() throws IOException {
|
||||||
try (Socket clientSocket = serverSocket.accept();) {
|
while (running && app.isRunning()) {
|
||||||
|
LOGGER.info("Waiting client"); //$NON-NLS-1$
|
||||||
sci.connect(clientSocket);
|
try (Socket clientSocket = serverSocket.accept();) {
|
||||||
|
|
||||||
final String id = rdc.addConnexion(clientSocket);
|
sci.connect(clientSocket);
|
||||||
rdc.lockDisconnexion(id);
|
|
||||||
awaitDisconnexion(id);
|
final String id = rdc.addConnexion(clientSocket);
|
||||||
rdc.releaseDisconnexionLock(id);
|
rdc.lockDisconnexion(id);
|
||||||
} catch (final SocketException e) {
|
awaitDisconnexion(id);
|
||||||
LOGGER.log(Level.INFO, "Socket closed"); //$NON-NLS-1$
|
rdc.releaseDisconnexionLock(id);
|
||||||
LOGGER.log(Level.FINE,
|
} catch (final SocketException e) {
|
||||||
"Socket closed with exception (probably due to server interruption)", //$NON-NLS-1$
|
LOGGER.log(Level.INFO, "Socket closed"); //$NON-NLS-1$
|
||||||
e);
|
LOGGER.log(Level.FINE,
|
||||||
} catch (final IOException e) {
|
"Socket closed with exception (probably due to server interruption)", //$NON-NLS-1$
|
||||||
throw e;
|
e);
|
||||||
}
|
} catch (final IOException e) {
|
||||||
LOGGER.info("Closing client"); //$NON-NLS-1$
|
throw e;
|
||||||
}
|
}
|
||||||
LOGGER.info("Closing Server"); //$NON-NLS-1$
|
LOGGER.info("Closing client"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
LOGGER.info("Closing Server"); //$NON-NLS-1$
|
||||||
/** Set the application.
|
}
|
||||||
* <p>
|
|
||||||
* If the application is closed, the server will also close.
|
/** Set the application.
|
||||||
*
|
* <p>
|
||||||
* @param app the app to set */
|
* If the application is closed, the server will also close.
|
||||||
public void setApplication(final ConsoleApplication app) {
|
*
|
||||||
this.app = app;
|
* @param app the app to set */
|
||||||
}
|
public void setApplication(final ConsoleApplication app) {
|
||||||
|
this.app = app;
|
||||||
/** Set the connexion manager.
|
}
|
||||||
*
|
|
||||||
* @param rdc the rdc to set */
|
/** Set the connexion manager.
|
||||||
public void setConnexionManager(final ConnexionManager<Socket> rdc) {
|
*
|
||||||
this.rdc = rdc;
|
* @param rdc the rdc to set */
|
||||||
}
|
public void setConnexionManager(final ConnexionManager<Socket> rdc) {
|
||||||
|
this.rdc = rdc;
|
||||||
/** Set the socket console interface.
|
}
|
||||||
*
|
|
||||||
* @param sci the console interface to set */
|
/** Set the socket console interface.
|
||||||
public void setInterface(final SocketConsoleInterface sci) {
|
*
|
||||||
this.sci = sci;
|
* @param sci the console interface to set */
|
||||||
}
|
public void setInterface(final SocketConsoleInterface sci) {
|
||||||
|
this.sci = sci;
|
||||||
/** This method will request the server to stop.
|
}
|
||||||
* <p>
|
|
||||||
* In most cases, this will terminate communication on every client. On some
|
/** This method will request the server to stop.
|
||||||
* cases, the */
|
* <p>
|
||||||
public void stop() {
|
* In most cases, this will terminate communication on every client. On some
|
||||||
running = false;
|
* cases, the */
|
||||||
try {
|
public void stop() {
|
||||||
serverSocket.close();
|
running = false;
|
||||||
} catch (final IOException e) {
|
try {
|
||||||
LOGGER.log(Level.SEVERE, "Exception in closing socket server", e); //$NON-NLS-1$
|
serverSocket.close();
|
||||||
}
|
} catch (final IOException e) {
|
||||||
}
|
LOGGER.log(Level.SEVERE, "Exception in closing socket server", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,82 +1,84 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.SocketConsoleInterface.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.SocketConsoleInterface.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.io.PrintStream;
|
*/
|
||||||
import java.net.Socket;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.io.PrintStream;
|
||||||
|
import java.net.Socket;
|
||||||
/** The interface for socket based access to console application.
|
import java.nio.charset.StandardCharsets;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon */
|
/** The interface for socket based access to console application.
|
||||||
public final class SocketConsoleInterface {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** The application's input. */
|
public final class SocketConsoleInterface {
|
||||||
private final PluggableConsoleInput input;
|
|
||||||
/** The application's output. */
|
/** The application's input. */
|
||||||
private final PluggableConsoleOutput output;
|
private final PluggableConsoleInput input;
|
||||||
|
/** The application's output. */
|
||||||
/** Create the interfacing object.
|
private final PluggableConsoleOutput output;
|
||||||
*
|
|
||||||
* @param input the input
|
/** Create the interfacing object.
|
||||||
* @param output the output */
|
*
|
||||||
public SocketConsoleInterface(final PluggableConsoleInput input,
|
* @param input the input
|
||||||
final PluggableConsoleOutput output) {
|
* @param output the output */
|
||||||
super();
|
public SocketConsoleInterface(final PluggableConsoleInput input,
|
||||||
this.input = input;
|
final PluggableConsoleOutput output) {
|
||||||
this.output = output;
|
super();
|
||||||
}
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
/** Connect the application's input and outputs to the socket's.
|
}
|
||||||
*
|
|
||||||
* @param socket the socket
|
/** Connect the application's input and outputs to the socket's.
|
||||||
* @throws IOException if the connection failed */
|
*
|
||||||
public void connect(final Socket socket) throws IOException {
|
* @param socket the socket
|
||||||
final PrintStream printStream = new PrintStream(
|
* @throws IOException if the connection failed */
|
||||||
socket.getOutputStream(), true,
|
public void connect(final Socket socket) throws IOException {
|
||||||
StandardCharsets.UTF_8.name());
|
final PrintStream printStream = new PrintStream(
|
||||||
output.connect(printStream);
|
socket.getOutputStream(), true,
|
||||||
input.connect(socket.getInputStream(),
|
StandardCharsets.UTF_8.name());
|
||||||
printStream);
|
output.connect(printStream);
|
||||||
}
|
input.connect(socket.getInputStream(),
|
||||||
|
printStream);
|
||||||
/** Disconnect the input and output of the application from the socket's. */
|
}
|
||||||
public void disconnect() {
|
|
||||||
input.disconnect();
|
/** Disconnect the input and output of the application from the socket's. */
|
||||||
output.disconnect();
|
public void disconnect() {
|
||||||
}
|
input.disconnect();
|
||||||
}
|
output.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,40 +1,39 @@
|
|||||||
/*
|
/** This package define a framework to access
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* {@link fr.bigeon.gclc.ConsoleApplication} through a socket.
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
*
|
||||||
* mailto:emmanuel@bigeon.fr
|
* @author Emmanuel Bigeon */
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.package-info.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
/** This package define a framework to access
|
* The fact that you are presently reading this means that you have had
|
||||||
* {@link fr.bigeon.gclc.ConsoleApplication} through a socket.
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
*
|
* #L%
|
||||||
* @author Emmanuel Bigeon */
|
*/
|
||||||
package fr.bigeon.gclc.socket;
|
|
||||||
|
@ -1,158 +1,160 @@
|
|||||||
/*
|
package fr.bigeon.gclc.socket;
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
/*-
|
||||||
* mailto:emmanuel@bigeon.fr
|
* #%L
|
||||||
*
|
* GCLC Socket
|
||||||
* This software is governed by the CeCILL license under French law and
|
* %%
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* %%
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* This software is governed by the CeCILL license under French law and
|
||||||
* "http://www.cecill.info".
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
*
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* "http://www.cecill.info".
|
||||||
* with a limited warranty and the software's author, the holder of the
|
*
|
||||||
* economic rights, and the successive licensors have only limited
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* liability.
|
* modify and redistribute granted by the license, users are provided only
|
||||||
*
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
* economic rights, and the successive licensors have only limited
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* liability.
|
||||||
* software by the user in light of its specific status of free software,
|
*
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* therefore means that it is reserved for developers and experienced
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* software by the user in light of its specific status of free software,
|
||||||
* encouraged to load and test the software's suitability as regards their
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* therefore means that it is reserved for developers and experienced
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
* same conditions as regards security.
|
* encouraged to load and test the software's suitability as regards their
|
||||||
*
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* The fact that you are presently reading this means that you have had
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.net.Socket;
|
*/
|
||||||
import java.util.Collection;
|
import java.io.IOException;
|
||||||
|
import java.net.Socket;
|
||||||
import fr.bigeon.gclc.ConsoleApplication;
|
import java.util.Collection;
|
||||||
import fr.bigeon.gclc.command.Command;
|
|
||||||
import fr.bigeon.gclc.command.ExitCommand;
|
import fr.bigeon.gclc.ConsoleApplication;
|
||||||
import fr.bigeon.gclc.command.HelpExecutor;
|
import fr.bigeon.gclc.command.Command;
|
||||||
import fr.bigeon.gclc.exception.CommandRunException;
|
import fr.bigeon.gclc.command.ExitCommand;
|
||||||
import fr.bigeon.gclc.exception.InvalidCommandName;
|
import fr.bigeon.gclc.command.HelpExecutor;
|
||||||
import fr.bigeon.gclc.manager.ConsoleInput;
|
import fr.bigeon.gclc.exception.CommandRunException;
|
||||||
import fr.bigeon.gclc.manager.ConsoleOutput;
|
import fr.bigeon.gclc.exception.InvalidCommandName;
|
||||||
|
import fr.bigeon.gclc.manager.ConsoleInput;
|
||||||
/** A test-purpose application
|
import fr.bigeon.gclc.manager.ConsoleOutput;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon */
|
/** A test-purpose application
|
||||||
public class ConsoleTestApplication {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** Exit command */
|
public class ConsoleTestApplication {
|
||||||
public static final String EXIT = "exit"; //$NON-NLS-1$
|
|
||||||
|
/** Exit command */
|
||||||
/** Create the test application.
|
public static final String EXIT = "exit"; //$NON-NLS-1$
|
||||||
*
|
|
||||||
* @param output the output
|
/** Create the test application.
|
||||||
* @param input the input
|
*
|
||||||
* @param manager the manager
|
* @param output the output
|
||||||
* @return create the application */
|
* @param input the input
|
||||||
@SuppressWarnings("nls")
|
* @param manager the manager
|
||||||
public static ConsoleApplication create(final ConsoleOutput output,
|
* @return create the application */
|
||||||
final ConsoleInput input,
|
@SuppressWarnings("nls")
|
||||||
final ConnexionManager<Socket> manager) {
|
public static ConsoleApplication create(final ConsoleOutput output,
|
||||||
try {
|
final ConsoleInput input,
|
||||||
final ConsoleApplication application = new ConsoleApplication(
|
final ConnexionManager<Socket> manager) {
|
||||||
output, input,
|
try {
|
||||||
"Welcome to the test application. Type help or test.",
|
final ConsoleApplication application = new ConsoleApplication(
|
||||||
"See you");
|
output, input,
|
||||||
application.add(new ExitCommand(EXIT, application) {
|
"Welcome to the test application. Type help or test.",
|
||||||
/* (non-Javadoc)
|
"See you");
|
||||||
* @see fr.bigeon.gclc.command.ExitCommand#beforeExit() */
|
application.add(new ExitCommand(EXIT, application) {
|
||||||
@Override
|
/* (non-Javadoc)
|
||||||
protected void beforeExit() {
|
* @see fr.bigeon.gclc.command.ExitCommand#beforeExit() */
|
||||||
final Collection<String> coll = manager.getConnected();
|
@Override
|
||||||
for (final String string : coll) {
|
protected void beforeExit() {
|
||||||
manager.disconnect(string);
|
final Collection<String> coll = manager.getConnected();
|
||||||
}
|
for (final String string : coll) {
|
||||||
}
|
manager.disconnect(string);
|
||||||
});
|
}
|
||||||
application
|
}
|
||||||
.add(new HelpExecutor("help", application.root));
|
});
|
||||||
application.add(new Command("test") {
|
application
|
||||||
|
.add(new HelpExecutor("help", application.root));
|
||||||
/* (non-Javadoc)
|
application.add(new Command("test") {
|
||||||
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
|
|
||||||
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
/* (non-Javadoc)
|
||||||
* java.lang.String[]) */
|
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
|
||||||
@Override
|
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
||||||
public void execute(final ConsoleOutput out,
|
* java.lang.String[]) */
|
||||||
final ConsoleInput in,
|
@Override
|
||||||
final String... args) throws CommandRunException {
|
public void execute(final ConsoleOutput out,
|
||||||
try {
|
final ConsoleInput in,
|
||||||
output.println("Test command ran fine");
|
final String... args) throws CommandRunException {
|
||||||
} catch (final IOException e) {
|
try {
|
||||||
throw new CommandRunException("manager closed", e,
|
output.println("Test command ran fine");
|
||||||
this);
|
} catch (final IOException e) {
|
||||||
}
|
throw new CommandRunException("manager closed", e,
|
||||||
}
|
this);
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public String tip() {
|
|
||||||
return "A test command";
|
@Override
|
||||||
}
|
public String tip() {
|
||||||
|
return "A test command";
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.command.Command#usageDetail()
|
|
||||||
*/
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see fr.bigeon.gclc.command.Command#usageDetail()
|
||||||
protected String usageDetail() {
|
*/
|
||||||
// TODO Auto-generated method stub
|
@Override
|
||||||
// return null;
|
protected String usageDetail() {
|
||||||
throw new RuntimeException("Not implemented yet");
|
// TODO Auto-generated method stub
|
||||||
}
|
// return null;
|
||||||
});
|
throw new RuntimeException("Not implemented yet");
|
||||||
application.add(new Command("long") {
|
}
|
||||||
|
});
|
||||||
/* (non-Javadoc)
|
application.add(new Command("long") {
|
||||||
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
|
|
||||||
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
/* (non-Javadoc)
|
||||||
* java.lang.String[]) */
|
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
|
||||||
@Override
|
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
|
||||||
public void execute(final ConsoleOutput out,
|
* java.lang.String[]) */
|
||||||
final ConsoleInput in,
|
@Override
|
||||||
final String... args) throws CommandRunException {
|
public void execute(final ConsoleOutput out,
|
||||||
try {
|
final ConsoleInput in,
|
||||||
Thread.sleep(2000);
|
final String... args) throws CommandRunException {
|
||||||
output.println("Test command ran fine");
|
try {
|
||||||
} catch (IOException | InterruptedException e) {
|
Thread.sleep(2000);
|
||||||
throw new CommandRunException("manager closed", e,
|
output.println("Test command ran fine");
|
||||||
this);
|
} catch (IOException | InterruptedException e) {
|
||||||
}
|
throw new CommandRunException("manager closed", e,
|
||||||
}
|
this);
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public String tip() {
|
|
||||||
return "A long run test command";
|
@Override
|
||||||
}
|
public String tip() {
|
||||||
|
return "A long run test command";
|
||||||
/* (non-Javadoc)
|
}
|
||||||
* @see fr.bigeon.gclc.command.Command#usageDetail()
|
|
||||||
*/
|
/* (non-Javadoc)
|
||||||
@Override
|
* @see fr.bigeon.gclc.command.Command#usageDetail()
|
||||||
protected String usageDetail() {
|
*/
|
||||||
// TODO Auto-generated method stub
|
@Override
|
||||||
// return null;
|
protected String usageDetail() {
|
||||||
throw new RuntimeException("Not implemented yet");
|
// TODO Auto-generated method stub
|
||||||
}
|
// return null;
|
||||||
});
|
throw new RuntimeException("Not implemented yet");
|
||||||
application.add(
|
}
|
||||||
new RemoteDisconnectCommand<>("out", manager, true));
|
});
|
||||||
return application;
|
application.add(
|
||||||
} catch (final InvalidCommandName e) {
|
new RemoteDisconnectCommand<>("out", manager, true));
|
||||||
e.printStackTrace();
|
return application;
|
||||||
}
|
} catch (final InvalidCommandName e) {
|
||||||
return null;
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,200 +1,202 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.PluggableConsoleInputTest.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.PluggableConsoleInputTest.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import static org.junit.Assert.assertEquals;
|
* #L%
|
||||||
import static org.junit.Assert.assertFalse;
|
*/
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import java.io.IOException;
|
import static org.junit.Assert.fail;
|
||||||
import java.io.PipedInputStream;
|
|
||||||
import java.io.PipedOutputStream;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PipedInputStream;
|
||||||
|
import java.io.PipedOutputStream;
|
||||||
import org.junit.Test;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
/**
|
import org.junit.Test;
|
||||||
* <p>
|
|
||||||
* TODO
|
/**
|
||||||
*
|
* <p>
|
||||||
* @author Emmanuel Bigeon */
|
* TODO
|
||||||
public class PluggableConsoleInputTest {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** Test method for
|
public class PluggableConsoleInputTest {
|
||||||
* {@link fr.bigeon.gclc.socket.PluggableConsoleInput#close()}. */
|
|
||||||
@Test
|
/** Test method for
|
||||||
public final void testClose() {
|
* {@link fr.bigeon.gclc.socket.PluggableConsoleInput#close()}. */
|
||||||
final PluggableConsoleInput input = new PluggableConsoleInput();
|
@Test
|
||||||
assertFalse("Input should not be initially closed", input.isClosed());
|
public final void testClose() {
|
||||||
input.close();
|
final PluggableConsoleInput input = new PluggableConsoleInput();
|
||||||
assertTrue("Close should close the input", input.isClosed());
|
assertFalse("Input should not be initially closed", input.isClosed());
|
||||||
|
input.close();
|
||||||
try {
|
assertTrue("Close should close the input", input.isClosed());
|
||||||
input.prompt();
|
|
||||||
fail("Closed prompt should cause an IO");
|
try {
|
||||||
} catch (final IOException e) {
|
input.prompt();
|
||||||
// ok
|
fail("Closed prompt should cause an IO");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
try {
|
// ok
|
||||||
input.prompt(10);
|
}
|
||||||
fail("Closed prompt should cause an IO");
|
try {
|
||||||
} catch (final IOException e) {
|
input.prompt(10);
|
||||||
// ok
|
fail("Closed prompt should cause an IO");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
|
// ok
|
||||||
final PluggableConsoleInput input2 = new PluggableConsoleInput();
|
}
|
||||||
|
|
||||||
final Thread th = new Thread(new Runnable() {
|
final PluggableConsoleInput input2 = new PluggableConsoleInput();
|
||||||
|
|
||||||
@Override
|
final Thread th = new Thread(new Runnable() {
|
||||||
public void run() {
|
|
||||||
while (!input2.isPrompting()) {
|
@Override
|
||||||
|
public void run() {
|
||||||
}
|
while (!input2.isPrompting()) {
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
}
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
// TODO Auto-generated catch block
|
Thread.sleep(100);
|
||||||
e.printStackTrace();
|
} catch (final InterruptedException e) {
|
||||||
}
|
// TODO Auto-generated catch block
|
||||||
input2.close();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
input2.close();
|
||||||
th.start();
|
}
|
||||||
try {
|
});
|
||||||
input.prompt();
|
th.start();
|
||||||
fail("Closed prompt should cause an IO");
|
try {
|
||||||
} catch (final IOException e) {
|
input.prompt();
|
||||||
// ok
|
fail("Closed prompt should cause an IO");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
final PluggableConsoleInput input3 = new PluggableConsoleInput();
|
// ok
|
||||||
|
}
|
||||||
final Thread th2 = new Thread(new Runnable() {
|
final PluggableConsoleInput input3 = new PluggableConsoleInput();
|
||||||
|
|
||||||
@Override
|
final Thread th2 = new Thread(new Runnable() {
|
||||||
public void run() {
|
|
||||||
try {
|
@Override
|
||||||
Thread.sleep(200);
|
public void run() {
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
// TODO Auto-generated catch block
|
Thread.sleep(200);
|
||||||
e.printStackTrace();
|
} catch (final InterruptedException e) {
|
||||||
}
|
// TODO Auto-generated catch block
|
||||||
input3.close();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
input3.close();
|
||||||
th2.start();
|
}
|
||||||
try {
|
});
|
||||||
input.prompt(2000);
|
th2.start();
|
||||||
fail("Closed prompt should cause an IO");
|
try {
|
||||||
} catch (final IOException e) {
|
input.prompt(2000);
|
||||||
// ok
|
fail("Closed prompt should cause an IO");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
}
|
// ok
|
||||||
|
}
|
||||||
@Test
|
}
|
||||||
public final void testConnect() throws IOException, InterruptedException {
|
|
||||||
final PluggableConsoleInput input = new PluggableConsoleInput();
|
@Test
|
||||||
|
public final void testConnect() throws IOException, InterruptedException {
|
||||||
input.disconnect();
|
final PluggableConsoleInput input = new PluggableConsoleInput();
|
||||||
try (final PipedInputStream pis = new PipedInputStream();
|
|
||||||
final PipedOutputStream pos = new PipedOutputStream();
|
input.disconnect();
|
||||||
final PipedInputStream inner = new PipedInputStream(pos);
|
try (final PipedInputStream pis = new PipedInputStream();
|
||||||
final PipedOutputStream innerPos = new PipedOutputStream(pis);
|
final PipedOutputStream pos = new PipedOutputStream();
|
||||||
final PrintStream testIn = new PrintStream(innerPos, true, "UTF8");
|
final PipedInputStream inner = new PipedInputStream(pos);
|
||||||
final PrintStream out = new PrintStream(pos)) {
|
final PipedOutputStream innerPos = new PipedOutputStream(pis);
|
||||||
input.connect(pis, out);
|
final PrintStream testIn = new PrintStream(innerPos, true, "UTF8");
|
||||||
try {
|
final PrintStream out = new PrintStream(pos)) {
|
||||||
input.connect(pis, out);
|
input.connect(pis, out);
|
||||||
fail("Should not be able to connect already connected");
|
try {
|
||||||
} catch (final IOException e) {
|
input.connect(pis, out);
|
||||||
// ok
|
fail("Should not be able to connect already connected");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
input.disconnect();
|
// ok
|
||||||
|
}
|
||||||
final Thread th = new Thread(new Runnable() {
|
input.disconnect();
|
||||||
|
|
||||||
@Override
|
final Thread th = new Thread(new Runnable() {
|
||||||
public void run() {
|
|
||||||
try {
|
@Override
|
||||||
input.prompt("Test", 5000);
|
public void run() {
|
||||||
} catch (final IOException e) {
|
try {
|
||||||
e.printStackTrace();
|
input.prompt("Test", 5000);
|
||||||
}
|
} catch (final IOException e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
});
|
}
|
||||||
th.start();
|
}
|
||||||
|
});
|
||||||
while (!input.isPrompting()) {
|
th.start();
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
while (!input.isPrompting()) {
|
||||||
|
Thread.sleep(10);
|
||||||
input.connect(pis, out);
|
}
|
||||||
testIn.println("tac");
|
|
||||||
|
input.connect(pis, out);
|
||||||
final Thread th2 = new Thread(new Runnable() {
|
testIn.println("tac");
|
||||||
|
|
||||||
@Override
|
final Thread th2 = new Thread(new Runnable() {
|
||||||
public void run() {
|
|
||||||
try {
|
@Override
|
||||||
input.prompt("Test", 5000);
|
public void run() {
|
||||||
fail("Prompt should io");
|
try {
|
||||||
} catch (final IOException e) {
|
input.prompt("Test", 5000);
|
||||||
// ok
|
fail("Prompt should io");
|
||||||
}
|
} catch (final IOException e) {
|
||||||
}
|
// ok
|
||||||
});
|
}
|
||||||
th2.start();
|
}
|
||||||
while (!input.isPrompting()) {
|
});
|
||||||
Thread.sleep(10);
|
th2.start();
|
||||||
}
|
while (!input.isPrompting()) {
|
||||||
|
Thread.sleep(10);
|
||||||
input.close();
|
}
|
||||||
|
|
||||||
|
input.close();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
}
|
||||||
/** Test method for
|
}
|
||||||
* {@link fr.bigeon.gclc.socket.PluggableConsoleInput#getPrompt()}. */
|
|
||||||
@Test
|
/** Test method for
|
||||||
public final void testGetPrompt() {
|
* {@link fr.bigeon.gclc.socket.PluggableConsoleInput#getPrompt()}. */
|
||||||
final PluggableConsoleInput input = new PluggableConsoleInput();
|
@Test
|
||||||
assertEquals("Default prompt invalid", "> ", input.getPrompt());
|
public final void testGetPrompt() {
|
||||||
input.setPrompt("test");
|
final PluggableConsoleInput input = new PluggableConsoleInput();
|
||||||
assertEquals("Prompt setting failed", "test", input.getPrompt());
|
assertEquals("Default prompt invalid", "> ", input.getPrompt().apply());
|
||||||
}
|
input.setPrompt("test");
|
||||||
}
|
assertEquals("Prompt setting failed", "test", input.getPrompt().apply());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,105 +1,107 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.RemoteDisconnectCommandTest.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Nov 18, 2017
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.RemoteDisconnectCommandTest.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Nov 18, 2017
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import static org.junit.Assert.assertFalse;
|
* #L%
|
||||||
import static org.junit.Assert.assertTrue;
|
*/
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import java.io.IOException;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import org.junit.Test;
|
import java.io.IOException;
|
||||||
|
|
||||||
import fr.bigeon.gclc.exception.CommandRunException;
|
import org.junit.Test;
|
||||||
import fr.bigeon.gclc.manager.PipedConsoleOutput;
|
|
||||||
|
import fr.bigeon.gclc.exception.CommandRunException;
|
||||||
/**
|
import fr.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
* <p>
|
|
||||||
* TODO
|
/**
|
||||||
*
|
* <p>
|
||||||
* @author Emmanuel Bigeon */
|
* TODO
|
||||||
public class RemoteDisconnectCommandTest {
|
*
|
||||||
|
* @author Emmanuel Bigeon */
|
||||||
/** Test method for
|
public class RemoteDisconnectCommandTest {
|
||||||
* {@link fr.bigeon.gclc.socket.RemoteDisconnectCommand#execute(fr.bigeon.gclc.manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput, java.lang.String[])}.
|
|
||||||
*
|
/** Test method for
|
||||||
* @throws CommandRunException if the command unexpectedly failed.
|
* {@link fr.bigeon.gclc.socket.RemoteDisconnectCommand#execute(fr.bigeon.gclc.manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput, java.lang.String[])}.
|
||||||
* @throws IOException if the output could not be written to */
|
*
|
||||||
@Test
|
* @throws CommandRunException if the command unexpectedly failed.
|
||||||
public final void testExecute() throws CommandRunException, IOException {
|
* @throws IOException if the output could not be written to */
|
||||||
final DConnexionManager<String> manager = new DConnexionManager<>();
|
@Test
|
||||||
final RemoteDisconnectCommand<String> cmd = new RemoteDisconnectCommand<>(
|
public final void testExecute() throws CommandRunException, IOException {
|
||||||
"quit", manager, true);
|
final DConnexionManager<String> manager = new DConnexionManager<>();
|
||||||
final RemoteDisconnectCommand<String> cmd2 = new RemoteDisconnectCommand<>(
|
final RemoteDisconnectCommand<String> cmd = new RemoteDisconnectCommand<>(
|
||||||
"quit", manager, false);
|
"quit", manager, true);
|
||||||
manager.addConnexion("test");
|
final RemoteDisconnectCommand<String> cmd2 = new RemoteDisconnectCommand<>(
|
||||||
|
"quit", manager, false);
|
||||||
cmd2.execute(null, null);
|
manager.addConnexion("test");
|
||||||
assertFalse("No arguemnt should remova no connections",
|
|
||||||
manager.getConnected().isEmpty());
|
cmd2.execute(null, null);
|
||||||
cmd.execute(null, null);
|
assertFalse("No arguemnt should remova no connections",
|
||||||
assertTrue("No arguemnt should remova all connections",
|
manager.getConnected().isEmpty());
|
||||||
manager.getConnected().isEmpty());
|
cmd.execute(null, null);
|
||||||
|
assertTrue("No arguemnt should remova all connections",
|
||||||
final String name1 = manager.addConnexion("test");
|
manager.getConnected().isEmpty());
|
||||||
final String name2 = manager.addConnexion("test");
|
|
||||||
|
final String name1 = manager.addConnexion("test");
|
||||||
cmd.execute(null, null, name1);
|
final String name2 = manager.addConnexion("test");
|
||||||
assertFalse("With argument shuld remove specified name",
|
|
||||||
manager.getConnected().contains(name1));
|
cmd.execute(null, null, name1);
|
||||||
assertTrue("With argument shuld remove only specified name",
|
assertFalse("With argument shuld remove specified name",
|
||||||
manager.getConnected().contains(name2));
|
manager.getConnected().contains(name1));
|
||||||
|
assertTrue("With argument shuld remove only specified name",
|
||||||
cmd.execute(null, null, name1);
|
manager.getConnected().contains(name2));
|
||||||
assertTrue("With argument shuld remove only specified name",
|
|
||||||
manager.getConnected().contains(name2));
|
cmd.execute(null, null, name1);
|
||||||
|
assertTrue("With argument shuld remove only specified name",
|
||||||
try (PipedConsoleOutput out = new PipedConsoleOutput()) {
|
manager.getConnected().contains(name2));
|
||||||
cmd.execute(out, null, name1);
|
|
||||||
assertTrue("With argument shuld remove only specified name",
|
try (PipedConsoleOutput out = new PipedConsoleOutput()) {
|
||||||
manager.getConnected().contains(name2));
|
cmd.execute(out, null, name1);
|
||||||
|
assertTrue("With argument shuld remove only specified name",
|
||||||
out.close();
|
manager.getConnected().contains(name2));
|
||||||
try {
|
|
||||||
cmd.execute(out, null, name1);
|
out.close();
|
||||||
fail("Closed stream should cause error in printing");
|
try {
|
||||||
} catch (final CommandRunException e) {
|
cmd.execute(out, null, name1);
|
||||||
// ok
|
fail("Closed stream should cause error in printing");
|
||||||
}
|
} catch (final CommandRunException e) {
|
||||||
}
|
// ok
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,169 +1,171 @@
|
|||||||
/*
|
/**
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
* gclc-socket:fr.bigeon.gclc.socket.SocketConsoleApplicationTest.java
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
* Created on: Jun 1, 2016
|
||||||
* mailto:emmanuel@bigeon.fr
|
*/
|
||||||
*
|
package fr.bigeon.gclc.socket;
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
/*-
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* #%L
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* GCLC Socket
|
||||||
* "http://www.cecill.info".
|
* %%
|
||||||
*
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* %%
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* This software is governed by the CeCILL license under French law and
|
||||||
* with a limited warranty and the software's author, the holder of the
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
* economic rights, and the successive licensors have only limited
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* liability.
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
*
|
* "http://www.cecill.info".
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
*
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* software by the user in light of its specific status of free software,
|
* modify and redistribute granted by the license, users are provided only
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* therefore means that it is reserved for developers and experienced
|
* economic rights, and the successive licensors have only limited
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* liability.
|
||||||
* encouraged to load and test the software's suitability as regards their
|
*
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* same conditions as regards security.
|
* software by the user in light of its specific status of free software,
|
||||||
*
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* The fact that you are presently reading this means that you have had
|
* therefore means that it is reserved for developers and experienced
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
*/
|
* encouraged to load and test the software's suitability as regards their
|
||||||
/**
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* gclc-socket:fr.bigeon.gclc.socket.SocketConsoleApplicationTest.java
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* Created on: Jun 1, 2016
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import static org.junit.Assert.assertEquals;
|
* #L%
|
||||||
|
*/
|
||||||
import java.io.BufferedReader;
|
import static org.junit.Assert.assertEquals;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.io.InputStreamReader;
|
||||||
import java.util.logging.Logger;
|
import java.io.PrintWriter;
|
||||||
|
import java.net.Socket;
|
||||||
import org.junit.Test;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/** Test class for {@link SocketConsoleApplicationShell}
|
import org.junit.Test;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon */
|
/** Test class for {@link SocketConsoleApplicationShell}
|
||||||
@SuppressWarnings({"static-method", "javadoc", "nls"})
|
*
|
||||||
public class SocketConsoleApplicationTest {
|
* @author Emmanuel Bigeon */
|
||||||
|
@SuppressWarnings({"static-method", "javadoc", "nls"})
|
||||||
private static final Logger LOGGER = Logger
|
public class SocketConsoleApplicationTest {
|
||||||
.getLogger(SocketConsoleApplicationTest.class.getName());
|
|
||||||
|
private static final Logger LOGGER = Logger
|
||||||
/** @param in the input
|
.getLogger(SocketConsoleApplicationTest.class.getName());
|
||||||
* @return the string
|
|
||||||
* @throws IOException if the input reading failed */
|
/** @param in the input
|
||||||
private String consumeToPrompt(final String server,
|
* @return the string
|
||||||
final BufferedReader in) throws IOException {
|
* @throws IOException if the input reading failed */
|
||||||
String fromServer = server;
|
private String consumeToPrompt(final String server,
|
||||||
LOGGER.fine("Server: \n" + fromServer);
|
final BufferedReader in) throws IOException {
|
||||||
while (fromServer != null && !fromServer.equals("Bye.") &&
|
String fromServer = server;
|
||||||
!fromServer.equals("> ")) {
|
LOGGER.fine("Server: \n" + fromServer);
|
||||||
fromServer = in.readLine();
|
while (fromServer != null && !fromServer.equals("Bye.") &&
|
||||||
LOGGER.fine("Server: \n" + fromServer);
|
!fromServer.equals("> ")) {
|
||||||
}
|
fromServer = in.readLine();
|
||||||
return fromServer;
|
LOGGER.fine("Server: \n" + fromServer);
|
||||||
}
|
}
|
||||||
|
return fromServer;
|
||||||
@Test
|
}
|
||||||
public void testIntegration() throws IOException, InterruptedException {
|
|
||||||
Thread server;
|
@Test
|
||||||
server = TestServer.getServer();
|
public void testIntegration() throws IOException, InterruptedException {
|
||||||
Thread.sleep(1000);
|
Thread server;
|
||||||
final String hostName = "127.0.0.1";
|
server = TestServer.getServer();
|
||||||
final int portNumber = 3300;
|
Thread.sleep(1000);
|
||||||
|
final String hostName = "127.0.0.1";
|
||||||
try (Socket kkSocket = new Socket(hostName, portNumber);
|
final int portNumber = 3300;
|
||||||
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
|
||||||
true);
|
try (Socket kkSocket = new Socket(hostName, portNumber);
|
||||||
BufferedReader in = new BufferedReader(
|
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
||||||
new InputStreamReader(kkSocket.getInputStream()));) {
|
true);
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
String fromServer;
|
new InputStreamReader(kkSocket.getInputStream()));) {
|
||||||
int i = -1;
|
|
||||||
final String[] cmds = {"help", "toto", "test", "out"};
|
String fromServer;
|
||||||
while ((fromServer = in.readLine()) != null) {
|
int i = -1;
|
||||||
i++;
|
final String[] cmds = {"help", "toto", "test", "out"};
|
||||||
fromServer = consumeToPrompt(fromServer, in);
|
while ((fromServer = in.readLine()) != null) {
|
||||||
if (fromServer == null || fromServer.equals("Bye.")) {
|
i++;
|
||||||
break;
|
fromServer = consumeToPrompt(fromServer, in);
|
||||||
}
|
if (fromServer == null || fromServer.equals("Bye.")) {
|
||||||
|
break;
|
||||||
final String fromUser = cmds[i];
|
}
|
||||||
if (fromUser != null) {
|
|
||||||
LOGGER.fine("Client: " + fromUser);
|
final String fromUser = cmds[i];
|
||||||
out.println(fromUser);
|
if (fromUser != null) {
|
||||||
}
|
LOGGER.fine("Client: " + fromUser);
|
||||||
}
|
out.println(fromUser);
|
||||||
assertEquals("Disconnection command should close connection", 3, i);
|
}
|
||||||
}
|
}
|
||||||
|
assertEquals("Disconnection command should close connection", 3, i);
|
||||||
try (Socket kkSocket = new Socket(hostName, portNumber);
|
}
|
||||||
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
|
||||||
true);
|
try (Socket kkSocket = new Socket(hostName, portNumber);
|
||||||
BufferedReader in = new BufferedReader(
|
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
||||||
new InputStreamReader(kkSocket.getInputStream()));) {
|
true);
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
String fromServer;
|
new InputStreamReader(kkSocket.getInputStream()));) {
|
||||||
int i = 0;
|
|
||||||
final String[] cmds = {"help", "toto", "test",
|
String fromServer;
|
||||||
ConsoleTestApplication.EXIT};
|
int i = 0;
|
||||||
while ((fromServer = in.readLine()) != null) {
|
final String[] cmds = {"help", "toto", "test",
|
||||||
fromServer = consumeToPrompt(fromServer, in);
|
ConsoleTestApplication.EXIT};
|
||||||
if (fromServer == null || fromServer.equals("Bye.")) {
|
while ((fromServer = in.readLine()) != null) {
|
||||||
break;
|
fromServer = consumeToPrompt(fromServer, in);
|
||||||
}
|
if (fromServer == null || fromServer.equals("Bye.")) {
|
||||||
LOGGER.info("Server: \n" + fromServer);
|
break;
|
||||||
|
}
|
||||||
final String fromUser = cmds[i];
|
LOGGER.info("Server: \n" + fromServer);
|
||||||
if (fromUser != null) {
|
|
||||||
LOGGER.info("Client: " + fromUser);
|
final String fromUser = cmds[i];
|
||||||
out.println(fromUser);
|
if (fromUser != null) {
|
||||||
}
|
LOGGER.info("Client: " + fromUser);
|
||||||
i++;
|
out.println(fromUser);
|
||||||
}
|
}
|
||||||
assertEquals("Application exit command should close connection", 4,
|
i++;
|
||||||
i);
|
}
|
||||||
}
|
assertEquals("Application exit command should close connection", 4,
|
||||||
Thread.sleep(100);
|
i);
|
||||||
TestServer.closeServer();
|
}
|
||||||
server.join();
|
Thread.sleep(100);
|
||||||
server = TestServer.getServer();
|
TestServer.closeServer();
|
||||||
Thread.sleep(1000);
|
server.join();
|
||||||
|
server = TestServer.getServer();
|
||||||
|
Thread.sleep(1000);
|
||||||
try (Socket kkSocket = new Socket(hostName, portNumber);
|
|
||||||
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
|
||||||
true);
|
try (Socket kkSocket = new Socket(hostName, portNumber);
|
||||||
BufferedReader in = new BufferedReader(
|
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
||||||
new InputStreamReader(kkSocket.getInputStream()));) {
|
true);
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
String fromServer;
|
new InputStreamReader(kkSocket.getInputStream()));) {
|
||||||
int i = 0;
|
|
||||||
final String[] cmds = {"help", "toto", "test",
|
String fromServer;
|
||||||
ConsoleTestApplication.EXIT};
|
int i = 0;
|
||||||
while ((fromServer = in.readLine()) != null) {
|
final String[] cmds = {"help", "toto", "test",
|
||||||
fromServer = consumeToPrompt(fromServer, in);
|
ConsoleTestApplication.EXIT};
|
||||||
if (fromServer == null || fromServer.equals("Bye.")) {
|
while ((fromServer = in.readLine()) != null) {
|
||||||
break;
|
fromServer = consumeToPrompt(fromServer, in);
|
||||||
}
|
if (fromServer == null || fromServer.equals("Bye.")) {
|
||||||
|
break;
|
||||||
final String fromUser = cmds[i];
|
}
|
||||||
if (fromUser != null) {
|
|
||||||
LOGGER.fine("Client: " + fromUser);
|
final String fromUser = cmds[i];
|
||||||
out.println(fromUser);
|
if (fromUser != null) {
|
||||||
}
|
LOGGER.fine("Client: " + fromUser);
|
||||||
i++;
|
out.println(fromUser);
|
||||||
}
|
}
|
||||||
assertEquals("Application exit command should close connection", 4,
|
i++;
|
||||||
i);
|
}
|
||||||
}
|
assertEquals("Application exit command should close connection", 4,
|
||||||
TestServer.closeServer();
|
i);
|
||||||
server.join();
|
}
|
||||||
}
|
TestServer.closeServer();
|
||||||
}
|
server.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,92 +1,94 @@
|
|||||||
/*
|
package fr.bigeon.gclc.socket;
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
/*-
|
||||||
* mailto:emmanuel@bigeon.fr
|
* #%L
|
||||||
*
|
* GCLC Socket
|
||||||
* This software is governed by the CeCILL license under French law and
|
* %%
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* %%
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* This software is governed by the CeCILL license under French law and
|
||||||
* "http://www.cecill.info".
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
*
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* "http://www.cecill.info".
|
||||||
* with a limited warranty and the software's author, the holder of the
|
*
|
||||||
* economic rights, and the successive licensors have only limited
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* liability.
|
* modify and redistribute granted by the license, users are provided only
|
||||||
*
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
* economic rights, and the successive licensors have only limited
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* liability.
|
||||||
* software by the user in light of its specific status of free software,
|
*
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* therefore means that it is reserved for developers and experienced
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* software by the user in light of its specific status of free software,
|
||||||
* encouraged to load and test the software's suitability as regards their
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* therefore means that it is reserved for developers and experienced
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
* same conditions as regards security.
|
* encouraged to load and test the software's suitability as regards their
|
||||||
*
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* The fact that you are presently reading this means that you have had
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.BufferedReader;
|
* #L%
|
||||||
import java.io.IOException;
|
*/
|
||||||
import java.io.InputStreamReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.io.PrintWriter;
|
||||||
import java.util.Collection;
|
import java.net.Socket;
|
||||||
|
import java.util.ArrayList;
|
||||||
import fr.bigeon.smu.StringEncoder;
|
import java.util.Collection;
|
||||||
|
|
||||||
/** TODO Describe TestConsoleClient.java
|
import fr.bigeon.smu.StringEncoder;
|
||||||
* @author Emmanuel Bigeon
|
|
||||||
*
|
/** TODO Describe TestConsoleClient.java
|
||||||
*/
|
* @author Emmanuel Bigeon
|
||||||
@SuppressWarnings("nls")
|
*
|
||||||
public class TestConsoleClient {
|
*/
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("nls")
|
||||||
private static final Collection<String> TO_ENCODE = new ArrayList<>();
|
public class TestConsoleClient {
|
||||||
static {
|
@SuppressWarnings("javadoc")
|
||||||
TO_ENCODE.add("\n");
|
private static final Collection<String> TO_ENCODE = new ArrayList<>();
|
||||||
}
|
static {
|
||||||
|
TO_ENCODE.add("\n");
|
||||||
@SuppressWarnings("javadoc")
|
}
|
||||||
private static final StringEncoder ENCODER = new StringEncoder("%",
|
|
||||||
TO_ENCODE);
|
@SuppressWarnings("javadoc")
|
||||||
|
private static final StringEncoder ENCODER = new StringEncoder("%",
|
||||||
@SuppressWarnings("javadoc")
|
TO_ENCODE);
|
||||||
public static void main(String[] args) {
|
|
||||||
final String hostName = "127.0.0.1";
|
@SuppressWarnings("javadoc")
|
||||||
final int portNumber = 3300;
|
public static void main(String[] args) {
|
||||||
|
final String hostName = "127.0.0.1";
|
||||||
try (Socket kkSocket = new Socket(hostName, portNumber);
|
final int portNumber = 3300;
|
||||||
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
|
||||||
true);
|
try (Socket kkSocket = new Socket(hostName, portNumber);
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(
|
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(),
|
||||||
kkSocket.getInputStream()));) {
|
true);
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(
|
||||||
String fromServer;
|
kkSocket.getInputStream()));) {
|
||||||
while ((fromServer = in.readLine()) != null) {
|
|
||||||
System.out.println("Server: \n" + ENCODER.decode(fromServer));
|
String fromServer;
|
||||||
if (fromServer.equals("Bye.")) {
|
while ((fromServer = in.readLine()) != null) {
|
||||||
break;
|
System.out.println("Server: \n" + ENCODER.decode(fromServer));
|
||||||
}
|
if (fromServer.equals("Bye.")) {
|
||||||
|
break;
|
||||||
final BufferedReader stdIn = new BufferedReader(
|
}
|
||||||
new InputStreamReader(System.in));
|
|
||||||
final String fromUser = stdIn.readLine();
|
final BufferedReader stdIn = new BufferedReader(
|
||||||
if (fromUser != null) {
|
new InputStreamReader(System.in));
|
||||||
System.out.println("Client: " + fromUser);
|
final String fromUser = stdIn.readLine();
|
||||||
out.println(fromUser);
|
if (fromUser != null) {
|
||||||
}
|
System.out.println("Client: " + fromUser);
|
||||||
}
|
out.println(fromUser);
|
||||||
} catch (final IOException e) {
|
}
|
||||||
// TODO Auto-generated catch block
|
}
|
||||||
e.printStackTrace();
|
} catch (final IOException e) {
|
||||||
}
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,105 +1,107 @@
|
|||||||
/*
|
package fr.bigeon.gclc.socket;
|
||||||
* GCLC Socket, Socket implementation of GCLC
|
|
||||||
* Copyright (C) 2014-2017 E. Bigeon
|
/*-
|
||||||
* mailto:emmanuel@bigeon.fr
|
* #%L
|
||||||
*
|
* GCLC Socket
|
||||||
* This software is governed by the CeCILL license under French law and
|
* %%
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
* Copyright (C) 2016 - 2018 Bigeon
|
||||||
* modify and/or redistribute the software under the terms of the CeCILL
|
* %%
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
* This software is governed by the CeCILL license under French law and
|
||||||
* "http://www.cecill.info".
|
* abiding by the rules of distribution of free software. You can use,
|
||||||
*
|
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
* modify and redistribute granted by the license, users are provided only
|
* "http://www.cecill.info".
|
||||||
* with a limited warranty and the software's author, the holder of the
|
*
|
||||||
* economic rights, and the successive licensors have only limited
|
* As a counterpart to the access to the source code and rights to copy,
|
||||||
* liability.
|
* modify and redistribute granted by the license, users are provided only
|
||||||
*
|
* with a limited warranty and the software's author, the holder of the
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
* economic rights, and the successive licensors have only limited
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
* liability.
|
||||||
* software by the user in light of its specific status of free software,
|
*
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
* In this respect, the user's attention is drawn to the risks associated
|
||||||
* therefore means that it is reserved for developers and experienced
|
* with loading, using, modifying and/or developing or reproducing the
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
* software by the user in light of its specific status of free software,
|
||||||
* encouraged to load and test the software's suitability as regards their
|
* that may mean that it is complicated to manipulate, and that also
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
* therefore means that it is reserved for developers and experienced
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
* professionals having in-depth computer knowledge. Users are therefore
|
||||||
* same conditions as regards security.
|
* encouraged to load and test the software's suitability as regards their
|
||||||
*
|
* requirements in conditions enabling the security of their systems and/or
|
||||||
* The fact that you are presently reading this means that you have had
|
* data to be ensured and, more generally, to use and operate it in the
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
* same conditions as regards security.
|
||||||
*/
|
*
|
||||||
package fr.bigeon.gclc.socket;
|
* The fact that you are presently reading this means that you have had
|
||||||
|
* knowledge of the CeCILL license and that you accept its terms.
|
||||||
import java.io.IOException;
|
* #L%
|
||||||
import java.net.InetAddress;
|
*/
|
||||||
import java.net.Socket;
|
import java.io.IOException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.InetAddress;
|
||||||
|
import java.net.Socket;
|
||||||
import fr.bigeon.gclc.ConsoleApplication;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
/** A test server
|
import fr.bigeon.gclc.ConsoleApplication;
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon */
|
/** A test server
|
||||||
@SuppressWarnings({"javadoc", "nls"})
|
*
|
||||||
public class TestServer {
|
* @author Emmanuel Bigeon */
|
||||||
|
@SuppressWarnings({"javadoc", "nls"})
|
||||||
private static SocketConsoleApplicationShell SHELL;
|
public class TestServer {
|
||||||
private static ConnexionManager<Socket> manager;
|
|
||||||
|
private static SocketConsoleApplicationShell SHELL;
|
||||||
private static Thread server;
|
private static ConnexionManager<Socket> manager;
|
||||||
private static PluggableConsoleInput input;
|
|
||||||
private static PluggableConsoleOutput output;
|
private static Thread server;
|
||||||
|
private static PluggableConsoleInput input;
|
||||||
public static synchronized void closeServer() {
|
private static PluggableConsoleOutput output;
|
||||||
SHELL.stop();
|
|
||||||
input.close();
|
public static synchronized void closeServer() {
|
||||||
output.close();
|
SHELL.stop();
|
||||||
SHELL = null;
|
input.close();
|
||||||
server = null;
|
output.close();
|
||||||
}
|
SHELL = null;
|
||||||
|
server = null;
|
||||||
public static synchronized Thread getServer() throws IOException {
|
}
|
||||||
if (server == null) {
|
|
||||||
server = new Thread(getShell(), "gclcServer");
|
public static synchronized Thread getServer() throws IOException {
|
||||||
server.start();
|
if (server == null) {
|
||||||
}
|
server = new Thread(getShell(), "gclcServer");
|
||||||
return server;
|
server.start();
|
||||||
}
|
}
|
||||||
|
return server;
|
||||||
private static SocketConsoleApplicationShell getShell() throws UnknownHostException {
|
}
|
||||||
if (SHELL == null) {
|
|
||||||
input = new PluggableConsoleInput();
|
private static SocketConsoleApplicationShell getShell() throws UnknownHostException {
|
||||||
input.setPrompt("> \n");
|
if (SHELL == null) {
|
||||||
output = new PluggableConsoleOutput();
|
input = new PluggableConsoleInput();
|
||||||
manager = new DConnexionManager<>();
|
input.setPrompt("> \n");
|
||||||
SHELL = new SocketConsoleApplicationShell(3300,
|
output = new PluggableConsoleOutput();
|
||||||
InetAddress.getByName("127.0.0.1"));
|
manager = new DConnexionManager<>();
|
||||||
final ConsoleApplication app = ConsoleTestApplication
|
SHELL = new SocketConsoleApplicationShell(3300,
|
||||||
.create(output, input, manager);
|
InetAddress.getByName("127.0.0.1"));
|
||||||
SHELL.setInterface(new SocketConsoleInterface(input, output));
|
final ConsoleApplication app = ConsoleTestApplication
|
||||||
SHELL.setConnexionManager(manager);
|
.create(output, input, manager);
|
||||||
SHELL.setApplication(app);
|
SHELL.setInterface(new SocketConsoleInterface(input, output));
|
||||||
final Thread th = new Thread(new Runnable() {
|
SHELL.setConnexionManager(manager);
|
||||||
|
SHELL.setApplication(app);
|
||||||
@Override
|
final Thread th = new Thread(new Runnable() {
|
||||||
public void run() {
|
|
||||||
app.start();
|
@Override
|
||||||
}
|
public void run() {
|
||||||
});
|
app.start();
|
||||||
th.start();
|
}
|
||||||
}
|
});
|
||||||
return SHELL;
|
th.start();
|
||||||
}
|
}
|
||||||
|
return SHELL;
|
||||||
/** @param args no argument
|
}
|
||||||
* @throws IOException if the server starting failed */
|
|
||||||
public static void main(final String... args) throws IOException {
|
/** @param args no argument
|
||||||
try {
|
* @throws IOException if the server starting failed */
|
||||||
getServer().join();
|
public static void main(final String... args) throws IOException {
|
||||||
} catch (final InterruptedException e) {
|
try {
|
||||||
e.printStackTrace();
|
getServer().join();
|
||||||
}
|
} catch (final InterruptedException e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
<artifactId>gclc</artifactId>
|
<artifactId>gclc</artifactId>
|
||||||
<version>2.0.6-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<url>http://www.bigeon.fr/emmanuel</url>
|
<url>http://www.bigeon.net</url>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.scm.id>git.bigeon.net</project.scm.id>
|
<project.scm.id>git.code.bigeon.net</project.scm.id>
|
||||||
<copyright.email>emmanuel@bigeon.fr</copyright.email>
|
<copyright.email>emmanuel@bigeon.fr</copyright.email>
|
||||||
<license.licenseName>cecill_2.1</license.licenseName>
|
<license.licenseName>cecill_2.1</license.licenseName>
|
||||||
</properties>
|
</properties>
|
||||||
@ -75,8 +75,8 @@
|
|||||||
<name>Generic Command Ligne console</name>
|
<name>Generic Command Ligne console</name>
|
||||||
<description>A generic framework for console applications, with customized command input and output streams.</description>
|
<description>A generic framework for console applications, with customized command input and output streams.</description>
|
||||||
<scm>
|
<scm>
|
||||||
|
|
||||||
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
||||||
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
<groupId>net.bigeon</groupId>
|
<groupId>net.bigeon</groupId>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
Reference in New Issue
Block a user